blob: 7a15116e52a1c45738a9f0eb9c80e54db47cffb1 [file] [log] [blame]
Norman James362a80f2015-09-14 14:04:39 -05001/*
Brad Bishop6bbf6462016-06-21 15:12:19 -04002 * Generated by gdbus-codegen 2.42.2. DO NOT EDIT.
Norman James362a80f2015-09-14 14:04:39 -05003 *
4 * The license of this code is the same as for the source it was derived from.
5 */
6
7#ifdef HAVE_CONFIG_H
8# include "config.h"
9#endif
10
Brad Bishopf6c85682016-06-27 11:56:39 -040011#include "openbmc_intf.h"
Norman James362a80f2015-09-14 14:04:39 -050012
13#include <string.h>
14#ifdef G_OS_UNIX
15# include <gio/gunixfdlist.h>
16#endif
17
18typedef struct
19{
20 GDBusArgInfo parent_struct;
21 gboolean use_gvariant;
22} _ExtendedGDBusArgInfo;
23
24typedef struct
25{
26 GDBusMethodInfo parent_struct;
27 const gchar *signal_name;
28 gboolean pass_fdlist;
29} _ExtendedGDBusMethodInfo;
30
31typedef struct
32{
33 GDBusSignalInfo parent_struct;
34 const gchar *signal_name;
35} _ExtendedGDBusSignalInfo;
36
37typedef struct
38{
39 GDBusPropertyInfo parent_struct;
40 const gchar *hyphen_name;
41 gboolean use_gvariant;
42} _ExtendedGDBusPropertyInfo;
43
44typedef struct
45{
46 GDBusInterfaceInfo parent_struct;
47 const gchar *hyphen_name;
48} _ExtendedGDBusInterfaceInfo;
49
50typedef struct
51{
52 const _ExtendedGDBusPropertyInfo *info;
53 guint prop_id;
54 GValue orig_value; /* the value before the change */
55} ChangedProperty;
56
57static void
58_changed_property_free (ChangedProperty *data)
59{
60 g_value_unset (&data->orig_value);
61 g_free (data);
62}
63
64static gboolean
65_g_strv_equal0 (gchar **a, gchar **b)
66{
67 gboolean ret = FALSE;
68 guint n;
69 if (a == NULL && b == NULL)
70 {
71 ret = TRUE;
72 goto out;
73 }
74 if (a == NULL || b == NULL)
75 goto out;
76 if (g_strv_length (a) != g_strv_length (b))
77 goto out;
78 for (n = 0; a[n] != NULL; n++)
79 if (g_strcmp0 (a[n], b[n]) != 0)
80 goto out;
81 ret = TRUE;
82out:
83 return ret;
84}
85
86static gboolean
87_g_variant_equal0 (GVariant *a, GVariant *b)
88{
89 gboolean ret = FALSE;
90 if (a == NULL && b == NULL)
91 {
92 ret = TRUE;
93 goto out;
94 }
95 if (a == NULL || b == NULL)
96 goto out;
97 ret = g_variant_equal (a, b);
98out:
99 return ret;
100}
101
102G_GNUC_UNUSED static gboolean
103_g_value_equal (const GValue *a, const GValue *b)
104{
105 gboolean ret = FALSE;
106 g_assert (G_VALUE_TYPE (a) == G_VALUE_TYPE (b));
107 switch (G_VALUE_TYPE (a))
108 {
109 case G_TYPE_BOOLEAN:
110 ret = (g_value_get_boolean (a) == g_value_get_boolean (b));
111 break;
112 case G_TYPE_UCHAR:
113 ret = (g_value_get_uchar (a) == g_value_get_uchar (b));
114 break;
115 case G_TYPE_INT:
116 ret = (g_value_get_int (a) == g_value_get_int (b));
117 break;
118 case G_TYPE_UINT:
119 ret = (g_value_get_uint (a) == g_value_get_uint (b));
120 break;
121 case G_TYPE_INT64:
122 ret = (g_value_get_int64 (a) == g_value_get_int64 (b));
123 break;
124 case G_TYPE_UINT64:
125 ret = (g_value_get_uint64 (a) == g_value_get_uint64 (b));
126 break;
127 case G_TYPE_DOUBLE:
128 {
129 /* Avoid -Wfloat-equal warnings by doing a direct bit compare */
130 gdouble da = g_value_get_double (a);
131 gdouble db = g_value_get_double (b);
132 ret = memcmp (&da, &db, sizeof (gdouble)) == 0;
133 }
134 break;
135 case G_TYPE_STRING:
136 ret = (g_strcmp0 (g_value_get_string (a), g_value_get_string (b)) == 0);
137 break;
138 case G_TYPE_VARIANT:
139 ret = _g_variant_equal0 (g_value_get_variant (a), g_value_get_variant (b));
140 break;
141 default:
142 if (G_VALUE_TYPE (a) == G_TYPE_STRV)
143 ret = _g_strv_equal0 (g_value_get_boxed (a), g_value_get_boxed (b));
144 else
145 g_critical ("_g_value_equal() does not handle type %s", g_type_name (G_VALUE_TYPE (a)));
146 break;
147 }
148 return ret;
149}
150
151/* ------------------------------------------------------------------------
Norman James5236a8f2015-11-05 20:39:31 -0600152 * Code for interface org.openbmc.Hwmon
153 * ------------------------------------------------------------------------
154 */
155
156/**
157 * SECTION:Hwmon
158 * @title: Hwmon
159 * @short_description: Generated C code for the org.openbmc.Hwmon D-Bus interface
160 *
161 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-Hwmon.top_of_page">org.openbmc.Hwmon</link> D-Bus interface in C.
162 */
163
164/* ---- Introspection data for org.openbmc.Hwmon ---- */
165
166static const _ExtendedGDBusPropertyInfo _hwmon_property_info_poll_interval =
167{
168 {
169 -1,
170 (gchar *) "poll_interval",
171 (gchar *) "i",
172 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
173 NULL
174 },
175 "poll-interval",
176 FALSE
177};
178
179static const _ExtendedGDBusPropertyInfo _hwmon_property_info_sysfs_path =
180{
181 {
182 -1,
183 (gchar *) "sysfs_path",
184 (gchar *) "s",
185 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
186 NULL
187 },
188 "sysfs-path",
189 FALSE
190};
191
Norman James74828452015-11-17 13:10:34 -0600192static const _ExtendedGDBusPropertyInfo _hwmon_property_info_scale =
Norman James5236a8f2015-11-05 20:39:31 -0600193{
194 {
195 -1,
Norman James74828452015-11-17 13:10:34 -0600196 (gchar *) "scale",
197 (gchar *) "i",
Norman James5236a8f2015-11-05 20:39:31 -0600198 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
199 NULL
200 },
Norman James74828452015-11-17 13:10:34 -0600201 "scale",
Norman James5236a8f2015-11-05 20:39:31 -0600202 FALSE
203};
204
205static const _ExtendedGDBusPropertyInfo * const _hwmon_property_info_pointers[] =
206{
207 &_hwmon_property_info_poll_interval,
208 &_hwmon_property_info_sysfs_path,
Norman James74828452015-11-17 13:10:34 -0600209 &_hwmon_property_info_scale,
Norman James5236a8f2015-11-05 20:39:31 -0600210 NULL
211};
212
213static const _ExtendedGDBusInterfaceInfo _hwmon_interface_info =
214{
215 {
216 -1,
217 (gchar *) "org.openbmc.Hwmon",
218 NULL,
219 NULL,
220 (GDBusPropertyInfo **) &_hwmon_property_info_pointers,
221 NULL
222 },
223 "hwmon",
224};
225
226
227/**
228 * hwmon_interface_info:
229 *
230 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Hwmon.top_of_page">org.openbmc.Hwmon</link> D-Bus interface.
231 *
232 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
233 */
234GDBusInterfaceInfo *
235hwmon_interface_info (void)
236{
237 return (GDBusInterfaceInfo *) &_hwmon_interface_info.parent_struct;
238}
239
240/**
241 * hwmon_override_properties:
242 * @klass: The class structure for a #GObject<!-- -->-derived class.
243 * @property_id_begin: The property id to assign to the first overridden property.
244 *
245 * Overrides all #GObject properties in the #Hwmon interface for a concrete class.
246 * The properties are overridden in the order they are defined.
247 *
248 * Returns: The last property id.
249 */
250guint
251hwmon_override_properties (GObjectClass *klass, guint property_id_begin)
252{
253 g_object_class_override_property (klass, property_id_begin++, "poll-interval");
254 g_object_class_override_property (klass, property_id_begin++, "sysfs-path");
Norman James74828452015-11-17 13:10:34 -0600255 g_object_class_override_property (klass, property_id_begin++, "scale");
Norman James5236a8f2015-11-05 20:39:31 -0600256 return property_id_begin - 1;
257}
258
259
260
261/**
262 * Hwmon:
263 *
264 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Hwmon.top_of_page">org.openbmc.Hwmon</link>.
265 */
266
267/**
268 * HwmonIface:
269 * @parent_iface: The parent interface.
270 * @get_poll_interval: Getter for the #Hwmon:poll-interval property.
Norman James74828452015-11-17 13:10:34 -0600271 * @get_scale: Getter for the #Hwmon:scale property.
Norman James5236a8f2015-11-05 20:39:31 -0600272 * @get_sysfs_path: Getter for the #Hwmon:sysfs-path property.
Norman James5236a8f2015-11-05 20:39:31 -0600273 *
274 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Hwmon.top_of_page">org.openbmc.Hwmon</link>.
275 */
276
277typedef HwmonIface HwmonInterface;
278G_DEFINE_INTERFACE (Hwmon, hwmon, G_TYPE_OBJECT);
279
280static void
281hwmon_default_init (HwmonIface *iface)
282{
283 /* GObject properties for D-Bus properties: */
284 /**
285 * Hwmon:poll-interval:
286 *
287 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Hwmon.poll_interval">"poll_interval"</link>.
288 *
289 * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.
290 */
291 g_object_interface_install_property (iface,
292 g_param_spec_int ("poll-interval", "poll_interval", "poll_interval", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
293 /**
294 * Hwmon:sysfs-path:
295 *
296 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Hwmon.sysfs_path">"sysfs_path"</link>.
297 *
298 * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.
299 */
300 g_object_interface_install_property (iface,
301 g_param_spec_string ("sysfs-path", "sysfs_path", "sysfs_path", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
302 /**
Norman James74828452015-11-17 13:10:34 -0600303 * Hwmon:scale:
Norman James5236a8f2015-11-05 20:39:31 -0600304 *
Norman James74828452015-11-17 13:10:34 -0600305 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Hwmon.scale">"scale"</link>.
Norman James5236a8f2015-11-05 20:39:31 -0600306 *
307 * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.
308 */
309 g_object_interface_install_property (iface,
Norman James74828452015-11-17 13:10:34 -0600310 g_param_spec_int ("scale", "scale", "scale", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Norman James5236a8f2015-11-05 20:39:31 -0600311}
312
313/**
314 * hwmon_get_poll_interval: (skip)
315 * @object: A #Hwmon.
316 *
317 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Hwmon.poll_interval">"poll_interval"</link> D-Bus property.
318 *
319 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
320 *
321 * Returns: The property value.
322 */
323gint
324hwmon_get_poll_interval (Hwmon *object)
325{
326 return HWMON_GET_IFACE (object)->get_poll_interval (object);
327}
328
329/**
330 * hwmon_set_poll_interval: (skip)
331 * @object: A #Hwmon.
332 * @value: The value to set.
333 *
334 * Sets the <link linkend="gdbus-property-org-openbmc-Hwmon.poll_interval">"poll_interval"</link> D-Bus property to @value.
335 *
336 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
337 */
338void
339hwmon_set_poll_interval (Hwmon *object, gint value)
340{
341 g_object_set (G_OBJECT (object), "poll-interval", value, NULL);
342}
343
344/**
345 * hwmon_get_sysfs_path: (skip)
346 * @object: A #Hwmon.
347 *
348 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Hwmon.sysfs_path">"sysfs_path"</link> D-Bus property.
349 *
350 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
351 *
352 * <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 hwmon_dup_sysfs_path() if on another thread.</warning>
353 *
354 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
355 */
356const gchar *
357hwmon_get_sysfs_path (Hwmon *object)
358{
359 return HWMON_GET_IFACE (object)->get_sysfs_path (object);
360}
361
362/**
363 * hwmon_dup_sysfs_path: (skip)
364 * @object: A #Hwmon.
365 *
366 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Hwmon.sysfs_path">"sysfs_path"</link> D-Bus property.
367 *
368 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
369 *
370 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
371 */
372gchar *
373hwmon_dup_sysfs_path (Hwmon *object)
374{
375 gchar *value;
376 g_object_get (G_OBJECT (object), "sysfs-path", &value, NULL);
377 return value;
378}
379
380/**
381 * hwmon_set_sysfs_path: (skip)
382 * @object: A #Hwmon.
383 * @value: The value to set.
384 *
385 * Sets the <link linkend="gdbus-property-org-openbmc-Hwmon.sysfs_path">"sysfs_path"</link> D-Bus property to @value.
386 *
387 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
388 */
389void
390hwmon_set_sysfs_path (Hwmon *object, const gchar *value)
391{
392 g_object_set (G_OBJECT (object), "sysfs-path", value, NULL);
393}
394
395/**
Norman James74828452015-11-17 13:10:34 -0600396 * hwmon_get_scale: (skip)
Norman James5236a8f2015-11-05 20:39:31 -0600397 * @object: A #Hwmon.
398 *
Norman James74828452015-11-17 13:10:34 -0600399 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Hwmon.scale">"scale"</link> D-Bus property.
Norman James5236a8f2015-11-05 20:39:31 -0600400 *
401 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
402 *
Norman James74828452015-11-17 13:10:34 -0600403 * Returns: The property value.
Norman James5236a8f2015-11-05 20:39:31 -0600404 */
Norman James74828452015-11-17 13:10:34 -0600405gint
406hwmon_get_scale (Hwmon *object)
Norman James5236a8f2015-11-05 20:39:31 -0600407{
Norman James74828452015-11-17 13:10:34 -0600408 return HWMON_GET_IFACE (object)->get_scale (object);
Norman James5236a8f2015-11-05 20:39:31 -0600409}
410
411/**
Norman James74828452015-11-17 13:10:34 -0600412 * hwmon_set_scale: (skip)
Norman James5236a8f2015-11-05 20:39:31 -0600413 * @object: A #Hwmon.
414 * @value: The value to set.
415 *
Norman James74828452015-11-17 13:10:34 -0600416 * Sets the <link linkend="gdbus-property-org-openbmc-Hwmon.scale">"scale"</link> D-Bus property to @value.
Norman James5236a8f2015-11-05 20:39:31 -0600417 *
418 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
419 */
420void
Norman James74828452015-11-17 13:10:34 -0600421hwmon_set_scale (Hwmon *object, gint value)
Norman James5236a8f2015-11-05 20:39:31 -0600422{
Norman James74828452015-11-17 13:10:34 -0600423 g_object_set (G_OBJECT (object), "scale", value, NULL);
Norman James5236a8f2015-11-05 20:39:31 -0600424}
425
426/* ------------------------------------------------------------------------ */
427
428/**
429 * HwmonProxy:
430 *
431 * The #HwmonProxy structure contains only private data and should only be accessed using the provided API.
432 */
433
434/**
435 * HwmonProxyClass:
436 * @parent_class: The parent class.
437 *
438 * Class structure for #HwmonProxy.
439 */
440
441struct _HwmonProxyPrivate
442{
443 GData *qdata;
444};
445
446static void hwmon_proxy_iface_init (HwmonIface *iface);
447
448#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
449G_DEFINE_TYPE_WITH_CODE (HwmonProxy, hwmon_proxy, G_TYPE_DBUS_PROXY,
450 G_ADD_PRIVATE (HwmonProxy)
451 G_IMPLEMENT_INTERFACE (TYPE_HWMON, hwmon_proxy_iface_init));
452
453#else
454G_DEFINE_TYPE_WITH_CODE (HwmonProxy, hwmon_proxy, G_TYPE_DBUS_PROXY,
455 G_IMPLEMENT_INTERFACE (TYPE_HWMON, hwmon_proxy_iface_init));
456
457#endif
458static void
459hwmon_proxy_finalize (GObject *object)
460{
461 HwmonProxy *proxy = HWMON_PROXY (object);
462 g_datalist_clear (&proxy->priv->qdata);
463 G_OBJECT_CLASS (hwmon_proxy_parent_class)->finalize (object);
464}
465
466static void
467hwmon_proxy_get_property (GObject *object,
468 guint prop_id,
469 GValue *value,
470 GParamSpec *pspec G_GNUC_UNUSED)
471{
472 const _ExtendedGDBusPropertyInfo *info;
473 GVariant *variant;
474 g_assert (prop_id != 0 && prop_id - 1 < 3);
475 info = _hwmon_property_info_pointers[prop_id - 1];
476 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
477 if (info->use_gvariant)
478 {
479 g_value_set_variant (value, variant);
480 }
481 else
482 {
483 if (variant != NULL)
484 g_dbus_gvariant_to_gvalue (variant, value);
485 }
486 if (variant != NULL)
487 g_variant_unref (variant);
488}
489
490static void
491hwmon_proxy_set_property_cb (GDBusProxy *proxy,
492 GAsyncResult *res,
493 gpointer user_data)
494{
495 const _ExtendedGDBusPropertyInfo *info = user_data;
496 GError *error;
497 GVariant *_ret;
498 error = NULL;
499 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
500 if (!_ret)
501 {
502 g_warning ("Error setting property '%s' on interface org.openbmc.Hwmon: %s (%s, %d)",
503 info->parent_struct.name,
504 error->message, g_quark_to_string (error->domain), error->code);
505 g_error_free (error);
506 }
507 else
508 {
509 g_variant_unref (_ret);
510 }
511}
512
513static void
514hwmon_proxy_set_property (GObject *object,
515 guint prop_id,
516 const GValue *value,
517 GParamSpec *pspec G_GNUC_UNUSED)
518{
519 const _ExtendedGDBusPropertyInfo *info;
520 GVariant *variant;
521 g_assert (prop_id != 0 && prop_id - 1 < 3);
522 info = _hwmon_property_info_pointers[prop_id - 1];
523 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
524 g_dbus_proxy_call (G_DBUS_PROXY (object),
525 "org.freedesktop.DBus.Properties.Set",
526 g_variant_new ("(ssv)", "org.openbmc.Hwmon", info->parent_struct.name, variant),
527 G_DBUS_CALL_FLAGS_NONE,
528 -1,
529 NULL, (GAsyncReadyCallback) hwmon_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
530 g_variant_unref (variant);
531}
532
533static void
534hwmon_proxy_g_signal (GDBusProxy *proxy,
535 const gchar *sender_name G_GNUC_UNUSED,
536 const gchar *signal_name,
537 GVariant *parameters)
538{
539 _ExtendedGDBusSignalInfo *info;
540 GVariantIter iter;
541 GVariant *child;
542 GValue *paramv;
543 guint num_params;
544 guint n;
545 guint signal_id;
546 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_hwmon_interface_info.parent_struct, signal_name);
547 if (info == NULL)
548 return;
549 num_params = g_variant_n_children (parameters);
550 paramv = g_new0 (GValue, num_params + 1);
551 g_value_init (&paramv[0], TYPE_HWMON);
552 g_value_set_object (&paramv[0], proxy);
553 g_variant_iter_init (&iter, parameters);
554 n = 1;
555 while ((child = g_variant_iter_next_value (&iter)) != NULL)
556 {
557 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
558 if (arg_info->use_gvariant)
559 {
560 g_value_init (&paramv[n], G_TYPE_VARIANT);
561 g_value_set_variant (&paramv[n], child);
562 n++;
563 }
564 else
565 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
566 g_variant_unref (child);
567 }
568 signal_id = g_signal_lookup (info->signal_name, TYPE_HWMON);
569 g_signal_emitv (paramv, signal_id, 0, NULL);
570 for (n = 0; n < num_params + 1; n++)
571 g_value_unset (&paramv[n]);
572 g_free (paramv);
573}
574
575static void
576hwmon_proxy_g_properties_changed (GDBusProxy *_proxy,
577 GVariant *changed_properties,
578 const gchar *const *invalidated_properties)
579{
580 HwmonProxy *proxy = HWMON_PROXY (_proxy);
581 guint n;
582 const gchar *key;
583 GVariantIter *iter;
584 _ExtendedGDBusPropertyInfo *info;
585 g_variant_get (changed_properties, "a{sv}", &iter);
586 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
587 {
588 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_hwmon_interface_info.parent_struct, key);
589 g_datalist_remove_data (&proxy->priv->qdata, key);
590 if (info != NULL)
591 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
592 }
593 g_variant_iter_free (iter);
594 for (n = 0; invalidated_properties[n] != NULL; n++)
595 {
596 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_hwmon_interface_info.parent_struct, invalidated_properties[n]);
597 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
598 if (info != NULL)
599 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
600 }
601}
602
603static gint
604hwmon_proxy_get_poll_interval (Hwmon *object)
605{
606 HwmonProxy *proxy = HWMON_PROXY (object);
607 GVariant *variant;
608 gint value = 0;
609 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "poll_interval");
610 if (variant != NULL)
611 {
612 value = g_variant_get_int32 (variant);
613 g_variant_unref (variant);
614 }
615 return value;
616}
617
618static const gchar *
619hwmon_proxy_get_sysfs_path (Hwmon *object)
620{
621 HwmonProxy *proxy = HWMON_PROXY (object);
622 GVariant *variant;
623 const gchar *value = NULL;
624 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "sysfs_path");
625 if (variant != NULL)
626 {
627 value = g_variant_get_string (variant, NULL);
628 g_variant_unref (variant);
629 }
630 return value;
631}
632
Norman James74828452015-11-17 13:10:34 -0600633static gint
634hwmon_proxy_get_scale (Hwmon *object)
Norman James5236a8f2015-11-05 20:39:31 -0600635{
636 HwmonProxy *proxy = HWMON_PROXY (object);
637 GVariant *variant;
Norman James74828452015-11-17 13:10:34 -0600638 gint value = 0;
639 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "scale");
Norman James5236a8f2015-11-05 20:39:31 -0600640 if (variant != NULL)
Norman James74828452015-11-17 13:10:34 -0600641 {
642 value = g_variant_get_int32 (variant);
643 g_variant_unref (variant);
644 }
Norman James5236a8f2015-11-05 20:39:31 -0600645 return value;
646}
647
648static void
649hwmon_proxy_init (HwmonProxy *proxy)
650{
651#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
652 proxy->priv = hwmon_proxy_get_instance_private (proxy);
653#else
654 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_HWMON_PROXY, HwmonProxyPrivate);
655#endif
656
657 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), hwmon_interface_info ());
658}
659
660static void
661hwmon_proxy_class_init (HwmonProxyClass *klass)
662{
663 GObjectClass *gobject_class;
664 GDBusProxyClass *proxy_class;
665
666 gobject_class = G_OBJECT_CLASS (klass);
667 gobject_class->finalize = hwmon_proxy_finalize;
668 gobject_class->get_property = hwmon_proxy_get_property;
669 gobject_class->set_property = hwmon_proxy_set_property;
670
671 proxy_class = G_DBUS_PROXY_CLASS (klass);
672 proxy_class->g_signal = hwmon_proxy_g_signal;
673 proxy_class->g_properties_changed = hwmon_proxy_g_properties_changed;
674
675 hwmon_override_properties (gobject_class, 1);
676
677#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
678 g_type_class_add_private (klass, sizeof (HwmonProxyPrivate));
679#endif
680}
681
682static void
683hwmon_proxy_iface_init (HwmonIface *iface)
684{
685 iface->get_poll_interval = hwmon_proxy_get_poll_interval;
686 iface->get_sysfs_path = hwmon_proxy_get_sysfs_path;
Norman James74828452015-11-17 13:10:34 -0600687 iface->get_scale = hwmon_proxy_get_scale;
Norman James5236a8f2015-11-05 20:39:31 -0600688}
689
690/**
691 * hwmon_proxy_new:
692 * @connection: A #GDBusConnection.
693 * @flags: Flags from the #GDBusProxyFlags enumeration.
694 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
695 * @object_path: An object path.
696 * @cancellable: (allow-none): A #GCancellable or %NULL.
697 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
698 * @user_data: User data to pass to @callback.
699 *
700 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Hwmon.top_of_page">org.openbmc.Hwmon</link>. See g_dbus_proxy_new() for more details.
701 *
702 * 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.
703 * You can then call hwmon_proxy_new_finish() to get the result of the operation.
704 *
705 * See hwmon_proxy_new_sync() for the synchronous, blocking version of this constructor.
706 */
707void
708hwmon_proxy_new (
709 GDBusConnection *connection,
710 GDBusProxyFlags flags,
711 const gchar *name,
712 const gchar *object_path,
713 GCancellable *cancellable,
714 GAsyncReadyCallback callback,
715 gpointer user_data)
716{
717 g_async_initable_new_async (TYPE_HWMON_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.Hwmon", NULL);
718}
719
720/**
721 * hwmon_proxy_new_finish:
722 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to hwmon_proxy_new().
723 * @error: Return location for error or %NULL
724 *
725 * Finishes an operation started with hwmon_proxy_new().
726 *
727 * Returns: (transfer full) (type HwmonProxy): The constructed proxy object or %NULL if @error is set.
728 */
729Hwmon *
730hwmon_proxy_new_finish (
731 GAsyncResult *res,
732 GError **error)
733{
734 GObject *ret;
735 GObject *source_object;
736 source_object = g_async_result_get_source_object (res);
737 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
738 g_object_unref (source_object);
739 if (ret != NULL)
740 return HWMON (ret);
741 else
742 return NULL;
743}
744
745/**
746 * hwmon_proxy_new_sync:
747 * @connection: A #GDBusConnection.
748 * @flags: Flags from the #GDBusProxyFlags enumeration.
749 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
750 * @object_path: An object path.
751 * @cancellable: (allow-none): A #GCancellable or %NULL.
752 * @error: Return location for error or %NULL
753 *
754 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Hwmon.top_of_page">org.openbmc.Hwmon</link>. See g_dbus_proxy_new_sync() for more details.
755 *
756 * The calling thread is blocked until a reply is received.
757 *
758 * See hwmon_proxy_new() for the asynchronous version of this constructor.
759 *
760 * Returns: (transfer full) (type HwmonProxy): The constructed proxy object or %NULL if @error is set.
761 */
762Hwmon *
763hwmon_proxy_new_sync (
764 GDBusConnection *connection,
765 GDBusProxyFlags flags,
766 const gchar *name,
767 const gchar *object_path,
768 GCancellable *cancellable,
769 GError **error)
770{
771 GInitable *ret;
772 ret = g_initable_new (TYPE_HWMON_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.Hwmon", NULL);
773 if (ret != NULL)
774 return HWMON (ret);
775 else
776 return NULL;
777}
778
779
780/**
781 * hwmon_proxy_new_for_bus:
782 * @bus_type: A #GBusType.
783 * @flags: Flags from the #GDBusProxyFlags enumeration.
784 * @name: A bus name (well-known or unique).
785 * @object_path: An object path.
786 * @cancellable: (allow-none): A #GCancellable or %NULL.
787 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
788 * @user_data: User data to pass to @callback.
789 *
790 * Like hwmon_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
791 *
792 * 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.
793 * You can then call hwmon_proxy_new_for_bus_finish() to get the result of the operation.
794 *
795 * See hwmon_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
796 */
797void
798hwmon_proxy_new_for_bus (
799 GBusType bus_type,
800 GDBusProxyFlags flags,
801 const gchar *name,
802 const gchar *object_path,
803 GCancellable *cancellable,
804 GAsyncReadyCallback callback,
805 gpointer user_data)
806{
807 g_async_initable_new_async (TYPE_HWMON_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.Hwmon", NULL);
808}
809
810/**
811 * hwmon_proxy_new_for_bus_finish:
812 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to hwmon_proxy_new_for_bus().
813 * @error: Return location for error or %NULL
814 *
815 * Finishes an operation started with hwmon_proxy_new_for_bus().
816 *
817 * Returns: (transfer full) (type HwmonProxy): The constructed proxy object or %NULL if @error is set.
818 */
819Hwmon *
820hwmon_proxy_new_for_bus_finish (
821 GAsyncResult *res,
822 GError **error)
823{
824 GObject *ret;
825 GObject *source_object;
826 source_object = g_async_result_get_source_object (res);
827 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
828 g_object_unref (source_object);
829 if (ret != NULL)
830 return HWMON (ret);
831 else
832 return NULL;
833}
834
835/**
836 * hwmon_proxy_new_for_bus_sync:
837 * @bus_type: A #GBusType.
838 * @flags: Flags from the #GDBusProxyFlags enumeration.
839 * @name: A bus name (well-known or unique).
840 * @object_path: An object path.
841 * @cancellable: (allow-none): A #GCancellable or %NULL.
842 * @error: Return location for error or %NULL
843 *
844 * Like hwmon_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
845 *
846 * The calling thread is blocked until a reply is received.
847 *
848 * See hwmon_proxy_new_for_bus() for the asynchronous version of this constructor.
849 *
850 * Returns: (transfer full) (type HwmonProxy): The constructed proxy object or %NULL if @error is set.
851 */
852Hwmon *
853hwmon_proxy_new_for_bus_sync (
854 GBusType bus_type,
855 GDBusProxyFlags flags,
856 const gchar *name,
857 const gchar *object_path,
858 GCancellable *cancellable,
859 GError **error)
860{
861 GInitable *ret;
862 ret = g_initable_new (TYPE_HWMON_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.Hwmon", NULL);
863 if (ret != NULL)
864 return HWMON (ret);
865 else
866 return NULL;
867}
868
869
870/* ------------------------------------------------------------------------ */
871
872/**
873 * HwmonSkeleton:
874 *
875 * The #HwmonSkeleton structure contains only private data and should only be accessed using the provided API.
876 */
877
878/**
879 * HwmonSkeletonClass:
880 * @parent_class: The parent class.
881 *
882 * Class structure for #HwmonSkeleton.
883 */
884
885struct _HwmonSkeletonPrivate
886{
887 GValue *properties;
888 GList *changed_properties;
889 GSource *changed_properties_idle_source;
890 GMainContext *context;
891 GMutex lock;
892};
893
894static void
895_hwmon_skeleton_handle_method_call (
896 GDBusConnection *connection G_GNUC_UNUSED,
897 const gchar *sender G_GNUC_UNUSED,
898 const gchar *object_path G_GNUC_UNUSED,
899 const gchar *interface_name,
900 const gchar *method_name,
901 GVariant *parameters,
902 GDBusMethodInvocation *invocation,
903 gpointer user_data)
904{
905 HwmonSkeleton *skeleton = HWMON_SKELETON (user_data);
906 _ExtendedGDBusMethodInfo *info;
907 GVariantIter iter;
908 GVariant *child;
909 GValue *paramv;
910 guint num_params;
911 guint num_extra;
912 guint n;
913 guint signal_id;
914 GValue return_value = G_VALUE_INIT;
915 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
916 g_assert (info != NULL);
917 num_params = g_variant_n_children (parameters);
918 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
919 n = 0;
920 g_value_init (&paramv[n], TYPE_HWMON);
921 g_value_set_object (&paramv[n++], skeleton);
922 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
923 g_value_set_object (&paramv[n++], invocation);
924 if (info->pass_fdlist)
925 {
926#ifdef G_OS_UNIX
927 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
928 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
929#else
930 g_assert_not_reached ();
931#endif
932 }
933 g_variant_iter_init (&iter, parameters);
934 while ((child = g_variant_iter_next_value (&iter)) != NULL)
935 {
936 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
937 if (arg_info->use_gvariant)
938 {
939 g_value_init (&paramv[n], G_TYPE_VARIANT);
940 g_value_set_variant (&paramv[n], child);
941 n++;
942 }
943 else
944 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
945 g_variant_unref (child);
946 }
947 signal_id = g_signal_lookup (info->signal_name, TYPE_HWMON);
948 g_value_init (&return_value, G_TYPE_BOOLEAN);
949 g_signal_emitv (paramv, signal_id, 0, &return_value);
950 if (!g_value_get_boolean (&return_value))
951 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);
952 g_value_unset (&return_value);
953 for (n = 0; n < num_params + num_extra; n++)
954 g_value_unset (&paramv[n]);
955 g_free (paramv);
956}
957
958static GVariant *
959_hwmon_skeleton_handle_get_property (
960 GDBusConnection *connection G_GNUC_UNUSED,
961 const gchar *sender G_GNUC_UNUSED,
962 const gchar *object_path G_GNUC_UNUSED,
963 const gchar *interface_name G_GNUC_UNUSED,
964 const gchar *property_name,
965 GError **error,
966 gpointer user_data)
967{
968 HwmonSkeleton *skeleton = HWMON_SKELETON (user_data);
969 GValue value = G_VALUE_INIT;
970 GParamSpec *pspec;
971 _ExtendedGDBusPropertyInfo *info;
972 GVariant *ret;
973 ret = NULL;
974 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_hwmon_interface_info.parent_struct, property_name);
975 g_assert (info != NULL);
976 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
977 if (pspec == NULL)
978 {
979 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
980 }
981 else
982 {
983 g_value_init (&value, pspec->value_type);
984 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
985 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
986 g_value_unset (&value);
987 }
988 return ret;
989}
990
991static gboolean
992_hwmon_skeleton_handle_set_property (
993 GDBusConnection *connection G_GNUC_UNUSED,
994 const gchar *sender G_GNUC_UNUSED,
995 const gchar *object_path G_GNUC_UNUSED,
996 const gchar *interface_name G_GNUC_UNUSED,
997 const gchar *property_name,
998 GVariant *variant,
999 GError **error,
1000 gpointer user_data)
1001{
1002 HwmonSkeleton *skeleton = HWMON_SKELETON (user_data);
1003 GValue value = G_VALUE_INIT;
1004 GParamSpec *pspec;
1005 _ExtendedGDBusPropertyInfo *info;
1006 gboolean ret;
1007 ret = FALSE;
1008 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_hwmon_interface_info.parent_struct, property_name);
1009 g_assert (info != NULL);
1010 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
1011 if (pspec == NULL)
1012 {
1013 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
1014 }
1015 else
1016 {
1017 if (info->use_gvariant)
1018 g_value_set_variant (&value, variant);
1019 else
1020 g_dbus_gvariant_to_gvalue (variant, &value);
1021 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
1022 g_value_unset (&value);
1023 ret = TRUE;
1024 }
1025 return ret;
1026}
1027
1028static const GDBusInterfaceVTable _hwmon_skeleton_vtable =
1029{
1030 _hwmon_skeleton_handle_method_call,
1031 _hwmon_skeleton_handle_get_property,
1032 _hwmon_skeleton_handle_set_property,
1033 {NULL}
1034};
1035
1036static GDBusInterfaceInfo *
1037hwmon_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
1038{
1039 return hwmon_interface_info ();
1040}
1041
1042static GDBusInterfaceVTable *
1043hwmon_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
1044{
1045 return (GDBusInterfaceVTable *) &_hwmon_skeleton_vtable;
1046}
1047
1048static GVariant *
1049hwmon_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
1050{
1051 HwmonSkeleton *skeleton = HWMON_SKELETON (_skeleton);
1052
1053 GVariantBuilder builder;
1054 guint n;
1055 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
1056 if (_hwmon_interface_info.parent_struct.properties == NULL)
1057 goto out;
1058 for (n = 0; _hwmon_interface_info.parent_struct.properties[n] != NULL; n++)
1059 {
1060 GDBusPropertyInfo *info = _hwmon_interface_info.parent_struct.properties[n];
1061 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
1062 {
1063 GVariant *value;
1064 value = _hwmon_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.Hwmon", info->name, NULL, skeleton);
1065 if (value != NULL)
1066 {
1067 g_variant_take_ref (value);
1068 g_variant_builder_add (&builder, "{sv}", info->name, value);
1069 g_variant_unref (value);
1070 }
1071 }
1072 }
1073out:
1074 return g_variant_builder_end (&builder);
1075}
1076
1077static gboolean _hwmon_emit_changed (gpointer user_data);
1078
1079static void
1080hwmon_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
1081{
1082 HwmonSkeleton *skeleton = HWMON_SKELETON (_skeleton);
1083 gboolean emit_changed = FALSE;
1084
1085 g_mutex_lock (&skeleton->priv->lock);
1086 if (skeleton->priv->changed_properties_idle_source != NULL)
1087 {
1088 g_source_destroy (skeleton->priv->changed_properties_idle_source);
1089 skeleton->priv->changed_properties_idle_source = NULL;
1090 emit_changed = TRUE;
1091 }
1092 g_mutex_unlock (&skeleton->priv->lock);
1093
1094 if (emit_changed)
1095 _hwmon_emit_changed (skeleton);
1096}
1097
1098static void hwmon_skeleton_iface_init (HwmonIface *iface);
1099#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
1100G_DEFINE_TYPE_WITH_CODE (HwmonSkeleton, hwmon_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
1101 G_ADD_PRIVATE (HwmonSkeleton)
1102 G_IMPLEMENT_INTERFACE (TYPE_HWMON, hwmon_skeleton_iface_init));
1103
1104#else
1105G_DEFINE_TYPE_WITH_CODE (HwmonSkeleton, hwmon_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
1106 G_IMPLEMENT_INTERFACE (TYPE_HWMON, hwmon_skeleton_iface_init));
1107
1108#endif
1109static void
1110hwmon_skeleton_finalize (GObject *object)
1111{
1112 HwmonSkeleton *skeleton = HWMON_SKELETON (object);
1113 guint n;
1114 for (n = 0; n < 3; n++)
1115 g_value_unset (&skeleton->priv->properties[n]);
1116 g_free (skeleton->priv->properties);
1117 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
1118 if (skeleton->priv->changed_properties_idle_source != NULL)
1119 g_source_destroy (skeleton->priv->changed_properties_idle_source);
1120 g_main_context_unref (skeleton->priv->context);
1121 g_mutex_clear (&skeleton->priv->lock);
1122 G_OBJECT_CLASS (hwmon_skeleton_parent_class)->finalize (object);
1123}
1124
1125static void
1126hwmon_skeleton_get_property (GObject *object,
1127 guint prop_id,
1128 GValue *value,
1129 GParamSpec *pspec G_GNUC_UNUSED)
1130{
1131 HwmonSkeleton *skeleton = HWMON_SKELETON (object);
1132 g_assert (prop_id != 0 && prop_id - 1 < 3);
1133 g_mutex_lock (&skeleton->priv->lock);
1134 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
1135 g_mutex_unlock (&skeleton->priv->lock);
1136}
1137
1138static gboolean
1139_hwmon_emit_changed (gpointer user_data)
1140{
1141 HwmonSkeleton *skeleton = HWMON_SKELETON (user_data);
1142 GList *l;
1143 GVariantBuilder builder;
1144 GVariantBuilder invalidated_builder;
1145 guint num_changes;
1146
1147 g_mutex_lock (&skeleton->priv->lock);
1148 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
1149 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
1150 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
1151 {
1152 ChangedProperty *cp = l->data;
1153 GVariant *variant;
1154 const GValue *cur_value;
1155
1156 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
1157 if (!_g_value_equal (cur_value, &cp->orig_value))
1158 {
1159 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
1160 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
1161 g_variant_unref (variant);
1162 num_changes++;
1163 }
1164 }
1165 if (num_changes > 0)
1166 {
1167 GList *connections, *ll;
1168 GVariant *signal_variant;
1169 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Hwmon",
1170 &builder, &invalidated_builder));
1171 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
1172 for (ll = connections; ll != NULL; ll = ll->next)
1173 {
1174 GDBusConnection *connection = ll->data;
1175
1176 g_dbus_connection_emit_signal (connection,
1177 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
1178 "org.freedesktop.DBus.Properties",
1179 "PropertiesChanged",
1180 signal_variant,
1181 NULL);
1182 }
1183 g_variant_unref (signal_variant);
1184 g_list_free_full (connections, g_object_unref);
1185 }
1186 else
1187 {
1188 g_variant_builder_clear (&builder);
1189 g_variant_builder_clear (&invalidated_builder);
1190 }
1191 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
1192 skeleton->priv->changed_properties = NULL;
1193 skeleton->priv->changed_properties_idle_source = NULL;
1194 g_mutex_unlock (&skeleton->priv->lock);
1195 return FALSE;
1196}
1197
1198static void
1199_hwmon_schedule_emit_changed (HwmonSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
1200{
1201 ChangedProperty *cp;
1202 GList *l;
1203 cp = NULL;
1204 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
1205 {
1206 ChangedProperty *i_cp = l->data;
1207 if (i_cp->info == info)
1208 {
1209 cp = i_cp;
1210 break;
1211 }
1212 }
1213 if (cp == NULL)
1214 {
1215 cp = g_new0 (ChangedProperty, 1);
1216 cp->prop_id = prop_id;
1217 cp->info = info;
1218 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
1219 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
1220 g_value_copy (orig_value, &cp->orig_value);
1221 }
1222}
1223
1224static void
1225hwmon_skeleton_notify (GObject *object,
1226 GParamSpec *pspec G_GNUC_UNUSED)
1227{
1228 HwmonSkeleton *skeleton = HWMON_SKELETON (object);
1229 g_mutex_lock (&skeleton->priv->lock);
1230 if (skeleton->priv->changed_properties != NULL &&
1231 skeleton->priv->changed_properties_idle_source == NULL)
1232 {
1233 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
1234 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
1235 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _hwmon_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
Adriana Kobylakfd778822016-06-16 09:08:37 -05001236 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _hwmon_emit_changed");
Norman James5236a8f2015-11-05 20:39:31 -06001237 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
1238 g_source_unref (skeleton->priv->changed_properties_idle_source);
1239 }
1240 g_mutex_unlock (&skeleton->priv->lock);
1241}
1242
1243static void
1244hwmon_skeleton_set_property (GObject *object,
1245 guint prop_id,
1246 const GValue *value,
1247 GParamSpec *pspec)
1248{
1249 HwmonSkeleton *skeleton = HWMON_SKELETON (object);
1250 g_assert (prop_id != 0 && prop_id - 1 < 3);
1251 g_mutex_lock (&skeleton->priv->lock);
1252 g_object_freeze_notify (object);
1253 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
1254 {
1255 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
1256 _hwmon_schedule_emit_changed (skeleton, _hwmon_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
1257 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
1258 g_object_notify_by_pspec (object, pspec);
1259 }
1260 g_mutex_unlock (&skeleton->priv->lock);
1261 g_object_thaw_notify (object);
1262}
1263
1264static void
1265hwmon_skeleton_init (HwmonSkeleton *skeleton)
1266{
1267#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
1268 skeleton->priv = hwmon_skeleton_get_instance_private (skeleton);
1269#else
1270 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_HWMON_SKELETON, HwmonSkeletonPrivate);
1271#endif
1272
1273 g_mutex_init (&skeleton->priv->lock);
1274 skeleton->priv->context = g_main_context_ref_thread_default ();
1275 skeleton->priv->properties = g_new0 (GValue, 3);
1276 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
1277 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
Norman James74828452015-11-17 13:10:34 -06001278 g_value_init (&skeleton->priv->properties[2], G_TYPE_INT);
Norman James5236a8f2015-11-05 20:39:31 -06001279}
1280
1281static gint
1282hwmon_skeleton_get_poll_interval (Hwmon *object)
1283{
1284 HwmonSkeleton *skeleton = HWMON_SKELETON (object);
1285 gint value;
1286 g_mutex_lock (&skeleton->priv->lock);
1287 value = g_value_get_int (&(skeleton->priv->properties[0]));
1288 g_mutex_unlock (&skeleton->priv->lock);
1289 return value;
1290}
1291
1292static const gchar *
1293hwmon_skeleton_get_sysfs_path (Hwmon *object)
1294{
1295 HwmonSkeleton *skeleton = HWMON_SKELETON (object);
1296 const gchar *value;
1297 g_mutex_lock (&skeleton->priv->lock);
1298 value = g_value_get_string (&(skeleton->priv->properties[1]));
1299 g_mutex_unlock (&skeleton->priv->lock);
1300 return value;
1301}
1302
Norman James74828452015-11-17 13:10:34 -06001303static gint
1304hwmon_skeleton_get_scale (Hwmon *object)
Norman James5236a8f2015-11-05 20:39:31 -06001305{
1306 HwmonSkeleton *skeleton = HWMON_SKELETON (object);
Norman James74828452015-11-17 13:10:34 -06001307 gint value;
Norman James5236a8f2015-11-05 20:39:31 -06001308 g_mutex_lock (&skeleton->priv->lock);
Norman James74828452015-11-17 13:10:34 -06001309 value = g_value_get_int (&(skeleton->priv->properties[2]));
Norman James5236a8f2015-11-05 20:39:31 -06001310 g_mutex_unlock (&skeleton->priv->lock);
1311 return value;
1312}
1313
1314static void
1315hwmon_skeleton_class_init (HwmonSkeletonClass *klass)
1316{
1317 GObjectClass *gobject_class;
1318 GDBusInterfaceSkeletonClass *skeleton_class;
1319
1320 gobject_class = G_OBJECT_CLASS (klass);
1321 gobject_class->finalize = hwmon_skeleton_finalize;
1322 gobject_class->get_property = hwmon_skeleton_get_property;
1323 gobject_class->set_property = hwmon_skeleton_set_property;
1324 gobject_class->notify = hwmon_skeleton_notify;
1325
1326
1327 hwmon_override_properties (gobject_class, 1);
1328
1329 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
1330 skeleton_class->get_info = hwmon_skeleton_dbus_interface_get_info;
1331 skeleton_class->get_properties = hwmon_skeleton_dbus_interface_get_properties;
1332 skeleton_class->flush = hwmon_skeleton_dbus_interface_flush;
1333 skeleton_class->get_vtable = hwmon_skeleton_dbus_interface_get_vtable;
1334
1335#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
1336 g_type_class_add_private (klass, sizeof (HwmonSkeletonPrivate));
1337#endif
1338}
1339
1340static void
1341hwmon_skeleton_iface_init (HwmonIface *iface)
1342{
1343 iface->get_poll_interval = hwmon_skeleton_get_poll_interval;
1344 iface->get_sysfs_path = hwmon_skeleton_get_sysfs_path;
Norman James74828452015-11-17 13:10:34 -06001345 iface->get_scale = hwmon_skeleton_get_scale;
Norman James5236a8f2015-11-05 20:39:31 -06001346}
1347
1348/**
1349 * hwmon_skeleton_new:
1350 *
1351 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Hwmon.top_of_page">org.openbmc.Hwmon</link>.
1352 *
1353 * Returns: (transfer full) (type HwmonSkeleton): The skeleton object.
1354 */
1355Hwmon *
1356hwmon_skeleton_new (void)
1357{
1358 return HWMON (g_object_new (TYPE_HWMON_SKELETON, NULL));
1359}
1360
1361/* ------------------------------------------------------------------------
Norman James362a80f2015-09-14 14:04:39 -05001362 * Code for interface org.openbmc.Fan
1363 * ------------------------------------------------------------------------
1364 */
1365
1366/**
1367 * SECTION:Fan
1368 * @title: Fan
1369 * @short_description: Generated C code for the org.openbmc.Fan D-Bus interface
1370 *
1371 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link> D-Bus interface in C.
1372 */
1373
1374/* ---- Introspection data for org.openbmc.Fan ---- */
1375
1376static const _ExtendedGDBusArgInfo _fan_method_info_set_cooling_zone_IN_ARG_cooling_zone =
1377{
1378 {
1379 -1,
1380 (gchar *) "cooling_zone",
1381 (gchar *) "i",
1382 NULL
1383 },
1384 FALSE
1385};
1386
1387static const _ExtendedGDBusArgInfo * const _fan_method_info_set_cooling_zone_IN_ARG_pointers[] =
1388{
1389 &_fan_method_info_set_cooling_zone_IN_ARG_cooling_zone,
1390 NULL
1391};
1392
1393static const _ExtendedGDBusMethodInfo _fan_method_info_set_cooling_zone =
1394{
1395 {
1396 -1,
1397 (gchar *) "setCoolingZone",
1398 (GDBusArgInfo **) &_fan_method_info_set_cooling_zone_IN_ARG_pointers,
1399 NULL,
1400 NULL
1401 },
1402 "handle-set-cooling-zone",
1403 FALSE
1404};
1405
1406static const _ExtendedGDBusArgInfo _fan_method_info_get_speed_OUT_ARG_speed =
1407{
1408 {
1409 -1,
1410 (gchar *) "speed",
1411 (gchar *) "i",
1412 NULL
1413 },
1414 FALSE
1415};
1416
1417static const _ExtendedGDBusArgInfo * const _fan_method_info_get_speed_OUT_ARG_pointers[] =
1418{
1419 &_fan_method_info_get_speed_OUT_ARG_speed,
1420 NULL
1421};
1422
1423static const _ExtendedGDBusMethodInfo _fan_method_info_get_speed =
1424{
1425 {
1426 -1,
1427 (gchar *) "getSpeed",
1428 NULL,
1429 (GDBusArgInfo **) &_fan_method_info_get_speed_OUT_ARG_pointers,
1430 NULL
1431 },
1432 "handle-get-speed",
1433 FALSE
1434};
1435
1436static const _ExtendedGDBusArgInfo _fan_method_info_set_speed_IN_ARG_speed =
1437{
1438 {
1439 -1,
1440 (gchar *) "speed",
1441 (gchar *) "i",
1442 NULL
1443 },
1444 FALSE
1445};
1446
1447static const _ExtendedGDBusArgInfo * const _fan_method_info_set_speed_IN_ARG_pointers[] =
1448{
1449 &_fan_method_info_set_speed_IN_ARG_speed,
1450 NULL
1451};
1452
1453static const _ExtendedGDBusMethodInfo _fan_method_info_set_speed =
1454{
1455 {
1456 -1,
1457 (gchar *) "setSpeed",
1458 (GDBusArgInfo **) &_fan_method_info_set_speed_IN_ARG_pointers,
1459 NULL,
1460 NULL
1461 },
1462 "handle-set-speed",
1463 FALSE
1464};
1465
1466static const _ExtendedGDBusMethodInfo * const _fan_method_info_pointers[] =
1467{
1468 &_fan_method_info_set_cooling_zone,
1469 &_fan_method_info_get_speed,
1470 &_fan_method_info_set_speed,
1471 NULL
1472};
1473
1474static const _ExtendedGDBusArgInfo _fan_signal_info_speed_changed_ARG_speed =
1475{
1476 {
1477 -1,
1478 (gchar *) "speed",
1479 (gchar *) "i",
1480 NULL
1481 },
1482 FALSE
1483};
1484
1485static const _ExtendedGDBusArgInfo * const _fan_signal_info_speed_changed_ARG_pointers[] =
1486{
1487 &_fan_signal_info_speed_changed_ARG_speed,
1488 NULL
1489};
1490
1491static const _ExtendedGDBusSignalInfo _fan_signal_info_speed_changed =
1492{
1493 {
1494 -1,
1495 (gchar *) "SpeedChanged",
1496 (GDBusArgInfo **) &_fan_signal_info_speed_changed_ARG_pointers,
1497 NULL
1498 },
1499 "speed-changed"
1500};
1501
1502static const _ExtendedGDBusSignalInfo _fan_signal_info_tach_error =
1503{
1504 {
1505 -1,
1506 (gchar *) "TachError",
1507 NULL,
1508 NULL
1509 },
1510 "tach-error"
1511};
1512
1513static const _ExtendedGDBusSignalInfo * const _fan_signal_info_pointers[] =
1514{
1515 &_fan_signal_info_speed_changed,
1516 &_fan_signal_info_tach_error,
1517 NULL
1518};
1519
1520static const _ExtendedGDBusPropertyInfo _fan_property_info_speed =
1521{
1522 {
1523 -1,
1524 (gchar *) "speed",
1525 (gchar *) "i",
1526 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
1527 NULL
1528 },
1529 "speed",
1530 FALSE
1531};
1532
1533static const _ExtendedGDBusPropertyInfo _fan_property_info_cooling_zone =
1534{
1535 {
1536 -1,
1537 (gchar *) "cooling_zone",
1538 (gchar *) "i",
1539 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
1540 NULL
1541 },
1542 "cooling-zone",
1543 FALSE
1544};
1545
1546static const _ExtendedGDBusPropertyInfo _fan_property_info_pwm_num =
1547{
1548 {
1549 -1,
1550 (gchar *) "pwm_num",
1551 (gchar *) "i",
1552 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
1553 NULL
1554 },
1555 "pwm-num",
1556 FALSE
1557};
1558
1559static const _ExtendedGDBusPropertyInfo * const _fan_property_info_pointers[] =
1560{
1561 &_fan_property_info_speed,
1562 &_fan_property_info_cooling_zone,
1563 &_fan_property_info_pwm_num,
1564 NULL
1565};
1566
1567static const _ExtendedGDBusInterfaceInfo _fan_interface_info =
1568{
1569 {
1570 -1,
1571 (gchar *) "org.openbmc.Fan",
1572 (GDBusMethodInfo **) &_fan_method_info_pointers,
1573 (GDBusSignalInfo **) &_fan_signal_info_pointers,
1574 (GDBusPropertyInfo **) &_fan_property_info_pointers,
1575 NULL
1576 },
1577 "fan",
1578};
1579
1580
1581/**
1582 * fan_interface_info:
1583 *
1584 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link> D-Bus interface.
1585 *
1586 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
1587 */
1588GDBusInterfaceInfo *
1589fan_interface_info (void)
1590{
1591 return (GDBusInterfaceInfo *) &_fan_interface_info.parent_struct;
1592}
1593
1594/**
1595 * fan_override_properties:
1596 * @klass: The class structure for a #GObject<!-- -->-derived class.
1597 * @property_id_begin: The property id to assign to the first overridden property.
1598 *
1599 * Overrides all #GObject properties in the #Fan interface for a concrete class.
1600 * The properties are overridden in the order they are defined.
1601 *
1602 * Returns: The last property id.
1603 */
1604guint
1605fan_override_properties (GObjectClass *klass, guint property_id_begin)
1606{
1607 g_object_class_override_property (klass, property_id_begin++, "speed");
1608 g_object_class_override_property (klass, property_id_begin++, "cooling-zone");
1609 g_object_class_override_property (klass, property_id_begin++, "pwm-num");
1610 return property_id_begin - 1;
1611}
1612
1613
1614
1615/**
1616 * Fan:
1617 *
1618 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link>.
1619 */
1620
1621/**
1622 * FanIface:
1623 * @parent_iface: The parent interface.
1624 * @handle_get_speed: Handler for the #Fan::handle-get-speed signal.
1625 * @handle_set_cooling_zone: Handler for the #Fan::handle-set-cooling-zone signal.
1626 * @handle_set_speed: Handler for the #Fan::handle-set-speed signal.
1627 * @get_cooling_zone: Getter for the #Fan:cooling-zone property.
1628 * @get_pwm_num: Getter for the #Fan:pwm-num property.
1629 * @get_speed: Getter for the #Fan:speed property.
1630 * @speed_changed: Handler for the #Fan::speed-changed signal.
1631 * @tach_error: Handler for the #Fan::tach-error signal.
1632 *
1633 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link>.
1634 */
1635
1636typedef FanIface FanInterface;
1637G_DEFINE_INTERFACE (Fan, fan, G_TYPE_OBJECT);
1638
1639static void
1640fan_default_init (FanIface *iface)
1641{
1642 /* GObject signals for incoming D-Bus method calls: */
1643 /**
1644 * Fan::handle-set-cooling-zone:
1645 * @object: A #Fan.
1646 * @invocation: A #GDBusMethodInvocation.
1647 * @arg_cooling_zone: Argument passed by remote caller.
1648 *
1649 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Fan.setCoolingZone">setCoolingZone()</link> D-Bus method.
1650 *
1651 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call fan_complete_set_cooling_zone() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
1652 *
1653 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
1654 */
1655 g_signal_new ("handle-set-cooling-zone",
1656 G_TYPE_FROM_INTERFACE (iface),
1657 G_SIGNAL_RUN_LAST,
1658 G_STRUCT_OFFSET (FanIface, handle_set_cooling_zone),
1659 g_signal_accumulator_true_handled,
1660 NULL,
1661 g_cclosure_marshal_generic,
1662 G_TYPE_BOOLEAN,
1663 2,
1664 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT);
1665
1666 /**
1667 * Fan::handle-get-speed:
1668 * @object: A #Fan.
1669 * @invocation: A #GDBusMethodInvocation.
1670 *
1671 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Fan.getSpeed">getSpeed()</link> D-Bus method.
1672 *
1673 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call fan_complete_get_speed() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
1674 *
1675 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
1676 */
1677 g_signal_new ("handle-get-speed",
1678 G_TYPE_FROM_INTERFACE (iface),
1679 G_SIGNAL_RUN_LAST,
1680 G_STRUCT_OFFSET (FanIface, handle_get_speed),
1681 g_signal_accumulator_true_handled,
1682 NULL,
1683 g_cclosure_marshal_generic,
1684 G_TYPE_BOOLEAN,
1685 1,
1686 G_TYPE_DBUS_METHOD_INVOCATION);
1687
1688 /**
1689 * Fan::handle-set-speed:
1690 * @object: A #Fan.
1691 * @invocation: A #GDBusMethodInvocation.
1692 * @arg_speed: Argument passed by remote caller.
1693 *
1694 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Fan.setSpeed">setSpeed()</link> D-Bus method.
1695 *
1696 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call fan_complete_set_speed() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
1697 *
1698 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
1699 */
1700 g_signal_new ("handle-set-speed",
1701 G_TYPE_FROM_INTERFACE (iface),
1702 G_SIGNAL_RUN_LAST,
1703 G_STRUCT_OFFSET (FanIface, handle_set_speed),
1704 g_signal_accumulator_true_handled,
1705 NULL,
1706 g_cclosure_marshal_generic,
1707 G_TYPE_BOOLEAN,
1708 2,
1709 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT);
1710
1711 /* GObject signals for received D-Bus signals: */
1712 /**
1713 * Fan::speed-changed:
1714 * @object: A #Fan.
1715 * @arg_speed: Argument.
1716 *
1717 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Fan.SpeedChanged">"SpeedChanged"</link> is received.
1718 *
1719 * 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.
1720 */
1721 g_signal_new ("speed-changed",
1722 G_TYPE_FROM_INTERFACE (iface),
1723 G_SIGNAL_RUN_LAST,
1724 G_STRUCT_OFFSET (FanIface, speed_changed),
1725 NULL,
1726 NULL,
1727 g_cclosure_marshal_generic,
1728 G_TYPE_NONE,
1729 1, G_TYPE_INT);
1730
1731 /**
1732 * Fan::tach-error:
1733 * @object: A #Fan.
1734 *
1735 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Fan.TachError">"TachError"</link> is received.
1736 *
1737 * 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.
1738 */
1739 g_signal_new ("tach-error",
1740 G_TYPE_FROM_INTERFACE (iface),
1741 G_SIGNAL_RUN_LAST,
1742 G_STRUCT_OFFSET (FanIface, tach_error),
1743 NULL,
1744 NULL,
1745 g_cclosure_marshal_generic,
1746 G_TYPE_NONE,
1747 0);
1748
1749 /* GObject properties for D-Bus properties: */
1750 /**
1751 * Fan:speed:
1752 *
1753 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fan.speed">"speed"</link>.
1754 *
1755 * 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.
1756 */
1757 g_object_interface_install_property (iface,
1758 g_param_spec_int ("speed", "speed", "speed", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
1759 /**
1760 * Fan:cooling-zone:
1761 *
1762 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fan.cooling_zone">"cooling_zone"</link>.
1763 *
1764 * 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.
1765 */
1766 g_object_interface_install_property (iface,
1767 g_param_spec_int ("cooling-zone", "cooling_zone", "cooling_zone", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
1768 /**
1769 * Fan:pwm-num:
1770 *
1771 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fan.pwm_num">"pwm_num"</link>.
1772 *
1773 * 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.
1774 */
1775 g_object_interface_install_property (iface,
1776 g_param_spec_int ("pwm-num", "pwm_num", "pwm_num", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
1777}
1778
1779/**
1780 * fan_get_speed: (skip)
1781 * @object: A #Fan.
1782 *
1783 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fan.speed">"speed"</link> D-Bus property.
1784 *
1785 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
1786 *
1787 * Returns: The property value.
1788 */
1789gint
1790fan_get_speed (Fan *object)
1791{
1792 return FAN_GET_IFACE (object)->get_speed (object);
1793}
1794
1795/**
1796 * fan_set_speed: (skip)
1797 * @object: A #Fan.
1798 * @value: The value to set.
1799 *
1800 * Sets the <link linkend="gdbus-property-org-openbmc-Fan.speed">"speed"</link> D-Bus property to @value.
1801 *
1802 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
1803 */
1804void
1805fan_set_speed (Fan *object, gint value)
1806{
1807 g_object_set (G_OBJECT (object), "speed", value, NULL);
1808}
1809
1810/**
1811 * fan_get_cooling_zone: (skip)
1812 * @object: A #Fan.
1813 *
1814 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fan.cooling_zone">"cooling_zone"</link> D-Bus property.
1815 *
1816 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
1817 *
1818 * Returns: The property value.
1819 */
1820gint
1821fan_get_cooling_zone (Fan *object)
1822{
1823 return FAN_GET_IFACE (object)->get_cooling_zone (object);
1824}
1825
1826/**
1827 * fan_set_cooling_zone: (skip)
1828 * @object: A #Fan.
1829 * @value: The value to set.
1830 *
1831 * Sets the <link linkend="gdbus-property-org-openbmc-Fan.cooling_zone">"cooling_zone"</link> D-Bus property to @value.
1832 *
1833 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
1834 */
1835void
1836fan_set_cooling_zone (Fan *object, gint value)
1837{
1838 g_object_set (G_OBJECT (object), "cooling-zone", value, NULL);
1839}
1840
1841/**
1842 * fan_get_pwm_num: (skip)
1843 * @object: A #Fan.
1844 *
1845 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fan.pwm_num">"pwm_num"</link> D-Bus property.
1846 *
1847 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
1848 *
1849 * Returns: The property value.
1850 */
1851gint
1852fan_get_pwm_num (Fan *object)
1853{
1854 return FAN_GET_IFACE (object)->get_pwm_num (object);
1855}
1856
1857/**
1858 * fan_set_pwm_num: (skip)
1859 * @object: A #Fan.
1860 * @value: The value to set.
1861 *
1862 * Sets the <link linkend="gdbus-property-org-openbmc-Fan.pwm_num">"pwm_num"</link> D-Bus property to @value.
1863 *
1864 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
1865 */
1866void
1867fan_set_pwm_num (Fan *object, gint value)
1868{
1869 g_object_set (G_OBJECT (object), "pwm-num", value, NULL);
1870}
1871
1872/**
1873 * fan_emit_speed_changed:
1874 * @object: A #Fan.
1875 * @arg_speed: Argument to pass with the signal.
1876 *
1877 * Emits the <link linkend="gdbus-signal-org-openbmc-Fan.SpeedChanged">"SpeedChanged"</link> D-Bus signal.
1878 */
1879void
1880fan_emit_speed_changed (
1881 Fan *object,
1882 gint arg_speed)
1883{
1884 g_signal_emit_by_name (object, "speed-changed", arg_speed);
1885}
1886
1887/**
1888 * fan_emit_tach_error:
1889 * @object: A #Fan.
1890 *
1891 * Emits the <link linkend="gdbus-signal-org-openbmc-Fan.TachError">"TachError"</link> D-Bus signal.
1892 */
1893void
1894fan_emit_tach_error (
1895 Fan *object)
1896{
1897 g_signal_emit_by_name (object, "tach-error");
1898}
1899
1900/**
1901 * fan_call_set_cooling_zone:
1902 * @proxy: A #FanProxy.
1903 * @arg_cooling_zone: Argument to pass with the method invocation.
1904 * @cancellable: (allow-none): A #GCancellable or %NULL.
1905 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
1906 * @user_data: User data to pass to @callback.
1907 *
1908 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Fan.setCoolingZone">setCoolingZone()</link> D-Bus method on @proxy.
1909 * 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.
1910 * You can then call fan_call_set_cooling_zone_finish() to get the result of the operation.
1911 *
1912 * See fan_call_set_cooling_zone_sync() for the synchronous, blocking version of this method.
1913 */
1914void
1915fan_call_set_cooling_zone (
1916 Fan *proxy,
1917 gint arg_cooling_zone,
1918 GCancellable *cancellable,
1919 GAsyncReadyCallback callback,
1920 gpointer user_data)
1921{
1922 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
1923 "setCoolingZone",
1924 g_variant_new ("(i)",
1925 arg_cooling_zone),
1926 G_DBUS_CALL_FLAGS_NONE,
1927 -1,
1928 cancellable,
1929 callback,
1930 user_data);
1931}
1932
1933/**
1934 * fan_call_set_cooling_zone_finish:
1935 * @proxy: A #FanProxy.
1936 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_call_set_cooling_zone().
1937 * @error: Return location for error or %NULL.
1938 *
1939 * Finishes an operation started with fan_call_set_cooling_zone().
1940 *
1941 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
1942 */
1943gboolean
1944fan_call_set_cooling_zone_finish (
1945 Fan *proxy,
1946 GAsyncResult *res,
1947 GError **error)
1948{
1949 GVariant *_ret;
1950 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
1951 if (_ret == NULL)
1952 goto _out;
1953 g_variant_get (_ret,
1954 "()");
1955 g_variant_unref (_ret);
1956_out:
1957 return _ret != NULL;
1958}
1959
1960/**
1961 * fan_call_set_cooling_zone_sync:
1962 * @proxy: A #FanProxy.
1963 * @arg_cooling_zone: Argument to pass with the method invocation.
1964 * @cancellable: (allow-none): A #GCancellable or %NULL.
1965 * @error: Return location for error or %NULL.
1966 *
1967 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Fan.setCoolingZone">setCoolingZone()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
1968 *
1969 * See fan_call_set_cooling_zone() for the asynchronous version of this method.
1970 *
1971 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
1972 */
1973gboolean
1974fan_call_set_cooling_zone_sync (
1975 Fan *proxy,
1976 gint arg_cooling_zone,
1977 GCancellable *cancellable,
1978 GError **error)
1979{
1980 GVariant *_ret;
1981 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
1982 "setCoolingZone",
1983 g_variant_new ("(i)",
1984 arg_cooling_zone),
1985 G_DBUS_CALL_FLAGS_NONE,
1986 -1,
1987 cancellable,
1988 error);
1989 if (_ret == NULL)
1990 goto _out;
1991 g_variant_get (_ret,
1992 "()");
1993 g_variant_unref (_ret);
1994_out:
1995 return _ret != NULL;
1996}
1997
1998/**
1999 * fan_call_get_speed:
2000 * @proxy: A #FanProxy.
2001 * @cancellable: (allow-none): A #GCancellable or %NULL.
2002 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
2003 * @user_data: User data to pass to @callback.
2004 *
2005 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Fan.getSpeed">getSpeed()</link> D-Bus method on @proxy.
2006 * 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.
2007 * You can then call fan_call_get_speed_finish() to get the result of the operation.
2008 *
2009 * See fan_call_get_speed_sync() for the synchronous, blocking version of this method.
2010 */
2011void
2012fan_call_get_speed (
2013 Fan *proxy,
2014 GCancellable *cancellable,
2015 GAsyncReadyCallback callback,
2016 gpointer user_data)
2017{
2018 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
2019 "getSpeed",
2020 g_variant_new ("()"),
2021 G_DBUS_CALL_FLAGS_NONE,
2022 -1,
2023 cancellable,
2024 callback,
2025 user_data);
2026}
2027
2028/**
2029 * fan_call_get_speed_finish:
2030 * @proxy: A #FanProxy.
2031 * @out_speed: (out): Return location for return parameter or %NULL to ignore.
2032 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_call_get_speed().
2033 * @error: Return location for error or %NULL.
2034 *
2035 * Finishes an operation started with fan_call_get_speed().
2036 *
2037 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
2038 */
2039gboolean
2040fan_call_get_speed_finish (
2041 Fan *proxy,
2042 gint *out_speed,
2043 GAsyncResult *res,
2044 GError **error)
2045{
2046 GVariant *_ret;
2047 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
2048 if (_ret == NULL)
2049 goto _out;
2050 g_variant_get (_ret,
2051 "(i)",
2052 out_speed);
2053 g_variant_unref (_ret);
2054_out:
2055 return _ret != NULL;
2056}
2057
2058/**
2059 * fan_call_get_speed_sync:
2060 * @proxy: A #FanProxy.
2061 * @out_speed: (out): Return location for return parameter or %NULL to ignore.
2062 * @cancellable: (allow-none): A #GCancellable or %NULL.
2063 * @error: Return location for error or %NULL.
2064 *
2065 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Fan.getSpeed">getSpeed()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
2066 *
2067 * See fan_call_get_speed() for the asynchronous version of this method.
2068 *
2069 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
2070 */
2071gboolean
2072fan_call_get_speed_sync (
2073 Fan *proxy,
2074 gint *out_speed,
2075 GCancellable *cancellable,
2076 GError **error)
2077{
2078 GVariant *_ret;
2079 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
2080 "getSpeed",
2081 g_variant_new ("()"),
2082 G_DBUS_CALL_FLAGS_NONE,
2083 -1,
2084 cancellable,
2085 error);
2086 if (_ret == NULL)
2087 goto _out;
2088 g_variant_get (_ret,
2089 "(i)",
2090 out_speed);
2091 g_variant_unref (_ret);
2092_out:
2093 return _ret != NULL;
2094}
2095
2096/**
2097 * fan_call_set_speed:
2098 * @proxy: A #FanProxy.
2099 * @arg_speed: Argument to pass with the method invocation.
2100 * @cancellable: (allow-none): A #GCancellable or %NULL.
2101 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
2102 * @user_data: User data to pass to @callback.
2103 *
2104 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Fan.setSpeed">setSpeed()</link> D-Bus method on @proxy.
2105 * 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.
2106 * You can then call fan_call_set_speed_finish() to get the result of the operation.
2107 *
2108 * See fan_call_set_speed_sync() for the synchronous, blocking version of this method.
2109 */
2110void
2111fan_call_set_speed (
2112 Fan *proxy,
2113 gint arg_speed,
2114 GCancellable *cancellable,
2115 GAsyncReadyCallback callback,
2116 gpointer user_data)
2117{
2118 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
2119 "setSpeed",
2120 g_variant_new ("(i)",
2121 arg_speed),
2122 G_DBUS_CALL_FLAGS_NONE,
2123 -1,
2124 cancellable,
2125 callback,
2126 user_data);
2127}
2128
2129/**
2130 * fan_call_set_speed_finish:
2131 * @proxy: A #FanProxy.
2132 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_call_set_speed().
2133 * @error: Return location for error or %NULL.
2134 *
2135 * Finishes an operation started with fan_call_set_speed().
2136 *
2137 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
2138 */
2139gboolean
2140fan_call_set_speed_finish (
2141 Fan *proxy,
2142 GAsyncResult *res,
2143 GError **error)
2144{
2145 GVariant *_ret;
2146 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
2147 if (_ret == NULL)
2148 goto _out;
2149 g_variant_get (_ret,
2150 "()");
2151 g_variant_unref (_ret);
2152_out:
2153 return _ret != NULL;
2154}
2155
2156/**
2157 * fan_call_set_speed_sync:
2158 * @proxy: A #FanProxy.
2159 * @arg_speed: Argument to pass with the method invocation.
2160 * @cancellable: (allow-none): A #GCancellable or %NULL.
2161 * @error: Return location for error or %NULL.
2162 *
2163 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Fan.setSpeed">setSpeed()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
2164 *
2165 * See fan_call_set_speed() for the asynchronous version of this method.
2166 *
2167 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
2168 */
2169gboolean
2170fan_call_set_speed_sync (
2171 Fan *proxy,
2172 gint arg_speed,
2173 GCancellable *cancellable,
2174 GError **error)
2175{
2176 GVariant *_ret;
2177 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
2178 "setSpeed",
2179 g_variant_new ("(i)",
2180 arg_speed),
2181 G_DBUS_CALL_FLAGS_NONE,
2182 -1,
2183 cancellable,
2184 error);
2185 if (_ret == NULL)
2186 goto _out;
2187 g_variant_get (_ret,
2188 "()");
2189 g_variant_unref (_ret);
2190_out:
2191 return _ret != NULL;
2192}
2193
2194/**
2195 * fan_complete_set_cooling_zone:
2196 * @object: A #Fan.
2197 * @invocation: (transfer full): A #GDBusMethodInvocation.
2198 *
2199 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Fan.setCoolingZone">setCoolingZone()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
2200 *
2201 * This method will free @invocation, you cannot use it afterwards.
2202 */
2203void
2204fan_complete_set_cooling_zone (
2205 Fan *object,
2206 GDBusMethodInvocation *invocation)
2207{
2208 g_dbus_method_invocation_return_value (invocation,
2209 g_variant_new ("()"));
2210}
2211
2212/**
2213 * fan_complete_get_speed:
2214 * @object: A #Fan.
2215 * @invocation: (transfer full): A #GDBusMethodInvocation.
2216 * @speed: Parameter to return.
2217 *
2218 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Fan.getSpeed">getSpeed()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
2219 *
2220 * This method will free @invocation, you cannot use it afterwards.
2221 */
2222void
2223fan_complete_get_speed (
2224 Fan *object,
2225 GDBusMethodInvocation *invocation,
2226 gint speed)
2227{
2228 g_dbus_method_invocation_return_value (invocation,
2229 g_variant_new ("(i)",
2230 speed));
2231}
2232
2233/**
2234 * fan_complete_set_speed:
2235 * @object: A #Fan.
2236 * @invocation: (transfer full): A #GDBusMethodInvocation.
2237 *
2238 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Fan.setSpeed">setSpeed()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
2239 *
2240 * This method will free @invocation, you cannot use it afterwards.
2241 */
2242void
2243fan_complete_set_speed (
2244 Fan *object,
2245 GDBusMethodInvocation *invocation)
2246{
2247 g_dbus_method_invocation_return_value (invocation,
2248 g_variant_new ("()"));
2249}
2250
2251/* ------------------------------------------------------------------------ */
2252
2253/**
2254 * FanProxy:
2255 *
2256 * The #FanProxy structure contains only private data and should only be accessed using the provided API.
2257 */
2258
2259/**
2260 * FanProxyClass:
2261 * @parent_class: The parent class.
2262 *
2263 * Class structure for #FanProxy.
2264 */
2265
2266struct _FanProxyPrivate
2267{
2268 GData *qdata;
2269};
2270
2271static void fan_proxy_iface_init (FanIface *iface);
2272
2273#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
2274G_DEFINE_TYPE_WITH_CODE (FanProxy, fan_proxy, G_TYPE_DBUS_PROXY,
2275 G_ADD_PRIVATE (FanProxy)
2276 G_IMPLEMENT_INTERFACE (TYPE_FAN, fan_proxy_iface_init));
2277
2278#else
2279G_DEFINE_TYPE_WITH_CODE (FanProxy, fan_proxy, G_TYPE_DBUS_PROXY,
2280 G_IMPLEMENT_INTERFACE (TYPE_FAN, fan_proxy_iface_init));
2281
2282#endif
2283static void
2284fan_proxy_finalize (GObject *object)
2285{
2286 FanProxy *proxy = FAN_PROXY (object);
2287 g_datalist_clear (&proxy->priv->qdata);
2288 G_OBJECT_CLASS (fan_proxy_parent_class)->finalize (object);
2289}
2290
2291static void
2292fan_proxy_get_property (GObject *object,
2293 guint prop_id,
2294 GValue *value,
2295 GParamSpec *pspec G_GNUC_UNUSED)
2296{
2297 const _ExtendedGDBusPropertyInfo *info;
2298 GVariant *variant;
2299 g_assert (prop_id != 0 && prop_id - 1 < 3);
2300 info = _fan_property_info_pointers[prop_id - 1];
2301 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
2302 if (info->use_gvariant)
2303 {
2304 g_value_set_variant (value, variant);
2305 }
2306 else
2307 {
2308 if (variant != NULL)
2309 g_dbus_gvariant_to_gvalue (variant, value);
2310 }
2311 if (variant != NULL)
2312 g_variant_unref (variant);
2313}
2314
2315static void
2316fan_proxy_set_property_cb (GDBusProxy *proxy,
2317 GAsyncResult *res,
2318 gpointer user_data)
2319{
2320 const _ExtendedGDBusPropertyInfo *info = user_data;
2321 GError *error;
2322 GVariant *_ret;
2323 error = NULL;
2324 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
2325 if (!_ret)
2326 {
2327 g_warning ("Error setting property '%s' on interface org.openbmc.Fan: %s (%s, %d)",
2328 info->parent_struct.name,
2329 error->message, g_quark_to_string (error->domain), error->code);
2330 g_error_free (error);
2331 }
2332 else
2333 {
2334 g_variant_unref (_ret);
2335 }
2336}
2337
2338static void
2339fan_proxy_set_property (GObject *object,
2340 guint prop_id,
2341 const GValue *value,
2342 GParamSpec *pspec G_GNUC_UNUSED)
2343{
2344 const _ExtendedGDBusPropertyInfo *info;
2345 GVariant *variant;
2346 g_assert (prop_id != 0 && prop_id - 1 < 3);
2347 info = _fan_property_info_pointers[prop_id - 1];
2348 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
2349 g_dbus_proxy_call (G_DBUS_PROXY (object),
2350 "org.freedesktop.DBus.Properties.Set",
2351 g_variant_new ("(ssv)", "org.openbmc.Fan", info->parent_struct.name, variant),
2352 G_DBUS_CALL_FLAGS_NONE,
2353 -1,
2354 NULL, (GAsyncReadyCallback) fan_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
2355 g_variant_unref (variant);
2356}
2357
2358static void
2359fan_proxy_g_signal (GDBusProxy *proxy,
2360 const gchar *sender_name G_GNUC_UNUSED,
2361 const gchar *signal_name,
2362 GVariant *parameters)
2363{
2364 _ExtendedGDBusSignalInfo *info;
2365 GVariantIter iter;
2366 GVariant *child;
2367 GValue *paramv;
2368 guint num_params;
2369 guint n;
2370 guint signal_id;
2371 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, signal_name);
2372 if (info == NULL)
2373 return;
2374 num_params = g_variant_n_children (parameters);
2375 paramv = g_new0 (GValue, num_params + 1);
2376 g_value_init (&paramv[0], TYPE_FAN);
2377 g_value_set_object (&paramv[0], proxy);
2378 g_variant_iter_init (&iter, parameters);
2379 n = 1;
2380 while ((child = g_variant_iter_next_value (&iter)) != NULL)
2381 {
2382 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
2383 if (arg_info->use_gvariant)
2384 {
2385 g_value_init (&paramv[n], G_TYPE_VARIANT);
2386 g_value_set_variant (&paramv[n], child);
2387 n++;
2388 }
2389 else
2390 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
2391 g_variant_unref (child);
2392 }
2393 signal_id = g_signal_lookup (info->signal_name, TYPE_FAN);
2394 g_signal_emitv (paramv, signal_id, 0, NULL);
2395 for (n = 0; n < num_params + 1; n++)
2396 g_value_unset (&paramv[n]);
2397 g_free (paramv);
2398}
2399
2400static void
2401fan_proxy_g_properties_changed (GDBusProxy *_proxy,
2402 GVariant *changed_properties,
2403 const gchar *const *invalidated_properties)
2404{
2405 FanProxy *proxy = FAN_PROXY (_proxy);
2406 guint n;
2407 const gchar *key;
2408 GVariantIter *iter;
2409 _ExtendedGDBusPropertyInfo *info;
2410 g_variant_get (changed_properties, "a{sv}", &iter);
2411 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
2412 {
2413 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, key);
2414 g_datalist_remove_data (&proxy->priv->qdata, key);
2415 if (info != NULL)
2416 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
2417 }
2418 g_variant_iter_free (iter);
2419 for (n = 0; invalidated_properties[n] != NULL; n++)
2420 {
2421 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, invalidated_properties[n]);
2422 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
2423 if (info != NULL)
2424 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
2425 }
2426}
2427
2428static gint
2429fan_proxy_get_speed (Fan *object)
2430{
2431 FanProxy *proxy = FAN_PROXY (object);
2432 GVariant *variant;
2433 gint value = 0;
2434 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "speed");
2435 if (variant != NULL)
2436 {
2437 value = g_variant_get_int32 (variant);
2438 g_variant_unref (variant);
2439 }
2440 return value;
2441}
2442
2443static gint
2444fan_proxy_get_cooling_zone (Fan *object)
2445{
2446 FanProxy *proxy = FAN_PROXY (object);
2447 GVariant *variant;
2448 gint value = 0;
2449 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "cooling_zone");
2450 if (variant != NULL)
2451 {
2452 value = g_variant_get_int32 (variant);
2453 g_variant_unref (variant);
2454 }
2455 return value;
2456}
2457
2458static gint
2459fan_proxy_get_pwm_num (Fan *object)
2460{
2461 FanProxy *proxy = FAN_PROXY (object);
2462 GVariant *variant;
2463 gint value = 0;
2464 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "pwm_num");
2465 if (variant != NULL)
2466 {
2467 value = g_variant_get_int32 (variant);
2468 g_variant_unref (variant);
2469 }
2470 return value;
2471}
2472
2473static void
2474fan_proxy_init (FanProxy *proxy)
2475{
2476#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
2477 proxy->priv = fan_proxy_get_instance_private (proxy);
2478#else
2479 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_FAN_PROXY, FanProxyPrivate);
2480#endif
2481
2482 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), fan_interface_info ());
2483}
2484
2485static void
2486fan_proxy_class_init (FanProxyClass *klass)
2487{
2488 GObjectClass *gobject_class;
2489 GDBusProxyClass *proxy_class;
2490
2491 gobject_class = G_OBJECT_CLASS (klass);
2492 gobject_class->finalize = fan_proxy_finalize;
2493 gobject_class->get_property = fan_proxy_get_property;
2494 gobject_class->set_property = fan_proxy_set_property;
2495
2496 proxy_class = G_DBUS_PROXY_CLASS (klass);
2497 proxy_class->g_signal = fan_proxy_g_signal;
2498 proxy_class->g_properties_changed = fan_proxy_g_properties_changed;
2499
2500 fan_override_properties (gobject_class, 1);
2501
2502#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
2503 g_type_class_add_private (klass, sizeof (FanProxyPrivate));
2504#endif
2505}
2506
2507static void
2508fan_proxy_iface_init (FanIface *iface)
2509{
2510 iface->get_speed = fan_proxy_get_speed;
2511 iface->get_cooling_zone = fan_proxy_get_cooling_zone;
2512 iface->get_pwm_num = fan_proxy_get_pwm_num;
2513}
2514
2515/**
2516 * fan_proxy_new:
2517 * @connection: A #GDBusConnection.
2518 * @flags: Flags from the #GDBusProxyFlags enumeration.
2519 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
2520 * @object_path: An object path.
2521 * @cancellable: (allow-none): A #GCancellable or %NULL.
2522 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
2523 * @user_data: User data to pass to @callback.
2524 *
2525 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link>. See g_dbus_proxy_new() for more details.
2526 *
2527 * 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.
2528 * You can then call fan_proxy_new_finish() to get the result of the operation.
2529 *
2530 * See fan_proxy_new_sync() for the synchronous, blocking version of this constructor.
2531 */
2532void
2533fan_proxy_new (
2534 GDBusConnection *connection,
2535 GDBusProxyFlags flags,
2536 const gchar *name,
2537 const gchar *object_path,
2538 GCancellable *cancellable,
2539 GAsyncReadyCallback callback,
2540 gpointer user_data)
2541{
2542 g_async_initable_new_async (TYPE_FAN_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.Fan", NULL);
2543}
2544
2545/**
2546 * fan_proxy_new_finish:
2547 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_proxy_new().
2548 * @error: Return location for error or %NULL
2549 *
2550 * Finishes an operation started with fan_proxy_new().
2551 *
2552 * Returns: (transfer full) (type FanProxy): The constructed proxy object or %NULL if @error is set.
2553 */
2554Fan *
2555fan_proxy_new_finish (
2556 GAsyncResult *res,
2557 GError **error)
2558{
2559 GObject *ret;
2560 GObject *source_object;
2561 source_object = g_async_result_get_source_object (res);
2562 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
2563 g_object_unref (source_object);
2564 if (ret != NULL)
2565 return FAN (ret);
2566 else
2567 return NULL;
2568}
2569
2570/**
2571 * fan_proxy_new_sync:
2572 * @connection: A #GDBusConnection.
2573 * @flags: Flags from the #GDBusProxyFlags enumeration.
2574 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
2575 * @object_path: An object path.
2576 * @cancellable: (allow-none): A #GCancellable or %NULL.
2577 * @error: Return location for error or %NULL
2578 *
2579 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link>. See g_dbus_proxy_new_sync() for more details.
2580 *
2581 * The calling thread is blocked until a reply is received.
2582 *
2583 * See fan_proxy_new() for the asynchronous version of this constructor.
2584 *
2585 * Returns: (transfer full) (type FanProxy): The constructed proxy object or %NULL if @error is set.
2586 */
2587Fan *
2588fan_proxy_new_sync (
2589 GDBusConnection *connection,
2590 GDBusProxyFlags flags,
2591 const gchar *name,
2592 const gchar *object_path,
2593 GCancellable *cancellable,
2594 GError **error)
2595{
2596 GInitable *ret;
2597 ret = g_initable_new (TYPE_FAN_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.Fan", NULL);
2598 if (ret != NULL)
2599 return FAN (ret);
2600 else
2601 return NULL;
2602}
2603
2604
2605/**
2606 * fan_proxy_new_for_bus:
2607 * @bus_type: A #GBusType.
2608 * @flags: Flags from the #GDBusProxyFlags enumeration.
2609 * @name: A bus name (well-known or unique).
2610 * @object_path: An object path.
2611 * @cancellable: (allow-none): A #GCancellable or %NULL.
2612 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
2613 * @user_data: User data to pass to @callback.
2614 *
2615 * Like fan_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
2616 *
2617 * 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.
2618 * You can then call fan_proxy_new_for_bus_finish() to get the result of the operation.
2619 *
2620 * See fan_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
2621 */
2622void
2623fan_proxy_new_for_bus (
2624 GBusType bus_type,
2625 GDBusProxyFlags flags,
2626 const gchar *name,
2627 const gchar *object_path,
2628 GCancellable *cancellable,
2629 GAsyncReadyCallback callback,
2630 gpointer user_data)
2631{
2632 g_async_initable_new_async (TYPE_FAN_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.Fan", NULL);
2633}
2634
2635/**
2636 * fan_proxy_new_for_bus_finish:
2637 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_proxy_new_for_bus().
2638 * @error: Return location for error or %NULL
2639 *
2640 * Finishes an operation started with fan_proxy_new_for_bus().
2641 *
2642 * Returns: (transfer full) (type FanProxy): The constructed proxy object or %NULL if @error is set.
2643 */
2644Fan *
2645fan_proxy_new_for_bus_finish (
2646 GAsyncResult *res,
2647 GError **error)
2648{
2649 GObject *ret;
2650 GObject *source_object;
2651 source_object = g_async_result_get_source_object (res);
2652 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
2653 g_object_unref (source_object);
2654 if (ret != NULL)
2655 return FAN (ret);
2656 else
2657 return NULL;
2658}
2659
2660/**
2661 * fan_proxy_new_for_bus_sync:
2662 * @bus_type: A #GBusType.
2663 * @flags: Flags from the #GDBusProxyFlags enumeration.
2664 * @name: A bus name (well-known or unique).
2665 * @object_path: An object path.
2666 * @cancellable: (allow-none): A #GCancellable or %NULL.
2667 * @error: Return location for error or %NULL
2668 *
2669 * Like fan_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
2670 *
2671 * The calling thread is blocked until a reply is received.
2672 *
2673 * See fan_proxy_new_for_bus() for the asynchronous version of this constructor.
2674 *
2675 * Returns: (transfer full) (type FanProxy): The constructed proxy object or %NULL if @error is set.
2676 */
2677Fan *
2678fan_proxy_new_for_bus_sync (
2679 GBusType bus_type,
2680 GDBusProxyFlags flags,
2681 const gchar *name,
2682 const gchar *object_path,
2683 GCancellable *cancellable,
2684 GError **error)
2685{
2686 GInitable *ret;
2687 ret = g_initable_new (TYPE_FAN_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.Fan", NULL);
2688 if (ret != NULL)
2689 return FAN (ret);
2690 else
2691 return NULL;
2692}
2693
2694
2695/* ------------------------------------------------------------------------ */
2696
2697/**
2698 * FanSkeleton:
2699 *
2700 * The #FanSkeleton structure contains only private data and should only be accessed using the provided API.
2701 */
2702
2703/**
2704 * FanSkeletonClass:
2705 * @parent_class: The parent class.
2706 *
2707 * Class structure for #FanSkeleton.
2708 */
2709
2710struct _FanSkeletonPrivate
2711{
2712 GValue *properties;
2713 GList *changed_properties;
2714 GSource *changed_properties_idle_source;
2715 GMainContext *context;
2716 GMutex lock;
2717};
2718
2719static void
2720_fan_skeleton_handle_method_call (
2721 GDBusConnection *connection G_GNUC_UNUSED,
2722 const gchar *sender G_GNUC_UNUSED,
2723 const gchar *object_path G_GNUC_UNUSED,
2724 const gchar *interface_name,
2725 const gchar *method_name,
2726 GVariant *parameters,
2727 GDBusMethodInvocation *invocation,
2728 gpointer user_data)
2729{
2730 FanSkeleton *skeleton = FAN_SKELETON (user_data);
2731 _ExtendedGDBusMethodInfo *info;
2732 GVariantIter iter;
2733 GVariant *child;
2734 GValue *paramv;
2735 guint num_params;
2736 guint num_extra;
2737 guint n;
2738 guint signal_id;
2739 GValue return_value = G_VALUE_INIT;
2740 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
2741 g_assert (info != NULL);
2742 num_params = g_variant_n_children (parameters);
2743 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
2744 n = 0;
2745 g_value_init (&paramv[n], TYPE_FAN);
2746 g_value_set_object (&paramv[n++], skeleton);
2747 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
2748 g_value_set_object (&paramv[n++], invocation);
2749 if (info->pass_fdlist)
2750 {
2751#ifdef G_OS_UNIX
2752 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
2753 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
2754#else
2755 g_assert_not_reached ();
2756#endif
2757 }
2758 g_variant_iter_init (&iter, parameters);
2759 while ((child = g_variant_iter_next_value (&iter)) != NULL)
2760 {
2761 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
2762 if (arg_info->use_gvariant)
2763 {
2764 g_value_init (&paramv[n], G_TYPE_VARIANT);
2765 g_value_set_variant (&paramv[n], child);
2766 n++;
2767 }
2768 else
2769 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
2770 g_variant_unref (child);
2771 }
2772 signal_id = g_signal_lookup (info->signal_name, TYPE_FAN);
2773 g_value_init (&return_value, G_TYPE_BOOLEAN);
2774 g_signal_emitv (paramv, signal_id, 0, &return_value);
2775 if (!g_value_get_boolean (&return_value))
2776 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);
2777 g_value_unset (&return_value);
2778 for (n = 0; n < num_params + num_extra; n++)
2779 g_value_unset (&paramv[n]);
2780 g_free (paramv);
2781}
2782
2783static GVariant *
2784_fan_skeleton_handle_get_property (
2785 GDBusConnection *connection G_GNUC_UNUSED,
2786 const gchar *sender G_GNUC_UNUSED,
2787 const gchar *object_path G_GNUC_UNUSED,
2788 const gchar *interface_name G_GNUC_UNUSED,
2789 const gchar *property_name,
2790 GError **error,
2791 gpointer user_data)
2792{
2793 FanSkeleton *skeleton = FAN_SKELETON (user_data);
2794 GValue value = G_VALUE_INIT;
2795 GParamSpec *pspec;
2796 _ExtendedGDBusPropertyInfo *info;
2797 GVariant *ret;
2798 ret = NULL;
2799 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, property_name);
2800 g_assert (info != NULL);
2801 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
2802 if (pspec == NULL)
2803 {
2804 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
2805 }
2806 else
2807 {
2808 g_value_init (&value, pspec->value_type);
2809 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
2810 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
2811 g_value_unset (&value);
2812 }
2813 return ret;
2814}
2815
2816static gboolean
2817_fan_skeleton_handle_set_property (
2818 GDBusConnection *connection G_GNUC_UNUSED,
2819 const gchar *sender G_GNUC_UNUSED,
2820 const gchar *object_path G_GNUC_UNUSED,
2821 const gchar *interface_name G_GNUC_UNUSED,
2822 const gchar *property_name,
2823 GVariant *variant,
2824 GError **error,
2825 gpointer user_data)
2826{
2827 FanSkeleton *skeleton = FAN_SKELETON (user_data);
2828 GValue value = G_VALUE_INIT;
2829 GParamSpec *pspec;
2830 _ExtendedGDBusPropertyInfo *info;
2831 gboolean ret;
2832 ret = FALSE;
2833 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, property_name);
2834 g_assert (info != NULL);
2835 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
2836 if (pspec == NULL)
2837 {
2838 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
2839 }
2840 else
2841 {
2842 if (info->use_gvariant)
2843 g_value_set_variant (&value, variant);
2844 else
2845 g_dbus_gvariant_to_gvalue (variant, &value);
2846 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
2847 g_value_unset (&value);
2848 ret = TRUE;
2849 }
2850 return ret;
2851}
2852
2853static const GDBusInterfaceVTable _fan_skeleton_vtable =
2854{
2855 _fan_skeleton_handle_method_call,
2856 _fan_skeleton_handle_get_property,
2857 _fan_skeleton_handle_set_property,
2858 {NULL}
2859};
2860
2861static GDBusInterfaceInfo *
2862fan_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
2863{
2864 return fan_interface_info ();
2865}
2866
2867static GDBusInterfaceVTable *
2868fan_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
2869{
2870 return (GDBusInterfaceVTable *) &_fan_skeleton_vtable;
2871}
2872
2873static GVariant *
2874fan_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
2875{
2876 FanSkeleton *skeleton = FAN_SKELETON (_skeleton);
2877
2878 GVariantBuilder builder;
2879 guint n;
2880 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
2881 if (_fan_interface_info.parent_struct.properties == NULL)
2882 goto out;
2883 for (n = 0; _fan_interface_info.parent_struct.properties[n] != NULL; n++)
2884 {
2885 GDBusPropertyInfo *info = _fan_interface_info.parent_struct.properties[n];
2886 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
2887 {
2888 GVariant *value;
2889 value = _fan_skeleton_handle_get_property (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Fan", info->name, NULL, skeleton);
2890 if (value != NULL)
2891 {
2892 g_variant_take_ref (value);
2893 g_variant_builder_add (&builder, "{sv}", info->name, value);
2894 g_variant_unref (value);
2895 }
2896 }
2897 }
2898out:
2899 return g_variant_builder_end (&builder);
2900}
2901
2902static gboolean _fan_emit_changed (gpointer user_data);
2903
2904static void
2905fan_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
2906{
2907 FanSkeleton *skeleton = FAN_SKELETON (_skeleton);
2908 gboolean emit_changed = FALSE;
2909
2910 g_mutex_lock (&skeleton->priv->lock);
2911 if (skeleton->priv->changed_properties_idle_source != NULL)
2912 {
2913 g_source_destroy (skeleton->priv->changed_properties_idle_source);
2914 skeleton->priv->changed_properties_idle_source = NULL;
2915 emit_changed = TRUE;
2916 }
2917 g_mutex_unlock (&skeleton->priv->lock);
2918
2919 if (emit_changed)
2920 _fan_emit_changed (skeleton);
2921}
2922
2923static void
2924_fan_on_signal_speed_changed (
2925 Fan *object,
2926 gint arg_speed)
2927{
2928 FanSkeleton *skeleton = FAN_SKELETON (object);
2929
2930 GList *connections, *l;
2931 GVariant *signal_variant;
2932 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
2933
2934 signal_variant = g_variant_ref_sink (g_variant_new ("(i)",
2935 arg_speed));
2936 for (l = connections; l != NULL; l = l->next)
2937 {
2938 GDBusConnection *connection = l->data;
2939 g_dbus_connection_emit_signal (connection,
2940 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Fan", "SpeedChanged",
2941 signal_variant, NULL);
2942 }
2943 g_variant_unref (signal_variant);
2944 g_list_free_full (connections, g_object_unref);
2945}
2946
2947static void
2948_fan_on_signal_tach_error (
2949 Fan *object)
2950{
2951 FanSkeleton *skeleton = FAN_SKELETON (object);
2952
2953 GList *connections, *l;
2954 GVariant *signal_variant;
2955 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
2956
2957 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
2958 for (l = connections; l != NULL; l = l->next)
2959 {
2960 GDBusConnection *connection = l->data;
2961 g_dbus_connection_emit_signal (connection,
2962 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Fan", "TachError",
2963 signal_variant, NULL);
2964 }
2965 g_variant_unref (signal_variant);
2966 g_list_free_full (connections, g_object_unref);
2967}
2968
2969static void fan_skeleton_iface_init (FanIface *iface);
2970#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
2971G_DEFINE_TYPE_WITH_CODE (FanSkeleton, fan_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
2972 G_ADD_PRIVATE (FanSkeleton)
2973 G_IMPLEMENT_INTERFACE (TYPE_FAN, fan_skeleton_iface_init));
2974
2975#else
2976G_DEFINE_TYPE_WITH_CODE (FanSkeleton, fan_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
2977 G_IMPLEMENT_INTERFACE (TYPE_FAN, fan_skeleton_iface_init));
2978
2979#endif
2980static void
2981fan_skeleton_finalize (GObject *object)
2982{
2983 FanSkeleton *skeleton = FAN_SKELETON (object);
2984 guint n;
2985 for (n = 0; n < 3; n++)
2986 g_value_unset (&skeleton->priv->properties[n]);
2987 g_free (skeleton->priv->properties);
2988 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
2989 if (skeleton->priv->changed_properties_idle_source != NULL)
2990 g_source_destroy (skeleton->priv->changed_properties_idle_source);
2991 g_main_context_unref (skeleton->priv->context);
2992 g_mutex_clear (&skeleton->priv->lock);
2993 G_OBJECT_CLASS (fan_skeleton_parent_class)->finalize (object);
2994}
2995
2996static void
2997fan_skeleton_get_property (GObject *object,
2998 guint prop_id,
2999 GValue *value,
3000 GParamSpec *pspec G_GNUC_UNUSED)
3001{
3002 FanSkeleton *skeleton = FAN_SKELETON (object);
3003 g_assert (prop_id != 0 && prop_id - 1 < 3);
3004 g_mutex_lock (&skeleton->priv->lock);
3005 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
3006 g_mutex_unlock (&skeleton->priv->lock);
3007}
3008
3009static gboolean
3010_fan_emit_changed (gpointer user_data)
3011{
3012 FanSkeleton *skeleton = FAN_SKELETON (user_data);
3013 GList *l;
3014 GVariantBuilder builder;
3015 GVariantBuilder invalidated_builder;
3016 guint num_changes;
3017
3018 g_mutex_lock (&skeleton->priv->lock);
3019 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
3020 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
3021 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
3022 {
3023 ChangedProperty *cp = l->data;
3024 GVariant *variant;
3025 const GValue *cur_value;
3026
3027 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
3028 if (!_g_value_equal (cur_value, &cp->orig_value))
3029 {
3030 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
3031 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
3032 g_variant_unref (variant);
3033 num_changes++;
3034 }
3035 }
3036 if (num_changes > 0)
3037 {
3038 GList *connections, *ll;
3039 GVariant *signal_variant;
3040 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Fan",
3041 &builder, &invalidated_builder));
3042 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
3043 for (ll = connections; ll != NULL; ll = ll->next)
3044 {
3045 GDBusConnection *connection = ll->data;
3046
3047 g_dbus_connection_emit_signal (connection,
3048 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
3049 "org.freedesktop.DBus.Properties",
3050 "PropertiesChanged",
3051 signal_variant,
3052 NULL);
3053 }
3054 g_variant_unref (signal_variant);
3055 g_list_free_full (connections, g_object_unref);
3056 }
3057 else
3058 {
3059 g_variant_builder_clear (&builder);
3060 g_variant_builder_clear (&invalidated_builder);
3061 }
3062 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
3063 skeleton->priv->changed_properties = NULL;
3064 skeleton->priv->changed_properties_idle_source = NULL;
3065 g_mutex_unlock (&skeleton->priv->lock);
3066 return FALSE;
3067}
3068
3069static void
3070_fan_schedule_emit_changed (FanSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
3071{
3072 ChangedProperty *cp;
3073 GList *l;
3074 cp = NULL;
3075 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
3076 {
3077 ChangedProperty *i_cp = l->data;
3078 if (i_cp->info == info)
3079 {
3080 cp = i_cp;
3081 break;
3082 }
3083 }
3084 if (cp == NULL)
3085 {
3086 cp = g_new0 (ChangedProperty, 1);
3087 cp->prop_id = prop_id;
3088 cp->info = info;
3089 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
3090 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
3091 g_value_copy (orig_value, &cp->orig_value);
3092 }
3093}
3094
3095static void
3096fan_skeleton_notify (GObject *object,
3097 GParamSpec *pspec G_GNUC_UNUSED)
3098{
3099 FanSkeleton *skeleton = FAN_SKELETON (object);
3100 g_mutex_lock (&skeleton->priv->lock);
3101 if (skeleton->priv->changed_properties != NULL &&
3102 skeleton->priv->changed_properties_idle_source == NULL)
3103 {
3104 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
3105 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
3106 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _fan_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
Adriana Kobylakfd778822016-06-16 09:08:37 -05003107 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _fan_emit_changed");
Norman James362a80f2015-09-14 14:04:39 -05003108 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
3109 g_source_unref (skeleton->priv->changed_properties_idle_source);
3110 }
3111 g_mutex_unlock (&skeleton->priv->lock);
3112}
3113
3114static void
3115fan_skeleton_set_property (GObject *object,
3116 guint prop_id,
3117 const GValue *value,
3118 GParamSpec *pspec)
3119{
3120 FanSkeleton *skeleton = FAN_SKELETON (object);
3121 g_assert (prop_id != 0 && prop_id - 1 < 3);
3122 g_mutex_lock (&skeleton->priv->lock);
3123 g_object_freeze_notify (object);
3124 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
3125 {
3126 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
3127 _fan_schedule_emit_changed (skeleton, _fan_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
3128 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
3129 g_object_notify_by_pspec (object, pspec);
3130 }
3131 g_mutex_unlock (&skeleton->priv->lock);
3132 g_object_thaw_notify (object);
3133}
3134
3135static void
3136fan_skeleton_init (FanSkeleton *skeleton)
3137{
3138#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
3139 skeleton->priv = fan_skeleton_get_instance_private (skeleton);
3140#else
3141 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_FAN_SKELETON, FanSkeletonPrivate);
3142#endif
3143
3144 g_mutex_init (&skeleton->priv->lock);
3145 skeleton->priv->context = g_main_context_ref_thread_default ();
3146 skeleton->priv->properties = g_new0 (GValue, 3);
3147 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
3148 g_value_init (&skeleton->priv->properties[1], G_TYPE_INT);
3149 g_value_init (&skeleton->priv->properties[2], G_TYPE_INT);
3150}
3151
3152static gint
3153fan_skeleton_get_speed (Fan *object)
3154{
3155 FanSkeleton *skeleton = FAN_SKELETON (object);
3156 gint value;
3157 g_mutex_lock (&skeleton->priv->lock);
3158 value = g_value_get_int (&(skeleton->priv->properties[0]));
3159 g_mutex_unlock (&skeleton->priv->lock);
3160 return value;
3161}
3162
3163static gint
3164fan_skeleton_get_cooling_zone (Fan *object)
3165{
3166 FanSkeleton *skeleton = FAN_SKELETON (object);
3167 gint value;
3168 g_mutex_lock (&skeleton->priv->lock);
3169 value = g_value_get_int (&(skeleton->priv->properties[1]));
3170 g_mutex_unlock (&skeleton->priv->lock);
3171 return value;
3172}
3173
3174static gint
3175fan_skeleton_get_pwm_num (Fan *object)
3176{
3177 FanSkeleton *skeleton = FAN_SKELETON (object);
3178 gint value;
3179 g_mutex_lock (&skeleton->priv->lock);
3180 value = g_value_get_int (&(skeleton->priv->properties[2]));
3181 g_mutex_unlock (&skeleton->priv->lock);
3182 return value;
3183}
3184
3185static void
3186fan_skeleton_class_init (FanSkeletonClass *klass)
3187{
3188 GObjectClass *gobject_class;
3189 GDBusInterfaceSkeletonClass *skeleton_class;
3190
3191 gobject_class = G_OBJECT_CLASS (klass);
3192 gobject_class->finalize = fan_skeleton_finalize;
3193 gobject_class->get_property = fan_skeleton_get_property;
3194 gobject_class->set_property = fan_skeleton_set_property;
3195 gobject_class->notify = fan_skeleton_notify;
3196
3197
3198 fan_override_properties (gobject_class, 1);
3199
3200 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
3201 skeleton_class->get_info = fan_skeleton_dbus_interface_get_info;
3202 skeleton_class->get_properties = fan_skeleton_dbus_interface_get_properties;
3203 skeleton_class->flush = fan_skeleton_dbus_interface_flush;
3204 skeleton_class->get_vtable = fan_skeleton_dbus_interface_get_vtable;
3205
3206#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
3207 g_type_class_add_private (klass, sizeof (FanSkeletonPrivate));
3208#endif
3209}
3210
3211static void
3212fan_skeleton_iface_init (FanIface *iface)
3213{
3214 iface->speed_changed = _fan_on_signal_speed_changed;
3215 iface->tach_error = _fan_on_signal_tach_error;
3216 iface->get_speed = fan_skeleton_get_speed;
3217 iface->get_cooling_zone = fan_skeleton_get_cooling_zone;
3218 iface->get_pwm_num = fan_skeleton_get_pwm_num;
3219}
3220
3221/**
3222 * fan_skeleton_new:
3223 *
3224 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link>.
3225 *
3226 * Returns: (transfer full) (type FanSkeleton): The skeleton object.
3227 */
3228Fan *
3229fan_skeleton_new (void)
3230{
3231 return FAN (g_object_new (TYPE_FAN_SKELETON, NULL));
3232}
3233
3234/* ------------------------------------------------------------------------
3235 * Code for interface org.openbmc.SensorValue
3236 * ------------------------------------------------------------------------
3237 */
3238
3239/**
3240 * SECTION:SensorValue
3241 * @title: SensorValue
3242 * @short_description: Generated C code for the org.openbmc.SensorValue D-Bus interface
3243 *
3244 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link> D-Bus interface in C.
3245 */
3246
3247/* ---- Introspection data for org.openbmc.SensorValue ---- */
3248
3249static const _ExtendedGDBusMethodInfo _sensor_value_method_info_init =
3250{
3251 {
3252 -1,
3253 (gchar *) "init",
3254 NULL,
3255 NULL,
3256 NULL
3257 },
3258 "handle-init",
3259 FALSE
3260};
3261
3262static const _ExtendedGDBusArgInfo _sensor_value_method_info_get_value_OUT_ARG_value =
3263{
3264 {
3265 -1,
3266 (gchar *) "value",
3267 (gchar *) "v",
3268 NULL
3269 },
3270 FALSE
3271};
3272
3273static const _ExtendedGDBusArgInfo * const _sensor_value_method_info_get_value_OUT_ARG_pointers[] =
3274{
3275 &_sensor_value_method_info_get_value_OUT_ARG_value,
3276 NULL
3277};
3278
3279static const _ExtendedGDBusMethodInfo _sensor_value_method_info_get_value =
3280{
3281 {
3282 -1,
3283 (gchar *) "getValue",
3284 NULL,
3285 (GDBusArgInfo **) &_sensor_value_method_info_get_value_OUT_ARG_pointers,
3286 NULL
3287 },
3288 "handle-get-value",
3289 FALSE
3290};
3291
Norman James19e45912015-10-04 20:19:41 -05003292static const _ExtendedGDBusArgInfo _sensor_value_method_info_set_value_IN_ARG_value =
3293{
3294 {
3295 -1,
3296 (gchar *) "value",
3297 (gchar *) "v",
3298 NULL
3299 },
3300 FALSE
3301};
3302
3303static const _ExtendedGDBusArgInfo * const _sensor_value_method_info_set_value_IN_ARG_pointers[] =
3304{
3305 &_sensor_value_method_info_set_value_IN_ARG_value,
3306 NULL
3307};
3308
3309static const _ExtendedGDBusMethodInfo _sensor_value_method_info_set_value =
3310{
3311 {
3312 -1,
3313 (gchar *) "setValue",
3314 (GDBusArgInfo **) &_sensor_value_method_info_set_value_IN_ARG_pointers,
3315 NULL,
3316 NULL
3317 },
3318 "handle-set-value",
3319 FALSE
3320};
3321
Norman James362a80f2015-09-14 14:04:39 -05003322static const _ExtendedGDBusMethodInfo * const _sensor_value_method_info_pointers[] =
3323{
3324 &_sensor_value_method_info_init,
3325 &_sensor_value_method_info_get_value,
Norman James19e45912015-10-04 20:19:41 -05003326 &_sensor_value_method_info_set_value,
Norman James362a80f2015-09-14 14:04:39 -05003327 NULL
3328};
3329
3330static const _ExtendedGDBusArgInfo _sensor_value_signal_info_changed_ARG_value =
3331{
3332 {
3333 -1,
3334 (gchar *) "value",
3335 (gchar *) "v",
3336 NULL
3337 },
3338 FALSE
3339};
3340
3341static const _ExtendedGDBusArgInfo _sensor_value_signal_info_changed_ARG_units =
3342{
3343 {
3344 -1,
3345 (gchar *) "units",
3346 (gchar *) "s",
3347 NULL
3348 },
3349 FALSE
3350};
3351
3352static const _ExtendedGDBusArgInfo * const _sensor_value_signal_info_changed_ARG_pointers[] =
3353{
3354 &_sensor_value_signal_info_changed_ARG_value,
3355 &_sensor_value_signal_info_changed_ARG_units,
3356 NULL
3357};
3358
3359static const _ExtendedGDBusSignalInfo _sensor_value_signal_info_changed =
3360{
3361 {
3362 -1,
3363 (gchar *) "Changed",
3364 (GDBusArgInfo **) &_sensor_value_signal_info_changed_ARG_pointers,
3365 NULL
3366 },
3367 "changed"
3368};
3369
Norman James32e74e22015-09-15 21:28:06 -05003370static const _ExtendedGDBusSignalInfo _sensor_value_signal_info_error =
3371{
3372 {
3373 -1,
3374 (gchar *) "Error",
3375 NULL,
3376 NULL
3377 },
3378 "error"
3379};
3380
Norman James362a80f2015-09-14 14:04:39 -05003381static const _ExtendedGDBusArgInfo _sensor_value_signal_info_heartbeat_ARG_bus_name =
3382{
3383 {
3384 -1,
3385 (gchar *) "bus_name",
3386 (gchar *) "s",
3387 NULL
3388 },
3389 FALSE
3390};
3391
3392static const _ExtendedGDBusArgInfo * const _sensor_value_signal_info_heartbeat_ARG_pointers[] =
3393{
3394 &_sensor_value_signal_info_heartbeat_ARG_bus_name,
3395 NULL
3396};
3397
3398static const _ExtendedGDBusSignalInfo _sensor_value_signal_info_heartbeat =
3399{
3400 {
3401 -1,
3402 (gchar *) "Heartbeat",
3403 (GDBusArgInfo **) &_sensor_value_signal_info_heartbeat_ARG_pointers,
3404 NULL
3405 },
3406 "heartbeat"
3407};
3408
3409static const _ExtendedGDBusSignalInfo * const _sensor_value_signal_info_pointers[] =
3410{
3411 &_sensor_value_signal_info_changed,
Norman James32e74e22015-09-15 21:28:06 -05003412 &_sensor_value_signal_info_error,
Norman James362a80f2015-09-14 14:04:39 -05003413 &_sensor_value_signal_info_heartbeat,
3414 NULL
3415};
3416
3417static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_value =
3418{
3419 {
3420 -1,
3421 (gchar *) "value",
3422 (gchar *) "v",
3423 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
3424 NULL
3425 },
3426 "value",
3427 FALSE
3428};
3429
3430static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_units =
3431{
3432 {
3433 -1,
3434 (gchar *) "units",
3435 (gchar *) "s",
3436 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
3437 NULL
3438 },
3439 "units",
3440 FALSE
3441};
3442
3443static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_poll_interval =
3444{
3445 {
3446 -1,
3447 (gchar *) "poll_interval",
3448 (gchar *) "i",
3449 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
3450 NULL
3451 },
3452 "poll-interval",
3453 FALSE
3454};
3455
3456static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_heatbeat =
3457{
3458 {
3459 -1,
3460 (gchar *) "heatbeat",
3461 (gchar *) "i",
3462 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
3463 NULL
3464 },
3465 "heatbeat",
3466 FALSE
3467};
3468
3469static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_settable =
3470{
3471 {
3472 -1,
3473 (gchar *) "settable",
3474 (gchar *) "b",
3475 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
3476 NULL
3477 },
3478 "settable",
3479 FALSE
3480};
3481
Norman James362a80f2015-09-14 14:04:39 -05003482static const _ExtendedGDBusPropertyInfo * const _sensor_value_property_info_pointers[] =
3483{
3484 &_sensor_value_property_info_value,
3485 &_sensor_value_property_info_units,
3486 &_sensor_value_property_info_poll_interval,
3487 &_sensor_value_property_info_heatbeat,
3488 &_sensor_value_property_info_settable,
Norman James362a80f2015-09-14 14:04:39 -05003489 NULL
3490};
3491
3492static const _ExtendedGDBusInterfaceInfo _sensor_value_interface_info =
3493{
3494 {
3495 -1,
3496 (gchar *) "org.openbmc.SensorValue",
3497 (GDBusMethodInfo **) &_sensor_value_method_info_pointers,
3498 (GDBusSignalInfo **) &_sensor_value_signal_info_pointers,
3499 (GDBusPropertyInfo **) &_sensor_value_property_info_pointers,
3500 NULL
3501 },
3502 "sensor-value",
3503};
3504
3505
3506/**
3507 * sensor_value_interface_info:
3508 *
3509 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link> D-Bus interface.
3510 *
3511 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
3512 */
3513GDBusInterfaceInfo *
3514sensor_value_interface_info (void)
3515{
3516 return (GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct;
3517}
3518
3519/**
3520 * sensor_value_override_properties:
3521 * @klass: The class structure for a #GObject<!-- -->-derived class.
3522 * @property_id_begin: The property id to assign to the first overridden property.
3523 *
3524 * Overrides all #GObject properties in the #SensorValue interface for a concrete class.
3525 * The properties are overridden in the order they are defined.
3526 *
3527 * Returns: The last property id.
3528 */
3529guint
3530sensor_value_override_properties (GObjectClass *klass, guint property_id_begin)
3531{
3532 g_object_class_override_property (klass, property_id_begin++, "value");
3533 g_object_class_override_property (klass, property_id_begin++, "units");
3534 g_object_class_override_property (klass, property_id_begin++, "poll-interval");
3535 g_object_class_override_property (klass, property_id_begin++, "heatbeat");
3536 g_object_class_override_property (klass, property_id_begin++, "settable");
Norman James362a80f2015-09-14 14:04:39 -05003537 return property_id_begin - 1;
3538}
3539
3540
3541
3542/**
3543 * SensorValue:
3544 *
3545 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link>.
3546 */
3547
3548/**
3549 * SensorValueIface:
3550 * @parent_iface: The parent interface.
3551 * @handle_get_value: Handler for the #SensorValue::handle-get-value signal.
3552 * @handle_init: Handler for the #SensorValue::handle-init signal.
Norman James19e45912015-10-04 20:19:41 -05003553 * @handle_set_value: Handler for the #SensorValue::handle-set-value signal.
Norman James362a80f2015-09-14 14:04:39 -05003554 * @get_heatbeat: Getter for the #SensorValue:heatbeat property.
Norman James362a80f2015-09-14 14:04:39 -05003555 * @get_poll_interval: Getter for the #SensorValue:poll-interval property.
3556 * @get_settable: Getter for the #SensorValue:settable property.
3557 * @get_units: Getter for the #SensorValue:units property.
3558 * @get_value: Getter for the #SensorValue:value property.
3559 * @changed: Handler for the #SensorValue::changed signal.
Norman James32e74e22015-09-15 21:28:06 -05003560 * @error: Handler for the #SensorValue::error signal.
Norman James362a80f2015-09-14 14:04:39 -05003561 * @heartbeat: Handler for the #SensorValue::heartbeat signal.
3562 *
3563 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link>.
3564 */
3565
3566typedef SensorValueIface SensorValueInterface;
3567G_DEFINE_INTERFACE (SensorValue, sensor_value, G_TYPE_OBJECT);
3568
3569static void
3570sensor_value_default_init (SensorValueIface *iface)
3571{
3572 /* GObject signals for incoming D-Bus method calls: */
3573 /**
3574 * SensorValue::handle-init:
3575 * @object: A #SensorValue.
3576 * @invocation: A #GDBusMethodInvocation.
3577 *
3578 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorValue.init">init()</link> D-Bus method.
3579 *
3580 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call sensor_value_complete_init() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
3581 *
3582 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
3583 */
3584 g_signal_new ("handle-init",
3585 G_TYPE_FROM_INTERFACE (iface),
3586 G_SIGNAL_RUN_LAST,
3587 G_STRUCT_OFFSET (SensorValueIface, handle_init),
3588 g_signal_accumulator_true_handled,
3589 NULL,
3590 g_cclosure_marshal_generic,
3591 G_TYPE_BOOLEAN,
3592 1,
3593 G_TYPE_DBUS_METHOD_INVOCATION);
3594
3595 /**
3596 * SensorValue::handle-get-value:
3597 * @object: A #SensorValue.
3598 * @invocation: A #GDBusMethodInvocation.
3599 *
3600 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorValue.getValue">getValue()</link> D-Bus method.
3601 *
3602 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call sensor_value_complete_get_value() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
3603 *
3604 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
3605 */
3606 g_signal_new ("handle-get-value",
3607 G_TYPE_FROM_INTERFACE (iface),
3608 G_SIGNAL_RUN_LAST,
3609 G_STRUCT_OFFSET (SensorValueIface, handle_get_value),
3610 g_signal_accumulator_true_handled,
3611 NULL,
3612 g_cclosure_marshal_generic,
3613 G_TYPE_BOOLEAN,
3614 1,
3615 G_TYPE_DBUS_METHOD_INVOCATION);
3616
Norman James19e45912015-10-04 20:19:41 -05003617 /**
3618 * SensorValue::handle-set-value:
3619 * @object: A #SensorValue.
3620 * @invocation: A #GDBusMethodInvocation.
3621 * @arg_value: Argument passed by remote caller.
3622 *
3623 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorValue.setValue">setValue()</link> D-Bus method.
3624 *
3625 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call sensor_value_complete_set_value() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
3626 *
3627 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
3628 */
3629 g_signal_new ("handle-set-value",
3630 G_TYPE_FROM_INTERFACE (iface),
3631 G_SIGNAL_RUN_LAST,
3632 G_STRUCT_OFFSET (SensorValueIface, handle_set_value),
3633 g_signal_accumulator_true_handled,
3634 NULL,
3635 g_cclosure_marshal_generic,
3636 G_TYPE_BOOLEAN,
3637 2,
3638 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_VARIANT);
3639
Norman James362a80f2015-09-14 14:04:39 -05003640 /* GObject signals for received D-Bus signals: */
3641 /**
3642 * SensorValue::changed:
3643 * @object: A #SensorValue.
3644 * @arg_value: Argument.
3645 * @arg_units: Argument.
3646 *
3647 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-SensorValue.Changed">"Changed"</link> is received.
3648 *
3649 * 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.
3650 */
3651 g_signal_new ("changed",
3652 G_TYPE_FROM_INTERFACE (iface),
3653 G_SIGNAL_RUN_LAST,
3654 G_STRUCT_OFFSET (SensorValueIface, changed),
3655 NULL,
3656 NULL,
3657 g_cclosure_marshal_generic,
3658 G_TYPE_NONE,
3659 2, G_TYPE_VARIANT, G_TYPE_STRING);
3660
3661 /**
Norman James32e74e22015-09-15 21:28:06 -05003662 * SensorValue::error:
3663 * @object: A #SensorValue.
3664 *
3665 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-SensorValue.Error">"Error"</link> is received.
3666 *
3667 * 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.
3668 */
3669 g_signal_new ("error",
3670 G_TYPE_FROM_INTERFACE (iface),
3671 G_SIGNAL_RUN_LAST,
3672 G_STRUCT_OFFSET (SensorValueIface, error),
3673 NULL,
3674 NULL,
3675 g_cclosure_marshal_generic,
3676 G_TYPE_NONE,
3677 0);
3678
3679 /**
Norman James362a80f2015-09-14 14:04:39 -05003680 * SensorValue::heartbeat:
3681 * @object: A #SensorValue.
3682 * @arg_bus_name: Argument.
3683 *
3684 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-SensorValue.Heartbeat">"Heartbeat"</link> is received.
3685 *
3686 * 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.
3687 */
3688 g_signal_new ("heartbeat",
3689 G_TYPE_FROM_INTERFACE (iface),
3690 G_SIGNAL_RUN_LAST,
3691 G_STRUCT_OFFSET (SensorValueIface, heartbeat),
3692 NULL,
3693 NULL,
3694 g_cclosure_marshal_generic,
3695 G_TYPE_NONE,
3696 1, G_TYPE_STRING);
3697
3698 /* GObject properties for D-Bus properties: */
3699 /**
3700 * SensorValue:value:
3701 *
3702 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link>.
3703 *
3704 * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.
3705 */
3706 g_object_interface_install_property (iface,
3707 g_param_spec_variant ("value", "value", "value", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
3708 /**
3709 * SensorValue:units:
3710 *
3711 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link>.
3712 *
3713 * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.
3714 */
3715 g_object_interface_install_property (iface,
3716 g_param_spec_string ("units", "units", "units", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
3717 /**
3718 * SensorValue:poll-interval:
3719 *
3720 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.poll_interval">"poll_interval"</link>.
3721 *
3722 * 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.
3723 */
3724 g_object_interface_install_property (iface,
3725 g_param_spec_int ("poll-interval", "poll_interval", "poll_interval", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
3726 /**
3727 * SensorValue:heatbeat:
3728 *
3729 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.heatbeat">"heatbeat"</link>.
3730 *
3731 * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.
3732 */
3733 g_object_interface_install_property (iface,
3734 g_param_spec_int ("heatbeat", "heatbeat", "heatbeat", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
3735 /**
3736 * SensorValue:settable:
3737 *
3738 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.settable">"settable"</link>.
3739 *
3740 * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.
3741 */
3742 g_object_interface_install_property (iface,
3743 g_param_spec_boolean ("settable", "settable", "settable", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Norman James362a80f2015-09-14 14:04:39 -05003744}
3745
3746/**
3747 * sensor_value_get_value: (skip)
3748 * @object: A #SensorValue.
3749 *
3750 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link> D-Bus property.
3751 *
3752 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
3753 *
3754 * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use sensor_value_dup_value() if on another thread.</warning>
3755 *
3756 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
3757 */
3758GVariant *
3759sensor_value_get_value (SensorValue *object)
3760{
3761 return SENSOR_VALUE_GET_IFACE (object)->get_value (object);
3762}
3763
3764/**
3765 * sensor_value_dup_value: (skip)
3766 * @object: A #SensorValue.
3767 *
3768 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link> D-Bus property.
3769 *
3770 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
3771 *
3772 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
3773 */
3774GVariant *
3775sensor_value_dup_value (SensorValue *object)
3776{
3777 GVariant *value;
3778 g_object_get (G_OBJECT (object), "value", &value, NULL);
3779 return value;
3780}
3781
3782/**
3783 * sensor_value_set_value: (skip)
3784 * @object: A #SensorValue.
3785 * @value: The value to set.
3786 *
3787 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link> D-Bus property to @value.
3788 *
3789 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
3790 */
3791void
3792sensor_value_set_value (SensorValue *object, GVariant *value)
3793{
3794 g_object_set (G_OBJECT (object), "value", value, NULL);
3795}
3796
3797/**
3798 * sensor_value_get_units: (skip)
3799 * @object: A #SensorValue.
3800 *
3801 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link> D-Bus property.
3802 *
3803 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
3804 *
3805 * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use sensor_value_dup_units() if on another thread.</warning>
3806 *
3807 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
3808 */
3809const gchar *
3810sensor_value_get_units (SensorValue *object)
3811{
3812 return SENSOR_VALUE_GET_IFACE (object)->get_units (object);
3813}
3814
3815/**
3816 * sensor_value_dup_units: (skip)
3817 * @object: A #SensorValue.
3818 *
3819 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link> D-Bus property.
3820 *
3821 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
3822 *
3823 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
3824 */
3825gchar *
3826sensor_value_dup_units (SensorValue *object)
3827{
3828 gchar *value;
3829 g_object_get (G_OBJECT (object), "units", &value, NULL);
3830 return value;
3831}
3832
3833/**
3834 * sensor_value_set_units: (skip)
3835 * @object: A #SensorValue.
3836 * @value: The value to set.
3837 *
3838 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link> D-Bus property to @value.
3839 *
3840 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
3841 */
3842void
3843sensor_value_set_units (SensorValue *object, const gchar *value)
3844{
3845 g_object_set (G_OBJECT (object), "units", value, NULL);
3846}
3847
3848/**
3849 * sensor_value_get_poll_interval: (skip)
3850 * @object: A #SensorValue.
3851 *
3852 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.poll_interval">"poll_interval"</link> D-Bus property.
3853 *
3854 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
3855 *
3856 * Returns: The property value.
3857 */
3858gint
3859sensor_value_get_poll_interval (SensorValue *object)
3860{
3861 return SENSOR_VALUE_GET_IFACE (object)->get_poll_interval (object);
3862}
3863
3864/**
3865 * sensor_value_set_poll_interval: (skip)
3866 * @object: A #SensorValue.
3867 * @value: The value to set.
3868 *
3869 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.poll_interval">"poll_interval"</link> D-Bus property to @value.
3870 *
3871 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
3872 */
3873void
3874sensor_value_set_poll_interval (SensorValue *object, gint value)
3875{
3876 g_object_set (G_OBJECT (object), "poll-interval", value, NULL);
3877}
3878
3879/**
3880 * sensor_value_get_heatbeat: (skip)
3881 * @object: A #SensorValue.
3882 *
3883 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.heatbeat">"heatbeat"</link> D-Bus property.
3884 *
3885 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
3886 *
3887 * Returns: The property value.
3888 */
3889gint
3890sensor_value_get_heatbeat (SensorValue *object)
3891{
3892 return SENSOR_VALUE_GET_IFACE (object)->get_heatbeat (object);
3893}
3894
3895/**
3896 * sensor_value_set_heatbeat: (skip)
3897 * @object: A #SensorValue.
3898 * @value: The value to set.
3899 *
3900 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.heatbeat">"heatbeat"</link> D-Bus property to @value.
3901 *
3902 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
3903 */
3904void
3905sensor_value_set_heatbeat (SensorValue *object, gint value)
3906{
3907 g_object_set (G_OBJECT (object), "heatbeat", value, NULL);
3908}
3909
3910/**
3911 * sensor_value_get_settable: (skip)
3912 * @object: A #SensorValue.
3913 *
3914 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.settable">"settable"</link> D-Bus property.
3915 *
3916 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
3917 *
3918 * Returns: The property value.
3919 */
3920gboolean
3921sensor_value_get_settable (SensorValue *object)
3922{
3923 return SENSOR_VALUE_GET_IFACE (object)->get_settable (object);
3924}
3925
3926/**
3927 * sensor_value_set_settable: (skip)
3928 * @object: A #SensorValue.
3929 * @value: The value to set.
3930 *
3931 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.settable">"settable"</link> D-Bus property to @value.
3932 *
3933 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
3934 */
3935void
3936sensor_value_set_settable (SensorValue *object, gboolean value)
3937{
3938 g_object_set (G_OBJECT (object), "settable", value, NULL);
3939}
3940
3941/**
Norman James362a80f2015-09-14 14:04:39 -05003942 * sensor_value_emit_changed:
3943 * @object: A #SensorValue.
3944 * @arg_value: Argument to pass with the signal.
3945 * @arg_units: Argument to pass with the signal.
3946 *
3947 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorValue.Changed">"Changed"</link> D-Bus signal.
3948 */
3949void
3950sensor_value_emit_changed (
3951 SensorValue *object,
3952 GVariant *arg_value,
3953 const gchar *arg_units)
3954{
3955 g_signal_emit_by_name (object, "changed", arg_value, arg_units);
3956}
3957
3958/**
Norman James32e74e22015-09-15 21:28:06 -05003959 * sensor_value_emit_error:
3960 * @object: A #SensorValue.
3961 *
3962 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorValue.Error">"Error"</link> D-Bus signal.
3963 */
3964void
3965sensor_value_emit_error (
3966 SensorValue *object)
3967{
3968 g_signal_emit_by_name (object, "error");
3969}
3970
3971/**
Norman James362a80f2015-09-14 14:04:39 -05003972 * sensor_value_emit_heartbeat:
3973 * @object: A #SensorValue.
3974 * @arg_bus_name: Argument to pass with the signal.
3975 *
3976 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorValue.Heartbeat">"Heartbeat"</link> D-Bus signal.
3977 */
3978void
3979sensor_value_emit_heartbeat (
3980 SensorValue *object,
3981 const gchar *arg_bus_name)
3982{
3983 g_signal_emit_by_name (object, "heartbeat", arg_bus_name);
3984}
3985
3986/**
3987 * sensor_value_call_init:
3988 * @proxy: A #SensorValueProxy.
3989 * @cancellable: (allow-none): A #GCancellable or %NULL.
3990 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
3991 * @user_data: User data to pass to @callback.
3992 *
3993 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorValue.init">init()</link> D-Bus method on @proxy.
3994 * 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.
3995 * You can then call sensor_value_call_init_finish() to get the result of the operation.
3996 *
3997 * See sensor_value_call_init_sync() for the synchronous, blocking version of this method.
3998 */
3999void
4000sensor_value_call_init (
4001 SensorValue *proxy,
4002 GCancellable *cancellable,
4003 GAsyncReadyCallback callback,
4004 gpointer user_data)
4005{
4006 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
4007 "init",
4008 g_variant_new ("()"),
4009 G_DBUS_CALL_FLAGS_NONE,
4010 -1,
4011 cancellable,
4012 callback,
4013 user_data);
4014}
4015
4016/**
4017 * sensor_value_call_init_finish:
4018 * @proxy: A #SensorValueProxy.
4019 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_call_init().
4020 * @error: Return location for error or %NULL.
4021 *
4022 * Finishes an operation started with sensor_value_call_init().
4023 *
4024 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
4025 */
4026gboolean
4027sensor_value_call_init_finish (
4028 SensorValue *proxy,
4029 GAsyncResult *res,
4030 GError **error)
4031{
4032 GVariant *_ret;
4033 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
4034 if (_ret == NULL)
4035 goto _out;
4036 g_variant_get (_ret,
4037 "()");
4038 g_variant_unref (_ret);
4039_out:
4040 return _ret != NULL;
4041}
4042
4043/**
4044 * sensor_value_call_init_sync:
4045 * @proxy: A #SensorValueProxy.
4046 * @cancellable: (allow-none): A #GCancellable or %NULL.
4047 * @error: Return location for error or %NULL.
4048 *
4049 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorValue.init">init()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
4050 *
4051 * See sensor_value_call_init() for the asynchronous version of this method.
4052 *
4053 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
4054 */
4055gboolean
4056sensor_value_call_init_sync (
4057 SensorValue *proxy,
4058 GCancellable *cancellable,
4059 GError **error)
4060{
4061 GVariant *_ret;
4062 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
4063 "init",
4064 g_variant_new ("()"),
4065 G_DBUS_CALL_FLAGS_NONE,
4066 -1,
4067 cancellable,
4068 error);
4069 if (_ret == NULL)
4070 goto _out;
4071 g_variant_get (_ret,
4072 "()");
4073 g_variant_unref (_ret);
4074_out:
4075 return _ret != NULL;
4076}
4077
4078/**
4079 * sensor_value_call_get_value:
4080 * @proxy: A #SensorValueProxy.
4081 * @cancellable: (allow-none): A #GCancellable or %NULL.
4082 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
4083 * @user_data: User data to pass to @callback.
4084 *
4085 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorValue.getValue">getValue()</link> D-Bus method on @proxy.
4086 * 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.
4087 * You can then call sensor_value_call_get_value_finish() to get the result of the operation.
4088 *
4089 * See sensor_value_call_get_value_sync() for the synchronous, blocking version of this method.
4090 */
4091void
4092sensor_value_call_get_value (
4093 SensorValue *proxy,
4094 GCancellable *cancellable,
4095 GAsyncReadyCallback callback,
4096 gpointer user_data)
4097{
4098 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
4099 "getValue",
4100 g_variant_new ("()"),
4101 G_DBUS_CALL_FLAGS_NONE,
4102 -1,
4103 cancellable,
4104 callback,
4105 user_data);
4106}
4107
4108/**
4109 * sensor_value_call_get_value_finish:
4110 * @proxy: A #SensorValueProxy.
4111 * @out_value: (out): Return location for return parameter or %NULL to ignore.
4112 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_call_get_value().
4113 * @error: Return location for error or %NULL.
4114 *
4115 * Finishes an operation started with sensor_value_call_get_value().
4116 *
4117 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
4118 */
4119gboolean
4120sensor_value_call_get_value_finish (
4121 SensorValue *proxy,
4122 GVariant **out_value,
4123 GAsyncResult *res,
4124 GError **error)
4125{
4126 GVariant *_ret;
4127 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
4128 if (_ret == NULL)
4129 goto _out;
4130 g_variant_get (_ret,
4131 "(@v)",
4132 out_value);
4133 g_variant_unref (_ret);
4134_out:
4135 return _ret != NULL;
4136}
4137
4138/**
4139 * sensor_value_call_get_value_sync:
4140 * @proxy: A #SensorValueProxy.
4141 * @out_value: (out): Return location for return parameter or %NULL to ignore.
4142 * @cancellable: (allow-none): A #GCancellable or %NULL.
4143 * @error: Return location for error or %NULL.
4144 *
4145 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorValue.getValue">getValue()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
4146 *
4147 * See sensor_value_call_get_value() for the asynchronous version of this method.
4148 *
4149 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
4150 */
4151gboolean
4152sensor_value_call_get_value_sync (
4153 SensorValue *proxy,
4154 GVariant **out_value,
4155 GCancellable *cancellable,
4156 GError **error)
4157{
4158 GVariant *_ret;
4159 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
4160 "getValue",
4161 g_variant_new ("()"),
4162 G_DBUS_CALL_FLAGS_NONE,
4163 -1,
4164 cancellable,
4165 error);
4166 if (_ret == NULL)
4167 goto _out;
4168 g_variant_get (_ret,
4169 "(@v)",
4170 out_value);
4171 g_variant_unref (_ret);
4172_out:
4173 return _ret != NULL;
4174}
4175
4176/**
Norman James19e45912015-10-04 20:19:41 -05004177 * sensor_value_call_set_value:
4178 * @proxy: A #SensorValueProxy.
4179 * @arg_value: Argument to pass with the method invocation.
4180 * @cancellable: (allow-none): A #GCancellable or %NULL.
4181 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
4182 * @user_data: User data to pass to @callback.
4183 *
4184 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorValue.setValue">setValue()</link> D-Bus method on @proxy.
4185 * 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.
4186 * You can then call sensor_value_call_set_value_finish() to get the result of the operation.
4187 *
4188 * See sensor_value_call_set_value_sync() for the synchronous, blocking version of this method.
4189 */
4190void
4191sensor_value_call_set_value (
4192 SensorValue *proxy,
4193 GVariant *arg_value,
4194 GCancellable *cancellable,
4195 GAsyncReadyCallback callback,
4196 gpointer user_data)
4197{
4198 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
4199 "setValue",
4200 g_variant_new ("(@v)",
4201 arg_value),
4202 G_DBUS_CALL_FLAGS_NONE,
4203 -1,
4204 cancellable,
4205 callback,
4206 user_data);
4207}
4208
4209/**
4210 * sensor_value_call_set_value_finish:
4211 * @proxy: A #SensorValueProxy.
4212 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_call_set_value().
4213 * @error: Return location for error or %NULL.
4214 *
4215 * Finishes an operation started with sensor_value_call_set_value().
4216 *
4217 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
4218 */
4219gboolean
4220sensor_value_call_set_value_finish (
4221 SensorValue *proxy,
4222 GAsyncResult *res,
4223 GError **error)
4224{
4225 GVariant *_ret;
4226 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
4227 if (_ret == NULL)
4228 goto _out;
4229 g_variant_get (_ret,
4230 "()");
4231 g_variant_unref (_ret);
4232_out:
4233 return _ret != NULL;
4234}
4235
4236/**
4237 * sensor_value_call_set_value_sync:
4238 * @proxy: A #SensorValueProxy.
4239 * @arg_value: Argument to pass with the method invocation.
4240 * @cancellable: (allow-none): A #GCancellable or %NULL.
4241 * @error: Return location for error or %NULL.
4242 *
4243 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorValue.setValue">setValue()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
4244 *
4245 * See sensor_value_call_set_value() for the asynchronous version of this method.
4246 *
4247 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
4248 */
4249gboolean
4250sensor_value_call_set_value_sync (
4251 SensorValue *proxy,
4252 GVariant *arg_value,
4253 GCancellable *cancellable,
4254 GError **error)
4255{
4256 GVariant *_ret;
4257 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
4258 "setValue",
4259 g_variant_new ("(@v)",
4260 arg_value),
4261 G_DBUS_CALL_FLAGS_NONE,
4262 -1,
4263 cancellable,
4264 error);
4265 if (_ret == NULL)
4266 goto _out;
4267 g_variant_get (_ret,
4268 "()");
4269 g_variant_unref (_ret);
4270_out:
4271 return _ret != NULL;
4272}
4273
4274/**
Norman James362a80f2015-09-14 14:04:39 -05004275 * sensor_value_complete_init:
4276 * @object: A #SensorValue.
4277 * @invocation: (transfer full): A #GDBusMethodInvocation.
4278 *
4279 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-SensorValue.init">init()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
4280 *
4281 * This method will free @invocation, you cannot use it afterwards.
4282 */
4283void
4284sensor_value_complete_init (
4285 SensorValue *object,
4286 GDBusMethodInvocation *invocation)
4287{
4288 g_dbus_method_invocation_return_value (invocation,
4289 g_variant_new ("()"));
4290}
4291
4292/**
4293 * sensor_value_complete_get_value:
4294 * @object: A #SensorValue.
4295 * @invocation: (transfer full): A #GDBusMethodInvocation.
4296 * @value: Parameter to return.
4297 *
4298 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-SensorValue.getValue">getValue()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
4299 *
4300 * This method will free @invocation, you cannot use it afterwards.
4301 */
4302void
4303sensor_value_complete_get_value (
4304 SensorValue *object,
4305 GDBusMethodInvocation *invocation,
4306 GVariant *value)
4307{
4308 g_dbus_method_invocation_return_value (invocation,
4309 g_variant_new ("(@v)",
4310 value));
4311}
4312
Norman James19e45912015-10-04 20:19:41 -05004313/**
4314 * sensor_value_complete_set_value:
4315 * @object: A #SensorValue.
4316 * @invocation: (transfer full): A #GDBusMethodInvocation.
4317 *
4318 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-SensorValue.setValue">setValue()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
4319 *
4320 * This method will free @invocation, you cannot use it afterwards.
4321 */
4322void
4323sensor_value_complete_set_value (
4324 SensorValue *object,
4325 GDBusMethodInvocation *invocation)
4326{
4327 g_dbus_method_invocation_return_value (invocation,
4328 g_variant_new ("()"));
4329}
4330
Norman James362a80f2015-09-14 14:04:39 -05004331/* ------------------------------------------------------------------------ */
4332
4333/**
4334 * SensorValueProxy:
4335 *
4336 * The #SensorValueProxy structure contains only private data and should only be accessed using the provided API.
4337 */
4338
4339/**
4340 * SensorValueProxyClass:
4341 * @parent_class: The parent class.
4342 *
4343 * Class structure for #SensorValueProxy.
4344 */
4345
4346struct _SensorValueProxyPrivate
4347{
4348 GData *qdata;
4349};
4350
4351static void sensor_value_proxy_iface_init (SensorValueIface *iface);
4352
4353#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
4354G_DEFINE_TYPE_WITH_CODE (SensorValueProxy, sensor_value_proxy, G_TYPE_DBUS_PROXY,
4355 G_ADD_PRIVATE (SensorValueProxy)
4356 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_proxy_iface_init));
4357
4358#else
4359G_DEFINE_TYPE_WITH_CODE (SensorValueProxy, sensor_value_proxy, G_TYPE_DBUS_PROXY,
4360 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_proxy_iface_init));
4361
4362#endif
4363static void
4364sensor_value_proxy_finalize (GObject *object)
4365{
4366 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
4367 g_datalist_clear (&proxy->priv->qdata);
4368 G_OBJECT_CLASS (sensor_value_proxy_parent_class)->finalize (object);
4369}
4370
4371static void
4372sensor_value_proxy_get_property (GObject *object,
4373 guint prop_id,
4374 GValue *value,
4375 GParamSpec *pspec G_GNUC_UNUSED)
4376{
4377 const _ExtendedGDBusPropertyInfo *info;
4378 GVariant *variant;
Norman Jamesdfdaca92015-09-27 22:11:15 -05004379 g_assert (prop_id != 0 && prop_id - 1 < 5);
Norman James362a80f2015-09-14 14:04:39 -05004380 info = _sensor_value_property_info_pointers[prop_id - 1];
4381 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
4382 if (info->use_gvariant)
4383 {
4384 g_value_set_variant (value, variant);
4385 }
4386 else
4387 {
4388 if (variant != NULL)
4389 g_dbus_gvariant_to_gvalue (variant, value);
4390 }
4391 if (variant != NULL)
4392 g_variant_unref (variant);
4393}
4394
4395static void
4396sensor_value_proxy_set_property_cb (GDBusProxy *proxy,
4397 GAsyncResult *res,
4398 gpointer user_data)
4399{
4400 const _ExtendedGDBusPropertyInfo *info = user_data;
4401 GError *error;
4402 GVariant *_ret;
4403 error = NULL;
4404 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
4405 if (!_ret)
4406 {
4407 g_warning ("Error setting property '%s' on interface org.openbmc.SensorValue: %s (%s, %d)",
4408 info->parent_struct.name,
4409 error->message, g_quark_to_string (error->domain), error->code);
4410 g_error_free (error);
4411 }
4412 else
4413 {
4414 g_variant_unref (_ret);
4415 }
4416}
4417
4418static void
4419sensor_value_proxy_set_property (GObject *object,
4420 guint prop_id,
4421 const GValue *value,
4422 GParamSpec *pspec G_GNUC_UNUSED)
4423{
4424 const _ExtendedGDBusPropertyInfo *info;
4425 GVariant *variant;
Norman Jamesdfdaca92015-09-27 22:11:15 -05004426 g_assert (prop_id != 0 && prop_id - 1 < 5);
Norman James362a80f2015-09-14 14:04:39 -05004427 info = _sensor_value_property_info_pointers[prop_id - 1];
4428 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
4429 g_dbus_proxy_call (G_DBUS_PROXY (object),
4430 "org.freedesktop.DBus.Properties.Set",
4431 g_variant_new ("(ssv)", "org.openbmc.SensorValue", info->parent_struct.name, variant),
4432 G_DBUS_CALL_FLAGS_NONE,
4433 -1,
4434 NULL, (GAsyncReadyCallback) sensor_value_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
4435 g_variant_unref (variant);
4436}
4437
4438static void
4439sensor_value_proxy_g_signal (GDBusProxy *proxy,
4440 const gchar *sender_name G_GNUC_UNUSED,
4441 const gchar *signal_name,
4442 GVariant *parameters)
4443{
4444 _ExtendedGDBusSignalInfo *info;
4445 GVariantIter iter;
4446 GVariant *child;
4447 GValue *paramv;
4448 guint num_params;
4449 guint n;
4450 guint signal_id;
4451 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, signal_name);
4452 if (info == NULL)
4453 return;
4454 num_params = g_variant_n_children (parameters);
4455 paramv = g_new0 (GValue, num_params + 1);
4456 g_value_init (&paramv[0], TYPE_SENSOR_VALUE);
4457 g_value_set_object (&paramv[0], proxy);
4458 g_variant_iter_init (&iter, parameters);
4459 n = 1;
4460 while ((child = g_variant_iter_next_value (&iter)) != NULL)
4461 {
4462 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
4463 if (arg_info->use_gvariant)
4464 {
4465 g_value_init (&paramv[n], G_TYPE_VARIANT);
4466 g_value_set_variant (&paramv[n], child);
4467 n++;
4468 }
4469 else
4470 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
4471 g_variant_unref (child);
4472 }
4473 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_VALUE);
4474 g_signal_emitv (paramv, signal_id, 0, NULL);
4475 for (n = 0; n < num_params + 1; n++)
4476 g_value_unset (&paramv[n]);
4477 g_free (paramv);
4478}
4479
4480static void
4481sensor_value_proxy_g_properties_changed (GDBusProxy *_proxy,
4482 GVariant *changed_properties,
4483 const gchar *const *invalidated_properties)
4484{
4485 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (_proxy);
4486 guint n;
4487 const gchar *key;
4488 GVariantIter *iter;
4489 _ExtendedGDBusPropertyInfo *info;
4490 g_variant_get (changed_properties, "a{sv}", &iter);
4491 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
4492 {
4493 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, key);
4494 g_datalist_remove_data (&proxy->priv->qdata, key);
4495 if (info != NULL)
4496 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
4497 }
4498 g_variant_iter_free (iter);
4499 for (n = 0; invalidated_properties[n] != NULL; n++)
4500 {
4501 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, invalidated_properties[n]);
4502 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
4503 if (info != NULL)
4504 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
4505 }
4506}
4507
4508static GVariant *
4509sensor_value_proxy_get_value (SensorValue *object)
4510{
4511 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
4512 GVariant *variant;
4513 GVariant *value = NULL;
4514 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "value");
4515 value = variant;
4516 if (variant != NULL)
4517 g_variant_unref (variant);
4518 return value;
4519}
4520
4521static const gchar *
4522sensor_value_proxy_get_units (SensorValue *object)
4523{
4524 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
4525 GVariant *variant;
4526 const gchar *value = NULL;
4527 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "units");
4528 if (variant != NULL)
4529 {
4530 value = g_variant_get_string (variant, NULL);
4531 g_variant_unref (variant);
4532 }
4533 return value;
4534}
4535
4536static gint
4537sensor_value_proxy_get_poll_interval (SensorValue *object)
4538{
4539 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
4540 GVariant *variant;
4541 gint value = 0;
4542 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "poll_interval");
4543 if (variant != NULL)
4544 {
4545 value = g_variant_get_int32 (variant);
4546 g_variant_unref (variant);
4547 }
4548 return value;
4549}
4550
4551static gint
4552sensor_value_proxy_get_heatbeat (SensorValue *object)
4553{
4554 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
4555 GVariant *variant;
4556 gint value = 0;
4557 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "heatbeat");
4558 if (variant != NULL)
4559 {
4560 value = g_variant_get_int32 (variant);
4561 g_variant_unref (variant);
4562 }
4563 return value;
4564}
4565
4566static gboolean
4567sensor_value_proxy_get_settable (SensorValue *object)
4568{
4569 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
4570 GVariant *variant;
4571 gboolean value = 0;
4572 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "settable");
4573 if (variant != NULL)
4574 {
4575 value = g_variant_get_boolean (variant);
4576 g_variant_unref (variant);
4577 }
4578 return value;
4579}
4580
Norman James362a80f2015-09-14 14:04:39 -05004581static void
4582sensor_value_proxy_init (SensorValueProxy *proxy)
4583{
4584#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
4585 proxy->priv = sensor_value_proxy_get_instance_private (proxy);
4586#else
4587 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_VALUE_PROXY, SensorValueProxyPrivate);
4588#endif
4589
4590 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_value_interface_info ());
4591}
4592
4593static void
4594sensor_value_proxy_class_init (SensorValueProxyClass *klass)
4595{
4596 GObjectClass *gobject_class;
4597 GDBusProxyClass *proxy_class;
4598
4599 gobject_class = G_OBJECT_CLASS (klass);
4600 gobject_class->finalize = sensor_value_proxy_finalize;
4601 gobject_class->get_property = sensor_value_proxy_get_property;
4602 gobject_class->set_property = sensor_value_proxy_set_property;
4603
4604 proxy_class = G_DBUS_PROXY_CLASS (klass);
4605 proxy_class->g_signal = sensor_value_proxy_g_signal;
4606 proxy_class->g_properties_changed = sensor_value_proxy_g_properties_changed;
4607
4608 sensor_value_override_properties (gobject_class, 1);
4609
4610#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
4611 g_type_class_add_private (klass, sizeof (SensorValueProxyPrivate));
4612#endif
4613}
4614
4615static void
4616sensor_value_proxy_iface_init (SensorValueIface *iface)
4617{
4618 iface->get_value = sensor_value_proxy_get_value;
4619 iface->get_units = sensor_value_proxy_get_units;
4620 iface->get_poll_interval = sensor_value_proxy_get_poll_interval;
4621 iface->get_heatbeat = sensor_value_proxy_get_heatbeat;
4622 iface->get_settable = sensor_value_proxy_get_settable;
Norman James362a80f2015-09-14 14:04:39 -05004623}
4624
4625/**
4626 * sensor_value_proxy_new:
4627 * @connection: A #GDBusConnection.
4628 * @flags: Flags from the #GDBusProxyFlags enumeration.
4629 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
4630 * @object_path: An object path.
4631 * @cancellable: (allow-none): A #GCancellable or %NULL.
4632 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
4633 * @user_data: User data to pass to @callback.
4634 *
4635 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link>. See g_dbus_proxy_new() for more details.
4636 *
4637 * 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.
4638 * You can then call sensor_value_proxy_new_finish() to get the result of the operation.
4639 *
4640 * See sensor_value_proxy_new_sync() for the synchronous, blocking version of this constructor.
4641 */
4642void
4643sensor_value_proxy_new (
4644 GDBusConnection *connection,
4645 GDBusProxyFlags flags,
4646 const gchar *name,
4647 const gchar *object_path,
4648 GCancellable *cancellable,
4649 GAsyncReadyCallback callback,
4650 gpointer user_data)
4651{
4652 g_async_initable_new_async (TYPE_SENSOR_VALUE_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorValue", NULL);
4653}
4654
4655/**
4656 * sensor_value_proxy_new_finish:
4657 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_proxy_new().
4658 * @error: Return location for error or %NULL
4659 *
4660 * Finishes an operation started with sensor_value_proxy_new().
4661 *
4662 * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set.
4663 */
4664SensorValue *
4665sensor_value_proxy_new_finish (
4666 GAsyncResult *res,
4667 GError **error)
4668{
4669 GObject *ret;
4670 GObject *source_object;
4671 source_object = g_async_result_get_source_object (res);
4672 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
4673 g_object_unref (source_object);
4674 if (ret != NULL)
4675 return SENSOR_VALUE (ret);
4676 else
4677 return NULL;
4678}
4679
4680/**
4681 * sensor_value_proxy_new_sync:
4682 * @connection: A #GDBusConnection.
4683 * @flags: Flags from the #GDBusProxyFlags enumeration.
4684 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
4685 * @object_path: An object path.
4686 * @cancellable: (allow-none): A #GCancellable or %NULL.
4687 * @error: Return location for error or %NULL
4688 *
4689 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link>. See g_dbus_proxy_new_sync() for more details.
4690 *
4691 * The calling thread is blocked until a reply is received.
4692 *
4693 * See sensor_value_proxy_new() for the asynchronous version of this constructor.
4694 *
4695 * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set.
4696 */
4697SensorValue *
4698sensor_value_proxy_new_sync (
4699 GDBusConnection *connection,
4700 GDBusProxyFlags flags,
4701 const gchar *name,
4702 const gchar *object_path,
4703 GCancellable *cancellable,
4704 GError **error)
4705{
4706 GInitable *ret;
4707 ret = g_initable_new (TYPE_SENSOR_VALUE_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorValue", NULL);
4708 if (ret != NULL)
4709 return SENSOR_VALUE (ret);
4710 else
4711 return NULL;
4712}
4713
4714
4715/**
4716 * sensor_value_proxy_new_for_bus:
4717 * @bus_type: A #GBusType.
4718 * @flags: Flags from the #GDBusProxyFlags enumeration.
4719 * @name: A bus name (well-known or unique).
4720 * @object_path: An object path.
4721 * @cancellable: (allow-none): A #GCancellable or %NULL.
4722 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
4723 * @user_data: User data to pass to @callback.
4724 *
4725 * Like sensor_value_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
4726 *
4727 * 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.
4728 * You can then call sensor_value_proxy_new_for_bus_finish() to get the result of the operation.
4729 *
4730 * See sensor_value_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
4731 */
4732void
4733sensor_value_proxy_new_for_bus (
4734 GBusType bus_type,
4735 GDBusProxyFlags flags,
4736 const gchar *name,
4737 const gchar *object_path,
4738 GCancellable *cancellable,
4739 GAsyncReadyCallback callback,
4740 gpointer user_data)
4741{
4742 g_async_initable_new_async (TYPE_SENSOR_VALUE_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorValue", NULL);
4743}
4744
4745/**
4746 * sensor_value_proxy_new_for_bus_finish:
4747 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_proxy_new_for_bus().
4748 * @error: Return location for error or %NULL
4749 *
4750 * Finishes an operation started with sensor_value_proxy_new_for_bus().
4751 *
4752 * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set.
4753 */
4754SensorValue *
4755sensor_value_proxy_new_for_bus_finish (
4756 GAsyncResult *res,
4757 GError **error)
4758{
4759 GObject *ret;
4760 GObject *source_object;
4761 source_object = g_async_result_get_source_object (res);
4762 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
4763 g_object_unref (source_object);
4764 if (ret != NULL)
4765 return SENSOR_VALUE (ret);
4766 else
4767 return NULL;
4768}
4769
4770/**
4771 * sensor_value_proxy_new_for_bus_sync:
4772 * @bus_type: A #GBusType.
4773 * @flags: Flags from the #GDBusProxyFlags enumeration.
4774 * @name: A bus name (well-known or unique).
4775 * @object_path: An object path.
4776 * @cancellable: (allow-none): A #GCancellable or %NULL.
4777 * @error: Return location for error or %NULL
4778 *
4779 * Like sensor_value_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
4780 *
4781 * The calling thread is blocked until a reply is received.
4782 *
4783 * See sensor_value_proxy_new_for_bus() for the asynchronous version of this constructor.
4784 *
4785 * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set.
4786 */
4787SensorValue *
4788sensor_value_proxy_new_for_bus_sync (
4789 GBusType bus_type,
4790 GDBusProxyFlags flags,
4791 const gchar *name,
4792 const gchar *object_path,
4793 GCancellable *cancellable,
4794 GError **error)
4795{
4796 GInitable *ret;
4797 ret = g_initable_new (TYPE_SENSOR_VALUE_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorValue", NULL);
4798 if (ret != NULL)
4799 return SENSOR_VALUE (ret);
4800 else
4801 return NULL;
4802}
4803
4804
4805/* ------------------------------------------------------------------------ */
4806
4807/**
4808 * SensorValueSkeleton:
4809 *
4810 * The #SensorValueSkeleton structure contains only private data and should only be accessed using the provided API.
4811 */
4812
4813/**
4814 * SensorValueSkeletonClass:
4815 * @parent_class: The parent class.
4816 *
4817 * Class structure for #SensorValueSkeleton.
4818 */
4819
4820struct _SensorValueSkeletonPrivate
4821{
4822 GValue *properties;
4823 GList *changed_properties;
4824 GSource *changed_properties_idle_source;
4825 GMainContext *context;
4826 GMutex lock;
4827};
4828
4829static void
4830_sensor_value_skeleton_handle_method_call (
4831 GDBusConnection *connection G_GNUC_UNUSED,
4832 const gchar *sender G_GNUC_UNUSED,
4833 const gchar *object_path G_GNUC_UNUSED,
4834 const gchar *interface_name,
4835 const gchar *method_name,
4836 GVariant *parameters,
4837 GDBusMethodInvocation *invocation,
4838 gpointer user_data)
4839{
4840 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data);
4841 _ExtendedGDBusMethodInfo *info;
4842 GVariantIter iter;
4843 GVariant *child;
4844 GValue *paramv;
4845 guint num_params;
4846 guint num_extra;
4847 guint n;
4848 guint signal_id;
4849 GValue return_value = G_VALUE_INIT;
4850 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
4851 g_assert (info != NULL);
4852 num_params = g_variant_n_children (parameters);
4853 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
4854 n = 0;
4855 g_value_init (&paramv[n], TYPE_SENSOR_VALUE);
4856 g_value_set_object (&paramv[n++], skeleton);
4857 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
4858 g_value_set_object (&paramv[n++], invocation);
4859 if (info->pass_fdlist)
4860 {
4861#ifdef G_OS_UNIX
4862 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
4863 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
4864#else
4865 g_assert_not_reached ();
4866#endif
4867 }
4868 g_variant_iter_init (&iter, parameters);
4869 while ((child = g_variant_iter_next_value (&iter)) != NULL)
4870 {
4871 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
4872 if (arg_info->use_gvariant)
4873 {
4874 g_value_init (&paramv[n], G_TYPE_VARIANT);
4875 g_value_set_variant (&paramv[n], child);
4876 n++;
4877 }
4878 else
4879 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
4880 g_variant_unref (child);
4881 }
4882 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_VALUE);
4883 g_value_init (&return_value, G_TYPE_BOOLEAN);
4884 g_signal_emitv (paramv, signal_id, 0, &return_value);
4885 if (!g_value_get_boolean (&return_value))
4886 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);
4887 g_value_unset (&return_value);
4888 for (n = 0; n < num_params + num_extra; n++)
4889 g_value_unset (&paramv[n]);
4890 g_free (paramv);
4891}
4892
4893static GVariant *
4894_sensor_value_skeleton_handle_get_property (
4895 GDBusConnection *connection G_GNUC_UNUSED,
4896 const gchar *sender G_GNUC_UNUSED,
4897 const gchar *object_path G_GNUC_UNUSED,
4898 const gchar *interface_name G_GNUC_UNUSED,
4899 const gchar *property_name,
4900 GError **error,
4901 gpointer user_data)
4902{
4903 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data);
4904 GValue value = G_VALUE_INIT;
4905 GParamSpec *pspec;
4906 _ExtendedGDBusPropertyInfo *info;
4907 GVariant *ret;
4908 ret = NULL;
4909 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, property_name);
4910 g_assert (info != NULL);
4911 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
4912 if (pspec == NULL)
4913 {
4914 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
4915 }
4916 else
4917 {
4918 g_value_init (&value, pspec->value_type);
4919 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
4920 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
4921 g_value_unset (&value);
4922 }
4923 return ret;
4924}
4925
4926static gboolean
4927_sensor_value_skeleton_handle_set_property (
4928 GDBusConnection *connection G_GNUC_UNUSED,
4929 const gchar *sender G_GNUC_UNUSED,
4930 const gchar *object_path G_GNUC_UNUSED,
4931 const gchar *interface_name G_GNUC_UNUSED,
4932 const gchar *property_name,
4933 GVariant *variant,
4934 GError **error,
4935 gpointer user_data)
4936{
4937 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data);
4938 GValue value = G_VALUE_INIT;
4939 GParamSpec *pspec;
4940 _ExtendedGDBusPropertyInfo *info;
4941 gboolean ret;
4942 ret = FALSE;
4943 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, property_name);
4944 g_assert (info != NULL);
4945 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
4946 if (pspec == NULL)
4947 {
4948 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
4949 }
4950 else
4951 {
4952 if (info->use_gvariant)
4953 g_value_set_variant (&value, variant);
4954 else
4955 g_dbus_gvariant_to_gvalue (variant, &value);
4956 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
4957 g_value_unset (&value);
4958 ret = TRUE;
4959 }
4960 return ret;
4961}
4962
4963static const GDBusInterfaceVTable _sensor_value_skeleton_vtable =
4964{
4965 _sensor_value_skeleton_handle_method_call,
4966 _sensor_value_skeleton_handle_get_property,
4967 _sensor_value_skeleton_handle_set_property,
4968 {NULL}
4969};
4970
4971static GDBusInterfaceInfo *
4972sensor_value_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
4973{
4974 return sensor_value_interface_info ();
4975}
4976
4977static GDBusInterfaceVTable *
4978sensor_value_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
4979{
4980 return (GDBusInterfaceVTable *) &_sensor_value_skeleton_vtable;
4981}
4982
4983static GVariant *
4984sensor_value_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
4985{
4986 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (_skeleton);
4987
4988 GVariantBuilder builder;
4989 guint n;
4990 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
4991 if (_sensor_value_interface_info.parent_struct.properties == NULL)
4992 goto out;
4993 for (n = 0; _sensor_value_interface_info.parent_struct.properties[n] != NULL; n++)
4994 {
4995 GDBusPropertyInfo *info = _sensor_value_interface_info.parent_struct.properties[n];
4996 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
4997 {
4998 GVariant *value;
4999 value = _sensor_value_skeleton_handle_get_property (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorValue", info->name, NULL, skeleton);
5000 if (value != NULL)
5001 {
5002 g_variant_take_ref (value);
5003 g_variant_builder_add (&builder, "{sv}", info->name, value);
5004 g_variant_unref (value);
5005 }
5006 }
5007 }
5008out:
5009 return g_variant_builder_end (&builder);
5010}
5011
5012static gboolean _sensor_value_emit_changed (gpointer user_data);
5013
5014static void
5015sensor_value_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
5016{
5017 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (_skeleton);
5018 gboolean emit_changed = FALSE;
5019
5020 g_mutex_lock (&skeleton->priv->lock);
5021 if (skeleton->priv->changed_properties_idle_source != NULL)
5022 {
5023 g_source_destroy (skeleton->priv->changed_properties_idle_source);
5024 skeleton->priv->changed_properties_idle_source = NULL;
5025 emit_changed = TRUE;
5026 }
5027 g_mutex_unlock (&skeleton->priv->lock);
5028
5029 if (emit_changed)
5030 _sensor_value_emit_changed (skeleton);
5031}
5032
5033static void
5034_sensor_value_on_signal_changed (
5035 SensorValue *object,
5036 GVariant *arg_value,
5037 const gchar *arg_units)
5038{
5039 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5040
5041 GList *connections, *l;
5042 GVariant *signal_variant;
5043 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
5044
5045 signal_variant = g_variant_ref_sink (g_variant_new ("(@vs)",
5046 arg_value,
5047 arg_units));
5048 for (l = connections; l != NULL; l = l->next)
5049 {
5050 GDBusConnection *connection = l->data;
5051 g_dbus_connection_emit_signal (connection,
5052 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorValue", "Changed",
5053 signal_variant, NULL);
5054 }
5055 g_variant_unref (signal_variant);
5056 g_list_free_full (connections, g_object_unref);
5057}
5058
5059static void
Norman James32e74e22015-09-15 21:28:06 -05005060_sensor_value_on_signal_error (
5061 SensorValue *object)
5062{
5063 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5064
5065 GList *connections, *l;
5066 GVariant *signal_variant;
5067 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
5068
5069 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
5070 for (l = connections; l != NULL; l = l->next)
5071 {
5072 GDBusConnection *connection = l->data;
5073 g_dbus_connection_emit_signal (connection,
5074 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorValue", "Error",
5075 signal_variant, NULL);
5076 }
5077 g_variant_unref (signal_variant);
5078 g_list_free_full (connections, g_object_unref);
5079}
5080
5081static void
Norman James362a80f2015-09-14 14:04:39 -05005082_sensor_value_on_signal_heartbeat (
5083 SensorValue *object,
5084 const gchar *arg_bus_name)
5085{
5086 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5087
5088 GList *connections, *l;
5089 GVariant *signal_variant;
5090 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
5091
5092 signal_variant = g_variant_ref_sink (g_variant_new ("(s)",
5093 arg_bus_name));
5094 for (l = connections; l != NULL; l = l->next)
5095 {
5096 GDBusConnection *connection = l->data;
5097 g_dbus_connection_emit_signal (connection,
5098 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorValue", "Heartbeat",
5099 signal_variant, NULL);
5100 }
5101 g_variant_unref (signal_variant);
5102 g_list_free_full (connections, g_object_unref);
5103}
5104
5105static void sensor_value_skeleton_iface_init (SensorValueIface *iface);
5106#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
5107G_DEFINE_TYPE_WITH_CODE (SensorValueSkeleton, sensor_value_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
5108 G_ADD_PRIVATE (SensorValueSkeleton)
5109 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_skeleton_iface_init));
5110
5111#else
5112G_DEFINE_TYPE_WITH_CODE (SensorValueSkeleton, sensor_value_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
5113 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_skeleton_iface_init));
5114
5115#endif
5116static void
5117sensor_value_skeleton_finalize (GObject *object)
5118{
5119 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5120 guint n;
Norman Jamesdfdaca92015-09-27 22:11:15 -05005121 for (n = 0; n < 5; n++)
Norman James362a80f2015-09-14 14:04:39 -05005122 g_value_unset (&skeleton->priv->properties[n]);
5123 g_free (skeleton->priv->properties);
5124 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
5125 if (skeleton->priv->changed_properties_idle_source != NULL)
5126 g_source_destroy (skeleton->priv->changed_properties_idle_source);
5127 g_main_context_unref (skeleton->priv->context);
5128 g_mutex_clear (&skeleton->priv->lock);
5129 G_OBJECT_CLASS (sensor_value_skeleton_parent_class)->finalize (object);
5130}
5131
5132static void
5133sensor_value_skeleton_get_property (GObject *object,
5134 guint prop_id,
5135 GValue *value,
5136 GParamSpec *pspec G_GNUC_UNUSED)
5137{
5138 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
Norman Jamesdfdaca92015-09-27 22:11:15 -05005139 g_assert (prop_id != 0 && prop_id - 1 < 5);
Norman James362a80f2015-09-14 14:04:39 -05005140 g_mutex_lock (&skeleton->priv->lock);
5141 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
5142 g_mutex_unlock (&skeleton->priv->lock);
5143}
5144
5145static gboolean
5146_sensor_value_emit_changed (gpointer user_data)
5147{
5148 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data);
5149 GList *l;
5150 GVariantBuilder builder;
5151 GVariantBuilder invalidated_builder;
5152 guint num_changes;
5153
5154 g_mutex_lock (&skeleton->priv->lock);
5155 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
5156 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
5157 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
5158 {
5159 ChangedProperty *cp = l->data;
5160 GVariant *variant;
5161 const GValue *cur_value;
5162
5163 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
5164 if (!_g_value_equal (cur_value, &cp->orig_value))
5165 {
5166 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
5167 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
5168 g_variant_unref (variant);
5169 num_changes++;
5170 }
5171 }
5172 if (num_changes > 0)
5173 {
5174 GList *connections, *ll;
5175 GVariant *signal_variant;
5176 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorValue",
5177 &builder, &invalidated_builder));
5178 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
5179 for (ll = connections; ll != NULL; ll = ll->next)
5180 {
5181 GDBusConnection *connection = ll->data;
5182
5183 g_dbus_connection_emit_signal (connection,
5184 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
5185 "org.freedesktop.DBus.Properties",
5186 "PropertiesChanged",
5187 signal_variant,
5188 NULL);
5189 }
5190 g_variant_unref (signal_variant);
5191 g_list_free_full (connections, g_object_unref);
5192 }
5193 else
5194 {
5195 g_variant_builder_clear (&builder);
5196 g_variant_builder_clear (&invalidated_builder);
5197 }
5198 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
5199 skeleton->priv->changed_properties = NULL;
5200 skeleton->priv->changed_properties_idle_source = NULL;
5201 g_mutex_unlock (&skeleton->priv->lock);
5202 return FALSE;
5203}
5204
5205static void
5206_sensor_value_schedule_emit_changed (SensorValueSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
5207{
5208 ChangedProperty *cp;
5209 GList *l;
5210 cp = NULL;
5211 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
5212 {
5213 ChangedProperty *i_cp = l->data;
5214 if (i_cp->info == info)
5215 {
5216 cp = i_cp;
5217 break;
5218 }
5219 }
5220 if (cp == NULL)
5221 {
5222 cp = g_new0 (ChangedProperty, 1);
5223 cp->prop_id = prop_id;
5224 cp->info = info;
5225 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
5226 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
5227 g_value_copy (orig_value, &cp->orig_value);
5228 }
5229}
5230
5231static void
5232sensor_value_skeleton_notify (GObject *object,
5233 GParamSpec *pspec G_GNUC_UNUSED)
5234{
5235 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5236 g_mutex_lock (&skeleton->priv->lock);
5237 if (skeleton->priv->changed_properties != NULL &&
5238 skeleton->priv->changed_properties_idle_source == NULL)
5239 {
5240 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
5241 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
5242 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_value_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
Adriana Kobylakfd778822016-06-16 09:08:37 -05005243 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _sensor_value_emit_changed");
Norman James362a80f2015-09-14 14:04:39 -05005244 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
5245 g_source_unref (skeleton->priv->changed_properties_idle_source);
5246 }
5247 g_mutex_unlock (&skeleton->priv->lock);
5248}
5249
5250static void
5251sensor_value_skeleton_set_property (GObject *object,
5252 guint prop_id,
5253 const GValue *value,
5254 GParamSpec *pspec)
5255{
5256 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
Norman Jamesdfdaca92015-09-27 22:11:15 -05005257 g_assert (prop_id != 0 && prop_id - 1 < 5);
Norman James362a80f2015-09-14 14:04:39 -05005258 g_mutex_lock (&skeleton->priv->lock);
5259 g_object_freeze_notify (object);
5260 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
5261 {
5262 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
5263 _sensor_value_schedule_emit_changed (skeleton, _sensor_value_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
5264 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
5265 g_object_notify_by_pspec (object, pspec);
5266 }
5267 g_mutex_unlock (&skeleton->priv->lock);
5268 g_object_thaw_notify (object);
5269}
5270
5271static void
5272sensor_value_skeleton_init (SensorValueSkeleton *skeleton)
5273{
5274#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
5275 skeleton->priv = sensor_value_skeleton_get_instance_private (skeleton);
5276#else
5277 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_VALUE_SKELETON, SensorValueSkeletonPrivate);
5278#endif
5279
5280 g_mutex_init (&skeleton->priv->lock);
5281 skeleton->priv->context = g_main_context_ref_thread_default ();
Norman Jamesdfdaca92015-09-27 22:11:15 -05005282 skeleton->priv->properties = g_new0 (GValue, 5);
Norman James362a80f2015-09-14 14:04:39 -05005283 g_value_init (&skeleton->priv->properties[0], G_TYPE_VARIANT);
5284 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
5285 g_value_init (&skeleton->priv->properties[2], G_TYPE_INT);
5286 g_value_init (&skeleton->priv->properties[3], G_TYPE_INT);
5287 g_value_init (&skeleton->priv->properties[4], G_TYPE_BOOLEAN);
Norman James362a80f2015-09-14 14:04:39 -05005288}
5289
5290static GVariant *
5291sensor_value_skeleton_get_value (SensorValue *object)
5292{
5293 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5294 GVariant *value;
5295 g_mutex_lock (&skeleton->priv->lock);
5296 value = g_value_get_variant (&(skeleton->priv->properties[0]));
5297 g_mutex_unlock (&skeleton->priv->lock);
5298 return value;
5299}
5300
5301static const gchar *
5302sensor_value_skeleton_get_units (SensorValue *object)
5303{
5304 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5305 const gchar *value;
5306 g_mutex_lock (&skeleton->priv->lock);
5307 value = g_value_get_string (&(skeleton->priv->properties[1]));
5308 g_mutex_unlock (&skeleton->priv->lock);
5309 return value;
5310}
5311
5312static gint
5313sensor_value_skeleton_get_poll_interval (SensorValue *object)
5314{
5315 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5316 gint value;
5317 g_mutex_lock (&skeleton->priv->lock);
5318 value = g_value_get_int (&(skeleton->priv->properties[2]));
5319 g_mutex_unlock (&skeleton->priv->lock);
5320 return value;
5321}
5322
5323static gint
5324sensor_value_skeleton_get_heatbeat (SensorValue *object)
5325{
5326 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5327 gint value;
5328 g_mutex_lock (&skeleton->priv->lock);
5329 value = g_value_get_int (&(skeleton->priv->properties[3]));
5330 g_mutex_unlock (&skeleton->priv->lock);
5331 return value;
5332}
5333
5334static gboolean
5335sensor_value_skeleton_get_settable (SensorValue *object)
5336{
5337 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5338 gboolean value;
5339 g_mutex_lock (&skeleton->priv->lock);
5340 value = g_value_get_boolean (&(skeleton->priv->properties[4]));
5341 g_mutex_unlock (&skeleton->priv->lock);
5342 return value;
5343}
5344
Norman James362a80f2015-09-14 14:04:39 -05005345static void
5346sensor_value_skeleton_class_init (SensorValueSkeletonClass *klass)
5347{
5348 GObjectClass *gobject_class;
5349 GDBusInterfaceSkeletonClass *skeleton_class;
5350
5351 gobject_class = G_OBJECT_CLASS (klass);
5352 gobject_class->finalize = sensor_value_skeleton_finalize;
5353 gobject_class->get_property = sensor_value_skeleton_get_property;
5354 gobject_class->set_property = sensor_value_skeleton_set_property;
5355 gobject_class->notify = sensor_value_skeleton_notify;
5356
5357
5358 sensor_value_override_properties (gobject_class, 1);
5359
5360 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
5361 skeleton_class->get_info = sensor_value_skeleton_dbus_interface_get_info;
5362 skeleton_class->get_properties = sensor_value_skeleton_dbus_interface_get_properties;
5363 skeleton_class->flush = sensor_value_skeleton_dbus_interface_flush;
5364 skeleton_class->get_vtable = sensor_value_skeleton_dbus_interface_get_vtable;
5365
5366#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
5367 g_type_class_add_private (klass, sizeof (SensorValueSkeletonPrivate));
5368#endif
5369}
5370
5371static void
5372sensor_value_skeleton_iface_init (SensorValueIface *iface)
5373{
5374 iface->changed = _sensor_value_on_signal_changed;
Norman James32e74e22015-09-15 21:28:06 -05005375 iface->error = _sensor_value_on_signal_error;
Norman James362a80f2015-09-14 14:04:39 -05005376 iface->heartbeat = _sensor_value_on_signal_heartbeat;
5377 iface->get_value = sensor_value_skeleton_get_value;
5378 iface->get_units = sensor_value_skeleton_get_units;
5379 iface->get_poll_interval = sensor_value_skeleton_get_poll_interval;
5380 iface->get_heatbeat = sensor_value_skeleton_get_heatbeat;
5381 iface->get_settable = sensor_value_skeleton_get_settable;
Norman James362a80f2015-09-14 14:04:39 -05005382}
5383
5384/**
5385 * sensor_value_skeleton_new:
5386 *
5387 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link>.
5388 *
5389 * Returns: (transfer full) (type SensorValueSkeleton): The skeleton object.
5390 */
5391SensorValue *
5392sensor_value_skeleton_new (void)
5393{
5394 return SENSOR_VALUE (g_object_new (TYPE_SENSOR_VALUE_SKELETON, NULL));
5395}
5396
5397/* ------------------------------------------------------------------------
5398 * Code for interface org.openbmc.SensorThreshold
5399 * ------------------------------------------------------------------------
5400 */
5401
5402/**
5403 * SECTION:SensorThreshold
5404 * @title: SensorThreshold
5405 * @short_description: Generated C code for the org.openbmc.SensorThreshold D-Bus interface
5406 *
5407 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link> D-Bus interface in C.
5408 */
5409
5410/* ---- Introspection data for org.openbmc.SensorThreshold ---- */
5411
5412static const _ExtendedGDBusArgInfo _sensor_threshold_method_info_get_state_OUT_ARG_state =
5413{
5414 {
5415 -1,
5416 (gchar *) "state",
5417 (gchar *) "y",
5418 NULL
5419 },
5420 FALSE
5421};
5422
5423static const _ExtendedGDBusArgInfo * const _sensor_threshold_method_info_get_state_OUT_ARG_pointers[] =
5424{
5425 &_sensor_threshold_method_info_get_state_OUT_ARG_state,
5426 NULL
5427};
5428
5429static const _ExtendedGDBusMethodInfo _sensor_threshold_method_info_get_state =
5430{
5431 {
5432 -1,
5433 (gchar *) "getState",
5434 NULL,
5435 (GDBusArgInfo **) &_sensor_threshold_method_info_get_state_OUT_ARG_pointers,
5436 NULL
5437 },
5438 "handle-get-state",
5439 FALSE
5440};
5441
5442static const _ExtendedGDBusMethodInfo * const _sensor_threshold_method_info_pointers[] =
5443{
5444 &_sensor_threshold_method_info_get_state,
5445 NULL
5446};
5447
5448static const _ExtendedGDBusSignalInfo _sensor_threshold_signal_info_warning =
5449{
5450 {
5451 -1,
5452 (gchar *) "Warning",
5453 NULL,
5454 NULL
5455 },
5456 "warning"
5457};
5458
5459static const _ExtendedGDBusSignalInfo _sensor_threshold_signal_info_critical =
5460{
5461 {
5462 -1,
5463 (gchar *) "Critical",
5464 NULL,
5465 NULL
5466 },
5467 "critical"
5468};
5469
5470static const _ExtendedGDBusSignalInfo _sensor_threshold_signal_info_normal =
5471{
5472 {
5473 -1,
5474 (gchar *) "Normal",
5475 NULL,
5476 NULL
5477 },
5478 "normal"
5479};
5480
5481static const _ExtendedGDBusSignalInfo * const _sensor_threshold_signal_info_pointers[] =
5482{
5483 &_sensor_threshold_signal_info_warning,
5484 &_sensor_threshold_signal_info_critical,
5485 &_sensor_threshold_signal_info_normal,
5486 NULL
5487};
5488
5489static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_lower_critical =
5490{
5491 {
5492 -1,
5493 (gchar *) "lower_critical",
5494 (gchar *) "v",
5495 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
5496 NULL
5497 },
5498 "lower-critical",
5499 FALSE
5500};
5501
5502static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_lower_warning =
5503{
5504 {
5505 -1,
5506 (gchar *) "lower_warning",
5507 (gchar *) "v",
5508 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
5509 NULL
5510 },
5511 "lower-warning",
5512 FALSE
5513};
5514
5515static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_upper_warning =
5516{
5517 {
5518 -1,
5519 (gchar *) "upper_warning",
5520 (gchar *) "v",
5521 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
5522 NULL
5523 },
5524 "upper-warning",
5525 FALSE
5526};
5527
5528static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_upper_critical =
5529{
5530 {
5531 -1,
5532 (gchar *) "upper_critical",
5533 (gchar *) "v",
5534 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
5535 NULL
5536 },
5537 "upper-critical",
5538 FALSE
5539};
5540
5541static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_state =
5542{
5543 {
5544 -1,
5545 (gchar *) "state",
5546 (gchar *) "y",
5547 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
5548 NULL
5549 },
5550 "state",
5551 FALSE
5552};
5553
5554static const _ExtendedGDBusPropertyInfo * const _sensor_threshold_property_info_pointers[] =
5555{
5556 &_sensor_threshold_property_info_lower_critical,
5557 &_sensor_threshold_property_info_lower_warning,
5558 &_sensor_threshold_property_info_upper_warning,
5559 &_sensor_threshold_property_info_upper_critical,
5560 &_sensor_threshold_property_info_state,
5561 NULL
5562};
5563
5564static const _ExtendedGDBusInterfaceInfo _sensor_threshold_interface_info =
5565{
5566 {
5567 -1,
5568 (gchar *) "org.openbmc.SensorThreshold",
5569 (GDBusMethodInfo **) &_sensor_threshold_method_info_pointers,
5570 (GDBusSignalInfo **) &_sensor_threshold_signal_info_pointers,
5571 (GDBusPropertyInfo **) &_sensor_threshold_property_info_pointers,
5572 NULL
5573 },
5574 "sensor-threshold",
5575};
5576
5577
5578/**
5579 * sensor_threshold_interface_info:
5580 *
5581 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link> D-Bus interface.
5582 *
5583 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
5584 */
5585GDBusInterfaceInfo *
5586sensor_threshold_interface_info (void)
5587{
5588 return (GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct;
5589}
5590
5591/**
5592 * sensor_threshold_override_properties:
5593 * @klass: The class structure for a #GObject<!-- -->-derived class.
5594 * @property_id_begin: The property id to assign to the first overridden property.
5595 *
5596 * Overrides all #GObject properties in the #SensorThreshold interface for a concrete class.
5597 * The properties are overridden in the order they are defined.
5598 *
5599 * Returns: The last property id.
5600 */
5601guint
5602sensor_threshold_override_properties (GObjectClass *klass, guint property_id_begin)
5603{
5604 g_object_class_override_property (klass, property_id_begin++, "lower-critical");
5605 g_object_class_override_property (klass, property_id_begin++, "lower-warning");
5606 g_object_class_override_property (klass, property_id_begin++, "upper-warning");
5607 g_object_class_override_property (klass, property_id_begin++, "upper-critical");
5608 g_object_class_override_property (klass, property_id_begin++, "state");
5609 return property_id_begin - 1;
5610}
5611
5612
5613
5614/**
5615 * SensorThreshold:
5616 *
5617 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link>.
5618 */
5619
5620/**
5621 * SensorThresholdIface:
5622 * @parent_iface: The parent interface.
5623 * @handle_get_state: Handler for the #SensorThreshold::handle-get-state signal.
5624 * @get_lower_critical: Getter for the #SensorThreshold:lower-critical property.
5625 * @get_lower_warning: Getter for the #SensorThreshold:lower-warning property.
5626 * @get_state: Getter for the #SensorThreshold:state property.
5627 * @get_upper_critical: Getter for the #SensorThreshold:upper-critical property.
5628 * @get_upper_warning: Getter for the #SensorThreshold:upper-warning property.
5629 * @critical: Handler for the #SensorThreshold::critical signal.
5630 * @normal: Handler for the #SensorThreshold::normal signal.
5631 * @warning: Handler for the #SensorThreshold::warning signal.
5632 *
5633 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link>.
5634 */
5635
5636typedef SensorThresholdIface SensorThresholdInterface;
5637G_DEFINE_INTERFACE (SensorThreshold, sensor_threshold, G_TYPE_OBJECT);
5638
5639static void
5640sensor_threshold_default_init (SensorThresholdIface *iface)
5641{
5642 /* GObject signals for incoming D-Bus method calls: */
5643 /**
5644 * SensorThreshold::handle-get-state:
5645 * @object: A #SensorThreshold.
5646 * @invocation: A #GDBusMethodInvocation.
5647 *
5648 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorThreshold.getState">getState()</link> D-Bus method.
5649 *
5650 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call sensor_threshold_complete_get_state() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
5651 *
5652 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
5653 */
5654 g_signal_new ("handle-get-state",
5655 G_TYPE_FROM_INTERFACE (iface),
5656 G_SIGNAL_RUN_LAST,
5657 G_STRUCT_OFFSET (SensorThresholdIface, handle_get_state),
5658 g_signal_accumulator_true_handled,
5659 NULL,
5660 g_cclosure_marshal_generic,
5661 G_TYPE_BOOLEAN,
5662 1,
5663 G_TYPE_DBUS_METHOD_INVOCATION);
5664
5665 /* GObject signals for received D-Bus signals: */
5666 /**
5667 * SensorThreshold::warning:
5668 * @object: A #SensorThreshold.
5669 *
5670 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-SensorThreshold.Warning">"Warning"</link> is received.
5671 *
5672 * 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.
5673 */
5674 g_signal_new ("warning",
5675 G_TYPE_FROM_INTERFACE (iface),
5676 G_SIGNAL_RUN_LAST,
5677 G_STRUCT_OFFSET (SensorThresholdIface, warning),
5678 NULL,
5679 NULL,
5680 g_cclosure_marshal_generic,
5681 G_TYPE_NONE,
5682 0);
5683
5684 /**
5685 * SensorThreshold::critical:
5686 * @object: A #SensorThreshold.
5687 *
5688 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-SensorThreshold.Critical">"Critical"</link> is received.
5689 *
5690 * 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.
5691 */
5692 g_signal_new ("critical",
5693 G_TYPE_FROM_INTERFACE (iface),
5694 G_SIGNAL_RUN_LAST,
5695 G_STRUCT_OFFSET (SensorThresholdIface, critical),
5696 NULL,
5697 NULL,
5698 g_cclosure_marshal_generic,
5699 G_TYPE_NONE,
5700 0);
5701
5702 /**
5703 * SensorThreshold::normal:
5704 * @object: A #SensorThreshold.
5705 *
5706 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-SensorThreshold.Normal">"Normal"</link> is received.
5707 *
5708 * 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.
5709 */
5710 g_signal_new ("normal",
5711 G_TYPE_FROM_INTERFACE (iface),
5712 G_SIGNAL_RUN_LAST,
5713 G_STRUCT_OFFSET (SensorThresholdIface, normal),
5714 NULL,
5715 NULL,
5716 g_cclosure_marshal_generic,
5717 G_TYPE_NONE,
5718 0);
5719
5720 /* GObject properties for D-Bus properties: */
5721 /**
5722 * SensorThreshold:lower-critical:
5723 *
5724 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link>.
5725 *
5726 * 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.
5727 */
5728 g_object_interface_install_property (iface,
5729 g_param_spec_variant ("lower-critical", "lower_critical", "lower_critical", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
5730 /**
5731 * SensorThreshold:lower-warning:
5732 *
5733 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link>.
5734 *
5735 * 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.
5736 */
5737 g_object_interface_install_property (iface,
5738 g_param_spec_variant ("lower-warning", "lower_warning", "lower_warning", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
5739 /**
5740 * SensorThreshold:upper-warning:
5741 *
5742 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link>.
5743 *
5744 * 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.
5745 */
5746 g_object_interface_install_property (iface,
5747 g_param_spec_variant ("upper-warning", "upper_warning", "upper_warning", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
5748 /**
5749 * SensorThreshold:upper-critical:
5750 *
5751 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link>.
5752 *
5753 * 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.
5754 */
5755 g_object_interface_install_property (iface,
5756 g_param_spec_variant ("upper-critical", "upper_critical", "upper_critical", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
5757 /**
5758 * SensorThreshold:state:
5759 *
5760 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.state">"state"</link>.
5761 *
5762 * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.
5763 */
5764 g_object_interface_install_property (iface,
5765 g_param_spec_uchar ("state", "state", "state", 0, 255, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
5766}
5767
5768/**
5769 * sensor_threshold_get_lower_critical: (skip)
5770 * @object: A #SensorThreshold.
5771 *
5772 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link> D-Bus property.
5773 *
5774 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
5775 *
5776 * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use sensor_threshold_dup_lower_critical() if on another thread.</warning>
5777 *
5778 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
5779 */
5780GVariant *
5781sensor_threshold_get_lower_critical (SensorThreshold *object)
5782{
5783 return SENSOR_THRESHOLD_GET_IFACE (object)->get_lower_critical (object);
5784}
5785
5786/**
5787 * sensor_threshold_dup_lower_critical: (skip)
5788 * @object: A #SensorThreshold.
5789 *
5790 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link> D-Bus property.
5791 *
5792 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
5793 *
5794 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
5795 */
5796GVariant *
5797sensor_threshold_dup_lower_critical (SensorThreshold *object)
5798{
5799 GVariant *value;
5800 g_object_get (G_OBJECT (object), "lower-critical", &value, NULL);
5801 return value;
5802}
5803
5804/**
5805 * sensor_threshold_set_lower_critical: (skip)
5806 * @object: A #SensorThreshold.
5807 * @value: The value to set.
5808 *
5809 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link> D-Bus property to @value.
5810 *
5811 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
5812 */
5813void
5814sensor_threshold_set_lower_critical (SensorThreshold *object, GVariant *value)
5815{
5816 g_object_set (G_OBJECT (object), "lower-critical", value, NULL);
5817}
5818
5819/**
5820 * sensor_threshold_get_lower_warning: (skip)
5821 * @object: A #SensorThreshold.
5822 *
5823 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link> D-Bus property.
5824 *
5825 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
5826 *
5827 * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use sensor_threshold_dup_lower_warning() if on another thread.</warning>
5828 *
5829 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
5830 */
5831GVariant *
5832sensor_threshold_get_lower_warning (SensorThreshold *object)
5833{
5834 return SENSOR_THRESHOLD_GET_IFACE (object)->get_lower_warning (object);
5835}
5836
5837/**
5838 * sensor_threshold_dup_lower_warning: (skip)
5839 * @object: A #SensorThreshold.
5840 *
5841 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link> D-Bus property.
5842 *
5843 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
5844 *
5845 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
5846 */
5847GVariant *
5848sensor_threshold_dup_lower_warning (SensorThreshold *object)
5849{
5850 GVariant *value;
5851 g_object_get (G_OBJECT (object), "lower-warning", &value, NULL);
5852 return value;
5853}
5854
5855/**
5856 * sensor_threshold_set_lower_warning: (skip)
5857 * @object: A #SensorThreshold.
5858 * @value: The value to set.
5859 *
5860 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link> D-Bus property to @value.
5861 *
5862 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
5863 */
5864void
5865sensor_threshold_set_lower_warning (SensorThreshold *object, GVariant *value)
5866{
5867 g_object_set (G_OBJECT (object), "lower-warning", value, NULL);
5868}
5869
5870/**
5871 * sensor_threshold_get_upper_warning: (skip)
5872 * @object: A #SensorThreshold.
5873 *
5874 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link> D-Bus property.
5875 *
5876 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
5877 *
5878 * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use sensor_threshold_dup_upper_warning() if on another thread.</warning>
5879 *
5880 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
5881 */
5882GVariant *
5883sensor_threshold_get_upper_warning (SensorThreshold *object)
5884{
5885 return SENSOR_THRESHOLD_GET_IFACE (object)->get_upper_warning (object);
5886}
5887
5888/**
5889 * sensor_threshold_dup_upper_warning: (skip)
5890 * @object: A #SensorThreshold.
5891 *
5892 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link> D-Bus property.
5893 *
5894 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
5895 *
5896 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
5897 */
5898GVariant *
5899sensor_threshold_dup_upper_warning (SensorThreshold *object)
5900{
5901 GVariant *value;
5902 g_object_get (G_OBJECT (object), "upper-warning", &value, NULL);
5903 return value;
5904}
5905
5906/**
5907 * sensor_threshold_set_upper_warning: (skip)
5908 * @object: A #SensorThreshold.
5909 * @value: The value to set.
5910 *
5911 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link> D-Bus property to @value.
5912 *
5913 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
5914 */
5915void
5916sensor_threshold_set_upper_warning (SensorThreshold *object, GVariant *value)
5917{
5918 g_object_set (G_OBJECT (object), "upper-warning", value, NULL);
5919}
5920
5921/**
5922 * sensor_threshold_get_upper_critical: (skip)
5923 * @object: A #SensorThreshold.
5924 *
5925 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link> D-Bus property.
5926 *
5927 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
5928 *
5929 * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use sensor_threshold_dup_upper_critical() if on another thread.</warning>
5930 *
5931 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
5932 */
5933GVariant *
5934sensor_threshold_get_upper_critical (SensorThreshold *object)
5935{
5936 return SENSOR_THRESHOLD_GET_IFACE (object)->get_upper_critical (object);
5937}
5938
5939/**
5940 * sensor_threshold_dup_upper_critical: (skip)
5941 * @object: A #SensorThreshold.
5942 *
5943 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link> D-Bus property.
5944 *
5945 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
5946 *
5947 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
5948 */
5949GVariant *
5950sensor_threshold_dup_upper_critical (SensorThreshold *object)
5951{
5952 GVariant *value;
5953 g_object_get (G_OBJECT (object), "upper-critical", &value, NULL);
5954 return value;
5955}
5956
5957/**
5958 * sensor_threshold_set_upper_critical: (skip)
5959 * @object: A #SensorThreshold.
5960 * @value: The value to set.
5961 *
5962 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link> D-Bus property to @value.
5963 *
5964 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
5965 */
5966void
5967sensor_threshold_set_upper_critical (SensorThreshold *object, GVariant *value)
5968{
5969 g_object_set (G_OBJECT (object), "upper-critical", value, NULL);
5970}
5971
5972/**
5973 * sensor_threshold_get_state: (skip)
5974 * @object: A #SensorThreshold.
5975 *
5976 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.state">"state"</link> D-Bus property.
5977 *
5978 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
5979 *
5980 * Returns: The property value.
5981 */
5982guchar
5983sensor_threshold_get_state (SensorThreshold *object)
5984{
5985 return SENSOR_THRESHOLD_GET_IFACE (object)->get_state (object);
5986}
5987
5988/**
5989 * sensor_threshold_set_state: (skip)
5990 * @object: A #SensorThreshold.
5991 * @value: The value to set.
5992 *
5993 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.state">"state"</link> D-Bus property to @value.
5994 *
5995 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
5996 */
5997void
5998sensor_threshold_set_state (SensorThreshold *object, guchar value)
5999{
6000 g_object_set (G_OBJECT (object), "state", value, NULL);
6001}
6002
6003/**
6004 * sensor_threshold_emit_warning:
6005 * @object: A #SensorThreshold.
6006 *
6007 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorThreshold.Warning">"Warning"</link> D-Bus signal.
6008 */
6009void
6010sensor_threshold_emit_warning (
6011 SensorThreshold *object)
6012{
6013 g_signal_emit_by_name (object, "warning");
6014}
6015
6016/**
6017 * sensor_threshold_emit_critical:
6018 * @object: A #SensorThreshold.
6019 *
6020 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorThreshold.Critical">"Critical"</link> D-Bus signal.
6021 */
6022void
6023sensor_threshold_emit_critical (
6024 SensorThreshold *object)
6025{
6026 g_signal_emit_by_name (object, "critical");
6027}
6028
6029/**
6030 * sensor_threshold_emit_normal:
6031 * @object: A #SensorThreshold.
6032 *
6033 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorThreshold.Normal">"Normal"</link> D-Bus signal.
6034 */
6035void
6036sensor_threshold_emit_normal (
6037 SensorThreshold *object)
6038{
6039 g_signal_emit_by_name (object, "normal");
6040}
6041
6042/**
6043 * sensor_threshold_call_get_state:
6044 * @proxy: A #SensorThresholdProxy.
6045 * @cancellable: (allow-none): A #GCancellable or %NULL.
6046 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
6047 * @user_data: User data to pass to @callback.
6048 *
6049 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorThreshold.getState">getState()</link> D-Bus method on @proxy.
6050 * 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.
6051 * You can then call sensor_threshold_call_get_state_finish() to get the result of the operation.
6052 *
6053 * See sensor_threshold_call_get_state_sync() for the synchronous, blocking version of this method.
6054 */
6055void
6056sensor_threshold_call_get_state (
6057 SensorThreshold *proxy,
6058 GCancellable *cancellable,
6059 GAsyncReadyCallback callback,
6060 gpointer user_data)
6061{
6062 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
6063 "getState",
6064 g_variant_new ("()"),
6065 G_DBUS_CALL_FLAGS_NONE,
6066 -1,
6067 cancellable,
6068 callback,
6069 user_data);
6070}
6071
6072/**
6073 * sensor_threshold_call_get_state_finish:
6074 * @proxy: A #SensorThresholdProxy.
6075 * @out_state: (out): Return location for return parameter or %NULL to ignore.
6076 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_threshold_call_get_state().
6077 * @error: Return location for error or %NULL.
6078 *
6079 * Finishes an operation started with sensor_threshold_call_get_state().
6080 *
6081 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
6082 */
6083gboolean
6084sensor_threshold_call_get_state_finish (
6085 SensorThreshold *proxy,
6086 guchar *out_state,
6087 GAsyncResult *res,
6088 GError **error)
6089{
6090 GVariant *_ret;
6091 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
6092 if (_ret == NULL)
6093 goto _out;
6094 g_variant_get (_ret,
6095 "(y)",
6096 out_state);
6097 g_variant_unref (_ret);
6098_out:
6099 return _ret != NULL;
6100}
6101
6102/**
6103 * sensor_threshold_call_get_state_sync:
6104 * @proxy: A #SensorThresholdProxy.
6105 * @out_state: (out): Return location for return parameter or %NULL to ignore.
6106 * @cancellable: (allow-none): A #GCancellable or %NULL.
6107 * @error: Return location for error or %NULL.
6108 *
6109 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorThreshold.getState">getState()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
6110 *
6111 * See sensor_threshold_call_get_state() for the asynchronous version of this method.
6112 *
6113 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
6114 */
6115gboolean
6116sensor_threshold_call_get_state_sync (
6117 SensorThreshold *proxy,
6118 guchar *out_state,
6119 GCancellable *cancellable,
6120 GError **error)
6121{
6122 GVariant *_ret;
6123 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
6124 "getState",
6125 g_variant_new ("()"),
6126 G_DBUS_CALL_FLAGS_NONE,
6127 -1,
6128 cancellable,
6129 error);
6130 if (_ret == NULL)
6131 goto _out;
6132 g_variant_get (_ret,
6133 "(y)",
6134 out_state);
6135 g_variant_unref (_ret);
6136_out:
6137 return _ret != NULL;
6138}
6139
6140/**
6141 * sensor_threshold_complete_get_state:
6142 * @object: A #SensorThreshold.
6143 * @invocation: (transfer full): A #GDBusMethodInvocation.
6144 * @state: Parameter to return.
6145 *
6146 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-SensorThreshold.getState">getState()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
6147 *
6148 * This method will free @invocation, you cannot use it afterwards.
6149 */
6150void
6151sensor_threshold_complete_get_state (
6152 SensorThreshold *object,
6153 GDBusMethodInvocation *invocation,
6154 guchar state)
6155{
6156 g_dbus_method_invocation_return_value (invocation,
6157 g_variant_new ("(y)",
6158 state));
6159}
6160
6161/* ------------------------------------------------------------------------ */
6162
6163/**
6164 * SensorThresholdProxy:
6165 *
6166 * The #SensorThresholdProxy structure contains only private data and should only be accessed using the provided API.
6167 */
6168
6169/**
6170 * SensorThresholdProxyClass:
6171 * @parent_class: The parent class.
6172 *
6173 * Class structure for #SensorThresholdProxy.
6174 */
6175
6176struct _SensorThresholdProxyPrivate
6177{
6178 GData *qdata;
6179};
6180
6181static void sensor_threshold_proxy_iface_init (SensorThresholdIface *iface);
6182
6183#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
6184G_DEFINE_TYPE_WITH_CODE (SensorThresholdProxy, sensor_threshold_proxy, G_TYPE_DBUS_PROXY,
6185 G_ADD_PRIVATE (SensorThresholdProxy)
6186 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_proxy_iface_init));
6187
6188#else
6189G_DEFINE_TYPE_WITH_CODE (SensorThresholdProxy, sensor_threshold_proxy, G_TYPE_DBUS_PROXY,
6190 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_proxy_iface_init));
6191
6192#endif
6193static void
6194sensor_threshold_proxy_finalize (GObject *object)
6195{
6196 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
6197 g_datalist_clear (&proxy->priv->qdata);
6198 G_OBJECT_CLASS (sensor_threshold_proxy_parent_class)->finalize (object);
6199}
6200
6201static void
6202sensor_threshold_proxy_get_property (GObject *object,
6203 guint prop_id,
6204 GValue *value,
6205 GParamSpec *pspec G_GNUC_UNUSED)
6206{
6207 const _ExtendedGDBusPropertyInfo *info;
6208 GVariant *variant;
6209 g_assert (prop_id != 0 && prop_id - 1 < 5);
6210 info = _sensor_threshold_property_info_pointers[prop_id - 1];
6211 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
6212 if (info->use_gvariant)
6213 {
6214 g_value_set_variant (value, variant);
6215 }
6216 else
6217 {
6218 if (variant != NULL)
6219 g_dbus_gvariant_to_gvalue (variant, value);
6220 }
6221 if (variant != NULL)
6222 g_variant_unref (variant);
6223}
6224
6225static void
6226sensor_threshold_proxy_set_property_cb (GDBusProxy *proxy,
6227 GAsyncResult *res,
6228 gpointer user_data)
6229{
6230 const _ExtendedGDBusPropertyInfo *info = user_data;
6231 GError *error;
6232 GVariant *_ret;
6233 error = NULL;
6234 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
6235 if (!_ret)
6236 {
6237 g_warning ("Error setting property '%s' on interface org.openbmc.SensorThreshold: %s (%s, %d)",
6238 info->parent_struct.name,
6239 error->message, g_quark_to_string (error->domain), error->code);
6240 g_error_free (error);
6241 }
6242 else
6243 {
6244 g_variant_unref (_ret);
6245 }
6246}
6247
6248static void
6249sensor_threshold_proxy_set_property (GObject *object,
6250 guint prop_id,
6251 const GValue *value,
6252 GParamSpec *pspec G_GNUC_UNUSED)
6253{
6254 const _ExtendedGDBusPropertyInfo *info;
6255 GVariant *variant;
6256 g_assert (prop_id != 0 && prop_id - 1 < 5);
6257 info = _sensor_threshold_property_info_pointers[prop_id - 1];
6258 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
6259 g_dbus_proxy_call (G_DBUS_PROXY (object),
6260 "org.freedesktop.DBus.Properties.Set",
6261 g_variant_new ("(ssv)", "org.openbmc.SensorThreshold", info->parent_struct.name, variant),
6262 G_DBUS_CALL_FLAGS_NONE,
6263 -1,
6264 NULL, (GAsyncReadyCallback) sensor_threshold_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
6265 g_variant_unref (variant);
6266}
6267
6268static void
6269sensor_threshold_proxy_g_signal (GDBusProxy *proxy,
6270 const gchar *sender_name G_GNUC_UNUSED,
6271 const gchar *signal_name,
6272 GVariant *parameters)
6273{
6274 _ExtendedGDBusSignalInfo *info;
6275 GVariantIter iter;
6276 GVariant *child;
6277 GValue *paramv;
6278 guint num_params;
6279 guint n;
6280 guint signal_id;
6281 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, signal_name);
6282 if (info == NULL)
6283 return;
6284 num_params = g_variant_n_children (parameters);
6285 paramv = g_new0 (GValue, num_params + 1);
6286 g_value_init (&paramv[0], TYPE_SENSOR_THRESHOLD);
6287 g_value_set_object (&paramv[0], proxy);
6288 g_variant_iter_init (&iter, parameters);
6289 n = 1;
6290 while ((child = g_variant_iter_next_value (&iter)) != NULL)
6291 {
6292 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
6293 if (arg_info->use_gvariant)
6294 {
6295 g_value_init (&paramv[n], G_TYPE_VARIANT);
6296 g_value_set_variant (&paramv[n], child);
6297 n++;
6298 }
6299 else
6300 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
6301 g_variant_unref (child);
6302 }
6303 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_THRESHOLD);
6304 g_signal_emitv (paramv, signal_id, 0, NULL);
6305 for (n = 0; n < num_params + 1; n++)
6306 g_value_unset (&paramv[n]);
6307 g_free (paramv);
6308}
6309
6310static void
6311sensor_threshold_proxy_g_properties_changed (GDBusProxy *_proxy,
6312 GVariant *changed_properties,
6313 const gchar *const *invalidated_properties)
6314{
6315 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (_proxy);
6316 guint n;
6317 const gchar *key;
6318 GVariantIter *iter;
6319 _ExtendedGDBusPropertyInfo *info;
6320 g_variant_get (changed_properties, "a{sv}", &iter);
6321 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
6322 {
6323 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, key);
6324 g_datalist_remove_data (&proxy->priv->qdata, key);
6325 if (info != NULL)
6326 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
6327 }
6328 g_variant_iter_free (iter);
6329 for (n = 0; invalidated_properties[n] != NULL; n++)
6330 {
6331 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, invalidated_properties[n]);
6332 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
6333 if (info != NULL)
6334 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
6335 }
6336}
6337
6338static GVariant *
6339sensor_threshold_proxy_get_lower_critical (SensorThreshold *object)
6340{
6341 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
6342 GVariant *variant;
6343 GVariant *value = NULL;
6344 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "lower_critical");
6345 value = variant;
6346 if (variant != NULL)
6347 g_variant_unref (variant);
6348 return value;
6349}
6350
6351static GVariant *
6352sensor_threshold_proxy_get_lower_warning (SensorThreshold *object)
6353{
6354 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
6355 GVariant *variant;
6356 GVariant *value = NULL;
6357 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "lower_warning");
6358 value = variant;
6359 if (variant != NULL)
6360 g_variant_unref (variant);
6361 return value;
6362}
6363
6364static GVariant *
6365sensor_threshold_proxy_get_upper_warning (SensorThreshold *object)
6366{
6367 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
6368 GVariant *variant;
6369 GVariant *value = NULL;
6370 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "upper_warning");
6371 value = variant;
6372 if (variant != NULL)
6373 g_variant_unref (variant);
6374 return value;
6375}
6376
6377static GVariant *
6378sensor_threshold_proxy_get_upper_critical (SensorThreshold *object)
6379{
6380 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
6381 GVariant *variant;
6382 GVariant *value = NULL;
6383 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "upper_critical");
6384 value = variant;
6385 if (variant != NULL)
6386 g_variant_unref (variant);
6387 return value;
6388}
6389
6390static guchar
6391sensor_threshold_proxy_get_state (SensorThreshold *object)
6392{
6393 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
6394 GVariant *variant;
6395 guchar value = 0;
6396 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state");
6397 if (variant != NULL)
6398 {
6399 value = g_variant_get_byte (variant);
6400 g_variant_unref (variant);
6401 }
6402 return value;
6403}
6404
6405static void
6406sensor_threshold_proxy_init (SensorThresholdProxy *proxy)
6407{
6408#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
6409 proxy->priv = sensor_threshold_proxy_get_instance_private (proxy);
6410#else
6411 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_THRESHOLD_PROXY, SensorThresholdProxyPrivate);
6412#endif
6413
6414 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_threshold_interface_info ());
6415}
6416
6417static void
6418sensor_threshold_proxy_class_init (SensorThresholdProxyClass *klass)
6419{
6420 GObjectClass *gobject_class;
6421 GDBusProxyClass *proxy_class;
6422
6423 gobject_class = G_OBJECT_CLASS (klass);
6424 gobject_class->finalize = sensor_threshold_proxy_finalize;
6425 gobject_class->get_property = sensor_threshold_proxy_get_property;
6426 gobject_class->set_property = sensor_threshold_proxy_set_property;
6427
6428 proxy_class = G_DBUS_PROXY_CLASS (klass);
6429 proxy_class->g_signal = sensor_threshold_proxy_g_signal;
6430 proxy_class->g_properties_changed = sensor_threshold_proxy_g_properties_changed;
6431
6432 sensor_threshold_override_properties (gobject_class, 1);
6433
6434#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
6435 g_type_class_add_private (klass, sizeof (SensorThresholdProxyPrivate));
6436#endif
6437}
6438
6439static void
6440sensor_threshold_proxy_iface_init (SensorThresholdIface *iface)
6441{
6442 iface->get_lower_critical = sensor_threshold_proxy_get_lower_critical;
6443 iface->get_lower_warning = sensor_threshold_proxy_get_lower_warning;
6444 iface->get_upper_warning = sensor_threshold_proxy_get_upper_warning;
6445 iface->get_upper_critical = sensor_threshold_proxy_get_upper_critical;
6446 iface->get_state = sensor_threshold_proxy_get_state;
6447}
6448
6449/**
6450 * sensor_threshold_proxy_new:
6451 * @connection: A #GDBusConnection.
6452 * @flags: Flags from the #GDBusProxyFlags enumeration.
6453 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
6454 * @object_path: An object path.
6455 * @cancellable: (allow-none): A #GCancellable or %NULL.
6456 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
6457 * @user_data: User data to pass to @callback.
6458 *
6459 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link>. See g_dbus_proxy_new() for more details.
6460 *
6461 * 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.
6462 * You can then call sensor_threshold_proxy_new_finish() to get the result of the operation.
6463 *
6464 * See sensor_threshold_proxy_new_sync() for the synchronous, blocking version of this constructor.
6465 */
6466void
6467sensor_threshold_proxy_new (
6468 GDBusConnection *connection,
6469 GDBusProxyFlags flags,
6470 const gchar *name,
6471 const gchar *object_path,
6472 GCancellable *cancellable,
6473 GAsyncReadyCallback callback,
6474 gpointer user_data)
6475{
6476 g_async_initable_new_async (TYPE_SENSOR_THRESHOLD_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorThreshold", NULL);
6477}
6478
6479/**
6480 * sensor_threshold_proxy_new_finish:
6481 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_threshold_proxy_new().
6482 * @error: Return location for error or %NULL
6483 *
6484 * Finishes an operation started with sensor_threshold_proxy_new().
6485 *
6486 * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set.
6487 */
6488SensorThreshold *
6489sensor_threshold_proxy_new_finish (
6490 GAsyncResult *res,
6491 GError **error)
6492{
6493 GObject *ret;
6494 GObject *source_object;
6495 source_object = g_async_result_get_source_object (res);
6496 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
6497 g_object_unref (source_object);
6498 if (ret != NULL)
6499 return SENSOR_THRESHOLD (ret);
6500 else
6501 return NULL;
6502}
6503
6504/**
6505 * sensor_threshold_proxy_new_sync:
6506 * @connection: A #GDBusConnection.
6507 * @flags: Flags from the #GDBusProxyFlags enumeration.
6508 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
6509 * @object_path: An object path.
6510 * @cancellable: (allow-none): A #GCancellable or %NULL.
6511 * @error: Return location for error or %NULL
6512 *
6513 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link>. See g_dbus_proxy_new_sync() for more details.
6514 *
6515 * The calling thread is blocked until a reply is received.
6516 *
6517 * See sensor_threshold_proxy_new() for the asynchronous version of this constructor.
6518 *
6519 * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set.
6520 */
6521SensorThreshold *
6522sensor_threshold_proxy_new_sync (
6523 GDBusConnection *connection,
6524 GDBusProxyFlags flags,
6525 const gchar *name,
6526 const gchar *object_path,
6527 GCancellable *cancellable,
6528 GError **error)
6529{
6530 GInitable *ret;
6531 ret = g_initable_new (TYPE_SENSOR_THRESHOLD_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorThreshold", NULL);
6532 if (ret != NULL)
6533 return SENSOR_THRESHOLD (ret);
6534 else
6535 return NULL;
6536}
6537
6538
6539/**
6540 * sensor_threshold_proxy_new_for_bus:
6541 * @bus_type: A #GBusType.
6542 * @flags: Flags from the #GDBusProxyFlags enumeration.
6543 * @name: A bus name (well-known or unique).
6544 * @object_path: An object path.
6545 * @cancellable: (allow-none): A #GCancellable or %NULL.
6546 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
6547 * @user_data: User data to pass to @callback.
6548 *
6549 * Like sensor_threshold_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
6550 *
6551 * 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.
6552 * You can then call sensor_threshold_proxy_new_for_bus_finish() to get the result of the operation.
6553 *
6554 * See sensor_threshold_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
6555 */
6556void
6557sensor_threshold_proxy_new_for_bus (
6558 GBusType bus_type,
6559 GDBusProxyFlags flags,
6560 const gchar *name,
6561 const gchar *object_path,
6562 GCancellable *cancellable,
6563 GAsyncReadyCallback callback,
6564 gpointer user_data)
6565{
6566 g_async_initable_new_async (TYPE_SENSOR_THRESHOLD_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorThreshold", NULL);
6567}
6568
6569/**
6570 * sensor_threshold_proxy_new_for_bus_finish:
6571 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_threshold_proxy_new_for_bus().
6572 * @error: Return location for error or %NULL
6573 *
6574 * Finishes an operation started with sensor_threshold_proxy_new_for_bus().
6575 *
6576 * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set.
6577 */
6578SensorThreshold *
6579sensor_threshold_proxy_new_for_bus_finish (
6580 GAsyncResult *res,
6581 GError **error)
6582{
6583 GObject *ret;
6584 GObject *source_object;
6585 source_object = g_async_result_get_source_object (res);
6586 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
6587 g_object_unref (source_object);
6588 if (ret != NULL)
6589 return SENSOR_THRESHOLD (ret);
6590 else
6591 return NULL;
6592}
6593
6594/**
6595 * sensor_threshold_proxy_new_for_bus_sync:
6596 * @bus_type: A #GBusType.
6597 * @flags: Flags from the #GDBusProxyFlags enumeration.
6598 * @name: A bus name (well-known or unique).
6599 * @object_path: An object path.
6600 * @cancellable: (allow-none): A #GCancellable or %NULL.
6601 * @error: Return location for error or %NULL
6602 *
6603 * Like sensor_threshold_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
6604 *
6605 * The calling thread is blocked until a reply is received.
6606 *
6607 * See sensor_threshold_proxy_new_for_bus() for the asynchronous version of this constructor.
6608 *
6609 * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set.
6610 */
6611SensorThreshold *
6612sensor_threshold_proxy_new_for_bus_sync (
6613 GBusType bus_type,
6614 GDBusProxyFlags flags,
6615 const gchar *name,
6616 const gchar *object_path,
6617 GCancellable *cancellable,
6618 GError **error)
6619{
6620 GInitable *ret;
6621 ret = g_initable_new (TYPE_SENSOR_THRESHOLD_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorThreshold", NULL);
6622 if (ret != NULL)
6623 return SENSOR_THRESHOLD (ret);
6624 else
6625 return NULL;
6626}
6627
6628
6629/* ------------------------------------------------------------------------ */
6630
6631/**
6632 * SensorThresholdSkeleton:
6633 *
6634 * The #SensorThresholdSkeleton structure contains only private data and should only be accessed using the provided API.
6635 */
6636
6637/**
6638 * SensorThresholdSkeletonClass:
6639 * @parent_class: The parent class.
6640 *
6641 * Class structure for #SensorThresholdSkeleton.
6642 */
6643
6644struct _SensorThresholdSkeletonPrivate
6645{
6646 GValue *properties;
6647 GList *changed_properties;
6648 GSource *changed_properties_idle_source;
6649 GMainContext *context;
6650 GMutex lock;
6651};
6652
6653static void
6654_sensor_threshold_skeleton_handle_method_call (
6655 GDBusConnection *connection G_GNUC_UNUSED,
6656 const gchar *sender G_GNUC_UNUSED,
6657 const gchar *object_path G_GNUC_UNUSED,
6658 const gchar *interface_name,
6659 const gchar *method_name,
6660 GVariant *parameters,
6661 GDBusMethodInvocation *invocation,
6662 gpointer user_data)
6663{
6664 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data);
6665 _ExtendedGDBusMethodInfo *info;
6666 GVariantIter iter;
6667 GVariant *child;
6668 GValue *paramv;
6669 guint num_params;
6670 guint num_extra;
6671 guint n;
6672 guint signal_id;
6673 GValue return_value = G_VALUE_INIT;
6674 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
6675 g_assert (info != NULL);
6676 num_params = g_variant_n_children (parameters);
6677 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
6678 n = 0;
6679 g_value_init (&paramv[n], TYPE_SENSOR_THRESHOLD);
6680 g_value_set_object (&paramv[n++], skeleton);
6681 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
6682 g_value_set_object (&paramv[n++], invocation);
6683 if (info->pass_fdlist)
6684 {
6685#ifdef G_OS_UNIX
6686 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
6687 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
6688#else
6689 g_assert_not_reached ();
6690#endif
6691 }
6692 g_variant_iter_init (&iter, parameters);
6693 while ((child = g_variant_iter_next_value (&iter)) != NULL)
6694 {
6695 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
6696 if (arg_info->use_gvariant)
6697 {
6698 g_value_init (&paramv[n], G_TYPE_VARIANT);
6699 g_value_set_variant (&paramv[n], child);
6700 n++;
6701 }
6702 else
6703 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
6704 g_variant_unref (child);
6705 }
6706 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_THRESHOLD);
6707 g_value_init (&return_value, G_TYPE_BOOLEAN);
6708 g_signal_emitv (paramv, signal_id, 0, &return_value);
6709 if (!g_value_get_boolean (&return_value))
6710 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);
6711 g_value_unset (&return_value);
6712 for (n = 0; n < num_params + num_extra; n++)
6713 g_value_unset (&paramv[n]);
6714 g_free (paramv);
6715}
6716
6717static GVariant *
6718_sensor_threshold_skeleton_handle_get_property (
6719 GDBusConnection *connection G_GNUC_UNUSED,
6720 const gchar *sender G_GNUC_UNUSED,
6721 const gchar *object_path G_GNUC_UNUSED,
6722 const gchar *interface_name G_GNUC_UNUSED,
6723 const gchar *property_name,
6724 GError **error,
6725 gpointer user_data)
6726{
6727 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data);
6728 GValue value = G_VALUE_INIT;
6729 GParamSpec *pspec;
6730 _ExtendedGDBusPropertyInfo *info;
6731 GVariant *ret;
6732 ret = NULL;
6733 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, property_name);
6734 g_assert (info != NULL);
6735 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
6736 if (pspec == NULL)
6737 {
6738 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
6739 }
6740 else
6741 {
6742 g_value_init (&value, pspec->value_type);
6743 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
6744 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
6745 g_value_unset (&value);
6746 }
6747 return ret;
6748}
6749
6750static gboolean
6751_sensor_threshold_skeleton_handle_set_property (
6752 GDBusConnection *connection G_GNUC_UNUSED,
6753 const gchar *sender G_GNUC_UNUSED,
6754 const gchar *object_path G_GNUC_UNUSED,
6755 const gchar *interface_name G_GNUC_UNUSED,
6756 const gchar *property_name,
6757 GVariant *variant,
6758 GError **error,
6759 gpointer user_data)
6760{
6761 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data);
6762 GValue value = G_VALUE_INIT;
6763 GParamSpec *pspec;
6764 _ExtendedGDBusPropertyInfo *info;
6765 gboolean ret;
6766 ret = FALSE;
6767 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, property_name);
6768 g_assert (info != NULL);
6769 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
6770 if (pspec == NULL)
6771 {
6772 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
6773 }
6774 else
6775 {
6776 if (info->use_gvariant)
6777 g_value_set_variant (&value, variant);
6778 else
6779 g_dbus_gvariant_to_gvalue (variant, &value);
6780 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
6781 g_value_unset (&value);
6782 ret = TRUE;
6783 }
6784 return ret;
6785}
6786
6787static const GDBusInterfaceVTable _sensor_threshold_skeleton_vtable =
6788{
6789 _sensor_threshold_skeleton_handle_method_call,
6790 _sensor_threshold_skeleton_handle_get_property,
6791 _sensor_threshold_skeleton_handle_set_property,
6792 {NULL}
6793};
6794
6795static GDBusInterfaceInfo *
6796sensor_threshold_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
6797{
6798 return sensor_threshold_interface_info ();
6799}
6800
6801static GDBusInterfaceVTable *
6802sensor_threshold_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
6803{
6804 return (GDBusInterfaceVTable *) &_sensor_threshold_skeleton_vtable;
6805}
6806
6807static GVariant *
6808sensor_threshold_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
6809{
6810 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (_skeleton);
6811
6812 GVariantBuilder builder;
6813 guint n;
6814 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
6815 if (_sensor_threshold_interface_info.parent_struct.properties == NULL)
6816 goto out;
6817 for (n = 0; _sensor_threshold_interface_info.parent_struct.properties[n] != NULL; n++)
6818 {
6819 GDBusPropertyInfo *info = _sensor_threshold_interface_info.parent_struct.properties[n];
6820 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
6821 {
6822 GVariant *value;
6823 value = _sensor_threshold_skeleton_handle_get_property (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorThreshold", info->name, NULL, skeleton);
6824 if (value != NULL)
6825 {
6826 g_variant_take_ref (value);
6827 g_variant_builder_add (&builder, "{sv}", info->name, value);
6828 g_variant_unref (value);
6829 }
6830 }
6831 }
6832out:
6833 return g_variant_builder_end (&builder);
6834}
6835
6836static gboolean _sensor_threshold_emit_changed (gpointer user_data);
6837
6838static void
6839sensor_threshold_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
6840{
6841 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (_skeleton);
6842 gboolean emit_changed = FALSE;
6843
6844 g_mutex_lock (&skeleton->priv->lock);
6845 if (skeleton->priv->changed_properties_idle_source != NULL)
6846 {
6847 g_source_destroy (skeleton->priv->changed_properties_idle_source);
6848 skeleton->priv->changed_properties_idle_source = NULL;
6849 emit_changed = TRUE;
6850 }
6851 g_mutex_unlock (&skeleton->priv->lock);
6852
6853 if (emit_changed)
6854 _sensor_threshold_emit_changed (skeleton);
6855}
6856
6857static void
6858_sensor_threshold_on_signal_warning (
6859 SensorThreshold *object)
6860{
6861 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
6862
6863 GList *connections, *l;
6864 GVariant *signal_variant;
6865 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
6866
6867 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
6868 for (l = connections; l != NULL; l = l->next)
6869 {
6870 GDBusConnection *connection = l->data;
6871 g_dbus_connection_emit_signal (connection,
6872 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorThreshold", "Warning",
6873 signal_variant, NULL);
6874 }
6875 g_variant_unref (signal_variant);
6876 g_list_free_full (connections, g_object_unref);
6877}
6878
6879static void
6880_sensor_threshold_on_signal_critical (
6881 SensorThreshold *object)
6882{
6883 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
6884
6885 GList *connections, *l;
6886 GVariant *signal_variant;
6887 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
6888
6889 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
6890 for (l = connections; l != NULL; l = l->next)
6891 {
6892 GDBusConnection *connection = l->data;
6893 g_dbus_connection_emit_signal (connection,
6894 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorThreshold", "Critical",
6895 signal_variant, NULL);
6896 }
6897 g_variant_unref (signal_variant);
6898 g_list_free_full (connections, g_object_unref);
6899}
6900
6901static void
6902_sensor_threshold_on_signal_normal (
6903 SensorThreshold *object)
6904{
6905 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
6906
6907 GList *connections, *l;
6908 GVariant *signal_variant;
6909 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
6910
6911 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
6912 for (l = connections; l != NULL; l = l->next)
6913 {
6914 GDBusConnection *connection = l->data;
6915 g_dbus_connection_emit_signal (connection,
6916 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorThreshold", "Normal",
6917 signal_variant, NULL);
6918 }
6919 g_variant_unref (signal_variant);
6920 g_list_free_full (connections, g_object_unref);
6921}
6922
6923static void sensor_threshold_skeleton_iface_init (SensorThresholdIface *iface);
6924#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
6925G_DEFINE_TYPE_WITH_CODE (SensorThresholdSkeleton, sensor_threshold_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
6926 G_ADD_PRIVATE (SensorThresholdSkeleton)
6927 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_skeleton_iface_init));
6928
6929#else
6930G_DEFINE_TYPE_WITH_CODE (SensorThresholdSkeleton, sensor_threshold_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
6931 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_skeleton_iface_init));
6932
6933#endif
6934static void
6935sensor_threshold_skeleton_finalize (GObject *object)
6936{
6937 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
6938 guint n;
6939 for (n = 0; n < 5; n++)
6940 g_value_unset (&skeleton->priv->properties[n]);
6941 g_free (skeleton->priv->properties);
6942 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
6943 if (skeleton->priv->changed_properties_idle_source != NULL)
6944 g_source_destroy (skeleton->priv->changed_properties_idle_source);
6945 g_main_context_unref (skeleton->priv->context);
6946 g_mutex_clear (&skeleton->priv->lock);
6947 G_OBJECT_CLASS (sensor_threshold_skeleton_parent_class)->finalize (object);
6948}
6949
6950static void
6951sensor_threshold_skeleton_get_property (GObject *object,
6952 guint prop_id,
6953 GValue *value,
6954 GParamSpec *pspec G_GNUC_UNUSED)
6955{
6956 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
6957 g_assert (prop_id != 0 && prop_id - 1 < 5);
6958 g_mutex_lock (&skeleton->priv->lock);
6959 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
6960 g_mutex_unlock (&skeleton->priv->lock);
6961}
6962
6963static gboolean
6964_sensor_threshold_emit_changed (gpointer user_data)
6965{
6966 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data);
6967 GList *l;
6968 GVariantBuilder builder;
6969 GVariantBuilder invalidated_builder;
6970 guint num_changes;
6971
6972 g_mutex_lock (&skeleton->priv->lock);
6973 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
6974 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
6975 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
6976 {
6977 ChangedProperty *cp = l->data;
6978 GVariant *variant;
6979 const GValue *cur_value;
6980
6981 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
6982 if (!_g_value_equal (cur_value, &cp->orig_value))
6983 {
6984 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
6985 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
6986 g_variant_unref (variant);
6987 num_changes++;
6988 }
6989 }
6990 if (num_changes > 0)
6991 {
6992 GList *connections, *ll;
6993 GVariant *signal_variant;
6994 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorThreshold",
6995 &builder, &invalidated_builder));
6996 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
6997 for (ll = connections; ll != NULL; ll = ll->next)
6998 {
6999 GDBusConnection *connection = ll->data;
7000
7001 g_dbus_connection_emit_signal (connection,
7002 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
7003 "org.freedesktop.DBus.Properties",
7004 "PropertiesChanged",
7005 signal_variant,
7006 NULL);
7007 }
7008 g_variant_unref (signal_variant);
7009 g_list_free_full (connections, g_object_unref);
7010 }
7011 else
7012 {
7013 g_variant_builder_clear (&builder);
7014 g_variant_builder_clear (&invalidated_builder);
7015 }
7016 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
7017 skeleton->priv->changed_properties = NULL;
7018 skeleton->priv->changed_properties_idle_source = NULL;
7019 g_mutex_unlock (&skeleton->priv->lock);
7020 return FALSE;
7021}
7022
7023static void
7024_sensor_threshold_schedule_emit_changed (SensorThresholdSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
7025{
7026 ChangedProperty *cp;
7027 GList *l;
7028 cp = NULL;
7029 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
7030 {
7031 ChangedProperty *i_cp = l->data;
7032 if (i_cp->info == info)
7033 {
7034 cp = i_cp;
7035 break;
7036 }
7037 }
7038 if (cp == NULL)
7039 {
7040 cp = g_new0 (ChangedProperty, 1);
7041 cp->prop_id = prop_id;
7042 cp->info = info;
7043 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
7044 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
7045 g_value_copy (orig_value, &cp->orig_value);
7046 }
7047}
7048
7049static void
7050sensor_threshold_skeleton_notify (GObject *object,
7051 GParamSpec *pspec G_GNUC_UNUSED)
7052{
7053 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7054 g_mutex_lock (&skeleton->priv->lock);
7055 if (skeleton->priv->changed_properties != NULL &&
7056 skeleton->priv->changed_properties_idle_source == NULL)
7057 {
7058 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
7059 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
7060 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_threshold_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
Adriana Kobylakfd778822016-06-16 09:08:37 -05007061 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _sensor_threshold_emit_changed");
Norman James362a80f2015-09-14 14:04:39 -05007062 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
7063 g_source_unref (skeleton->priv->changed_properties_idle_source);
7064 }
7065 g_mutex_unlock (&skeleton->priv->lock);
7066}
7067
7068static void
7069sensor_threshold_skeleton_set_property (GObject *object,
7070 guint prop_id,
7071 const GValue *value,
7072 GParamSpec *pspec)
7073{
7074 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7075 g_assert (prop_id != 0 && prop_id - 1 < 5);
7076 g_mutex_lock (&skeleton->priv->lock);
7077 g_object_freeze_notify (object);
7078 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
7079 {
7080 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
7081 _sensor_threshold_schedule_emit_changed (skeleton, _sensor_threshold_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
7082 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
7083 g_object_notify_by_pspec (object, pspec);
7084 }
7085 g_mutex_unlock (&skeleton->priv->lock);
7086 g_object_thaw_notify (object);
7087}
7088
7089static void
7090sensor_threshold_skeleton_init (SensorThresholdSkeleton *skeleton)
7091{
7092#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
7093 skeleton->priv = sensor_threshold_skeleton_get_instance_private (skeleton);
7094#else
7095 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_THRESHOLD_SKELETON, SensorThresholdSkeletonPrivate);
7096#endif
7097
7098 g_mutex_init (&skeleton->priv->lock);
7099 skeleton->priv->context = g_main_context_ref_thread_default ();
7100 skeleton->priv->properties = g_new0 (GValue, 5);
7101 g_value_init (&skeleton->priv->properties[0], G_TYPE_VARIANT);
7102 g_value_init (&skeleton->priv->properties[1], G_TYPE_VARIANT);
7103 g_value_init (&skeleton->priv->properties[2], G_TYPE_VARIANT);
7104 g_value_init (&skeleton->priv->properties[3], G_TYPE_VARIANT);
7105 g_value_init (&skeleton->priv->properties[4], G_TYPE_UCHAR);
7106}
7107
7108static GVariant *
7109sensor_threshold_skeleton_get_lower_critical (SensorThreshold *object)
7110{
7111 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7112 GVariant *value;
7113 g_mutex_lock (&skeleton->priv->lock);
7114 value = g_value_get_variant (&(skeleton->priv->properties[0]));
7115 g_mutex_unlock (&skeleton->priv->lock);
7116 return value;
7117}
7118
7119static GVariant *
7120sensor_threshold_skeleton_get_lower_warning (SensorThreshold *object)
7121{
7122 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7123 GVariant *value;
7124 g_mutex_lock (&skeleton->priv->lock);
7125 value = g_value_get_variant (&(skeleton->priv->properties[1]));
7126 g_mutex_unlock (&skeleton->priv->lock);
7127 return value;
7128}
7129
7130static GVariant *
7131sensor_threshold_skeleton_get_upper_warning (SensorThreshold *object)
7132{
7133 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7134 GVariant *value;
7135 g_mutex_lock (&skeleton->priv->lock);
7136 value = g_value_get_variant (&(skeleton->priv->properties[2]));
7137 g_mutex_unlock (&skeleton->priv->lock);
7138 return value;
7139}
7140
7141static GVariant *
7142sensor_threshold_skeleton_get_upper_critical (SensorThreshold *object)
7143{
7144 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7145 GVariant *value;
7146 g_mutex_lock (&skeleton->priv->lock);
7147 value = g_value_get_variant (&(skeleton->priv->properties[3]));
7148 g_mutex_unlock (&skeleton->priv->lock);
7149 return value;
7150}
7151
7152static guchar
7153sensor_threshold_skeleton_get_state (SensorThreshold *object)
7154{
7155 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7156 guchar value;
7157 g_mutex_lock (&skeleton->priv->lock);
7158 value = g_value_get_uchar (&(skeleton->priv->properties[4]));
7159 g_mutex_unlock (&skeleton->priv->lock);
7160 return value;
7161}
7162
7163static void
7164sensor_threshold_skeleton_class_init (SensorThresholdSkeletonClass *klass)
7165{
7166 GObjectClass *gobject_class;
7167 GDBusInterfaceSkeletonClass *skeleton_class;
7168
7169 gobject_class = G_OBJECT_CLASS (klass);
7170 gobject_class->finalize = sensor_threshold_skeleton_finalize;
7171 gobject_class->get_property = sensor_threshold_skeleton_get_property;
7172 gobject_class->set_property = sensor_threshold_skeleton_set_property;
7173 gobject_class->notify = sensor_threshold_skeleton_notify;
7174
7175
7176 sensor_threshold_override_properties (gobject_class, 1);
7177
7178 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
7179 skeleton_class->get_info = sensor_threshold_skeleton_dbus_interface_get_info;
7180 skeleton_class->get_properties = sensor_threshold_skeleton_dbus_interface_get_properties;
7181 skeleton_class->flush = sensor_threshold_skeleton_dbus_interface_flush;
7182 skeleton_class->get_vtable = sensor_threshold_skeleton_dbus_interface_get_vtable;
7183
7184#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
7185 g_type_class_add_private (klass, sizeof (SensorThresholdSkeletonPrivate));
7186#endif
7187}
7188
7189static void
7190sensor_threshold_skeleton_iface_init (SensorThresholdIface *iface)
7191{
7192 iface->warning = _sensor_threshold_on_signal_warning;
7193 iface->critical = _sensor_threshold_on_signal_critical;
7194 iface->normal = _sensor_threshold_on_signal_normal;
7195 iface->get_lower_critical = sensor_threshold_skeleton_get_lower_critical;
7196 iface->get_lower_warning = sensor_threshold_skeleton_get_lower_warning;
7197 iface->get_upper_warning = sensor_threshold_skeleton_get_upper_warning;
7198 iface->get_upper_critical = sensor_threshold_skeleton_get_upper_critical;
7199 iface->get_state = sensor_threshold_skeleton_get_state;
7200}
7201
7202/**
7203 * sensor_threshold_skeleton_new:
7204 *
7205 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link>.
7206 *
7207 * Returns: (transfer full) (type SensorThresholdSkeleton): The skeleton object.
7208 */
7209SensorThreshold *
7210sensor_threshold_skeleton_new (void)
7211{
7212 return SENSOR_THRESHOLD (g_object_new (TYPE_SENSOR_THRESHOLD_SKELETON, NULL));
7213}
7214
7215/* ------------------------------------------------------------------------
7216 * Code for interface org.openbmc.SensorI2c
7217 * ------------------------------------------------------------------------
7218 */
7219
7220/**
7221 * SECTION:SensorI2c
7222 * @title: SensorI2c
7223 * @short_description: Generated C code for the org.openbmc.SensorI2c D-Bus interface
7224 *
7225 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link> D-Bus interface in C.
7226 */
7227
7228/* ---- Introspection data for org.openbmc.SensorI2c ---- */
7229
7230static const _ExtendedGDBusPropertyInfo _sensor_i2c_property_info_dev_path =
7231{
7232 {
7233 -1,
7234 (gchar *) "dev_path",
7235 (gchar *) "s",
7236 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
7237 NULL
7238 },
7239 "dev-path",
7240 FALSE
7241};
7242
7243static const _ExtendedGDBusPropertyInfo _sensor_i2c_property_info_address =
7244{
7245 {
7246 -1,
7247 (gchar *) "address",
7248 (gchar *) "s",
7249 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
7250 NULL
7251 },
7252 "address",
7253 FALSE
7254};
7255
7256static const _ExtendedGDBusPropertyInfo * const _sensor_i2c_property_info_pointers[] =
7257{
7258 &_sensor_i2c_property_info_dev_path,
7259 &_sensor_i2c_property_info_address,
7260 NULL
7261};
7262
7263static const _ExtendedGDBusInterfaceInfo _sensor_i2c_interface_info =
7264{
7265 {
7266 -1,
7267 (gchar *) "org.openbmc.SensorI2c",
7268 NULL,
7269 NULL,
7270 (GDBusPropertyInfo **) &_sensor_i2c_property_info_pointers,
7271 NULL
7272 },
7273 "sensor-i2c",
7274};
7275
7276
7277/**
7278 * sensor_i2c_interface_info:
7279 *
7280 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link> D-Bus interface.
7281 *
7282 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
7283 */
7284GDBusInterfaceInfo *
7285sensor_i2c_interface_info (void)
7286{
7287 return (GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct;
7288}
7289
7290/**
7291 * sensor_i2c_override_properties:
7292 * @klass: The class structure for a #GObject<!-- -->-derived class.
7293 * @property_id_begin: The property id to assign to the first overridden property.
7294 *
7295 * Overrides all #GObject properties in the #SensorI2c interface for a concrete class.
7296 * The properties are overridden in the order they are defined.
7297 *
7298 * Returns: The last property id.
7299 */
7300guint
7301sensor_i2c_override_properties (GObjectClass *klass, guint property_id_begin)
7302{
7303 g_object_class_override_property (klass, property_id_begin++, "dev-path");
7304 g_object_class_override_property (klass, property_id_begin++, "address");
7305 return property_id_begin - 1;
7306}
7307
7308
7309
7310/**
7311 * SensorI2c:
7312 *
7313 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>.
7314 */
7315
7316/**
7317 * SensorI2cIface:
7318 * @parent_iface: The parent interface.
7319 * @get_address: Getter for the #SensorI2c:address property.
7320 * @get_dev_path: Getter for the #SensorI2c:dev-path property.
7321 *
7322 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>.
7323 */
7324
7325typedef SensorI2cIface SensorI2cInterface;
7326G_DEFINE_INTERFACE (SensorI2c, sensor_i2c, G_TYPE_OBJECT);
7327
7328static void
7329sensor_i2c_default_init (SensorI2cIface *iface)
7330{
7331 /* GObject properties for D-Bus properties: */
7332 /**
7333 * SensorI2c:dev-path:
7334 *
7335 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link>.
7336 *
7337 * 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.
7338 */
7339 g_object_interface_install_property (iface,
7340 g_param_spec_string ("dev-path", "dev_path", "dev_path", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
7341 /**
7342 * SensorI2c:address:
7343 *
7344 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link>.
7345 *
7346 * 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.
7347 */
7348 g_object_interface_install_property (iface,
7349 g_param_spec_string ("address", "address", "address", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
7350}
7351
7352/**
7353 * sensor_i2c_get_dev_path: (skip)
7354 * @object: A #SensorI2c.
7355 *
7356 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link> D-Bus property.
7357 *
7358 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
7359 *
7360 * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use sensor_i2c_dup_dev_path() if on another thread.</warning>
7361 *
7362 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
7363 */
7364const gchar *
7365sensor_i2c_get_dev_path (SensorI2c *object)
7366{
7367 return SENSOR_I2C_GET_IFACE (object)->get_dev_path (object);
7368}
7369
7370/**
7371 * sensor_i2c_dup_dev_path: (skip)
7372 * @object: A #SensorI2c.
7373 *
7374 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link> D-Bus property.
7375 *
7376 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
7377 *
7378 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
7379 */
7380gchar *
7381sensor_i2c_dup_dev_path (SensorI2c *object)
7382{
7383 gchar *value;
7384 g_object_get (G_OBJECT (object), "dev-path", &value, NULL);
7385 return value;
7386}
7387
7388/**
7389 * sensor_i2c_set_dev_path: (skip)
7390 * @object: A #SensorI2c.
7391 * @value: The value to set.
7392 *
7393 * Sets the <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link> D-Bus property to @value.
7394 *
7395 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
7396 */
7397void
7398sensor_i2c_set_dev_path (SensorI2c *object, const gchar *value)
7399{
7400 g_object_set (G_OBJECT (object), "dev-path", value, NULL);
7401}
7402
7403/**
7404 * sensor_i2c_get_address: (skip)
7405 * @object: A #SensorI2c.
7406 *
7407 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link> D-Bus property.
7408 *
7409 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
7410 *
7411 * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use sensor_i2c_dup_address() if on another thread.</warning>
7412 *
7413 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
7414 */
7415const gchar *
7416sensor_i2c_get_address (SensorI2c *object)
7417{
7418 return SENSOR_I2C_GET_IFACE (object)->get_address (object);
7419}
7420
7421/**
7422 * sensor_i2c_dup_address: (skip)
7423 * @object: A #SensorI2c.
7424 *
7425 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link> D-Bus property.
7426 *
7427 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
7428 *
7429 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
7430 */
7431gchar *
7432sensor_i2c_dup_address (SensorI2c *object)
7433{
7434 gchar *value;
7435 g_object_get (G_OBJECT (object), "address", &value, NULL);
7436 return value;
7437}
7438
7439/**
7440 * sensor_i2c_set_address: (skip)
7441 * @object: A #SensorI2c.
7442 * @value: The value to set.
7443 *
7444 * Sets the <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link> D-Bus property to @value.
7445 *
7446 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
7447 */
7448void
7449sensor_i2c_set_address (SensorI2c *object, const gchar *value)
7450{
7451 g_object_set (G_OBJECT (object), "address", value, NULL);
7452}
7453
7454/* ------------------------------------------------------------------------ */
7455
7456/**
7457 * SensorI2cProxy:
7458 *
7459 * The #SensorI2cProxy structure contains only private data and should only be accessed using the provided API.
7460 */
7461
7462/**
7463 * SensorI2cProxyClass:
7464 * @parent_class: The parent class.
7465 *
7466 * Class structure for #SensorI2cProxy.
7467 */
7468
7469struct _SensorI2cProxyPrivate
7470{
7471 GData *qdata;
7472};
7473
7474static void sensor_i2c_proxy_iface_init (SensorI2cIface *iface);
7475
7476#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
7477G_DEFINE_TYPE_WITH_CODE (SensorI2cProxy, sensor_i2c_proxy, G_TYPE_DBUS_PROXY,
7478 G_ADD_PRIVATE (SensorI2cProxy)
7479 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_proxy_iface_init));
7480
7481#else
7482G_DEFINE_TYPE_WITH_CODE (SensorI2cProxy, sensor_i2c_proxy, G_TYPE_DBUS_PROXY,
7483 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_proxy_iface_init));
7484
7485#endif
7486static void
7487sensor_i2c_proxy_finalize (GObject *object)
7488{
7489 SensorI2cProxy *proxy = SENSOR_I2C_PROXY (object);
7490 g_datalist_clear (&proxy->priv->qdata);
7491 G_OBJECT_CLASS (sensor_i2c_proxy_parent_class)->finalize (object);
7492}
7493
7494static void
7495sensor_i2c_proxy_get_property (GObject *object,
7496 guint prop_id,
7497 GValue *value,
7498 GParamSpec *pspec G_GNUC_UNUSED)
7499{
7500 const _ExtendedGDBusPropertyInfo *info;
7501 GVariant *variant;
7502 g_assert (prop_id != 0 && prop_id - 1 < 2);
7503 info = _sensor_i2c_property_info_pointers[prop_id - 1];
7504 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
7505 if (info->use_gvariant)
7506 {
7507 g_value_set_variant (value, variant);
7508 }
7509 else
7510 {
7511 if (variant != NULL)
7512 g_dbus_gvariant_to_gvalue (variant, value);
7513 }
7514 if (variant != NULL)
7515 g_variant_unref (variant);
7516}
7517
7518static void
7519sensor_i2c_proxy_set_property_cb (GDBusProxy *proxy,
7520 GAsyncResult *res,
7521 gpointer user_data)
7522{
7523 const _ExtendedGDBusPropertyInfo *info = user_data;
7524 GError *error;
7525 GVariant *_ret;
7526 error = NULL;
7527 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
7528 if (!_ret)
7529 {
7530 g_warning ("Error setting property '%s' on interface org.openbmc.SensorI2c: %s (%s, %d)",
7531 info->parent_struct.name,
7532 error->message, g_quark_to_string (error->domain), error->code);
7533 g_error_free (error);
7534 }
7535 else
7536 {
7537 g_variant_unref (_ret);
7538 }
7539}
7540
7541static void
7542sensor_i2c_proxy_set_property (GObject *object,
7543 guint prop_id,
7544 const GValue *value,
7545 GParamSpec *pspec G_GNUC_UNUSED)
7546{
7547 const _ExtendedGDBusPropertyInfo *info;
7548 GVariant *variant;
7549 g_assert (prop_id != 0 && prop_id - 1 < 2);
7550 info = _sensor_i2c_property_info_pointers[prop_id - 1];
7551 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
7552 g_dbus_proxy_call (G_DBUS_PROXY (object),
7553 "org.freedesktop.DBus.Properties.Set",
7554 g_variant_new ("(ssv)", "org.openbmc.SensorI2c", info->parent_struct.name, variant),
7555 G_DBUS_CALL_FLAGS_NONE,
7556 -1,
7557 NULL, (GAsyncReadyCallback) sensor_i2c_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
7558 g_variant_unref (variant);
7559}
7560
7561static void
7562sensor_i2c_proxy_g_signal (GDBusProxy *proxy,
7563 const gchar *sender_name G_GNUC_UNUSED,
7564 const gchar *signal_name,
7565 GVariant *parameters)
7566{
7567 _ExtendedGDBusSignalInfo *info;
7568 GVariantIter iter;
7569 GVariant *child;
7570 GValue *paramv;
7571 guint num_params;
7572 guint n;
7573 guint signal_id;
7574 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, signal_name);
7575 if (info == NULL)
7576 return;
7577 num_params = g_variant_n_children (parameters);
7578 paramv = g_new0 (GValue, num_params + 1);
7579 g_value_init (&paramv[0], TYPE_SENSOR_I2C);
7580 g_value_set_object (&paramv[0], proxy);
7581 g_variant_iter_init (&iter, parameters);
7582 n = 1;
7583 while ((child = g_variant_iter_next_value (&iter)) != NULL)
7584 {
7585 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
7586 if (arg_info->use_gvariant)
7587 {
7588 g_value_init (&paramv[n], G_TYPE_VARIANT);
7589 g_value_set_variant (&paramv[n], child);
7590 n++;
7591 }
7592 else
7593 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
7594 g_variant_unref (child);
7595 }
7596 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_I2C);
7597 g_signal_emitv (paramv, signal_id, 0, NULL);
7598 for (n = 0; n < num_params + 1; n++)
7599 g_value_unset (&paramv[n]);
7600 g_free (paramv);
7601}
7602
7603static void
7604sensor_i2c_proxy_g_properties_changed (GDBusProxy *_proxy,
7605 GVariant *changed_properties,
7606 const gchar *const *invalidated_properties)
7607{
7608 SensorI2cProxy *proxy = SENSOR_I2C_PROXY (_proxy);
7609 guint n;
7610 const gchar *key;
7611 GVariantIter *iter;
7612 _ExtendedGDBusPropertyInfo *info;
7613 g_variant_get (changed_properties, "a{sv}", &iter);
7614 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
7615 {
7616 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, key);
7617 g_datalist_remove_data (&proxy->priv->qdata, key);
7618 if (info != NULL)
7619 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
7620 }
7621 g_variant_iter_free (iter);
7622 for (n = 0; invalidated_properties[n] != NULL; n++)
7623 {
7624 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, invalidated_properties[n]);
7625 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
7626 if (info != NULL)
7627 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
7628 }
7629}
7630
7631static const gchar *
7632sensor_i2c_proxy_get_dev_path (SensorI2c *object)
7633{
7634 SensorI2cProxy *proxy = SENSOR_I2C_PROXY (object);
7635 GVariant *variant;
7636 const gchar *value = NULL;
7637 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "dev_path");
7638 if (variant != NULL)
7639 {
7640 value = g_variant_get_string (variant, NULL);
7641 g_variant_unref (variant);
7642 }
7643 return value;
7644}
7645
7646static const gchar *
7647sensor_i2c_proxy_get_address (SensorI2c *object)
7648{
7649 SensorI2cProxy *proxy = SENSOR_I2C_PROXY (object);
7650 GVariant *variant;
7651 const gchar *value = NULL;
7652 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "address");
7653 if (variant != NULL)
7654 {
7655 value = g_variant_get_string (variant, NULL);
7656 g_variant_unref (variant);
7657 }
7658 return value;
7659}
7660
7661static void
7662sensor_i2c_proxy_init (SensorI2cProxy *proxy)
7663{
7664#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
7665 proxy->priv = sensor_i2c_proxy_get_instance_private (proxy);
7666#else
7667 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_I2C_PROXY, SensorI2cProxyPrivate);
7668#endif
7669
7670 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_i2c_interface_info ());
7671}
7672
7673static void
7674sensor_i2c_proxy_class_init (SensorI2cProxyClass *klass)
7675{
7676 GObjectClass *gobject_class;
7677 GDBusProxyClass *proxy_class;
7678
7679 gobject_class = G_OBJECT_CLASS (klass);
7680 gobject_class->finalize = sensor_i2c_proxy_finalize;
7681 gobject_class->get_property = sensor_i2c_proxy_get_property;
7682 gobject_class->set_property = sensor_i2c_proxy_set_property;
7683
7684 proxy_class = G_DBUS_PROXY_CLASS (klass);
7685 proxy_class->g_signal = sensor_i2c_proxy_g_signal;
7686 proxy_class->g_properties_changed = sensor_i2c_proxy_g_properties_changed;
7687
7688 sensor_i2c_override_properties (gobject_class, 1);
7689
7690#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
7691 g_type_class_add_private (klass, sizeof (SensorI2cProxyPrivate));
7692#endif
7693}
7694
7695static void
7696sensor_i2c_proxy_iface_init (SensorI2cIface *iface)
7697{
7698 iface->get_dev_path = sensor_i2c_proxy_get_dev_path;
7699 iface->get_address = sensor_i2c_proxy_get_address;
7700}
7701
7702/**
7703 * sensor_i2c_proxy_new:
7704 * @connection: A #GDBusConnection.
7705 * @flags: Flags from the #GDBusProxyFlags enumeration.
7706 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
7707 * @object_path: An object path.
7708 * @cancellable: (allow-none): A #GCancellable or %NULL.
7709 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
7710 * @user_data: User data to pass to @callback.
7711 *
7712 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>. See g_dbus_proxy_new() for more details.
7713 *
7714 * 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.
7715 * You can then call sensor_i2c_proxy_new_finish() to get the result of the operation.
7716 *
7717 * See sensor_i2c_proxy_new_sync() for the synchronous, blocking version of this constructor.
7718 */
7719void
7720sensor_i2c_proxy_new (
7721 GDBusConnection *connection,
7722 GDBusProxyFlags flags,
7723 const gchar *name,
7724 const gchar *object_path,
7725 GCancellable *cancellable,
7726 GAsyncReadyCallback callback,
7727 gpointer user_data)
7728{
7729 g_async_initable_new_async (TYPE_SENSOR_I2C_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorI2c", NULL);
7730}
7731
7732/**
7733 * sensor_i2c_proxy_new_finish:
7734 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_i2c_proxy_new().
7735 * @error: Return location for error or %NULL
7736 *
7737 * Finishes an operation started with sensor_i2c_proxy_new().
7738 *
7739 * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set.
7740 */
7741SensorI2c *
7742sensor_i2c_proxy_new_finish (
7743 GAsyncResult *res,
7744 GError **error)
7745{
7746 GObject *ret;
7747 GObject *source_object;
7748 source_object = g_async_result_get_source_object (res);
7749 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
7750 g_object_unref (source_object);
7751 if (ret != NULL)
7752 return SENSOR_I2C (ret);
7753 else
7754 return NULL;
7755}
7756
7757/**
7758 * sensor_i2c_proxy_new_sync:
7759 * @connection: A #GDBusConnection.
7760 * @flags: Flags from the #GDBusProxyFlags enumeration.
7761 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
7762 * @object_path: An object path.
7763 * @cancellable: (allow-none): A #GCancellable or %NULL.
7764 * @error: Return location for error or %NULL
7765 *
7766 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>. See g_dbus_proxy_new_sync() for more details.
7767 *
7768 * The calling thread is blocked until a reply is received.
7769 *
7770 * See sensor_i2c_proxy_new() for the asynchronous version of this constructor.
7771 *
7772 * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set.
7773 */
7774SensorI2c *
7775sensor_i2c_proxy_new_sync (
7776 GDBusConnection *connection,
7777 GDBusProxyFlags flags,
7778 const gchar *name,
7779 const gchar *object_path,
7780 GCancellable *cancellable,
7781 GError **error)
7782{
7783 GInitable *ret;
7784 ret = g_initable_new (TYPE_SENSOR_I2C_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorI2c", NULL);
7785 if (ret != NULL)
7786 return SENSOR_I2C (ret);
7787 else
7788 return NULL;
7789}
7790
7791
7792/**
7793 * sensor_i2c_proxy_new_for_bus:
7794 * @bus_type: A #GBusType.
7795 * @flags: Flags from the #GDBusProxyFlags enumeration.
7796 * @name: A bus name (well-known or unique).
7797 * @object_path: An object path.
7798 * @cancellable: (allow-none): A #GCancellable or %NULL.
7799 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
7800 * @user_data: User data to pass to @callback.
7801 *
7802 * Like sensor_i2c_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
7803 *
7804 * 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.
7805 * You can then call sensor_i2c_proxy_new_for_bus_finish() to get the result of the operation.
7806 *
7807 * See sensor_i2c_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
7808 */
7809void
7810sensor_i2c_proxy_new_for_bus (
7811 GBusType bus_type,
7812 GDBusProxyFlags flags,
7813 const gchar *name,
7814 const gchar *object_path,
7815 GCancellable *cancellable,
7816 GAsyncReadyCallback callback,
7817 gpointer user_data)
7818{
7819 g_async_initable_new_async (TYPE_SENSOR_I2C_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorI2c", NULL);
7820}
7821
7822/**
7823 * sensor_i2c_proxy_new_for_bus_finish:
7824 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_i2c_proxy_new_for_bus().
7825 * @error: Return location for error or %NULL
7826 *
7827 * Finishes an operation started with sensor_i2c_proxy_new_for_bus().
7828 *
7829 * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set.
7830 */
7831SensorI2c *
7832sensor_i2c_proxy_new_for_bus_finish (
7833 GAsyncResult *res,
7834 GError **error)
7835{
7836 GObject *ret;
7837 GObject *source_object;
7838 source_object = g_async_result_get_source_object (res);
7839 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
7840 g_object_unref (source_object);
7841 if (ret != NULL)
7842 return SENSOR_I2C (ret);
7843 else
7844 return NULL;
7845}
7846
7847/**
7848 * sensor_i2c_proxy_new_for_bus_sync:
7849 * @bus_type: A #GBusType.
7850 * @flags: Flags from the #GDBusProxyFlags enumeration.
7851 * @name: A bus name (well-known or unique).
7852 * @object_path: An object path.
7853 * @cancellable: (allow-none): A #GCancellable or %NULL.
7854 * @error: Return location for error or %NULL
7855 *
7856 * Like sensor_i2c_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
7857 *
7858 * The calling thread is blocked until a reply is received.
7859 *
7860 * See sensor_i2c_proxy_new_for_bus() for the asynchronous version of this constructor.
7861 *
7862 * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set.
7863 */
7864SensorI2c *
7865sensor_i2c_proxy_new_for_bus_sync (
7866 GBusType bus_type,
7867 GDBusProxyFlags flags,
7868 const gchar *name,
7869 const gchar *object_path,
7870 GCancellable *cancellable,
7871 GError **error)
7872{
7873 GInitable *ret;
7874 ret = g_initable_new (TYPE_SENSOR_I2C_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorI2c", NULL);
7875 if (ret != NULL)
7876 return SENSOR_I2C (ret);
7877 else
7878 return NULL;
7879}
7880
7881
7882/* ------------------------------------------------------------------------ */
7883
7884/**
7885 * SensorI2cSkeleton:
7886 *
7887 * The #SensorI2cSkeleton structure contains only private data and should only be accessed using the provided API.
7888 */
7889
7890/**
7891 * SensorI2cSkeletonClass:
7892 * @parent_class: The parent class.
7893 *
7894 * Class structure for #SensorI2cSkeleton.
7895 */
7896
7897struct _SensorI2cSkeletonPrivate
7898{
7899 GValue *properties;
7900 GList *changed_properties;
7901 GSource *changed_properties_idle_source;
7902 GMainContext *context;
7903 GMutex lock;
7904};
7905
7906static void
7907_sensor_i2c_skeleton_handle_method_call (
7908 GDBusConnection *connection G_GNUC_UNUSED,
7909 const gchar *sender G_GNUC_UNUSED,
7910 const gchar *object_path G_GNUC_UNUSED,
7911 const gchar *interface_name,
7912 const gchar *method_name,
7913 GVariant *parameters,
7914 GDBusMethodInvocation *invocation,
7915 gpointer user_data)
7916{
7917 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data);
7918 _ExtendedGDBusMethodInfo *info;
7919 GVariantIter iter;
7920 GVariant *child;
7921 GValue *paramv;
7922 guint num_params;
7923 guint num_extra;
7924 guint n;
7925 guint signal_id;
7926 GValue return_value = G_VALUE_INIT;
7927 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
7928 g_assert (info != NULL);
7929 num_params = g_variant_n_children (parameters);
7930 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
7931 n = 0;
7932 g_value_init (&paramv[n], TYPE_SENSOR_I2C);
7933 g_value_set_object (&paramv[n++], skeleton);
7934 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
7935 g_value_set_object (&paramv[n++], invocation);
7936 if (info->pass_fdlist)
7937 {
7938#ifdef G_OS_UNIX
7939 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
7940 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
7941#else
7942 g_assert_not_reached ();
7943#endif
7944 }
7945 g_variant_iter_init (&iter, parameters);
7946 while ((child = g_variant_iter_next_value (&iter)) != NULL)
7947 {
7948 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
7949 if (arg_info->use_gvariant)
7950 {
7951 g_value_init (&paramv[n], G_TYPE_VARIANT);
7952 g_value_set_variant (&paramv[n], child);
7953 n++;
7954 }
7955 else
7956 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
7957 g_variant_unref (child);
7958 }
7959 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_I2C);
7960 g_value_init (&return_value, G_TYPE_BOOLEAN);
7961 g_signal_emitv (paramv, signal_id, 0, &return_value);
7962 if (!g_value_get_boolean (&return_value))
7963 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);
7964 g_value_unset (&return_value);
7965 for (n = 0; n < num_params + num_extra; n++)
7966 g_value_unset (&paramv[n]);
7967 g_free (paramv);
7968}
7969
7970static GVariant *
7971_sensor_i2c_skeleton_handle_get_property (
7972 GDBusConnection *connection G_GNUC_UNUSED,
7973 const gchar *sender G_GNUC_UNUSED,
7974 const gchar *object_path G_GNUC_UNUSED,
7975 const gchar *interface_name G_GNUC_UNUSED,
7976 const gchar *property_name,
7977 GError **error,
7978 gpointer user_data)
7979{
7980 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data);
7981 GValue value = G_VALUE_INIT;
7982 GParamSpec *pspec;
7983 _ExtendedGDBusPropertyInfo *info;
7984 GVariant *ret;
7985 ret = NULL;
7986 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, property_name);
7987 g_assert (info != NULL);
7988 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
7989 if (pspec == NULL)
7990 {
7991 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
7992 }
7993 else
7994 {
7995 g_value_init (&value, pspec->value_type);
7996 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
7997 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
7998 g_value_unset (&value);
7999 }
8000 return ret;
8001}
8002
8003static gboolean
8004_sensor_i2c_skeleton_handle_set_property (
8005 GDBusConnection *connection G_GNUC_UNUSED,
8006 const gchar *sender G_GNUC_UNUSED,
8007 const gchar *object_path G_GNUC_UNUSED,
8008 const gchar *interface_name G_GNUC_UNUSED,
8009 const gchar *property_name,
8010 GVariant *variant,
8011 GError **error,
8012 gpointer user_data)
8013{
8014 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data);
8015 GValue value = G_VALUE_INIT;
8016 GParamSpec *pspec;
8017 _ExtendedGDBusPropertyInfo *info;
8018 gboolean ret;
8019 ret = FALSE;
8020 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, property_name);
8021 g_assert (info != NULL);
8022 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
8023 if (pspec == NULL)
8024 {
8025 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
8026 }
8027 else
8028 {
8029 if (info->use_gvariant)
8030 g_value_set_variant (&value, variant);
8031 else
8032 g_dbus_gvariant_to_gvalue (variant, &value);
8033 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
8034 g_value_unset (&value);
8035 ret = TRUE;
8036 }
8037 return ret;
8038}
8039
8040static const GDBusInterfaceVTable _sensor_i2c_skeleton_vtable =
8041{
8042 _sensor_i2c_skeleton_handle_method_call,
8043 _sensor_i2c_skeleton_handle_get_property,
8044 _sensor_i2c_skeleton_handle_set_property,
8045 {NULL}
8046};
8047
8048static GDBusInterfaceInfo *
8049sensor_i2c_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
8050{
8051 return sensor_i2c_interface_info ();
8052}
8053
8054static GDBusInterfaceVTable *
8055sensor_i2c_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
8056{
8057 return (GDBusInterfaceVTable *) &_sensor_i2c_skeleton_vtable;
8058}
8059
8060static GVariant *
8061sensor_i2c_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
8062{
8063 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (_skeleton);
8064
8065 GVariantBuilder builder;
8066 guint n;
8067 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
8068 if (_sensor_i2c_interface_info.parent_struct.properties == NULL)
8069 goto out;
8070 for (n = 0; _sensor_i2c_interface_info.parent_struct.properties[n] != NULL; n++)
8071 {
8072 GDBusPropertyInfo *info = _sensor_i2c_interface_info.parent_struct.properties[n];
8073 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
8074 {
8075 GVariant *value;
8076 value = _sensor_i2c_skeleton_handle_get_property (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorI2c", info->name, NULL, skeleton);
8077 if (value != NULL)
8078 {
8079 g_variant_take_ref (value);
8080 g_variant_builder_add (&builder, "{sv}", info->name, value);
8081 g_variant_unref (value);
8082 }
8083 }
8084 }
8085out:
8086 return g_variant_builder_end (&builder);
8087}
8088
8089static gboolean _sensor_i2c_emit_changed (gpointer user_data);
8090
8091static void
8092sensor_i2c_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
8093{
8094 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (_skeleton);
8095 gboolean emit_changed = FALSE;
8096
8097 g_mutex_lock (&skeleton->priv->lock);
8098 if (skeleton->priv->changed_properties_idle_source != NULL)
8099 {
8100 g_source_destroy (skeleton->priv->changed_properties_idle_source);
8101 skeleton->priv->changed_properties_idle_source = NULL;
8102 emit_changed = TRUE;
8103 }
8104 g_mutex_unlock (&skeleton->priv->lock);
8105
8106 if (emit_changed)
8107 _sensor_i2c_emit_changed (skeleton);
8108}
8109
8110static void sensor_i2c_skeleton_iface_init (SensorI2cIface *iface);
8111#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
8112G_DEFINE_TYPE_WITH_CODE (SensorI2cSkeleton, sensor_i2c_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
8113 G_ADD_PRIVATE (SensorI2cSkeleton)
8114 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_skeleton_iface_init));
8115
8116#else
8117G_DEFINE_TYPE_WITH_CODE (SensorI2cSkeleton, sensor_i2c_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
8118 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_skeleton_iface_init));
8119
8120#endif
8121static void
8122sensor_i2c_skeleton_finalize (GObject *object)
8123{
8124 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
8125 guint n;
8126 for (n = 0; n < 2; n++)
8127 g_value_unset (&skeleton->priv->properties[n]);
8128 g_free (skeleton->priv->properties);
8129 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
8130 if (skeleton->priv->changed_properties_idle_source != NULL)
8131 g_source_destroy (skeleton->priv->changed_properties_idle_source);
8132 g_main_context_unref (skeleton->priv->context);
8133 g_mutex_clear (&skeleton->priv->lock);
8134 G_OBJECT_CLASS (sensor_i2c_skeleton_parent_class)->finalize (object);
8135}
8136
8137static void
8138sensor_i2c_skeleton_get_property (GObject *object,
8139 guint prop_id,
8140 GValue *value,
8141 GParamSpec *pspec G_GNUC_UNUSED)
8142{
8143 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
8144 g_assert (prop_id != 0 && prop_id - 1 < 2);
8145 g_mutex_lock (&skeleton->priv->lock);
8146 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
8147 g_mutex_unlock (&skeleton->priv->lock);
8148}
8149
8150static gboolean
8151_sensor_i2c_emit_changed (gpointer user_data)
8152{
8153 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data);
8154 GList *l;
8155 GVariantBuilder builder;
8156 GVariantBuilder invalidated_builder;
8157 guint num_changes;
8158
8159 g_mutex_lock (&skeleton->priv->lock);
8160 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
8161 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
8162 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
8163 {
8164 ChangedProperty *cp = l->data;
8165 GVariant *variant;
8166 const GValue *cur_value;
8167
8168 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
8169 if (!_g_value_equal (cur_value, &cp->orig_value))
8170 {
8171 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
8172 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
8173 g_variant_unref (variant);
8174 num_changes++;
8175 }
8176 }
8177 if (num_changes > 0)
8178 {
8179 GList *connections, *ll;
8180 GVariant *signal_variant;
8181 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorI2c",
8182 &builder, &invalidated_builder));
8183 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
8184 for (ll = connections; ll != NULL; ll = ll->next)
8185 {
8186 GDBusConnection *connection = ll->data;
8187
8188 g_dbus_connection_emit_signal (connection,
8189 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
8190 "org.freedesktop.DBus.Properties",
8191 "PropertiesChanged",
8192 signal_variant,
8193 NULL);
8194 }
8195 g_variant_unref (signal_variant);
8196 g_list_free_full (connections, g_object_unref);
8197 }
8198 else
8199 {
8200 g_variant_builder_clear (&builder);
8201 g_variant_builder_clear (&invalidated_builder);
8202 }
8203 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
8204 skeleton->priv->changed_properties = NULL;
8205 skeleton->priv->changed_properties_idle_source = NULL;
8206 g_mutex_unlock (&skeleton->priv->lock);
8207 return FALSE;
8208}
8209
8210static void
8211_sensor_i2c_schedule_emit_changed (SensorI2cSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
8212{
8213 ChangedProperty *cp;
8214 GList *l;
8215 cp = NULL;
8216 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
8217 {
8218 ChangedProperty *i_cp = l->data;
8219 if (i_cp->info == info)
8220 {
8221 cp = i_cp;
8222 break;
8223 }
8224 }
8225 if (cp == NULL)
8226 {
8227 cp = g_new0 (ChangedProperty, 1);
8228 cp->prop_id = prop_id;
8229 cp->info = info;
8230 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
8231 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
8232 g_value_copy (orig_value, &cp->orig_value);
8233 }
8234}
8235
8236static void
8237sensor_i2c_skeleton_notify (GObject *object,
8238 GParamSpec *pspec G_GNUC_UNUSED)
8239{
8240 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
8241 g_mutex_lock (&skeleton->priv->lock);
8242 if (skeleton->priv->changed_properties != NULL &&
8243 skeleton->priv->changed_properties_idle_source == NULL)
8244 {
8245 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
8246 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
8247 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_i2c_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
Adriana Kobylakfd778822016-06-16 09:08:37 -05008248 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _sensor_i2c_emit_changed");
Norman James362a80f2015-09-14 14:04:39 -05008249 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
8250 g_source_unref (skeleton->priv->changed_properties_idle_source);
8251 }
8252 g_mutex_unlock (&skeleton->priv->lock);
8253}
8254
8255static void
8256sensor_i2c_skeleton_set_property (GObject *object,
8257 guint prop_id,
8258 const GValue *value,
8259 GParamSpec *pspec)
8260{
8261 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
8262 g_assert (prop_id != 0 && prop_id - 1 < 2);
8263 g_mutex_lock (&skeleton->priv->lock);
8264 g_object_freeze_notify (object);
8265 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
8266 {
8267 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
8268 _sensor_i2c_schedule_emit_changed (skeleton, _sensor_i2c_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
8269 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
8270 g_object_notify_by_pspec (object, pspec);
8271 }
8272 g_mutex_unlock (&skeleton->priv->lock);
8273 g_object_thaw_notify (object);
8274}
8275
8276static void
8277sensor_i2c_skeleton_init (SensorI2cSkeleton *skeleton)
8278{
8279#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
8280 skeleton->priv = sensor_i2c_skeleton_get_instance_private (skeleton);
8281#else
8282 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_I2C_SKELETON, SensorI2cSkeletonPrivate);
8283#endif
8284
8285 g_mutex_init (&skeleton->priv->lock);
8286 skeleton->priv->context = g_main_context_ref_thread_default ();
8287 skeleton->priv->properties = g_new0 (GValue, 2);
8288 g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING);
8289 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
8290}
8291
8292static const gchar *
8293sensor_i2c_skeleton_get_dev_path (SensorI2c *object)
8294{
8295 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
8296 const gchar *value;
8297 g_mutex_lock (&skeleton->priv->lock);
8298 value = g_value_get_string (&(skeleton->priv->properties[0]));
8299 g_mutex_unlock (&skeleton->priv->lock);
8300 return value;
8301}
8302
8303static const gchar *
8304sensor_i2c_skeleton_get_address (SensorI2c *object)
8305{
8306 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
8307 const gchar *value;
8308 g_mutex_lock (&skeleton->priv->lock);
8309 value = g_value_get_string (&(skeleton->priv->properties[1]));
8310 g_mutex_unlock (&skeleton->priv->lock);
8311 return value;
8312}
8313
8314static void
8315sensor_i2c_skeleton_class_init (SensorI2cSkeletonClass *klass)
8316{
8317 GObjectClass *gobject_class;
8318 GDBusInterfaceSkeletonClass *skeleton_class;
8319
8320 gobject_class = G_OBJECT_CLASS (klass);
8321 gobject_class->finalize = sensor_i2c_skeleton_finalize;
8322 gobject_class->get_property = sensor_i2c_skeleton_get_property;
8323 gobject_class->set_property = sensor_i2c_skeleton_set_property;
8324 gobject_class->notify = sensor_i2c_skeleton_notify;
8325
8326
8327 sensor_i2c_override_properties (gobject_class, 1);
8328
8329 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
8330 skeleton_class->get_info = sensor_i2c_skeleton_dbus_interface_get_info;
8331 skeleton_class->get_properties = sensor_i2c_skeleton_dbus_interface_get_properties;
8332 skeleton_class->flush = sensor_i2c_skeleton_dbus_interface_flush;
8333 skeleton_class->get_vtable = sensor_i2c_skeleton_dbus_interface_get_vtable;
8334
8335#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
8336 g_type_class_add_private (klass, sizeof (SensorI2cSkeletonPrivate));
8337#endif
8338}
8339
8340static void
8341sensor_i2c_skeleton_iface_init (SensorI2cIface *iface)
8342{
8343 iface->get_dev_path = sensor_i2c_skeleton_get_dev_path;
8344 iface->get_address = sensor_i2c_skeleton_get_address;
8345}
8346
8347/**
8348 * sensor_i2c_skeleton_new:
8349 *
8350 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>.
8351 *
8352 * Returns: (transfer full) (type SensorI2cSkeleton): The skeleton object.
8353 */
8354SensorI2c *
8355sensor_i2c_skeleton_new (void)
8356{
8357 return SENSOR_I2C (g_object_new (TYPE_SENSOR_I2C_SKELETON, NULL));
8358}
8359
8360/* ------------------------------------------------------------------------
8361 * Code for interface org.openbmc.SensorMatch
8362 * ------------------------------------------------------------------------
8363 */
8364
8365/**
8366 * SECTION:SensorMatch
8367 * @title: SensorMatch
8368 * @short_description: Generated C code for the org.openbmc.SensorMatch D-Bus interface
8369 *
8370 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link> D-Bus interface in C.
8371 */
8372
8373/* ---- Introspection data for org.openbmc.SensorMatch ---- */
8374
8375static const _ExtendedGDBusArgInfo _sensor_match_signal_info_sensor_match_ARG_state =
8376{
8377 {
8378 -1,
8379 (gchar *) "state",
8380 (gchar *) "y",
8381 NULL
8382 },
8383 FALSE
8384};
8385
8386static const _ExtendedGDBusArgInfo * const _sensor_match_signal_info_sensor_match_ARG_pointers[] =
8387{
8388 &_sensor_match_signal_info_sensor_match_ARG_state,
8389 NULL
8390};
8391
8392static const _ExtendedGDBusSignalInfo _sensor_match_signal_info_sensor_match =
8393{
8394 {
8395 -1,
8396 (gchar *) "SensorMatch",
8397 (GDBusArgInfo **) &_sensor_match_signal_info_sensor_match_ARG_pointers,
8398 NULL
8399 },
8400 "sensor-match"
8401};
8402
8403static const _ExtendedGDBusSignalInfo * const _sensor_match_signal_info_pointers[] =
8404{
8405 &_sensor_match_signal_info_sensor_match,
8406 NULL
8407};
8408
8409static const _ExtendedGDBusPropertyInfo _sensor_match_property_info_match_value =
8410{
8411 {
8412 -1,
8413 (gchar *) "match_value",
8414 (gchar *) "v",
8415 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
8416 NULL
8417 },
8418 "match-value",
8419 FALSE
8420};
8421
8422static const _ExtendedGDBusPropertyInfo _sensor_match_property_info_state =
8423{
8424 {
8425 -1,
8426 (gchar *) "state",
8427 (gchar *) "y",
8428 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
8429 NULL
8430 },
8431 "state",
8432 FALSE
8433};
8434
8435static const _ExtendedGDBusPropertyInfo * const _sensor_match_property_info_pointers[] =
8436{
8437 &_sensor_match_property_info_match_value,
8438 &_sensor_match_property_info_state,
8439 NULL
8440};
8441
8442static const _ExtendedGDBusInterfaceInfo _sensor_match_interface_info =
8443{
8444 {
8445 -1,
8446 (gchar *) "org.openbmc.SensorMatch",
8447 NULL,
8448 (GDBusSignalInfo **) &_sensor_match_signal_info_pointers,
8449 (GDBusPropertyInfo **) &_sensor_match_property_info_pointers,
8450 NULL
8451 },
8452 "sensor-match",
8453};
8454
8455
8456/**
8457 * sensor_match_interface_info:
8458 *
8459 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link> D-Bus interface.
8460 *
8461 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
8462 */
8463GDBusInterfaceInfo *
8464sensor_match_interface_info (void)
8465{
8466 return (GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct;
8467}
8468
8469/**
8470 * sensor_match_override_properties:
8471 * @klass: The class structure for a #GObject<!-- -->-derived class.
8472 * @property_id_begin: The property id to assign to the first overridden property.
8473 *
8474 * Overrides all #GObject properties in the #SensorMatch interface for a concrete class.
8475 * The properties are overridden in the order they are defined.
8476 *
8477 * Returns: The last property id.
8478 */
8479guint
8480sensor_match_override_properties (GObjectClass *klass, guint property_id_begin)
8481{
8482 g_object_class_override_property (klass, property_id_begin++, "match-value");
8483 g_object_class_override_property (klass, property_id_begin++, "state");
8484 return property_id_begin - 1;
8485}
8486
8487
8488
8489/**
8490 * SensorMatch:
8491 *
8492 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>.
8493 */
8494
8495/**
8496 * SensorMatchIface:
8497 * @parent_iface: The parent interface.
8498 * @get_match_value: Getter for the #SensorMatch:match-value property.
8499 * @get_state: Getter for the #SensorMatch:state property.
8500 * @sensor_match: Handler for the #SensorMatch::sensor-match signal.
8501 *
8502 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>.
8503 */
8504
8505typedef SensorMatchIface SensorMatchInterface;
8506G_DEFINE_INTERFACE (SensorMatch, sensor_match, G_TYPE_OBJECT);
8507
8508static void
8509sensor_match_default_init (SensorMatchIface *iface)
8510{
8511 /* GObject signals for received D-Bus signals: */
8512 /**
8513 * SensorMatch::sensor-match:
8514 * @object: A #SensorMatch.
8515 * @arg_state: Argument.
8516 *
8517 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-SensorMatch.SensorMatch">"SensorMatch"</link> is received.
8518 *
8519 * 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.
8520 */
8521 g_signal_new ("sensor-match",
8522 G_TYPE_FROM_INTERFACE (iface),
8523 G_SIGNAL_RUN_LAST,
8524 G_STRUCT_OFFSET (SensorMatchIface, sensor_match),
8525 NULL,
8526 NULL,
8527 g_cclosure_marshal_generic,
8528 G_TYPE_NONE,
8529 1, G_TYPE_UCHAR);
8530
8531 /* GObject properties for D-Bus properties: */
8532 /**
8533 * SensorMatch:match-value:
8534 *
8535 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link>.
8536 *
8537 * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.
8538 */
8539 g_object_interface_install_property (iface,
8540 g_param_spec_variant ("match-value", "match_value", "match_value", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
8541 /**
8542 * SensorMatch:state:
8543 *
8544 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorMatch.state">"state"</link>.
8545 *
8546 * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.
8547 */
8548 g_object_interface_install_property (iface,
8549 g_param_spec_uchar ("state", "state", "state", 0, 255, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
8550}
8551
8552/**
8553 * sensor_match_get_match_value: (skip)
8554 * @object: A #SensorMatch.
8555 *
8556 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link> D-Bus property.
8557 *
8558 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
8559 *
8560 * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use sensor_match_dup_match_value() if on another thread.</warning>
8561 *
8562 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
8563 */
8564GVariant *
8565sensor_match_get_match_value (SensorMatch *object)
8566{
8567 return SENSOR_MATCH_GET_IFACE (object)->get_match_value (object);
8568}
8569
8570/**
8571 * sensor_match_dup_match_value: (skip)
8572 * @object: A #SensorMatch.
8573 *
8574 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link> D-Bus property.
8575 *
8576 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
8577 *
8578 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
8579 */
8580GVariant *
8581sensor_match_dup_match_value (SensorMatch *object)
8582{
8583 GVariant *value;
8584 g_object_get (G_OBJECT (object), "match-value", &value, NULL);
8585 return value;
8586}
8587
8588/**
8589 * sensor_match_set_match_value: (skip)
8590 * @object: A #SensorMatch.
8591 * @value: The value to set.
8592 *
8593 * Sets the <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link> D-Bus property to @value.
8594 *
8595 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
8596 */
8597void
8598sensor_match_set_match_value (SensorMatch *object, GVariant *value)
8599{
8600 g_object_set (G_OBJECT (object), "match-value", value, NULL);
8601}
8602
8603/**
8604 * sensor_match_get_state: (skip)
8605 * @object: A #SensorMatch.
8606 *
8607 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorMatch.state">"state"</link> D-Bus property.
8608 *
8609 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
8610 *
8611 * Returns: The property value.
8612 */
8613guchar
8614sensor_match_get_state (SensorMatch *object)
8615{
8616 return SENSOR_MATCH_GET_IFACE (object)->get_state (object);
8617}
8618
8619/**
8620 * sensor_match_set_state: (skip)
8621 * @object: A #SensorMatch.
8622 * @value: The value to set.
8623 *
8624 * Sets the <link linkend="gdbus-property-org-openbmc-SensorMatch.state">"state"</link> D-Bus property to @value.
8625 *
8626 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
8627 */
8628void
8629sensor_match_set_state (SensorMatch *object, guchar value)
8630{
8631 g_object_set (G_OBJECT (object), "state", value, NULL);
8632}
8633
8634/**
8635 * sensor_match_emit_sensor_match:
8636 * @object: A #SensorMatch.
8637 * @arg_state: Argument to pass with the signal.
8638 *
8639 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorMatch.SensorMatch">"SensorMatch"</link> D-Bus signal.
8640 */
8641void
8642sensor_match_emit_sensor_match (
8643 SensorMatch *object,
8644 guchar arg_state)
8645{
8646 g_signal_emit_by_name (object, "sensor-match", arg_state);
8647}
8648
8649/* ------------------------------------------------------------------------ */
8650
8651/**
8652 * SensorMatchProxy:
8653 *
8654 * The #SensorMatchProxy structure contains only private data and should only be accessed using the provided API.
8655 */
8656
8657/**
8658 * SensorMatchProxyClass:
8659 * @parent_class: The parent class.
8660 *
8661 * Class structure for #SensorMatchProxy.
8662 */
8663
8664struct _SensorMatchProxyPrivate
8665{
8666 GData *qdata;
8667};
8668
8669static void sensor_match_proxy_iface_init (SensorMatchIface *iface);
8670
8671#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
8672G_DEFINE_TYPE_WITH_CODE (SensorMatchProxy, sensor_match_proxy, G_TYPE_DBUS_PROXY,
8673 G_ADD_PRIVATE (SensorMatchProxy)
8674 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_proxy_iface_init));
8675
8676#else
8677G_DEFINE_TYPE_WITH_CODE (SensorMatchProxy, sensor_match_proxy, G_TYPE_DBUS_PROXY,
8678 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_proxy_iface_init));
8679
8680#endif
8681static void
8682sensor_match_proxy_finalize (GObject *object)
8683{
8684 SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (object);
8685 g_datalist_clear (&proxy->priv->qdata);
8686 G_OBJECT_CLASS (sensor_match_proxy_parent_class)->finalize (object);
8687}
8688
8689static void
8690sensor_match_proxy_get_property (GObject *object,
8691 guint prop_id,
8692 GValue *value,
8693 GParamSpec *pspec G_GNUC_UNUSED)
8694{
8695 const _ExtendedGDBusPropertyInfo *info;
8696 GVariant *variant;
8697 g_assert (prop_id != 0 && prop_id - 1 < 2);
8698 info = _sensor_match_property_info_pointers[prop_id - 1];
8699 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
8700 if (info->use_gvariant)
8701 {
8702 g_value_set_variant (value, variant);
8703 }
8704 else
8705 {
8706 if (variant != NULL)
8707 g_dbus_gvariant_to_gvalue (variant, value);
8708 }
8709 if (variant != NULL)
8710 g_variant_unref (variant);
8711}
8712
8713static void
8714sensor_match_proxy_set_property_cb (GDBusProxy *proxy,
8715 GAsyncResult *res,
8716 gpointer user_data)
8717{
8718 const _ExtendedGDBusPropertyInfo *info = user_data;
8719 GError *error;
8720 GVariant *_ret;
8721 error = NULL;
8722 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
8723 if (!_ret)
8724 {
8725 g_warning ("Error setting property '%s' on interface org.openbmc.SensorMatch: %s (%s, %d)",
8726 info->parent_struct.name,
8727 error->message, g_quark_to_string (error->domain), error->code);
8728 g_error_free (error);
8729 }
8730 else
8731 {
8732 g_variant_unref (_ret);
8733 }
8734}
8735
8736static void
8737sensor_match_proxy_set_property (GObject *object,
8738 guint prop_id,
8739 const GValue *value,
8740 GParamSpec *pspec G_GNUC_UNUSED)
8741{
8742 const _ExtendedGDBusPropertyInfo *info;
8743 GVariant *variant;
8744 g_assert (prop_id != 0 && prop_id - 1 < 2);
8745 info = _sensor_match_property_info_pointers[prop_id - 1];
8746 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
8747 g_dbus_proxy_call (G_DBUS_PROXY (object),
8748 "org.freedesktop.DBus.Properties.Set",
8749 g_variant_new ("(ssv)", "org.openbmc.SensorMatch", info->parent_struct.name, variant),
8750 G_DBUS_CALL_FLAGS_NONE,
8751 -1,
8752 NULL, (GAsyncReadyCallback) sensor_match_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
8753 g_variant_unref (variant);
8754}
8755
8756static void
8757sensor_match_proxy_g_signal (GDBusProxy *proxy,
8758 const gchar *sender_name G_GNUC_UNUSED,
8759 const gchar *signal_name,
8760 GVariant *parameters)
8761{
8762 _ExtendedGDBusSignalInfo *info;
8763 GVariantIter iter;
8764 GVariant *child;
8765 GValue *paramv;
8766 guint num_params;
8767 guint n;
8768 guint signal_id;
8769 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, signal_name);
8770 if (info == NULL)
8771 return;
8772 num_params = g_variant_n_children (parameters);
8773 paramv = g_new0 (GValue, num_params + 1);
8774 g_value_init (&paramv[0], TYPE_SENSOR_MATCH);
8775 g_value_set_object (&paramv[0], proxy);
8776 g_variant_iter_init (&iter, parameters);
8777 n = 1;
8778 while ((child = g_variant_iter_next_value (&iter)) != NULL)
8779 {
8780 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
8781 if (arg_info->use_gvariant)
8782 {
8783 g_value_init (&paramv[n], G_TYPE_VARIANT);
8784 g_value_set_variant (&paramv[n], child);
8785 n++;
8786 }
8787 else
8788 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
8789 g_variant_unref (child);
8790 }
8791 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_MATCH);
8792 g_signal_emitv (paramv, signal_id, 0, NULL);
8793 for (n = 0; n < num_params + 1; n++)
8794 g_value_unset (&paramv[n]);
8795 g_free (paramv);
8796}
8797
8798static void
8799sensor_match_proxy_g_properties_changed (GDBusProxy *_proxy,
8800 GVariant *changed_properties,
8801 const gchar *const *invalidated_properties)
8802{
8803 SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (_proxy);
8804 guint n;
8805 const gchar *key;
8806 GVariantIter *iter;
8807 _ExtendedGDBusPropertyInfo *info;
8808 g_variant_get (changed_properties, "a{sv}", &iter);
8809 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
8810 {
8811 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, key);
8812 g_datalist_remove_data (&proxy->priv->qdata, key);
8813 if (info != NULL)
8814 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
8815 }
8816 g_variant_iter_free (iter);
8817 for (n = 0; invalidated_properties[n] != NULL; n++)
8818 {
8819 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, invalidated_properties[n]);
8820 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
8821 if (info != NULL)
8822 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
8823 }
8824}
8825
8826static GVariant *
8827sensor_match_proxy_get_match_value (SensorMatch *object)
8828{
8829 SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (object);
8830 GVariant *variant;
8831 GVariant *value = NULL;
8832 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "match_value");
8833 value = variant;
8834 if (variant != NULL)
8835 g_variant_unref (variant);
8836 return value;
8837}
8838
8839static guchar
8840sensor_match_proxy_get_state (SensorMatch *object)
8841{
8842 SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (object);
8843 GVariant *variant;
8844 guchar value = 0;
8845 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state");
8846 if (variant != NULL)
8847 {
8848 value = g_variant_get_byte (variant);
8849 g_variant_unref (variant);
8850 }
8851 return value;
8852}
8853
8854static void
8855sensor_match_proxy_init (SensorMatchProxy *proxy)
8856{
8857#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
8858 proxy->priv = sensor_match_proxy_get_instance_private (proxy);
8859#else
8860 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_MATCH_PROXY, SensorMatchProxyPrivate);
8861#endif
8862
8863 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_match_interface_info ());
8864}
8865
8866static void
8867sensor_match_proxy_class_init (SensorMatchProxyClass *klass)
8868{
8869 GObjectClass *gobject_class;
8870 GDBusProxyClass *proxy_class;
8871
8872 gobject_class = G_OBJECT_CLASS (klass);
8873 gobject_class->finalize = sensor_match_proxy_finalize;
8874 gobject_class->get_property = sensor_match_proxy_get_property;
8875 gobject_class->set_property = sensor_match_proxy_set_property;
8876
8877 proxy_class = G_DBUS_PROXY_CLASS (klass);
8878 proxy_class->g_signal = sensor_match_proxy_g_signal;
8879 proxy_class->g_properties_changed = sensor_match_proxy_g_properties_changed;
8880
8881 sensor_match_override_properties (gobject_class, 1);
8882
8883#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
8884 g_type_class_add_private (klass, sizeof (SensorMatchProxyPrivate));
8885#endif
8886}
8887
8888static void
8889sensor_match_proxy_iface_init (SensorMatchIface *iface)
8890{
8891 iface->get_match_value = sensor_match_proxy_get_match_value;
8892 iface->get_state = sensor_match_proxy_get_state;
8893}
8894
8895/**
8896 * sensor_match_proxy_new:
8897 * @connection: A #GDBusConnection.
8898 * @flags: Flags from the #GDBusProxyFlags enumeration.
8899 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
8900 * @object_path: An object path.
8901 * @cancellable: (allow-none): A #GCancellable or %NULL.
8902 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
8903 * @user_data: User data to pass to @callback.
8904 *
8905 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>. See g_dbus_proxy_new() for more details.
8906 *
8907 * 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.
8908 * You can then call sensor_match_proxy_new_finish() to get the result of the operation.
8909 *
8910 * See sensor_match_proxy_new_sync() for the synchronous, blocking version of this constructor.
8911 */
8912void
8913sensor_match_proxy_new (
8914 GDBusConnection *connection,
8915 GDBusProxyFlags flags,
8916 const gchar *name,
8917 const gchar *object_path,
8918 GCancellable *cancellable,
8919 GAsyncReadyCallback callback,
8920 gpointer user_data)
8921{
8922 g_async_initable_new_async (TYPE_SENSOR_MATCH_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorMatch", NULL);
8923}
8924
8925/**
8926 * sensor_match_proxy_new_finish:
8927 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_match_proxy_new().
8928 * @error: Return location for error or %NULL
8929 *
8930 * Finishes an operation started with sensor_match_proxy_new().
8931 *
8932 * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set.
8933 */
8934SensorMatch *
8935sensor_match_proxy_new_finish (
8936 GAsyncResult *res,
8937 GError **error)
8938{
8939 GObject *ret;
8940 GObject *source_object;
8941 source_object = g_async_result_get_source_object (res);
8942 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
8943 g_object_unref (source_object);
8944 if (ret != NULL)
8945 return SENSOR_MATCH (ret);
8946 else
8947 return NULL;
8948}
8949
8950/**
8951 * sensor_match_proxy_new_sync:
8952 * @connection: A #GDBusConnection.
8953 * @flags: Flags from the #GDBusProxyFlags enumeration.
8954 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
8955 * @object_path: An object path.
8956 * @cancellable: (allow-none): A #GCancellable or %NULL.
8957 * @error: Return location for error or %NULL
8958 *
8959 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>. See g_dbus_proxy_new_sync() for more details.
8960 *
8961 * The calling thread is blocked until a reply is received.
8962 *
8963 * See sensor_match_proxy_new() for the asynchronous version of this constructor.
8964 *
8965 * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set.
8966 */
8967SensorMatch *
8968sensor_match_proxy_new_sync (
8969 GDBusConnection *connection,
8970 GDBusProxyFlags flags,
8971 const gchar *name,
8972 const gchar *object_path,
8973 GCancellable *cancellable,
8974 GError **error)
8975{
8976 GInitable *ret;
8977 ret = g_initable_new (TYPE_SENSOR_MATCH_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorMatch", NULL);
8978 if (ret != NULL)
8979 return SENSOR_MATCH (ret);
8980 else
8981 return NULL;
8982}
8983
8984
8985/**
8986 * sensor_match_proxy_new_for_bus:
8987 * @bus_type: A #GBusType.
8988 * @flags: Flags from the #GDBusProxyFlags enumeration.
8989 * @name: A bus name (well-known or unique).
8990 * @object_path: An object path.
8991 * @cancellable: (allow-none): A #GCancellable or %NULL.
8992 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
8993 * @user_data: User data to pass to @callback.
8994 *
8995 * Like sensor_match_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
8996 *
8997 * 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.
8998 * You can then call sensor_match_proxy_new_for_bus_finish() to get the result of the operation.
8999 *
9000 * See sensor_match_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
9001 */
9002void
9003sensor_match_proxy_new_for_bus (
9004 GBusType bus_type,
9005 GDBusProxyFlags flags,
9006 const gchar *name,
9007 const gchar *object_path,
9008 GCancellable *cancellable,
9009 GAsyncReadyCallback callback,
9010 gpointer user_data)
9011{
9012 g_async_initable_new_async (TYPE_SENSOR_MATCH_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorMatch", NULL);
9013}
9014
9015/**
9016 * sensor_match_proxy_new_for_bus_finish:
9017 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_match_proxy_new_for_bus().
9018 * @error: Return location for error or %NULL
9019 *
9020 * Finishes an operation started with sensor_match_proxy_new_for_bus().
9021 *
9022 * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set.
9023 */
9024SensorMatch *
9025sensor_match_proxy_new_for_bus_finish (
9026 GAsyncResult *res,
9027 GError **error)
9028{
9029 GObject *ret;
9030 GObject *source_object;
9031 source_object = g_async_result_get_source_object (res);
9032 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
9033 g_object_unref (source_object);
9034 if (ret != NULL)
9035 return SENSOR_MATCH (ret);
9036 else
9037 return NULL;
9038}
9039
9040/**
9041 * sensor_match_proxy_new_for_bus_sync:
9042 * @bus_type: A #GBusType.
9043 * @flags: Flags from the #GDBusProxyFlags enumeration.
9044 * @name: A bus name (well-known or unique).
9045 * @object_path: An object path.
9046 * @cancellable: (allow-none): A #GCancellable or %NULL.
9047 * @error: Return location for error or %NULL
9048 *
9049 * Like sensor_match_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
9050 *
9051 * The calling thread is blocked until a reply is received.
9052 *
9053 * See sensor_match_proxy_new_for_bus() for the asynchronous version of this constructor.
9054 *
9055 * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set.
9056 */
9057SensorMatch *
9058sensor_match_proxy_new_for_bus_sync (
9059 GBusType bus_type,
9060 GDBusProxyFlags flags,
9061 const gchar *name,
9062 const gchar *object_path,
9063 GCancellable *cancellable,
9064 GError **error)
9065{
9066 GInitable *ret;
9067 ret = g_initable_new (TYPE_SENSOR_MATCH_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.SensorMatch", NULL);
9068 if (ret != NULL)
9069 return SENSOR_MATCH (ret);
9070 else
9071 return NULL;
9072}
9073
9074
9075/* ------------------------------------------------------------------------ */
9076
9077/**
9078 * SensorMatchSkeleton:
9079 *
9080 * The #SensorMatchSkeleton structure contains only private data and should only be accessed using the provided API.
9081 */
9082
9083/**
9084 * SensorMatchSkeletonClass:
9085 * @parent_class: The parent class.
9086 *
9087 * Class structure for #SensorMatchSkeleton.
9088 */
9089
9090struct _SensorMatchSkeletonPrivate
9091{
9092 GValue *properties;
9093 GList *changed_properties;
9094 GSource *changed_properties_idle_source;
9095 GMainContext *context;
9096 GMutex lock;
9097};
9098
9099static void
9100_sensor_match_skeleton_handle_method_call (
9101 GDBusConnection *connection G_GNUC_UNUSED,
9102 const gchar *sender G_GNUC_UNUSED,
9103 const gchar *object_path G_GNUC_UNUSED,
9104 const gchar *interface_name,
9105 const gchar *method_name,
9106 GVariant *parameters,
9107 GDBusMethodInvocation *invocation,
9108 gpointer user_data)
9109{
9110 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data);
9111 _ExtendedGDBusMethodInfo *info;
9112 GVariantIter iter;
9113 GVariant *child;
9114 GValue *paramv;
9115 guint num_params;
9116 guint num_extra;
9117 guint n;
9118 guint signal_id;
9119 GValue return_value = G_VALUE_INIT;
9120 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
9121 g_assert (info != NULL);
9122 num_params = g_variant_n_children (parameters);
9123 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
9124 n = 0;
9125 g_value_init (&paramv[n], TYPE_SENSOR_MATCH);
9126 g_value_set_object (&paramv[n++], skeleton);
9127 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
9128 g_value_set_object (&paramv[n++], invocation);
9129 if (info->pass_fdlist)
9130 {
9131#ifdef G_OS_UNIX
9132 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
9133 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
9134#else
9135 g_assert_not_reached ();
9136#endif
9137 }
9138 g_variant_iter_init (&iter, parameters);
9139 while ((child = g_variant_iter_next_value (&iter)) != NULL)
9140 {
9141 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
9142 if (arg_info->use_gvariant)
9143 {
9144 g_value_init (&paramv[n], G_TYPE_VARIANT);
9145 g_value_set_variant (&paramv[n], child);
9146 n++;
9147 }
9148 else
9149 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
9150 g_variant_unref (child);
9151 }
9152 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_MATCH);
9153 g_value_init (&return_value, G_TYPE_BOOLEAN);
9154 g_signal_emitv (paramv, signal_id, 0, &return_value);
9155 if (!g_value_get_boolean (&return_value))
9156 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);
9157 g_value_unset (&return_value);
9158 for (n = 0; n < num_params + num_extra; n++)
9159 g_value_unset (&paramv[n]);
9160 g_free (paramv);
9161}
9162
9163static GVariant *
9164_sensor_match_skeleton_handle_get_property (
9165 GDBusConnection *connection G_GNUC_UNUSED,
9166 const gchar *sender G_GNUC_UNUSED,
9167 const gchar *object_path G_GNUC_UNUSED,
9168 const gchar *interface_name G_GNUC_UNUSED,
9169 const gchar *property_name,
9170 GError **error,
9171 gpointer user_data)
9172{
9173 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data);
9174 GValue value = G_VALUE_INIT;
9175 GParamSpec *pspec;
9176 _ExtendedGDBusPropertyInfo *info;
9177 GVariant *ret;
9178 ret = NULL;
9179 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, property_name);
9180 g_assert (info != NULL);
9181 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
9182 if (pspec == NULL)
9183 {
9184 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
9185 }
9186 else
9187 {
9188 g_value_init (&value, pspec->value_type);
9189 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
9190 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
9191 g_value_unset (&value);
9192 }
9193 return ret;
9194}
9195
9196static gboolean
9197_sensor_match_skeleton_handle_set_property (
9198 GDBusConnection *connection G_GNUC_UNUSED,
9199 const gchar *sender G_GNUC_UNUSED,
9200 const gchar *object_path G_GNUC_UNUSED,
9201 const gchar *interface_name G_GNUC_UNUSED,
9202 const gchar *property_name,
9203 GVariant *variant,
9204 GError **error,
9205 gpointer user_data)
9206{
9207 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data);
9208 GValue value = G_VALUE_INIT;
9209 GParamSpec *pspec;
9210 _ExtendedGDBusPropertyInfo *info;
9211 gboolean ret;
9212 ret = FALSE;
9213 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, property_name);
9214 g_assert (info != NULL);
9215 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
9216 if (pspec == NULL)
9217 {
9218 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
9219 }
9220 else
9221 {
9222 if (info->use_gvariant)
9223 g_value_set_variant (&value, variant);
9224 else
9225 g_dbus_gvariant_to_gvalue (variant, &value);
9226 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
9227 g_value_unset (&value);
9228 ret = TRUE;
9229 }
9230 return ret;
9231}
9232
9233static const GDBusInterfaceVTable _sensor_match_skeleton_vtable =
9234{
9235 _sensor_match_skeleton_handle_method_call,
9236 _sensor_match_skeleton_handle_get_property,
9237 _sensor_match_skeleton_handle_set_property,
9238 {NULL}
9239};
9240
9241static GDBusInterfaceInfo *
9242sensor_match_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
9243{
9244 return sensor_match_interface_info ();
9245}
9246
9247static GDBusInterfaceVTable *
9248sensor_match_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
9249{
9250 return (GDBusInterfaceVTable *) &_sensor_match_skeleton_vtable;
9251}
9252
9253static GVariant *
9254sensor_match_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
9255{
9256 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (_skeleton);
9257
9258 GVariantBuilder builder;
9259 guint n;
9260 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
9261 if (_sensor_match_interface_info.parent_struct.properties == NULL)
9262 goto out;
9263 for (n = 0; _sensor_match_interface_info.parent_struct.properties[n] != NULL; n++)
9264 {
9265 GDBusPropertyInfo *info = _sensor_match_interface_info.parent_struct.properties[n];
9266 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
9267 {
9268 GVariant *value;
9269 value = _sensor_match_skeleton_handle_get_property (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorMatch", info->name, NULL, skeleton);
9270 if (value != NULL)
9271 {
9272 g_variant_take_ref (value);
9273 g_variant_builder_add (&builder, "{sv}", info->name, value);
9274 g_variant_unref (value);
9275 }
9276 }
9277 }
9278out:
9279 return g_variant_builder_end (&builder);
9280}
9281
9282static gboolean _sensor_match_emit_changed (gpointer user_data);
9283
9284static void
9285sensor_match_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
9286{
9287 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (_skeleton);
9288 gboolean emit_changed = FALSE;
9289
9290 g_mutex_lock (&skeleton->priv->lock);
9291 if (skeleton->priv->changed_properties_idle_source != NULL)
9292 {
9293 g_source_destroy (skeleton->priv->changed_properties_idle_source);
9294 skeleton->priv->changed_properties_idle_source = NULL;
9295 emit_changed = TRUE;
9296 }
9297 g_mutex_unlock (&skeleton->priv->lock);
9298
9299 if (emit_changed)
9300 _sensor_match_emit_changed (skeleton);
9301}
9302
9303static void
9304_sensor_match_on_signal_sensor_match (
9305 SensorMatch *object,
9306 guchar arg_state)
9307{
9308 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
9309
9310 GList *connections, *l;
9311 GVariant *signal_variant;
9312 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
9313
9314 signal_variant = g_variant_ref_sink (g_variant_new ("(y)",
9315 arg_state));
9316 for (l = connections; l != NULL; l = l->next)
9317 {
9318 GDBusConnection *connection = l->data;
9319 g_dbus_connection_emit_signal (connection,
9320 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorMatch", "SensorMatch",
9321 signal_variant, NULL);
9322 }
9323 g_variant_unref (signal_variant);
9324 g_list_free_full (connections, g_object_unref);
9325}
9326
9327static void sensor_match_skeleton_iface_init (SensorMatchIface *iface);
9328#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
9329G_DEFINE_TYPE_WITH_CODE (SensorMatchSkeleton, sensor_match_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
9330 G_ADD_PRIVATE (SensorMatchSkeleton)
9331 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_skeleton_iface_init));
9332
9333#else
9334G_DEFINE_TYPE_WITH_CODE (SensorMatchSkeleton, sensor_match_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
9335 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_skeleton_iface_init));
9336
9337#endif
9338static void
9339sensor_match_skeleton_finalize (GObject *object)
9340{
9341 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
9342 guint n;
9343 for (n = 0; n < 2; n++)
9344 g_value_unset (&skeleton->priv->properties[n]);
9345 g_free (skeleton->priv->properties);
9346 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
9347 if (skeleton->priv->changed_properties_idle_source != NULL)
9348 g_source_destroy (skeleton->priv->changed_properties_idle_source);
9349 g_main_context_unref (skeleton->priv->context);
9350 g_mutex_clear (&skeleton->priv->lock);
9351 G_OBJECT_CLASS (sensor_match_skeleton_parent_class)->finalize (object);
9352}
9353
9354static void
9355sensor_match_skeleton_get_property (GObject *object,
9356 guint prop_id,
9357 GValue *value,
9358 GParamSpec *pspec G_GNUC_UNUSED)
9359{
9360 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
9361 g_assert (prop_id != 0 && prop_id - 1 < 2);
9362 g_mutex_lock (&skeleton->priv->lock);
9363 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
9364 g_mutex_unlock (&skeleton->priv->lock);
9365}
9366
9367static gboolean
9368_sensor_match_emit_changed (gpointer user_data)
9369{
9370 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data);
9371 GList *l;
9372 GVariantBuilder builder;
9373 GVariantBuilder invalidated_builder;
9374 guint num_changes;
9375
9376 g_mutex_lock (&skeleton->priv->lock);
9377 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
9378 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
9379 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
9380 {
9381 ChangedProperty *cp = l->data;
9382 GVariant *variant;
9383 const GValue *cur_value;
9384
9385 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
9386 if (!_g_value_equal (cur_value, &cp->orig_value))
9387 {
9388 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
9389 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
9390 g_variant_unref (variant);
9391 num_changes++;
9392 }
9393 }
9394 if (num_changes > 0)
9395 {
9396 GList *connections, *ll;
9397 GVariant *signal_variant;
9398 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorMatch",
9399 &builder, &invalidated_builder));
9400 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
9401 for (ll = connections; ll != NULL; ll = ll->next)
9402 {
9403 GDBusConnection *connection = ll->data;
9404
9405 g_dbus_connection_emit_signal (connection,
9406 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
9407 "org.freedesktop.DBus.Properties",
9408 "PropertiesChanged",
9409 signal_variant,
9410 NULL);
9411 }
9412 g_variant_unref (signal_variant);
9413 g_list_free_full (connections, g_object_unref);
9414 }
9415 else
9416 {
9417 g_variant_builder_clear (&builder);
9418 g_variant_builder_clear (&invalidated_builder);
9419 }
9420 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
9421 skeleton->priv->changed_properties = NULL;
9422 skeleton->priv->changed_properties_idle_source = NULL;
9423 g_mutex_unlock (&skeleton->priv->lock);
9424 return FALSE;
9425}
9426
9427static void
9428_sensor_match_schedule_emit_changed (SensorMatchSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
9429{
9430 ChangedProperty *cp;
9431 GList *l;
9432 cp = NULL;
9433 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
9434 {
9435 ChangedProperty *i_cp = l->data;
9436 if (i_cp->info == info)
9437 {
9438 cp = i_cp;
9439 break;
9440 }
9441 }
9442 if (cp == NULL)
9443 {
9444 cp = g_new0 (ChangedProperty, 1);
9445 cp->prop_id = prop_id;
9446 cp->info = info;
9447 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
9448 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
9449 g_value_copy (orig_value, &cp->orig_value);
9450 }
9451}
9452
9453static void
9454sensor_match_skeleton_notify (GObject *object,
9455 GParamSpec *pspec G_GNUC_UNUSED)
9456{
9457 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
9458 g_mutex_lock (&skeleton->priv->lock);
9459 if (skeleton->priv->changed_properties != NULL &&
9460 skeleton->priv->changed_properties_idle_source == NULL)
9461 {
9462 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
9463 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
9464 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_match_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
Adriana Kobylakfd778822016-06-16 09:08:37 -05009465 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _sensor_match_emit_changed");
Norman James362a80f2015-09-14 14:04:39 -05009466 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
9467 g_source_unref (skeleton->priv->changed_properties_idle_source);
9468 }
9469 g_mutex_unlock (&skeleton->priv->lock);
9470}
9471
9472static void
9473sensor_match_skeleton_set_property (GObject *object,
9474 guint prop_id,
9475 const GValue *value,
9476 GParamSpec *pspec)
9477{
9478 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
9479 g_assert (prop_id != 0 && prop_id - 1 < 2);
9480 g_mutex_lock (&skeleton->priv->lock);
9481 g_object_freeze_notify (object);
9482 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
9483 {
9484 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
9485 _sensor_match_schedule_emit_changed (skeleton, _sensor_match_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
9486 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
9487 g_object_notify_by_pspec (object, pspec);
9488 }
9489 g_mutex_unlock (&skeleton->priv->lock);
9490 g_object_thaw_notify (object);
9491}
9492
9493static void
9494sensor_match_skeleton_init (SensorMatchSkeleton *skeleton)
9495{
9496#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
9497 skeleton->priv = sensor_match_skeleton_get_instance_private (skeleton);
9498#else
9499 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_MATCH_SKELETON, SensorMatchSkeletonPrivate);
9500#endif
9501
9502 g_mutex_init (&skeleton->priv->lock);
9503 skeleton->priv->context = g_main_context_ref_thread_default ();
9504 skeleton->priv->properties = g_new0 (GValue, 2);
9505 g_value_init (&skeleton->priv->properties[0], G_TYPE_VARIANT);
9506 g_value_init (&skeleton->priv->properties[1], G_TYPE_UCHAR);
9507}
9508
9509static GVariant *
9510sensor_match_skeleton_get_match_value (SensorMatch *object)
9511{
9512 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
9513 GVariant *value;
9514 g_mutex_lock (&skeleton->priv->lock);
9515 value = g_value_get_variant (&(skeleton->priv->properties[0]));
9516 g_mutex_unlock (&skeleton->priv->lock);
9517 return value;
9518}
9519
9520static guchar
9521sensor_match_skeleton_get_state (SensorMatch *object)
9522{
9523 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
9524 guchar value;
9525 g_mutex_lock (&skeleton->priv->lock);
9526 value = g_value_get_uchar (&(skeleton->priv->properties[1]));
9527 g_mutex_unlock (&skeleton->priv->lock);
9528 return value;
9529}
9530
9531static void
9532sensor_match_skeleton_class_init (SensorMatchSkeletonClass *klass)
9533{
9534 GObjectClass *gobject_class;
9535 GDBusInterfaceSkeletonClass *skeleton_class;
9536
9537 gobject_class = G_OBJECT_CLASS (klass);
9538 gobject_class->finalize = sensor_match_skeleton_finalize;
9539 gobject_class->get_property = sensor_match_skeleton_get_property;
9540 gobject_class->set_property = sensor_match_skeleton_set_property;
9541 gobject_class->notify = sensor_match_skeleton_notify;
9542
9543
9544 sensor_match_override_properties (gobject_class, 1);
9545
9546 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
9547 skeleton_class->get_info = sensor_match_skeleton_dbus_interface_get_info;
9548 skeleton_class->get_properties = sensor_match_skeleton_dbus_interface_get_properties;
9549 skeleton_class->flush = sensor_match_skeleton_dbus_interface_flush;
9550 skeleton_class->get_vtable = sensor_match_skeleton_dbus_interface_get_vtable;
9551
9552#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
9553 g_type_class_add_private (klass, sizeof (SensorMatchSkeletonPrivate));
9554#endif
9555}
9556
9557static void
9558sensor_match_skeleton_iface_init (SensorMatchIface *iface)
9559{
9560 iface->sensor_match = _sensor_match_on_signal_sensor_match;
9561 iface->get_match_value = sensor_match_skeleton_get_match_value;
9562 iface->get_state = sensor_match_skeleton_get_state;
9563}
9564
9565/**
9566 * sensor_match_skeleton_new:
9567 *
9568 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>.
9569 *
9570 * Returns: (transfer full) (type SensorMatchSkeleton): The skeleton object.
9571 */
9572SensorMatch *
9573sensor_match_skeleton_new (void)
9574{
9575 return SENSOR_MATCH (g_object_new (TYPE_SENSOR_MATCH_SKELETON, NULL));
9576}
9577
9578/* ------------------------------------------------------------------------
9579 * Code for interface org.openbmc.Process
9580 * ------------------------------------------------------------------------
9581 */
9582
9583/**
9584 * SECTION:Process
9585 * @title: Process
9586 * @short_description: Generated C code for the org.openbmc.Process D-Bus interface
9587 *
9588 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link> D-Bus interface in C.
9589 */
9590
9591/* ---- Introspection data for org.openbmc.Process ---- */
9592
9593static const _ExtendedGDBusMethodInfo _process_method_info_stop =
9594{
9595 {
9596 -1,
9597 (gchar *) "stop",
9598 NULL,
9599 NULL,
9600 NULL
9601 },
9602 "handle-stop",
9603 FALSE
9604};
9605
9606static const _ExtendedGDBusMethodInfo * const _process_method_info_pointers[] =
9607{
9608 &_process_method_info_stop,
9609 NULL
9610};
9611
9612static const _ExtendedGDBusInterfaceInfo _process_interface_info =
9613{
9614 {
9615 -1,
9616 (gchar *) "org.openbmc.Process",
9617 (GDBusMethodInfo **) &_process_method_info_pointers,
9618 NULL,
9619 NULL,
9620 NULL
9621 },
9622 "process",
9623};
9624
9625
9626/**
9627 * process_interface_info:
9628 *
9629 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link> D-Bus interface.
9630 *
9631 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
9632 */
9633GDBusInterfaceInfo *
9634process_interface_info (void)
9635{
9636 return (GDBusInterfaceInfo *) &_process_interface_info.parent_struct;
9637}
9638
9639/**
9640 * process_override_properties:
9641 * @klass: The class structure for a #GObject<!-- -->-derived class.
9642 * @property_id_begin: The property id to assign to the first overridden property.
9643 *
9644 * Overrides all #GObject properties in the #Process interface for a concrete class.
9645 * The properties are overridden in the order they are defined.
9646 *
9647 * Returns: The last property id.
9648 */
9649guint
9650process_override_properties (GObjectClass *klass, guint property_id_begin)
9651{
9652 return property_id_begin - 1;
9653}
9654
9655
9656
9657/**
9658 * Process:
9659 *
9660 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link>.
9661 */
9662
9663/**
9664 * ProcessIface:
9665 * @parent_iface: The parent interface.
9666 * @handle_stop: Handler for the #Process::handle-stop signal.
9667 *
9668 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link>.
9669 */
9670
9671typedef ProcessIface ProcessInterface;
9672G_DEFINE_INTERFACE (Process, process, G_TYPE_OBJECT);
9673
9674static void
9675process_default_init (ProcessIface *iface)
9676{
9677 /* GObject signals for incoming D-Bus method calls: */
9678 /**
9679 * Process::handle-stop:
9680 * @object: A #Process.
9681 * @invocation: A #GDBusMethodInvocation.
9682 *
9683 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Process.stop">stop()</link> D-Bus method.
9684 *
9685 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call process_complete_stop() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
9686 *
9687 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
9688 */
9689 g_signal_new ("handle-stop",
9690 G_TYPE_FROM_INTERFACE (iface),
9691 G_SIGNAL_RUN_LAST,
9692 G_STRUCT_OFFSET (ProcessIface, handle_stop),
9693 g_signal_accumulator_true_handled,
9694 NULL,
9695 g_cclosure_marshal_generic,
9696 G_TYPE_BOOLEAN,
9697 1,
9698 G_TYPE_DBUS_METHOD_INVOCATION);
9699
9700}
9701
9702/**
9703 * process_call_stop:
9704 * @proxy: A #ProcessProxy.
9705 * @cancellable: (allow-none): A #GCancellable or %NULL.
9706 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
9707 * @user_data: User data to pass to @callback.
9708 *
9709 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Process.stop">stop()</link> D-Bus method on @proxy.
9710 * 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.
9711 * You can then call process_call_stop_finish() to get the result of the operation.
9712 *
9713 * See process_call_stop_sync() for the synchronous, blocking version of this method.
9714 */
9715void
9716process_call_stop (
9717 Process *proxy,
9718 GCancellable *cancellable,
9719 GAsyncReadyCallback callback,
9720 gpointer user_data)
9721{
9722 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
9723 "stop",
9724 g_variant_new ("()"),
9725 G_DBUS_CALL_FLAGS_NONE,
9726 -1,
9727 cancellable,
9728 callback,
9729 user_data);
9730}
9731
9732/**
9733 * process_call_stop_finish:
9734 * @proxy: A #ProcessProxy.
9735 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to process_call_stop().
9736 * @error: Return location for error or %NULL.
9737 *
9738 * Finishes an operation started with process_call_stop().
9739 *
9740 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
9741 */
9742gboolean
9743process_call_stop_finish (
9744 Process *proxy,
9745 GAsyncResult *res,
9746 GError **error)
9747{
9748 GVariant *_ret;
9749 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
9750 if (_ret == NULL)
9751 goto _out;
9752 g_variant_get (_ret,
9753 "()");
9754 g_variant_unref (_ret);
9755_out:
9756 return _ret != NULL;
9757}
9758
9759/**
9760 * process_call_stop_sync:
9761 * @proxy: A #ProcessProxy.
9762 * @cancellable: (allow-none): A #GCancellable or %NULL.
9763 * @error: Return location for error or %NULL.
9764 *
9765 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Process.stop">stop()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
9766 *
9767 * See process_call_stop() for the asynchronous version of this method.
9768 *
9769 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
9770 */
9771gboolean
9772process_call_stop_sync (
9773 Process *proxy,
9774 GCancellable *cancellable,
9775 GError **error)
9776{
9777 GVariant *_ret;
9778 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
9779 "stop",
9780 g_variant_new ("()"),
9781 G_DBUS_CALL_FLAGS_NONE,
9782 -1,
9783 cancellable,
9784 error);
9785 if (_ret == NULL)
9786 goto _out;
9787 g_variant_get (_ret,
9788 "()");
9789 g_variant_unref (_ret);
9790_out:
9791 return _ret != NULL;
9792}
9793
9794/**
9795 * process_complete_stop:
9796 * @object: A #Process.
9797 * @invocation: (transfer full): A #GDBusMethodInvocation.
9798 *
9799 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Process.stop">stop()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
9800 *
9801 * This method will free @invocation, you cannot use it afterwards.
9802 */
9803void
9804process_complete_stop (
9805 Process *object,
9806 GDBusMethodInvocation *invocation)
9807{
9808 g_dbus_method_invocation_return_value (invocation,
9809 g_variant_new ("()"));
9810}
9811
9812/* ------------------------------------------------------------------------ */
9813
9814/**
9815 * ProcessProxy:
9816 *
9817 * The #ProcessProxy structure contains only private data and should only be accessed using the provided API.
9818 */
9819
9820/**
9821 * ProcessProxyClass:
9822 * @parent_class: The parent class.
9823 *
9824 * Class structure for #ProcessProxy.
9825 */
9826
9827struct _ProcessProxyPrivate
9828{
9829 GData *qdata;
9830};
9831
9832static void process_proxy_iface_init (ProcessIface *iface);
9833
9834#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
9835G_DEFINE_TYPE_WITH_CODE (ProcessProxy, process_proxy, G_TYPE_DBUS_PROXY,
9836 G_ADD_PRIVATE (ProcessProxy)
9837 G_IMPLEMENT_INTERFACE (TYPE_PROCESS, process_proxy_iface_init));
9838
9839#else
9840G_DEFINE_TYPE_WITH_CODE (ProcessProxy, process_proxy, G_TYPE_DBUS_PROXY,
9841 G_IMPLEMENT_INTERFACE (TYPE_PROCESS, process_proxy_iface_init));
9842
9843#endif
9844static void
9845process_proxy_finalize (GObject *object)
9846{
9847 ProcessProxy *proxy = PROCESS_PROXY (object);
9848 g_datalist_clear (&proxy->priv->qdata);
9849 G_OBJECT_CLASS (process_proxy_parent_class)->finalize (object);
9850}
9851
9852static void
9853process_proxy_get_property (GObject *object,
9854 guint prop_id,
9855 GValue *value,
9856 GParamSpec *pspec G_GNUC_UNUSED)
9857{
9858}
9859
9860static void
9861process_proxy_set_property (GObject *object,
9862 guint prop_id,
9863 const GValue *value,
9864 GParamSpec *pspec G_GNUC_UNUSED)
9865{
9866}
9867
9868static void
9869process_proxy_g_signal (GDBusProxy *proxy,
9870 const gchar *sender_name G_GNUC_UNUSED,
9871 const gchar *signal_name,
9872 GVariant *parameters)
9873{
9874 _ExtendedGDBusSignalInfo *info;
9875 GVariantIter iter;
9876 GVariant *child;
9877 GValue *paramv;
9878 guint num_params;
9879 guint n;
9880 guint signal_id;
9881 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, signal_name);
9882 if (info == NULL)
9883 return;
9884 num_params = g_variant_n_children (parameters);
9885 paramv = g_new0 (GValue, num_params + 1);
9886 g_value_init (&paramv[0], TYPE_PROCESS);
9887 g_value_set_object (&paramv[0], proxy);
9888 g_variant_iter_init (&iter, parameters);
9889 n = 1;
9890 while ((child = g_variant_iter_next_value (&iter)) != NULL)
9891 {
9892 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
9893 if (arg_info->use_gvariant)
9894 {
9895 g_value_init (&paramv[n], G_TYPE_VARIANT);
9896 g_value_set_variant (&paramv[n], child);
9897 n++;
9898 }
9899 else
9900 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
9901 g_variant_unref (child);
9902 }
9903 signal_id = g_signal_lookup (info->signal_name, TYPE_PROCESS);
9904 g_signal_emitv (paramv, signal_id, 0, NULL);
9905 for (n = 0; n < num_params + 1; n++)
9906 g_value_unset (&paramv[n]);
9907 g_free (paramv);
9908}
9909
9910static void
9911process_proxy_g_properties_changed (GDBusProxy *_proxy,
9912 GVariant *changed_properties,
9913 const gchar *const *invalidated_properties)
9914{
9915 ProcessProxy *proxy = PROCESS_PROXY (_proxy);
9916 guint n;
9917 const gchar *key;
9918 GVariantIter *iter;
9919 _ExtendedGDBusPropertyInfo *info;
9920 g_variant_get (changed_properties, "a{sv}", &iter);
9921 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
9922 {
9923 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, key);
9924 g_datalist_remove_data (&proxy->priv->qdata, key);
9925 if (info != NULL)
9926 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
9927 }
9928 g_variant_iter_free (iter);
9929 for (n = 0; invalidated_properties[n] != NULL; n++)
9930 {
9931 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, invalidated_properties[n]);
9932 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
9933 if (info != NULL)
9934 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
9935 }
9936}
9937
9938static void
9939process_proxy_init (ProcessProxy *proxy)
9940{
9941#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
9942 proxy->priv = process_proxy_get_instance_private (proxy);
9943#else
9944 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_PROCESS_PROXY, ProcessProxyPrivate);
9945#endif
9946
9947 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), process_interface_info ());
9948}
9949
9950static void
9951process_proxy_class_init (ProcessProxyClass *klass)
9952{
9953 GObjectClass *gobject_class;
9954 GDBusProxyClass *proxy_class;
9955
9956 gobject_class = G_OBJECT_CLASS (klass);
9957 gobject_class->finalize = process_proxy_finalize;
9958 gobject_class->get_property = process_proxy_get_property;
9959 gobject_class->set_property = process_proxy_set_property;
9960
9961 proxy_class = G_DBUS_PROXY_CLASS (klass);
9962 proxy_class->g_signal = process_proxy_g_signal;
9963 proxy_class->g_properties_changed = process_proxy_g_properties_changed;
9964
9965#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
9966 g_type_class_add_private (klass, sizeof (ProcessProxyPrivate));
9967#endif
9968}
9969
9970static void
9971process_proxy_iface_init (ProcessIface *iface)
9972{
9973}
9974
9975/**
9976 * process_proxy_new:
9977 * @connection: A #GDBusConnection.
9978 * @flags: Flags from the #GDBusProxyFlags enumeration.
9979 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
9980 * @object_path: An object path.
9981 * @cancellable: (allow-none): A #GCancellable or %NULL.
9982 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
9983 * @user_data: User data to pass to @callback.
9984 *
9985 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link>. See g_dbus_proxy_new() for more details.
9986 *
9987 * 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.
9988 * You can then call process_proxy_new_finish() to get the result of the operation.
9989 *
9990 * See process_proxy_new_sync() for the synchronous, blocking version of this constructor.
9991 */
9992void
9993process_proxy_new (
9994 GDBusConnection *connection,
9995 GDBusProxyFlags flags,
9996 const gchar *name,
9997 const gchar *object_path,
9998 GCancellable *cancellable,
9999 GAsyncReadyCallback callback,
10000 gpointer user_data)
10001{
10002 g_async_initable_new_async (TYPE_PROCESS_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.Process", NULL);
10003}
10004
10005/**
10006 * process_proxy_new_finish:
10007 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to process_proxy_new().
10008 * @error: Return location for error or %NULL
10009 *
10010 * Finishes an operation started with process_proxy_new().
10011 *
10012 * Returns: (transfer full) (type ProcessProxy): The constructed proxy object or %NULL if @error is set.
10013 */
10014Process *
10015process_proxy_new_finish (
10016 GAsyncResult *res,
10017 GError **error)
10018{
10019 GObject *ret;
10020 GObject *source_object;
10021 source_object = g_async_result_get_source_object (res);
10022 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
10023 g_object_unref (source_object);
10024 if (ret != NULL)
10025 return PROCESS (ret);
10026 else
10027 return NULL;
10028}
10029
10030/**
10031 * process_proxy_new_sync:
10032 * @connection: A #GDBusConnection.
10033 * @flags: Flags from the #GDBusProxyFlags enumeration.
10034 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
10035 * @object_path: An object path.
10036 * @cancellable: (allow-none): A #GCancellable or %NULL.
10037 * @error: Return location for error or %NULL
10038 *
10039 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link>. See g_dbus_proxy_new_sync() for more details.
10040 *
10041 * The calling thread is blocked until a reply is received.
10042 *
10043 * See process_proxy_new() for the asynchronous version of this constructor.
10044 *
10045 * Returns: (transfer full) (type ProcessProxy): The constructed proxy object or %NULL if @error is set.
10046 */
10047Process *
10048process_proxy_new_sync (
10049 GDBusConnection *connection,
10050 GDBusProxyFlags flags,
10051 const gchar *name,
10052 const gchar *object_path,
10053 GCancellable *cancellable,
10054 GError **error)
10055{
10056 GInitable *ret;
10057 ret = g_initable_new (TYPE_PROCESS_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.Process", NULL);
10058 if (ret != NULL)
10059 return PROCESS (ret);
10060 else
10061 return NULL;
10062}
10063
10064
10065/**
10066 * process_proxy_new_for_bus:
10067 * @bus_type: A #GBusType.
10068 * @flags: Flags from the #GDBusProxyFlags enumeration.
10069 * @name: A bus name (well-known or unique).
10070 * @object_path: An object path.
10071 * @cancellable: (allow-none): A #GCancellable or %NULL.
10072 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
10073 * @user_data: User data to pass to @callback.
10074 *
10075 * Like process_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
10076 *
10077 * 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.
10078 * You can then call process_proxy_new_for_bus_finish() to get the result of the operation.
10079 *
10080 * See process_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
10081 */
10082void
10083process_proxy_new_for_bus (
10084 GBusType bus_type,
10085 GDBusProxyFlags flags,
10086 const gchar *name,
10087 const gchar *object_path,
10088 GCancellable *cancellable,
10089 GAsyncReadyCallback callback,
10090 gpointer user_data)
10091{
10092 g_async_initable_new_async (TYPE_PROCESS_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.Process", NULL);
10093}
10094
10095/**
10096 * process_proxy_new_for_bus_finish:
10097 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to process_proxy_new_for_bus().
10098 * @error: Return location for error or %NULL
10099 *
10100 * Finishes an operation started with process_proxy_new_for_bus().
10101 *
10102 * Returns: (transfer full) (type ProcessProxy): The constructed proxy object or %NULL if @error is set.
10103 */
10104Process *
10105process_proxy_new_for_bus_finish (
10106 GAsyncResult *res,
10107 GError **error)
10108{
10109 GObject *ret;
10110 GObject *source_object;
10111 source_object = g_async_result_get_source_object (res);
10112 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
10113 g_object_unref (source_object);
10114 if (ret != NULL)
10115 return PROCESS (ret);
10116 else
10117 return NULL;
10118}
10119
10120/**
10121 * process_proxy_new_for_bus_sync:
10122 * @bus_type: A #GBusType.
10123 * @flags: Flags from the #GDBusProxyFlags enumeration.
10124 * @name: A bus name (well-known or unique).
10125 * @object_path: An object path.
10126 * @cancellable: (allow-none): A #GCancellable or %NULL.
10127 * @error: Return location for error or %NULL
10128 *
10129 * Like process_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
10130 *
10131 * The calling thread is blocked until a reply is received.
10132 *
10133 * See process_proxy_new_for_bus() for the asynchronous version of this constructor.
10134 *
10135 * Returns: (transfer full) (type ProcessProxy): The constructed proxy object or %NULL if @error is set.
10136 */
10137Process *
10138process_proxy_new_for_bus_sync (
10139 GBusType bus_type,
10140 GDBusProxyFlags flags,
10141 const gchar *name,
10142 const gchar *object_path,
10143 GCancellable *cancellable,
10144 GError **error)
10145{
10146 GInitable *ret;
10147 ret = g_initable_new (TYPE_PROCESS_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.Process", NULL);
10148 if (ret != NULL)
10149 return PROCESS (ret);
10150 else
10151 return NULL;
10152}
10153
10154
10155/* ------------------------------------------------------------------------ */
10156
10157/**
10158 * ProcessSkeleton:
10159 *
10160 * The #ProcessSkeleton structure contains only private data and should only be accessed using the provided API.
10161 */
10162
10163/**
10164 * ProcessSkeletonClass:
10165 * @parent_class: The parent class.
10166 *
10167 * Class structure for #ProcessSkeleton.
10168 */
10169
10170struct _ProcessSkeletonPrivate
10171{
10172 GValue *properties;
10173 GList *changed_properties;
10174 GSource *changed_properties_idle_source;
10175 GMainContext *context;
10176 GMutex lock;
10177};
10178
10179static void
10180_process_skeleton_handle_method_call (
10181 GDBusConnection *connection G_GNUC_UNUSED,
10182 const gchar *sender G_GNUC_UNUSED,
10183 const gchar *object_path G_GNUC_UNUSED,
10184 const gchar *interface_name,
10185 const gchar *method_name,
10186 GVariant *parameters,
10187 GDBusMethodInvocation *invocation,
10188 gpointer user_data)
10189{
10190 ProcessSkeleton *skeleton = PROCESS_SKELETON (user_data);
10191 _ExtendedGDBusMethodInfo *info;
10192 GVariantIter iter;
10193 GVariant *child;
10194 GValue *paramv;
10195 guint num_params;
10196 guint num_extra;
10197 guint n;
10198 guint signal_id;
10199 GValue return_value = G_VALUE_INIT;
10200 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
10201 g_assert (info != NULL);
10202 num_params = g_variant_n_children (parameters);
10203 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
10204 n = 0;
10205 g_value_init (&paramv[n], TYPE_PROCESS);
10206 g_value_set_object (&paramv[n++], skeleton);
10207 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
10208 g_value_set_object (&paramv[n++], invocation);
10209 if (info->pass_fdlist)
10210 {
10211#ifdef G_OS_UNIX
10212 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
10213 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
10214#else
10215 g_assert_not_reached ();
10216#endif
10217 }
10218 g_variant_iter_init (&iter, parameters);
10219 while ((child = g_variant_iter_next_value (&iter)) != NULL)
10220 {
10221 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
10222 if (arg_info->use_gvariant)
10223 {
10224 g_value_init (&paramv[n], G_TYPE_VARIANT);
10225 g_value_set_variant (&paramv[n], child);
10226 n++;
10227 }
10228 else
10229 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
10230 g_variant_unref (child);
10231 }
10232 signal_id = g_signal_lookup (info->signal_name, TYPE_PROCESS);
10233 g_value_init (&return_value, G_TYPE_BOOLEAN);
10234 g_signal_emitv (paramv, signal_id, 0, &return_value);
10235 if (!g_value_get_boolean (&return_value))
10236 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);
10237 g_value_unset (&return_value);
10238 for (n = 0; n < num_params + num_extra; n++)
10239 g_value_unset (&paramv[n]);
10240 g_free (paramv);
10241}
10242
10243static GVariant *
10244_process_skeleton_handle_get_property (
10245 GDBusConnection *connection G_GNUC_UNUSED,
10246 const gchar *sender G_GNUC_UNUSED,
10247 const gchar *object_path G_GNUC_UNUSED,
10248 const gchar *interface_name G_GNUC_UNUSED,
10249 const gchar *property_name,
10250 GError **error,
10251 gpointer user_data)
10252{
10253 ProcessSkeleton *skeleton = PROCESS_SKELETON (user_data);
10254 GValue value = G_VALUE_INIT;
10255 GParamSpec *pspec;
10256 _ExtendedGDBusPropertyInfo *info;
10257 GVariant *ret;
10258 ret = NULL;
10259 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, property_name);
10260 g_assert (info != NULL);
10261 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
10262 if (pspec == NULL)
10263 {
10264 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
10265 }
10266 else
10267 {
10268 g_value_init (&value, pspec->value_type);
10269 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
10270 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
10271 g_value_unset (&value);
10272 }
10273 return ret;
10274}
10275
10276static gboolean
10277_process_skeleton_handle_set_property (
10278 GDBusConnection *connection G_GNUC_UNUSED,
10279 const gchar *sender G_GNUC_UNUSED,
10280 const gchar *object_path G_GNUC_UNUSED,
10281 const gchar *interface_name G_GNUC_UNUSED,
10282 const gchar *property_name,
10283 GVariant *variant,
10284 GError **error,
10285 gpointer user_data)
10286{
10287 ProcessSkeleton *skeleton = PROCESS_SKELETON (user_data);
10288 GValue value = G_VALUE_INIT;
10289 GParamSpec *pspec;
10290 _ExtendedGDBusPropertyInfo *info;
10291 gboolean ret;
10292 ret = FALSE;
10293 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, property_name);
10294 g_assert (info != NULL);
10295 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
10296 if (pspec == NULL)
10297 {
10298 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
10299 }
10300 else
10301 {
10302 if (info->use_gvariant)
10303 g_value_set_variant (&value, variant);
10304 else
10305 g_dbus_gvariant_to_gvalue (variant, &value);
10306 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
10307 g_value_unset (&value);
10308 ret = TRUE;
10309 }
10310 return ret;
10311}
10312
10313static const GDBusInterfaceVTable _process_skeleton_vtable =
10314{
10315 _process_skeleton_handle_method_call,
10316 _process_skeleton_handle_get_property,
10317 _process_skeleton_handle_set_property,
10318 {NULL}
10319};
10320
10321static GDBusInterfaceInfo *
10322process_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
10323{
10324 return process_interface_info ();
10325}
10326
10327static GDBusInterfaceVTable *
10328process_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
10329{
10330 return (GDBusInterfaceVTable *) &_process_skeleton_vtable;
10331}
10332
10333static GVariant *
10334process_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
10335{
10336 ProcessSkeleton *skeleton = PROCESS_SKELETON (_skeleton);
10337
10338 GVariantBuilder builder;
10339 guint n;
10340 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
10341 if (_process_interface_info.parent_struct.properties == NULL)
10342 goto out;
10343 for (n = 0; _process_interface_info.parent_struct.properties[n] != NULL; n++)
10344 {
10345 GDBusPropertyInfo *info = _process_interface_info.parent_struct.properties[n];
10346 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
10347 {
10348 GVariant *value;
10349 value = _process_skeleton_handle_get_property (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Process", info->name, NULL, skeleton);
10350 if (value != NULL)
10351 {
10352 g_variant_take_ref (value);
10353 g_variant_builder_add (&builder, "{sv}", info->name, value);
10354 g_variant_unref (value);
10355 }
10356 }
10357 }
10358out:
10359 return g_variant_builder_end (&builder);
10360}
10361
10362static void
10363process_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
10364{
10365}
10366
10367static void process_skeleton_iface_init (ProcessIface *iface);
10368#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
10369G_DEFINE_TYPE_WITH_CODE (ProcessSkeleton, process_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
10370 G_ADD_PRIVATE (ProcessSkeleton)
10371 G_IMPLEMENT_INTERFACE (TYPE_PROCESS, process_skeleton_iface_init));
10372
10373#else
10374G_DEFINE_TYPE_WITH_CODE (ProcessSkeleton, process_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
10375 G_IMPLEMENT_INTERFACE (TYPE_PROCESS, process_skeleton_iface_init));
10376
10377#endif
10378static void
10379process_skeleton_finalize (GObject *object)
10380{
10381 ProcessSkeleton *skeleton = PROCESS_SKELETON (object);
10382 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
10383 if (skeleton->priv->changed_properties_idle_source != NULL)
10384 g_source_destroy (skeleton->priv->changed_properties_idle_source);
10385 g_main_context_unref (skeleton->priv->context);
10386 g_mutex_clear (&skeleton->priv->lock);
10387 G_OBJECT_CLASS (process_skeleton_parent_class)->finalize (object);
10388}
10389
10390static void
10391process_skeleton_init (ProcessSkeleton *skeleton)
10392{
10393#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
10394 skeleton->priv = process_skeleton_get_instance_private (skeleton);
10395#else
10396 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_PROCESS_SKELETON, ProcessSkeletonPrivate);
10397#endif
10398
10399 g_mutex_init (&skeleton->priv->lock);
10400 skeleton->priv->context = g_main_context_ref_thread_default ();
10401}
10402
10403static void
10404process_skeleton_class_init (ProcessSkeletonClass *klass)
10405{
10406 GObjectClass *gobject_class;
10407 GDBusInterfaceSkeletonClass *skeleton_class;
10408
10409 gobject_class = G_OBJECT_CLASS (klass);
10410 gobject_class->finalize = process_skeleton_finalize;
10411
10412 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
10413 skeleton_class->get_info = process_skeleton_dbus_interface_get_info;
10414 skeleton_class->get_properties = process_skeleton_dbus_interface_get_properties;
10415 skeleton_class->flush = process_skeleton_dbus_interface_flush;
10416 skeleton_class->get_vtable = process_skeleton_dbus_interface_get_vtable;
10417
10418#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
10419 g_type_class_add_private (klass, sizeof (ProcessSkeletonPrivate));
10420#endif
10421}
10422
10423static void
10424process_skeleton_iface_init (ProcessIface *iface)
10425{
10426}
10427
10428/**
10429 * process_skeleton_new:
10430 *
10431 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link>.
10432 *
10433 * Returns: (transfer full) (type ProcessSkeleton): The skeleton object.
10434 */
10435Process *
10436process_skeleton_new (void)
10437{
10438 return PROCESS (g_object_new (TYPE_PROCESS_SKELETON, NULL));
10439}
10440
10441/* ------------------------------------------------------------------------
Norman James18998182015-10-11 21:54:53 -050010442 * Code for interface org.openbmc.SharedResource
10443 * ------------------------------------------------------------------------
10444 */
10445
10446/**
10447 * SECTION:SharedResource
10448 * @title: SharedResource
10449 * @short_description: Generated C code for the org.openbmc.SharedResource D-Bus interface
10450 *
10451 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link> D-Bus interface in C.
10452 */
10453
10454/* ---- Introspection data for org.openbmc.SharedResource ---- */
10455
10456static const _ExtendedGDBusArgInfo _shared_resource_method_info_lock_IN_ARG_name =
10457{
10458 {
10459 -1,
10460 (gchar *) "name",
10461 (gchar *) "s",
10462 NULL
10463 },
10464 FALSE
10465};
10466
10467static const _ExtendedGDBusArgInfo * const _shared_resource_method_info_lock_IN_ARG_pointers[] =
10468{
10469 &_shared_resource_method_info_lock_IN_ARG_name,
10470 NULL
10471};
10472
10473static const _ExtendedGDBusMethodInfo _shared_resource_method_info_lock =
10474{
10475 {
10476 -1,
10477 (gchar *) "lock",
10478 (GDBusArgInfo **) &_shared_resource_method_info_lock_IN_ARG_pointers,
10479 NULL,
10480 NULL
10481 },
10482 "handle-lock",
10483 FALSE
10484};
10485
10486static const _ExtendedGDBusMethodInfo _shared_resource_method_info_unlock =
10487{
10488 {
10489 -1,
10490 (gchar *) "unlock",
10491 NULL,
10492 NULL,
10493 NULL
10494 },
10495 "handle-unlock",
10496 FALSE
10497};
10498
10499static const _ExtendedGDBusArgInfo _shared_resource_method_info_is_locked_OUT_ARG_lock =
10500{
10501 {
10502 -1,
10503 (gchar *) "lock",
10504 (gchar *) "b",
10505 NULL
10506 },
10507 FALSE
10508};
10509
10510static const _ExtendedGDBusArgInfo _shared_resource_method_info_is_locked_OUT_ARG_name =
10511{
10512 {
10513 -1,
10514 (gchar *) "name",
10515 (gchar *) "s",
10516 NULL
10517 },
10518 FALSE
10519};
10520
10521static const _ExtendedGDBusArgInfo * const _shared_resource_method_info_is_locked_OUT_ARG_pointers[] =
10522{
10523 &_shared_resource_method_info_is_locked_OUT_ARG_lock,
10524 &_shared_resource_method_info_is_locked_OUT_ARG_name,
10525 NULL
10526};
10527
10528static const _ExtendedGDBusMethodInfo _shared_resource_method_info_is_locked =
10529{
10530 {
10531 -1,
10532 (gchar *) "isLocked",
10533 NULL,
10534 (GDBusArgInfo **) &_shared_resource_method_info_is_locked_OUT_ARG_pointers,
10535 NULL
10536 },
10537 "handle-is-locked",
10538 FALSE
10539};
10540
10541static const _ExtendedGDBusMethodInfo * const _shared_resource_method_info_pointers[] =
10542{
10543 &_shared_resource_method_info_lock,
10544 &_shared_resource_method_info_unlock,
10545 &_shared_resource_method_info_is_locked,
10546 NULL
10547};
10548
10549static const _ExtendedGDBusPropertyInfo _shared_resource_property_info_lock =
10550{
10551 {
10552 -1,
10553 (gchar *) "lock",
10554 (gchar *) "b",
10555 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
10556 NULL
10557 },
10558 "lock",
10559 FALSE
10560};
10561
10562static const _ExtendedGDBusPropertyInfo _shared_resource_property_info_name =
10563{
10564 {
10565 -1,
10566 (gchar *) "name",
10567 (gchar *) "s",
10568 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
10569 NULL
10570 },
10571 "name",
10572 FALSE
10573};
10574
10575static const _ExtendedGDBusPropertyInfo * const _shared_resource_property_info_pointers[] =
10576{
10577 &_shared_resource_property_info_lock,
10578 &_shared_resource_property_info_name,
10579 NULL
10580};
10581
10582static const _ExtendedGDBusInterfaceInfo _shared_resource_interface_info =
10583{
10584 {
10585 -1,
10586 (gchar *) "org.openbmc.SharedResource",
10587 (GDBusMethodInfo **) &_shared_resource_method_info_pointers,
10588 NULL,
10589 (GDBusPropertyInfo **) &_shared_resource_property_info_pointers,
10590 NULL
10591 },
10592 "shared-resource",
10593};
10594
10595
10596/**
10597 * shared_resource_interface_info:
10598 *
10599 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link> D-Bus interface.
10600 *
10601 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
10602 */
10603GDBusInterfaceInfo *
10604shared_resource_interface_info (void)
10605{
10606 return (GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct;
10607}
10608
10609/**
10610 * shared_resource_override_properties:
10611 * @klass: The class structure for a #GObject<!-- -->-derived class.
10612 * @property_id_begin: The property id to assign to the first overridden property.
10613 *
10614 * Overrides all #GObject properties in the #SharedResource interface for a concrete class.
10615 * The properties are overridden in the order they are defined.
10616 *
10617 * Returns: The last property id.
10618 */
10619guint
10620shared_resource_override_properties (GObjectClass *klass, guint property_id_begin)
10621{
10622 g_object_class_override_property (klass, property_id_begin++, "lock");
10623 g_object_class_override_property (klass, property_id_begin++, "name");
10624 return property_id_begin - 1;
10625}
10626
10627
10628
10629/**
10630 * SharedResource:
10631 *
10632 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link>.
10633 */
10634
10635/**
10636 * SharedResourceIface:
10637 * @parent_iface: The parent interface.
10638 * @handle_is_locked: Handler for the #SharedResource::handle-is-locked signal.
10639 * @handle_lock: Handler for the #SharedResource::handle-lock signal.
10640 * @handle_unlock: Handler for the #SharedResource::handle-unlock signal.
10641 * @get_lock: Getter for the #SharedResource:lock property.
10642 * @get_name: Getter for the #SharedResource:name property.
10643 *
10644 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link>.
10645 */
10646
10647typedef SharedResourceIface SharedResourceInterface;
10648G_DEFINE_INTERFACE (SharedResource, shared_resource, G_TYPE_OBJECT);
10649
10650static void
10651shared_resource_default_init (SharedResourceIface *iface)
10652{
10653 /* GObject signals for incoming D-Bus method calls: */
10654 /**
10655 * SharedResource::handle-lock:
10656 * @object: A #SharedResource.
10657 * @invocation: A #GDBusMethodInvocation.
10658 * @arg_name: Argument passed by remote caller.
10659 *
10660 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SharedResource.lock">lock()</link> D-Bus method.
10661 *
10662 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call shared_resource_complete_lock() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
10663 *
10664 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
10665 */
10666 g_signal_new ("handle-lock",
10667 G_TYPE_FROM_INTERFACE (iface),
10668 G_SIGNAL_RUN_LAST,
10669 G_STRUCT_OFFSET (SharedResourceIface, handle_lock),
10670 g_signal_accumulator_true_handled,
10671 NULL,
10672 g_cclosure_marshal_generic,
10673 G_TYPE_BOOLEAN,
10674 2,
10675 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING);
10676
10677 /**
10678 * SharedResource::handle-unlock:
10679 * @object: A #SharedResource.
10680 * @invocation: A #GDBusMethodInvocation.
10681 *
10682 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SharedResource.unlock">unlock()</link> D-Bus method.
10683 *
10684 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call shared_resource_complete_unlock() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
10685 *
10686 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
10687 */
10688 g_signal_new ("handle-unlock",
10689 G_TYPE_FROM_INTERFACE (iface),
10690 G_SIGNAL_RUN_LAST,
10691 G_STRUCT_OFFSET (SharedResourceIface, handle_unlock),
10692 g_signal_accumulator_true_handled,
10693 NULL,
10694 g_cclosure_marshal_generic,
10695 G_TYPE_BOOLEAN,
10696 1,
10697 G_TYPE_DBUS_METHOD_INVOCATION);
10698
10699 /**
10700 * SharedResource::handle-is-locked:
10701 * @object: A #SharedResource.
10702 * @invocation: A #GDBusMethodInvocation.
10703 *
10704 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SharedResource.isLocked">isLocked()</link> D-Bus method.
10705 *
10706 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call shared_resource_complete_is_locked() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
10707 *
10708 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
10709 */
10710 g_signal_new ("handle-is-locked",
10711 G_TYPE_FROM_INTERFACE (iface),
10712 G_SIGNAL_RUN_LAST,
10713 G_STRUCT_OFFSET (SharedResourceIface, handle_is_locked),
10714 g_signal_accumulator_true_handled,
10715 NULL,
10716 g_cclosure_marshal_generic,
10717 G_TYPE_BOOLEAN,
10718 1,
10719 G_TYPE_DBUS_METHOD_INVOCATION);
10720
10721 /* GObject properties for D-Bus properties: */
10722 /**
10723 * SharedResource:lock:
10724 *
10725 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SharedResource.lock">"lock"</link>.
10726 *
10727 * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.
10728 */
10729 g_object_interface_install_property (iface,
10730 g_param_spec_boolean ("lock", "lock", "lock", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
10731 /**
10732 * SharedResource:name:
10733 *
10734 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SharedResource.name">"name"</link>.
10735 *
10736 * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.
10737 */
10738 g_object_interface_install_property (iface,
10739 g_param_spec_string ("name", "name", "name", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
10740}
10741
10742/**
10743 * shared_resource_get_lock: (skip)
10744 * @object: A #SharedResource.
10745 *
10746 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SharedResource.lock">"lock"</link> D-Bus property.
10747 *
10748 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
10749 *
10750 * Returns: The property value.
10751 */
10752gboolean
10753shared_resource_get_lock (SharedResource *object)
10754{
10755 return SHARED_RESOURCE_GET_IFACE (object)->get_lock (object);
10756}
10757
10758/**
10759 * shared_resource_set_lock: (skip)
10760 * @object: A #SharedResource.
10761 * @value: The value to set.
10762 *
10763 * Sets the <link linkend="gdbus-property-org-openbmc-SharedResource.lock">"lock"</link> D-Bus property to @value.
10764 *
10765 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
10766 */
10767void
10768shared_resource_set_lock (SharedResource *object, gboolean value)
10769{
10770 g_object_set (G_OBJECT (object), "lock", value, NULL);
10771}
10772
10773/**
10774 * shared_resource_get_name: (skip)
10775 * @object: A #SharedResource.
10776 *
10777 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SharedResource.name">"name"</link> D-Bus property.
10778 *
10779 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
10780 *
10781 * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use shared_resource_dup_name() if on another thread.</warning>
10782 *
10783 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
10784 */
10785const gchar *
10786shared_resource_get_name (SharedResource *object)
10787{
10788 return SHARED_RESOURCE_GET_IFACE (object)->get_name (object);
10789}
10790
10791/**
10792 * shared_resource_dup_name: (skip)
10793 * @object: A #SharedResource.
10794 *
10795 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SharedResource.name">"name"</link> D-Bus property.
10796 *
10797 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
10798 *
10799 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
10800 */
10801gchar *
10802shared_resource_dup_name (SharedResource *object)
10803{
10804 gchar *value;
10805 g_object_get (G_OBJECT (object), "name", &value, NULL);
10806 return value;
10807}
10808
10809/**
10810 * shared_resource_set_name: (skip)
10811 * @object: A #SharedResource.
10812 * @value: The value to set.
10813 *
10814 * Sets the <link linkend="gdbus-property-org-openbmc-SharedResource.name">"name"</link> D-Bus property to @value.
10815 *
10816 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
10817 */
10818void
10819shared_resource_set_name (SharedResource *object, const gchar *value)
10820{
10821 g_object_set (G_OBJECT (object), "name", value, NULL);
10822}
10823
10824/**
10825 * shared_resource_call_lock:
10826 * @proxy: A #SharedResourceProxy.
10827 * @arg_name: Argument to pass with the method invocation.
10828 * @cancellable: (allow-none): A #GCancellable or %NULL.
10829 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
10830 * @user_data: User data to pass to @callback.
10831 *
10832 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SharedResource.lock">lock()</link> D-Bus method on @proxy.
10833 * 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.
10834 * You can then call shared_resource_call_lock_finish() to get the result of the operation.
10835 *
10836 * See shared_resource_call_lock_sync() for the synchronous, blocking version of this method.
10837 */
10838void
10839shared_resource_call_lock (
10840 SharedResource *proxy,
10841 const gchar *arg_name,
10842 GCancellable *cancellable,
10843 GAsyncReadyCallback callback,
10844 gpointer user_data)
10845{
10846 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
10847 "lock",
10848 g_variant_new ("(s)",
10849 arg_name),
10850 G_DBUS_CALL_FLAGS_NONE,
10851 -1,
10852 cancellable,
10853 callback,
10854 user_data);
10855}
10856
10857/**
10858 * shared_resource_call_lock_finish:
10859 * @proxy: A #SharedResourceProxy.
10860 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to shared_resource_call_lock().
10861 * @error: Return location for error or %NULL.
10862 *
10863 * Finishes an operation started with shared_resource_call_lock().
10864 *
10865 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
10866 */
10867gboolean
10868shared_resource_call_lock_finish (
10869 SharedResource *proxy,
10870 GAsyncResult *res,
10871 GError **error)
10872{
10873 GVariant *_ret;
10874 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
10875 if (_ret == NULL)
10876 goto _out;
10877 g_variant_get (_ret,
10878 "()");
10879 g_variant_unref (_ret);
10880_out:
10881 return _ret != NULL;
10882}
10883
10884/**
10885 * shared_resource_call_lock_sync:
10886 * @proxy: A #SharedResourceProxy.
10887 * @arg_name: Argument to pass with the method invocation.
10888 * @cancellable: (allow-none): A #GCancellable or %NULL.
10889 * @error: Return location for error or %NULL.
10890 *
10891 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-SharedResource.lock">lock()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
10892 *
10893 * See shared_resource_call_lock() for the asynchronous version of this method.
10894 *
10895 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
10896 */
10897gboolean
10898shared_resource_call_lock_sync (
10899 SharedResource *proxy,
10900 const gchar *arg_name,
10901 GCancellable *cancellable,
10902 GError **error)
10903{
10904 GVariant *_ret;
10905 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
10906 "lock",
10907 g_variant_new ("(s)",
10908 arg_name),
10909 G_DBUS_CALL_FLAGS_NONE,
10910 -1,
10911 cancellable,
10912 error);
10913 if (_ret == NULL)
10914 goto _out;
10915 g_variant_get (_ret,
10916 "()");
10917 g_variant_unref (_ret);
10918_out:
10919 return _ret != NULL;
10920}
10921
10922/**
10923 * shared_resource_call_unlock:
10924 * @proxy: A #SharedResourceProxy.
10925 * @cancellable: (allow-none): A #GCancellable or %NULL.
10926 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
10927 * @user_data: User data to pass to @callback.
10928 *
10929 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SharedResource.unlock">unlock()</link> D-Bus method on @proxy.
10930 * 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.
10931 * You can then call shared_resource_call_unlock_finish() to get the result of the operation.
10932 *
10933 * See shared_resource_call_unlock_sync() for the synchronous, blocking version of this method.
10934 */
10935void
10936shared_resource_call_unlock (
10937 SharedResource *proxy,
10938 GCancellable *cancellable,
10939 GAsyncReadyCallback callback,
10940 gpointer user_data)
10941{
10942 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
10943 "unlock",
10944 g_variant_new ("()"),
10945 G_DBUS_CALL_FLAGS_NONE,
10946 -1,
10947 cancellable,
10948 callback,
10949 user_data);
10950}
10951
10952/**
10953 * shared_resource_call_unlock_finish:
10954 * @proxy: A #SharedResourceProxy.
10955 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to shared_resource_call_unlock().
10956 * @error: Return location for error or %NULL.
10957 *
10958 * Finishes an operation started with shared_resource_call_unlock().
10959 *
10960 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
10961 */
10962gboolean
10963shared_resource_call_unlock_finish (
10964 SharedResource *proxy,
10965 GAsyncResult *res,
10966 GError **error)
10967{
10968 GVariant *_ret;
10969 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
10970 if (_ret == NULL)
10971 goto _out;
10972 g_variant_get (_ret,
10973 "()");
10974 g_variant_unref (_ret);
10975_out:
10976 return _ret != NULL;
10977}
10978
10979/**
10980 * shared_resource_call_unlock_sync:
10981 * @proxy: A #SharedResourceProxy.
10982 * @cancellable: (allow-none): A #GCancellable or %NULL.
10983 * @error: Return location for error or %NULL.
10984 *
10985 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-SharedResource.unlock">unlock()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
10986 *
10987 * See shared_resource_call_unlock() for the asynchronous version of this method.
10988 *
10989 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
10990 */
10991gboolean
10992shared_resource_call_unlock_sync (
10993 SharedResource *proxy,
10994 GCancellable *cancellable,
10995 GError **error)
10996{
10997 GVariant *_ret;
10998 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
10999 "unlock",
11000 g_variant_new ("()"),
11001 G_DBUS_CALL_FLAGS_NONE,
11002 -1,
11003 cancellable,
11004 error);
11005 if (_ret == NULL)
11006 goto _out;
11007 g_variant_get (_ret,
11008 "()");
11009 g_variant_unref (_ret);
11010_out:
11011 return _ret != NULL;
11012}
11013
11014/**
11015 * shared_resource_call_is_locked:
11016 * @proxy: A #SharedResourceProxy.
11017 * @cancellable: (allow-none): A #GCancellable or %NULL.
11018 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
11019 * @user_data: User data to pass to @callback.
11020 *
11021 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SharedResource.isLocked">isLocked()</link> D-Bus method on @proxy.
11022 * 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.
11023 * You can then call shared_resource_call_is_locked_finish() to get the result of the operation.
11024 *
11025 * See shared_resource_call_is_locked_sync() for the synchronous, blocking version of this method.
11026 */
11027void
11028shared_resource_call_is_locked (
11029 SharedResource *proxy,
11030 GCancellable *cancellable,
11031 GAsyncReadyCallback callback,
11032 gpointer user_data)
11033{
11034 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
11035 "isLocked",
11036 g_variant_new ("()"),
11037 G_DBUS_CALL_FLAGS_NONE,
11038 -1,
11039 cancellable,
11040 callback,
11041 user_data);
11042}
11043
11044/**
11045 * shared_resource_call_is_locked_finish:
11046 * @proxy: A #SharedResourceProxy.
11047 * @out_lock: (out): Return location for return parameter or %NULL to ignore.
11048 * @out_name: (out): Return location for return parameter or %NULL to ignore.
11049 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to shared_resource_call_is_locked().
11050 * @error: Return location for error or %NULL.
11051 *
11052 * Finishes an operation started with shared_resource_call_is_locked().
11053 *
11054 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
11055 */
11056gboolean
11057shared_resource_call_is_locked_finish (
11058 SharedResource *proxy,
11059 gboolean *out_lock,
11060 gchar **out_name,
11061 GAsyncResult *res,
11062 GError **error)
11063{
11064 GVariant *_ret;
11065 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
11066 if (_ret == NULL)
11067 goto _out;
11068 g_variant_get (_ret,
11069 "(bs)",
11070 out_lock,
11071 out_name);
11072 g_variant_unref (_ret);
11073_out:
11074 return _ret != NULL;
11075}
11076
11077/**
11078 * shared_resource_call_is_locked_sync:
11079 * @proxy: A #SharedResourceProxy.
11080 * @out_lock: (out): Return location for return parameter or %NULL to ignore.
11081 * @out_name: (out): Return location for return parameter or %NULL to ignore.
11082 * @cancellable: (allow-none): A #GCancellable or %NULL.
11083 * @error: Return location for error or %NULL.
11084 *
11085 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-SharedResource.isLocked">isLocked()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
11086 *
11087 * See shared_resource_call_is_locked() for the asynchronous version of this method.
11088 *
11089 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
11090 */
11091gboolean
11092shared_resource_call_is_locked_sync (
11093 SharedResource *proxy,
11094 gboolean *out_lock,
11095 gchar **out_name,
11096 GCancellable *cancellable,
11097 GError **error)
11098{
11099 GVariant *_ret;
11100 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
11101 "isLocked",
11102 g_variant_new ("()"),
11103 G_DBUS_CALL_FLAGS_NONE,
11104 -1,
11105 cancellable,
11106 error);
11107 if (_ret == NULL)
11108 goto _out;
11109 g_variant_get (_ret,
11110 "(bs)",
11111 out_lock,
11112 out_name);
11113 g_variant_unref (_ret);
11114_out:
11115 return _ret != NULL;
11116}
11117
11118/**
11119 * shared_resource_complete_lock:
11120 * @object: A #SharedResource.
11121 * @invocation: (transfer full): A #GDBusMethodInvocation.
11122 *
11123 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-SharedResource.lock">lock()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
11124 *
11125 * This method will free @invocation, you cannot use it afterwards.
11126 */
11127void
11128shared_resource_complete_lock (
11129 SharedResource *object,
11130 GDBusMethodInvocation *invocation)
11131{
11132 g_dbus_method_invocation_return_value (invocation,
11133 g_variant_new ("()"));
11134}
11135
11136/**
11137 * shared_resource_complete_unlock:
11138 * @object: A #SharedResource.
11139 * @invocation: (transfer full): A #GDBusMethodInvocation.
11140 *
11141 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-SharedResource.unlock">unlock()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
11142 *
11143 * This method will free @invocation, you cannot use it afterwards.
11144 */
11145void
11146shared_resource_complete_unlock (
11147 SharedResource *object,
11148 GDBusMethodInvocation *invocation)
11149{
11150 g_dbus_method_invocation_return_value (invocation,
11151 g_variant_new ("()"));
11152}
11153
11154/**
11155 * shared_resource_complete_is_locked:
11156 * @object: A #SharedResource.
11157 * @invocation: (transfer full): A #GDBusMethodInvocation.
11158 * @lock: Parameter to return.
11159 * @name: Parameter to return.
11160 *
11161 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-SharedResource.isLocked">isLocked()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
11162 *
11163 * This method will free @invocation, you cannot use it afterwards.
11164 */
11165void
11166shared_resource_complete_is_locked (
11167 SharedResource *object,
11168 GDBusMethodInvocation *invocation,
11169 gboolean lock,
11170 const gchar *name)
11171{
11172 g_dbus_method_invocation_return_value (invocation,
11173 g_variant_new ("(bs)",
11174 lock,
11175 name));
11176}
11177
11178/* ------------------------------------------------------------------------ */
11179
11180/**
11181 * SharedResourceProxy:
11182 *
11183 * The #SharedResourceProxy structure contains only private data and should only be accessed using the provided API.
11184 */
11185
11186/**
11187 * SharedResourceProxyClass:
11188 * @parent_class: The parent class.
11189 *
11190 * Class structure for #SharedResourceProxy.
11191 */
11192
11193struct _SharedResourceProxyPrivate
11194{
11195 GData *qdata;
11196};
11197
11198static void shared_resource_proxy_iface_init (SharedResourceIface *iface);
11199
11200#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
11201G_DEFINE_TYPE_WITH_CODE (SharedResourceProxy, shared_resource_proxy, G_TYPE_DBUS_PROXY,
11202 G_ADD_PRIVATE (SharedResourceProxy)
11203 G_IMPLEMENT_INTERFACE (TYPE_SHARED_RESOURCE, shared_resource_proxy_iface_init));
11204
11205#else
11206G_DEFINE_TYPE_WITH_CODE (SharedResourceProxy, shared_resource_proxy, G_TYPE_DBUS_PROXY,
11207 G_IMPLEMENT_INTERFACE (TYPE_SHARED_RESOURCE, shared_resource_proxy_iface_init));
11208
11209#endif
11210static void
11211shared_resource_proxy_finalize (GObject *object)
11212{
11213 SharedResourceProxy *proxy = SHARED_RESOURCE_PROXY (object);
11214 g_datalist_clear (&proxy->priv->qdata);
11215 G_OBJECT_CLASS (shared_resource_proxy_parent_class)->finalize (object);
11216}
11217
11218static void
11219shared_resource_proxy_get_property (GObject *object,
11220 guint prop_id,
11221 GValue *value,
11222 GParamSpec *pspec G_GNUC_UNUSED)
11223{
11224 const _ExtendedGDBusPropertyInfo *info;
11225 GVariant *variant;
11226 g_assert (prop_id != 0 && prop_id - 1 < 2);
11227 info = _shared_resource_property_info_pointers[prop_id - 1];
11228 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
11229 if (info->use_gvariant)
11230 {
11231 g_value_set_variant (value, variant);
11232 }
11233 else
11234 {
11235 if (variant != NULL)
11236 g_dbus_gvariant_to_gvalue (variant, value);
11237 }
11238 if (variant != NULL)
11239 g_variant_unref (variant);
11240}
11241
11242static void
11243shared_resource_proxy_set_property_cb (GDBusProxy *proxy,
11244 GAsyncResult *res,
11245 gpointer user_data)
11246{
11247 const _ExtendedGDBusPropertyInfo *info = user_data;
11248 GError *error;
11249 GVariant *_ret;
11250 error = NULL;
11251 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
11252 if (!_ret)
11253 {
11254 g_warning ("Error setting property '%s' on interface org.openbmc.SharedResource: %s (%s, %d)",
11255 info->parent_struct.name,
11256 error->message, g_quark_to_string (error->domain), error->code);
11257 g_error_free (error);
11258 }
11259 else
11260 {
11261 g_variant_unref (_ret);
11262 }
11263}
11264
11265static void
11266shared_resource_proxy_set_property (GObject *object,
11267 guint prop_id,
11268 const GValue *value,
11269 GParamSpec *pspec G_GNUC_UNUSED)
11270{
11271 const _ExtendedGDBusPropertyInfo *info;
11272 GVariant *variant;
11273 g_assert (prop_id != 0 && prop_id - 1 < 2);
11274 info = _shared_resource_property_info_pointers[prop_id - 1];
11275 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
11276 g_dbus_proxy_call (G_DBUS_PROXY (object),
11277 "org.freedesktop.DBus.Properties.Set",
11278 g_variant_new ("(ssv)", "org.openbmc.SharedResource", info->parent_struct.name, variant),
11279 G_DBUS_CALL_FLAGS_NONE,
11280 -1,
11281 NULL, (GAsyncReadyCallback) shared_resource_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
11282 g_variant_unref (variant);
11283}
11284
11285static void
11286shared_resource_proxy_g_signal (GDBusProxy *proxy,
11287 const gchar *sender_name G_GNUC_UNUSED,
11288 const gchar *signal_name,
11289 GVariant *parameters)
11290{
11291 _ExtendedGDBusSignalInfo *info;
11292 GVariantIter iter;
11293 GVariant *child;
11294 GValue *paramv;
11295 guint num_params;
11296 guint n;
11297 guint signal_id;
11298 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct, signal_name);
11299 if (info == NULL)
11300 return;
11301 num_params = g_variant_n_children (parameters);
11302 paramv = g_new0 (GValue, num_params + 1);
11303 g_value_init (&paramv[0], TYPE_SHARED_RESOURCE);
11304 g_value_set_object (&paramv[0], proxy);
11305 g_variant_iter_init (&iter, parameters);
11306 n = 1;
11307 while ((child = g_variant_iter_next_value (&iter)) != NULL)
11308 {
11309 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
11310 if (arg_info->use_gvariant)
11311 {
11312 g_value_init (&paramv[n], G_TYPE_VARIANT);
11313 g_value_set_variant (&paramv[n], child);
11314 n++;
11315 }
11316 else
11317 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
11318 g_variant_unref (child);
11319 }
11320 signal_id = g_signal_lookup (info->signal_name, TYPE_SHARED_RESOURCE);
11321 g_signal_emitv (paramv, signal_id, 0, NULL);
11322 for (n = 0; n < num_params + 1; n++)
11323 g_value_unset (&paramv[n]);
11324 g_free (paramv);
11325}
11326
11327static void
11328shared_resource_proxy_g_properties_changed (GDBusProxy *_proxy,
11329 GVariant *changed_properties,
11330 const gchar *const *invalidated_properties)
11331{
11332 SharedResourceProxy *proxy = SHARED_RESOURCE_PROXY (_proxy);
11333 guint n;
11334 const gchar *key;
11335 GVariantIter *iter;
11336 _ExtendedGDBusPropertyInfo *info;
11337 g_variant_get (changed_properties, "a{sv}", &iter);
11338 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
11339 {
11340 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct, key);
11341 g_datalist_remove_data (&proxy->priv->qdata, key);
11342 if (info != NULL)
11343 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
11344 }
11345 g_variant_iter_free (iter);
11346 for (n = 0; invalidated_properties[n] != NULL; n++)
11347 {
11348 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct, invalidated_properties[n]);
11349 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
11350 if (info != NULL)
11351 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
11352 }
11353}
11354
11355static gboolean
11356shared_resource_proxy_get_lock (SharedResource *object)
11357{
11358 SharedResourceProxy *proxy = SHARED_RESOURCE_PROXY (object);
11359 GVariant *variant;
11360 gboolean value = 0;
11361 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "lock");
11362 if (variant != NULL)
11363 {
11364 value = g_variant_get_boolean (variant);
11365 g_variant_unref (variant);
11366 }
11367 return value;
11368}
11369
11370static const gchar *
11371shared_resource_proxy_get_name (SharedResource *object)
11372{
11373 SharedResourceProxy *proxy = SHARED_RESOURCE_PROXY (object);
11374 GVariant *variant;
11375 const gchar *value = NULL;
11376 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "name");
11377 if (variant != NULL)
11378 {
11379 value = g_variant_get_string (variant, NULL);
11380 g_variant_unref (variant);
11381 }
11382 return value;
11383}
11384
11385static void
11386shared_resource_proxy_init (SharedResourceProxy *proxy)
11387{
11388#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
11389 proxy->priv = shared_resource_proxy_get_instance_private (proxy);
11390#else
11391 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SHARED_RESOURCE_PROXY, SharedResourceProxyPrivate);
11392#endif
11393
11394 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), shared_resource_interface_info ());
11395}
11396
11397static void
11398shared_resource_proxy_class_init (SharedResourceProxyClass *klass)
11399{
11400 GObjectClass *gobject_class;
11401 GDBusProxyClass *proxy_class;
11402
11403 gobject_class = G_OBJECT_CLASS (klass);
11404 gobject_class->finalize = shared_resource_proxy_finalize;
11405 gobject_class->get_property = shared_resource_proxy_get_property;
11406 gobject_class->set_property = shared_resource_proxy_set_property;
11407
11408 proxy_class = G_DBUS_PROXY_CLASS (klass);
11409 proxy_class->g_signal = shared_resource_proxy_g_signal;
11410 proxy_class->g_properties_changed = shared_resource_proxy_g_properties_changed;
11411
11412 shared_resource_override_properties (gobject_class, 1);
11413
11414#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
11415 g_type_class_add_private (klass, sizeof (SharedResourceProxyPrivate));
11416#endif
11417}
11418
11419static void
11420shared_resource_proxy_iface_init (SharedResourceIface *iface)
11421{
11422 iface->get_lock = shared_resource_proxy_get_lock;
11423 iface->get_name = shared_resource_proxy_get_name;
11424}
11425
11426/**
11427 * shared_resource_proxy_new:
11428 * @connection: A #GDBusConnection.
11429 * @flags: Flags from the #GDBusProxyFlags enumeration.
11430 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
11431 * @object_path: An object path.
11432 * @cancellable: (allow-none): A #GCancellable or %NULL.
11433 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
11434 * @user_data: User data to pass to @callback.
11435 *
11436 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link>. See g_dbus_proxy_new() for more details.
11437 *
11438 * 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.
11439 * You can then call shared_resource_proxy_new_finish() to get the result of the operation.
11440 *
11441 * See shared_resource_proxy_new_sync() for the synchronous, blocking version of this constructor.
11442 */
11443void
11444shared_resource_proxy_new (
11445 GDBusConnection *connection,
11446 GDBusProxyFlags flags,
11447 const gchar *name,
11448 const gchar *object_path,
11449 GCancellable *cancellable,
11450 GAsyncReadyCallback callback,
11451 gpointer user_data)
11452{
11453 g_async_initable_new_async (TYPE_SHARED_RESOURCE_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.SharedResource", NULL);
11454}
11455
11456/**
11457 * shared_resource_proxy_new_finish:
11458 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to shared_resource_proxy_new().
11459 * @error: Return location for error or %NULL
11460 *
11461 * Finishes an operation started with shared_resource_proxy_new().
11462 *
11463 * Returns: (transfer full) (type SharedResourceProxy): The constructed proxy object or %NULL if @error is set.
11464 */
11465SharedResource *
11466shared_resource_proxy_new_finish (
11467 GAsyncResult *res,
11468 GError **error)
11469{
11470 GObject *ret;
11471 GObject *source_object;
11472 source_object = g_async_result_get_source_object (res);
11473 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
11474 g_object_unref (source_object);
11475 if (ret != NULL)
11476 return SHARED_RESOURCE (ret);
11477 else
11478 return NULL;
11479}
11480
11481/**
11482 * shared_resource_proxy_new_sync:
11483 * @connection: A #GDBusConnection.
11484 * @flags: Flags from the #GDBusProxyFlags enumeration.
11485 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
11486 * @object_path: An object path.
11487 * @cancellable: (allow-none): A #GCancellable or %NULL.
11488 * @error: Return location for error or %NULL
11489 *
11490 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link>. See g_dbus_proxy_new_sync() for more details.
11491 *
11492 * The calling thread is blocked until a reply is received.
11493 *
11494 * See shared_resource_proxy_new() for the asynchronous version of this constructor.
11495 *
11496 * Returns: (transfer full) (type SharedResourceProxy): The constructed proxy object or %NULL if @error is set.
11497 */
11498SharedResource *
11499shared_resource_proxy_new_sync (
11500 GDBusConnection *connection,
11501 GDBusProxyFlags flags,
11502 const gchar *name,
11503 const gchar *object_path,
11504 GCancellable *cancellable,
11505 GError **error)
11506{
11507 GInitable *ret;
11508 ret = g_initable_new (TYPE_SHARED_RESOURCE_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.SharedResource", NULL);
11509 if (ret != NULL)
11510 return SHARED_RESOURCE (ret);
11511 else
11512 return NULL;
11513}
11514
11515
11516/**
11517 * shared_resource_proxy_new_for_bus:
11518 * @bus_type: A #GBusType.
11519 * @flags: Flags from the #GDBusProxyFlags enumeration.
11520 * @name: A bus name (well-known or unique).
11521 * @object_path: An object path.
11522 * @cancellable: (allow-none): A #GCancellable or %NULL.
11523 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
11524 * @user_data: User data to pass to @callback.
11525 *
11526 * Like shared_resource_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
11527 *
11528 * 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.
11529 * You can then call shared_resource_proxy_new_for_bus_finish() to get the result of the operation.
11530 *
11531 * See shared_resource_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
11532 */
11533void
11534shared_resource_proxy_new_for_bus (
11535 GBusType bus_type,
11536 GDBusProxyFlags flags,
11537 const gchar *name,
11538 const gchar *object_path,
11539 GCancellable *cancellable,
11540 GAsyncReadyCallback callback,
11541 gpointer user_data)
11542{
11543 g_async_initable_new_async (TYPE_SHARED_RESOURCE_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.SharedResource", NULL);
11544}
11545
11546/**
11547 * shared_resource_proxy_new_for_bus_finish:
11548 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to shared_resource_proxy_new_for_bus().
11549 * @error: Return location for error or %NULL
11550 *
11551 * Finishes an operation started with shared_resource_proxy_new_for_bus().
11552 *
11553 * Returns: (transfer full) (type SharedResourceProxy): The constructed proxy object or %NULL if @error is set.
11554 */
11555SharedResource *
11556shared_resource_proxy_new_for_bus_finish (
11557 GAsyncResult *res,
11558 GError **error)
11559{
11560 GObject *ret;
11561 GObject *source_object;
11562 source_object = g_async_result_get_source_object (res);
11563 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
11564 g_object_unref (source_object);
11565 if (ret != NULL)
11566 return SHARED_RESOURCE (ret);
11567 else
11568 return NULL;
11569}
11570
11571/**
11572 * shared_resource_proxy_new_for_bus_sync:
11573 * @bus_type: A #GBusType.
11574 * @flags: Flags from the #GDBusProxyFlags enumeration.
11575 * @name: A bus name (well-known or unique).
11576 * @object_path: An object path.
11577 * @cancellable: (allow-none): A #GCancellable or %NULL.
11578 * @error: Return location for error or %NULL
11579 *
11580 * Like shared_resource_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
11581 *
11582 * The calling thread is blocked until a reply is received.
11583 *
11584 * See shared_resource_proxy_new_for_bus() for the asynchronous version of this constructor.
11585 *
11586 * Returns: (transfer full) (type SharedResourceProxy): The constructed proxy object or %NULL if @error is set.
11587 */
11588SharedResource *
11589shared_resource_proxy_new_for_bus_sync (
11590 GBusType bus_type,
11591 GDBusProxyFlags flags,
11592 const gchar *name,
11593 const gchar *object_path,
11594 GCancellable *cancellable,
11595 GError **error)
11596{
11597 GInitable *ret;
11598 ret = g_initable_new (TYPE_SHARED_RESOURCE_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.SharedResource", NULL);
11599 if (ret != NULL)
11600 return SHARED_RESOURCE (ret);
11601 else
11602 return NULL;
11603}
11604
11605
11606/* ------------------------------------------------------------------------ */
11607
11608/**
11609 * SharedResourceSkeleton:
11610 *
11611 * The #SharedResourceSkeleton structure contains only private data and should only be accessed using the provided API.
11612 */
11613
11614/**
11615 * SharedResourceSkeletonClass:
11616 * @parent_class: The parent class.
11617 *
11618 * Class structure for #SharedResourceSkeleton.
11619 */
11620
11621struct _SharedResourceSkeletonPrivate
11622{
11623 GValue *properties;
11624 GList *changed_properties;
11625 GSource *changed_properties_idle_source;
11626 GMainContext *context;
11627 GMutex lock;
11628};
11629
11630static void
11631_shared_resource_skeleton_handle_method_call (
11632 GDBusConnection *connection G_GNUC_UNUSED,
11633 const gchar *sender G_GNUC_UNUSED,
11634 const gchar *object_path G_GNUC_UNUSED,
11635 const gchar *interface_name,
11636 const gchar *method_name,
11637 GVariant *parameters,
11638 GDBusMethodInvocation *invocation,
11639 gpointer user_data)
11640{
11641 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (user_data);
11642 _ExtendedGDBusMethodInfo *info;
11643 GVariantIter iter;
11644 GVariant *child;
11645 GValue *paramv;
11646 guint num_params;
11647 guint num_extra;
11648 guint n;
11649 guint signal_id;
11650 GValue return_value = G_VALUE_INIT;
11651 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
11652 g_assert (info != NULL);
11653 num_params = g_variant_n_children (parameters);
11654 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
11655 n = 0;
11656 g_value_init (&paramv[n], TYPE_SHARED_RESOURCE);
11657 g_value_set_object (&paramv[n++], skeleton);
11658 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
11659 g_value_set_object (&paramv[n++], invocation);
11660 if (info->pass_fdlist)
11661 {
11662#ifdef G_OS_UNIX
11663 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
11664 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
11665#else
11666 g_assert_not_reached ();
11667#endif
11668 }
11669 g_variant_iter_init (&iter, parameters);
11670 while ((child = g_variant_iter_next_value (&iter)) != NULL)
11671 {
11672 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
11673 if (arg_info->use_gvariant)
11674 {
11675 g_value_init (&paramv[n], G_TYPE_VARIANT);
11676 g_value_set_variant (&paramv[n], child);
11677 n++;
11678 }
11679 else
11680 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
11681 g_variant_unref (child);
11682 }
11683 signal_id = g_signal_lookup (info->signal_name, TYPE_SHARED_RESOURCE);
11684 g_value_init (&return_value, G_TYPE_BOOLEAN);
11685 g_signal_emitv (paramv, signal_id, 0, &return_value);
11686 if (!g_value_get_boolean (&return_value))
11687 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);
11688 g_value_unset (&return_value);
11689 for (n = 0; n < num_params + num_extra; n++)
11690 g_value_unset (&paramv[n]);
11691 g_free (paramv);
11692}
11693
11694static GVariant *
11695_shared_resource_skeleton_handle_get_property (
11696 GDBusConnection *connection G_GNUC_UNUSED,
11697 const gchar *sender G_GNUC_UNUSED,
11698 const gchar *object_path G_GNUC_UNUSED,
11699 const gchar *interface_name G_GNUC_UNUSED,
11700 const gchar *property_name,
11701 GError **error,
11702 gpointer user_data)
11703{
11704 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (user_data);
11705 GValue value = G_VALUE_INIT;
11706 GParamSpec *pspec;
11707 _ExtendedGDBusPropertyInfo *info;
11708 GVariant *ret;
11709 ret = NULL;
11710 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct, property_name);
11711 g_assert (info != NULL);
11712 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
11713 if (pspec == NULL)
11714 {
11715 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
11716 }
11717 else
11718 {
11719 g_value_init (&value, pspec->value_type);
11720 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
11721 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
11722 g_value_unset (&value);
11723 }
11724 return ret;
11725}
11726
11727static gboolean
11728_shared_resource_skeleton_handle_set_property (
11729 GDBusConnection *connection G_GNUC_UNUSED,
11730 const gchar *sender G_GNUC_UNUSED,
11731 const gchar *object_path G_GNUC_UNUSED,
11732 const gchar *interface_name G_GNUC_UNUSED,
11733 const gchar *property_name,
11734 GVariant *variant,
11735 GError **error,
11736 gpointer user_data)
11737{
11738 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (user_data);
11739 GValue value = G_VALUE_INIT;
11740 GParamSpec *pspec;
11741 _ExtendedGDBusPropertyInfo *info;
11742 gboolean ret;
11743 ret = FALSE;
11744 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct, property_name);
11745 g_assert (info != NULL);
11746 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
11747 if (pspec == NULL)
11748 {
11749 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
11750 }
11751 else
11752 {
11753 if (info->use_gvariant)
11754 g_value_set_variant (&value, variant);
11755 else
11756 g_dbus_gvariant_to_gvalue (variant, &value);
11757 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
11758 g_value_unset (&value);
11759 ret = TRUE;
11760 }
11761 return ret;
11762}
11763
11764static const GDBusInterfaceVTable _shared_resource_skeleton_vtable =
11765{
11766 _shared_resource_skeleton_handle_method_call,
11767 _shared_resource_skeleton_handle_get_property,
11768 _shared_resource_skeleton_handle_set_property,
11769 {NULL}
11770};
11771
11772static GDBusInterfaceInfo *
11773shared_resource_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
11774{
11775 return shared_resource_interface_info ();
11776}
11777
11778static GDBusInterfaceVTable *
11779shared_resource_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
11780{
11781 return (GDBusInterfaceVTable *) &_shared_resource_skeleton_vtable;
11782}
11783
11784static GVariant *
11785shared_resource_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
11786{
11787 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (_skeleton);
11788
11789 GVariantBuilder builder;
11790 guint n;
11791 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
11792 if (_shared_resource_interface_info.parent_struct.properties == NULL)
11793 goto out;
11794 for (n = 0; _shared_resource_interface_info.parent_struct.properties[n] != NULL; n++)
11795 {
11796 GDBusPropertyInfo *info = _shared_resource_interface_info.parent_struct.properties[n];
11797 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
11798 {
11799 GVariant *value;
11800 value = _shared_resource_skeleton_handle_get_property (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SharedResource", info->name, NULL, skeleton);
11801 if (value != NULL)
11802 {
11803 g_variant_take_ref (value);
11804 g_variant_builder_add (&builder, "{sv}", info->name, value);
11805 g_variant_unref (value);
11806 }
11807 }
11808 }
11809out:
11810 return g_variant_builder_end (&builder);
11811}
11812
11813static gboolean _shared_resource_emit_changed (gpointer user_data);
11814
11815static void
11816shared_resource_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
11817{
11818 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (_skeleton);
11819 gboolean emit_changed = FALSE;
11820
11821 g_mutex_lock (&skeleton->priv->lock);
11822 if (skeleton->priv->changed_properties_idle_source != NULL)
11823 {
11824 g_source_destroy (skeleton->priv->changed_properties_idle_source);
11825 skeleton->priv->changed_properties_idle_source = NULL;
11826 emit_changed = TRUE;
11827 }
11828 g_mutex_unlock (&skeleton->priv->lock);
11829
11830 if (emit_changed)
11831 _shared_resource_emit_changed (skeleton);
11832}
11833
11834static void shared_resource_skeleton_iface_init (SharedResourceIface *iface);
11835#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
11836G_DEFINE_TYPE_WITH_CODE (SharedResourceSkeleton, shared_resource_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
11837 G_ADD_PRIVATE (SharedResourceSkeleton)
11838 G_IMPLEMENT_INTERFACE (TYPE_SHARED_RESOURCE, shared_resource_skeleton_iface_init));
11839
11840#else
11841G_DEFINE_TYPE_WITH_CODE (SharedResourceSkeleton, shared_resource_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
11842 G_IMPLEMENT_INTERFACE (TYPE_SHARED_RESOURCE, shared_resource_skeleton_iface_init));
11843
11844#endif
11845static void
11846shared_resource_skeleton_finalize (GObject *object)
11847{
11848 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object);
11849 guint n;
11850 for (n = 0; n < 2; n++)
11851 g_value_unset (&skeleton->priv->properties[n]);
11852 g_free (skeleton->priv->properties);
11853 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
11854 if (skeleton->priv->changed_properties_idle_source != NULL)
11855 g_source_destroy (skeleton->priv->changed_properties_idle_source);
11856 g_main_context_unref (skeleton->priv->context);
11857 g_mutex_clear (&skeleton->priv->lock);
11858 G_OBJECT_CLASS (shared_resource_skeleton_parent_class)->finalize (object);
11859}
11860
11861static void
11862shared_resource_skeleton_get_property (GObject *object,
11863 guint prop_id,
11864 GValue *value,
11865 GParamSpec *pspec G_GNUC_UNUSED)
11866{
11867 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object);
11868 g_assert (prop_id != 0 && prop_id - 1 < 2);
11869 g_mutex_lock (&skeleton->priv->lock);
11870 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
11871 g_mutex_unlock (&skeleton->priv->lock);
11872}
11873
11874static gboolean
11875_shared_resource_emit_changed (gpointer user_data)
11876{
11877 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (user_data);
11878 GList *l;
11879 GVariantBuilder builder;
11880 GVariantBuilder invalidated_builder;
11881 guint num_changes;
11882
11883 g_mutex_lock (&skeleton->priv->lock);
11884 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
11885 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
11886 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
11887 {
11888 ChangedProperty *cp = l->data;
11889 GVariant *variant;
11890 const GValue *cur_value;
11891
11892 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
11893 if (!_g_value_equal (cur_value, &cp->orig_value))
11894 {
11895 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
11896 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
11897 g_variant_unref (variant);
11898 num_changes++;
11899 }
11900 }
11901 if (num_changes > 0)
11902 {
11903 GList *connections, *ll;
11904 GVariant *signal_variant;
11905 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SharedResource",
11906 &builder, &invalidated_builder));
11907 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
11908 for (ll = connections; ll != NULL; ll = ll->next)
11909 {
11910 GDBusConnection *connection = ll->data;
11911
11912 g_dbus_connection_emit_signal (connection,
11913 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
11914 "org.freedesktop.DBus.Properties",
11915 "PropertiesChanged",
11916 signal_variant,
11917 NULL);
11918 }
11919 g_variant_unref (signal_variant);
11920 g_list_free_full (connections, g_object_unref);
11921 }
11922 else
11923 {
11924 g_variant_builder_clear (&builder);
11925 g_variant_builder_clear (&invalidated_builder);
11926 }
11927 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
11928 skeleton->priv->changed_properties = NULL;
11929 skeleton->priv->changed_properties_idle_source = NULL;
11930 g_mutex_unlock (&skeleton->priv->lock);
11931 return FALSE;
11932}
11933
11934static void
11935_shared_resource_schedule_emit_changed (SharedResourceSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
11936{
11937 ChangedProperty *cp;
11938 GList *l;
11939 cp = NULL;
11940 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
11941 {
11942 ChangedProperty *i_cp = l->data;
11943 if (i_cp->info == info)
11944 {
11945 cp = i_cp;
11946 break;
11947 }
11948 }
11949 if (cp == NULL)
11950 {
11951 cp = g_new0 (ChangedProperty, 1);
11952 cp->prop_id = prop_id;
11953 cp->info = info;
11954 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
11955 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
11956 g_value_copy (orig_value, &cp->orig_value);
11957 }
11958}
11959
11960static void
11961shared_resource_skeleton_notify (GObject *object,
11962 GParamSpec *pspec G_GNUC_UNUSED)
11963{
11964 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object);
11965 g_mutex_lock (&skeleton->priv->lock);
11966 if (skeleton->priv->changed_properties != NULL &&
11967 skeleton->priv->changed_properties_idle_source == NULL)
11968 {
11969 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
11970 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
11971 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _shared_resource_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
Adriana Kobylakfd778822016-06-16 09:08:37 -050011972 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _shared_resource_emit_changed");
Norman James18998182015-10-11 21:54:53 -050011973 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
11974 g_source_unref (skeleton->priv->changed_properties_idle_source);
11975 }
11976 g_mutex_unlock (&skeleton->priv->lock);
11977}
11978
11979static void
11980shared_resource_skeleton_set_property (GObject *object,
11981 guint prop_id,
11982 const GValue *value,
11983 GParamSpec *pspec)
11984{
11985 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object);
11986 g_assert (prop_id != 0 && prop_id - 1 < 2);
11987 g_mutex_lock (&skeleton->priv->lock);
11988 g_object_freeze_notify (object);
11989 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
11990 {
11991 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
11992 _shared_resource_schedule_emit_changed (skeleton, _shared_resource_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
11993 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
11994 g_object_notify_by_pspec (object, pspec);
11995 }
11996 g_mutex_unlock (&skeleton->priv->lock);
11997 g_object_thaw_notify (object);
11998}
11999
12000static void
12001shared_resource_skeleton_init (SharedResourceSkeleton *skeleton)
12002{
12003#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
12004 skeleton->priv = shared_resource_skeleton_get_instance_private (skeleton);
12005#else
12006 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SHARED_RESOURCE_SKELETON, SharedResourceSkeletonPrivate);
12007#endif
12008
12009 g_mutex_init (&skeleton->priv->lock);
12010 skeleton->priv->context = g_main_context_ref_thread_default ();
12011 skeleton->priv->properties = g_new0 (GValue, 2);
12012 g_value_init (&skeleton->priv->properties[0], G_TYPE_BOOLEAN);
12013 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
12014}
12015
12016static gboolean
12017shared_resource_skeleton_get_lock (SharedResource *object)
12018{
12019 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object);
12020 gboolean value;
12021 g_mutex_lock (&skeleton->priv->lock);
12022 value = g_value_get_boolean (&(skeleton->priv->properties[0]));
12023 g_mutex_unlock (&skeleton->priv->lock);
12024 return value;
12025}
12026
12027static const gchar *
12028shared_resource_skeleton_get_name (SharedResource *object)
12029{
12030 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object);
12031 const gchar *value;
12032 g_mutex_lock (&skeleton->priv->lock);
12033 value = g_value_get_string (&(skeleton->priv->properties[1]));
12034 g_mutex_unlock (&skeleton->priv->lock);
12035 return value;
12036}
12037
12038static void
12039shared_resource_skeleton_class_init (SharedResourceSkeletonClass *klass)
12040{
12041 GObjectClass *gobject_class;
12042 GDBusInterfaceSkeletonClass *skeleton_class;
12043
12044 gobject_class = G_OBJECT_CLASS (klass);
12045 gobject_class->finalize = shared_resource_skeleton_finalize;
12046 gobject_class->get_property = shared_resource_skeleton_get_property;
12047 gobject_class->set_property = shared_resource_skeleton_set_property;
12048 gobject_class->notify = shared_resource_skeleton_notify;
12049
12050
12051 shared_resource_override_properties (gobject_class, 1);
12052
12053 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
12054 skeleton_class->get_info = shared_resource_skeleton_dbus_interface_get_info;
12055 skeleton_class->get_properties = shared_resource_skeleton_dbus_interface_get_properties;
12056 skeleton_class->flush = shared_resource_skeleton_dbus_interface_flush;
12057 skeleton_class->get_vtable = shared_resource_skeleton_dbus_interface_get_vtable;
12058
12059#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
12060 g_type_class_add_private (klass, sizeof (SharedResourceSkeletonPrivate));
12061#endif
12062}
12063
12064static void
12065shared_resource_skeleton_iface_init (SharedResourceIface *iface)
12066{
12067 iface->get_lock = shared_resource_skeleton_get_lock;
12068 iface->get_name = shared_resource_skeleton_get_name;
12069}
12070
12071/**
12072 * shared_resource_skeleton_new:
12073 *
12074 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link>.
12075 *
12076 * Returns: (transfer full) (type SharedResourceSkeleton): The skeleton object.
12077 */
12078SharedResource *
12079shared_resource_skeleton_new (void)
12080{
12081 return SHARED_RESOURCE (g_object_new (TYPE_SHARED_RESOURCE_SKELETON, NULL));
12082}
12083
12084/* ------------------------------------------------------------------------
Norman James362a80f2015-09-14 14:04:39 -050012085 * Code for interface org.openbmc.Control
12086 * ------------------------------------------------------------------------
12087 */
12088
12089/**
12090 * SECTION:Control
12091 * @title: Control
12092 * @short_description: Generated C code for the org.openbmc.Control D-Bus interface
12093 *
12094 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link> D-Bus interface in C.
12095 */
12096
12097/* ---- Introspection data for org.openbmc.Control ---- */
12098
12099static const _ExtendedGDBusMethodInfo _control_method_info_init =
12100{
12101 {
12102 -1,
12103 (gchar *) "init",
12104 NULL,
12105 NULL,
12106 NULL
12107 },
12108 "handle-init",
12109 FALSE
12110};
12111
12112static const _ExtendedGDBusMethodInfo * const _control_method_info_pointers[] =
12113{
12114 &_control_method_info_init,
12115 NULL
12116};
12117
12118static const _ExtendedGDBusArgInfo _control_signal_info_heartbeat_ARG_bus_name =
12119{
12120 {
12121 -1,
12122 (gchar *) "bus_name",
12123 (gchar *) "s",
12124 NULL
12125 },
12126 FALSE
12127};
12128
12129static const _ExtendedGDBusArgInfo * const _control_signal_info_heartbeat_ARG_pointers[] =
12130{
12131 &_control_signal_info_heartbeat_ARG_bus_name,
12132 NULL
12133};
12134
12135static const _ExtendedGDBusSignalInfo _control_signal_info_heartbeat =
12136{
12137 {
12138 -1,
12139 (gchar *) "Heartbeat",
12140 (GDBusArgInfo **) &_control_signal_info_heartbeat_ARG_pointers,
12141 NULL
12142 },
12143 "heartbeat"
12144};
12145
12146static const _ExtendedGDBusArgInfo _control_signal_info_goto_system_state_ARG_state_name =
12147{
12148 {
12149 -1,
12150 (gchar *) "state_name",
12151 (gchar *) "s",
12152 NULL
12153 },
12154 FALSE
12155};
12156
12157static const _ExtendedGDBusArgInfo * const _control_signal_info_goto_system_state_ARG_pointers[] =
12158{
12159 &_control_signal_info_goto_system_state_ARG_state_name,
12160 NULL
12161};
12162
12163static const _ExtendedGDBusSignalInfo _control_signal_info_goto_system_state =
12164{
12165 {
12166 -1,
12167 (gchar *) "GotoSystemState",
12168 (GDBusArgInfo **) &_control_signal_info_goto_system_state_ARG_pointers,
12169 NULL
12170 },
12171 "goto-system-state"
12172};
12173
Norman Jamesa3e47c42015-10-18 14:43:10 -050012174static const _ExtendedGDBusSignalInfo _control_signal_info_started =
12175{
12176 {
12177 -1,
12178 (gchar *) "Started",
12179 NULL,
12180 NULL
12181 },
12182 "started"
12183};
12184
Norman James362a80f2015-09-14 14:04:39 -050012185static const _ExtendedGDBusSignalInfo * const _control_signal_info_pointers[] =
12186{
12187 &_control_signal_info_heartbeat,
12188 &_control_signal_info_goto_system_state,
Norman Jamesa3e47c42015-10-18 14:43:10 -050012189 &_control_signal_info_started,
Norman James362a80f2015-09-14 14:04:39 -050012190 NULL
12191};
12192
12193static const _ExtendedGDBusPropertyInfo _control_property_info_poll_interval =
12194{
12195 {
12196 -1,
12197 (gchar *) "poll_interval",
12198 (gchar *) "i",
12199 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
12200 NULL
12201 },
12202 "poll-interval",
12203 FALSE
12204};
12205
12206static const _ExtendedGDBusPropertyInfo _control_property_info_heatbeat =
12207{
12208 {
12209 -1,
12210 (gchar *) "heatbeat",
12211 (gchar *) "i",
12212 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
12213 NULL
12214 },
12215 "heatbeat",
12216 FALSE
12217};
12218
12219static const _ExtendedGDBusPropertyInfo * const _control_property_info_pointers[] =
12220{
12221 &_control_property_info_poll_interval,
12222 &_control_property_info_heatbeat,
12223 NULL
12224};
12225
12226static const _ExtendedGDBusInterfaceInfo _control_interface_info =
12227{
12228 {
12229 -1,
12230 (gchar *) "org.openbmc.Control",
12231 (GDBusMethodInfo **) &_control_method_info_pointers,
12232 (GDBusSignalInfo **) &_control_signal_info_pointers,
12233 (GDBusPropertyInfo **) &_control_property_info_pointers,
12234 NULL
12235 },
12236 "control",
12237};
12238
12239
12240/**
12241 * control_interface_info:
12242 *
12243 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link> D-Bus interface.
12244 *
12245 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
12246 */
12247GDBusInterfaceInfo *
12248control_interface_info (void)
12249{
12250 return (GDBusInterfaceInfo *) &_control_interface_info.parent_struct;
12251}
12252
12253/**
12254 * control_override_properties:
12255 * @klass: The class structure for a #GObject<!-- -->-derived class.
12256 * @property_id_begin: The property id to assign to the first overridden property.
12257 *
12258 * Overrides all #GObject properties in the #Control interface for a concrete class.
12259 * The properties are overridden in the order they are defined.
12260 *
12261 * Returns: The last property id.
12262 */
12263guint
12264control_override_properties (GObjectClass *klass, guint property_id_begin)
12265{
12266 g_object_class_override_property (klass, property_id_begin++, "poll-interval");
12267 g_object_class_override_property (klass, property_id_begin++, "heatbeat");
12268 return property_id_begin - 1;
12269}
12270
12271
12272
12273/**
12274 * Control:
12275 *
12276 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link>.
12277 */
12278
12279/**
12280 * ControlIface:
12281 * @parent_iface: The parent interface.
12282 * @handle_init: Handler for the #Control::handle-init signal.
12283 * @get_heatbeat: Getter for the #Control:heatbeat property.
12284 * @get_poll_interval: Getter for the #Control:poll-interval property.
12285 * @goto_system_state: Handler for the #Control::goto-system-state signal.
12286 * @heartbeat: Handler for the #Control::heartbeat signal.
Norman Jamesa3e47c42015-10-18 14:43:10 -050012287 * @started: Handler for the #Control::started signal.
Norman James362a80f2015-09-14 14:04:39 -050012288 *
12289 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link>.
12290 */
12291
12292typedef ControlIface ControlInterface;
12293G_DEFINE_INTERFACE (Control, control, G_TYPE_OBJECT);
12294
12295static void
12296control_default_init (ControlIface *iface)
12297{
12298 /* GObject signals for incoming D-Bus method calls: */
12299 /**
12300 * Control::handle-init:
12301 * @object: A #Control.
12302 * @invocation: A #GDBusMethodInvocation.
12303 *
12304 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Control.init">init()</link> D-Bus method.
12305 *
12306 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call control_complete_init() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
12307 *
12308 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
12309 */
12310 g_signal_new ("handle-init",
12311 G_TYPE_FROM_INTERFACE (iface),
12312 G_SIGNAL_RUN_LAST,
12313 G_STRUCT_OFFSET (ControlIface, handle_init),
12314 g_signal_accumulator_true_handled,
12315 NULL,
12316 g_cclosure_marshal_generic,
12317 G_TYPE_BOOLEAN,
12318 1,
12319 G_TYPE_DBUS_METHOD_INVOCATION);
12320
12321 /* GObject signals for received D-Bus signals: */
12322 /**
12323 * Control::heartbeat:
12324 * @object: A #Control.
12325 * @arg_bus_name: Argument.
12326 *
12327 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Control.Heartbeat">"Heartbeat"</link> is received.
12328 *
12329 * 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.
12330 */
12331 g_signal_new ("heartbeat",
12332 G_TYPE_FROM_INTERFACE (iface),
12333 G_SIGNAL_RUN_LAST,
12334 G_STRUCT_OFFSET (ControlIface, heartbeat),
12335 NULL,
12336 NULL,
12337 g_cclosure_marshal_generic,
12338 G_TYPE_NONE,
12339 1, G_TYPE_STRING);
12340
12341 /**
12342 * Control::goto-system-state:
12343 * @object: A #Control.
12344 * @arg_state_name: Argument.
12345 *
12346 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Control.GotoSystemState">"GotoSystemState"</link> is received.
12347 *
12348 * 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.
12349 */
12350 g_signal_new ("goto-system-state",
12351 G_TYPE_FROM_INTERFACE (iface),
12352 G_SIGNAL_RUN_LAST,
12353 G_STRUCT_OFFSET (ControlIface, goto_system_state),
12354 NULL,
12355 NULL,
12356 g_cclosure_marshal_generic,
12357 G_TYPE_NONE,
12358 1, G_TYPE_STRING);
12359
Norman Jamesa3e47c42015-10-18 14:43:10 -050012360 /**
12361 * Control::started:
12362 * @object: A #Control.
12363 *
12364 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Control.Started">"Started"</link> is received.
12365 *
12366 * 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.
12367 */
12368 g_signal_new ("started",
12369 G_TYPE_FROM_INTERFACE (iface),
12370 G_SIGNAL_RUN_LAST,
12371 G_STRUCT_OFFSET (ControlIface, started),
12372 NULL,
12373 NULL,
12374 g_cclosure_marshal_generic,
12375 G_TYPE_NONE,
12376 0);
12377
Norman James362a80f2015-09-14 14:04:39 -050012378 /* GObject properties for D-Bus properties: */
12379 /**
12380 * Control:poll-interval:
12381 *
12382 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Control.poll_interval">"poll_interval"</link>.
12383 *
12384 * 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.
12385 */
12386 g_object_interface_install_property (iface,
12387 g_param_spec_int ("poll-interval", "poll_interval", "poll_interval", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
12388 /**
12389 * Control:heatbeat:
12390 *
12391 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Control.heatbeat">"heatbeat"</link>.
12392 *
12393 * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.
12394 */
12395 g_object_interface_install_property (iface,
12396 g_param_spec_int ("heatbeat", "heatbeat", "heatbeat", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
12397}
12398
12399/**
12400 * control_get_poll_interval: (skip)
12401 * @object: A #Control.
12402 *
12403 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Control.poll_interval">"poll_interval"</link> D-Bus property.
12404 *
12405 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
12406 *
12407 * Returns: The property value.
12408 */
12409gint
12410control_get_poll_interval (Control *object)
12411{
12412 return CONTROL_GET_IFACE (object)->get_poll_interval (object);
12413}
12414
12415/**
12416 * control_set_poll_interval: (skip)
12417 * @object: A #Control.
12418 * @value: The value to set.
12419 *
12420 * Sets the <link linkend="gdbus-property-org-openbmc-Control.poll_interval">"poll_interval"</link> D-Bus property to @value.
12421 *
12422 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
12423 */
12424void
12425control_set_poll_interval (Control *object, gint value)
12426{
12427 g_object_set (G_OBJECT (object), "poll-interval", value, NULL);
12428}
12429
12430/**
12431 * control_get_heatbeat: (skip)
12432 * @object: A #Control.
12433 *
12434 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Control.heatbeat">"heatbeat"</link> D-Bus property.
12435 *
12436 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
12437 *
12438 * Returns: The property value.
12439 */
12440gint
12441control_get_heatbeat (Control *object)
12442{
12443 return CONTROL_GET_IFACE (object)->get_heatbeat (object);
12444}
12445
12446/**
12447 * control_set_heatbeat: (skip)
12448 * @object: A #Control.
12449 * @value: The value to set.
12450 *
12451 * Sets the <link linkend="gdbus-property-org-openbmc-Control.heatbeat">"heatbeat"</link> D-Bus property to @value.
12452 *
12453 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
12454 */
12455void
12456control_set_heatbeat (Control *object, gint value)
12457{
12458 g_object_set (G_OBJECT (object), "heatbeat", value, NULL);
12459}
12460
12461/**
12462 * control_emit_heartbeat:
12463 * @object: A #Control.
12464 * @arg_bus_name: Argument to pass with the signal.
12465 *
12466 * Emits the <link linkend="gdbus-signal-org-openbmc-Control.Heartbeat">"Heartbeat"</link> D-Bus signal.
12467 */
12468void
12469control_emit_heartbeat (
12470 Control *object,
12471 const gchar *arg_bus_name)
12472{
12473 g_signal_emit_by_name (object, "heartbeat", arg_bus_name);
12474}
12475
12476/**
12477 * control_emit_goto_system_state:
12478 * @object: A #Control.
12479 * @arg_state_name: Argument to pass with the signal.
12480 *
12481 * Emits the <link linkend="gdbus-signal-org-openbmc-Control.GotoSystemState">"GotoSystemState"</link> D-Bus signal.
12482 */
12483void
12484control_emit_goto_system_state (
12485 Control *object,
12486 const gchar *arg_state_name)
12487{
12488 g_signal_emit_by_name (object, "goto-system-state", arg_state_name);
12489}
12490
12491/**
Norman Jamesa3e47c42015-10-18 14:43:10 -050012492 * control_emit_started:
12493 * @object: A #Control.
12494 *
12495 * Emits the <link linkend="gdbus-signal-org-openbmc-Control.Started">"Started"</link> D-Bus signal.
12496 */
12497void
12498control_emit_started (
12499 Control *object)
12500{
12501 g_signal_emit_by_name (object, "started");
12502}
12503
12504/**
Norman James362a80f2015-09-14 14:04:39 -050012505 * control_call_init:
12506 * @proxy: A #ControlProxy.
12507 * @cancellable: (allow-none): A #GCancellable or %NULL.
12508 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
12509 * @user_data: User data to pass to @callback.
12510 *
12511 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Control.init">init()</link> D-Bus method on @proxy.
12512 * 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.
12513 * You can then call control_call_init_finish() to get the result of the operation.
12514 *
12515 * See control_call_init_sync() for the synchronous, blocking version of this method.
12516 */
12517void
12518control_call_init (
12519 Control *proxy,
12520 GCancellable *cancellable,
12521 GAsyncReadyCallback callback,
12522 gpointer user_data)
12523{
12524 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
12525 "init",
12526 g_variant_new ("()"),
12527 G_DBUS_CALL_FLAGS_NONE,
12528 -1,
12529 cancellable,
12530 callback,
12531 user_data);
12532}
12533
12534/**
12535 * control_call_init_finish:
12536 * @proxy: A #ControlProxy.
12537 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_call_init().
12538 * @error: Return location for error or %NULL.
12539 *
12540 * Finishes an operation started with control_call_init().
12541 *
12542 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
12543 */
12544gboolean
12545control_call_init_finish (
12546 Control *proxy,
12547 GAsyncResult *res,
12548 GError **error)
12549{
12550 GVariant *_ret;
12551 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
12552 if (_ret == NULL)
12553 goto _out;
12554 g_variant_get (_ret,
12555 "()");
12556 g_variant_unref (_ret);
12557_out:
12558 return _ret != NULL;
12559}
12560
12561/**
12562 * control_call_init_sync:
12563 * @proxy: A #ControlProxy.
12564 * @cancellable: (allow-none): A #GCancellable or %NULL.
12565 * @error: Return location for error or %NULL.
12566 *
12567 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Control.init">init()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
12568 *
12569 * See control_call_init() for the asynchronous version of this method.
12570 *
12571 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
12572 */
12573gboolean
12574control_call_init_sync (
12575 Control *proxy,
12576 GCancellable *cancellable,
12577 GError **error)
12578{
12579 GVariant *_ret;
12580 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
12581 "init",
12582 g_variant_new ("()"),
12583 G_DBUS_CALL_FLAGS_NONE,
12584 -1,
12585 cancellable,
12586 error);
12587 if (_ret == NULL)
12588 goto _out;
12589 g_variant_get (_ret,
12590 "()");
12591 g_variant_unref (_ret);
12592_out:
12593 return _ret != NULL;
12594}
12595
12596/**
12597 * control_complete_init:
12598 * @object: A #Control.
12599 * @invocation: (transfer full): A #GDBusMethodInvocation.
12600 *
12601 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Control.init">init()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
12602 *
12603 * This method will free @invocation, you cannot use it afterwards.
12604 */
12605void
12606control_complete_init (
12607 Control *object,
12608 GDBusMethodInvocation *invocation)
12609{
12610 g_dbus_method_invocation_return_value (invocation,
12611 g_variant_new ("()"));
12612}
12613
12614/* ------------------------------------------------------------------------ */
12615
12616/**
12617 * ControlProxy:
12618 *
12619 * The #ControlProxy structure contains only private data and should only be accessed using the provided API.
12620 */
12621
12622/**
12623 * ControlProxyClass:
12624 * @parent_class: The parent class.
12625 *
12626 * Class structure for #ControlProxy.
12627 */
12628
12629struct _ControlProxyPrivate
12630{
12631 GData *qdata;
12632};
12633
12634static void control_proxy_iface_init (ControlIface *iface);
12635
12636#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
12637G_DEFINE_TYPE_WITH_CODE (ControlProxy, control_proxy, G_TYPE_DBUS_PROXY,
12638 G_ADD_PRIVATE (ControlProxy)
12639 G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_proxy_iface_init));
12640
12641#else
12642G_DEFINE_TYPE_WITH_CODE (ControlProxy, control_proxy, G_TYPE_DBUS_PROXY,
12643 G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_proxy_iface_init));
12644
12645#endif
12646static void
12647control_proxy_finalize (GObject *object)
12648{
12649 ControlProxy *proxy = CONTROL_PROXY (object);
12650 g_datalist_clear (&proxy->priv->qdata);
12651 G_OBJECT_CLASS (control_proxy_parent_class)->finalize (object);
12652}
12653
12654static void
12655control_proxy_get_property (GObject *object,
12656 guint prop_id,
12657 GValue *value,
12658 GParamSpec *pspec G_GNUC_UNUSED)
12659{
12660 const _ExtendedGDBusPropertyInfo *info;
12661 GVariant *variant;
12662 g_assert (prop_id != 0 && prop_id - 1 < 2);
12663 info = _control_property_info_pointers[prop_id - 1];
12664 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
12665 if (info->use_gvariant)
12666 {
12667 g_value_set_variant (value, variant);
12668 }
12669 else
12670 {
12671 if (variant != NULL)
12672 g_dbus_gvariant_to_gvalue (variant, value);
12673 }
12674 if (variant != NULL)
12675 g_variant_unref (variant);
12676}
12677
12678static void
12679control_proxy_set_property_cb (GDBusProxy *proxy,
12680 GAsyncResult *res,
12681 gpointer user_data)
12682{
12683 const _ExtendedGDBusPropertyInfo *info = user_data;
12684 GError *error;
12685 GVariant *_ret;
12686 error = NULL;
12687 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
12688 if (!_ret)
12689 {
12690 g_warning ("Error setting property '%s' on interface org.openbmc.Control: %s (%s, %d)",
12691 info->parent_struct.name,
12692 error->message, g_quark_to_string (error->domain), error->code);
12693 g_error_free (error);
12694 }
12695 else
12696 {
12697 g_variant_unref (_ret);
12698 }
12699}
12700
12701static void
12702control_proxy_set_property (GObject *object,
12703 guint prop_id,
12704 const GValue *value,
12705 GParamSpec *pspec G_GNUC_UNUSED)
12706{
12707 const _ExtendedGDBusPropertyInfo *info;
12708 GVariant *variant;
12709 g_assert (prop_id != 0 && prop_id - 1 < 2);
12710 info = _control_property_info_pointers[prop_id - 1];
12711 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
12712 g_dbus_proxy_call (G_DBUS_PROXY (object),
12713 "org.freedesktop.DBus.Properties.Set",
12714 g_variant_new ("(ssv)", "org.openbmc.Control", info->parent_struct.name, variant),
12715 G_DBUS_CALL_FLAGS_NONE,
12716 -1,
12717 NULL, (GAsyncReadyCallback) control_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
12718 g_variant_unref (variant);
12719}
12720
12721static void
12722control_proxy_g_signal (GDBusProxy *proxy,
12723 const gchar *sender_name G_GNUC_UNUSED,
12724 const gchar *signal_name,
12725 GVariant *parameters)
12726{
12727 _ExtendedGDBusSignalInfo *info;
12728 GVariantIter iter;
12729 GVariant *child;
12730 GValue *paramv;
12731 guint num_params;
12732 guint n;
12733 guint signal_id;
12734 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, signal_name);
12735 if (info == NULL)
12736 return;
12737 num_params = g_variant_n_children (parameters);
12738 paramv = g_new0 (GValue, num_params + 1);
12739 g_value_init (&paramv[0], TYPE_CONTROL);
12740 g_value_set_object (&paramv[0], proxy);
12741 g_variant_iter_init (&iter, parameters);
12742 n = 1;
12743 while ((child = g_variant_iter_next_value (&iter)) != NULL)
12744 {
12745 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
12746 if (arg_info->use_gvariant)
12747 {
12748 g_value_init (&paramv[n], G_TYPE_VARIANT);
12749 g_value_set_variant (&paramv[n], child);
12750 n++;
12751 }
12752 else
12753 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
12754 g_variant_unref (child);
12755 }
12756 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL);
12757 g_signal_emitv (paramv, signal_id, 0, NULL);
12758 for (n = 0; n < num_params + 1; n++)
12759 g_value_unset (&paramv[n]);
12760 g_free (paramv);
12761}
12762
12763static void
12764control_proxy_g_properties_changed (GDBusProxy *_proxy,
12765 GVariant *changed_properties,
12766 const gchar *const *invalidated_properties)
12767{
12768 ControlProxy *proxy = CONTROL_PROXY (_proxy);
12769 guint n;
12770 const gchar *key;
12771 GVariantIter *iter;
12772 _ExtendedGDBusPropertyInfo *info;
12773 g_variant_get (changed_properties, "a{sv}", &iter);
12774 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
12775 {
12776 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, key);
12777 g_datalist_remove_data (&proxy->priv->qdata, key);
12778 if (info != NULL)
12779 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
12780 }
12781 g_variant_iter_free (iter);
12782 for (n = 0; invalidated_properties[n] != NULL; n++)
12783 {
12784 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, invalidated_properties[n]);
12785 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
12786 if (info != NULL)
12787 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
12788 }
12789}
12790
12791static gint
12792control_proxy_get_poll_interval (Control *object)
12793{
12794 ControlProxy *proxy = CONTROL_PROXY (object);
12795 GVariant *variant;
12796 gint value = 0;
12797 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "poll_interval");
12798 if (variant != NULL)
12799 {
12800 value = g_variant_get_int32 (variant);
12801 g_variant_unref (variant);
12802 }
12803 return value;
12804}
12805
12806static gint
12807control_proxy_get_heatbeat (Control *object)
12808{
12809 ControlProxy *proxy = CONTROL_PROXY (object);
12810 GVariant *variant;
12811 gint value = 0;
12812 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "heatbeat");
12813 if (variant != NULL)
12814 {
12815 value = g_variant_get_int32 (variant);
12816 g_variant_unref (variant);
12817 }
12818 return value;
12819}
12820
12821static void
12822control_proxy_init (ControlProxy *proxy)
12823{
12824#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
12825 proxy->priv = control_proxy_get_instance_private (proxy);
12826#else
12827 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_PROXY, ControlProxyPrivate);
12828#endif
12829
12830 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_interface_info ());
12831}
12832
12833static void
12834control_proxy_class_init (ControlProxyClass *klass)
12835{
12836 GObjectClass *gobject_class;
12837 GDBusProxyClass *proxy_class;
12838
12839 gobject_class = G_OBJECT_CLASS (klass);
12840 gobject_class->finalize = control_proxy_finalize;
12841 gobject_class->get_property = control_proxy_get_property;
12842 gobject_class->set_property = control_proxy_set_property;
12843
12844 proxy_class = G_DBUS_PROXY_CLASS (klass);
12845 proxy_class->g_signal = control_proxy_g_signal;
12846 proxy_class->g_properties_changed = control_proxy_g_properties_changed;
12847
12848 control_override_properties (gobject_class, 1);
12849
12850#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
12851 g_type_class_add_private (klass, sizeof (ControlProxyPrivate));
12852#endif
12853}
12854
12855static void
12856control_proxy_iface_init (ControlIface *iface)
12857{
12858 iface->get_poll_interval = control_proxy_get_poll_interval;
12859 iface->get_heatbeat = control_proxy_get_heatbeat;
12860}
12861
12862/**
12863 * control_proxy_new:
12864 * @connection: A #GDBusConnection.
12865 * @flags: Flags from the #GDBusProxyFlags enumeration.
12866 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
12867 * @object_path: An object path.
12868 * @cancellable: (allow-none): A #GCancellable or %NULL.
12869 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
12870 * @user_data: User data to pass to @callback.
12871 *
12872 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link>. See g_dbus_proxy_new() for more details.
12873 *
12874 * 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.
12875 * You can then call control_proxy_new_finish() to get the result of the operation.
12876 *
12877 * See control_proxy_new_sync() for the synchronous, blocking version of this constructor.
12878 */
12879void
12880control_proxy_new (
12881 GDBusConnection *connection,
12882 GDBusProxyFlags flags,
12883 const gchar *name,
12884 const gchar *object_path,
12885 GCancellable *cancellable,
12886 GAsyncReadyCallback callback,
12887 gpointer user_data)
12888{
12889 g_async_initable_new_async (TYPE_CONTROL_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.Control", NULL);
12890}
12891
12892/**
12893 * control_proxy_new_finish:
12894 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_proxy_new().
12895 * @error: Return location for error or %NULL
12896 *
12897 * Finishes an operation started with control_proxy_new().
12898 *
12899 * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set.
12900 */
12901Control *
12902control_proxy_new_finish (
12903 GAsyncResult *res,
12904 GError **error)
12905{
12906 GObject *ret;
12907 GObject *source_object;
12908 source_object = g_async_result_get_source_object (res);
12909 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
12910 g_object_unref (source_object);
12911 if (ret != NULL)
12912 return CONTROL (ret);
12913 else
12914 return NULL;
12915}
12916
12917/**
12918 * control_proxy_new_sync:
12919 * @connection: A #GDBusConnection.
12920 * @flags: Flags from the #GDBusProxyFlags enumeration.
12921 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
12922 * @object_path: An object path.
12923 * @cancellable: (allow-none): A #GCancellable or %NULL.
12924 * @error: Return location for error or %NULL
12925 *
12926 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link>. See g_dbus_proxy_new_sync() for more details.
12927 *
12928 * The calling thread is blocked until a reply is received.
12929 *
12930 * See control_proxy_new() for the asynchronous version of this constructor.
12931 *
12932 * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set.
12933 */
12934Control *
12935control_proxy_new_sync (
12936 GDBusConnection *connection,
12937 GDBusProxyFlags flags,
12938 const gchar *name,
12939 const gchar *object_path,
12940 GCancellable *cancellable,
12941 GError **error)
12942{
12943 GInitable *ret;
12944 ret = g_initable_new (TYPE_CONTROL_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.Control", NULL);
12945 if (ret != NULL)
12946 return CONTROL (ret);
12947 else
12948 return NULL;
12949}
12950
12951
12952/**
12953 * control_proxy_new_for_bus:
12954 * @bus_type: A #GBusType.
12955 * @flags: Flags from the #GDBusProxyFlags enumeration.
12956 * @name: A bus name (well-known or unique).
12957 * @object_path: An object path.
12958 * @cancellable: (allow-none): A #GCancellable or %NULL.
12959 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
12960 * @user_data: User data to pass to @callback.
12961 *
12962 * Like control_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
12963 *
12964 * 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.
12965 * You can then call control_proxy_new_for_bus_finish() to get the result of the operation.
12966 *
12967 * See control_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
12968 */
12969void
12970control_proxy_new_for_bus (
12971 GBusType bus_type,
12972 GDBusProxyFlags flags,
12973 const gchar *name,
12974 const gchar *object_path,
12975 GCancellable *cancellable,
12976 GAsyncReadyCallback callback,
12977 gpointer user_data)
12978{
12979 g_async_initable_new_async (TYPE_CONTROL_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.Control", NULL);
12980}
12981
12982/**
12983 * control_proxy_new_for_bus_finish:
12984 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_proxy_new_for_bus().
12985 * @error: Return location for error or %NULL
12986 *
12987 * Finishes an operation started with control_proxy_new_for_bus().
12988 *
12989 * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set.
12990 */
12991Control *
12992control_proxy_new_for_bus_finish (
12993 GAsyncResult *res,
12994 GError **error)
12995{
12996 GObject *ret;
12997 GObject *source_object;
12998 source_object = g_async_result_get_source_object (res);
12999 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
13000 g_object_unref (source_object);
13001 if (ret != NULL)
13002 return CONTROL (ret);
13003 else
13004 return NULL;
13005}
13006
13007/**
13008 * control_proxy_new_for_bus_sync:
13009 * @bus_type: A #GBusType.
13010 * @flags: Flags from the #GDBusProxyFlags enumeration.
13011 * @name: A bus name (well-known or unique).
13012 * @object_path: An object path.
13013 * @cancellable: (allow-none): A #GCancellable or %NULL.
13014 * @error: Return location for error or %NULL
13015 *
13016 * Like control_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
13017 *
13018 * The calling thread is blocked until a reply is received.
13019 *
13020 * See control_proxy_new_for_bus() for the asynchronous version of this constructor.
13021 *
13022 * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set.
13023 */
13024Control *
13025control_proxy_new_for_bus_sync (
13026 GBusType bus_type,
13027 GDBusProxyFlags flags,
13028 const gchar *name,
13029 const gchar *object_path,
13030 GCancellable *cancellable,
13031 GError **error)
13032{
13033 GInitable *ret;
13034 ret = g_initable_new (TYPE_CONTROL_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.Control", NULL);
13035 if (ret != NULL)
13036 return CONTROL (ret);
13037 else
13038 return NULL;
13039}
13040
13041
13042/* ------------------------------------------------------------------------ */
13043
13044/**
13045 * ControlSkeleton:
13046 *
13047 * The #ControlSkeleton structure contains only private data and should only be accessed using the provided API.
13048 */
13049
13050/**
13051 * ControlSkeletonClass:
13052 * @parent_class: The parent class.
13053 *
13054 * Class structure for #ControlSkeleton.
13055 */
13056
13057struct _ControlSkeletonPrivate
13058{
13059 GValue *properties;
13060 GList *changed_properties;
13061 GSource *changed_properties_idle_source;
13062 GMainContext *context;
13063 GMutex lock;
13064};
13065
13066static void
13067_control_skeleton_handle_method_call (
13068 GDBusConnection *connection G_GNUC_UNUSED,
13069 const gchar *sender G_GNUC_UNUSED,
13070 const gchar *object_path G_GNUC_UNUSED,
13071 const gchar *interface_name,
13072 const gchar *method_name,
13073 GVariant *parameters,
13074 GDBusMethodInvocation *invocation,
13075 gpointer user_data)
13076{
13077 ControlSkeleton *skeleton = CONTROL_SKELETON (user_data);
13078 _ExtendedGDBusMethodInfo *info;
13079 GVariantIter iter;
13080 GVariant *child;
13081 GValue *paramv;
13082 guint num_params;
13083 guint num_extra;
13084 guint n;
13085 guint signal_id;
13086 GValue return_value = G_VALUE_INIT;
13087 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
13088 g_assert (info != NULL);
13089 num_params = g_variant_n_children (parameters);
13090 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
13091 n = 0;
13092 g_value_init (&paramv[n], TYPE_CONTROL);
13093 g_value_set_object (&paramv[n++], skeleton);
13094 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
13095 g_value_set_object (&paramv[n++], invocation);
13096 if (info->pass_fdlist)
13097 {
13098#ifdef G_OS_UNIX
13099 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
13100 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
13101#else
13102 g_assert_not_reached ();
13103#endif
13104 }
13105 g_variant_iter_init (&iter, parameters);
13106 while ((child = g_variant_iter_next_value (&iter)) != NULL)
13107 {
13108 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
13109 if (arg_info->use_gvariant)
13110 {
13111 g_value_init (&paramv[n], G_TYPE_VARIANT);
13112 g_value_set_variant (&paramv[n], child);
13113 n++;
13114 }
13115 else
13116 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
13117 g_variant_unref (child);
13118 }
13119 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL);
13120 g_value_init (&return_value, G_TYPE_BOOLEAN);
13121 g_signal_emitv (paramv, signal_id, 0, &return_value);
13122 if (!g_value_get_boolean (&return_value))
13123 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);
13124 g_value_unset (&return_value);
13125 for (n = 0; n < num_params + num_extra; n++)
13126 g_value_unset (&paramv[n]);
13127 g_free (paramv);
13128}
13129
13130static GVariant *
13131_control_skeleton_handle_get_property (
13132 GDBusConnection *connection G_GNUC_UNUSED,
13133 const gchar *sender G_GNUC_UNUSED,
13134 const gchar *object_path G_GNUC_UNUSED,
13135 const gchar *interface_name G_GNUC_UNUSED,
13136 const gchar *property_name,
13137 GError **error,
13138 gpointer user_data)
13139{
13140 ControlSkeleton *skeleton = CONTROL_SKELETON (user_data);
13141 GValue value = G_VALUE_INIT;
13142 GParamSpec *pspec;
13143 _ExtendedGDBusPropertyInfo *info;
13144 GVariant *ret;
13145 ret = NULL;
13146 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, property_name);
13147 g_assert (info != NULL);
13148 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
13149 if (pspec == NULL)
13150 {
13151 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
13152 }
13153 else
13154 {
13155 g_value_init (&value, pspec->value_type);
13156 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
13157 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
13158 g_value_unset (&value);
13159 }
13160 return ret;
13161}
13162
13163static gboolean
13164_control_skeleton_handle_set_property (
13165 GDBusConnection *connection G_GNUC_UNUSED,
13166 const gchar *sender G_GNUC_UNUSED,
13167 const gchar *object_path G_GNUC_UNUSED,
13168 const gchar *interface_name G_GNUC_UNUSED,
13169 const gchar *property_name,
13170 GVariant *variant,
13171 GError **error,
13172 gpointer user_data)
13173{
13174 ControlSkeleton *skeleton = CONTROL_SKELETON (user_data);
13175 GValue value = G_VALUE_INIT;
13176 GParamSpec *pspec;
13177 _ExtendedGDBusPropertyInfo *info;
13178 gboolean ret;
13179 ret = FALSE;
13180 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, property_name);
13181 g_assert (info != NULL);
13182 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
13183 if (pspec == NULL)
13184 {
13185 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
13186 }
13187 else
13188 {
13189 if (info->use_gvariant)
13190 g_value_set_variant (&value, variant);
13191 else
13192 g_dbus_gvariant_to_gvalue (variant, &value);
13193 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
13194 g_value_unset (&value);
13195 ret = TRUE;
13196 }
13197 return ret;
13198}
13199
13200static const GDBusInterfaceVTable _control_skeleton_vtable =
13201{
13202 _control_skeleton_handle_method_call,
13203 _control_skeleton_handle_get_property,
13204 _control_skeleton_handle_set_property,
13205 {NULL}
13206};
13207
13208static GDBusInterfaceInfo *
13209control_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
13210{
13211 return control_interface_info ();
13212}
13213
13214static GDBusInterfaceVTable *
13215control_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
13216{
13217 return (GDBusInterfaceVTable *) &_control_skeleton_vtable;
13218}
13219
13220static GVariant *
13221control_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
13222{
13223 ControlSkeleton *skeleton = CONTROL_SKELETON (_skeleton);
13224
13225 GVariantBuilder builder;
13226 guint n;
13227 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
13228 if (_control_interface_info.parent_struct.properties == NULL)
13229 goto out;
13230 for (n = 0; _control_interface_info.parent_struct.properties[n] != NULL; n++)
13231 {
13232 GDBusPropertyInfo *info = _control_interface_info.parent_struct.properties[n];
13233 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
13234 {
13235 GVariant *value;
13236 value = _control_skeleton_handle_get_property (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Control", info->name, NULL, skeleton);
13237 if (value != NULL)
13238 {
13239 g_variant_take_ref (value);
13240 g_variant_builder_add (&builder, "{sv}", info->name, value);
13241 g_variant_unref (value);
13242 }
13243 }
13244 }
13245out:
13246 return g_variant_builder_end (&builder);
13247}
13248
13249static gboolean _control_emit_changed (gpointer user_data);
13250
13251static void
13252control_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
13253{
13254 ControlSkeleton *skeleton = CONTROL_SKELETON (_skeleton);
13255 gboolean emit_changed = FALSE;
13256
13257 g_mutex_lock (&skeleton->priv->lock);
13258 if (skeleton->priv->changed_properties_idle_source != NULL)
13259 {
13260 g_source_destroy (skeleton->priv->changed_properties_idle_source);
13261 skeleton->priv->changed_properties_idle_source = NULL;
13262 emit_changed = TRUE;
13263 }
13264 g_mutex_unlock (&skeleton->priv->lock);
13265
13266 if (emit_changed)
13267 _control_emit_changed (skeleton);
13268}
13269
13270static void
13271_control_on_signal_heartbeat (
13272 Control *object,
13273 const gchar *arg_bus_name)
13274{
13275 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
13276
13277 GList *connections, *l;
13278 GVariant *signal_variant;
13279 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
13280
13281 signal_variant = g_variant_ref_sink (g_variant_new ("(s)",
13282 arg_bus_name));
13283 for (l = connections; l != NULL; l = l->next)
13284 {
13285 GDBusConnection *connection = l->data;
13286 g_dbus_connection_emit_signal (connection,
13287 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Control", "Heartbeat",
13288 signal_variant, NULL);
13289 }
13290 g_variant_unref (signal_variant);
13291 g_list_free_full (connections, g_object_unref);
13292}
13293
13294static void
13295_control_on_signal_goto_system_state (
13296 Control *object,
13297 const gchar *arg_state_name)
13298{
13299 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
13300
13301 GList *connections, *l;
13302 GVariant *signal_variant;
13303 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
13304
13305 signal_variant = g_variant_ref_sink (g_variant_new ("(s)",
13306 arg_state_name));
13307 for (l = connections; l != NULL; l = l->next)
13308 {
13309 GDBusConnection *connection = l->data;
13310 g_dbus_connection_emit_signal (connection,
13311 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Control", "GotoSystemState",
13312 signal_variant, NULL);
13313 }
13314 g_variant_unref (signal_variant);
13315 g_list_free_full (connections, g_object_unref);
13316}
13317
Norman Jamesa3e47c42015-10-18 14:43:10 -050013318static void
13319_control_on_signal_started (
13320 Control *object)
13321{
13322 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
13323
13324 GList *connections, *l;
13325 GVariant *signal_variant;
13326 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
13327
13328 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
13329 for (l = connections; l != NULL; l = l->next)
13330 {
13331 GDBusConnection *connection = l->data;
13332 g_dbus_connection_emit_signal (connection,
13333 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Control", "Started",
13334 signal_variant, NULL);
13335 }
13336 g_variant_unref (signal_variant);
13337 g_list_free_full (connections, g_object_unref);
13338}
13339
Norman James362a80f2015-09-14 14:04:39 -050013340static void control_skeleton_iface_init (ControlIface *iface);
13341#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
13342G_DEFINE_TYPE_WITH_CODE (ControlSkeleton, control_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
13343 G_ADD_PRIVATE (ControlSkeleton)
13344 G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_skeleton_iface_init));
13345
13346#else
13347G_DEFINE_TYPE_WITH_CODE (ControlSkeleton, control_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
13348 G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_skeleton_iface_init));
13349
13350#endif
13351static void
13352control_skeleton_finalize (GObject *object)
13353{
13354 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
13355 guint n;
13356 for (n = 0; n < 2; n++)
13357 g_value_unset (&skeleton->priv->properties[n]);
13358 g_free (skeleton->priv->properties);
13359 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
13360 if (skeleton->priv->changed_properties_idle_source != NULL)
13361 g_source_destroy (skeleton->priv->changed_properties_idle_source);
13362 g_main_context_unref (skeleton->priv->context);
13363 g_mutex_clear (&skeleton->priv->lock);
13364 G_OBJECT_CLASS (control_skeleton_parent_class)->finalize (object);
13365}
13366
13367static void
13368control_skeleton_get_property (GObject *object,
13369 guint prop_id,
13370 GValue *value,
13371 GParamSpec *pspec G_GNUC_UNUSED)
13372{
13373 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
13374 g_assert (prop_id != 0 && prop_id - 1 < 2);
13375 g_mutex_lock (&skeleton->priv->lock);
13376 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
13377 g_mutex_unlock (&skeleton->priv->lock);
13378}
13379
13380static gboolean
13381_control_emit_changed (gpointer user_data)
13382{
13383 ControlSkeleton *skeleton = CONTROL_SKELETON (user_data);
13384 GList *l;
13385 GVariantBuilder builder;
13386 GVariantBuilder invalidated_builder;
13387 guint num_changes;
13388
13389 g_mutex_lock (&skeleton->priv->lock);
13390 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
13391 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
13392 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
13393 {
13394 ChangedProperty *cp = l->data;
13395 GVariant *variant;
13396 const GValue *cur_value;
13397
13398 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
13399 if (!_g_value_equal (cur_value, &cp->orig_value))
13400 {
13401 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
13402 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
13403 g_variant_unref (variant);
13404 num_changes++;
13405 }
13406 }
13407 if (num_changes > 0)
13408 {
13409 GList *connections, *ll;
13410 GVariant *signal_variant;
13411 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Control",
13412 &builder, &invalidated_builder));
13413 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
13414 for (ll = connections; ll != NULL; ll = ll->next)
13415 {
13416 GDBusConnection *connection = ll->data;
13417
13418 g_dbus_connection_emit_signal (connection,
13419 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
13420 "org.freedesktop.DBus.Properties",
13421 "PropertiesChanged",
13422 signal_variant,
13423 NULL);
13424 }
13425 g_variant_unref (signal_variant);
13426 g_list_free_full (connections, g_object_unref);
13427 }
13428 else
13429 {
13430 g_variant_builder_clear (&builder);
13431 g_variant_builder_clear (&invalidated_builder);
13432 }
13433 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
13434 skeleton->priv->changed_properties = NULL;
13435 skeleton->priv->changed_properties_idle_source = NULL;
13436 g_mutex_unlock (&skeleton->priv->lock);
13437 return FALSE;
13438}
13439
13440static void
13441_control_schedule_emit_changed (ControlSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
13442{
13443 ChangedProperty *cp;
13444 GList *l;
13445 cp = NULL;
13446 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
13447 {
13448 ChangedProperty *i_cp = l->data;
13449 if (i_cp->info == info)
13450 {
13451 cp = i_cp;
13452 break;
13453 }
13454 }
13455 if (cp == NULL)
13456 {
13457 cp = g_new0 (ChangedProperty, 1);
13458 cp->prop_id = prop_id;
13459 cp->info = info;
13460 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
13461 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
13462 g_value_copy (orig_value, &cp->orig_value);
13463 }
13464}
13465
13466static void
13467control_skeleton_notify (GObject *object,
13468 GParamSpec *pspec G_GNUC_UNUSED)
13469{
13470 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
13471 g_mutex_lock (&skeleton->priv->lock);
13472 if (skeleton->priv->changed_properties != NULL &&
13473 skeleton->priv->changed_properties_idle_source == NULL)
13474 {
13475 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
13476 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
13477 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _control_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
Adriana Kobylakfd778822016-06-16 09:08:37 -050013478 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _control_emit_changed");
Norman James362a80f2015-09-14 14:04:39 -050013479 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
13480 g_source_unref (skeleton->priv->changed_properties_idle_source);
13481 }
13482 g_mutex_unlock (&skeleton->priv->lock);
13483}
13484
13485static void
13486control_skeleton_set_property (GObject *object,
13487 guint prop_id,
13488 const GValue *value,
13489 GParamSpec *pspec)
13490{
13491 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
13492 g_assert (prop_id != 0 && prop_id - 1 < 2);
13493 g_mutex_lock (&skeleton->priv->lock);
13494 g_object_freeze_notify (object);
13495 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
13496 {
13497 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
13498 _control_schedule_emit_changed (skeleton, _control_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
13499 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
13500 g_object_notify_by_pspec (object, pspec);
13501 }
13502 g_mutex_unlock (&skeleton->priv->lock);
13503 g_object_thaw_notify (object);
13504}
13505
13506static void
13507control_skeleton_init (ControlSkeleton *skeleton)
13508{
13509#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
13510 skeleton->priv = control_skeleton_get_instance_private (skeleton);
13511#else
13512 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_SKELETON, ControlSkeletonPrivate);
13513#endif
13514
13515 g_mutex_init (&skeleton->priv->lock);
13516 skeleton->priv->context = g_main_context_ref_thread_default ();
13517 skeleton->priv->properties = g_new0 (GValue, 2);
13518 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
13519 g_value_init (&skeleton->priv->properties[1], G_TYPE_INT);
13520}
13521
13522static gint
13523control_skeleton_get_poll_interval (Control *object)
13524{
13525 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
13526 gint value;
13527 g_mutex_lock (&skeleton->priv->lock);
13528 value = g_value_get_int (&(skeleton->priv->properties[0]));
13529 g_mutex_unlock (&skeleton->priv->lock);
13530 return value;
13531}
13532
13533static gint
13534control_skeleton_get_heatbeat (Control *object)
13535{
13536 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
13537 gint value;
13538 g_mutex_lock (&skeleton->priv->lock);
13539 value = g_value_get_int (&(skeleton->priv->properties[1]));
13540 g_mutex_unlock (&skeleton->priv->lock);
13541 return value;
13542}
13543
13544static void
13545control_skeleton_class_init (ControlSkeletonClass *klass)
13546{
13547 GObjectClass *gobject_class;
13548 GDBusInterfaceSkeletonClass *skeleton_class;
13549
13550 gobject_class = G_OBJECT_CLASS (klass);
13551 gobject_class->finalize = control_skeleton_finalize;
13552 gobject_class->get_property = control_skeleton_get_property;
13553 gobject_class->set_property = control_skeleton_set_property;
13554 gobject_class->notify = control_skeleton_notify;
13555
13556
13557 control_override_properties (gobject_class, 1);
13558
13559 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
13560 skeleton_class->get_info = control_skeleton_dbus_interface_get_info;
13561 skeleton_class->get_properties = control_skeleton_dbus_interface_get_properties;
13562 skeleton_class->flush = control_skeleton_dbus_interface_flush;
13563 skeleton_class->get_vtable = control_skeleton_dbus_interface_get_vtable;
13564
13565#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
13566 g_type_class_add_private (klass, sizeof (ControlSkeletonPrivate));
13567#endif
13568}
13569
13570static void
13571control_skeleton_iface_init (ControlIface *iface)
13572{
13573 iface->heartbeat = _control_on_signal_heartbeat;
13574 iface->goto_system_state = _control_on_signal_goto_system_state;
Norman Jamesa3e47c42015-10-18 14:43:10 -050013575 iface->started = _control_on_signal_started;
Norman James362a80f2015-09-14 14:04:39 -050013576 iface->get_poll_interval = control_skeleton_get_poll_interval;
13577 iface->get_heatbeat = control_skeleton_get_heatbeat;
13578}
13579
13580/**
13581 * control_skeleton_new:
13582 *
13583 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link>.
13584 *
13585 * Returns: (transfer full) (type ControlSkeleton): The skeleton object.
13586 */
13587Control *
13588control_skeleton_new (void)
13589{
13590 return CONTROL (g_object_new (TYPE_CONTROL_SKELETON, NULL));
13591}
13592
13593/* ------------------------------------------------------------------------
13594 * Code for interface org.openbmc.control.Bmc
13595 * ------------------------------------------------------------------------
13596 */
13597
13598/**
13599 * SECTION:ControlBmc
13600 * @title: ControlBmc
13601 * @short_description: Generated C code for the org.openbmc.control.Bmc D-Bus interface
13602 *
13603 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-control-Bmc.top_of_page">org.openbmc.control.Bmc</link> D-Bus interface in C.
13604 */
13605
13606/* ---- Introspection data for org.openbmc.control.Bmc ---- */
13607
Williamf784d752016-01-19 12:28:49 +080013608static const _ExtendedGDBusMethodInfo _control_bmc_method_info_warm_reset =
Norman James362a80f2015-09-14 14:04:39 -050013609{
13610 {
13611 -1,
Williamf784d752016-01-19 12:28:49 +080013612 (gchar *) "warmReset",
Norman James362a80f2015-09-14 14:04:39 -050013613 NULL,
13614 NULL,
13615 NULL
13616 },
Williamf784d752016-01-19 12:28:49 +080013617 "handle-warm-reset",
Norman James362a80f2015-09-14 14:04:39 -050013618 FALSE
13619};
13620
13621static const _ExtendedGDBusMethodInfo * const _control_bmc_method_info_pointers[] =
13622{
Williamf784d752016-01-19 12:28:49 +080013623 &_control_bmc_method_info_warm_reset,
Norman James362a80f2015-09-14 14:04:39 -050013624 NULL
13625};
13626
13627static const _ExtendedGDBusInterfaceInfo _control_bmc_interface_info =
13628{
13629 {
13630 -1,
13631 (gchar *) "org.openbmc.control.Bmc",
13632 (GDBusMethodInfo **) &_control_bmc_method_info_pointers,
13633 NULL,
13634 NULL,
13635 NULL
13636 },
13637 "control-bmc",
13638};
13639
13640
13641/**
13642 * control_bmc_interface_info:
13643 *
13644 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-control-Bmc.top_of_page">org.openbmc.control.Bmc</link> D-Bus interface.
13645 *
13646 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
13647 */
13648GDBusInterfaceInfo *
13649control_bmc_interface_info (void)
13650{
13651 return (GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct;
13652}
13653
13654/**
13655 * control_bmc_override_properties:
13656 * @klass: The class structure for a #GObject<!-- -->-derived class.
13657 * @property_id_begin: The property id to assign to the first overridden property.
13658 *
13659 * Overrides all #GObject properties in the #ControlBmc interface for a concrete class.
13660 * The properties are overridden in the order they are defined.
13661 *
13662 * Returns: The last property id.
13663 */
13664guint
13665control_bmc_override_properties (GObjectClass *klass, guint property_id_begin)
13666{
13667 return property_id_begin - 1;
13668}
13669
13670
13671
13672/**
13673 * ControlBmc:
13674 *
13675 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Bmc.top_of_page">org.openbmc.control.Bmc</link>.
13676 */
13677
13678/**
13679 * ControlBmcIface:
13680 * @parent_iface: The parent interface.
Williamf784d752016-01-19 12:28:49 +080013681 * @handle_warm_reset: Handler for the #ControlBmc::handle-warm-reset signal.
Norman James362a80f2015-09-14 14:04:39 -050013682 *
13683 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Bmc.top_of_page">org.openbmc.control.Bmc</link>.
13684 */
13685
13686typedef ControlBmcIface ControlBmcInterface;
13687G_DEFINE_INTERFACE (ControlBmc, control_bmc, G_TYPE_OBJECT);
13688
13689static void
13690control_bmc_default_init (ControlBmcIface *iface)
13691{
13692 /* GObject signals for incoming D-Bus method calls: */
13693 /**
Williamf784d752016-01-19 12:28:49 +080013694 * ControlBmc::handle-warm-reset:
Norman James362a80f2015-09-14 14:04:39 -050013695 * @object: A #ControlBmc.
13696 * @invocation: A #GDBusMethodInvocation.
13697 *
Williamf784d752016-01-19 12:28:49 +080013698 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Bmc.warmReset">warmReset()</link> D-Bus method.
Norman James362a80f2015-09-14 14:04:39 -050013699 *
Williamf784d752016-01-19 12:28:49 +080013700 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call control_bmc_complete_warm_reset() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
Norman James362a80f2015-09-14 14:04:39 -050013701 *
13702 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
13703 */
Williamf784d752016-01-19 12:28:49 +080013704 g_signal_new ("handle-warm-reset",
Norman James362a80f2015-09-14 14:04:39 -050013705 G_TYPE_FROM_INTERFACE (iface),
13706 G_SIGNAL_RUN_LAST,
Williamf784d752016-01-19 12:28:49 +080013707 G_STRUCT_OFFSET (ControlBmcIface, handle_warm_reset),
Norman James362a80f2015-09-14 14:04:39 -050013708 g_signal_accumulator_true_handled,
13709 NULL,
13710 g_cclosure_marshal_generic,
13711 G_TYPE_BOOLEAN,
13712 1,
13713 G_TYPE_DBUS_METHOD_INVOCATION);
13714
13715}
13716
13717/**
Williamf784d752016-01-19 12:28:49 +080013718 * control_bmc_call_warm_reset:
Norman James362a80f2015-09-14 14:04:39 -050013719 * @proxy: A #ControlBmcProxy.
13720 * @cancellable: (allow-none): A #GCancellable or %NULL.
13721 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
13722 * @user_data: User data to pass to @callback.
13723 *
Williamf784d752016-01-19 12:28:49 +080013724 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Bmc.warmReset">warmReset()</link> D-Bus method on @proxy.
Norman James362a80f2015-09-14 14:04:39 -050013725 * 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.
Williamf784d752016-01-19 12:28:49 +080013726 * You can then call control_bmc_call_warm_reset_finish() to get the result of the operation.
Norman James362a80f2015-09-14 14:04:39 -050013727 *
Williamf784d752016-01-19 12:28:49 +080013728 * See control_bmc_call_warm_reset_sync() for the synchronous, blocking version of this method.
Norman James362a80f2015-09-14 14:04:39 -050013729 */
13730void
Williamf784d752016-01-19 12:28:49 +080013731control_bmc_call_warm_reset (
Norman James362a80f2015-09-14 14:04:39 -050013732 ControlBmc *proxy,
13733 GCancellable *cancellable,
13734 GAsyncReadyCallback callback,
13735 gpointer user_data)
13736{
13737 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
Williamf784d752016-01-19 12:28:49 +080013738 "warmReset",
Norman James362a80f2015-09-14 14:04:39 -050013739 g_variant_new ("()"),
13740 G_DBUS_CALL_FLAGS_NONE,
13741 -1,
13742 cancellable,
13743 callback,
13744 user_data);
13745}
13746
13747/**
Williamf784d752016-01-19 12:28:49 +080013748 * control_bmc_call_warm_reset_finish:
Norman James362a80f2015-09-14 14:04:39 -050013749 * @proxy: A #ControlBmcProxy.
Williamf784d752016-01-19 12:28:49 +080013750 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_bmc_call_warm_reset().
Norman James362a80f2015-09-14 14:04:39 -050013751 * @error: Return location for error or %NULL.
13752 *
Williamf784d752016-01-19 12:28:49 +080013753 * Finishes an operation started with control_bmc_call_warm_reset().
Norman James362a80f2015-09-14 14:04:39 -050013754 *
13755 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
13756 */
13757gboolean
Williamf784d752016-01-19 12:28:49 +080013758control_bmc_call_warm_reset_finish (
Norman James362a80f2015-09-14 14:04:39 -050013759 ControlBmc *proxy,
13760 GAsyncResult *res,
13761 GError **error)
13762{
13763 GVariant *_ret;
13764 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
13765 if (_ret == NULL)
13766 goto _out;
13767 g_variant_get (_ret,
13768 "()");
13769 g_variant_unref (_ret);
13770_out:
13771 return _ret != NULL;
13772}
13773
13774/**
Williamf784d752016-01-19 12:28:49 +080013775 * control_bmc_call_warm_reset_sync:
Norman James362a80f2015-09-14 14:04:39 -050013776 * @proxy: A #ControlBmcProxy.
13777 * @cancellable: (allow-none): A #GCancellable or %NULL.
13778 * @error: Return location for error or %NULL.
13779 *
Williamf784d752016-01-19 12:28:49 +080013780 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Bmc.warmReset">warmReset()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
Norman James362a80f2015-09-14 14:04:39 -050013781 *
Williamf784d752016-01-19 12:28:49 +080013782 * See control_bmc_call_warm_reset() for the asynchronous version of this method.
Norman James362a80f2015-09-14 14:04:39 -050013783 *
13784 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
13785 */
13786gboolean
Williamf784d752016-01-19 12:28:49 +080013787control_bmc_call_warm_reset_sync (
Norman James362a80f2015-09-14 14:04:39 -050013788 ControlBmc *proxy,
13789 GCancellable *cancellable,
13790 GError **error)
13791{
13792 GVariant *_ret;
13793 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
Williamf784d752016-01-19 12:28:49 +080013794 "warmReset",
Norman James362a80f2015-09-14 14:04:39 -050013795 g_variant_new ("()"),
13796 G_DBUS_CALL_FLAGS_NONE,
13797 -1,
13798 cancellable,
13799 error);
13800 if (_ret == NULL)
13801 goto _out;
13802 g_variant_get (_ret,
13803 "()");
13804 g_variant_unref (_ret);
13805_out:
13806 return _ret != NULL;
13807}
13808
13809/**
Williamf784d752016-01-19 12:28:49 +080013810 * control_bmc_complete_warm_reset:
Norman James362a80f2015-09-14 14:04:39 -050013811 * @object: A #ControlBmc.
13812 * @invocation: (transfer full): A #GDBusMethodInvocation.
13813 *
Williamf784d752016-01-19 12:28:49 +080013814 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-control-Bmc.warmReset">warmReset()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
Norman James362a80f2015-09-14 14:04:39 -050013815 *
13816 * This method will free @invocation, you cannot use it afterwards.
13817 */
13818void
Williamf784d752016-01-19 12:28:49 +080013819control_bmc_complete_warm_reset (
Norman James362a80f2015-09-14 14:04:39 -050013820 ControlBmc *object,
13821 GDBusMethodInvocation *invocation)
13822{
13823 g_dbus_method_invocation_return_value (invocation,
13824 g_variant_new ("()"));
13825}
13826
13827/* ------------------------------------------------------------------------ */
13828
13829/**
13830 * ControlBmcProxy:
13831 *
13832 * The #ControlBmcProxy structure contains only private data and should only be accessed using the provided API.
13833 */
13834
13835/**
13836 * ControlBmcProxyClass:
13837 * @parent_class: The parent class.
13838 *
13839 * Class structure for #ControlBmcProxy.
13840 */
13841
13842struct _ControlBmcProxyPrivate
13843{
13844 GData *qdata;
13845};
13846
13847static void control_bmc_proxy_iface_init (ControlBmcIface *iface);
13848
13849#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
13850G_DEFINE_TYPE_WITH_CODE (ControlBmcProxy, control_bmc_proxy, G_TYPE_DBUS_PROXY,
13851 G_ADD_PRIVATE (ControlBmcProxy)
13852 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_BMC, control_bmc_proxy_iface_init));
13853
13854#else
13855G_DEFINE_TYPE_WITH_CODE (ControlBmcProxy, control_bmc_proxy, G_TYPE_DBUS_PROXY,
13856 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_BMC, control_bmc_proxy_iface_init));
13857
13858#endif
13859static void
13860control_bmc_proxy_finalize (GObject *object)
13861{
13862 ControlBmcProxy *proxy = CONTROL_BMC_PROXY (object);
13863 g_datalist_clear (&proxy->priv->qdata);
13864 G_OBJECT_CLASS (control_bmc_proxy_parent_class)->finalize (object);
13865}
13866
13867static void
13868control_bmc_proxy_get_property (GObject *object,
13869 guint prop_id,
13870 GValue *value,
13871 GParamSpec *pspec G_GNUC_UNUSED)
13872{
13873}
13874
13875static void
13876control_bmc_proxy_set_property (GObject *object,
13877 guint prop_id,
13878 const GValue *value,
13879 GParamSpec *pspec G_GNUC_UNUSED)
13880{
13881}
13882
13883static void
13884control_bmc_proxy_g_signal (GDBusProxy *proxy,
13885 const gchar *sender_name G_GNUC_UNUSED,
13886 const gchar *signal_name,
13887 GVariant *parameters)
13888{
13889 _ExtendedGDBusSignalInfo *info;
13890 GVariantIter iter;
13891 GVariant *child;
13892 GValue *paramv;
13893 guint num_params;
13894 guint n;
13895 guint signal_id;
13896 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, signal_name);
13897 if (info == NULL)
13898 return;
13899 num_params = g_variant_n_children (parameters);
13900 paramv = g_new0 (GValue, num_params + 1);
13901 g_value_init (&paramv[0], TYPE_CONTROL_BMC);
13902 g_value_set_object (&paramv[0], proxy);
13903 g_variant_iter_init (&iter, parameters);
13904 n = 1;
13905 while ((child = g_variant_iter_next_value (&iter)) != NULL)
13906 {
13907 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
13908 if (arg_info->use_gvariant)
13909 {
13910 g_value_init (&paramv[n], G_TYPE_VARIANT);
13911 g_value_set_variant (&paramv[n], child);
13912 n++;
13913 }
13914 else
13915 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
13916 g_variant_unref (child);
13917 }
13918 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_BMC);
13919 g_signal_emitv (paramv, signal_id, 0, NULL);
13920 for (n = 0; n < num_params + 1; n++)
13921 g_value_unset (&paramv[n]);
13922 g_free (paramv);
13923}
13924
13925static void
13926control_bmc_proxy_g_properties_changed (GDBusProxy *_proxy,
13927 GVariant *changed_properties,
13928 const gchar *const *invalidated_properties)
13929{
13930 ControlBmcProxy *proxy = CONTROL_BMC_PROXY (_proxy);
13931 guint n;
13932 const gchar *key;
13933 GVariantIter *iter;
13934 _ExtendedGDBusPropertyInfo *info;
13935 g_variant_get (changed_properties, "a{sv}", &iter);
13936 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
13937 {
13938 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, key);
13939 g_datalist_remove_data (&proxy->priv->qdata, key);
13940 if (info != NULL)
13941 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
13942 }
13943 g_variant_iter_free (iter);
13944 for (n = 0; invalidated_properties[n] != NULL; n++)
13945 {
13946 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, invalidated_properties[n]);
13947 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
13948 if (info != NULL)
13949 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
13950 }
13951}
13952
13953static void
13954control_bmc_proxy_init (ControlBmcProxy *proxy)
13955{
13956#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
13957 proxy->priv = control_bmc_proxy_get_instance_private (proxy);
13958#else
13959 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_BMC_PROXY, ControlBmcProxyPrivate);
13960#endif
13961
13962 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_bmc_interface_info ());
13963}
13964
13965static void
13966control_bmc_proxy_class_init (ControlBmcProxyClass *klass)
13967{
13968 GObjectClass *gobject_class;
13969 GDBusProxyClass *proxy_class;
13970
13971 gobject_class = G_OBJECT_CLASS (klass);
13972 gobject_class->finalize = control_bmc_proxy_finalize;
13973 gobject_class->get_property = control_bmc_proxy_get_property;
13974 gobject_class->set_property = control_bmc_proxy_set_property;
13975
13976 proxy_class = G_DBUS_PROXY_CLASS (klass);
13977 proxy_class->g_signal = control_bmc_proxy_g_signal;
13978 proxy_class->g_properties_changed = control_bmc_proxy_g_properties_changed;
13979
13980#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
13981 g_type_class_add_private (klass, sizeof (ControlBmcProxyPrivate));
13982#endif
13983}
13984
13985static void
13986control_bmc_proxy_iface_init (ControlBmcIface *iface)
13987{
13988}
13989
13990/**
13991 * control_bmc_proxy_new:
13992 * @connection: A #GDBusConnection.
13993 * @flags: Flags from the #GDBusProxyFlags enumeration.
13994 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
13995 * @object_path: An object path.
13996 * @cancellable: (allow-none): A #GCancellable or %NULL.
13997 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
13998 * @user_data: User data to pass to @callback.
13999 *
14000 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Bmc.top_of_page">org.openbmc.control.Bmc</link>. See g_dbus_proxy_new() for more details.
14001 *
14002 * 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.
14003 * You can then call control_bmc_proxy_new_finish() to get the result of the operation.
14004 *
14005 * See control_bmc_proxy_new_sync() for the synchronous, blocking version of this constructor.
14006 */
14007void
14008control_bmc_proxy_new (
14009 GDBusConnection *connection,
14010 GDBusProxyFlags flags,
14011 const gchar *name,
14012 const gchar *object_path,
14013 GCancellable *cancellable,
14014 GAsyncReadyCallback callback,
14015 gpointer user_data)
14016{
14017 g_async_initable_new_async (TYPE_CONTROL_BMC_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.control.Bmc", NULL);
14018}
14019
14020/**
14021 * control_bmc_proxy_new_finish:
14022 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_bmc_proxy_new().
14023 * @error: Return location for error or %NULL
14024 *
14025 * Finishes an operation started with control_bmc_proxy_new().
14026 *
14027 * Returns: (transfer full) (type ControlBmcProxy): The constructed proxy object or %NULL if @error is set.
14028 */
14029ControlBmc *
14030control_bmc_proxy_new_finish (
14031 GAsyncResult *res,
14032 GError **error)
14033{
14034 GObject *ret;
14035 GObject *source_object;
14036 source_object = g_async_result_get_source_object (res);
14037 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
14038 g_object_unref (source_object);
14039 if (ret != NULL)
14040 return CONTROL_BMC (ret);
14041 else
14042 return NULL;
14043}
14044
14045/**
14046 * control_bmc_proxy_new_sync:
14047 * @connection: A #GDBusConnection.
14048 * @flags: Flags from the #GDBusProxyFlags enumeration.
14049 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
14050 * @object_path: An object path.
14051 * @cancellable: (allow-none): A #GCancellable or %NULL.
14052 * @error: Return location for error or %NULL
14053 *
14054 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Bmc.top_of_page">org.openbmc.control.Bmc</link>. See g_dbus_proxy_new_sync() for more details.
14055 *
14056 * The calling thread is blocked until a reply is received.
14057 *
14058 * See control_bmc_proxy_new() for the asynchronous version of this constructor.
14059 *
14060 * Returns: (transfer full) (type ControlBmcProxy): The constructed proxy object or %NULL if @error is set.
14061 */
14062ControlBmc *
14063control_bmc_proxy_new_sync (
14064 GDBusConnection *connection,
14065 GDBusProxyFlags flags,
14066 const gchar *name,
14067 const gchar *object_path,
14068 GCancellable *cancellable,
14069 GError **error)
14070{
14071 GInitable *ret;
14072 ret = g_initable_new (TYPE_CONTROL_BMC_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.control.Bmc", NULL);
14073 if (ret != NULL)
14074 return CONTROL_BMC (ret);
14075 else
14076 return NULL;
14077}
14078
14079
14080/**
14081 * control_bmc_proxy_new_for_bus:
14082 * @bus_type: A #GBusType.
14083 * @flags: Flags from the #GDBusProxyFlags enumeration.
14084 * @name: A bus name (well-known or unique).
14085 * @object_path: An object path.
14086 * @cancellable: (allow-none): A #GCancellable or %NULL.
14087 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
14088 * @user_data: User data to pass to @callback.
14089 *
14090 * Like control_bmc_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
14091 *
14092 * 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.
14093 * You can then call control_bmc_proxy_new_for_bus_finish() to get the result of the operation.
14094 *
14095 * See control_bmc_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
14096 */
14097void
14098control_bmc_proxy_new_for_bus (
14099 GBusType bus_type,
14100 GDBusProxyFlags flags,
14101 const gchar *name,
14102 const gchar *object_path,
14103 GCancellable *cancellable,
14104 GAsyncReadyCallback callback,
14105 gpointer user_data)
14106{
14107 g_async_initable_new_async (TYPE_CONTROL_BMC_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.control.Bmc", NULL);
14108}
14109
14110/**
14111 * control_bmc_proxy_new_for_bus_finish:
14112 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_bmc_proxy_new_for_bus().
14113 * @error: Return location for error or %NULL
14114 *
14115 * Finishes an operation started with control_bmc_proxy_new_for_bus().
14116 *
14117 * Returns: (transfer full) (type ControlBmcProxy): The constructed proxy object or %NULL if @error is set.
14118 */
14119ControlBmc *
14120control_bmc_proxy_new_for_bus_finish (
14121 GAsyncResult *res,
14122 GError **error)
14123{
14124 GObject *ret;
14125 GObject *source_object;
14126 source_object = g_async_result_get_source_object (res);
14127 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
14128 g_object_unref (source_object);
14129 if (ret != NULL)
14130 return CONTROL_BMC (ret);
14131 else
14132 return NULL;
14133}
14134
14135/**
14136 * control_bmc_proxy_new_for_bus_sync:
14137 * @bus_type: A #GBusType.
14138 * @flags: Flags from the #GDBusProxyFlags enumeration.
14139 * @name: A bus name (well-known or unique).
14140 * @object_path: An object path.
14141 * @cancellable: (allow-none): A #GCancellable or %NULL.
14142 * @error: Return location for error or %NULL
14143 *
14144 * Like control_bmc_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
14145 *
14146 * The calling thread is blocked until a reply is received.
14147 *
14148 * See control_bmc_proxy_new_for_bus() for the asynchronous version of this constructor.
14149 *
14150 * Returns: (transfer full) (type ControlBmcProxy): The constructed proxy object or %NULL if @error is set.
14151 */
14152ControlBmc *
14153control_bmc_proxy_new_for_bus_sync (
14154 GBusType bus_type,
14155 GDBusProxyFlags flags,
14156 const gchar *name,
14157 const gchar *object_path,
14158 GCancellable *cancellable,
14159 GError **error)
14160{
14161 GInitable *ret;
14162 ret = g_initable_new (TYPE_CONTROL_BMC_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.control.Bmc", NULL);
14163 if (ret != NULL)
14164 return CONTROL_BMC (ret);
14165 else
14166 return NULL;
14167}
14168
14169
14170/* ------------------------------------------------------------------------ */
14171
14172/**
14173 * ControlBmcSkeleton:
14174 *
14175 * The #ControlBmcSkeleton structure contains only private data and should only be accessed using the provided API.
14176 */
14177
14178/**
14179 * ControlBmcSkeletonClass:
14180 * @parent_class: The parent class.
14181 *
14182 * Class structure for #ControlBmcSkeleton.
14183 */
14184
14185struct _ControlBmcSkeletonPrivate
14186{
14187 GValue *properties;
14188 GList *changed_properties;
14189 GSource *changed_properties_idle_source;
14190 GMainContext *context;
14191 GMutex lock;
14192};
14193
14194static void
14195_control_bmc_skeleton_handle_method_call (
14196 GDBusConnection *connection G_GNUC_UNUSED,
14197 const gchar *sender G_GNUC_UNUSED,
14198 const gchar *object_path G_GNUC_UNUSED,
14199 const gchar *interface_name,
14200 const gchar *method_name,
14201 GVariant *parameters,
14202 GDBusMethodInvocation *invocation,
14203 gpointer user_data)
14204{
14205 ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (user_data);
14206 _ExtendedGDBusMethodInfo *info;
14207 GVariantIter iter;
14208 GVariant *child;
14209 GValue *paramv;
14210 guint num_params;
14211 guint num_extra;
14212 guint n;
14213 guint signal_id;
14214 GValue return_value = G_VALUE_INIT;
14215 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
14216 g_assert (info != NULL);
14217 num_params = g_variant_n_children (parameters);
14218 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
14219 n = 0;
14220 g_value_init (&paramv[n], TYPE_CONTROL_BMC);
14221 g_value_set_object (&paramv[n++], skeleton);
14222 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
14223 g_value_set_object (&paramv[n++], invocation);
14224 if (info->pass_fdlist)
14225 {
14226#ifdef G_OS_UNIX
14227 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
14228 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
14229#else
14230 g_assert_not_reached ();
14231#endif
14232 }
14233 g_variant_iter_init (&iter, parameters);
14234 while ((child = g_variant_iter_next_value (&iter)) != NULL)
14235 {
14236 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
14237 if (arg_info->use_gvariant)
14238 {
14239 g_value_init (&paramv[n], G_TYPE_VARIANT);
14240 g_value_set_variant (&paramv[n], child);
14241 n++;
14242 }
14243 else
14244 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
14245 g_variant_unref (child);
14246 }
14247 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_BMC);
14248 g_value_init (&return_value, G_TYPE_BOOLEAN);
14249 g_signal_emitv (paramv, signal_id, 0, &return_value);
14250 if (!g_value_get_boolean (&return_value))
14251 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);
14252 g_value_unset (&return_value);
14253 for (n = 0; n < num_params + num_extra; n++)
14254 g_value_unset (&paramv[n]);
14255 g_free (paramv);
14256}
14257
14258static GVariant *
14259_control_bmc_skeleton_handle_get_property (
14260 GDBusConnection *connection G_GNUC_UNUSED,
14261 const gchar *sender G_GNUC_UNUSED,
14262 const gchar *object_path G_GNUC_UNUSED,
14263 const gchar *interface_name G_GNUC_UNUSED,
14264 const gchar *property_name,
14265 GError **error,
14266 gpointer user_data)
14267{
14268 ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (user_data);
14269 GValue value = G_VALUE_INIT;
14270 GParamSpec *pspec;
14271 _ExtendedGDBusPropertyInfo *info;
14272 GVariant *ret;
14273 ret = NULL;
14274 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, property_name);
14275 g_assert (info != NULL);
14276 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
14277 if (pspec == NULL)
14278 {
14279 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
14280 }
14281 else
14282 {
14283 g_value_init (&value, pspec->value_type);
14284 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
14285 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
14286 g_value_unset (&value);
14287 }
14288 return ret;
14289}
14290
14291static gboolean
14292_control_bmc_skeleton_handle_set_property (
14293 GDBusConnection *connection G_GNUC_UNUSED,
14294 const gchar *sender G_GNUC_UNUSED,
14295 const gchar *object_path G_GNUC_UNUSED,
14296 const gchar *interface_name G_GNUC_UNUSED,
14297 const gchar *property_name,
14298 GVariant *variant,
14299 GError **error,
14300 gpointer user_data)
14301{
14302 ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (user_data);
14303 GValue value = G_VALUE_INIT;
14304 GParamSpec *pspec;
14305 _ExtendedGDBusPropertyInfo *info;
14306 gboolean ret;
14307 ret = FALSE;
14308 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, property_name);
14309 g_assert (info != NULL);
14310 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
14311 if (pspec == NULL)
14312 {
14313 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
14314 }
14315 else
14316 {
14317 if (info->use_gvariant)
14318 g_value_set_variant (&value, variant);
14319 else
14320 g_dbus_gvariant_to_gvalue (variant, &value);
14321 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
14322 g_value_unset (&value);
14323 ret = TRUE;
14324 }
14325 return ret;
14326}
14327
14328static const GDBusInterfaceVTable _control_bmc_skeleton_vtable =
14329{
14330 _control_bmc_skeleton_handle_method_call,
14331 _control_bmc_skeleton_handle_get_property,
14332 _control_bmc_skeleton_handle_set_property,
14333 {NULL}
14334};
14335
14336static GDBusInterfaceInfo *
14337control_bmc_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
14338{
14339 return control_bmc_interface_info ();
14340}
14341
14342static GDBusInterfaceVTable *
14343control_bmc_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
14344{
14345 return (GDBusInterfaceVTable *) &_control_bmc_skeleton_vtable;
14346}
14347
14348static GVariant *
14349control_bmc_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
14350{
14351 ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (_skeleton);
14352
14353 GVariantBuilder builder;
14354 guint n;
14355 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
14356 if (_control_bmc_interface_info.parent_struct.properties == NULL)
14357 goto out;
14358 for (n = 0; _control_bmc_interface_info.parent_struct.properties[n] != NULL; n++)
14359 {
14360 GDBusPropertyInfo *info = _control_bmc_interface_info.parent_struct.properties[n];
14361 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
14362 {
14363 GVariant *value;
14364 value = _control_bmc_skeleton_handle_get_property (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.control.Bmc", info->name, NULL, skeleton);
14365 if (value != NULL)
14366 {
14367 g_variant_take_ref (value);
14368 g_variant_builder_add (&builder, "{sv}", info->name, value);
14369 g_variant_unref (value);
14370 }
14371 }
14372 }
14373out:
14374 return g_variant_builder_end (&builder);
14375}
14376
14377static void
14378control_bmc_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
14379{
14380}
14381
14382static void control_bmc_skeleton_iface_init (ControlBmcIface *iface);
14383#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
14384G_DEFINE_TYPE_WITH_CODE (ControlBmcSkeleton, control_bmc_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
14385 G_ADD_PRIVATE (ControlBmcSkeleton)
14386 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_BMC, control_bmc_skeleton_iface_init));
14387
14388#else
14389G_DEFINE_TYPE_WITH_CODE (ControlBmcSkeleton, control_bmc_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
14390 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_BMC, control_bmc_skeleton_iface_init));
14391
14392#endif
14393static void
14394control_bmc_skeleton_finalize (GObject *object)
14395{
14396 ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (object);
14397 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
14398 if (skeleton->priv->changed_properties_idle_source != NULL)
14399 g_source_destroy (skeleton->priv->changed_properties_idle_source);
14400 g_main_context_unref (skeleton->priv->context);
14401 g_mutex_clear (&skeleton->priv->lock);
14402 G_OBJECT_CLASS (control_bmc_skeleton_parent_class)->finalize (object);
14403}
14404
14405static void
14406control_bmc_skeleton_init (ControlBmcSkeleton *skeleton)
14407{
14408#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
14409 skeleton->priv = control_bmc_skeleton_get_instance_private (skeleton);
14410#else
14411 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_BMC_SKELETON, ControlBmcSkeletonPrivate);
14412#endif
14413
14414 g_mutex_init (&skeleton->priv->lock);
14415 skeleton->priv->context = g_main_context_ref_thread_default ();
14416}
14417
14418static void
14419control_bmc_skeleton_class_init (ControlBmcSkeletonClass *klass)
14420{
14421 GObjectClass *gobject_class;
14422 GDBusInterfaceSkeletonClass *skeleton_class;
14423
14424 gobject_class = G_OBJECT_CLASS (klass);
14425 gobject_class->finalize = control_bmc_skeleton_finalize;
14426
14427 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
14428 skeleton_class->get_info = control_bmc_skeleton_dbus_interface_get_info;
14429 skeleton_class->get_properties = control_bmc_skeleton_dbus_interface_get_properties;
14430 skeleton_class->flush = control_bmc_skeleton_dbus_interface_flush;
14431 skeleton_class->get_vtable = control_bmc_skeleton_dbus_interface_get_vtable;
14432
14433#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
14434 g_type_class_add_private (klass, sizeof (ControlBmcSkeletonPrivate));
14435#endif
14436}
14437
14438static void
14439control_bmc_skeleton_iface_init (ControlBmcIface *iface)
14440{
14441}
14442
14443/**
14444 * control_bmc_skeleton_new:
14445 *
14446 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Bmc.top_of_page">org.openbmc.control.Bmc</link>.
14447 *
14448 * Returns: (transfer full) (type ControlBmcSkeleton): The skeleton object.
14449 */
14450ControlBmc *
14451control_bmc_skeleton_new (void)
14452{
14453 return CONTROL_BMC (g_object_new (TYPE_CONTROL_BMC_SKELETON, NULL));
14454}
14455
14456/* ------------------------------------------------------------------------
14457 * Code for interface org.openbmc.control.Host
14458 * ------------------------------------------------------------------------
14459 */
14460
14461/**
14462 * SECTION:ControlHost
14463 * @title: ControlHost
14464 * @short_description: Generated C code for the org.openbmc.control.Host D-Bus interface
14465 *
14466 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link> D-Bus interface in C.
14467 */
14468
14469/* ---- Introspection data for org.openbmc.control.Host ---- */
14470
14471static const _ExtendedGDBusMethodInfo _control_host_method_info_boot =
14472{
14473 {
14474 -1,
14475 (gchar *) "boot",
14476 NULL,
14477 NULL,
14478 NULL
14479 },
14480 "handle-boot",
14481 FALSE
14482};
14483
14484static const _ExtendedGDBusMethodInfo _control_host_method_info_shutdown =
14485{
14486 {
14487 -1,
14488 (gchar *) "shutdown",
14489 NULL,
14490 NULL,
14491 NULL
14492 },
14493 "handle-shutdown",
14494 FALSE
14495};
14496
14497static const _ExtendedGDBusMethodInfo _control_host_method_info_reboot =
14498{
14499 {
14500 -1,
14501 (gchar *) "reboot",
14502 NULL,
14503 NULL,
14504 NULL
14505 },
14506 "handle-reboot",
14507 FALSE
14508};
14509
14510static const _ExtendedGDBusMethodInfo * const _control_host_method_info_pointers[] =
14511{
14512 &_control_host_method_info_boot,
14513 &_control_host_method_info_shutdown,
14514 &_control_host_method_info_reboot,
14515 NULL
14516};
14517
14518static const _ExtendedGDBusSignalInfo _control_host_signal_info_booted =
14519{
14520 {
14521 -1,
14522 (gchar *) "Booted",
14523 NULL,
14524 NULL
14525 },
14526 "booted"
14527};
14528
14529static const _ExtendedGDBusSignalInfo * const _control_host_signal_info_pointers[] =
14530{
14531 &_control_host_signal_info_booted,
14532 NULL
14533};
14534
Norman James493996c2015-10-31 17:27:13 -050014535static const _ExtendedGDBusPropertyInfo _control_host_property_info_debug_mode =
14536{
14537 {
14538 -1,
14539 (gchar *) "debug_mode",
14540 (gchar *) "i",
14541 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
14542 NULL
14543 },
14544 "debug-mode",
14545 FALSE
14546};
14547
14548static const _ExtendedGDBusPropertyInfo _control_host_property_info_flash_side =
14549{
14550 {
14551 -1,
14552 (gchar *) "flash_side",
14553 (gchar *) "s",
14554 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
14555 NULL
14556 },
14557 "flash-side",
14558 FALSE
14559};
14560
14561static const _ExtendedGDBusPropertyInfo * const _control_host_property_info_pointers[] =
14562{
14563 &_control_host_property_info_debug_mode,
14564 &_control_host_property_info_flash_side,
14565 NULL
14566};
14567
Norman James362a80f2015-09-14 14:04:39 -050014568static const _ExtendedGDBusInterfaceInfo _control_host_interface_info =
14569{
14570 {
14571 -1,
14572 (gchar *) "org.openbmc.control.Host",
14573 (GDBusMethodInfo **) &_control_host_method_info_pointers,
14574 (GDBusSignalInfo **) &_control_host_signal_info_pointers,
Norman James493996c2015-10-31 17:27:13 -050014575 (GDBusPropertyInfo **) &_control_host_property_info_pointers,
Norman James362a80f2015-09-14 14:04:39 -050014576 NULL
14577 },
14578 "control-host",
14579};
14580
14581
14582/**
14583 * control_host_interface_info:
14584 *
14585 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link> D-Bus interface.
14586 *
14587 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
14588 */
14589GDBusInterfaceInfo *
14590control_host_interface_info (void)
14591{
14592 return (GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct;
14593}
14594
14595/**
14596 * control_host_override_properties:
14597 * @klass: The class structure for a #GObject<!-- -->-derived class.
14598 * @property_id_begin: The property id to assign to the first overridden property.
14599 *
14600 * Overrides all #GObject properties in the #ControlHost interface for a concrete class.
14601 * The properties are overridden in the order they are defined.
14602 *
14603 * Returns: The last property id.
14604 */
14605guint
14606control_host_override_properties (GObjectClass *klass, guint property_id_begin)
14607{
Norman James493996c2015-10-31 17:27:13 -050014608 g_object_class_override_property (klass, property_id_begin++, "debug-mode");
14609 g_object_class_override_property (klass, property_id_begin++, "flash-side");
Norman James362a80f2015-09-14 14:04:39 -050014610 return property_id_begin - 1;
14611}
14612
14613
14614
14615/**
14616 * ControlHost:
14617 *
14618 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link>.
14619 */
14620
14621/**
14622 * ControlHostIface:
14623 * @parent_iface: The parent interface.
14624 * @handle_boot: Handler for the #ControlHost::handle-boot signal.
14625 * @handle_reboot: Handler for the #ControlHost::handle-reboot signal.
14626 * @handle_shutdown: Handler for the #ControlHost::handle-shutdown signal.
Norman James493996c2015-10-31 17:27:13 -050014627 * @get_debug_mode: Getter for the #ControlHost:debug-mode property.
14628 * @get_flash_side: Getter for the #ControlHost:flash-side property.
Norman James362a80f2015-09-14 14:04:39 -050014629 * @booted: Handler for the #ControlHost::booted signal.
14630 *
14631 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link>.
14632 */
14633
14634typedef ControlHostIface ControlHostInterface;
14635G_DEFINE_INTERFACE (ControlHost, control_host, G_TYPE_OBJECT);
14636
14637static void
14638control_host_default_init (ControlHostIface *iface)
14639{
14640 /* GObject signals for incoming D-Bus method calls: */
14641 /**
14642 * ControlHost::handle-boot:
14643 * @object: A #ControlHost.
14644 * @invocation: A #GDBusMethodInvocation.
14645 *
14646 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Host.boot">boot()</link> D-Bus method.
14647 *
14648 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call control_host_complete_boot() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
14649 *
14650 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
14651 */
14652 g_signal_new ("handle-boot",
14653 G_TYPE_FROM_INTERFACE (iface),
14654 G_SIGNAL_RUN_LAST,
14655 G_STRUCT_OFFSET (ControlHostIface, handle_boot),
14656 g_signal_accumulator_true_handled,
14657 NULL,
14658 g_cclosure_marshal_generic,
14659 G_TYPE_BOOLEAN,
14660 1,
14661 G_TYPE_DBUS_METHOD_INVOCATION);
14662
14663 /**
14664 * ControlHost::handle-shutdown:
14665 * @object: A #ControlHost.
14666 * @invocation: A #GDBusMethodInvocation.
14667 *
14668 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Host.shutdown">shutdown()</link> D-Bus method.
14669 *
14670 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call control_host_complete_shutdown() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
14671 *
14672 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
14673 */
14674 g_signal_new ("handle-shutdown",
14675 G_TYPE_FROM_INTERFACE (iface),
14676 G_SIGNAL_RUN_LAST,
14677 G_STRUCT_OFFSET (ControlHostIface, handle_shutdown),
14678 g_signal_accumulator_true_handled,
14679 NULL,
14680 g_cclosure_marshal_generic,
14681 G_TYPE_BOOLEAN,
14682 1,
14683 G_TYPE_DBUS_METHOD_INVOCATION);
14684
14685 /**
14686 * ControlHost::handle-reboot:
14687 * @object: A #ControlHost.
14688 * @invocation: A #GDBusMethodInvocation.
14689 *
14690 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Host.reboot">reboot()</link> D-Bus method.
14691 *
14692 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call control_host_complete_reboot() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
14693 *
14694 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
14695 */
14696 g_signal_new ("handle-reboot",
14697 G_TYPE_FROM_INTERFACE (iface),
14698 G_SIGNAL_RUN_LAST,
14699 G_STRUCT_OFFSET (ControlHostIface, handle_reboot),
14700 g_signal_accumulator_true_handled,
14701 NULL,
14702 g_cclosure_marshal_generic,
14703 G_TYPE_BOOLEAN,
14704 1,
14705 G_TYPE_DBUS_METHOD_INVOCATION);
14706
14707 /* GObject signals for received D-Bus signals: */
14708 /**
14709 * ControlHost::booted:
14710 * @object: A #ControlHost.
14711 *
14712 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-control-Host.Booted">"Booted"</link> is received.
14713 *
14714 * 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.
14715 */
14716 g_signal_new ("booted",
14717 G_TYPE_FROM_INTERFACE (iface),
14718 G_SIGNAL_RUN_LAST,
14719 G_STRUCT_OFFSET (ControlHostIface, booted),
14720 NULL,
14721 NULL,
14722 g_cclosure_marshal_generic,
14723 G_TYPE_NONE,
14724 0);
14725
Norman James493996c2015-10-31 17:27:13 -050014726 /* GObject properties for D-Bus properties: */
14727 /**
14728 * ControlHost:debug-mode:
14729 *
14730 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-control-Host.debug_mode">"debug_mode"</link>.
14731 *
14732 * 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.
14733 */
14734 g_object_interface_install_property (iface,
14735 g_param_spec_int ("debug-mode", "debug_mode", "debug_mode", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
14736 /**
14737 * ControlHost:flash-side:
14738 *
14739 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-control-Host.flash_side">"flash_side"</link>.
14740 *
14741 * 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.
14742 */
14743 g_object_interface_install_property (iface,
14744 g_param_spec_string ("flash-side", "flash_side", "flash_side", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
14745}
14746
14747/**
14748 * control_host_get_debug_mode: (skip)
14749 * @object: A #ControlHost.
14750 *
14751 * Gets the value of the <link linkend="gdbus-property-org-openbmc-control-Host.debug_mode">"debug_mode"</link> D-Bus property.
14752 *
14753 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
14754 *
14755 * Returns: The property value.
14756 */
14757gint
14758control_host_get_debug_mode (ControlHost *object)
14759{
14760 return CONTROL_HOST_GET_IFACE (object)->get_debug_mode (object);
14761}
14762
14763/**
14764 * control_host_set_debug_mode: (skip)
14765 * @object: A #ControlHost.
14766 * @value: The value to set.
14767 *
14768 * Sets the <link linkend="gdbus-property-org-openbmc-control-Host.debug_mode">"debug_mode"</link> D-Bus property to @value.
14769 *
14770 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
14771 */
14772void
14773control_host_set_debug_mode (ControlHost *object, gint value)
14774{
14775 g_object_set (G_OBJECT (object), "debug-mode", value, NULL);
14776}
14777
14778/**
14779 * control_host_get_flash_side: (skip)
14780 * @object: A #ControlHost.
14781 *
14782 * Gets the value of the <link linkend="gdbus-property-org-openbmc-control-Host.flash_side">"flash_side"</link> D-Bus property.
14783 *
14784 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
14785 *
14786 * <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 control_host_dup_flash_side() if on another thread.</warning>
14787 *
14788 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
14789 */
14790const gchar *
14791control_host_get_flash_side (ControlHost *object)
14792{
14793 return CONTROL_HOST_GET_IFACE (object)->get_flash_side (object);
14794}
14795
14796/**
14797 * control_host_dup_flash_side: (skip)
14798 * @object: A #ControlHost.
14799 *
14800 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-control-Host.flash_side">"flash_side"</link> D-Bus property.
14801 *
14802 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
14803 *
14804 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
14805 */
14806gchar *
14807control_host_dup_flash_side (ControlHost *object)
14808{
14809 gchar *value;
14810 g_object_get (G_OBJECT (object), "flash-side", &value, NULL);
14811 return value;
14812}
14813
14814/**
14815 * control_host_set_flash_side: (skip)
14816 * @object: A #ControlHost.
14817 * @value: The value to set.
14818 *
14819 * Sets the <link linkend="gdbus-property-org-openbmc-control-Host.flash_side">"flash_side"</link> D-Bus property to @value.
14820 *
14821 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
14822 */
14823void
14824control_host_set_flash_side (ControlHost *object, const gchar *value)
14825{
14826 g_object_set (G_OBJECT (object), "flash-side", value, NULL);
Norman James362a80f2015-09-14 14:04:39 -050014827}
14828
14829/**
14830 * control_host_emit_booted:
14831 * @object: A #ControlHost.
14832 *
14833 * Emits the <link linkend="gdbus-signal-org-openbmc-control-Host.Booted">"Booted"</link> D-Bus signal.
14834 */
14835void
14836control_host_emit_booted (
14837 ControlHost *object)
14838{
14839 g_signal_emit_by_name (object, "booted");
14840}
14841
14842/**
14843 * control_host_call_boot:
14844 * @proxy: A #ControlHostProxy.
14845 * @cancellable: (allow-none): A #GCancellable or %NULL.
14846 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
14847 * @user_data: User data to pass to @callback.
14848 *
14849 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Host.boot">boot()</link> D-Bus method on @proxy.
14850 * 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.
14851 * You can then call control_host_call_boot_finish() to get the result of the operation.
14852 *
14853 * See control_host_call_boot_sync() for the synchronous, blocking version of this method.
14854 */
14855void
14856control_host_call_boot (
14857 ControlHost *proxy,
14858 GCancellable *cancellable,
14859 GAsyncReadyCallback callback,
14860 gpointer user_data)
14861{
14862 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
14863 "boot",
14864 g_variant_new ("()"),
14865 G_DBUS_CALL_FLAGS_NONE,
14866 -1,
14867 cancellable,
14868 callback,
14869 user_data);
14870}
14871
14872/**
14873 * control_host_call_boot_finish:
14874 * @proxy: A #ControlHostProxy.
14875 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_call_boot().
14876 * @error: Return location for error or %NULL.
14877 *
14878 * Finishes an operation started with control_host_call_boot().
14879 *
14880 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
14881 */
14882gboolean
14883control_host_call_boot_finish (
14884 ControlHost *proxy,
14885 GAsyncResult *res,
14886 GError **error)
14887{
14888 GVariant *_ret;
14889 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
14890 if (_ret == NULL)
14891 goto _out;
14892 g_variant_get (_ret,
14893 "()");
14894 g_variant_unref (_ret);
14895_out:
14896 return _ret != NULL;
14897}
14898
14899/**
14900 * control_host_call_boot_sync:
14901 * @proxy: A #ControlHostProxy.
14902 * @cancellable: (allow-none): A #GCancellable or %NULL.
14903 * @error: Return location for error or %NULL.
14904 *
14905 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Host.boot">boot()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
14906 *
14907 * See control_host_call_boot() for the asynchronous version of this method.
14908 *
14909 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
14910 */
14911gboolean
14912control_host_call_boot_sync (
14913 ControlHost *proxy,
14914 GCancellable *cancellable,
14915 GError **error)
14916{
14917 GVariant *_ret;
14918 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
14919 "boot",
14920 g_variant_new ("()"),
14921 G_DBUS_CALL_FLAGS_NONE,
14922 -1,
14923 cancellable,
14924 error);
14925 if (_ret == NULL)
14926 goto _out;
14927 g_variant_get (_ret,
14928 "()");
14929 g_variant_unref (_ret);
14930_out:
14931 return _ret != NULL;
14932}
14933
14934/**
14935 * control_host_call_shutdown:
14936 * @proxy: A #ControlHostProxy.
14937 * @cancellable: (allow-none): A #GCancellable or %NULL.
14938 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
14939 * @user_data: User data to pass to @callback.
14940 *
14941 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Host.shutdown">shutdown()</link> D-Bus method on @proxy.
14942 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
14943 * You can then call control_host_call_shutdown_finish() to get the result of the operation.
14944 *
14945 * See control_host_call_shutdown_sync() for the synchronous, blocking version of this method.
14946 */
14947void
14948control_host_call_shutdown (
14949 ControlHost *proxy,
14950 GCancellable *cancellable,
14951 GAsyncReadyCallback callback,
14952 gpointer user_data)
14953{
14954 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
14955 "shutdown",
14956 g_variant_new ("()"),
14957 G_DBUS_CALL_FLAGS_NONE,
14958 -1,
14959 cancellable,
14960 callback,
14961 user_data);
14962}
14963
14964/**
14965 * control_host_call_shutdown_finish:
14966 * @proxy: A #ControlHostProxy.
14967 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_call_shutdown().
14968 * @error: Return location for error or %NULL.
14969 *
14970 * Finishes an operation started with control_host_call_shutdown().
14971 *
14972 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
14973 */
14974gboolean
14975control_host_call_shutdown_finish (
14976 ControlHost *proxy,
14977 GAsyncResult *res,
14978 GError **error)
14979{
14980 GVariant *_ret;
14981 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
14982 if (_ret == NULL)
14983 goto _out;
14984 g_variant_get (_ret,
14985 "()");
14986 g_variant_unref (_ret);
14987_out:
14988 return _ret != NULL;
14989}
14990
14991/**
14992 * control_host_call_shutdown_sync:
14993 * @proxy: A #ControlHostProxy.
14994 * @cancellable: (allow-none): A #GCancellable or %NULL.
14995 * @error: Return location for error or %NULL.
14996 *
14997 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Host.shutdown">shutdown()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
14998 *
14999 * See control_host_call_shutdown() for the asynchronous version of this method.
15000 *
15001 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
15002 */
15003gboolean
15004control_host_call_shutdown_sync (
15005 ControlHost *proxy,
15006 GCancellable *cancellable,
15007 GError **error)
15008{
15009 GVariant *_ret;
15010 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
15011 "shutdown",
15012 g_variant_new ("()"),
15013 G_DBUS_CALL_FLAGS_NONE,
15014 -1,
15015 cancellable,
15016 error);
15017 if (_ret == NULL)
15018 goto _out;
15019 g_variant_get (_ret,
15020 "()");
15021 g_variant_unref (_ret);
15022_out:
15023 return _ret != NULL;
15024}
15025
15026/**
15027 * control_host_call_reboot:
15028 * @proxy: A #ControlHostProxy.
15029 * @cancellable: (allow-none): A #GCancellable or %NULL.
15030 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
15031 * @user_data: User data to pass to @callback.
15032 *
15033 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Host.reboot">reboot()</link> D-Bus method on @proxy.
15034 * 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.
15035 * You can then call control_host_call_reboot_finish() to get the result of the operation.
15036 *
15037 * See control_host_call_reboot_sync() for the synchronous, blocking version of this method.
15038 */
15039void
15040control_host_call_reboot (
15041 ControlHost *proxy,
15042 GCancellable *cancellable,
15043 GAsyncReadyCallback callback,
15044 gpointer user_data)
15045{
15046 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
15047 "reboot",
15048 g_variant_new ("()"),
15049 G_DBUS_CALL_FLAGS_NONE,
15050 -1,
15051 cancellable,
15052 callback,
15053 user_data);
15054}
15055
15056/**
15057 * control_host_call_reboot_finish:
15058 * @proxy: A #ControlHostProxy.
15059 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_call_reboot().
15060 * @error: Return location for error or %NULL.
15061 *
15062 * Finishes an operation started with control_host_call_reboot().
15063 *
15064 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
15065 */
15066gboolean
15067control_host_call_reboot_finish (
15068 ControlHost *proxy,
15069 GAsyncResult *res,
15070 GError **error)
15071{
15072 GVariant *_ret;
15073 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
15074 if (_ret == NULL)
15075 goto _out;
15076 g_variant_get (_ret,
15077 "()");
15078 g_variant_unref (_ret);
15079_out:
15080 return _ret != NULL;
15081}
15082
15083/**
15084 * control_host_call_reboot_sync:
15085 * @proxy: A #ControlHostProxy.
15086 * @cancellable: (allow-none): A #GCancellable or %NULL.
15087 * @error: Return location for error or %NULL.
15088 *
15089 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Host.reboot">reboot()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
15090 *
15091 * See control_host_call_reboot() for the asynchronous version of this method.
15092 *
15093 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
15094 */
15095gboolean
15096control_host_call_reboot_sync (
15097 ControlHost *proxy,
15098 GCancellable *cancellable,
15099 GError **error)
15100{
15101 GVariant *_ret;
15102 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
15103 "reboot",
15104 g_variant_new ("()"),
15105 G_DBUS_CALL_FLAGS_NONE,
15106 -1,
15107 cancellable,
15108 error);
15109 if (_ret == NULL)
15110 goto _out;
15111 g_variant_get (_ret,
15112 "()");
15113 g_variant_unref (_ret);
15114_out:
15115 return _ret != NULL;
15116}
15117
15118/**
15119 * control_host_complete_boot:
15120 * @object: A #ControlHost.
15121 * @invocation: (transfer full): A #GDBusMethodInvocation.
15122 *
15123 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-control-Host.boot">boot()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
15124 *
15125 * This method will free @invocation, you cannot use it afterwards.
15126 */
15127void
15128control_host_complete_boot (
15129 ControlHost *object,
15130 GDBusMethodInvocation *invocation)
15131{
15132 g_dbus_method_invocation_return_value (invocation,
15133 g_variant_new ("()"));
15134}
15135
15136/**
15137 * control_host_complete_shutdown:
15138 * @object: A #ControlHost.
15139 * @invocation: (transfer full): A #GDBusMethodInvocation.
15140 *
15141 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-control-Host.shutdown">shutdown()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
15142 *
15143 * This method will free @invocation, you cannot use it afterwards.
15144 */
15145void
15146control_host_complete_shutdown (
15147 ControlHost *object,
15148 GDBusMethodInvocation *invocation)
15149{
15150 g_dbus_method_invocation_return_value (invocation,
15151 g_variant_new ("()"));
15152}
15153
15154/**
15155 * control_host_complete_reboot:
15156 * @object: A #ControlHost.
15157 * @invocation: (transfer full): A #GDBusMethodInvocation.
15158 *
15159 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-control-Host.reboot">reboot()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
15160 *
15161 * This method will free @invocation, you cannot use it afterwards.
15162 */
15163void
15164control_host_complete_reboot (
15165 ControlHost *object,
15166 GDBusMethodInvocation *invocation)
15167{
15168 g_dbus_method_invocation_return_value (invocation,
15169 g_variant_new ("()"));
15170}
15171
15172/* ------------------------------------------------------------------------ */
15173
15174/**
15175 * ControlHostProxy:
15176 *
15177 * The #ControlHostProxy structure contains only private data and should only be accessed using the provided API.
15178 */
15179
15180/**
15181 * ControlHostProxyClass:
15182 * @parent_class: The parent class.
15183 *
15184 * Class structure for #ControlHostProxy.
15185 */
15186
15187struct _ControlHostProxyPrivate
15188{
15189 GData *qdata;
15190};
15191
15192static void control_host_proxy_iface_init (ControlHostIface *iface);
15193
15194#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
15195G_DEFINE_TYPE_WITH_CODE (ControlHostProxy, control_host_proxy, G_TYPE_DBUS_PROXY,
15196 G_ADD_PRIVATE (ControlHostProxy)
15197 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_proxy_iface_init));
15198
15199#else
15200G_DEFINE_TYPE_WITH_CODE (ControlHostProxy, control_host_proxy, G_TYPE_DBUS_PROXY,
15201 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_proxy_iface_init));
15202
15203#endif
15204static void
15205control_host_proxy_finalize (GObject *object)
15206{
15207 ControlHostProxy *proxy = CONTROL_HOST_PROXY (object);
15208 g_datalist_clear (&proxy->priv->qdata);
15209 G_OBJECT_CLASS (control_host_proxy_parent_class)->finalize (object);
15210}
15211
15212static void
15213control_host_proxy_get_property (GObject *object,
15214 guint prop_id,
15215 GValue *value,
15216 GParamSpec *pspec G_GNUC_UNUSED)
15217{
Norman James493996c2015-10-31 17:27:13 -050015218 const _ExtendedGDBusPropertyInfo *info;
15219 GVariant *variant;
15220 g_assert (prop_id != 0 && prop_id - 1 < 2);
15221 info = _control_host_property_info_pointers[prop_id - 1];
15222 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
15223 if (info->use_gvariant)
15224 {
15225 g_value_set_variant (value, variant);
15226 }
15227 else
15228 {
15229 if (variant != NULL)
15230 g_dbus_gvariant_to_gvalue (variant, value);
15231 }
15232 if (variant != NULL)
15233 g_variant_unref (variant);
15234}
15235
15236static void
15237control_host_proxy_set_property_cb (GDBusProxy *proxy,
15238 GAsyncResult *res,
15239 gpointer user_data)
15240{
15241 const _ExtendedGDBusPropertyInfo *info = user_data;
15242 GError *error;
15243 GVariant *_ret;
15244 error = NULL;
15245 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
15246 if (!_ret)
15247 {
15248 g_warning ("Error setting property '%s' on interface org.openbmc.control.Host: %s (%s, %d)",
15249 info->parent_struct.name,
15250 error->message, g_quark_to_string (error->domain), error->code);
15251 g_error_free (error);
15252 }
15253 else
15254 {
15255 g_variant_unref (_ret);
15256 }
Norman James362a80f2015-09-14 14:04:39 -050015257}
15258
15259static void
15260control_host_proxy_set_property (GObject *object,
15261 guint prop_id,
15262 const GValue *value,
15263 GParamSpec *pspec G_GNUC_UNUSED)
15264{
Norman James493996c2015-10-31 17:27:13 -050015265 const _ExtendedGDBusPropertyInfo *info;
15266 GVariant *variant;
15267 g_assert (prop_id != 0 && prop_id - 1 < 2);
15268 info = _control_host_property_info_pointers[prop_id - 1];
15269 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
15270 g_dbus_proxy_call (G_DBUS_PROXY (object),
15271 "org.freedesktop.DBus.Properties.Set",
15272 g_variant_new ("(ssv)", "org.openbmc.control.Host", info->parent_struct.name, variant),
15273 G_DBUS_CALL_FLAGS_NONE,
15274 -1,
15275 NULL, (GAsyncReadyCallback) control_host_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
15276 g_variant_unref (variant);
Norman James362a80f2015-09-14 14:04:39 -050015277}
15278
15279static void
15280control_host_proxy_g_signal (GDBusProxy *proxy,
15281 const gchar *sender_name G_GNUC_UNUSED,
15282 const gchar *signal_name,
15283 GVariant *parameters)
15284{
15285 _ExtendedGDBusSignalInfo *info;
15286 GVariantIter iter;
15287 GVariant *child;
15288 GValue *paramv;
15289 guint num_params;
15290 guint n;
15291 guint signal_id;
15292 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, signal_name);
15293 if (info == NULL)
15294 return;
15295 num_params = g_variant_n_children (parameters);
15296 paramv = g_new0 (GValue, num_params + 1);
15297 g_value_init (&paramv[0], TYPE_CONTROL_HOST);
15298 g_value_set_object (&paramv[0], proxy);
15299 g_variant_iter_init (&iter, parameters);
15300 n = 1;
15301 while ((child = g_variant_iter_next_value (&iter)) != NULL)
15302 {
15303 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
15304 if (arg_info->use_gvariant)
15305 {
15306 g_value_init (&paramv[n], G_TYPE_VARIANT);
15307 g_value_set_variant (&paramv[n], child);
15308 n++;
15309 }
15310 else
15311 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
15312 g_variant_unref (child);
15313 }
15314 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_HOST);
15315 g_signal_emitv (paramv, signal_id, 0, NULL);
15316 for (n = 0; n < num_params + 1; n++)
15317 g_value_unset (&paramv[n]);
15318 g_free (paramv);
15319}
15320
15321static void
15322control_host_proxy_g_properties_changed (GDBusProxy *_proxy,
15323 GVariant *changed_properties,
15324 const gchar *const *invalidated_properties)
15325{
15326 ControlHostProxy *proxy = CONTROL_HOST_PROXY (_proxy);
15327 guint n;
15328 const gchar *key;
15329 GVariantIter *iter;
15330 _ExtendedGDBusPropertyInfo *info;
15331 g_variant_get (changed_properties, "a{sv}", &iter);
15332 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
15333 {
15334 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, key);
15335 g_datalist_remove_data (&proxy->priv->qdata, key);
15336 if (info != NULL)
15337 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
15338 }
15339 g_variant_iter_free (iter);
15340 for (n = 0; invalidated_properties[n] != NULL; n++)
15341 {
15342 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, invalidated_properties[n]);
15343 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
15344 if (info != NULL)
15345 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
15346 }
15347}
15348
Norman James493996c2015-10-31 17:27:13 -050015349static gint
15350control_host_proxy_get_debug_mode (ControlHost *object)
15351{
15352 ControlHostProxy *proxy = CONTROL_HOST_PROXY (object);
15353 GVariant *variant;
15354 gint value = 0;
15355 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "debug_mode");
15356 if (variant != NULL)
15357 {
15358 value = g_variant_get_int32 (variant);
15359 g_variant_unref (variant);
15360 }
15361 return value;
15362}
15363
15364static const gchar *
15365control_host_proxy_get_flash_side (ControlHost *object)
15366{
15367 ControlHostProxy *proxy = CONTROL_HOST_PROXY (object);
15368 GVariant *variant;
15369 const gchar *value = NULL;
15370 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "flash_side");
15371 if (variant != NULL)
15372 {
15373 value = g_variant_get_string (variant, NULL);
15374 g_variant_unref (variant);
15375 }
15376 return value;
15377}
15378
Norman James362a80f2015-09-14 14:04:39 -050015379static void
15380control_host_proxy_init (ControlHostProxy *proxy)
15381{
15382#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
15383 proxy->priv = control_host_proxy_get_instance_private (proxy);
15384#else
15385 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_HOST_PROXY, ControlHostProxyPrivate);
15386#endif
15387
15388 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_host_interface_info ());
15389}
15390
15391static void
15392control_host_proxy_class_init (ControlHostProxyClass *klass)
15393{
15394 GObjectClass *gobject_class;
15395 GDBusProxyClass *proxy_class;
15396
15397 gobject_class = G_OBJECT_CLASS (klass);
15398 gobject_class->finalize = control_host_proxy_finalize;
15399 gobject_class->get_property = control_host_proxy_get_property;
15400 gobject_class->set_property = control_host_proxy_set_property;
15401
15402 proxy_class = G_DBUS_PROXY_CLASS (klass);
15403 proxy_class->g_signal = control_host_proxy_g_signal;
15404 proxy_class->g_properties_changed = control_host_proxy_g_properties_changed;
15405
Norman James493996c2015-10-31 17:27:13 -050015406 control_host_override_properties (gobject_class, 1);
15407
Norman James362a80f2015-09-14 14:04:39 -050015408#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
15409 g_type_class_add_private (klass, sizeof (ControlHostProxyPrivate));
15410#endif
15411}
15412
15413static void
15414control_host_proxy_iface_init (ControlHostIface *iface)
15415{
Norman James493996c2015-10-31 17:27:13 -050015416 iface->get_debug_mode = control_host_proxy_get_debug_mode;
15417 iface->get_flash_side = control_host_proxy_get_flash_side;
Norman James362a80f2015-09-14 14:04:39 -050015418}
15419
15420/**
15421 * control_host_proxy_new:
15422 * @connection: A #GDBusConnection.
15423 * @flags: Flags from the #GDBusProxyFlags enumeration.
15424 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
15425 * @object_path: An object path.
15426 * @cancellable: (allow-none): A #GCancellable or %NULL.
15427 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
15428 * @user_data: User data to pass to @callback.
15429 *
15430 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link>. See g_dbus_proxy_new() for more details.
15431 *
15432 * 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.
15433 * You can then call control_host_proxy_new_finish() to get the result of the operation.
15434 *
15435 * See control_host_proxy_new_sync() for the synchronous, blocking version of this constructor.
15436 */
15437void
15438control_host_proxy_new (
15439 GDBusConnection *connection,
15440 GDBusProxyFlags flags,
15441 const gchar *name,
15442 const gchar *object_path,
15443 GCancellable *cancellable,
15444 GAsyncReadyCallback callback,
15445 gpointer user_data)
15446{
15447 g_async_initable_new_async (TYPE_CONTROL_HOST_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.control.Host", NULL);
15448}
15449
15450/**
15451 * control_host_proxy_new_finish:
15452 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_proxy_new().
15453 * @error: Return location for error or %NULL
15454 *
15455 * Finishes an operation started with control_host_proxy_new().
15456 *
15457 * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set.
15458 */
15459ControlHost *
15460control_host_proxy_new_finish (
15461 GAsyncResult *res,
15462 GError **error)
15463{
15464 GObject *ret;
15465 GObject *source_object;
15466 source_object = g_async_result_get_source_object (res);
15467 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
15468 g_object_unref (source_object);
15469 if (ret != NULL)
15470 return CONTROL_HOST (ret);
15471 else
15472 return NULL;
15473}
15474
15475/**
15476 * control_host_proxy_new_sync:
15477 * @connection: A #GDBusConnection.
15478 * @flags: Flags from the #GDBusProxyFlags enumeration.
15479 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
15480 * @object_path: An object path.
15481 * @cancellable: (allow-none): A #GCancellable or %NULL.
15482 * @error: Return location for error or %NULL
15483 *
15484 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link>. See g_dbus_proxy_new_sync() for more details.
15485 *
15486 * The calling thread is blocked until a reply is received.
15487 *
15488 * See control_host_proxy_new() for the asynchronous version of this constructor.
15489 *
15490 * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set.
15491 */
15492ControlHost *
15493control_host_proxy_new_sync (
15494 GDBusConnection *connection,
15495 GDBusProxyFlags flags,
15496 const gchar *name,
15497 const gchar *object_path,
15498 GCancellable *cancellable,
15499 GError **error)
15500{
15501 GInitable *ret;
15502 ret = g_initable_new (TYPE_CONTROL_HOST_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.control.Host", NULL);
15503 if (ret != NULL)
15504 return CONTROL_HOST (ret);
15505 else
15506 return NULL;
15507}
15508
15509
15510/**
15511 * control_host_proxy_new_for_bus:
15512 * @bus_type: A #GBusType.
15513 * @flags: Flags from the #GDBusProxyFlags enumeration.
15514 * @name: A bus name (well-known or unique).
15515 * @object_path: An object path.
15516 * @cancellable: (allow-none): A #GCancellable or %NULL.
15517 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
15518 * @user_data: User data to pass to @callback.
15519 *
15520 * Like control_host_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
15521 *
15522 * 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.
15523 * You can then call control_host_proxy_new_for_bus_finish() to get the result of the operation.
15524 *
15525 * See control_host_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
15526 */
15527void
15528control_host_proxy_new_for_bus (
15529 GBusType bus_type,
15530 GDBusProxyFlags flags,
15531 const gchar *name,
15532 const gchar *object_path,
15533 GCancellable *cancellable,
15534 GAsyncReadyCallback callback,
15535 gpointer user_data)
15536{
15537 g_async_initable_new_async (TYPE_CONTROL_HOST_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.control.Host", NULL);
15538}
15539
15540/**
15541 * control_host_proxy_new_for_bus_finish:
15542 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_proxy_new_for_bus().
15543 * @error: Return location for error or %NULL
15544 *
15545 * Finishes an operation started with control_host_proxy_new_for_bus().
15546 *
15547 * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set.
15548 */
15549ControlHost *
15550control_host_proxy_new_for_bus_finish (
15551 GAsyncResult *res,
15552 GError **error)
15553{
15554 GObject *ret;
15555 GObject *source_object;
15556 source_object = g_async_result_get_source_object (res);
15557 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
15558 g_object_unref (source_object);
15559 if (ret != NULL)
15560 return CONTROL_HOST (ret);
15561 else
15562 return NULL;
15563}
15564
15565/**
15566 * control_host_proxy_new_for_bus_sync:
15567 * @bus_type: A #GBusType.
15568 * @flags: Flags from the #GDBusProxyFlags enumeration.
15569 * @name: A bus name (well-known or unique).
15570 * @object_path: An object path.
15571 * @cancellable: (allow-none): A #GCancellable or %NULL.
15572 * @error: Return location for error or %NULL
15573 *
15574 * Like control_host_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
15575 *
15576 * The calling thread is blocked until a reply is received.
15577 *
15578 * See control_host_proxy_new_for_bus() for the asynchronous version of this constructor.
15579 *
15580 * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set.
15581 */
15582ControlHost *
15583control_host_proxy_new_for_bus_sync (
15584 GBusType bus_type,
15585 GDBusProxyFlags flags,
15586 const gchar *name,
15587 const gchar *object_path,
15588 GCancellable *cancellable,
15589 GError **error)
15590{
15591 GInitable *ret;
15592 ret = g_initable_new (TYPE_CONTROL_HOST_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.control.Host", NULL);
15593 if (ret != NULL)
15594 return CONTROL_HOST (ret);
15595 else
15596 return NULL;
15597}
15598
15599
15600/* ------------------------------------------------------------------------ */
15601
15602/**
15603 * ControlHostSkeleton:
15604 *
15605 * The #ControlHostSkeleton structure contains only private data and should only be accessed using the provided API.
15606 */
15607
15608/**
15609 * ControlHostSkeletonClass:
15610 * @parent_class: The parent class.
15611 *
15612 * Class structure for #ControlHostSkeleton.
15613 */
15614
15615struct _ControlHostSkeletonPrivate
15616{
15617 GValue *properties;
15618 GList *changed_properties;
15619 GSource *changed_properties_idle_source;
15620 GMainContext *context;
15621 GMutex lock;
15622};
15623
15624static void
15625_control_host_skeleton_handle_method_call (
15626 GDBusConnection *connection G_GNUC_UNUSED,
15627 const gchar *sender G_GNUC_UNUSED,
15628 const gchar *object_path G_GNUC_UNUSED,
15629 const gchar *interface_name,
15630 const gchar *method_name,
15631 GVariant *parameters,
15632 GDBusMethodInvocation *invocation,
15633 gpointer user_data)
15634{
15635 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (user_data);
15636 _ExtendedGDBusMethodInfo *info;
15637 GVariantIter iter;
15638 GVariant *child;
15639 GValue *paramv;
15640 guint num_params;
15641 guint num_extra;
15642 guint n;
15643 guint signal_id;
15644 GValue return_value = G_VALUE_INIT;
15645 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
15646 g_assert (info != NULL);
15647 num_params = g_variant_n_children (parameters);
15648 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
15649 n = 0;
15650 g_value_init (&paramv[n], TYPE_CONTROL_HOST);
15651 g_value_set_object (&paramv[n++], skeleton);
15652 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
15653 g_value_set_object (&paramv[n++], invocation);
15654 if (info->pass_fdlist)
15655 {
15656#ifdef G_OS_UNIX
15657 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
15658 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
15659#else
15660 g_assert_not_reached ();
15661#endif
15662 }
15663 g_variant_iter_init (&iter, parameters);
15664 while ((child = g_variant_iter_next_value (&iter)) != NULL)
15665 {
15666 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
15667 if (arg_info->use_gvariant)
15668 {
15669 g_value_init (&paramv[n], G_TYPE_VARIANT);
15670 g_value_set_variant (&paramv[n], child);
15671 n++;
15672 }
15673 else
15674 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
15675 g_variant_unref (child);
15676 }
15677 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_HOST);
15678 g_value_init (&return_value, G_TYPE_BOOLEAN);
15679 g_signal_emitv (paramv, signal_id, 0, &return_value);
15680 if (!g_value_get_boolean (&return_value))
15681 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);
15682 g_value_unset (&return_value);
15683 for (n = 0; n < num_params + num_extra; n++)
15684 g_value_unset (&paramv[n]);
15685 g_free (paramv);
15686}
15687
15688static GVariant *
15689_control_host_skeleton_handle_get_property (
15690 GDBusConnection *connection G_GNUC_UNUSED,
15691 const gchar *sender G_GNUC_UNUSED,
15692 const gchar *object_path G_GNUC_UNUSED,
15693 const gchar *interface_name G_GNUC_UNUSED,
15694 const gchar *property_name,
15695 GError **error,
15696 gpointer user_data)
15697{
15698 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (user_data);
15699 GValue value = G_VALUE_INIT;
15700 GParamSpec *pspec;
15701 _ExtendedGDBusPropertyInfo *info;
15702 GVariant *ret;
15703 ret = NULL;
15704 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, property_name);
15705 g_assert (info != NULL);
15706 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
15707 if (pspec == NULL)
15708 {
15709 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
15710 }
15711 else
15712 {
15713 g_value_init (&value, pspec->value_type);
15714 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
15715 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
15716 g_value_unset (&value);
15717 }
15718 return ret;
15719}
15720
15721static gboolean
15722_control_host_skeleton_handle_set_property (
15723 GDBusConnection *connection G_GNUC_UNUSED,
15724 const gchar *sender G_GNUC_UNUSED,
15725 const gchar *object_path G_GNUC_UNUSED,
15726 const gchar *interface_name G_GNUC_UNUSED,
15727 const gchar *property_name,
15728 GVariant *variant,
15729 GError **error,
15730 gpointer user_data)
15731{
15732 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (user_data);
15733 GValue value = G_VALUE_INIT;
15734 GParamSpec *pspec;
15735 _ExtendedGDBusPropertyInfo *info;
15736 gboolean ret;
15737 ret = FALSE;
15738 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, property_name);
15739 g_assert (info != NULL);
15740 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
15741 if (pspec == NULL)
15742 {
15743 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
15744 }
15745 else
15746 {
15747 if (info->use_gvariant)
15748 g_value_set_variant (&value, variant);
15749 else
15750 g_dbus_gvariant_to_gvalue (variant, &value);
15751 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
15752 g_value_unset (&value);
15753 ret = TRUE;
15754 }
15755 return ret;
15756}
15757
15758static const GDBusInterfaceVTable _control_host_skeleton_vtable =
15759{
15760 _control_host_skeleton_handle_method_call,
15761 _control_host_skeleton_handle_get_property,
15762 _control_host_skeleton_handle_set_property,
15763 {NULL}
15764};
15765
15766static GDBusInterfaceInfo *
15767control_host_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
15768{
15769 return control_host_interface_info ();
15770}
15771
15772static GDBusInterfaceVTable *
15773control_host_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
15774{
15775 return (GDBusInterfaceVTable *) &_control_host_skeleton_vtable;
15776}
15777
15778static GVariant *
15779control_host_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
15780{
15781 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (_skeleton);
15782
15783 GVariantBuilder builder;
15784 guint n;
15785 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
15786 if (_control_host_interface_info.parent_struct.properties == NULL)
15787 goto out;
15788 for (n = 0; _control_host_interface_info.parent_struct.properties[n] != NULL; n++)
15789 {
15790 GDBusPropertyInfo *info = _control_host_interface_info.parent_struct.properties[n];
15791 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
15792 {
15793 GVariant *value;
15794 value = _control_host_skeleton_handle_get_property (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.control.Host", info->name, NULL, skeleton);
15795 if (value != NULL)
15796 {
15797 g_variant_take_ref (value);
15798 g_variant_builder_add (&builder, "{sv}", info->name, value);
15799 g_variant_unref (value);
15800 }
15801 }
15802 }
15803out:
15804 return g_variant_builder_end (&builder);
15805}
15806
Norman James493996c2015-10-31 17:27:13 -050015807static gboolean _control_host_emit_changed (gpointer user_data);
15808
Norman James362a80f2015-09-14 14:04:39 -050015809static void
15810control_host_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
15811{
Norman James493996c2015-10-31 17:27:13 -050015812 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (_skeleton);
15813 gboolean emit_changed = FALSE;
15814
15815 g_mutex_lock (&skeleton->priv->lock);
15816 if (skeleton->priv->changed_properties_idle_source != NULL)
15817 {
15818 g_source_destroy (skeleton->priv->changed_properties_idle_source);
15819 skeleton->priv->changed_properties_idle_source = NULL;
15820 emit_changed = TRUE;
15821 }
15822 g_mutex_unlock (&skeleton->priv->lock);
15823
15824 if (emit_changed)
15825 _control_host_emit_changed (skeleton);
Norman James362a80f2015-09-14 14:04:39 -050015826}
15827
15828static void
15829_control_host_on_signal_booted (
15830 ControlHost *object)
15831{
15832 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object);
15833
15834 GList *connections, *l;
15835 GVariant *signal_variant;
15836 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
15837
15838 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
15839 for (l = connections; l != NULL; l = l->next)
15840 {
15841 GDBusConnection *connection = l->data;
15842 g_dbus_connection_emit_signal (connection,
15843 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.control.Host", "Booted",
15844 signal_variant, NULL);
15845 }
15846 g_variant_unref (signal_variant);
15847 g_list_free_full (connections, g_object_unref);
15848}
15849
15850static void control_host_skeleton_iface_init (ControlHostIface *iface);
15851#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
15852G_DEFINE_TYPE_WITH_CODE (ControlHostSkeleton, control_host_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
15853 G_ADD_PRIVATE (ControlHostSkeleton)
15854 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_skeleton_iface_init));
15855
15856#else
15857G_DEFINE_TYPE_WITH_CODE (ControlHostSkeleton, control_host_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
15858 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_skeleton_iface_init));
15859
15860#endif
15861static void
15862control_host_skeleton_finalize (GObject *object)
15863{
15864 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object);
Norman James493996c2015-10-31 17:27:13 -050015865 guint n;
15866 for (n = 0; n < 2; n++)
15867 g_value_unset (&skeleton->priv->properties[n]);
15868 g_free (skeleton->priv->properties);
Norman James362a80f2015-09-14 14:04:39 -050015869 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
15870 if (skeleton->priv->changed_properties_idle_source != NULL)
15871 g_source_destroy (skeleton->priv->changed_properties_idle_source);
15872 g_main_context_unref (skeleton->priv->context);
15873 g_mutex_clear (&skeleton->priv->lock);
15874 G_OBJECT_CLASS (control_host_skeleton_parent_class)->finalize (object);
15875}
15876
15877static void
Norman James493996c2015-10-31 17:27:13 -050015878control_host_skeleton_get_property (GObject *object,
15879 guint prop_id,
15880 GValue *value,
15881 GParamSpec *pspec G_GNUC_UNUSED)
15882{
15883 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object);
15884 g_assert (prop_id != 0 && prop_id - 1 < 2);
15885 g_mutex_lock (&skeleton->priv->lock);
15886 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
15887 g_mutex_unlock (&skeleton->priv->lock);
15888}
15889
15890static gboolean
15891_control_host_emit_changed (gpointer user_data)
15892{
15893 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (user_data);
15894 GList *l;
15895 GVariantBuilder builder;
15896 GVariantBuilder invalidated_builder;
15897 guint num_changes;
15898
15899 g_mutex_lock (&skeleton->priv->lock);
15900 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
15901 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
15902 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
15903 {
15904 ChangedProperty *cp = l->data;
15905 GVariant *variant;
15906 const GValue *cur_value;
15907
15908 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
15909 if (!_g_value_equal (cur_value, &cp->orig_value))
15910 {
15911 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
15912 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
15913 g_variant_unref (variant);
15914 num_changes++;
15915 }
15916 }
15917 if (num_changes > 0)
15918 {
15919 GList *connections, *ll;
15920 GVariant *signal_variant;
15921 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.control.Host",
15922 &builder, &invalidated_builder));
15923 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
15924 for (ll = connections; ll != NULL; ll = ll->next)
15925 {
15926 GDBusConnection *connection = ll->data;
15927
15928 g_dbus_connection_emit_signal (connection,
15929 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
15930 "org.freedesktop.DBus.Properties",
15931 "PropertiesChanged",
15932 signal_variant,
15933 NULL);
15934 }
15935 g_variant_unref (signal_variant);
15936 g_list_free_full (connections, g_object_unref);
15937 }
15938 else
15939 {
15940 g_variant_builder_clear (&builder);
15941 g_variant_builder_clear (&invalidated_builder);
15942 }
15943 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
15944 skeleton->priv->changed_properties = NULL;
15945 skeleton->priv->changed_properties_idle_source = NULL;
15946 g_mutex_unlock (&skeleton->priv->lock);
15947 return FALSE;
15948}
15949
15950static void
15951_control_host_schedule_emit_changed (ControlHostSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
15952{
15953 ChangedProperty *cp;
15954 GList *l;
15955 cp = NULL;
15956 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
15957 {
15958 ChangedProperty *i_cp = l->data;
15959 if (i_cp->info == info)
15960 {
15961 cp = i_cp;
15962 break;
15963 }
15964 }
15965 if (cp == NULL)
15966 {
15967 cp = g_new0 (ChangedProperty, 1);
15968 cp->prop_id = prop_id;
15969 cp->info = info;
15970 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
15971 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
15972 g_value_copy (orig_value, &cp->orig_value);
15973 }
15974}
15975
15976static void
15977control_host_skeleton_notify (GObject *object,
15978 GParamSpec *pspec G_GNUC_UNUSED)
15979{
15980 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object);
15981 g_mutex_lock (&skeleton->priv->lock);
15982 if (skeleton->priv->changed_properties != NULL &&
15983 skeleton->priv->changed_properties_idle_source == NULL)
15984 {
15985 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
15986 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
15987 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _control_host_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
Adriana Kobylakfd778822016-06-16 09:08:37 -050015988 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _control_host_emit_changed");
Norman James493996c2015-10-31 17:27:13 -050015989 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
15990 g_source_unref (skeleton->priv->changed_properties_idle_source);
15991 }
15992 g_mutex_unlock (&skeleton->priv->lock);
15993}
15994
15995static void
15996control_host_skeleton_set_property (GObject *object,
15997 guint prop_id,
15998 const GValue *value,
15999 GParamSpec *pspec)
16000{
16001 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object);
16002 g_assert (prop_id != 0 && prop_id - 1 < 2);
16003 g_mutex_lock (&skeleton->priv->lock);
16004 g_object_freeze_notify (object);
16005 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
16006 {
16007 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
16008 _control_host_schedule_emit_changed (skeleton, _control_host_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
16009 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
16010 g_object_notify_by_pspec (object, pspec);
16011 }
16012 g_mutex_unlock (&skeleton->priv->lock);
16013 g_object_thaw_notify (object);
16014}
16015
16016static void
Norman James362a80f2015-09-14 14:04:39 -050016017control_host_skeleton_init (ControlHostSkeleton *skeleton)
16018{
16019#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
16020 skeleton->priv = control_host_skeleton_get_instance_private (skeleton);
16021#else
16022 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_HOST_SKELETON, ControlHostSkeletonPrivate);
16023#endif
16024
16025 g_mutex_init (&skeleton->priv->lock);
16026 skeleton->priv->context = g_main_context_ref_thread_default ();
Norman James493996c2015-10-31 17:27:13 -050016027 skeleton->priv->properties = g_new0 (GValue, 2);
16028 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
16029 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
16030}
16031
16032static gint
16033control_host_skeleton_get_debug_mode (ControlHost *object)
16034{
16035 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object);
16036 gint value;
16037 g_mutex_lock (&skeleton->priv->lock);
16038 value = g_value_get_int (&(skeleton->priv->properties[0]));
16039 g_mutex_unlock (&skeleton->priv->lock);
16040 return value;
16041}
16042
16043static const gchar *
16044control_host_skeleton_get_flash_side (ControlHost *object)
16045{
16046 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object);
16047 const gchar *value;
16048 g_mutex_lock (&skeleton->priv->lock);
16049 value = g_value_get_string (&(skeleton->priv->properties[1]));
16050 g_mutex_unlock (&skeleton->priv->lock);
16051 return value;
Norman James362a80f2015-09-14 14:04:39 -050016052}
16053
16054static void
16055control_host_skeleton_class_init (ControlHostSkeletonClass *klass)
16056{
16057 GObjectClass *gobject_class;
16058 GDBusInterfaceSkeletonClass *skeleton_class;
16059
16060 gobject_class = G_OBJECT_CLASS (klass);
16061 gobject_class->finalize = control_host_skeleton_finalize;
Norman James493996c2015-10-31 17:27:13 -050016062 gobject_class->get_property = control_host_skeleton_get_property;
16063 gobject_class->set_property = control_host_skeleton_set_property;
16064 gobject_class->notify = control_host_skeleton_notify;
16065
16066
16067 control_host_override_properties (gobject_class, 1);
Norman James362a80f2015-09-14 14:04:39 -050016068
16069 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
16070 skeleton_class->get_info = control_host_skeleton_dbus_interface_get_info;
16071 skeleton_class->get_properties = control_host_skeleton_dbus_interface_get_properties;
16072 skeleton_class->flush = control_host_skeleton_dbus_interface_flush;
16073 skeleton_class->get_vtable = control_host_skeleton_dbus_interface_get_vtable;
16074
16075#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
16076 g_type_class_add_private (klass, sizeof (ControlHostSkeletonPrivate));
16077#endif
16078}
16079
16080static void
16081control_host_skeleton_iface_init (ControlHostIface *iface)
16082{
16083 iface->booted = _control_host_on_signal_booted;
Norman James493996c2015-10-31 17:27:13 -050016084 iface->get_debug_mode = control_host_skeleton_get_debug_mode;
16085 iface->get_flash_side = control_host_skeleton_get_flash_side;
Norman James362a80f2015-09-14 14:04:39 -050016086}
16087
16088/**
16089 * control_host_skeleton_new:
16090 *
16091 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link>.
16092 *
16093 * Returns: (transfer full) (type ControlHostSkeleton): The skeleton object.
16094 */
16095ControlHost *
16096control_host_skeleton_new (void)
16097{
16098 return CONTROL_HOST (g_object_new (TYPE_CONTROL_HOST_SKELETON, NULL));
16099}
16100
16101/* ------------------------------------------------------------------------
16102 * Code for interface org.openbmc.control.Power
16103 * ------------------------------------------------------------------------
16104 */
16105
16106/**
16107 * SECTION:ControlPower
16108 * @title: ControlPower
16109 * @short_description: Generated C code for the org.openbmc.control.Power D-Bus interface
16110 *
16111 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-control-Power.top_of_page">org.openbmc.control.Power</link> D-Bus interface in C.
16112 */
16113
16114/* ---- Introspection data for org.openbmc.control.Power ---- */
16115
16116static const _ExtendedGDBusArgInfo _control_power_method_info_set_power_state_IN_ARG_state =
16117{
16118 {
16119 -1,
16120 (gchar *) "state",
16121 (gchar *) "i",
16122 NULL
16123 },
16124 FALSE
16125};
16126
16127static const _ExtendedGDBusArgInfo * const _control_power_method_info_set_power_state_IN_ARG_pointers[] =
16128{
16129 &_control_power_method_info_set_power_state_IN_ARG_state,
16130 NULL
16131};
16132
16133static const _ExtendedGDBusMethodInfo _control_power_method_info_set_power_state =
16134{
16135 {
16136 -1,
16137 (gchar *) "setPowerState",
16138 (GDBusArgInfo **) &_control_power_method_info_set_power_state_IN_ARG_pointers,
16139 NULL,
16140 NULL
16141 },
16142 "handle-set-power-state",
16143 FALSE
16144};
16145
16146static const _ExtendedGDBusArgInfo _control_power_method_info_get_power_state_OUT_ARG_state =
16147{
16148 {
16149 -1,
16150 (gchar *) "state",
16151 (gchar *) "i",
16152 NULL
16153 },
16154 FALSE
16155};
16156
16157static const _ExtendedGDBusArgInfo * const _control_power_method_info_get_power_state_OUT_ARG_pointers[] =
16158{
16159 &_control_power_method_info_get_power_state_OUT_ARG_state,
16160 NULL
16161};
16162
16163static const _ExtendedGDBusMethodInfo _control_power_method_info_get_power_state =
16164{
16165 {
16166 -1,
16167 (gchar *) "getPowerState",
16168 NULL,
16169 (GDBusArgInfo **) &_control_power_method_info_get_power_state_OUT_ARG_pointers,
16170 NULL
16171 },
16172 "handle-get-power-state",
16173 FALSE
16174};
16175
16176static const _ExtendedGDBusMethodInfo * const _control_power_method_info_pointers[] =
16177{
16178 &_control_power_method_info_set_power_state,
16179 &_control_power_method_info_get_power_state,
16180 NULL
16181};
16182
16183static const _ExtendedGDBusSignalInfo _control_power_signal_info_power_good =
16184{
16185 {
16186 -1,
16187 (gchar *) "PowerGood",
16188 NULL,
16189 NULL
16190 },
16191 "power-good"
16192};
16193
16194static const _ExtendedGDBusSignalInfo _control_power_signal_info_power_lost =
16195{
16196 {
16197 -1,
16198 (gchar *) "PowerLost",
16199 NULL,
16200 NULL
16201 },
16202 "power-lost"
16203};
16204
16205static const _ExtendedGDBusSignalInfo * const _control_power_signal_info_pointers[] =
16206{
16207 &_control_power_signal_info_power_good,
16208 &_control_power_signal_info_power_lost,
16209 NULL
16210};
16211
16212static const _ExtendedGDBusPropertyInfo _control_power_property_info_pgood =
16213{
16214 {
16215 -1,
16216 (gchar *) "pgood",
16217 (gchar *) "i",
16218 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
16219 NULL
16220 },
16221 "pgood",
16222 FALSE
16223};
16224
16225static const _ExtendedGDBusPropertyInfo _control_power_property_info_state =
16226{
16227 {
16228 -1,
16229 (gchar *) "state",
16230 (gchar *) "i",
16231 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
16232 NULL
16233 },
16234 "state",
16235 FALSE
16236};
16237
Norman James32e74e22015-09-15 21:28:06 -050016238static const _ExtendedGDBusPropertyInfo _control_power_property_info_pgood_timeout =
16239{
16240 {
16241 -1,
16242 (gchar *) "pgood_timeout",
16243 (gchar *) "i",
16244 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
16245 NULL
16246 },
16247 "pgood-timeout",
16248 FALSE
16249};
16250
Norman James362a80f2015-09-14 14:04:39 -050016251static const _ExtendedGDBusPropertyInfo * const _control_power_property_info_pointers[] =
16252{
16253 &_control_power_property_info_pgood,
16254 &_control_power_property_info_state,
Norman James32e74e22015-09-15 21:28:06 -050016255 &_control_power_property_info_pgood_timeout,
Norman James362a80f2015-09-14 14:04:39 -050016256 NULL
16257};
16258
16259static const _ExtendedGDBusInterfaceInfo _control_power_interface_info =
16260{
16261 {
16262 -1,
16263 (gchar *) "org.openbmc.control.Power",
16264 (GDBusMethodInfo **) &_control_power_method_info_pointers,
16265 (GDBusSignalInfo **) &_control_power_signal_info_pointers,
16266 (GDBusPropertyInfo **) &_control_power_property_info_pointers,
16267 NULL
16268 },
16269 "control-power",
16270};
16271
16272
16273/**
16274 * control_power_interface_info:
16275 *
16276 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-control-Power.top_of_page">org.openbmc.control.Power</link> D-Bus interface.
16277 *
16278 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
16279 */
16280GDBusInterfaceInfo *
16281control_power_interface_info (void)
16282{
16283 return (GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct;
16284}
16285
16286/**
16287 * control_power_override_properties:
16288 * @klass: The class structure for a #GObject<!-- -->-derived class.
16289 * @property_id_begin: The property id to assign to the first overridden property.
16290 *
16291 * Overrides all #GObject properties in the #ControlPower interface for a concrete class.
16292 * The properties are overridden in the order they are defined.
16293 *
16294 * Returns: The last property id.
16295 */
16296guint
16297control_power_override_properties (GObjectClass *klass, guint property_id_begin)
16298{
16299 g_object_class_override_property (klass, property_id_begin++, "pgood");
16300 g_object_class_override_property (klass, property_id_begin++, "state");
Norman James32e74e22015-09-15 21:28:06 -050016301 g_object_class_override_property (klass, property_id_begin++, "pgood-timeout");
Norman James362a80f2015-09-14 14:04:39 -050016302 return property_id_begin - 1;
16303}
16304
16305
16306
16307/**
16308 * ControlPower:
16309 *
16310 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Power.top_of_page">org.openbmc.control.Power</link>.
16311 */
16312
16313/**
16314 * ControlPowerIface:
16315 * @parent_iface: The parent interface.
16316 * @handle_get_power_state: Handler for the #ControlPower::handle-get-power-state signal.
16317 * @handle_set_power_state: Handler for the #ControlPower::handle-set-power-state signal.
16318 * @get_pgood: Getter for the #ControlPower:pgood property.
Norman James32e74e22015-09-15 21:28:06 -050016319 * @get_pgood_timeout: Getter for the #ControlPower:pgood-timeout property.
Norman James362a80f2015-09-14 14:04:39 -050016320 * @get_state: Getter for the #ControlPower:state property.
16321 * @power_good: Handler for the #ControlPower::power-good signal.
16322 * @power_lost: Handler for the #ControlPower::power-lost signal.
16323 *
16324 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Power.top_of_page">org.openbmc.control.Power</link>.
16325 */
16326
16327typedef ControlPowerIface ControlPowerInterface;
16328G_DEFINE_INTERFACE (ControlPower, control_power, G_TYPE_OBJECT);
16329
16330static void
16331control_power_default_init (ControlPowerIface *iface)
16332{
16333 /* GObject signals for incoming D-Bus method calls: */
16334 /**
16335 * ControlPower::handle-set-power-state:
16336 * @object: A #ControlPower.
16337 * @invocation: A #GDBusMethodInvocation.
16338 * @arg_state: Argument passed by remote caller.
16339 *
16340 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Power.setPowerState">setPowerState()</link> D-Bus method.
16341 *
16342 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call control_power_complete_set_power_state() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
16343 *
16344 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
16345 */
16346 g_signal_new ("handle-set-power-state",
16347 G_TYPE_FROM_INTERFACE (iface),
16348 G_SIGNAL_RUN_LAST,
16349 G_STRUCT_OFFSET (ControlPowerIface, handle_set_power_state),
16350 g_signal_accumulator_true_handled,
16351 NULL,
16352 g_cclosure_marshal_generic,
16353 G_TYPE_BOOLEAN,
16354 2,
16355 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT);
16356
16357 /**
16358 * ControlPower::handle-get-power-state:
16359 * @object: A #ControlPower.
16360 * @invocation: A #GDBusMethodInvocation.
16361 *
16362 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Power.getPowerState">getPowerState()</link> D-Bus method.
16363 *
16364 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call control_power_complete_get_power_state() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
16365 *
16366 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
16367 */
16368 g_signal_new ("handle-get-power-state",
16369 G_TYPE_FROM_INTERFACE (iface),
16370 G_SIGNAL_RUN_LAST,
16371 G_STRUCT_OFFSET (ControlPowerIface, handle_get_power_state),
16372 g_signal_accumulator_true_handled,
16373 NULL,
16374 g_cclosure_marshal_generic,
16375 G_TYPE_BOOLEAN,
16376 1,
16377 G_TYPE_DBUS_METHOD_INVOCATION);
16378
16379 /* GObject signals for received D-Bus signals: */
16380 /**
16381 * ControlPower::power-good:
16382 * @object: A #ControlPower.
16383 *
16384 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-control-Power.PowerGood">"PowerGood"</link> is received.
16385 *
16386 * 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.
16387 */
16388 g_signal_new ("power-good",
16389 G_TYPE_FROM_INTERFACE (iface),
16390 G_SIGNAL_RUN_LAST,
16391 G_STRUCT_OFFSET (ControlPowerIface, power_good),
16392 NULL,
16393 NULL,
16394 g_cclosure_marshal_generic,
16395 G_TYPE_NONE,
16396 0);
16397
16398 /**
16399 * ControlPower::power-lost:
16400 * @object: A #ControlPower.
16401 *
16402 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-control-Power.PowerLost">"PowerLost"</link> is received.
16403 *
16404 * 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.
16405 */
16406 g_signal_new ("power-lost",
16407 G_TYPE_FROM_INTERFACE (iface),
16408 G_SIGNAL_RUN_LAST,
16409 G_STRUCT_OFFSET (ControlPowerIface, power_lost),
16410 NULL,
16411 NULL,
16412 g_cclosure_marshal_generic,
16413 G_TYPE_NONE,
16414 0);
16415
16416 /* GObject properties for D-Bus properties: */
16417 /**
16418 * ControlPower:pgood:
16419 *
16420 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-control-Power.pgood">"pgood"</link>.
16421 *
16422 * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.
16423 */
16424 g_object_interface_install_property (iface,
16425 g_param_spec_int ("pgood", "pgood", "pgood", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
16426 /**
16427 * ControlPower:state:
16428 *
16429 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-control-Power.state">"state"</link>.
16430 *
16431 * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.
16432 */
16433 g_object_interface_install_property (iface,
16434 g_param_spec_int ("state", "state", "state", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Norman James32e74e22015-09-15 21:28:06 -050016435 /**
16436 * ControlPower:pgood-timeout:
16437 *
16438 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-control-Power.pgood_timeout">"pgood_timeout"</link>.
16439 *
16440 * 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.
16441 */
16442 g_object_interface_install_property (iface,
16443 g_param_spec_int ("pgood-timeout", "pgood_timeout", "pgood_timeout", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Norman James362a80f2015-09-14 14:04:39 -050016444}
16445
16446/**
16447 * control_power_get_pgood: (skip)
16448 * @object: A #ControlPower.
16449 *
16450 * Gets the value of the <link linkend="gdbus-property-org-openbmc-control-Power.pgood">"pgood"</link> D-Bus property.
16451 *
16452 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
16453 *
16454 * Returns: The property value.
16455 */
16456gint
16457control_power_get_pgood (ControlPower *object)
16458{
16459 return CONTROL_POWER_GET_IFACE (object)->get_pgood (object);
16460}
16461
16462/**
16463 * control_power_set_pgood: (skip)
16464 * @object: A #ControlPower.
16465 * @value: The value to set.
16466 *
16467 * Sets the <link linkend="gdbus-property-org-openbmc-control-Power.pgood">"pgood"</link> D-Bus property to @value.
16468 *
16469 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
16470 */
16471void
16472control_power_set_pgood (ControlPower *object, gint value)
16473{
16474 g_object_set (G_OBJECT (object), "pgood", value, NULL);
16475}
16476
16477/**
16478 * control_power_get_state: (skip)
16479 * @object: A #ControlPower.
16480 *
16481 * Gets the value of the <link linkend="gdbus-property-org-openbmc-control-Power.state">"state"</link> D-Bus property.
16482 *
16483 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
16484 *
16485 * Returns: The property value.
16486 */
16487gint
16488control_power_get_state (ControlPower *object)
16489{
16490 return CONTROL_POWER_GET_IFACE (object)->get_state (object);
16491}
16492
16493/**
16494 * control_power_set_state: (skip)
16495 * @object: A #ControlPower.
16496 * @value: The value to set.
16497 *
16498 * Sets the <link linkend="gdbus-property-org-openbmc-control-Power.state">"state"</link> D-Bus property to @value.
16499 *
16500 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
16501 */
16502void
16503control_power_set_state (ControlPower *object, gint value)
16504{
16505 g_object_set (G_OBJECT (object), "state", value, NULL);
16506}
16507
16508/**
Norman James32e74e22015-09-15 21:28:06 -050016509 * control_power_get_pgood_timeout: (skip)
16510 * @object: A #ControlPower.
16511 *
16512 * Gets the value of the <link linkend="gdbus-property-org-openbmc-control-Power.pgood_timeout">"pgood_timeout"</link> D-Bus property.
16513 *
16514 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
16515 *
16516 * Returns: The property value.
16517 */
16518gint
16519control_power_get_pgood_timeout (ControlPower *object)
16520{
16521 return CONTROL_POWER_GET_IFACE (object)->get_pgood_timeout (object);
16522}
16523
16524/**
16525 * control_power_set_pgood_timeout: (skip)
16526 * @object: A #ControlPower.
16527 * @value: The value to set.
16528 *
16529 * Sets the <link linkend="gdbus-property-org-openbmc-control-Power.pgood_timeout">"pgood_timeout"</link> D-Bus property to @value.
16530 *
16531 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
16532 */
16533void
16534control_power_set_pgood_timeout (ControlPower *object, gint value)
16535{
16536 g_object_set (G_OBJECT (object), "pgood-timeout", value, NULL);
16537}
16538
16539/**
Norman James362a80f2015-09-14 14:04:39 -050016540 * control_power_emit_power_good:
16541 * @object: A #ControlPower.
16542 *
16543 * Emits the <link linkend="gdbus-signal-org-openbmc-control-Power.PowerGood">"PowerGood"</link> D-Bus signal.
16544 */
16545void
16546control_power_emit_power_good (
16547 ControlPower *object)
16548{
16549 g_signal_emit_by_name (object, "power-good");
16550}
16551
16552/**
16553 * control_power_emit_power_lost:
16554 * @object: A #ControlPower.
16555 *
16556 * Emits the <link linkend="gdbus-signal-org-openbmc-control-Power.PowerLost">"PowerLost"</link> D-Bus signal.
16557 */
16558void
16559control_power_emit_power_lost (
16560 ControlPower *object)
16561{
16562 g_signal_emit_by_name (object, "power-lost");
16563}
16564
16565/**
16566 * control_power_call_set_power_state:
16567 * @proxy: A #ControlPowerProxy.
16568 * @arg_state: Argument to pass with the method invocation.
16569 * @cancellable: (allow-none): A #GCancellable or %NULL.
16570 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
16571 * @user_data: User data to pass to @callback.
16572 *
16573 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Power.setPowerState">setPowerState()</link> D-Bus method on @proxy.
16574 * 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.
16575 * You can then call control_power_call_set_power_state_finish() to get the result of the operation.
16576 *
16577 * See control_power_call_set_power_state_sync() for the synchronous, blocking version of this method.
16578 */
16579void
16580control_power_call_set_power_state (
16581 ControlPower *proxy,
16582 gint arg_state,
16583 GCancellable *cancellable,
16584 GAsyncReadyCallback callback,
16585 gpointer user_data)
16586{
16587 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
16588 "setPowerState",
16589 g_variant_new ("(i)",
16590 arg_state),
16591 G_DBUS_CALL_FLAGS_NONE,
16592 -1,
16593 cancellable,
16594 callback,
16595 user_data);
16596}
16597
16598/**
16599 * control_power_call_set_power_state_finish:
16600 * @proxy: A #ControlPowerProxy.
16601 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_call_set_power_state().
16602 * @error: Return location for error or %NULL.
16603 *
16604 * Finishes an operation started with control_power_call_set_power_state().
16605 *
16606 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
16607 */
16608gboolean
16609control_power_call_set_power_state_finish (
16610 ControlPower *proxy,
16611 GAsyncResult *res,
16612 GError **error)
16613{
16614 GVariant *_ret;
16615 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
16616 if (_ret == NULL)
16617 goto _out;
16618 g_variant_get (_ret,
16619 "()");
16620 g_variant_unref (_ret);
16621_out:
16622 return _ret != NULL;
16623}
16624
16625/**
16626 * control_power_call_set_power_state_sync:
16627 * @proxy: A #ControlPowerProxy.
16628 * @arg_state: Argument to pass with the method invocation.
16629 * @cancellable: (allow-none): A #GCancellable or %NULL.
16630 * @error: Return location for error or %NULL.
16631 *
16632 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Power.setPowerState">setPowerState()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
16633 *
16634 * See control_power_call_set_power_state() for the asynchronous version of this method.
16635 *
16636 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
16637 */
16638gboolean
16639control_power_call_set_power_state_sync (
16640 ControlPower *proxy,
16641 gint arg_state,
16642 GCancellable *cancellable,
16643 GError **error)
16644{
16645 GVariant *_ret;
16646 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
16647 "setPowerState",
16648 g_variant_new ("(i)",
16649 arg_state),
16650 G_DBUS_CALL_FLAGS_NONE,
16651 -1,
16652 cancellable,
16653 error);
16654 if (_ret == NULL)
16655 goto _out;
16656 g_variant_get (_ret,
16657 "()");
16658 g_variant_unref (_ret);
16659_out:
16660 return _ret != NULL;
16661}
16662
16663/**
16664 * control_power_call_get_power_state:
16665 * @proxy: A #ControlPowerProxy.
16666 * @cancellable: (allow-none): A #GCancellable or %NULL.
16667 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
16668 * @user_data: User data to pass to @callback.
16669 *
16670 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Power.getPowerState">getPowerState()</link> D-Bus method on @proxy.
16671 * 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.
16672 * You can then call control_power_call_get_power_state_finish() to get the result of the operation.
16673 *
16674 * See control_power_call_get_power_state_sync() for the synchronous, blocking version of this method.
16675 */
16676void
16677control_power_call_get_power_state (
16678 ControlPower *proxy,
16679 GCancellable *cancellable,
16680 GAsyncReadyCallback callback,
16681 gpointer user_data)
16682{
16683 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
16684 "getPowerState",
16685 g_variant_new ("()"),
16686 G_DBUS_CALL_FLAGS_NONE,
16687 -1,
16688 cancellable,
16689 callback,
16690 user_data);
16691}
16692
16693/**
16694 * control_power_call_get_power_state_finish:
16695 * @proxy: A #ControlPowerProxy.
16696 * @out_state: (out): Return location for return parameter or %NULL to ignore.
16697 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_call_get_power_state().
16698 * @error: Return location for error or %NULL.
16699 *
16700 * Finishes an operation started with control_power_call_get_power_state().
16701 *
16702 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
16703 */
16704gboolean
16705control_power_call_get_power_state_finish (
16706 ControlPower *proxy,
16707 gint *out_state,
16708 GAsyncResult *res,
16709 GError **error)
16710{
16711 GVariant *_ret;
16712 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
16713 if (_ret == NULL)
16714 goto _out;
16715 g_variant_get (_ret,
16716 "(i)",
16717 out_state);
16718 g_variant_unref (_ret);
16719_out:
16720 return _ret != NULL;
16721}
16722
16723/**
16724 * control_power_call_get_power_state_sync:
16725 * @proxy: A #ControlPowerProxy.
16726 * @out_state: (out): Return location for return parameter or %NULL to ignore.
16727 * @cancellable: (allow-none): A #GCancellable or %NULL.
16728 * @error: Return location for error or %NULL.
16729 *
16730 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Power.getPowerState">getPowerState()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
16731 *
16732 * See control_power_call_get_power_state() for the asynchronous version of this method.
16733 *
16734 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
16735 */
16736gboolean
16737control_power_call_get_power_state_sync (
16738 ControlPower *proxy,
16739 gint *out_state,
16740 GCancellable *cancellable,
16741 GError **error)
16742{
16743 GVariant *_ret;
16744 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
16745 "getPowerState",
16746 g_variant_new ("()"),
16747 G_DBUS_CALL_FLAGS_NONE,
16748 -1,
16749 cancellable,
16750 error);
16751 if (_ret == NULL)
16752 goto _out;
16753 g_variant_get (_ret,
16754 "(i)",
16755 out_state);
16756 g_variant_unref (_ret);
16757_out:
16758 return _ret != NULL;
16759}
16760
16761/**
16762 * control_power_complete_set_power_state:
16763 * @object: A #ControlPower.
16764 * @invocation: (transfer full): A #GDBusMethodInvocation.
16765 *
16766 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-control-Power.setPowerState">setPowerState()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
16767 *
16768 * This method will free @invocation, you cannot use it afterwards.
16769 */
16770void
16771control_power_complete_set_power_state (
16772 ControlPower *object,
16773 GDBusMethodInvocation *invocation)
16774{
16775 g_dbus_method_invocation_return_value (invocation,
16776 g_variant_new ("()"));
16777}
16778
16779/**
16780 * control_power_complete_get_power_state:
16781 * @object: A #ControlPower.
16782 * @invocation: (transfer full): A #GDBusMethodInvocation.
16783 * @state: Parameter to return.
16784 *
16785 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-control-Power.getPowerState">getPowerState()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
16786 *
16787 * This method will free @invocation, you cannot use it afterwards.
16788 */
16789void
16790control_power_complete_get_power_state (
16791 ControlPower *object,
16792 GDBusMethodInvocation *invocation,
16793 gint state)
16794{
16795 g_dbus_method_invocation_return_value (invocation,
16796 g_variant_new ("(i)",
16797 state));
16798}
16799
16800/* ------------------------------------------------------------------------ */
16801
16802/**
16803 * ControlPowerProxy:
16804 *
16805 * The #ControlPowerProxy structure contains only private data and should only be accessed using the provided API.
16806 */
16807
16808/**
16809 * ControlPowerProxyClass:
16810 * @parent_class: The parent class.
16811 *
16812 * Class structure for #ControlPowerProxy.
16813 */
16814
16815struct _ControlPowerProxyPrivate
16816{
16817 GData *qdata;
16818};
16819
16820static void control_power_proxy_iface_init (ControlPowerIface *iface);
16821
16822#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
16823G_DEFINE_TYPE_WITH_CODE (ControlPowerProxy, control_power_proxy, G_TYPE_DBUS_PROXY,
16824 G_ADD_PRIVATE (ControlPowerProxy)
16825 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_proxy_iface_init));
16826
16827#else
16828G_DEFINE_TYPE_WITH_CODE (ControlPowerProxy, control_power_proxy, G_TYPE_DBUS_PROXY,
16829 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_proxy_iface_init));
16830
16831#endif
16832static void
16833control_power_proxy_finalize (GObject *object)
16834{
16835 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (object);
16836 g_datalist_clear (&proxy->priv->qdata);
16837 G_OBJECT_CLASS (control_power_proxy_parent_class)->finalize (object);
16838}
16839
16840static void
16841control_power_proxy_get_property (GObject *object,
16842 guint prop_id,
16843 GValue *value,
16844 GParamSpec *pspec G_GNUC_UNUSED)
16845{
16846 const _ExtendedGDBusPropertyInfo *info;
16847 GVariant *variant;
Norman James32e74e22015-09-15 21:28:06 -050016848 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -050016849 info = _control_power_property_info_pointers[prop_id - 1];
16850 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
16851 if (info->use_gvariant)
16852 {
16853 g_value_set_variant (value, variant);
16854 }
16855 else
16856 {
16857 if (variant != NULL)
16858 g_dbus_gvariant_to_gvalue (variant, value);
16859 }
16860 if (variant != NULL)
16861 g_variant_unref (variant);
16862}
16863
16864static void
16865control_power_proxy_set_property_cb (GDBusProxy *proxy,
16866 GAsyncResult *res,
16867 gpointer user_data)
16868{
16869 const _ExtendedGDBusPropertyInfo *info = user_data;
16870 GError *error;
16871 GVariant *_ret;
16872 error = NULL;
16873 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
16874 if (!_ret)
16875 {
16876 g_warning ("Error setting property '%s' on interface org.openbmc.control.Power: %s (%s, %d)",
16877 info->parent_struct.name,
16878 error->message, g_quark_to_string (error->domain), error->code);
16879 g_error_free (error);
16880 }
16881 else
16882 {
16883 g_variant_unref (_ret);
16884 }
16885}
16886
16887static void
16888control_power_proxy_set_property (GObject *object,
16889 guint prop_id,
16890 const GValue *value,
16891 GParamSpec *pspec G_GNUC_UNUSED)
16892{
16893 const _ExtendedGDBusPropertyInfo *info;
16894 GVariant *variant;
Norman James32e74e22015-09-15 21:28:06 -050016895 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -050016896 info = _control_power_property_info_pointers[prop_id - 1];
16897 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
16898 g_dbus_proxy_call (G_DBUS_PROXY (object),
16899 "org.freedesktop.DBus.Properties.Set",
16900 g_variant_new ("(ssv)", "org.openbmc.control.Power", info->parent_struct.name, variant),
16901 G_DBUS_CALL_FLAGS_NONE,
16902 -1,
16903 NULL, (GAsyncReadyCallback) control_power_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
16904 g_variant_unref (variant);
16905}
16906
16907static void
16908control_power_proxy_g_signal (GDBusProxy *proxy,
16909 const gchar *sender_name G_GNUC_UNUSED,
16910 const gchar *signal_name,
16911 GVariant *parameters)
16912{
16913 _ExtendedGDBusSignalInfo *info;
16914 GVariantIter iter;
16915 GVariant *child;
16916 GValue *paramv;
16917 guint num_params;
16918 guint n;
16919 guint signal_id;
16920 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, signal_name);
16921 if (info == NULL)
16922 return;
16923 num_params = g_variant_n_children (parameters);
16924 paramv = g_new0 (GValue, num_params + 1);
16925 g_value_init (&paramv[0], TYPE_CONTROL_POWER);
16926 g_value_set_object (&paramv[0], proxy);
16927 g_variant_iter_init (&iter, parameters);
16928 n = 1;
16929 while ((child = g_variant_iter_next_value (&iter)) != NULL)
16930 {
16931 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
16932 if (arg_info->use_gvariant)
16933 {
16934 g_value_init (&paramv[n], G_TYPE_VARIANT);
16935 g_value_set_variant (&paramv[n], child);
16936 n++;
16937 }
16938 else
16939 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
16940 g_variant_unref (child);
16941 }
16942 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_POWER);
16943 g_signal_emitv (paramv, signal_id, 0, NULL);
16944 for (n = 0; n < num_params + 1; n++)
16945 g_value_unset (&paramv[n]);
16946 g_free (paramv);
16947}
16948
16949static void
16950control_power_proxy_g_properties_changed (GDBusProxy *_proxy,
16951 GVariant *changed_properties,
16952 const gchar *const *invalidated_properties)
16953{
16954 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (_proxy);
16955 guint n;
16956 const gchar *key;
16957 GVariantIter *iter;
16958 _ExtendedGDBusPropertyInfo *info;
16959 g_variant_get (changed_properties, "a{sv}", &iter);
16960 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
16961 {
16962 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, key);
16963 g_datalist_remove_data (&proxy->priv->qdata, key);
16964 if (info != NULL)
16965 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
16966 }
16967 g_variant_iter_free (iter);
16968 for (n = 0; invalidated_properties[n] != NULL; n++)
16969 {
16970 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, invalidated_properties[n]);
16971 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
16972 if (info != NULL)
16973 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
16974 }
16975}
16976
16977static gint
16978control_power_proxy_get_pgood (ControlPower *object)
16979{
16980 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (object);
16981 GVariant *variant;
16982 gint value = 0;
16983 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "pgood");
16984 if (variant != NULL)
16985 {
16986 value = g_variant_get_int32 (variant);
16987 g_variant_unref (variant);
16988 }
16989 return value;
16990}
16991
16992static gint
16993control_power_proxy_get_state (ControlPower *object)
16994{
16995 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (object);
16996 GVariant *variant;
16997 gint value = 0;
16998 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state");
16999 if (variant != NULL)
17000 {
17001 value = g_variant_get_int32 (variant);
17002 g_variant_unref (variant);
17003 }
17004 return value;
17005}
17006
Norman James32e74e22015-09-15 21:28:06 -050017007static gint
17008control_power_proxy_get_pgood_timeout (ControlPower *object)
17009{
17010 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (object);
17011 GVariant *variant;
17012 gint value = 0;
17013 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "pgood_timeout");
17014 if (variant != NULL)
17015 {
17016 value = g_variant_get_int32 (variant);
17017 g_variant_unref (variant);
17018 }
17019 return value;
17020}
17021
Norman James362a80f2015-09-14 14:04:39 -050017022static void
17023control_power_proxy_init (ControlPowerProxy *proxy)
17024{
17025#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
17026 proxy->priv = control_power_proxy_get_instance_private (proxy);
17027#else
17028 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_POWER_PROXY, ControlPowerProxyPrivate);
17029#endif
17030
17031 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_power_interface_info ());
17032}
17033
17034static void
17035control_power_proxy_class_init (ControlPowerProxyClass *klass)
17036{
17037 GObjectClass *gobject_class;
17038 GDBusProxyClass *proxy_class;
17039
17040 gobject_class = G_OBJECT_CLASS (klass);
17041 gobject_class->finalize = control_power_proxy_finalize;
17042 gobject_class->get_property = control_power_proxy_get_property;
17043 gobject_class->set_property = control_power_proxy_set_property;
17044
17045 proxy_class = G_DBUS_PROXY_CLASS (klass);
17046 proxy_class->g_signal = control_power_proxy_g_signal;
17047 proxy_class->g_properties_changed = control_power_proxy_g_properties_changed;
17048
17049 control_power_override_properties (gobject_class, 1);
17050
17051#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
17052 g_type_class_add_private (klass, sizeof (ControlPowerProxyPrivate));
17053#endif
17054}
17055
17056static void
17057control_power_proxy_iface_init (ControlPowerIface *iface)
17058{
17059 iface->get_pgood = control_power_proxy_get_pgood;
17060 iface->get_state = control_power_proxy_get_state;
Norman James32e74e22015-09-15 21:28:06 -050017061 iface->get_pgood_timeout = control_power_proxy_get_pgood_timeout;
Norman James362a80f2015-09-14 14:04:39 -050017062}
17063
17064/**
17065 * control_power_proxy_new:
17066 * @connection: A #GDBusConnection.
17067 * @flags: Flags from the #GDBusProxyFlags enumeration.
17068 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
17069 * @object_path: An object path.
17070 * @cancellable: (allow-none): A #GCancellable or %NULL.
17071 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
17072 * @user_data: User data to pass to @callback.
17073 *
17074 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Power.top_of_page">org.openbmc.control.Power</link>. See g_dbus_proxy_new() for more details.
17075 *
17076 * 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.
17077 * You can then call control_power_proxy_new_finish() to get the result of the operation.
17078 *
17079 * See control_power_proxy_new_sync() for the synchronous, blocking version of this constructor.
17080 */
17081void
17082control_power_proxy_new (
17083 GDBusConnection *connection,
17084 GDBusProxyFlags flags,
17085 const gchar *name,
17086 const gchar *object_path,
17087 GCancellable *cancellable,
17088 GAsyncReadyCallback callback,
17089 gpointer user_data)
17090{
17091 g_async_initable_new_async (TYPE_CONTROL_POWER_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.control.Power", NULL);
17092}
17093
17094/**
17095 * control_power_proxy_new_finish:
17096 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_proxy_new().
17097 * @error: Return location for error or %NULL
17098 *
17099 * Finishes an operation started with control_power_proxy_new().
17100 *
17101 * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set.
17102 */
17103ControlPower *
17104control_power_proxy_new_finish (
17105 GAsyncResult *res,
17106 GError **error)
17107{
17108 GObject *ret;
17109 GObject *source_object;
17110 source_object = g_async_result_get_source_object (res);
17111 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
17112 g_object_unref (source_object);
17113 if (ret != NULL)
17114 return CONTROL_POWER (ret);
17115 else
17116 return NULL;
17117}
17118
17119/**
17120 * control_power_proxy_new_sync:
17121 * @connection: A #GDBusConnection.
17122 * @flags: Flags from the #GDBusProxyFlags enumeration.
17123 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
17124 * @object_path: An object path.
17125 * @cancellable: (allow-none): A #GCancellable or %NULL.
17126 * @error: Return location for error or %NULL
17127 *
17128 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Power.top_of_page">org.openbmc.control.Power</link>. See g_dbus_proxy_new_sync() for more details.
17129 *
17130 * The calling thread is blocked until a reply is received.
17131 *
17132 * See control_power_proxy_new() for the asynchronous version of this constructor.
17133 *
17134 * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set.
17135 */
17136ControlPower *
17137control_power_proxy_new_sync (
17138 GDBusConnection *connection,
17139 GDBusProxyFlags flags,
17140 const gchar *name,
17141 const gchar *object_path,
17142 GCancellable *cancellable,
17143 GError **error)
17144{
17145 GInitable *ret;
17146 ret = g_initable_new (TYPE_CONTROL_POWER_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.control.Power", NULL);
17147 if (ret != NULL)
17148 return CONTROL_POWER (ret);
17149 else
17150 return NULL;
17151}
17152
17153
17154/**
17155 * control_power_proxy_new_for_bus:
17156 * @bus_type: A #GBusType.
17157 * @flags: Flags from the #GDBusProxyFlags enumeration.
17158 * @name: A bus name (well-known or unique).
17159 * @object_path: An object path.
17160 * @cancellable: (allow-none): A #GCancellable or %NULL.
17161 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
17162 * @user_data: User data to pass to @callback.
17163 *
17164 * Like control_power_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
17165 *
17166 * 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.
17167 * You can then call control_power_proxy_new_for_bus_finish() to get the result of the operation.
17168 *
17169 * See control_power_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
17170 */
17171void
17172control_power_proxy_new_for_bus (
17173 GBusType bus_type,
17174 GDBusProxyFlags flags,
17175 const gchar *name,
17176 const gchar *object_path,
17177 GCancellable *cancellable,
17178 GAsyncReadyCallback callback,
17179 gpointer user_data)
17180{
17181 g_async_initable_new_async (TYPE_CONTROL_POWER_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.control.Power", NULL);
17182}
17183
17184/**
17185 * control_power_proxy_new_for_bus_finish:
17186 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_proxy_new_for_bus().
17187 * @error: Return location for error or %NULL
17188 *
17189 * Finishes an operation started with control_power_proxy_new_for_bus().
17190 *
17191 * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set.
17192 */
17193ControlPower *
17194control_power_proxy_new_for_bus_finish (
17195 GAsyncResult *res,
17196 GError **error)
17197{
17198 GObject *ret;
17199 GObject *source_object;
17200 source_object = g_async_result_get_source_object (res);
17201 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
17202 g_object_unref (source_object);
17203 if (ret != NULL)
17204 return CONTROL_POWER (ret);
17205 else
17206 return NULL;
17207}
17208
17209/**
17210 * control_power_proxy_new_for_bus_sync:
17211 * @bus_type: A #GBusType.
17212 * @flags: Flags from the #GDBusProxyFlags enumeration.
17213 * @name: A bus name (well-known or unique).
17214 * @object_path: An object path.
17215 * @cancellable: (allow-none): A #GCancellable or %NULL.
17216 * @error: Return location for error or %NULL
17217 *
17218 * Like control_power_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
17219 *
17220 * The calling thread is blocked until a reply is received.
17221 *
17222 * See control_power_proxy_new_for_bus() for the asynchronous version of this constructor.
17223 *
17224 * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set.
17225 */
17226ControlPower *
17227control_power_proxy_new_for_bus_sync (
17228 GBusType bus_type,
17229 GDBusProxyFlags flags,
17230 const gchar *name,
17231 const gchar *object_path,
17232 GCancellable *cancellable,
17233 GError **error)
17234{
17235 GInitable *ret;
17236 ret = g_initable_new (TYPE_CONTROL_POWER_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.control.Power", NULL);
17237 if (ret != NULL)
17238 return CONTROL_POWER (ret);
17239 else
17240 return NULL;
17241}
17242
17243
17244/* ------------------------------------------------------------------------ */
17245
17246/**
17247 * ControlPowerSkeleton:
17248 *
17249 * The #ControlPowerSkeleton structure contains only private data and should only be accessed using the provided API.
17250 */
17251
17252/**
17253 * ControlPowerSkeletonClass:
17254 * @parent_class: The parent class.
17255 *
17256 * Class structure for #ControlPowerSkeleton.
17257 */
17258
17259struct _ControlPowerSkeletonPrivate
17260{
17261 GValue *properties;
17262 GList *changed_properties;
17263 GSource *changed_properties_idle_source;
17264 GMainContext *context;
17265 GMutex lock;
17266};
17267
17268static void
17269_control_power_skeleton_handle_method_call (
17270 GDBusConnection *connection G_GNUC_UNUSED,
17271 const gchar *sender G_GNUC_UNUSED,
17272 const gchar *object_path G_GNUC_UNUSED,
17273 const gchar *interface_name,
17274 const gchar *method_name,
17275 GVariant *parameters,
17276 GDBusMethodInvocation *invocation,
17277 gpointer user_data)
17278{
17279 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data);
17280 _ExtendedGDBusMethodInfo *info;
17281 GVariantIter iter;
17282 GVariant *child;
17283 GValue *paramv;
17284 guint num_params;
17285 guint num_extra;
17286 guint n;
17287 guint signal_id;
17288 GValue return_value = G_VALUE_INIT;
17289 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
17290 g_assert (info != NULL);
17291 num_params = g_variant_n_children (parameters);
17292 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
17293 n = 0;
17294 g_value_init (&paramv[n], TYPE_CONTROL_POWER);
17295 g_value_set_object (&paramv[n++], skeleton);
17296 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
17297 g_value_set_object (&paramv[n++], invocation);
17298 if (info->pass_fdlist)
17299 {
17300#ifdef G_OS_UNIX
17301 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
17302 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
17303#else
17304 g_assert_not_reached ();
17305#endif
17306 }
17307 g_variant_iter_init (&iter, parameters);
17308 while ((child = g_variant_iter_next_value (&iter)) != NULL)
17309 {
17310 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
17311 if (arg_info->use_gvariant)
17312 {
17313 g_value_init (&paramv[n], G_TYPE_VARIANT);
17314 g_value_set_variant (&paramv[n], child);
17315 n++;
17316 }
17317 else
17318 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
17319 g_variant_unref (child);
17320 }
17321 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_POWER);
17322 g_value_init (&return_value, G_TYPE_BOOLEAN);
17323 g_signal_emitv (paramv, signal_id, 0, &return_value);
17324 if (!g_value_get_boolean (&return_value))
17325 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);
17326 g_value_unset (&return_value);
17327 for (n = 0; n < num_params + num_extra; n++)
17328 g_value_unset (&paramv[n]);
17329 g_free (paramv);
17330}
17331
17332static GVariant *
17333_control_power_skeleton_handle_get_property (
17334 GDBusConnection *connection G_GNUC_UNUSED,
17335 const gchar *sender G_GNUC_UNUSED,
17336 const gchar *object_path G_GNUC_UNUSED,
17337 const gchar *interface_name G_GNUC_UNUSED,
17338 const gchar *property_name,
17339 GError **error,
17340 gpointer user_data)
17341{
17342 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data);
17343 GValue value = G_VALUE_INIT;
17344 GParamSpec *pspec;
17345 _ExtendedGDBusPropertyInfo *info;
17346 GVariant *ret;
17347 ret = NULL;
17348 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, property_name);
17349 g_assert (info != NULL);
17350 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
17351 if (pspec == NULL)
17352 {
17353 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
17354 }
17355 else
17356 {
17357 g_value_init (&value, pspec->value_type);
17358 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
17359 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
17360 g_value_unset (&value);
17361 }
17362 return ret;
17363}
17364
17365static gboolean
17366_control_power_skeleton_handle_set_property (
17367 GDBusConnection *connection G_GNUC_UNUSED,
17368 const gchar *sender G_GNUC_UNUSED,
17369 const gchar *object_path G_GNUC_UNUSED,
17370 const gchar *interface_name G_GNUC_UNUSED,
17371 const gchar *property_name,
17372 GVariant *variant,
17373 GError **error,
17374 gpointer user_data)
17375{
17376 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data);
17377 GValue value = G_VALUE_INIT;
17378 GParamSpec *pspec;
17379 _ExtendedGDBusPropertyInfo *info;
17380 gboolean ret;
17381 ret = FALSE;
17382 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, property_name);
17383 g_assert (info != NULL);
17384 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
17385 if (pspec == NULL)
17386 {
17387 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
17388 }
17389 else
17390 {
17391 if (info->use_gvariant)
17392 g_value_set_variant (&value, variant);
17393 else
17394 g_dbus_gvariant_to_gvalue (variant, &value);
17395 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
17396 g_value_unset (&value);
17397 ret = TRUE;
17398 }
17399 return ret;
17400}
17401
17402static const GDBusInterfaceVTable _control_power_skeleton_vtable =
17403{
17404 _control_power_skeleton_handle_method_call,
17405 _control_power_skeleton_handle_get_property,
17406 _control_power_skeleton_handle_set_property,
17407 {NULL}
17408};
17409
17410static GDBusInterfaceInfo *
17411control_power_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
17412{
17413 return control_power_interface_info ();
17414}
17415
17416static GDBusInterfaceVTable *
17417control_power_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
17418{
17419 return (GDBusInterfaceVTable *) &_control_power_skeleton_vtable;
17420}
17421
17422static GVariant *
17423control_power_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
17424{
17425 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (_skeleton);
17426
17427 GVariantBuilder builder;
17428 guint n;
17429 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
17430 if (_control_power_interface_info.parent_struct.properties == NULL)
17431 goto out;
17432 for (n = 0; _control_power_interface_info.parent_struct.properties[n] != NULL; n++)
17433 {
17434 GDBusPropertyInfo *info = _control_power_interface_info.parent_struct.properties[n];
17435 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
17436 {
17437 GVariant *value;
17438 value = _control_power_skeleton_handle_get_property (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.control.Power", info->name, NULL, skeleton);
17439 if (value != NULL)
17440 {
17441 g_variant_take_ref (value);
17442 g_variant_builder_add (&builder, "{sv}", info->name, value);
17443 g_variant_unref (value);
17444 }
17445 }
17446 }
17447out:
17448 return g_variant_builder_end (&builder);
17449}
17450
17451static gboolean _control_power_emit_changed (gpointer user_data);
17452
17453static void
17454control_power_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
17455{
17456 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (_skeleton);
17457 gboolean emit_changed = FALSE;
17458
17459 g_mutex_lock (&skeleton->priv->lock);
17460 if (skeleton->priv->changed_properties_idle_source != NULL)
17461 {
17462 g_source_destroy (skeleton->priv->changed_properties_idle_source);
17463 skeleton->priv->changed_properties_idle_source = NULL;
17464 emit_changed = TRUE;
17465 }
17466 g_mutex_unlock (&skeleton->priv->lock);
17467
17468 if (emit_changed)
17469 _control_power_emit_changed (skeleton);
17470}
17471
17472static void
17473_control_power_on_signal_power_good (
17474 ControlPower *object)
17475{
17476 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
17477
17478 GList *connections, *l;
17479 GVariant *signal_variant;
17480 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
17481
17482 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
17483 for (l = connections; l != NULL; l = l->next)
17484 {
17485 GDBusConnection *connection = l->data;
17486 g_dbus_connection_emit_signal (connection,
17487 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.control.Power", "PowerGood",
17488 signal_variant, NULL);
17489 }
17490 g_variant_unref (signal_variant);
17491 g_list_free_full (connections, g_object_unref);
17492}
17493
17494static void
17495_control_power_on_signal_power_lost (
17496 ControlPower *object)
17497{
17498 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
17499
17500 GList *connections, *l;
17501 GVariant *signal_variant;
17502 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
17503
17504 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
17505 for (l = connections; l != NULL; l = l->next)
17506 {
17507 GDBusConnection *connection = l->data;
17508 g_dbus_connection_emit_signal (connection,
17509 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.control.Power", "PowerLost",
17510 signal_variant, NULL);
17511 }
17512 g_variant_unref (signal_variant);
17513 g_list_free_full (connections, g_object_unref);
17514}
17515
17516static void control_power_skeleton_iface_init (ControlPowerIface *iface);
17517#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
17518G_DEFINE_TYPE_WITH_CODE (ControlPowerSkeleton, control_power_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
17519 G_ADD_PRIVATE (ControlPowerSkeleton)
17520 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_skeleton_iface_init));
17521
17522#else
17523G_DEFINE_TYPE_WITH_CODE (ControlPowerSkeleton, control_power_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
17524 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_skeleton_iface_init));
17525
17526#endif
17527static void
17528control_power_skeleton_finalize (GObject *object)
17529{
17530 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
17531 guint n;
Norman James32e74e22015-09-15 21:28:06 -050017532 for (n = 0; n < 3; n++)
Norman James362a80f2015-09-14 14:04:39 -050017533 g_value_unset (&skeleton->priv->properties[n]);
17534 g_free (skeleton->priv->properties);
17535 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
17536 if (skeleton->priv->changed_properties_idle_source != NULL)
17537 g_source_destroy (skeleton->priv->changed_properties_idle_source);
17538 g_main_context_unref (skeleton->priv->context);
17539 g_mutex_clear (&skeleton->priv->lock);
17540 G_OBJECT_CLASS (control_power_skeleton_parent_class)->finalize (object);
17541}
17542
17543static void
17544control_power_skeleton_get_property (GObject *object,
17545 guint prop_id,
17546 GValue *value,
17547 GParamSpec *pspec G_GNUC_UNUSED)
17548{
17549 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
Norman James32e74e22015-09-15 21:28:06 -050017550 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -050017551 g_mutex_lock (&skeleton->priv->lock);
17552 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
17553 g_mutex_unlock (&skeleton->priv->lock);
17554}
17555
17556static gboolean
17557_control_power_emit_changed (gpointer user_data)
17558{
17559 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data);
17560 GList *l;
17561 GVariantBuilder builder;
17562 GVariantBuilder invalidated_builder;
17563 guint num_changes;
17564
17565 g_mutex_lock (&skeleton->priv->lock);
17566 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
17567 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
17568 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
17569 {
17570 ChangedProperty *cp = l->data;
17571 GVariant *variant;
17572 const GValue *cur_value;
17573
17574 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
17575 if (!_g_value_equal (cur_value, &cp->orig_value))
17576 {
17577 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
17578 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
17579 g_variant_unref (variant);
17580 num_changes++;
17581 }
17582 }
17583 if (num_changes > 0)
17584 {
17585 GList *connections, *ll;
17586 GVariant *signal_variant;
17587 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.control.Power",
17588 &builder, &invalidated_builder));
17589 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
17590 for (ll = connections; ll != NULL; ll = ll->next)
17591 {
17592 GDBusConnection *connection = ll->data;
17593
17594 g_dbus_connection_emit_signal (connection,
17595 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
17596 "org.freedesktop.DBus.Properties",
17597 "PropertiesChanged",
17598 signal_variant,
17599 NULL);
17600 }
17601 g_variant_unref (signal_variant);
17602 g_list_free_full (connections, g_object_unref);
17603 }
17604 else
17605 {
17606 g_variant_builder_clear (&builder);
17607 g_variant_builder_clear (&invalidated_builder);
17608 }
17609 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
17610 skeleton->priv->changed_properties = NULL;
17611 skeleton->priv->changed_properties_idle_source = NULL;
17612 g_mutex_unlock (&skeleton->priv->lock);
17613 return FALSE;
17614}
17615
17616static void
17617_control_power_schedule_emit_changed (ControlPowerSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
17618{
17619 ChangedProperty *cp;
17620 GList *l;
17621 cp = NULL;
17622 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
17623 {
17624 ChangedProperty *i_cp = l->data;
17625 if (i_cp->info == info)
17626 {
17627 cp = i_cp;
17628 break;
17629 }
17630 }
17631 if (cp == NULL)
17632 {
17633 cp = g_new0 (ChangedProperty, 1);
17634 cp->prop_id = prop_id;
17635 cp->info = info;
17636 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
17637 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
17638 g_value_copy (orig_value, &cp->orig_value);
17639 }
17640}
17641
17642static void
17643control_power_skeleton_notify (GObject *object,
17644 GParamSpec *pspec G_GNUC_UNUSED)
17645{
17646 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
17647 g_mutex_lock (&skeleton->priv->lock);
17648 if (skeleton->priv->changed_properties != NULL &&
17649 skeleton->priv->changed_properties_idle_source == NULL)
17650 {
17651 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
17652 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
17653 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _control_power_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
Adriana Kobylakfd778822016-06-16 09:08:37 -050017654 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _control_power_emit_changed");
Norman James362a80f2015-09-14 14:04:39 -050017655 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
17656 g_source_unref (skeleton->priv->changed_properties_idle_source);
17657 }
17658 g_mutex_unlock (&skeleton->priv->lock);
17659}
17660
17661static void
17662control_power_skeleton_set_property (GObject *object,
17663 guint prop_id,
17664 const GValue *value,
17665 GParamSpec *pspec)
17666{
17667 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
Norman James32e74e22015-09-15 21:28:06 -050017668 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -050017669 g_mutex_lock (&skeleton->priv->lock);
17670 g_object_freeze_notify (object);
17671 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
17672 {
17673 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
17674 _control_power_schedule_emit_changed (skeleton, _control_power_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
17675 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
17676 g_object_notify_by_pspec (object, pspec);
17677 }
17678 g_mutex_unlock (&skeleton->priv->lock);
17679 g_object_thaw_notify (object);
17680}
17681
17682static void
17683control_power_skeleton_init (ControlPowerSkeleton *skeleton)
17684{
17685#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
17686 skeleton->priv = control_power_skeleton_get_instance_private (skeleton);
17687#else
17688 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_POWER_SKELETON, ControlPowerSkeletonPrivate);
17689#endif
17690
17691 g_mutex_init (&skeleton->priv->lock);
17692 skeleton->priv->context = g_main_context_ref_thread_default ();
Norman James32e74e22015-09-15 21:28:06 -050017693 skeleton->priv->properties = g_new0 (GValue, 3);
Norman James362a80f2015-09-14 14:04:39 -050017694 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
17695 g_value_init (&skeleton->priv->properties[1], G_TYPE_INT);
Norman James32e74e22015-09-15 21:28:06 -050017696 g_value_init (&skeleton->priv->properties[2], G_TYPE_INT);
Norman James362a80f2015-09-14 14:04:39 -050017697}
17698
17699static gint
17700control_power_skeleton_get_pgood (ControlPower *object)
17701{
17702 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
17703 gint value;
17704 g_mutex_lock (&skeleton->priv->lock);
17705 value = g_value_get_int (&(skeleton->priv->properties[0]));
17706 g_mutex_unlock (&skeleton->priv->lock);
17707 return value;
17708}
17709
17710static gint
17711control_power_skeleton_get_state (ControlPower *object)
17712{
17713 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
17714 gint value;
17715 g_mutex_lock (&skeleton->priv->lock);
17716 value = g_value_get_int (&(skeleton->priv->properties[1]));
17717 g_mutex_unlock (&skeleton->priv->lock);
17718 return value;
17719}
17720
Norman James32e74e22015-09-15 21:28:06 -050017721static gint
17722control_power_skeleton_get_pgood_timeout (ControlPower *object)
17723{
17724 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
17725 gint value;
17726 g_mutex_lock (&skeleton->priv->lock);
17727 value = g_value_get_int (&(skeleton->priv->properties[2]));
17728 g_mutex_unlock (&skeleton->priv->lock);
17729 return value;
17730}
17731
Norman James362a80f2015-09-14 14:04:39 -050017732static void
17733control_power_skeleton_class_init (ControlPowerSkeletonClass *klass)
17734{
17735 GObjectClass *gobject_class;
17736 GDBusInterfaceSkeletonClass *skeleton_class;
17737
17738 gobject_class = G_OBJECT_CLASS (klass);
17739 gobject_class->finalize = control_power_skeleton_finalize;
17740 gobject_class->get_property = control_power_skeleton_get_property;
17741 gobject_class->set_property = control_power_skeleton_set_property;
17742 gobject_class->notify = control_power_skeleton_notify;
17743
17744
17745 control_power_override_properties (gobject_class, 1);
17746
17747 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
17748 skeleton_class->get_info = control_power_skeleton_dbus_interface_get_info;
17749 skeleton_class->get_properties = control_power_skeleton_dbus_interface_get_properties;
17750 skeleton_class->flush = control_power_skeleton_dbus_interface_flush;
17751 skeleton_class->get_vtable = control_power_skeleton_dbus_interface_get_vtable;
17752
17753#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
17754 g_type_class_add_private (klass, sizeof (ControlPowerSkeletonPrivate));
17755#endif
17756}
17757
17758static void
17759control_power_skeleton_iface_init (ControlPowerIface *iface)
17760{
17761 iface->power_good = _control_power_on_signal_power_good;
17762 iface->power_lost = _control_power_on_signal_power_lost;
17763 iface->get_pgood = control_power_skeleton_get_pgood;
17764 iface->get_state = control_power_skeleton_get_state;
Norman James32e74e22015-09-15 21:28:06 -050017765 iface->get_pgood_timeout = control_power_skeleton_get_pgood_timeout;
Norman James362a80f2015-09-14 14:04:39 -050017766}
17767
17768/**
17769 * control_power_skeleton_new:
17770 *
17771 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Power.top_of_page">org.openbmc.control.Power</link>.
17772 *
17773 * Returns: (transfer full) (type ControlPowerSkeleton): The skeleton object.
17774 */
17775ControlPower *
17776control_power_skeleton_new (void)
17777{
17778 return CONTROL_POWER (g_object_new (TYPE_CONTROL_POWER_SKELETON, NULL));
17779}
17780
17781/* ------------------------------------------------------------------------
Adriana Kobylakfd778822016-06-16 09:08:37 -050017782 * Code for interface org.openbmc.control.Checkstop
17783 * ------------------------------------------------------------------------
17784 */
17785
17786/**
17787 * SECTION:ControlCheckstop
17788 * @title: ControlCheckstop
17789 * @short_description: Generated C code for the org.openbmc.control.Checkstop D-Bus interface
17790 *
17791 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-control-Checkstop.top_of_page">org.openbmc.control.Checkstop</link> D-Bus interface in C.
17792 */
17793
17794/* ---- Introspection data for org.openbmc.control.Checkstop ---- */
17795
17796static const _ExtendedGDBusInterfaceInfo _control_checkstop_interface_info =
17797{
17798 {
17799 -1,
17800 (gchar *) "org.openbmc.control.Checkstop",
17801 NULL,
17802 NULL,
17803 NULL,
17804 NULL
17805 },
17806 "control-checkstop",
17807};
17808
17809
17810/**
17811 * control_checkstop_interface_info:
17812 *
17813 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-control-Checkstop.top_of_page">org.openbmc.control.Checkstop</link> D-Bus interface.
17814 *
17815 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
17816 */
17817GDBusInterfaceInfo *
17818control_checkstop_interface_info (void)
17819{
17820 return (GDBusInterfaceInfo *) &_control_checkstop_interface_info.parent_struct;
17821}
17822
17823/**
17824 * control_checkstop_override_properties:
17825 * @klass: The class structure for a #GObject<!-- -->-derived class.
17826 * @property_id_begin: The property id to assign to the first overridden property.
17827 *
17828 * Overrides all #GObject properties in the #ControlCheckstop interface for a concrete class.
17829 * The properties are overridden in the order they are defined.
17830 *
17831 * Returns: The last property id.
17832 */
17833guint
17834control_checkstop_override_properties (GObjectClass *klass, guint property_id_begin)
17835{
17836 return property_id_begin - 1;
17837}
17838
17839
17840
17841/**
17842 * ControlCheckstop:
17843 *
17844 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Checkstop.top_of_page">org.openbmc.control.Checkstop</link>.
17845 */
17846
17847/**
17848 * ControlCheckstopIface:
17849 * @parent_iface: The parent interface.
17850 *
17851 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Checkstop.top_of_page">org.openbmc.control.Checkstop</link>.
17852 */
17853
17854typedef ControlCheckstopIface ControlCheckstopInterface;
17855G_DEFINE_INTERFACE (ControlCheckstop, control_checkstop, G_TYPE_OBJECT);
17856
17857static void
17858control_checkstop_default_init (ControlCheckstopIface *iface)
17859{
17860}
17861
17862/* ------------------------------------------------------------------------ */
17863
17864/**
17865 * ControlCheckstopProxy:
17866 *
17867 * The #ControlCheckstopProxy structure contains only private data and should only be accessed using the provided API.
17868 */
17869
17870/**
17871 * ControlCheckstopProxyClass:
17872 * @parent_class: The parent class.
17873 *
17874 * Class structure for #ControlCheckstopProxy.
17875 */
17876
17877struct _ControlCheckstopProxyPrivate
17878{
17879 GData *qdata;
17880};
17881
17882static void control_checkstop_proxy_iface_init (ControlCheckstopIface *iface);
17883
17884#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
17885G_DEFINE_TYPE_WITH_CODE (ControlCheckstopProxy, control_checkstop_proxy, G_TYPE_DBUS_PROXY,
17886 G_ADD_PRIVATE (ControlCheckstopProxy)
17887 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_CHECKSTOP, control_checkstop_proxy_iface_init));
17888
17889#else
17890G_DEFINE_TYPE_WITH_CODE (ControlCheckstopProxy, control_checkstop_proxy, G_TYPE_DBUS_PROXY,
17891 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_CHECKSTOP, control_checkstop_proxy_iface_init));
17892
17893#endif
17894static void
17895control_checkstop_proxy_finalize (GObject *object)
17896{
17897 ControlCheckstopProxy *proxy = CONTROL_CHECKSTOP_PROXY (object);
17898 g_datalist_clear (&proxy->priv->qdata);
17899 G_OBJECT_CLASS (control_checkstop_proxy_parent_class)->finalize (object);
17900}
17901
17902static void
17903control_checkstop_proxy_get_property (GObject *object,
17904 guint prop_id,
17905 GValue *value,
17906 GParamSpec *pspec G_GNUC_UNUSED)
17907{
17908}
17909
17910static void
17911control_checkstop_proxy_set_property (GObject *object,
17912 guint prop_id,
17913 const GValue *value,
17914 GParamSpec *pspec G_GNUC_UNUSED)
17915{
17916}
17917
17918static void
17919control_checkstop_proxy_g_signal (GDBusProxy *proxy,
17920 const gchar *sender_name G_GNUC_UNUSED,
17921 const gchar *signal_name,
17922 GVariant *parameters)
17923{
17924 _ExtendedGDBusSignalInfo *info;
17925 GVariantIter iter;
17926 GVariant *child;
17927 GValue *paramv;
17928 guint num_params;
17929 guint n;
17930 guint signal_id;
17931 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_checkstop_interface_info.parent_struct, signal_name);
17932 if (info == NULL)
17933 return;
17934 num_params = g_variant_n_children (parameters);
17935 paramv = g_new0 (GValue, num_params + 1);
17936 g_value_init (&paramv[0], TYPE_CONTROL_CHECKSTOP);
17937 g_value_set_object (&paramv[0], proxy);
17938 g_variant_iter_init (&iter, parameters);
17939 n = 1;
17940 while ((child = g_variant_iter_next_value (&iter)) != NULL)
17941 {
17942 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
17943 if (arg_info->use_gvariant)
17944 {
17945 g_value_init (&paramv[n], G_TYPE_VARIANT);
17946 g_value_set_variant (&paramv[n], child);
17947 n++;
17948 }
17949 else
17950 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
17951 g_variant_unref (child);
17952 }
17953 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_CHECKSTOP);
17954 g_signal_emitv (paramv, signal_id, 0, NULL);
17955 for (n = 0; n < num_params + 1; n++)
17956 g_value_unset (&paramv[n]);
17957 g_free (paramv);
17958}
17959
17960static void
17961control_checkstop_proxy_g_properties_changed (GDBusProxy *_proxy,
17962 GVariant *changed_properties,
17963 const gchar *const *invalidated_properties)
17964{
17965 ControlCheckstopProxy *proxy = CONTROL_CHECKSTOP_PROXY (_proxy);
17966 guint n;
17967 const gchar *key;
17968 GVariantIter *iter;
17969 _ExtendedGDBusPropertyInfo *info;
17970 g_variant_get (changed_properties, "a{sv}", &iter);
17971 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
17972 {
17973 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_checkstop_interface_info.parent_struct, key);
17974 g_datalist_remove_data (&proxy->priv->qdata, key);
17975 if (info != NULL)
17976 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
17977 }
17978 g_variant_iter_free (iter);
17979 for (n = 0; invalidated_properties[n] != NULL; n++)
17980 {
17981 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_checkstop_interface_info.parent_struct, invalidated_properties[n]);
17982 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
17983 if (info != NULL)
17984 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
17985 }
17986}
17987
17988static void
17989control_checkstop_proxy_init (ControlCheckstopProxy *proxy)
17990{
17991#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
17992 proxy->priv = control_checkstop_proxy_get_instance_private (proxy);
17993#else
17994 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_CHECKSTOP_PROXY, ControlCheckstopProxyPrivate);
17995#endif
17996
17997 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_checkstop_interface_info ());
17998}
17999
18000static void
18001control_checkstop_proxy_class_init (ControlCheckstopProxyClass *klass)
18002{
18003 GObjectClass *gobject_class;
18004 GDBusProxyClass *proxy_class;
18005
18006 gobject_class = G_OBJECT_CLASS (klass);
18007 gobject_class->finalize = control_checkstop_proxy_finalize;
18008 gobject_class->get_property = control_checkstop_proxy_get_property;
18009 gobject_class->set_property = control_checkstop_proxy_set_property;
18010
18011 proxy_class = G_DBUS_PROXY_CLASS (klass);
18012 proxy_class->g_signal = control_checkstop_proxy_g_signal;
18013 proxy_class->g_properties_changed = control_checkstop_proxy_g_properties_changed;
18014
18015#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
18016 g_type_class_add_private (klass, sizeof (ControlCheckstopProxyPrivate));
18017#endif
18018}
18019
18020static void
18021control_checkstop_proxy_iface_init (ControlCheckstopIface *iface)
18022{
18023}
18024
18025/**
18026 * control_checkstop_proxy_new:
18027 * @connection: A #GDBusConnection.
18028 * @flags: Flags from the #GDBusProxyFlags enumeration.
18029 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
18030 * @object_path: An object path.
18031 * @cancellable: (allow-none): A #GCancellable or %NULL.
18032 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
18033 * @user_data: User data to pass to @callback.
18034 *
18035 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Checkstop.top_of_page">org.openbmc.control.Checkstop</link>. See g_dbus_proxy_new() for more details.
18036 *
18037 * 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.
18038 * You can then call control_checkstop_proxy_new_finish() to get the result of the operation.
18039 *
18040 * See control_checkstop_proxy_new_sync() for the synchronous, blocking version of this constructor.
18041 */
18042void
18043control_checkstop_proxy_new (
18044 GDBusConnection *connection,
18045 GDBusProxyFlags flags,
18046 const gchar *name,
18047 const gchar *object_path,
18048 GCancellable *cancellable,
18049 GAsyncReadyCallback callback,
18050 gpointer user_data)
18051{
18052 g_async_initable_new_async (TYPE_CONTROL_CHECKSTOP_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.control.Checkstop", NULL);
18053}
18054
18055/**
18056 * control_checkstop_proxy_new_finish:
18057 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_checkstop_proxy_new().
18058 * @error: Return location for error or %NULL
18059 *
18060 * Finishes an operation started with control_checkstop_proxy_new().
18061 *
18062 * Returns: (transfer full) (type ControlCheckstopProxy): The constructed proxy object or %NULL if @error is set.
18063 */
18064ControlCheckstop *
18065control_checkstop_proxy_new_finish (
18066 GAsyncResult *res,
18067 GError **error)
18068{
18069 GObject *ret;
18070 GObject *source_object;
18071 source_object = g_async_result_get_source_object (res);
18072 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
18073 g_object_unref (source_object);
18074 if (ret != NULL)
18075 return CONTROL_CHECKSTOP (ret);
18076 else
18077 return NULL;
18078}
18079
18080/**
18081 * control_checkstop_proxy_new_sync:
18082 * @connection: A #GDBusConnection.
18083 * @flags: Flags from the #GDBusProxyFlags enumeration.
18084 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
18085 * @object_path: An object path.
18086 * @cancellable: (allow-none): A #GCancellable or %NULL.
18087 * @error: Return location for error or %NULL
18088 *
18089 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Checkstop.top_of_page">org.openbmc.control.Checkstop</link>. See g_dbus_proxy_new_sync() for more details.
18090 *
18091 * The calling thread is blocked until a reply is received.
18092 *
18093 * See control_checkstop_proxy_new() for the asynchronous version of this constructor.
18094 *
18095 * Returns: (transfer full) (type ControlCheckstopProxy): The constructed proxy object or %NULL if @error is set.
18096 */
18097ControlCheckstop *
18098control_checkstop_proxy_new_sync (
18099 GDBusConnection *connection,
18100 GDBusProxyFlags flags,
18101 const gchar *name,
18102 const gchar *object_path,
18103 GCancellable *cancellable,
18104 GError **error)
18105{
18106 GInitable *ret;
18107 ret = g_initable_new (TYPE_CONTROL_CHECKSTOP_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.control.Checkstop", NULL);
18108 if (ret != NULL)
18109 return CONTROL_CHECKSTOP (ret);
18110 else
18111 return NULL;
18112}
18113
18114
18115/**
18116 * control_checkstop_proxy_new_for_bus:
18117 * @bus_type: A #GBusType.
18118 * @flags: Flags from the #GDBusProxyFlags enumeration.
18119 * @name: A bus name (well-known or unique).
18120 * @object_path: An object path.
18121 * @cancellable: (allow-none): A #GCancellable or %NULL.
18122 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
18123 * @user_data: User data to pass to @callback.
18124 *
18125 * Like control_checkstop_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
18126 *
18127 * 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.
18128 * You can then call control_checkstop_proxy_new_for_bus_finish() to get the result of the operation.
18129 *
18130 * See control_checkstop_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
18131 */
18132void
18133control_checkstop_proxy_new_for_bus (
18134 GBusType bus_type,
18135 GDBusProxyFlags flags,
18136 const gchar *name,
18137 const gchar *object_path,
18138 GCancellable *cancellable,
18139 GAsyncReadyCallback callback,
18140 gpointer user_data)
18141{
18142 g_async_initable_new_async (TYPE_CONTROL_CHECKSTOP_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.control.Checkstop", NULL);
18143}
18144
18145/**
18146 * control_checkstop_proxy_new_for_bus_finish:
18147 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_checkstop_proxy_new_for_bus().
18148 * @error: Return location for error or %NULL
18149 *
18150 * Finishes an operation started with control_checkstop_proxy_new_for_bus().
18151 *
18152 * Returns: (transfer full) (type ControlCheckstopProxy): The constructed proxy object or %NULL if @error is set.
18153 */
18154ControlCheckstop *
18155control_checkstop_proxy_new_for_bus_finish (
18156 GAsyncResult *res,
18157 GError **error)
18158{
18159 GObject *ret;
18160 GObject *source_object;
18161 source_object = g_async_result_get_source_object (res);
18162 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
18163 g_object_unref (source_object);
18164 if (ret != NULL)
18165 return CONTROL_CHECKSTOP (ret);
18166 else
18167 return NULL;
18168}
18169
18170/**
18171 * control_checkstop_proxy_new_for_bus_sync:
18172 * @bus_type: A #GBusType.
18173 * @flags: Flags from the #GDBusProxyFlags enumeration.
18174 * @name: A bus name (well-known or unique).
18175 * @object_path: An object path.
18176 * @cancellable: (allow-none): A #GCancellable or %NULL.
18177 * @error: Return location for error or %NULL
18178 *
18179 * Like control_checkstop_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
18180 *
18181 * The calling thread is blocked until a reply is received.
18182 *
18183 * See control_checkstop_proxy_new_for_bus() for the asynchronous version of this constructor.
18184 *
18185 * Returns: (transfer full) (type ControlCheckstopProxy): The constructed proxy object or %NULL if @error is set.
18186 */
18187ControlCheckstop *
18188control_checkstop_proxy_new_for_bus_sync (
18189 GBusType bus_type,
18190 GDBusProxyFlags flags,
18191 const gchar *name,
18192 const gchar *object_path,
18193 GCancellable *cancellable,
18194 GError **error)
18195{
18196 GInitable *ret;
18197 ret = g_initable_new (TYPE_CONTROL_CHECKSTOP_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.control.Checkstop", NULL);
18198 if (ret != NULL)
18199 return CONTROL_CHECKSTOP (ret);
18200 else
18201 return NULL;
18202}
18203
18204
18205/* ------------------------------------------------------------------------ */
18206
18207/**
18208 * ControlCheckstopSkeleton:
18209 *
18210 * The #ControlCheckstopSkeleton structure contains only private data and should only be accessed using the provided API.
18211 */
18212
18213/**
18214 * ControlCheckstopSkeletonClass:
18215 * @parent_class: The parent class.
18216 *
18217 * Class structure for #ControlCheckstopSkeleton.
18218 */
18219
18220struct _ControlCheckstopSkeletonPrivate
18221{
18222 GValue *properties;
18223 GList *changed_properties;
18224 GSource *changed_properties_idle_source;
18225 GMainContext *context;
18226 GMutex lock;
18227};
18228
18229static void
18230_control_checkstop_skeleton_handle_method_call (
18231 GDBusConnection *connection G_GNUC_UNUSED,
18232 const gchar *sender G_GNUC_UNUSED,
18233 const gchar *object_path G_GNUC_UNUSED,
18234 const gchar *interface_name,
18235 const gchar *method_name,
18236 GVariant *parameters,
18237 GDBusMethodInvocation *invocation,
18238 gpointer user_data)
18239{
18240 ControlCheckstopSkeleton *skeleton = CONTROL_CHECKSTOP_SKELETON (user_data);
18241 _ExtendedGDBusMethodInfo *info;
18242 GVariantIter iter;
18243 GVariant *child;
18244 GValue *paramv;
18245 guint num_params;
18246 guint num_extra;
18247 guint n;
18248 guint signal_id;
18249 GValue return_value = G_VALUE_INIT;
18250 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
18251 g_assert (info != NULL);
18252 num_params = g_variant_n_children (parameters);
18253 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
18254 n = 0;
18255 g_value_init (&paramv[n], TYPE_CONTROL_CHECKSTOP);
18256 g_value_set_object (&paramv[n++], skeleton);
18257 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
18258 g_value_set_object (&paramv[n++], invocation);
18259 if (info->pass_fdlist)
18260 {
18261#ifdef G_OS_UNIX
18262 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
18263 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
18264#else
18265 g_assert_not_reached ();
18266#endif
18267 }
18268 g_variant_iter_init (&iter, parameters);
18269 while ((child = g_variant_iter_next_value (&iter)) != NULL)
18270 {
18271 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
18272 if (arg_info->use_gvariant)
18273 {
18274 g_value_init (&paramv[n], G_TYPE_VARIANT);
18275 g_value_set_variant (&paramv[n], child);
18276 n++;
18277 }
18278 else
18279 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
18280 g_variant_unref (child);
18281 }
18282 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_CHECKSTOP);
18283 g_value_init (&return_value, G_TYPE_BOOLEAN);
18284 g_signal_emitv (paramv, signal_id, 0, &return_value);
18285 if (!g_value_get_boolean (&return_value))
18286 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);
18287 g_value_unset (&return_value);
18288 for (n = 0; n < num_params + num_extra; n++)
18289 g_value_unset (&paramv[n]);
18290 g_free (paramv);
18291}
18292
18293static GVariant *
18294_control_checkstop_skeleton_handle_get_property (
18295 GDBusConnection *connection G_GNUC_UNUSED,
18296 const gchar *sender G_GNUC_UNUSED,
18297 const gchar *object_path G_GNUC_UNUSED,
18298 const gchar *interface_name G_GNUC_UNUSED,
18299 const gchar *property_name,
18300 GError **error,
18301 gpointer user_data)
18302{
18303 ControlCheckstopSkeleton *skeleton = CONTROL_CHECKSTOP_SKELETON (user_data);
18304 GValue value = G_VALUE_INIT;
18305 GParamSpec *pspec;
18306 _ExtendedGDBusPropertyInfo *info;
18307 GVariant *ret;
18308 ret = NULL;
18309 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_checkstop_interface_info.parent_struct, property_name);
18310 g_assert (info != NULL);
18311 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
18312 if (pspec == NULL)
18313 {
18314 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
18315 }
18316 else
18317 {
18318 g_value_init (&value, pspec->value_type);
18319 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
18320 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
18321 g_value_unset (&value);
18322 }
18323 return ret;
18324}
18325
18326static gboolean
18327_control_checkstop_skeleton_handle_set_property (
18328 GDBusConnection *connection G_GNUC_UNUSED,
18329 const gchar *sender G_GNUC_UNUSED,
18330 const gchar *object_path G_GNUC_UNUSED,
18331 const gchar *interface_name G_GNUC_UNUSED,
18332 const gchar *property_name,
18333 GVariant *variant,
18334 GError **error,
18335 gpointer user_data)
18336{
18337 ControlCheckstopSkeleton *skeleton = CONTROL_CHECKSTOP_SKELETON (user_data);
18338 GValue value = G_VALUE_INIT;
18339 GParamSpec *pspec;
18340 _ExtendedGDBusPropertyInfo *info;
18341 gboolean ret;
18342 ret = FALSE;
18343 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_checkstop_interface_info.parent_struct, property_name);
18344 g_assert (info != NULL);
18345 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
18346 if (pspec == NULL)
18347 {
18348 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
18349 }
18350 else
18351 {
18352 if (info->use_gvariant)
18353 g_value_set_variant (&value, variant);
18354 else
18355 g_dbus_gvariant_to_gvalue (variant, &value);
18356 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
18357 g_value_unset (&value);
18358 ret = TRUE;
18359 }
18360 return ret;
18361}
18362
18363static const GDBusInterfaceVTable _control_checkstop_skeleton_vtable =
18364{
18365 _control_checkstop_skeleton_handle_method_call,
18366 _control_checkstop_skeleton_handle_get_property,
18367 _control_checkstop_skeleton_handle_set_property,
18368 {NULL}
18369};
18370
18371static GDBusInterfaceInfo *
18372control_checkstop_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
18373{
18374 return control_checkstop_interface_info ();
18375}
18376
18377static GDBusInterfaceVTable *
18378control_checkstop_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
18379{
18380 return (GDBusInterfaceVTable *) &_control_checkstop_skeleton_vtable;
18381}
18382
18383static GVariant *
18384control_checkstop_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
18385{
18386 ControlCheckstopSkeleton *skeleton = CONTROL_CHECKSTOP_SKELETON (_skeleton);
18387
18388 GVariantBuilder builder;
18389 guint n;
18390 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
18391 if (_control_checkstop_interface_info.parent_struct.properties == NULL)
18392 goto out;
18393 for (n = 0; _control_checkstop_interface_info.parent_struct.properties[n] != NULL; n++)
18394 {
18395 GDBusPropertyInfo *info = _control_checkstop_interface_info.parent_struct.properties[n];
18396 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
18397 {
18398 GVariant *value;
18399 value = _control_checkstop_skeleton_handle_get_property (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.control.Checkstop", info->name, NULL, skeleton);
18400 if (value != NULL)
18401 {
18402 g_variant_take_ref (value);
18403 g_variant_builder_add (&builder, "{sv}", info->name, value);
18404 g_variant_unref (value);
18405 }
18406 }
18407 }
18408out:
18409 return g_variant_builder_end (&builder);
18410}
18411
18412static void
18413control_checkstop_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
18414{
18415}
18416
18417static void control_checkstop_skeleton_iface_init (ControlCheckstopIface *iface);
18418#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
18419G_DEFINE_TYPE_WITH_CODE (ControlCheckstopSkeleton, control_checkstop_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
18420 G_ADD_PRIVATE (ControlCheckstopSkeleton)
18421 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_CHECKSTOP, control_checkstop_skeleton_iface_init));
18422
18423#else
18424G_DEFINE_TYPE_WITH_CODE (ControlCheckstopSkeleton, control_checkstop_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
18425 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_CHECKSTOP, control_checkstop_skeleton_iface_init));
18426
18427#endif
18428static void
18429control_checkstop_skeleton_finalize (GObject *object)
18430{
18431 ControlCheckstopSkeleton *skeleton = CONTROL_CHECKSTOP_SKELETON (object);
18432 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
18433 if (skeleton->priv->changed_properties_idle_source != NULL)
18434 g_source_destroy (skeleton->priv->changed_properties_idle_source);
18435 g_main_context_unref (skeleton->priv->context);
18436 g_mutex_clear (&skeleton->priv->lock);
18437 G_OBJECT_CLASS (control_checkstop_skeleton_parent_class)->finalize (object);
18438}
18439
18440static void
18441control_checkstop_skeleton_init (ControlCheckstopSkeleton *skeleton)
18442{
18443#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
18444 skeleton->priv = control_checkstop_skeleton_get_instance_private (skeleton);
18445#else
18446 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_CHECKSTOP_SKELETON, ControlCheckstopSkeletonPrivate);
18447#endif
18448
18449 g_mutex_init (&skeleton->priv->lock);
18450 skeleton->priv->context = g_main_context_ref_thread_default ();
18451}
18452
18453static void
18454control_checkstop_skeleton_class_init (ControlCheckstopSkeletonClass *klass)
18455{
18456 GObjectClass *gobject_class;
18457 GDBusInterfaceSkeletonClass *skeleton_class;
18458
18459 gobject_class = G_OBJECT_CLASS (klass);
18460 gobject_class->finalize = control_checkstop_skeleton_finalize;
18461
18462 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
18463 skeleton_class->get_info = control_checkstop_skeleton_dbus_interface_get_info;
18464 skeleton_class->get_properties = control_checkstop_skeleton_dbus_interface_get_properties;
18465 skeleton_class->flush = control_checkstop_skeleton_dbus_interface_flush;
18466 skeleton_class->get_vtable = control_checkstop_skeleton_dbus_interface_get_vtable;
18467
18468#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
18469 g_type_class_add_private (klass, sizeof (ControlCheckstopSkeletonPrivate));
18470#endif
18471}
18472
18473static void
18474control_checkstop_skeleton_iface_init (ControlCheckstopIface *iface)
18475{
18476}
18477
18478/**
18479 * control_checkstop_skeleton_new:
18480 *
18481 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Checkstop.top_of_page">org.openbmc.control.Checkstop</link>.
18482 *
18483 * Returns: (transfer full) (type ControlCheckstopSkeleton): The skeleton object.
18484 */
18485ControlCheckstop *
18486control_checkstop_skeleton_new (void)
18487{
18488 return CONTROL_CHECKSTOP (g_object_new (TYPE_CONTROL_CHECKSTOP_SKELETON, NULL));
18489}
18490
18491/* ------------------------------------------------------------------------
Norman James362a80f2015-09-14 14:04:39 -050018492 * Code for interface org.openbmc.Watchdog
18493 * ------------------------------------------------------------------------
18494 */
18495
18496/**
18497 * SECTION:Watchdog
18498 * @title: Watchdog
18499 * @short_description: Generated C code for the org.openbmc.Watchdog D-Bus interface
18500 *
18501 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link> D-Bus interface in C.
18502 */
18503
18504/* ---- Introspection data for org.openbmc.Watchdog ---- */
18505
18506static const _ExtendedGDBusMethodInfo _watchdog_method_info_start =
18507{
18508 {
18509 -1,
18510 (gchar *) "start",
18511 NULL,
18512 NULL,
18513 NULL
18514 },
18515 "handle-start",
18516 FALSE
18517};
18518
18519static const _ExtendedGDBusMethodInfo _watchdog_method_info_poke =
18520{
18521 {
18522 -1,
18523 (gchar *) "poke",
18524 NULL,
18525 NULL,
18526 NULL
18527 },
18528 "handle-poke",
18529 FALSE
18530};
18531
18532static const _ExtendedGDBusMethodInfo _watchdog_method_info_stop =
18533{
18534 {
18535 -1,
18536 (gchar *) "stop",
18537 NULL,
18538 NULL,
18539 NULL
18540 },
18541 "handle-stop",
18542 FALSE
18543};
18544
Adriana Kobylak2cb27752015-10-19 16:23:14 -050018545static const _ExtendedGDBusArgInfo _watchdog_method_info_set_IN_ARG_interval =
18546{
18547 {
18548 -1,
18549 (gchar *) "interval",
18550 (gchar *) "i",
18551 NULL
18552 },
18553 FALSE
18554};
18555
18556static const _ExtendedGDBusArgInfo * const _watchdog_method_info_set_IN_ARG_pointers[] =
18557{
18558 &_watchdog_method_info_set_IN_ARG_interval,
18559 NULL
18560};
18561
18562static const _ExtendedGDBusMethodInfo _watchdog_method_info_set =
18563{
18564 {
18565 -1,
18566 (gchar *) "set",
18567 (GDBusArgInfo **) &_watchdog_method_info_set_IN_ARG_pointers,
18568 NULL,
18569 NULL
18570 },
18571 "handle-set",
18572 FALSE
18573};
18574
Norman James362a80f2015-09-14 14:04:39 -050018575static const _ExtendedGDBusMethodInfo * const _watchdog_method_info_pointers[] =
18576{
18577 &_watchdog_method_info_start,
18578 &_watchdog_method_info_poke,
18579 &_watchdog_method_info_stop,
Adriana Kobylak2cb27752015-10-19 16:23:14 -050018580 &_watchdog_method_info_set,
Norman James362a80f2015-09-14 14:04:39 -050018581 NULL
18582};
18583
18584static const _ExtendedGDBusSignalInfo _watchdog_signal_info_watchdog_error =
18585{
18586 {
18587 -1,
18588 (gchar *) "WatchdogError",
18589 NULL,
18590 NULL
18591 },
18592 "watchdog-error"
18593};
18594
18595static const _ExtendedGDBusSignalInfo * const _watchdog_signal_info_pointers[] =
18596{
18597 &_watchdog_signal_info_watchdog_error,
18598 NULL
18599};
18600
18601static const _ExtendedGDBusPropertyInfo _watchdog_property_info_watchdog =
18602{
18603 {
18604 -1,
18605 (gchar *) "watchdog",
18606 (gchar *) "i",
18607 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
18608 NULL
18609 },
18610 "watchdog",
18611 FALSE
18612};
18613
18614static const _ExtendedGDBusPropertyInfo _watchdog_property_info_poll_interval =
18615{
18616 {
18617 -1,
18618 (gchar *) "poll_interval",
18619 (gchar *) "i",
18620 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
18621 NULL
18622 },
18623 "poll-interval",
18624 FALSE
18625};
18626
18627static const _ExtendedGDBusPropertyInfo * const _watchdog_property_info_pointers[] =
18628{
18629 &_watchdog_property_info_watchdog,
18630 &_watchdog_property_info_poll_interval,
18631 NULL
18632};
18633
18634static const _ExtendedGDBusInterfaceInfo _watchdog_interface_info =
18635{
18636 {
18637 -1,
18638 (gchar *) "org.openbmc.Watchdog",
18639 (GDBusMethodInfo **) &_watchdog_method_info_pointers,
18640 (GDBusSignalInfo **) &_watchdog_signal_info_pointers,
18641 (GDBusPropertyInfo **) &_watchdog_property_info_pointers,
18642 NULL
18643 },
18644 "watchdog",
18645};
18646
18647
18648/**
18649 * watchdog_interface_info:
18650 *
18651 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link> D-Bus interface.
18652 *
18653 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
18654 */
18655GDBusInterfaceInfo *
18656watchdog_interface_info (void)
18657{
18658 return (GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct;
18659}
18660
18661/**
18662 * watchdog_override_properties:
18663 * @klass: The class structure for a #GObject<!-- -->-derived class.
18664 * @property_id_begin: The property id to assign to the first overridden property.
18665 *
18666 * Overrides all #GObject properties in the #Watchdog interface for a concrete class.
18667 * The properties are overridden in the order they are defined.
18668 *
18669 * Returns: The last property id.
18670 */
18671guint
18672watchdog_override_properties (GObjectClass *klass, guint property_id_begin)
18673{
18674 g_object_class_override_property (klass, property_id_begin++, "watchdog");
18675 g_object_class_override_property (klass, property_id_begin++, "poll-interval");
18676 return property_id_begin - 1;
18677}
18678
18679
18680
18681/**
18682 * Watchdog:
18683 *
18684 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link>.
18685 */
18686
18687/**
18688 * WatchdogIface:
18689 * @parent_iface: The parent interface.
18690 * @handle_poke: Handler for the #Watchdog::handle-poke signal.
Adriana Kobylak2cb27752015-10-19 16:23:14 -050018691 * @handle_set: Handler for the #Watchdog::handle-set signal.
Norman James362a80f2015-09-14 14:04:39 -050018692 * @handle_start: Handler for the #Watchdog::handle-start signal.
18693 * @handle_stop: Handler for the #Watchdog::handle-stop signal.
18694 * @get_poll_interval: Getter for the #Watchdog:poll-interval property.
18695 * @get_watchdog: Getter for the #Watchdog:watchdog property.
18696 * @watchdog_error: Handler for the #Watchdog::watchdog-error signal.
18697 *
18698 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link>.
18699 */
18700
18701typedef WatchdogIface WatchdogInterface;
18702G_DEFINE_INTERFACE (Watchdog, watchdog, G_TYPE_OBJECT);
18703
18704static void
18705watchdog_default_init (WatchdogIface *iface)
18706{
18707 /* GObject signals for incoming D-Bus method calls: */
18708 /**
18709 * Watchdog::handle-start:
18710 * @object: A #Watchdog.
18711 * @invocation: A #GDBusMethodInvocation.
18712 *
18713 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Watchdog.start">start()</link> D-Bus method.
18714 *
18715 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call watchdog_complete_start() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
18716 *
18717 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
18718 */
18719 g_signal_new ("handle-start",
18720 G_TYPE_FROM_INTERFACE (iface),
18721 G_SIGNAL_RUN_LAST,
18722 G_STRUCT_OFFSET (WatchdogIface, handle_start),
18723 g_signal_accumulator_true_handled,
18724 NULL,
18725 g_cclosure_marshal_generic,
18726 G_TYPE_BOOLEAN,
18727 1,
18728 G_TYPE_DBUS_METHOD_INVOCATION);
18729
18730 /**
18731 * Watchdog::handle-poke:
18732 * @object: A #Watchdog.
18733 * @invocation: A #GDBusMethodInvocation.
18734 *
18735 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Watchdog.poke">poke()</link> D-Bus method.
18736 *
18737 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call watchdog_complete_poke() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
18738 *
18739 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
18740 */
18741 g_signal_new ("handle-poke",
18742 G_TYPE_FROM_INTERFACE (iface),
18743 G_SIGNAL_RUN_LAST,
18744 G_STRUCT_OFFSET (WatchdogIface, handle_poke),
18745 g_signal_accumulator_true_handled,
18746 NULL,
18747 g_cclosure_marshal_generic,
18748 G_TYPE_BOOLEAN,
18749 1,
18750 G_TYPE_DBUS_METHOD_INVOCATION);
18751
18752 /**
18753 * Watchdog::handle-stop:
18754 * @object: A #Watchdog.
18755 * @invocation: A #GDBusMethodInvocation.
18756 *
18757 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Watchdog.stop">stop()</link> D-Bus method.
18758 *
18759 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call watchdog_complete_stop() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
18760 *
18761 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
18762 */
18763 g_signal_new ("handle-stop",
18764 G_TYPE_FROM_INTERFACE (iface),
18765 G_SIGNAL_RUN_LAST,
18766 G_STRUCT_OFFSET (WatchdogIface, handle_stop),
18767 g_signal_accumulator_true_handled,
18768 NULL,
18769 g_cclosure_marshal_generic,
18770 G_TYPE_BOOLEAN,
18771 1,
18772 G_TYPE_DBUS_METHOD_INVOCATION);
18773
Adriana Kobylak2cb27752015-10-19 16:23:14 -050018774 /**
18775 * Watchdog::handle-set:
18776 * @object: A #Watchdog.
18777 * @invocation: A #GDBusMethodInvocation.
18778 * @arg_interval: Argument passed by remote caller.
18779 *
18780 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Watchdog.set">set()</link> D-Bus method.
18781 *
18782 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call watchdog_complete_set() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
18783 *
18784 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
18785 */
18786 g_signal_new ("handle-set",
18787 G_TYPE_FROM_INTERFACE (iface),
18788 G_SIGNAL_RUN_LAST,
18789 G_STRUCT_OFFSET (WatchdogIface, handle_set),
18790 g_signal_accumulator_true_handled,
18791 NULL,
18792 g_cclosure_marshal_generic,
18793 G_TYPE_BOOLEAN,
18794 2,
18795 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT);
18796
Norman James362a80f2015-09-14 14:04:39 -050018797 /* GObject signals for received D-Bus signals: */
18798 /**
18799 * Watchdog::watchdog-error:
18800 * @object: A #Watchdog.
18801 *
18802 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Watchdog.WatchdogError">"WatchdogError"</link> is received.
18803 *
18804 * 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.
18805 */
18806 g_signal_new ("watchdog-error",
18807 G_TYPE_FROM_INTERFACE (iface),
18808 G_SIGNAL_RUN_LAST,
18809 G_STRUCT_OFFSET (WatchdogIface, watchdog_error),
18810 NULL,
18811 NULL,
18812 g_cclosure_marshal_generic,
18813 G_TYPE_NONE,
18814 0);
18815
18816 /* GObject properties for D-Bus properties: */
18817 /**
18818 * Watchdog:watchdog:
18819 *
18820 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Watchdog.watchdog">"watchdog"</link>.
18821 *
18822 * 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.
18823 */
18824 g_object_interface_install_property (iface,
18825 g_param_spec_int ("watchdog", "watchdog", "watchdog", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
18826 /**
18827 * Watchdog:poll-interval:
18828 *
18829 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Watchdog.poll_interval">"poll_interval"</link>.
18830 *
18831 * 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.
18832 */
18833 g_object_interface_install_property (iface,
18834 g_param_spec_int ("poll-interval", "poll_interval", "poll_interval", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
18835}
18836
18837/**
18838 * watchdog_get_watchdog: (skip)
18839 * @object: A #Watchdog.
18840 *
18841 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Watchdog.watchdog">"watchdog"</link> D-Bus property.
18842 *
18843 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
18844 *
18845 * Returns: The property value.
18846 */
18847gint
18848watchdog_get_watchdog (Watchdog *object)
18849{
18850 return WATCHDOG_GET_IFACE (object)->get_watchdog (object);
18851}
18852
18853/**
18854 * watchdog_set_watchdog: (skip)
18855 * @object: A #Watchdog.
18856 * @value: The value to set.
18857 *
18858 * Sets the <link linkend="gdbus-property-org-openbmc-Watchdog.watchdog">"watchdog"</link> D-Bus property to @value.
18859 *
18860 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
18861 */
18862void
18863watchdog_set_watchdog (Watchdog *object, gint value)
18864{
18865 g_object_set (G_OBJECT (object), "watchdog", value, NULL);
18866}
18867
18868/**
18869 * watchdog_get_poll_interval: (skip)
18870 * @object: A #Watchdog.
18871 *
18872 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Watchdog.poll_interval">"poll_interval"</link> D-Bus property.
18873 *
18874 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
18875 *
18876 * Returns: The property value.
18877 */
18878gint
18879watchdog_get_poll_interval (Watchdog *object)
18880{
18881 return WATCHDOG_GET_IFACE (object)->get_poll_interval (object);
18882}
18883
18884/**
18885 * watchdog_set_poll_interval: (skip)
18886 * @object: A #Watchdog.
18887 * @value: The value to set.
18888 *
18889 * Sets the <link linkend="gdbus-property-org-openbmc-Watchdog.poll_interval">"poll_interval"</link> D-Bus property to @value.
18890 *
18891 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
18892 */
18893void
18894watchdog_set_poll_interval (Watchdog *object, gint value)
18895{
18896 g_object_set (G_OBJECT (object), "poll-interval", value, NULL);
18897}
18898
18899/**
18900 * watchdog_emit_watchdog_error:
18901 * @object: A #Watchdog.
18902 *
18903 * Emits the <link linkend="gdbus-signal-org-openbmc-Watchdog.WatchdogError">"WatchdogError"</link> D-Bus signal.
18904 */
18905void
18906watchdog_emit_watchdog_error (
18907 Watchdog *object)
18908{
18909 g_signal_emit_by_name (object, "watchdog-error");
18910}
18911
18912/**
18913 * watchdog_call_start:
18914 * @proxy: A #WatchdogProxy.
18915 * @cancellable: (allow-none): A #GCancellable or %NULL.
18916 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
18917 * @user_data: User data to pass to @callback.
18918 *
18919 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.start">start()</link> D-Bus method on @proxy.
18920 * 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.
18921 * You can then call watchdog_call_start_finish() to get the result of the operation.
18922 *
18923 * See watchdog_call_start_sync() for the synchronous, blocking version of this method.
18924 */
18925void
18926watchdog_call_start (
18927 Watchdog *proxy,
18928 GCancellable *cancellable,
18929 GAsyncReadyCallback callback,
18930 gpointer user_data)
18931{
18932 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
18933 "start",
18934 g_variant_new ("()"),
18935 G_DBUS_CALL_FLAGS_NONE,
18936 -1,
18937 cancellable,
18938 callback,
18939 user_data);
18940}
18941
18942/**
18943 * watchdog_call_start_finish:
18944 * @proxy: A #WatchdogProxy.
18945 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_call_start().
18946 * @error: Return location for error or %NULL.
18947 *
18948 * Finishes an operation started with watchdog_call_start().
18949 *
18950 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
18951 */
18952gboolean
18953watchdog_call_start_finish (
18954 Watchdog *proxy,
18955 GAsyncResult *res,
18956 GError **error)
18957{
18958 GVariant *_ret;
18959 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
18960 if (_ret == NULL)
18961 goto _out;
18962 g_variant_get (_ret,
18963 "()");
18964 g_variant_unref (_ret);
18965_out:
18966 return _ret != NULL;
18967}
18968
18969/**
18970 * watchdog_call_start_sync:
18971 * @proxy: A #WatchdogProxy.
18972 * @cancellable: (allow-none): A #GCancellable or %NULL.
18973 * @error: Return location for error or %NULL.
18974 *
18975 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.start">start()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
18976 *
18977 * See watchdog_call_start() for the asynchronous version of this method.
18978 *
18979 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
18980 */
18981gboolean
18982watchdog_call_start_sync (
18983 Watchdog *proxy,
18984 GCancellable *cancellable,
18985 GError **error)
18986{
18987 GVariant *_ret;
18988 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
18989 "start",
18990 g_variant_new ("()"),
18991 G_DBUS_CALL_FLAGS_NONE,
18992 -1,
18993 cancellable,
18994 error);
18995 if (_ret == NULL)
18996 goto _out;
18997 g_variant_get (_ret,
18998 "()");
18999 g_variant_unref (_ret);
19000_out:
19001 return _ret != NULL;
19002}
19003
19004/**
19005 * watchdog_call_poke:
19006 * @proxy: A #WatchdogProxy.
19007 * @cancellable: (allow-none): A #GCancellable or %NULL.
19008 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
19009 * @user_data: User data to pass to @callback.
19010 *
19011 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.poke">poke()</link> D-Bus method on @proxy.
19012 * 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.
19013 * You can then call watchdog_call_poke_finish() to get the result of the operation.
19014 *
19015 * See watchdog_call_poke_sync() for the synchronous, blocking version of this method.
19016 */
19017void
19018watchdog_call_poke (
19019 Watchdog *proxy,
19020 GCancellable *cancellable,
19021 GAsyncReadyCallback callback,
19022 gpointer user_data)
19023{
19024 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
19025 "poke",
19026 g_variant_new ("()"),
19027 G_DBUS_CALL_FLAGS_NONE,
19028 -1,
19029 cancellable,
19030 callback,
19031 user_data);
19032}
19033
19034/**
19035 * watchdog_call_poke_finish:
19036 * @proxy: A #WatchdogProxy.
19037 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_call_poke().
19038 * @error: Return location for error or %NULL.
19039 *
19040 * Finishes an operation started with watchdog_call_poke().
19041 *
19042 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19043 */
19044gboolean
19045watchdog_call_poke_finish (
19046 Watchdog *proxy,
19047 GAsyncResult *res,
19048 GError **error)
19049{
19050 GVariant *_ret;
19051 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
19052 if (_ret == NULL)
19053 goto _out;
19054 g_variant_get (_ret,
19055 "()");
19056 g_variant_unref (_ret);
19057_out:
19058 return _ret != NULL;
19059}
19060
19061/**
19062 * watchdog_call_poke_sync:
19063 * @proxy: A #WatchdogProxy.
19064 * @cancellable: (allow-none): A #GCancellable or %NULL.
19065 * @error: Return location for error or %NULL.
19066 *
19067 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.poke">poke()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
19068 *
19069 * See watchdog_call_poke() for the asynchronous version of this method.
19070 *
19071 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19072 */
19073gboolean
19074watchdog_call_poke_sync (
19075 Watchdog *proxy,
19076 GCancellable *cancellable,
19077 GError **error)
19078{
19079 GVariant *_ret;
19080 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
19081 "poke",
19082 g_variant_new ("()"),
19083 G_DBUS_CALL_FLAGS_NONE,
19084 -1,
19085 cancellable,
19086 error);
19087 if (_ret == NULL)
19088 goto _out;
19089 g_variant_get (_ret,
19090 "()");
19091 g_variant_unref (_ret);
19092_out:
19093 return _ret != NULL;
19094}
19095
19096/**
19097 * watchdog_call_stop:
19098 * @proxy: A #WatchdogProxy.
19099 * @cancellable: (allow-none): A #GCancellable or %NULL.
19100 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
19101 * @user_data: User data to pass to @callback.
19102 *
19103 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.stop">stop()</link> D-Bus method on @proxy.
19104 * 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.
19105 * You can then call watchdog_call_stop_finish() to get the result of the operation.
19106 *
19107 * See watchdog_call_stop_sync() for the synchronous, blocking version of this method.
19108 */
19109void
19110watchdog_call_stop (
19111 Watchdog *proxy,
19112 GCancellable *cancellable,
19113 GAsyncReadyCallback callback,
19114 gpointer user_data)
19115{
19116 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
19117 "stop",
19118 g_variant_new ("()"),
19119 G_DBUS_CALL_FLAGS_NONE,
19120 -1,
19121 cancellable,
19122 callback,
19123 user_data);
19124}
19125
19126/**
19127 * watchdog_call_stop_finish:
19128 * @proxy: A #WatchdogProxy.
19129 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_call_stop().
19130 * @error: Return location for error or %NULL.
19131 *
19132 * Finishes an operation started with watchdog_call_stop().
19133 *
19134 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19135 */
19136gboolean
19137watchdog_call_stop_finish (
19138 Watchdog *proxy,
19139 GAsyncResult *res,
19140 GError **error)
19141{
19142 GVariant *_ret;
19143 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
19144 if (_ret == NULL)
19145 goto _out;
19146 g_variant_get (_ret,
19147 "()");
19148 g_variant_unref (_ret);
19149_out:
19150 return _ret != NULL;
19151}
19152
19153/**
19154 * watchdog_call_stop_sync:
19155 * @proxy: A #WatchdogProxy.
19156 * @cancellable: (allow-none): A #GCancellable or %NULL.
19157 * @error: Return location for error or %NULL.
19158 *
19159 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.stop">stop()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
19160 *
19161 * See watchdog_call_stop() for the asynchronous version of this method.
19162 *
19163 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19164 */
19165gboolean
19166watchdog_call_stop_sync (
19167 Watchdog *proxy,
19168 GCancellable *cancellable,
19169 GError **error)
19170{
19171 GVariant *_ret;
19172 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
19173 "stop",
19174 g_variant_new ("()"),
19175 G_DBUS_CALL_FLAGS_NONE,
19176 -1,
19177 cancellable,
19178 error);
19179 if (_ret == NULL)
19180 goto _out;
19181 g_variant_get (_ret,
19182 "()");
19183 g_variant_unref (_ret);
19184_out:
19185 return _ret != NULL;
19186}
19187
19188/**
Adriana Kobylak2cb27752015-10-19 16:23:14 -050019189 * watchdog_call_set:
19190 * @proxy: A #WatchdogProxy.
19191 * @arg_interval: Argument to pass with the method invocation.
19192 * @cancellable: (allow-none): A #GCancellable or %NULL.
19193 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
19194 * @user_data: User data to pass to @callback.
19195 *
19196 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.set">set()</link> D-Bus method on @proxy.
19197 * 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.
19198 * You can then call watchdog_call_set_finish() to get the result of the operation.
19199 *
19200 * See watchdog_call_set_sync() for the synchronous, blocking version of this method.
19201 */
19202void
19203watchdog_call_set (
19204 Watchdog *proxy,
19205 gint arg_interval,
19206 GCancellable *cancellable,
19207 GAsyncReadyCallback callback,
19208 gpointer user_data)
19209{
19210 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
19211 "set",
19212 g_variant_new ("(i)",
19213 arg_interval),
19214 G_DBUS_CALL_FLAGS_NONE,
19215 -1,
19216 cancellable,
19217 callback,
19218 user_data);
19219}
19220
19221/**
19222 * watchdog_call_set_finish:
19223 * @proxy: A #WatchdogProxy.
19224 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_call_set().
19225 * @error: Return location for error or %NULL.
19226 *
19227 * Finishes an operation started with watchdog_call_set().
19228 *
19229 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19230 */
19231gboolean
19232watchdog_call_set_finish (
19233 Watchdog *proxy,
19234 GAsyncResult *res,
19235 GError **error)
19236{
19237 GVariant *_ret;
19238 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
19239 if (_ret == NULL)
19240 goto _out;
19241 g_variant_get (_ret,
19242 "()");
19243 g_variant_unref (_ret);
19244_out:
19245 return _ret != NULL;
19246}
19247
19248/**
19249 * watchdog_call_set_sync:
19250 * @proxy: A #WatchdogProxy.
19251 * @arg_interval: Argument to pass with the method invocation.
19252 * @cancellable: (allow-none): A #GCancellable or %NULL.
19253 * @error: Return location for error or %NULL.
19254 *
19255 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.set">set()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
19256 *
19257 * See watchdog_call_set() for the asynchronous version of this method.
19258 *
19259 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19260 */
19261gboolean
19262watchdog_call_set_sync (
19263 Watchdog *proxy,
19264 gint arg_interval,
19265 GCancellable *cancellable,
19266 GError **error)
19267{
19268 GVariant *_ret;
19269 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
19270 "set",
19271 g_variant_new ("(i)",
19272 arg_interval),
19273 G_DBUS_CALL_FLAGS_NONE,
19274 -1,
19275 cancellable,
19276 error);
19277 if (_ret == NULL)
19278 goto _out;
19279 g_variant_get (_ret,
19280 "()");
19281 g_variant_unref (_ret);
19282_out:
19283 return _ret != NULL;
19284}
19285
19286/**
Norman James362a80f2015-09-14 14:04:39 -050019287 * watchdog_complete_start:
19288 * @object: A #Watchdog.
19289 * @invocation: (transfer full): A #GDBusMethodInvocation.
19290 *
19291 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Watchdog.start">start()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
19292 *
19293 * This method will free @invocation, you cannot use it afterwards.
19294 */
19295void
19296watchdog_complete_start (
19297 Watchdog *object,
19298 GDBusMethodInvocation *invocation)
19299{
19300 g_dbus_method_invocation_return_value (invocation,
19301 g_variant_new ("()"));
19302}
19303
19304/**
19305 * watchdog_complete_poke:
19306 * @object: A #Watchdog.
19307 * @invocation: (transfer full): A #GDBusMethodInvocation.
19308 *
19309 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Watchdog.poke">poke()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
19310 *
19311 * This method will free @invocation, you cannot use it afterwards.
19312 */
19313void
19314watchdog_complete_poke (
19315 Watchdog *object,
19316 GDBusMethodInvocation *invocation)
19317{
19318 g_dbus_method_invocation_return_value (invocation,
19319 g_variant_new ("()"));
19320}
19321
19322/**
19323 * watchdog_complete_stop:
19324 * @object: A #Watchdog.
19325 * @invocation: (transfer full): A #GDBusMethodInvocation.
19326 *
19327 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Watchdog.stop">stop()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
19328 *
19329 * This method will free @invocation, you cannot use it afterwards.
19330 */
19331void
19332watchdog_complete_stop (
19333 Watchdog *object,
19334 GDBusMethodInvocation *invocation)
19335{
19336 g_dbus_method_invocation_return_value (invocation,
19337 g_variant_new ("()"));
19338}
19339
Adriana Kobylak2cb27752015-10-19 16:23:14 -050019340/**
19341 * watchdog_complete_set:
19342 * @object: A #Watchdog.
19343 * @invocation: (transfer full): A #GDBusMethodInvocation.
19344 *
19345 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Watchdog.set">set()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
19346 *
19347 * This method will free @invocation, you cannot use it afterwards.
19348 */
19349void
19350watchdog_complete_set (
19351 Watchdog *object,
19352 GDBusMethodInvocation *invocation)
19353{
19354 g_dbus_method_invocation_return_value (invocation,
19355 g_variant_new ("()"));
19356}
19357
Norman James362a80f2015-09-14 14:04:39 -050019358/* ------------------------------------------------------------------------ */
19359
19360/**
19361 * WatchdogProxy:
19362 *
19363 * The #WatchdogProxy structure contains only private data and should only be accessed using the provided API.
19364 */
19365
19366/**
19367 * WatchdogProxyClass:
19368 * @parent_class: The parent class.
19369 *
19370 * Class structure for #WatchdogProxy.
19371 */
19372
19373struct _WatchdogProxyPrivate
19374{
19375 GData *qdata;
19376};
19377
19378static void watchdog_proxy_iface_init (WatchdogIface *iface);
19379
19380#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
19381G_DEFINE_TYPE_WITH_CODE (WatchdogProxy, watchdog_proxy, G_TYPE_DBUS_PROXY,
19382 G_ADD_PRIVATE (WatchdogProxy)
19383 G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_proxy_iface_init));
19384
19385#else
19386G_DEFINE_TYPE_WITH_CODE (WatchdogProxy, watchdog_proxy, G_TYPE_DBUS_PROXY,
19387 G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_proxy_iface_init));
19388
19389#endif
19390static void
19391watchdog_proxy_finalize (GObject *object)
19392{
19393 WatchdogProxy *proxy = WATCHDOG_PROXY (object);
19394 g_datalist_clear (&proxy->priv->qdata);
19395 G_OBJECT_CLASS (watchdog_proxy_parent_class)->finalize (object);
19396}
19397
19398static void
19399watchdog_proxy_get_property (GObject *object,
19400 guint prop_id,
19401 GValue *value,
19402 GParamSpec *pspec G_GNUC_UNUSED)
19403{
19404 const _ExtendedGDBusPropertyInfo *info;
19405 GVariant *variant;
19406 g_assert (prop_id != 0 && prop_id - 1 < 2);
19407 info = _watchdog_property_info_pointers[prop_id - 1];
19408 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
19409 if (info->use_gvariant)
19410 {
19411 g_value_set_variant (value, variant);
19412 }
19413 else
19414 {
19415 if (variant != NULL)
19416 g_dbus_gvariant_to_gvalue (variant, value);
19417 }
19418 if (variant != NULL)
19419 g_variant_unref (variant);
19420}
19421
19422static void
19423watchdog_proxy_set_property_cb (GDBusProxy *proxy,
19424 GAsyncResult *res,
19425 gpointer user_data)
19426{
19427 const _ExtendedGDBusPropertyInfo *info = user_data;
19428 GError *error;
19429 GVariant *_ret;
19430 error = NULL;
19431 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
19432 if (!_ret)
19433 {
19434 g_warning ("Error setting property '%s' on interface org.openbmc.Watchdog: %s (%s, %d)",
19435 info->parent_struct.name,
19436 error->message, g_quark_to_string (error->domain), error->code);
19437 g_error_free (error);
19438 }
19439 else
19440 {
19441 g_variant_unref (_ret);
19442 }
19443}
19444
19445static void
19446watchdog_proxy_set_property (GObject *object,
19447 guint prop_id,
19448 const GValue *value,
19449 GParamSpec *pspec G_GNUC_UNUSED)
19450{
19451 const _ExtendedGDBusPropertyInfo *info;
19452 GVariant *variant;
19453 g_assert (prop_id != 0 && prop_id - 1 < 2);
19454 info = _watchdog_property_info_pointers[prop_id - 1];
19455 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
19456 g_dbus_proxy_call (G_DBUS_PROXY (object),
19457 "org.freedesktop.DBus.Properties.Set",
19458 g_variant_new ("(ssv)", "org.openbmc.Watchdog", info->parent_struct.name, variant),
19459 G_DBUS_CALL_FLAGS_NONE,
19460 -1,
19461 NULL, (GAsyncReadyCallback) watchdog_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
19462 g_variant_unref (variant);
19463}
19464
19465static void
19466watchdog_proxy_g_signal (GDBusProxy *proxy,
19467 const gchar *sender_name G_GNUC_UNUSED,
19468 const gchar *signal_name,
19469 GVariant *parameters)
19470{
19471 _ExtendedGDBusSignalInfo *info;
19472 GVariantIter iter;
19473 GVariant *child;
19474 GValue *paramv;
19475 guint num_params;
19476 guint n;
19477 guint signal_id;
19478 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, signal_name);
19479 if (info == NULL)
19480 return;
19481 num_params = g_variant_n_children (parameters);
19482 paramv = g_new0 (GValue, num_params + 1);
19483 g_value_init (&paramv[0], TYPE_WATCHDOG);
19484 g_value_set_object (&paramv[0], proxy);
19485 g_variant_iter_init (&iter, parameters);
19486 n = 1;
19487 while ((child = g_variant_iter_next_value (&iter)) != NULL)
19488 {
19489 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
19490 if (arg_info->use_gvariant)
19491 {
19492 g_value_init (&paramv[n], G_TYPE_VARIANT);
19493 g_value_set_variant (&paramv[n], child);
19494 n++;
19495 }
19496 else
19497 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
19498 g_variant_unref (child);
19499 }
19500 signal_id = g_signal_lookup (info->signal_name, TYPE_WATCHDOG);
19501 g_signal_emitv (paramv, signal_id, 0, NULL);
19502 for (n = 0; n < num_params + 1; n++)
19503 g_value_unset (&paramv[n]);
19504 g_free (paramv);
19505}
19506
19507static void
19508watchdog_proxy_g_properties_changed (GDBusProxy *_proxy,
19509 GVariant *changed_properties,
19510 const gchar *const *invalidated_properties)
19511{
19512 WatchdogProxy *proxy = WATCHDOG_PROXY (_proxy);
19513 guint n;
19514 const gchar *key;
19515 GVariantIter *iter;
19516 _ExtendedGDBusPropertyInfo *info;
19517 g_variant_get (changed_properties, "a{sv}", &iter);
19518 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
19519 {
19520 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, key);
19521 g_datalist_remove_data (&proxy->priv->qdata, key);
19522 if (info != NULL)
19523 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
19524 }
19525 g_variant_iter_free (iter);
19526 for (n = 0; invalidated_properties[n] != NULL; n++)
19527 {
19528 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, invalidated_properties[n]);
19529 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
19530 if (info != NULL)
19531 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
19532 }
19533}
19534
19535static gint
19536watchdog_proxy_get_watchdog (Watchdog *object)
19537{
19538 WatchdogProxy *proxy = WATCHDOG_PROXY (object);
19539 GVariant *variant;
19540 gint value = 0;
19541 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "watchdog");
19542 if (variant != NULL)
19543 {
19544 value = g_variant_get_int32 (variant);
19545 g_variant_unref (variant);
19546 }
19547 return value;
19548}
19549
19550static gint
19551watchdog_proxy_get_poll_interval (Watchdog *object)
19552{
19553 WatchdogProxy *proxy = WATCHDOG_PROXY (object);
19554 GVariant *variant;
19555 gint value = 0;
19556 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "poll_interval");
19557 if (variant != NULL)
19558 {
19559 value = g_variant_get_int32 (variant);
19560 g_variant_unref (variant);
19561 }
19562 return value;
19563}
19564
19565static void
19566watchdog_proxy_init (WatchdogProxy *proxy)
19567{
19568#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
19569 proxy->priv = watchdog_proxy_get_instance_private (proxy);
19570#else
19571 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_WATCHDOG_PROXY, WatchdogProxyPrivate);
19572#endif
19573
19574 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), watchdog_interface_info ());
19575}
19576
19577static void
19578watchdog_proxy_class_init (WatchdogProxyClass *klass)
19579{
19580 GObjectClass *gobject_class;
19581 GDBusProxyClass *proxy_class;
19582
19583 gobject_class = G_OBJECT_CLASS (klass);
19584 gobject_class->finalize = watchdog_proxy_finalize;
19585 gobject_class->get_property = watchdog_proxy_get_property;
19586 gobject_class->set_property = watchdog_proxy_set_property;
19587
19588 proxy_class = G_DBUS_PROXY_CLASS (klass);
19589 proxy_class->g_signal = watchdog_proxy_g_signal;
19590 proxy_class->g_properties_changed = watchdog_proxy_g_properties_changed;
19591
19592 watchdog_override_properties (gobject_class, 1);
19593
19594#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
19595 g_type_class_add_private (klass, sizeof (WatchdogProxyPrivate));
19596#endif
19597}
19598
19599static void
19600watchdog_proxy_iface_init (WatchdogIface *iface)
19601{
19602 iface->get_watchdog = watchdog_proxy_get_watchdog;
19603 iface->get_poll_interval = watchdog_proxy_get_poll_interval;
19604}
19605
19606/**
19607 * watchdog_proxy_new:
19608 * @connection: A #GDBusConnection.
19609 * @flags: Flags from the #GDBusProxyFlags enumeration.
19610 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
19611 * @object_path: An object path.
19612 * @cancellable: (allow-none): A #GCancellable or %NULL.
19613 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
19614 * @user_data: User data to pass to @callback.
19615 *
19616 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link>. See g_dbus_proxy_new() for more details.
19617 *
19618 * 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.
19619 * You can then call watchdog_proxy_new_finish() to get the result of the operation.
19620 *
19621 * See watchdog_proxy_new_sync() for the synchronous, blocking version of this constructor.
19622 */
19623void
19624watchdog_proxy_new (
19625 GDBusConnection *connection,
19626 GDBusProxyFlags flags,
19627 const gchar *name,
19628 const gchar *object_path,
19629 GCancellable *cancellable,
19630 GAsyncReadyCallback callback,
19631 gpointer user_data)
19632{
19633 g_async_initable_new_async (TYPE_WATCHDOG_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.Watchdog", NULL);
19634}
19635
19636/**
19637 * watchdog_proxy_new_finish:
19638 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_proxy_new().
19639 * @error: Return location for error or %NULL
19640 *
19641 * Finishes an operation started with watchdog_proxy_new().
19642 *
19643 * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set.
19644 */
19645Watchdog *
19646watchdog_proxy_new_finish (
19647 GAsyncResult *res,
19648 GError **error)
19649{
19650 GObject *ret;
19651 GObject *source_object;
19652 source_object = g_async_result_get_source_object (res);
19653 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
19654 g_object_unref (source_object);
19655 if (ret != NULL)
19656 return WATCHDOG (ret);
19657 else
19658 return NULL;
19659}
19660
19661/**
19662 * watchdog_proxy_new_sync:
19663 * @connection: A #GDBusConnection.
19664 * @flags: Flags from the #GDBusProxyFlags enumeration.
19665 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
19666 * @object_path: An object path.
19667 * @cancellable: (allow-none): A #GCancellable or %NULL.
19668 * @error: Return location for error or %NULL
19669 *
19670 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link>. See g_dbus_proxy_new_sync() for more details.
19671 *
19672 * The calling thread is blocked until a reply is received.
19673 *
19674 * See watchdog_proxy_new() for the asynchronous version of this constructor.
19675 *
19676 * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set.
19677 */
19678Watchdog *
19679watchdog_proxy_new_sync (
19680 GDBusConnection *connection,
19681 GDBusProxyFlags flags,
19682 const gchar *name,
19683 const gchar *object_path,
19684 GCancellable *cancellable,
19685 GError **error)
19686{
19687 GInitable *ret;
19688 ret = g_initable_new (TYPE_WATCHDOG_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.Watchdog", NULL);
19689 if (ret != NULL)
19690 return WATCHDOG (ret);
19691 else
19692 return NULL;
19693}
19694
19695
19696/**
19697 * watchdog_proxy_new_for_bus:
19698 * @bus_type: A #GBusType.
19699 * @flags: Flags from the #GDBusProxyFlags enumeration.
19700 * @name: A bus name (well-known or unique).
19701 * @object_path: An object path.
19702 * @cancellable: (allow-none): A #GCancellable or %NULL.
19703 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
19704 * @user_data: User data to pass to @callback.
19705 *
19706 * Like watchdog_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
19707 *
19708 * 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.
19709 * You can then call watchdog_proxy_new_for_bus_finish() to get the result of the operation.
19710 *
19711 * See watchdog_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
19712 */
19713void
19714watchdog_proxy_new_for_bus (
19715 GBusType bus_type,
19716 GDBusProxyFlags flags,
19717 const gchar *name,
19718 const gchar *object_path,
19719 GCancellable *cancellable,
19720 GAsyncReadyCallback callback,
19721 gpointer user_data)
19722{
19723 g_async_initable_new_async (TYPE_WATCHDOG_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.Watchdog", NULL);
19724}
19725
19726/**
19727 * watchdog_proxy_new_for_bus_finish:
19728 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_proxy_new_for_bus().
19729 * @error: Return location for error or %NULL
19730 *
19731 * Finishes an operation started with watchdog_proxy_new_for_bus().
19732 *
19733 * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set.
19734 */
19735Watchdog *
19736watchdog_proxy_new_for_bus_finish (
19737 GAsyncResult *res,
19738 GError **error)
19739{
19740 GObject *ret;
19741 GObject *source_object;
19742 source_object = g_async_result_get_source_object (res);
19743 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
19744 g_object_unref (source_object);
19745 if (ret != NULL)
19746 return WATCHDOG (ret);
19747 else
19748 return NULL;
19749}
19750
19751/**
19752 * watchdog_proxy_new_for_bus_sync:
19753 * @bus_type: A #GBusType.
19754 * @flags: Flags from the #GDBusProxyFlags enumeration.
19755 * @name: A bus name (well-known or unique).
19756 * @object_path: An object path.
19757 * @cancellable: (allow-none): A #GCancellable or %NULL.
19758 * @error: Return location for error or %NULL
19759 *
19760 * Like watchdog_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
19761 *
19762 * The calling thread is blocked until a reply is received.
19763 *
19764 * See watchdog_proxy_new_for_bus() for the asynchronous version of this constructor.
19765 *
19766 * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set.
19767 */
19768Watchdog *
19769watchdog_proxy_new_for_bus_sync (
19770 GBusType bus_type,
19771 GDBusProxyFlags flags,
19772 const gchar *name,
19773 const gchar *object_path,
19774 GCancellable *cancellable,
19775 GError **error)
19776{
19777 GInitable *ret;
19778 ret = g_initable_new (TYPE_WATCHDOG_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.Watchdog", NULL);
19779 if (ret != NULL)
19780 return WATCHDOG (ret);
19781 else
19782 return NULL;
19783}
19784
19785
19786/* ------------------------------------------------------------------------ */
19787
19788/**
19789 * WatchdogSkeleton:
19790 *
19791 * The #WatchdogSkeleton structure contains only private data and should only be accessed using the provided API.
19792 */
19793
19794/**
19795 * WatchdogSkeletonClass:
19796 * @parent_class: The parent class.
19797 *
19798 * Class structure for #WatchdogSkeleton.
19799 */
19800
19801struct _WatchdogSkeletonPrivate
19802{
19803 GValue *properties;
19804 GList *changed_properties;
19805 GSource *changed_properties_idle_source;
19806 GMainContext *context;
19807 GMutex lock;
19808};
19809
19810static void
19811_watchdog_skeleton_handle_method_call (
19812 GDBusConnection *connection G_GNUC_UNUSED,
19813 const gchar *sender G_GNUC_UNUSED,
19814 const gchar *object_path G_GNUC_UNUSED,
19815 const gchar *interface_name,
19816 const gchar *method_name,
19817 GVariant *parameters,
19818 GDBusMethodInvocation *invocation,
19819 gpointer user_data)
19820{
19821 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data);
19822 _ExtendedGDBusMethodInfo *info;
19823 GVariantIter iter;
19824 GVariant *child;
19825 GValue *paramv;
19826 guint num_params;
19827 guint num_extra;
19828 guint n;
19829 guint signal_id;
19830 GValue return_value = G_VALUE_INIT;
19831 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
19832 g_assert (info != NULL);
19833 num_params = g_variant_n_children (parameters);
19834 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
19835 n = 0;
19836 g_value_init (&paramv[n], TYPE_WATCHDOG);
19837 g_value_set_object (&paramv[n++], skeleton);
19838 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
19839 g_value_set_object (&paramv[n++], invocation);
19840 if (info->pass_fdlist)
19841 {
19842#ifdef G_OS_UNIX
19843 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
19844 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
19845#else
19846 g_assert_not_reached ();
19847#endif
19848 }
19849 g_variant_iter_init (&iter, parameters);
19850 while ((child = g_variant_iter_next_value (&iter)) != NULL)
19851 {
19852 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
19853 if (arg_info->use_gvariant)
19854 {
19855 g_value_init (&paramv[n], G_TYPE_VARIANT);
19856 g_value_set_variant (&paramv[n], child);
19857 n++;
19858 }
19859 else
19860 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
19861 g_variant_unref (child);
19862 }
19863 signal_id = g_signal_lookup (info->signal_name, TYPE_WATCHDOG);
19864 g_value_init (&return_value, G_TYPE_BOOLEAN);
19865 g_signal_emitv (paramv, signal_id, 0, &return_value);
19866 if (!g_value_get_boolean (&return_value))
19867 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);
19868 g_value_unset (&return_value);
19869 for (n = 0; n < num_params + num_extra; n++)
19870 g_value_unset (&paramv[n]);
19871 g_free (paramv);
19872}
19873
19874static GVariant *
19875_watchdog_skeleton_handle_get_property (
19876 GDBusConnection *connection G_GNUC_UNUSED,
19877 const gchar *sender G_GNUC_UNUSED,
19878 const gchar *object_path G_GNUC_UNUSED,
19879 const gchar *interface_name G_GNUC_UNUSED,
19880 const gchar *property_name,
19881 GError **error,
19882 gpointer user_data)
19883{
19884 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data);
19885 GValue value = G_VALUE_INIT;
19886 GParamSpec *pspec;
19887 _ExtendedGDBusPropertyInfo *info;
19888 GVariant *ret;
19889 ret = NULL;
19890 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, property_name);
19891 g_assert (info != NULL);
19892 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
19893 if (pspec == NULL)
19894 {
19895 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
19896 }
19897 else
19898 {
19899 g_value_init (&value, pspec->value_type);
19900 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
19901 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
19902 g_value_unset (&value);
19903 }
19904 return ret;
19905}
19906
19907static gboolean
19908_watchdog_skeleton_handle_set_property (
19909 GDBusConnection *connection G_GNUC_UNUSED,
19910 const gchar *sender G_GNUC_UNUSED,
19911 const gchar *object_path G_GNUC_UNUSED,
19912 const gchar *interface_name G_GNUC_UNUSED,
19913 const gchar *property_name,
19914 GVariant *variant,
19915 GError **error,
19916 gpointer user_data)
19917{
19918 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data);
19919 GValue value = G_VALUE_INIT;
19920 GParamSpec *pspec;
19921 _ExtendedGDBusPropertyInfo *info;
19922 gboolean ret;
19923 ret = FALSE;
19924 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, property_name);
19925 g_assert (info != NULL);
19926 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
19927 if (pspec == NULL)
19928 {
19929 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
19930 }
19931 else
19932 {
19933 if (info->use_gvariant)
19934 g_value_set_variant (&value, variant);
19935 else
19936 g_dbus_gvariant_to_gvalue (variant, &value);
19937 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
19938 g_value_unset (&value);
19939 ret = TRUE;
19940 }
19941 return ret;
19942}
19943
19944static const GDBusInterfaceVTable _watchdog_skeleton_vtable =
19945{
19946 _watchdog_skeleton_handle_method_call,
19947 _watchdog_skeleton_handle_get_property,
19948 _watchdog_skeleton_handle_set_property,
19949 {NULL}
19950};
19951
19952static GDBusInterfaceInfo *
19953watchdog_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
19954{
19955 return watchdog_interface_info ();
19956}
19957
19958static GDBusInterfaceVTable *
19959watchdog_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
19960{
19961 return (GDBusInterfaceVTable *) &_watchdog_skeleton_vtable;
19962}
19963
19964static GVariant *
19965watchdog_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
19966{
19967 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (_skeleton);
19968
19969 GVariantBuilder builder;
19970 guint n;
19971 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
19972 if (_watchdog_interface_info.parent_struct.properties == NULL)
19973 goto out;
19974 for (n = 0; _watchdog_interface_info.parent_struct.properties[n] != NULL; n++)
19975 {
19976 GDBusPropertyInfo *info = _watchdog_interface_info.parent_struct.properties[n];
19977 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
19978 {
19979 GVariant *value;
19980 value = _watchdog_skeleton_handle_get_property (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Watchdog", info->name, NULL, skeleton);
19981 if (value != NULL)
19982 {
19983 g_variant_take_ref (value);
19984 g_variant_builder_add (&builder, "{sv}", info->name, value);
19985 g_variant_unref (value);
19986 }
19987 }
19988 }
19989out:
19990 return g_variant_builder_end (&builder);
19991}
19992
19993static gboolean _watchdog_emit_changed (gpointer user_data);
19994
19995static void
19996watchdog_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
19997{
19998 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (_skeleton);
19999 gboolean emit_changed = FALSE;
20000
20001 g_mutex_lock (&skeleton->priv->lock);
20002 if (skeleton->priv->changed_properties_idle_source != NULL)
20003 {
20004 g_source_destroy (skeleton->priv->changed_properties_idle_source);
20005 skeleton->priv->changed_properties_idle_source = NULL;
20006 emit_changed = TRUE;
20007 }
20008 g_mutex_unlock (&skeleton->priv->lock);
20009
20010 if (emit_changed)
20011 _watchdog_emit_changed (skeleton);
20012}
20013
20014static void
20015_watchdog_on_signal_watchdog_error (
20016 Watchdog *object)
20017{
20018 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
20019
20020 GList *connections, *l;
20021 GVariant *signal_variant;
20022 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
20023
20024 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
20025 for (l = connections; l != NULL; l = l->next)
20026 {
20027 GDBusConnection *connection = l->data;
20028 g_dbus_connection_emit_signal (connection,
20029 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Watchdog", "WatchdogError",
20030 signal_variant, NULL);
20031 }
20032 g_variant_unref (signal_variant);
20033 g_list_free_full (connections, g_object_unref);
20034}
20035
20036static void watchdog_skeleton_iface_init (WatchdogIface *iface);
20037#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
20038G_DEFINE_TYPE_WITH_CODE (WatchdogSkeleton, watchdog_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
20039 G_ADD_PRIVATE (WatchdogSkeleton)
20040 G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_skeleton_iface_init));
20041
20042#else
20043G_DEFINE_TYPE_WITH_CODE (WatchdogSkeleton, watchdog_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
20044 G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_skeleton_iface_init));
20045
20046#endif
20047static void
20048watchdog_skeleton_finalize (GObject *object)
20049{
20050 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
20051 guint n;
20052 for (n = 0; n < 2; n++)
20053 g_value_unset (&skeleton->priv->properties[n]);
20054 g_free (skeleton->priv->properties);
20055 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
20056 if (skeleton->priv->changed_properties_idle_source != NULL)
20057 g_source_destroy (skeleton->priv->changed_properties_idle_source);
20058 g_main_context_unref (skeleton->priv->context);
20059 g_mutex_clear (&skeleton->priv->lock);
20060 G_OBJECT_CLASS (watchdog_skeleton_parent_class)->finalize (object);
20061}
20062
20063static void
20064watchdog_skeleton_get_property (GObject *object,
20065 guint prop_id,
20066 GValue *value,
20067 GParamSpec *pspec G_GNUC_UNUSED)
20068{
20069 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
20070 g_assert (prop_id != 0 && prop_id - 1 < 2);
20071 g_mutex_lock (&skeleton->priv->lock);
20072 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
20073 g_mutex_unlock (&skeleton->priv->lock);
20074}
20075
20076static gboolean
20077_watchdog_emit_changed (gpointer user_data)
20078{
20079 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data);
20080 GList *l;
20081 GVariantBuilder builder;
20082 GVariantBuilder invalidated_builder;
20083 guint num_changes;
20084
20085 g_mutex_lock (&skeleton->priv->lock);
20086 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
20087 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
20088 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
20089 {
20090 ChangedProperty *cp = l->data;
20091 GVariant *variant;
20092 const GValue *cur_value;
20093
20094 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
20095 if (!_g_value_equal (cur_value, &cp->orig_value))
20096 {
20097 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
20098 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
20099 g_variant_unref (variant);
20100 num_changes++;
20101 }
20102 }
20103 if (num_changes > 0)
20104 {
20105 GList *connections, *ll;
20106 GVariant *signal_variant;
20107 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Watchdog",
20108 &builder, &invalidated_builder));
20109 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
20110 for (ll = connections; ll != NULL; ll = ll->next)
20111 {
20112 GDBusConnection *connection = ll->data;
20113
20114 g_dbus_connection_emit_signal (connection,
20115 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
20116 "org.freedesktop.DBus.Properties",
20117 "PropertiesChanged",
20118 signal_variant,
20119 NULL);
20120 }
20121 g_variant_unref (signal_variant);
20122 g_list_free_full (connections, g_object_unref);
20123 }
20124 else
20125 {
20126 g_variant_builder_clear (&builder);
20127 g_variant_builder_clear (&invalidated_builder);
20128 }
20129 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
20130 skeleton->priv->changed_properties = NULL;
20131 skeleton->priv->changed_properties_idle_source = NULL;
20132 g_mutex_unlock (&skeleton->priv->lock);
20133 return FALSE;
20134}
20135
20136static void
20137_watchdog_schedule_emit_changed (WatchdogSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
20138{
20139 ChangedProperty *cp;
20140 GList *l;
20141 cp = NULL;
20142 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
20143 {
20144 ChangedProperty *i_cp = l->data;
20145 if (i_cp->info == info)
20146 {
20147 cp = i_cp;
20148 break;
20149 }
20150 }
20151 if (cp == NULL)
20152 {
20153 cp = g_new0 (ChangedProperty, 1);
20154 cp->prop_id = prop_id;
20155 cp->info = info;
20156 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
20157 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
20158 g_value_copy (orig_value, &cp->orig_value);
20159 }
20160}
20161
20162static void
20163watchdog_skeleton_notify (GObject *object,
20164 GParamSpec *pspec G_GNUC_UNUSED)
20165{
20166 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
20167 g_mutex_lock (&skeleton->priv->lock);
20168 if (skeleton->priv->changed_properties != NULL &&
20169 skeleton->priv->changed_properties_idle_source == NULL)
20170 {
20171 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
20172 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
20173 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _watchdog_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
Adriana Kobylakfd778822016-06-16 09:08:37 -050020174 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _watchdog_emit_changed");
Norman James362a80f2015-09-14 14:04:39 -050020175 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
20176 g_source_unref (skeleton->priv->changed_properties_idle_source);
20177 }
20178 g_mutex_unlock (&skeleton->priv->lock);
20179}
20180
20181static void
20182watchdog_skeleton_set_property (GObject *object,
20183 guint prop_id,
20184 const GValue *value,
20185 GParamSpec *pspec)
20186{
20187 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
20188 g_assert (prop_id != 0 && prop_id - 1 < 2);
20189 g_mutex_lock (&skeleton->priv->lock);
20190 g_object_freeze_notify (object);
20191 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
20192 {
20193 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
20194 _watchdog_schedule_emit_changed (skeleton, _watchdog_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
20195 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
20196 g_object_notify_by_pspec (object, pspec);
20197 }
20198 g_mutex_unlock (&skeleton->priv->lock);
20199 g_object_thaw_notify (object);
20200}
20201
20202static void
20203watchdog_skeleton_init (WatchdogSkeleton *skeleton)
20204{
20205#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
20206 skeleton->priv = watchdog_skeleton_get_instance_private (skeleton);
20207#else
20208 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_WATCHDOG_SKELETON, WatchdogSkeletonPrivate);
20209#endif
20210
20211 g_mutex_init (&skeleton->priv->lock);
20212 skeleton->priv->context = g_main_context_ref_thread_default ();
20213 skeleton->priv->properties = g_new0 (GValue, 2);
20214 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
20215 g_value_init (&skeleton->priv->properties[1], G_TYPE_INT);
20216}
20217
20218static gint
20219watchdog_skeleton_get_watchdog (Watchdog *object)
20220{
20221 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
20222 gint value;
20223 g_mutex_lock (&skeleton->priv->lock);
20224 value = g_value_get_int (&(skeleton->priv->properties[0]));
20225 g_mutex_unlock (&skeleton->priv->lock);
20226 return value;
20227}
20228
20229static gint
20230watchdog_skeleton_get_poll_interval (Watchdog *object)
20231{
20232 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
20233 gint value;
20234 g_mutex_lock (&skeleton->priv->lock);
20235 value = g_value_get_int (&(skeleton->priv->properties[1]));
20236 g_mutex_unlock (&skeleton->priv->lock);
20237 return value;
20238}
20239
20240static void
20241watchdog_skeleton_class_init (WatchdogSkeletonClass *klass)
20242{
20243 GObjectClass *gobject_class;
20244 GDBusInterfaceSkeletonClass *skeleton_class;
20245
20246 gobject_class = G_OBJECT_CLASS (klass);
20247 gobject_class->finalize = watchdog_skeleton_finalize;
20248 gobject_class->get_property = watchdog_skeleton_get_property;
20249 gobject_class->set_property = watchdog_skeleton_set_property;
20250 gobject_class->notify = watchdog_skeleton_notify;
20251
20252
20253 watchdog_override_properties (gobject_class, 1);
20254
20255 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
20256 skeleton_class->get_info = watchdog_skeleton_dbus_interface_get_info;
20257 skeleton_class->get_properties = watchdog_skeleton_dbus_interface_get_properties;
20258 skeleton_class->flush = watchdog_skeleton_dbus_interface_flush;
20259 skeleton_class->get_vtable = watchdog_skeleton_dbus_interface_get_vtable;
20260
20261#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
20262 g_type_class_add_private (klass, sizeof (WatchdogSkeletonPrivate));
20263#endif
20264}
20265
20266static void
20267watchdog_skeleton_iface_init (WatchdogIface *iface)
20268{
20269 iface->watchdog_error = _watchdog_on_signal_watchdog_error;
20270 iface->get_watchdog = watchdog_skeleton_get_watchdog;
20271 iface->get_poll_interval = watchdog_skeleton_get_poll_interval;
20272}
20273
20274/**
20275 * watchdog_skeleton_new:
20276 *
20277 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link>.
20278 *
20279 * Returns: (transfer full) (type WatchdogSkeleton): The skeleton object.
20280 */
20281Watchdog *
20282watchdog_skeleton_new (void)
20283{
20284 return WATCHDOG (g_object_new (TYPE_WATCHDOG_SKELETON, NULL));
20285}
20286
20287/* ------------------------------------------------------------------------
20288 * Code for interface org.openbmc.EventLog
20289 * ------------------------------------------------------------------------
20290 */
20291
20292/**
20293 * SECTION:EventLog
20294 * @title: EventLog
20295 * @short_description: Generated C code for the org.openbmc.EventLog D-Bus interface
20296 *
20297 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link> D-Bus interface in C.
20298 */
20299
20300/* ---- Introspection data for org.openbmc.EventLog ---- */
20301
Norman James2d1ee892015-09-16 23:13:45 -050020302static const _ExtendedGDBusArgInfo _event_log_method_info_get_event_log_OUT_ARG_log =
20303{
20304 {
20305 -1,
20306 (gchar *) "log",
20307 (gchar *) "a(s)",
20308 NULL
20309 },
20310 FALSE
20311};
20312
20313static const _ExtendedGDBusArgInfo * const _event_log_method_info_get_event_log_OUT_ARG_pointers[] =
20314{
20315 &_event_log_method_info_get_event_log_OUT_ARG_log,
20316 NULL
20317};
20318
20319static const _ExtendedGDBusMethodInfo _event_log_method_info_get_event_log =
20320{
20321 {
20322 -1,
20323 (gchar *) "getEventLog",
20324 NULL,
20325 (GDBusArgInfo **) &_event_log_method_info_get_event_log_OUT_ARG_pointers,
20326 NULL
20327 },
20328 "handle-get-event-log",
20329 FALSE
20330};
20331
20332static const _ExtendedGDBusMethodInfo * const _event_log_method_info_pointers[] =
20333{
20334 &_event_log_method_info_get_event_log,
20335 NULL
20336};
20337
Norman James8abb50c2015-09-16 10:58:16 -050020338static const _ExtendedGDBusArgInfo _event_log_signal_info_event_log_ARG_priority =
Norman James362a80f2015-09-14 14:04:39 -050020339{
20340 {
20341 -1,
Norman James8abb50c2015-09-16 10:58:16 -050020342 (gchar *) "priority",
20343 (gchar *) "i",
Norman James362a80f2015-09-14 14:04:39 -050020344 NULL
20345 },
20346 FALSE
20347};
20348
Norman James362a80f2015-09-14 14:04:39 -050020349static const _ExtendedGDBusArgInfo _event_log_signal_info_event_log_ARG_message =
20350{
20351 {
20352 -1,
20353 (gchar *) "message",
Norman James32e74e22015-09-15 21:28:06 -050020354 (gchar *) "s",
Norman James362a80f2015-09-14 14:04:39 -050020355 NULL
20356 },
20357 FALSE
20358};
20359
Norman James88872672015-09-21 16:51:35 -050020360static const _ExtendedGDBusArgInfo _event_log_signal_info_event_log_ARG_rc =
20361{
20362 {
20363 -1,
20364 (gchar *) "rc",
20365 (gchar *) "i",
20366 NULL
20367 },
20368 FALSE
20369};
20370
Norman James362a80f2015-09-14 14:04:39 -050020371static const _ExtendedGDBusArgInfo * const _event_log_signal_info_event_log_ARG_pointers[] =
20372{
Norman James8abb50c2015-09-16 10:58:16 -050020373 &_event_log_signal_info_event_log_ARG_priority,
Norman James362a80f2015-09-14 14:04:39 -050020374 &_event_log_signal_info_event_log_ARG_message,
Norman James88872672015-09-21 16:51:35 -050020375 &_event_log_signal_info_event_log_ARG_rc,
Norman James362a80f2015-09-14 14:04:39 -050020376 NULL
20377};
20378
20379static const _ExtendedGDBusSignalInfo _event_log_signal_info_event_log =
20380{
20381 {
20382 -1,
20383 (gchar *) "EventLog",
20384 (GDBusArgInfo **) &_event_log_signal_info_event_log_ARG_pointers,
20385 NULL
20386 },
20387 "event-log"
20388};
20389
20390static const _ExtendedGDBusSignalInfo * const _event_log_signal_info_pointers[] =
20391{
20392 &_event_log_signal_info_event_log,
20393 NULL
20394};
20395
Norman James362a80f2015-09-14 14:04:39 -050020396static const _ExtendedGDBusInterfaceInfo _event_log_interface_info =
20397{
20398 {
20399 -1,
20400 (gchar *) "org.openbmc.EventLog",
Norman James2d1ee892015-09-16 23:13:45 -050020401 (GDBusMethodInfo **) &_event_log_method_info_pointers,
Norman James362a80f2015-09-14 14:04:39 -050020402 (GDBusSignalInfo **) &_event_log_signal_info_pointers,
Norman James32e74e22015-09-15 21:28:06 -050020403 NULL,
Norman James362a80f2015-09-14 14:04:39 -050020404 NULL
20405 },
20406 "event-log",
20407};
20408
20409
20410/**
20411 * event_log_interface_info:
20412 *
20413 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link> D-Bus interface.
20414 *
20415 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
20416 */
20417GDBusInterfaceInfo *
20418event_log_interface_info (void)
20419{
20420 return (GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct;
20421}
20422
20423/**
20424 * event_log_override_properties:
20425 * @klass: The class structure for a #GObject<!-- -->-derived class.
20426 * @property_id_begin: The property id to assign to the first overridden property.
20427 *
20428 * Overrides all #GObject properties in the #EventLog interface for a concrete class.
20429 * The properties are overridden in the order they are defined.
20430 *
20431 * Returns: The last property id.
20432 */
20433guint
20434event_log_override_properties (GObjectClass *klass, guint property_id_begin)
20435{
Norman James362a80f2015-09-14 14:04:39 -050020436 return property_id_begin - 1;
20437}
20438
20439
20440
20441/**
20442 * EventLog:
20443 *
20444 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>.
20445 */
20446
20447/**
20448 * EventLogIface:
20449 * @parent_iface: The parent interface.
Norman James2d1ee892015-09-16 23:13:45 -050020450 * @handle_get_event_log: Handler for the #EventLog::handle-get-event-log signal.
Norman James362a80f2015-09-14 14:04:39 -050020451 * @event_log: Handler for the #EventLog::event-log signal.
20452 *
20453 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>.
20454 */
20455
20456typedef EventLogIface EventLogInterface;
20457G_DEFINE_INTERFACE (EventLog, event_log, G_TYPE_OBJECT);
20458
20459static void
20460event_log_default_init (EventLogIface *iface)
20461{
Norman James2d1ee892015-09-16 23:13:45 -050020462 /* GObject signals for incoming D-Bus method calls: */
20463 /**
20464 * EventLog::handle-get-event-log:
20465 * @object: A #EventLog.
20466 * @invocation: A #GDBusMethodInvocation.
20467 *
20468 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-EventLog.getEventLog">getEventLog()</link> D-Bus method.
20469 *
20470 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call event_log_complete_get_event_log() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
20471 *
20472 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
20473 */
20474 g_signal_new ("handle-get-event-log",
20475 G_TYPE_FROM_INTERFACE (iface),
20476 G_SIGNAL_RUN_LAST,
20477 G_STRUCT_OFFSET (EventLogIface, handle_get_event_log),
20478 g_signal_accumulator_true_handled,
20479 NULL,
20480 g_cclosure_marshal_generic,
20481 G_TYPE_BOOLEAN,
20482 1,
20483 G_TYPE_DBUS_METHOD_INVOCATION);
20484
Norman James362a80f2015-09-14 14:04:39 -050020485 /* GObject signals for received D-Bus signals: */
20486 /**
20487 * EventLog::event-log:
20488 * @object: A #EventLog.
Norman James8abb50c2015-09-16 10:58:16 -050020489 * @arg_priority: Argument.
Norman James362a80f2015-09-14 14:04:39 -050020490 * @arg_message: Argument.
Norman James88872672015-09-21 16:51:35 -050020491 * @arg_rc: Argument.
Norman James362a80f2015-09-14 14:04:39 -050020492 *
20493 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-EventLog.EventLog">"EventLog"</link> is received.
20494 *
20495 * 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.
20496 */
20497 g_signal_new ("event-log",
20498 G_TYPE_FROM_INTERFACE (iface),
20499 G_SIGNAL_RUN_LAST,
20500 G_STRUCT_OFFSET (EventLogIface, event_log),
20501 NULL,
20502 NULL,
20503 g_cclosure_marshal_generic,
20504 G_TYPE_NONE,
Norman James88872672015-09-21 16:51:35 -050020505 3, G_TYPE_INT, G_TYPE_STRING, G_TYPE_INT);
Norman James362a80f2015-09-14 14:04:39 -050020506
Norman James362a80f2015-09-14 14:04:39 -050020507}
20508
20509/**
20510 * event_log_emit_event_log:
20511 * @object: A #EventLog.
Norman James8abb50c2015-09-16 10:58:16 -050020512 * @arg_priority: Argument to pass with the signal.
Norman James362a80f2015-09-14 14:04:39 -050020513 * @arg_message: Argument to pass with the signal.
Norman James88872672015-09-21 16:51:35 -050020514 * @arg_rc: Argument to pass with the signal.
Norman James362a80f2015-09-14 14:04:39 -050020515 *
20516 * Emits the <link linkend="gdbus-signal-org-openbmc-EventLog.EventLog">"EventLog"</link> D-Bus signal.
20517 */
20518void
20519event_log_emit_event_log (
20520 EventLog *object,
Norman James8abb50c2015-09-16 10:58:16 -050020521 gint arg_priority,
Norman James88872672015-09-21 16:51:35 -050020522 const gchar *arg_message,
20523 gint arg_rc)
Norman James362a80f2015-09-14 14:04:39 -050020524{
Norman James88872672015-09-21 16:51:35 -050020525 g_signal_emit_by_name (object, "event-log", arg_priority, arg_message, arg_rc);
Norman James362a80f2015-09-14 14:04:39 -050020526}
20527
Norman James2d1ee892015-09-16 23:13:45 -050020528/**
20529 * event_log_call_get_event_log:
20530 * @proxy: A #EventLogProxy.
20531 * @cancellable: (allow-none): A #GCancellable or %NULL.
20532 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
20533 * @user_data: User data to pass to @callback.
20534 *
20535 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-EventLog.getEventLog">getEventLog()</link> D-Bus method on @proxy.
20536 * 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.
20537 * You can then call event_log_call_get_event_log_finish() to get the result of the operation.
20538 *
20539 * See event_log_call_get_event_log_sync() for the synchronous, blocking version of this method.
20540 */
20541void
20542event_log_call_get_event_log (
20543 EventLog *proxy,
20544 GCancellable *cancellable,
20545 GAsyncReadyCallback callback,
20546 gpointer user_data)
20547{
20548 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
20549 "getEventLog",
20550 g_variant_new ("()"),
20551 G_DBUS_CALL_FLAGS_NONE,
20552 -1,
20553 cancellable,
20554 callback,
20555 user_data);
20556}
20557
20558/**
20559 * event_log_call_get_event_log_finish:
20560 * @proxy: A #EventLogProxy.
20561 * @out_log: (out): Return location for return parameter or %NULL to ignore.
20562 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to event_log_call_get_event_log().
20563 * @error: Return location for error or %NULL.
20564 *
20565 * Finishes an operation started with event_log_call_get_event_log().
20566 *
20567 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
20568 */
20569gboolean
20570event_log_call_get_event_log_finish (
20571 EventLog *proxy,
20572 GVariant **out_log,
20573 GAsyncResult *res,
20574 GError **error)
20575{
20576 GVariant *_ret;
20577 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
20578 if (_ret == NULL)
20579 goto _out;
20580 g_variant_get (_ret,
20581 "(@a(s))",
20582 out_log);
20583 g_variant_unref (_ret);
20584_out:
20585 return _ret != NULL;
20586}
20587
20588/**
20589 * event_log_call_get_event_log_sync:
20590 * @proxy: A #EventLogProxy.
20591 * @out_log: (out): Return location for return parameter or %NULL to ignore.
20592 * @cancellable: (allow-none): A #GCancellable or %NULL.
20593 * @error: Return location for error or %NULL.
20594 *
20595 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-EventLog.getEventLog">getEventLog()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
20596 *
20597 * See event_log_call_get_event_log() for the asynchronous version of this method.
20598 *
20599 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
20600 */
20601gboolean
20602event_log_call_get_event_log_sync (
20603 EventLog *proxy,
20604 GVariant **out_log,
20605 GCancellable *cancellable,
20606 GError **error)
20607{
20608 GVariant *_ret;
20609 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
20610 "getEventLog",
20611 g_variant_new ("()"),
20612 G_DBUS_CALL_FLAGS_NONE,
20613 -1,
20614 cancellable,
20615 error);
20616 if (_ret == NULL)
20617 goto _out;
20618 g_variant_get (_ret,
20619 "(@a(s))",
20620 out_log);
20621 g_variant_unref (_ret);
20622_out:
20623 return _ret != NULL;
20624}
20625
20626/**
20627 * event_log_complete_get_event_log:
20628 * @object: A #EventLog.
20629 * @invocation: (transfer full): A #GDBusMethodInvocation.
20630 * @log: Parameter to return.
20631 *
20632 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-EventLog.getEventLog">getEventLog()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
20633 *
20634 * This method will free @invocation, you cannot use it afterwards.
20635 */
20636void
20637event_log_complete_get_event_log (
20638 EventLog *object,
20639 GDBusMethodInvocation *invocation,
20640 GVariant *log)
20641{
20642 g_dbus_method_invocation_return_value (invocation,
20643 g_variant_new ("(@a(s))",
20644 log));
20645}
20646
Norman James362a80f2015-09-14 14:04:39 -050020647/* ------------------------------------------------------------------------ */
20648
20649/**
20650 * EventLogProxy:
20651 *
20652 * The #EventLogProxy structure contains only private data and should only be accessed using the provided API.
20653 */
20654
20655/**
20656 * EventLogProxyClass:
20657 * @parent_class: The parent class.
20658 *
20659 * Class structure for #EventLogProxy.
20660 */
20661
20662struct _EventLogProxyPrivate
20663{
20664 GData *qdata;
20665};
20666
20667static void event_log_proxy_iface_init (EventLogIface *iface);
20668
20669#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
20670G_DEFINE_TYPE_WITH_CODE (EventLogProxy, event_log_proxy, G_TYPE_DBUS_PROXY,
20671 G_ADD_PRIVATE (EventLogProxy)
20672 G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_proxy_iface_init));
20673
20674#else
20675G_DEFINE_TYPE_WITH_CODE (EventLogProxy, event_log_proxy, G_TYPE_DBUS_PROXY,
20676 G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_proxy_iface_init));
20677
20678#endif
20679static void
20680event_log_proxy_finalize (GObject *object)
20681{
20682 EventLogProxy *proxy = EVENT_LOG_PROXY (object);
20683 g_datalist_clear (&proxy->priv->qdata);
20684 G_OBJECT_CLASS (event_log_proxy_parent_class)->finalize (object);
20685}
20686
20687static void
20688event_log_proxy_get_property (GObject *object,
20689 guint prop_id,
20690 GValue *value,
20691 GParamSpec *pspec G_GNUC_UNUSED)
20692{
Norman James362a80f2015-09-14 14:04:39 -050020693}
20694
20695static void
20696event_log_proxy_set_property (GObject *object,
20697 guint prop_id,
20698 const GValue *value,
20699 GParamSpec *pspec G_GNUC_UNUSED)
20700{
Norman James362a80f2015-09-14 14:04:39 -050020701}
20702
20703static void
20704event_log_proxy_g_signal (GDBusProxy *proxy,
20705 const gchar *sender_name G_GNUC_UNUSED,
20706 const gchar *signal_name,
20707 GVariant *parameters)
20708{
20709 _ExtendedGDBusSignalInfo *info;
20710 GVariantIter iter;
20711 GVariant *child;
20712 GValue *paramv;
20713 guint num_params;
20714 guint n;
20715 guint signal_id;
20716 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, signal_name);
20717 if (info == NULL)
20718 return;
20719 num_params = g_variant_n_children (parameters);
20720 paramv = g_new0 (GValue, num_params + 1);
20721 g_value_init (&paramv[0], TYPE_EVENT_LOG);
20722 g_value_set_object (&paramv[0], proxy);
20723 g_variant_iter_init (&iter, parameters);
20724 n = 1;
20725 while ((child = g_variant_iter_next_value (&iter)) != NULL)
20726 {
20727 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
20728 if (arg_info->use_gvariant)
20729 {
20730 g_value_init (&paramv[n], G_TYPE_VARIANT);
20731 g_value_set_variant (&paramv[n], child);
20732 n++;
20733 }
20734 else
20735 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
20736 g_variant_unref (child);
20737 }
20738 signal_id = g_signal_lookup (info->signal_name, TYPE_EVENT_LOG);
20739 g_signal_emitv (paramv, signal_id, 0, NULL);
20740 for (n = 0; n < num_params + 1; n++)
20741 g_value_unset (&paramv[n]);
20742 g_free (paramv);
20743}
20744
20745static void
20746event_log_proxy_g_properties_changed (GDBusProxy *_proxy,
20747 GVariant *changed_properties,
20748 const gchar *const *invalidated_properties)
20749{
20750 EventLogProxy *proxy = EVENT_LOG_PROXY (_proxy);
20751 guint n;
20752 const gchar *key;
20753 GVariantIter *iter;
20754 _ExtendedGDBusPropertyInfo *info;
20755 g_variant_get (changed_properties, "a{sv}", &iter);
20756 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
20757 {
20758 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, key);
20759 g_datalist_remove_data (&proxy->priv->qdata, key);
20760 if (info != NULL)
20761 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
20762 }
20763 g_variant_iter_free (iter);
20764 for (n = 0; invalidated_properties[n] != NULL; n++)
20765 {
20766 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, invalidated_properties[n]);
20767 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
20768 if (info != NULL)
20769 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
20770 }
20771}
20772
Norman James362a80f2015-09-14 14:04:39 -050020773static void
20774event_log_proxy_init (EventLogProxy *proxy)
20775{
20776#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
20777 proxy->priv = event_log_proxy_get_instance_private (proxy);
20778#else
20779 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_EVENT_LOG_PROXY, EventLogProxyPrivate);
20780#endif
20781
20782 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), event_log_interface_info ());
20783}
20784
20785static void
20786event_log_proxy_class_init (EventLogProxyClass *klass)
20787{
20788 GObjectClass *gobject_class;
20789 GDBusProxyClass *proxy_class;
20790
20791 gobject_class = G_OBJECT_CLASS (klass);
20792 gobject_class->finalize = event_log_proxy_finalize;
20793 gobject_class->get_property = event_log_proxy_get_property;
20794 gobject_class->set_property = event_log_proxy_set_property;
20795
20796 proxy_class = G_DBUS_PROXY_CLASS (klass);
20797 proxy_class->g_signal = event_log_proxy_g_signal;
20798 proxy_class->g_properties_changed = event_log_proxy_g_properties_changed;
20799
Norman James362a80f2015-09-14 14:04:39 -050020800#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
20801 g_type_class_add_private (klass, sizeof (EventLogProxyPrivate));
20802#endif
20803}
20804
20805static void
20806event_log_proxy_iface_init (EventLogIface *iface)
20807{
Norman James362a80f2015-09-14 14:04:39 -050020808}
20809
20810/**
20811 * event_log_proxy_new:
20812 * @connection: A #GDBusConnection.
20813 * @flags: Flags from the #GDBusProxyFlags enumeration.
20814 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
20815 * @object_path: An object path.
20816 * @cancellable: (allow-none): A #GCancellable or %NULL.
20817 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
20818 * @user_data: User data to pass to @callback.
20819 *
20820 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>. See g_dbus_proxy_new() for more details.
20821 *
20822 * 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.
20823 * You can then call event_log_proxy_new_finish() to get the result of the operation.
20824 *
20825 * See event_log_proxy_new_sync() for the synchronous, blocking version of this constructor.
20826 */
20827void
20828event_log_proxy_new (
20829 GDBusConnection *connection,
20830 GDBusProxyFlags flags,
20831 const gchar *name,
20832 const gchar *object_path,
20833 GCancellable *cancellable,
20834 GAsyncReadyCallback callback,
20835 gpointer user_data)
20836{
20837 g_async_initable_new_async (TYPE_EVENT_LOG_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.EventLog", NULL);
20838}
20839
20840/**
20841 * event_log_proxy_new_finish:
20842 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to event_log_proxy_new().
20843 * @error: Return location for error or %NULL
20844 *
20845 * Finishes an operation started with event_log_proxy_new().
20846 *
20847 * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set.
20848 */
20849EventLog *
20850event_log_proxy_new_finish (
20851 GAsyncResult *res,
20852 GError **error)
20853{
20854 GObject *ret;
20855 GObject *source_object;
20856 source_object = g_async_result_get_source_object (res);
20857 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
20858 g_object_unref (source_object);
20859 if (ret != NULL)
20860 return EVENT_LOG (ret);
20861 else
20862 return NULL;
20863}
20864
20865/**
20866 * event_log_proxy_new_sync:
20867 * @connection: A #GDBusConnection.
20868 * @flags: Flags from the #GDBusProxyFlags enumeration.
20869 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
20870 * @object_path: An object path.
20871 * @cancellable: (allow-none): A #GCancellable or %NULL.
20872 * @error: Return location for error or %NULL
20873 *
20874 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>. See g_dbus_proxy_new_sync() for more details.
20875 *
20876 * The calling thread is blocked until a reply is received.
20877 *
20878 * See event_log_proxy_new() for the asynchronous version of this constructor.
20879 *
20880 * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set.
20881 */
20882EventLog *
20883event_log_proxy_new_sync (
20884 GDBusConnection *connection,
20885 GDBusProxyFlags flags,
20886 const gchar *name,
20887 const gchar *object_path,
20888 GCancellable *cancellable,
20889 GError **error)
20890{
20891 GInitable *ret;
20892 ret = g_initable_new (TYPE_EVENT_LOG_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.EventLog", NULL);
20893 if (ret != NULL)
20894 return EVENT_LOG (ret);
20895 else
20896 return NULL;
20897}
20898
20899
20900/**
20901 * event_log_proxy_new_for_bus:
20902 * @bus_type: A #GBusType.
20903 * @flags: Flags from the #GDBusProxyFlags enumeration.
20904 * @name: A bus name (well-known or unique).
20905 * @object_path: An object path.
20906 * @cancellable: (allow-none): A #GCancellable or %NULL.
20907 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
20908 * @user_data: User data to pass to @callback.
20909 *
20910 * Like event_log_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
20911 *
20912 * 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.
20913 * You can then call event_log_proxy_new_for_bus_finish() to get the result of the operation.
20914 *
20915 * See event_log_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
20916 */
20917void
20918event_log_proxy_new_for_bus (
20919 GBusType bus_type,
20920 GDBusProxyFlags flags,
20921 const gchar *name,
20922 const gchar *object_path,
20923 GCancellable *cancellable,
20924 GAsyncReadyCallback callback,
20925 gpointer user_data)
20926{
20927 g_async_initable_new_async (TYPE_EVENT_LOG_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.EventLog", NULL);
20928}
20929
20930/**
20931 * event_log_proxy_new_for_bus_finish:
20932 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to event_log_proxy_new_for_bus().
20933 * @error: Return location for error or %NULL
20934 *
20935 * Finishes an operation started with event_log_proxy_new_for_bus().
20936 *
20937 * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set.
20938 */
20939EventLog *
20940event_log_proxy_new_for_bus_finish (
20941 GAsyncResult *res,
20942 GError **error)
20943{
20944 GObject *ret;
20945 GObject *source_object;
20946 source_object = g_async_result_get_source_object (res);
20947 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
20948 g_object_unref (source_object);
20949 if (ret != NULL)
20950 return EVENT_LOG (ret);
20951 else
20952 return NULL;
20953}
20954
20955/**
20956 * event_log_proxy_new_for_bus_sync:
20957 * @bus_type: A #GBusType.
20958 * @flags: Flags from the #GDBusProxyFlags enumeration.
20959 * @name: A bus name (well-known or unique).
20960 * @object_path: An object path.
20961 * @cancellable: (allow-none): A #GCancellable or %NULL.
20962 * @error: Return location for error or %NULL
20963 *
20964 * Like event_log_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
20965 *
20966 * The calling thread is blocked until a reply is received.
20967 *
20968 * See event_log_proxy_new_for_bus() for the asynchronous version of this constructor.
20969 *
20970 * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set.
20971 */
20972EventLog *
20973event_log_proxy_new_for_bus_sync (
20974 GBusType bus_type,
20975 GDBusProxyFlags flags,
20976 const gchar *name,
20977 const gchar *object_path,
20978 GCancellable *cancellable,
20979 GError **error)
20980{
20981 GInitable *ret;
20982 ret = g_initable_new (TYPE_EVENT_LOG_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.EventLog", NULL);
20983 if (ret != NULL)
20984 return EVENT_LOG (ret);
20985 else
20986 return NULL;
20987}
20988
20989
20990/* ------------------------------------------------------------------------ */
20991
20992/**
20993 * EventLogSkeleton:
20994 *
20995 * The #EventLogSkeleton structure contains only private data and should only be accessed using the provided API.
20996 */
20997
20998/**
20999 * EventLogSkeletonClass:
21000 * @parent_class: The parent class.
21001 *
21002 * Class structure for #EventLogSkeleton.
21003 */
21004
21005struct _EventLogSkeletonPrivate
21006{
21007 GValue *properties;
21008 GList *changed_properties;
21009 GSource *changed_properties_idle_source;
21010 GMainContext *context;
21011 GMutex lock;
21012};
21013
21014static void
21015_event_log_skeleton_handle_method_call (
21016 GDBusConnection *connection G_GNUC_UNUSED,
21017 const gchar *sender G_GNUC_UNUSED,
21018 const gchar *object_path G_GNUC_UNUSED,
21019 const gchar *interface_name,
21020 const gchar *method_name,
21021 GVariant *parameters,
21022 GDBusMethodInvocation *invocation,
21023 gpointer user_data)
21024{
21025 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (user_data);
21026 _ExtendedGDBusMethodInfo *info;
21027 GVariantIter iter;
21028 GVariant *child;
21029 GValue *paramv;
21030 guint num_params;
21031 guint num_extra;
21032 guint n;
21033 guint signal_id;
21034 GValue return_value = G_VALUE_INIT;
21035 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
21036 g_assert (info != NULL);
21037 num_params = g_variant_n_children (parameters);
21038 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
21039 n = 0;
21040 g_value_init (&paramv[n], TYPE_EVENT_LOG);
21041 g_value_set_object (&paramv[n++], skeleton);
21042 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
21043 g_value_set_object (&paramv[n++], invocation);
21044 if (info->pass_fdlist)
21045 {
21046#ifdef G_OS_UNIX
21047 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
21048 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
21049#else
21050 g_assert_not_reached ();
21051#endif
21052 }
21053 g_variant_iter_init (&iter, parameters);
21054 while ((child = g_variant_iter_next_value (&iter)) != NULL)
21055 {
21056 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
21057 if (arg_info->use_gvariant)
21058 {
21059 g_value_init (&paramv[n], G_TYPE_VARIANT);
21060 g_value_set_variant (&paramv[n], child);
21061 n++;
21062 }
21063 else
21064 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
21065 g_variant_unref (child);
21066 }
21067 signal_id = g_signal_lookup (info->signal_name, TYPE_EVENT_LOG);
21068 g_value_init (&return_value, G_TYPE_BOOLEAN);
21069 g_signal_emitv (paramv, signal_id, 0, &return_value);
21070 if (!g_value_get_boolean (&return_value))
21071 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);
21072 g_value_unset (&return_value);
21073 for (n = 0; n < num_params + num_extra; n++)
21074 g_value_unset (&paramv[n]);
21075 g_free (paramv);
21076}
21077
21078static GVariant *
21079_event_log_skeleton_handle_get_property (
21080 GDBusConnection *connection G_GNUC_UNUSED,
21081 const gchar *sender G_GNUC_UNUSED,
21082 const gchar *object_path G_GNUC_UNUSED,
21083 const gchar *interface_name G_GNUC_UNUSED,
21084 const gchar *property_name,
21085 GError **error,
21086 gpointer user_data)
21087{
21088 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (user_data);
21089 GValue value = G_VALUE_INIT;
21090 GParamSpec *pspec;
21091 _ExtendedGDBusPropertyInfo *info;
21092 GVariant *ret;
21093 ret = NULL;
21094 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, property_name);
21095 g_assert (info != NULL);
21096 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
21097 if (pspec == NULL)
21098 {
21099 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
21100 }
21101 else
21102 {
21103 g_value_init (&value, pspec->value_type);
21104 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
21105 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
21106 g_value_unset (&value);
21107 }
21108 return ret;
21109}
21110
21111static gboolean
21112_event_log_skeleton_handle_set_property (
21113 GDBusConnection *connection G_GNUC_UNUSED,
21114 const gchar *sender G_GNUC_UNUSED,
21115 const gchar *object_path G_GNUC_UNUSED,
21116 const gchar *interface_name G_GNUC_UNUSED,
21117 const gchar *property_name,
21118 GVariant *variant,
21119 GError **error,
21120 gpointer user_data)
21121{
21122 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (user_data);
21123 GValue value = G_VALUE_INIT;
21124 GParamSpec *pspec;
21125 _ExtendedGDBusPropertyInfo *info;
21126 gboolean ret;
21127 ret = FALSE;
21128 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, property_name);
21129 g_assert (info != NULL);
21130 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
21131 if (pspec == NULL)
21132 {
21133 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
21134 }
21135 else
21136 {
21137 if (info->use_gvariant)
21138 g_value_set_variant (&value, variant);
21139 else
21140 g_dbus_gvariant_to_gvalue (variant, &value);
21141 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
21142 g_value_unset (&value);
21143 ret = TRUE;
21144 }
21145 return ret;
21146}
21147
21148static const GDBusInterfaceVTable _event_log_skeleton_vtable =
21149{
21150 _event_log_skeleton_handle_method_call,
21151 _event_log_skeleton_handle_get_property,
21152 _event_log_skeleton_handle_set_property,
21153 {NULL}
21154};
21155
21156static GDBusInterfaceInfo *
21157event_log_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
21158{
21159 return event_log_interface_info ();
21160}
21161
21162static GDBusInterfaceVTable *
21163event_log_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
21164{
21165 return (GDBusInterfaceVTable *) &_event_log_skeleton_vtable;
21166}
21167
21168static GVariant *
21169event_log_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
21170{
21171 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (_skeleton);
21172
21173 GVariantBuilder builder;
21174 guint n;
21175 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
21176 if (_event_log_interface_info.parent_struct.properties == NULL)
21177 goto out;
21178 for (n = 0; _event_log_interface_info.parent_struct.properties[n] != NULL; n++)
21179 {
21180 GDBusPropertyInfo *info = _event_log_interface_info.parent_struct.properties[n];
21181 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
21182 {
21183 GVariant *value;
21184 value = _event_log_skeleton_handle_get_property (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.EventLog", info->name, NULL, skeleton);
21185 if (value != NULL)
21186 {
21187 g_variant_take_ref (value);
21188 g_variant_builder_add (&builder, "{sv}", info->name, value);
21189 g_variant_unref (value);
21190 }
21191 }
21192 }
21193out:
21194 return g_variant_builder_end (&builder);
21195}
21196
Norman James362a80f2015-09-14 14:04:39 -050021197static void
21198event_log_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
21199{
Norman James362a80f2015-09-14 14:04:39 -050021200}
21201
21202static void
21203_event_log_on_signal_event_log (
21204 EventLog *object,
Norman James8abb50c2015-09-16 10:58:16 -050021205 gint arg_priority,
Norman James88872672015-09-21 16:51:35 -050021206 const gchar *arg_message,
21207 gint arg_rc)
Norman James362a80f2015-09-14 14:04:39 -050021208{
21209 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (object);
21210
21211 GList *connections, *l;
21212 GVariant *signal_variant;
21213 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
21214
Norman James88872672015-09-21 16:51:35 -050021215 signal_variant = g_variant_ref_sink (g_variant_new ("(isi)",
Norman James8abb50c2015-09-16 10:58:16 -050021216 arg_priority,
Norman James88872672015-09-21 16:51:35 -050021217 arg_message,
21218 arg_rc));
Norman James362a80f2015-09-14 14:04:39 -050021219 for (l = connections; l != NULL; l = l->next)
21220 {
21221 GDBusConnection *connection = l->data;
21222 g_dbus_connection_emit_signal (connection,
21223 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.EventLog", "EventLog",
21224 signal_variant, NULL);
21225 }
21226 g_variant_unref (signal_variant);
21227 g_list_free_full (connections, g_object_unref);
21228}
21229
21230static void event_log_skeleton_iface_init (EventLogIface *iface);
21231#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
21232G_DEFINE_TYPE_WITH_CODE (EventLogSkeleton, event_log_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
21233 G_ADD_PRIVATE (EventLogSkeleton)
21234 G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_skeleton_iface_init));
21235
21236#else
21237G_DEFINE_TYPE_WITH_CODE (EventLogSkeleton, event_log_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
21238 G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_skeleton_iface_init));
21239
21240#endif
21241static void
21242event_log_skeleton_finalize (GObject *object)
21243{
21244 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (object);
Norman James362a80f2015-09-14 14:04:39 -050021245 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
21246 if (skeleton->priv->changed_properties_idle_source != NULL)
21247 g_source_destroy (skeleton->priv->changed_properties_idle_source);
21248 g_main_context_unref (skeleton->priv->context);
21249 g_mutex_clear (&skeleton->priv->lock);
21250 G_OBJECT_CLASS (event_log_skeleton_parent_class)->finalize (object);
21251}
21252
21253static void
Norman James362a80f2015-09-14 14:04:39 -050021254event_log_skeleton_init (EventLogSkeleton *skeleton)
21255{
21256#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
21257 skeleton->priv = event_log_skeleton_get_instance_private (skeleton);
21258#else
21259 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_EVENT_LOG_SKELETON, EventLogSkeletonPrivate);
21260#endif
21261
21262 g_mutex_init (&skeleton->priv->lock);
21263 skeleton->priv->context = g_main_context_ref_thread_default ();
Norman James362a80f2015-09-14 14:04:39 -050021264}
21265
21266static void
21267event_log_skeleton_class_init (EventLogSkeletonClass *klass)
21268{
21269 GObjectClass *gobject_class;
21270 GDBusInterfaceSkeletonClass *skeleton_class;
21271
21272 gobject_class = G_OBJECT_CLASS (klass);
21273 gobject_class->finalize = event_log_skeleton_finalize;
Norman James362a80f2015-09-14 14:04:39 -050021274
21275 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
21276 skeleton_class->get_info = event_log_skeleton_dbus_interface_get_info;
21277 skeleton_class->get_properties = event_log_skeleton_dbus_interface_get_properties;
21278 skeleton_class->flush = event_log_skeleton_dbus_interface_flush;
21279 skeleton_class->get_vtable = event_log_skeleton_dbus_interface_get_vtable;
21280
21281#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
21282 g_type_class_add_private (klass, sizeof (EventLogSkeletonPrivate));
21283#endif
21284}
21285
21286static void
21287event_log_skeleton_iface_init (EventLogIface *iface)
21288{
21289 iface->event_log = _event_log_on_signal_event_log;
Norman James362a80f2015-09-14 14:04:39 -050021290}
21291
21292/**
21293 * event_log_skeleton_new:
21294 *
21295 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>.
21296 *
21297 * Returns: (transfer full) (type EventLogSkeleton): The skeleton object.
21298 */
21299EventLog *
21300event_log_skeleton_new (void)
21301{
21302 return EVENT_LOG (g_object_new (TYPE_EVENT_LOG_SKELETON, NULL));
21303}
21304
21305/* ------------------------------------------------------------------------
21306 * Code for interface org.openbmc.Flash
21307 * ------------------------------------------------------------------------
21308 */
21309
21310/**
21311 * SECTION:Flash
21312 * @title: Flash
21313 * @short_description: Generated C code for the org.openbmc.Flash D-Bus interface
21314 *
21315 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link> D-Bus interface in C.
21316 */
21317
21318/* ---- Introspection data for org.openbmc.Flash ---- */
21319
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021320static const _ExtendedGDBusArgInfo _flash_method_info_update_IN_ARG_filename =
Norman James362a80f2015-09-14 14:04:39 -050021321{
21322 {
21323 -1,
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021324 (gchar *) "filename",
Norman James362a80f2015-09-14 14:04:39 -050021325 (gchar *) "s",
21326 NULL
21327 },
21328 FALSE
21329};
21330
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021331static const _ExtendedGDBusArgInfo * const _flash_method_info_update_IN_ARG_pointers[] =
Norman James362a80f2015-09-14 14:04:39 -050021332{
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021333 &_flash_method_info_update_IN_ARG_filename,
Norman James362a80f2015-09-14 14:04:39 -050021334 NULL
21335};
21336
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021337static const _ExtendedGDBusMethodInfo _flash_method_info_update =
Norman James362a80f2015-09-14 14:04:39 -050021338{
21339 {
21340 -1,
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021341 (gchar *) "update",
21342 (GDBusArgInfo **) &_flash_method_info_update_IN_ARG_pointers,
Norman James362a80f2015-09-14 14:04:39 -050021343 NULL,
21344 NULL
21345 },
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021346 "handle-update",
Norman James362a80f2015-09-14 14:04:39 -050021347 FALSE
21348};
21349
Norman James166acf42015-10-22 07:11:51 -050021350static const _ExtendedGDBusArgInfo _flash_method_info_error_IN_ARG_message =
21351{
21352 {
21353 -1,
21354 (gchar *) "message",
21355 (gchar *) "s",
21356 NULL
21357 },
21358 FALSE
21359};
21360
21361static const _ExtendedGDBusArgInfo * const _flash_method_info_error_IN_ARG_pointers[] =
21362{
21363 &_flash_method_info_error_IN_ARG_message,
21364 NULL
21365};
21366
21367static const _ExtendedGDBusMethodInfo _flash_method_info_error =
21368{
21369 {
21370 -1,
21371 (gchar *) "error",
21372 (GDBusArgInfo **) &_flash_method_info_error_IN_ARG_pointers,
21373 NULL,
21374 NULL
21375 },
21376 "handle-error",
21377 FALSE
21378};
21379
21380static const _ExtendedGDBusMethodInfo _flash_method_info_done =
21381{
21382 {
21383 -1,
21384 (gchar *) "done",
21385 NULL,
21386 NULL,
21387 NULL
21388 },
21389 "handle-done",
21390 FALSE
21391};
21392
Norman Jamesf066e872015-10-07 15:29:51 -050021393static const _ExtendedGDBusArgInfo _flash_method_info_update_via_tftp_IN_ARG_url =
21394{
21395 {
21396 -1,
21397 (gchar *) "url",
21398 (gchar *) "s",
21399 NULL
21400 },
21401 FALSE
21402};
21403
21404static const _ExtendedGDBusArgInfo _flash_method_info_update_via_tftp_IN_ARG_filename =
21405{
21406 {
21407 -1,
21408 (gchar *) "filename",
21409 (gchar *) "s",
21410 NULL
21411 },
21412 FALSE
21413};
21414
21415static const _ExtendedGDBusArgInfo * const _flash_method_info_update_via_tftp_IN_ARG_pointers[] =
21416{
21417 &_flash_method_info_update_via_tftp_IN_ARG_url,
21418 &_flash_method_info_update_via_tftp_IN_ARG_filename,
21419 NULL
21420};
21421
21422static const _ExtendedGDBusMethodInfo _flash_method_info_update_via_tftp =
21423{
21424 {
21425 -1,
21426 (gchar *) "updateViaTftp",
21427 (GDBusArgInfo **) &_flash_method_info_update_via_tftp_IN_ARG_pointers,
21428 NULL,
21429 NULL
21430 },
21431 "handle-update-via-tftp",
21432 FALSE
21433};
21434
Norman James362a80f2015-09-14 14:04:39 -050021435static const _ExtendedGDBusMethodInfo _flash_method_info_init =
21436{
21437 {
21438 -1,
21439 (gchar *) "init",
21440 NULL,
21441 NULL,
21442 NULL
21443 },
21444 "handle-init",
21445 FALSE
21446};
21447
21448static const _ExtendedGDBusMethodInfo * const _flash_method_info_pointers[] =
21449{
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021450 &_flash_method_info_update,
Norman James166acf42015-10-22 07:11:51 -050021451 &_flash_method_info_error,
21452 &_flash_method_info_done,
Norman Jamesf066e872015-10-07 15:29:51 -050021453 &_flash_method_info_update_via_tftp,
Norman James362a80f2015-09-14 14:04:39 -050021454 &_flash_method_info_init,
21455 NULL
21456};
21457
21458static const _ExtendedGDBusSignalInfo _flash_signal_info_updated =
21459{
21460 {
21461 -1,
21462 (gchar *) "Updated",
21463 NULL,
21464 NULL
21465 },
21466 "updated"
21467};
21468
Norman Jamesf066e872015-10-07 15:29:51 -050021469static const _ExtendedGDBusArgInfo _flash_signal_info_download_ARG_url =
21470{
21471 {
21472 -1,
21473 (gchar *) "url",
21474 (gchar *) "s",
21475 NULL
21476 },
21477 FALSE
21478};
21479
21480static const _ExtendedGDBusArgInfo _flash_signal_info_download_ARG_filename =
21481{
21482 {
21483 -1,
21484 (gchar *) "filename",
21485 (gchar *) "s",
21486 NULL
21487 },
21488 FALSE
21489};
21490
21491static const _ExtendedGDBusArgInfo * const _flash_signal_info_download_ARG_pointers[] =
21492{
21493 &_flash_signal_info_download_ARG_url,
21494 &_flash_signal_info_download_ARG_filename,
21495 NULL
21496};
21497
21498static const _ExtendedGDBusSignalInfo _flash_signal_info_download =
21499{
21500 {
21501 -1,
21502 (gchar *) "Download",
21503 (GDBusArgInfo **) &_flash_signal_info_download_ARG_pointers,
21504 NULL
21505 },
21506 "download"
21507};
21508
Norman James362a80f2015-09-14 14:04:39 -050021509static const _ExtendedGDBusSignalInfo * const _flash_signal_info_pointers[] =
21510{
21511 &_flash_signal_info_updated,
Norman Jamesf066e872015-10-07 15:29:51 -050021512 &_flash_signal_info_download,
Norman James362a80f2015-09-14 14:04:39 -050021513 NULL
21514};
21515
Norman James18998182015-10-11 21:54:53 -050021516static const _ExtendedGDBusPropertyInfo _flash_property_info_filename =
21517{
21518 {
21519 -1,
21520 (gchar *) "filename",
21521 (gchar *) "s",
21522 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
21523 NULL
21524 },
21525 "filename",
21526 FALSE
21527};
21528
21529static const _ExtendedGDBusPropertyInfo _flash_property_info_flasher_path =
21530{
21531 {
21532 -1,
21533 (gchar *) "flasher_path",
21534 (gchar *) "s",
21535 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
21536 NULL
21537 },
21538 "flasher-path",
21539 FALSE
21540};
21541
21542static const _ExtendedGDBusPropertyInfo _flash_property_info_flasher_name =
21543{
21544 {
21545 -1,
21546 (gchar *) "flasher_name",
21547 (gchar *) "s",
21548 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
21549 NULL
21550 },
21551 "flasher-name",
21552 FALSE
21553};
21554
21555static const _ExtendedGDBusPropertyInfo _flash_property_info_flasher_instance =
21556{
21557 {
21558 -1,
21559 (gchar *) "flasher_instance",
21560 (gchar *) "s",
21561 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
21562 NULL
21563 },
21564 "flasher-instance",
21565 FALSE
21566};
21567
Norman James166acf42015-10-22 07:11:51 -050021568static const _ExtendedGDBusPropertyInfo _flash_property_info_status =
21569{
21570 {
21571 -1,
21572 (gchar *) "status",
21573 (gchar *) "s",
21574 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
21575 NULL
21576 },
21577 "status",
21578 FALSE
21579};
21580
Norman James18998182015-10-11 21:54:53 -050021581static const _ExtendedGDBusPropertyInfo * const _flash_property_info_pointers[] =
21582{
21583 &_flash_property_info_filename,
21584 &_flash_property_info_flasher_path,
21585 &_flash_property_info_flasher_name,
21586 &_flash_property_info_flasher_instance,
Norman James166acf42015-10-22 07:11:51 -050021587 &_flash_property_info_status,
Norman James18998182015-10-11 21:54:53 -050021588 NULL
21589};
21590
Norman James362a80f2015-09-14 14:04:39 -050021591static const _ExtendedGDBusInterfaceInfo _flash_interface_info =
21592{
21593 {
21594 -1,
21595 (gchar *) "org.openbmc.Flash",
21596 (GDBusMethodInfo **) &_flash_method_info_pointers,
21597 (GDBusSignalInfo **) &_flash_signal_info_pointers,
Norman James18998182015-10-11 21:54:53 -050021598 (GDBusPropertyInfo **) &_flash_property_info_pointers,
Norman James362a80f2015-09-14 14:04:39 -050021599 NULL
21600 },
21601 "flash",
21602};
21603
21604
21605/**
21606 * flash_interface_info:
21607 *
21608 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link> D-Bus interface.
21609 *
21610 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
21611 */
21612GDBusInterfaceInfo *
21613flash_interface_info (void)
21614{
21615 return (GDBusInterfaceInfo *) &_flash_interface_info.parent_struct;
21616}
21617
21618/**
21619 * flash_override_properties:
21620 * @klass: The class structure for a #GObject<!-- -->-derived class.
21621 * @property_id_begin: The property id to assign to the first overridden property.
21622 *
21623 * Overrides all #GObject properties in the #Flash interface for a concrete class.
21624 * The properties are overridden in the order they are defined.
21625 *
21626 * Returns: The last property id.
21627 */
21628guint
21629flash_override_properties (GObjectClass *klass, guint property_id_begin)
21630{
Norman James18998182015-10-11 21:54:53 -050021631 g_object_class_override_property (klass, property_id_begin++, "filename");
21632 g_object_class_override_property (klass, property_id_begin++, "flasher-path");
21633 g_object_class_override_property (klass, property_id_begin++, "flasher-name");
21634 g_object_class_override_property (klass, property_id_begin++, "flasher-instance");
Norman James166acf42015-10-22 07:11:51 -050021635 g_object_class_override_property (klass, property_id_begin++, "status");
Norman James362a80f2015-09-14 14:04:39 -050021636 return property_id_begin - 1;
21637}
21638
21639
21640
21641/**
21642 * Flash:
21643 *
21644 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>.
21645 */
21646
21647/**
21648 * FlashIface:
21649 * @parent_iface: The parent interface.
Norman James166acf42015-10-22 07:11:51 -050021650 * @handle_done: Handler for the #Flash::handle-done signal.
21651 * @handle_error: Handler for the #Flash::handle-error signal.
Norman James362a80f2015-09-14 14:04:39 -050021652 * @handle_init: Handler for the #Flash::handle-init signal.
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021653 * @handle_update: Handler for the #Flash::handle-update signal.
Norman Jamesf066e872015-10-07 15:29:51 -050021654 * @handle_update_via_tftp: Handler for the #Flash::handle-update-via-tftp signal.
Norman James18998182015-10-11 21:54:53 -050021655 * @get_filename: Getter for the #Flash:filename property.
21656 * @get_flasher_instance: Getter for the #Flash:flasher-instance property.
21657 * @get_flasher_name: Getter for the #Flash:flasher-name property.
21658 * @get_flasher_path: Getter for the #Flash:flasher-path property.
Norman James166acf42015-10-22 07:11:51 -050021659 * @get_status: Getter for the #Flash:status property.
Norman Jamesf066e872015-10-07 15:29:51 -050021660 * @download: Handler for the #Flash::download signal.
Norman James362a80f2015-09-14 14:04:39 -050021661 * @updated: Handler for the #Flash::updated signal.
21662 *
21663 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>.
21664 */
21665
21666typedef FlashIface FlashInterface;
21667G_DEFINE_INTERFACE (Flash, flash, G_TYPE_OBJECT);
21668
21669static void
21670flash_default_init (FlashIface *iface)
21671{
21672 /* GObject signals for incoming D-Bus method calls: */
21673 /**
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021674 * Flash::handle-update:
Norman James362a80f2015-09-14 14:04:39 -050021675 * @object: A #Flash.
21676 * @invocation: A #GDBusMethodInvocation.
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021677 * @arg_filename: Argument passed by remote caller.
Norman James362a80f2015-09-14 14:04:39 -050021678 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021679 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.update">update()</link> D-Bus method.
Norman James362a80f2015-09-14 14:04:39 -050021680 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021681 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call flash_complete_update() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
Norman James362a80f2015-09-14 14:04:39 -050021682 *
21683 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
21684 */
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021685 g_signal_new ("handle-update",
Norman James362a80f2015-09-14 14:04:39 -050021686 G_TYPE_FROM_INTERFACE (iface),
21687 G_SIGNAL_RUN_LAST,
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021688 G_STRUCT_OFFSET (FlashIface, handle_update),
Norman James362a80f2015-09-14 14:04:39 -050021689 g_signal_accumulator_true_handled,
21690 NULL,
21691 g_cclosure_marshal_generic,
21692 G_TYPE_BOOLEAN,
21693 2,
21694 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING);
21695
21696 /**
Norman James166acf42015-10-22 07:11:51 -050021697 * Flash::handle-error:
21698 * @object: A #Flash.
21699 * @invocation: A #GDBusMethodInvocation.
21700 * @arg_message: Argument passed by remote caller.
21701 *
21702 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.error">error()</link> D-Bus method.
21703 *
21704 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call flash_complete_error() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
21705 *
21706 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
21707 */
21708 g_signal_new ("handle-error",
21709 G_TYPE_FROM_INTERFACE (iface),
21710 G_SIGNAL_RUN_LAST,
21711 G_STRUCT_OFFSET (FlashIface, handle_error),
21712 g_signal_accumulator_true_handled,
21713 NULL,
21714 g_cclosure_marshal_generic,
21715 G_TYPE_BOOLEAN,
21716 2,
21717 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING);
21718
21719 /**
21720 * Flash::handle-done:
21721 * @object: A #Flash.
21722 * @invocation: A #GDBusMethodInvocation.
21723 *
21724 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.done">done()</link> D-Bus method.
21725 *
21726 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call flash_complete_done() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
21727 *
21728 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
21729 */
21730 g_signal_new ("handle-done",
21731 G_TYPE_FROM_INTERFACE (iface),
21732 G_SIGNAL_RUN_LAST,
21733 G_STRUCT_OFFSET (FlashIface, handle_done),
21734 g_signal_accumulator_true_handled,
21735 NULL,
21736 g_cclosure_marshal_generic,
21737 G_TYPE_BOOLEAN,
21738 1,
21739 G_TYPE_DBUS_METHOD_INVOCATION);
21740
21741 /**
Norman Jamesf066e872015-10-07 15:29:51 -050021742 * Flash::handle-update-via-tftp:
21743 * @object: A #Flash.
21744 * @invocation: A #GDBusMethodInvocation.
21745 * @arg_url: Argument passed by remote caller.
21746 * @arg_filename: Argument passed by remote caller.
21747 *
21748 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.updateViaTftp">updateViaTftp()</link> D-Bus method.
21749 *
21750 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call flash_complete_update_via_tftp() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
21751 *
21752 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
21753 */
21754 g_signal_new ("handle-update-via-tftp",
21755 G_TYPE_FROM_INTERFACE (iface),
21756 G_SIGNAL_RUN_LAST,
21757 G_STRUCT_OFFSET (FlashIface, handle_update_via_tftp),
21758 g_signal_accumulator_true_handled,
21759 NULL,
21760 g_cclosure_marshal_generic,
21761 G_TYPE_BOOLEAN,
21762 3,
21763 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_STRING);
21764
21765 /**
Norman James362a80f2015-09-14 14:04:39 -050021766 * Flash::handle-init:
21767 * @object: A #Flash.
21768 * @invocation: A #GDBusMethodInvocation.
21769 *
21770 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.init">init()</link> D-Bus method.
21771 *
21772 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call flash_complete_init() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
21773 *
21774 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
21775 */
21776 g_signal_new ("handle-init",
21777 G_TYPE_FROM_INTERFACE (iface),
21778 G_SIGNAL_RUN_LAST,
21779 G_STRUCT_OFFSET (FlashIface, handle_init),
21780 g_signal_accumulator_true_handled,
21781 NULL,
21782 g_cclosure_marshal_generic,
21783 G_TYPE_BOOLEAN,
21784 1,
21785 G_TYPE_DBUS_METHOD_INVOCATION);
21786
21787 /* GObject signals for received D-Bus signals: */
21788 /**
21789 * Flash::updated:
21790 * @object: A #Flash.
21791 *
21792 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Flash.Updated">"Updated"</link> is received.
21793 *
21794 * 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.
21795 */
21796 g_signal_new ("updated",
21797 G_TYPE_FROM_INTERFACE (iface),
21798 G_SIGNAL_RUN_LAST,
21799 G_STRUCT_OFFSET (FlashIface, updated),
21800 NULL,
21801 NULL,
21802 g_cclosure_marshal_generic,
21803 G_TYPE_NONE,
21804 0);
21805
Norman Jamesf066e872015-10-07 15:29:51 -050021806 /**
21807 * Flash::download:
21808 * @object: A #Flash.
21809 * @arg_url: Argument.
21810 * @arg_filename: Argument.
21811 *
21812 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Flash.Download">"Download"</link> is received.
21813 *
21814 * 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.
21815 */
21816 g_signal_new ("download",
21817 G_TYPE_FROM_INTERFACE (iface),
21818 G_SIGNAL_RUN_LAST,
21819 G_STRUCT_OFFSET (FlashIface, download),
21820 NULL,
21821 NULL,
21822 g_cclosure_marshal_generic,
21823 G_TYPE_NONE,
21824 2, G_TYPE_STRING, G_TYPE_STRING);
21825
Norman James18998182015-10-11 21:54:53 -050021826 /* GObject properties for D-Bus properties: */
21827 /**
21828 * Flash:filename:
21829 *
21830 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Flash.filename">"filename"</link>.
21831 *
21832 * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.
21833 */
21834 g_object_interface_install_property (iface,
21835 g_param_spec_string ("filename", "filename", "filename", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
21836 /**
21837 * Flash:flasher-path:
21838 *
21839 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Flash.flasher_path">"flasher_path"</link>.
21840 *
21841 * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.
21842 */
21843 g_object_interface_install_property (iface,
21844 g_param_spec_string ("flasher-path", "flasher_path", "flasher_path", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
21845 /**
21846 * Flash:flasher-name:
21847 *
21848 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Flash.flasher_name">"flasher_name"</link>.
21849 *
21850 * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.
21851 */
21852 g_object_interface_install_property (iface,
21853 g_param_spec_string ("flasher-name", "flasher_name", "flasher_name", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
21854 /**
21855 * Flash:flasher-instance:
21856 *
21857 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Flash.flasher_instance">"flasher_instance"</link>.
21858 *
21859 * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.
21860 */
21861 g_object_interface_install_property (iface,
21862 g_param_spec_string ("flasher-instance", "flasher_instance", "flasher_instance", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Norman James166acf42015-10-22 07:11:51 -050021863 /**
21864 * Flash:status:
21865 *
21866 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Flash.status">"status"</link>.
21867 *
21868 * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.
21869 */
21870 g_object_interface_install_property (iface,
21871 g_param_spec_string ("status", "status", "status", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Norman James18998182015-10-11 21:54:53 -050021872}
21873
21874/**
21875 * flash_get_filename: (skip)
21876 * @object: A #Flash.
21877 *
21878 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Flash.filename">"filename"</link> D-Bus property.
21879 *
21880 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
21881 *
21882 * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use flash_dup_filename() if on another thread.</warning>
21883 *
21884 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
21885 */
21886const gchar *
21887flash_get_filename (Flash *object)
21888{
21889 return FLASH_GET_IFACE (object)->get_filename (object);
21890}
21891
21892/**
21893 * flash_dup_filename: (skip)
21894 * @object: A #Flash.
21895 *
21896 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Flash.filename">"filename"</link> D-Bus property.
21897 *
21898 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
21899 *
21900 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
21901 */
21902gchar *
21903flash_dup_filename (Flash *object)
21904{
21905 gchar *value;
21906 g_object_get (G_OBJECT (object), "filename", &value, NULL);
21907 return value;
21908}
21909
21910/**
21911 * flash_set_filename: (skip)
21912 * @object: A #Flash.
21913 * @value: The value to set.
21914 *
21915 * Sets the <link linkend="gdbus-property-org-openbmc-Flash.filename">"filename"</link> D-Bus property to @value.
21916 *
21917 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
21918 */
21919void
21920flash_set_filename (Flash *object, const gchar *value)
21921{
21922 g_object_set (G_OBJECT (object), "filename", value, NULL);
21923}
21924
21925/**
21926 * flash_get_flasher_path: (skip)
21927 * @object: A #Flash.
21928 *
21929 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_path">"flasher_path"</link> D-Bus property.
21930 *
21931 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
21932 *
21933 * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use flash_dup_flasher_path() if on another thread.</warning>
21934 *
21935 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
21936 */
21937const gchar *
21938flash_get_flasher_path (Flash *object)
21939{
21940 return FLASH_GET_IFACE (object)->get_flasher_path (object);
21941}
21942
21943/**
21944 * flash_dup_flasher_path: (skip)
21945 * @object: A #Flash.
21946 *
21947 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_path">"flasher_path"</link> D-Bus property.
21948 *
21949 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
21950 *
21951 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
21952 */
21953gchar *
21954flash_dup_flasher_path (Flash *object)
21955{
21956 gchar *value;
21957 g_object_get (G_OBJECT (object), "flasher-path", &value, NULL);
21958 return value;
21959}
21960
21961/**
21962 * flash_set_flasher_path: (skip)
21963 * @object: A #Flash.
21964 * @value: The value to set.
21965 *
21966 * Sets the <link linkend="gdbus-property-org-openbmc-Flash.flasher_path">"flasher_path"</link> D-Bus property to @value.
21967 *
21968 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
21969 */
21970void
21971flash_set_flasher_path (Flash *object, const gchar *value)
21972{
21973 g_object_set (G_OBJECT (object), "flasher-path", value, NULL);
21974}
21975
21976/**
21977 * flash_get_flasher_name: (skip)
21978 * @object: A #Flash.
21979 *
21980 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_name">"flasher_name"</link> D-Bus property.
21981 *
21982 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
21983 *
21984 * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use flash_dup_flasher_name() if on another thread.</warning>
21985 *
21986 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
21987 */
21988const gchar *
21989flash_get_flasher_name (Flash *object)
21990{
21991 return FLASH_GET_IFACE (object)->get_flasher_name (object);
21992}
21993
21994/**
21995 * flash_dup_flasher_name: (skip)
21996 * @object: A #Flash.
21997 *
21998 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_name">"flasher_name"</link> D-Bus property.
21999 *
22000 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
22001 *
22002 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
22003 */
22004gchar *
22005flash_dup_flasher_name (Flash *object)
22006{
22007 gchar *value;
22008 g_object_get (G_OBJECT (object), "flasher-name", &value, NULL);
22009 return value;
22010}
22011
22012/**
22013 * flash_set_flasher_name: (skip)
22014 * @object: A #Flash.
22015 * @value: The value to set.
22016 *
22017 * Sets the <link linkend="gdbus-property-org-openbmc-Flash.flasher_name">"flasher_name"</link> D-Bus property to @value.
22018 *
22019 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
22020 */
22021void
22022flash_set_flasher_name (Flash *object, const gchar *value)
22023{
22024 g_object_set (G_OBJECT (object), "flasher-name", value, NULL);
22025}
22026
22027/**
22028 * flash_get_flasher_instance: (skip)
22029 * @object: A #Flash.
22030 *
22031 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_instance">"flasher_instance"</link> D-Bus property.
22032 *
22033 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
22034 *
22035 * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use flash_dup_flasher_instance() if on another thread.</warning>
22036 *
22037 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
22038 */
22039const gchar *
22040flash_get_flasher_instance (Flash *object)
22041{
22042 return FLASH_GET_IFACE (object)->get_flasher_instance (object);
22043}
22044
22045/**
22046 * flash_dup_flasher_instance: (skip)
22047 * @object: A #Flash.
22048 *
22049 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_instance">"flasher_instance"</link> D-Bus property.
22050 *
22051 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
22052 *
22053 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
22054 */
22055gchar *
22056flash_dup_flasher_instance (Flash *object)
22057{
22058 gchar *value;
22059 g_object_get (G_OBJECT (object), "flasher-instance", &value, NULL);
22060 return value;
22061}
22062
22063/**
22064 * flash_set_flasher_instance: (skip)
22065 * @object: A #Flash.
22066 * @value: The value to set.
22067 *
22068 * Sets the <link linkend="gdbus-property-org-openbmc-Flash.flasher_instance">"flasher_instance"</link> D-Bus property to @value.
22069 *
22070 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
22071 */
22072void
22073flash_set_flasher_instance (Flash *object, const gchar *value)
22074{
22075 g_object_set (G_OBJECT (object), "flasher-instance", value, NULL);
Norman James362a80f2015-09-14 14:04:39 -050022076}
22077
22078/**
Norman James166acf42015-10-22 07:11:51 -050022079 * flash_get_status: (skip)
22080 * @object: A #Flash.
22081 *
22082 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Flash.status">"status"</link> D-Bus property.
22083 *
22084 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
22085 *
22086 * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use flash_dup_status() if on another thread.</warning>
22087 *
22088 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
22089 */
22090const gchar *
22091flash_get_status (Flash *object)
22092{
22093 return FLASH_GET_IFACE (object)->get_status (object);
22094}
22095
22096/**
22097 * flash_dup_status: (skip)
22098 * @object: A #Flash.
22099 *
22100 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Flash.status">"status"</link> D-Bus property.
22101 *
22102 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
22103 *
22104 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
22105 */
22106gchar *
22107flash_dup_status (Flash *object)
22108{
22109 gchar *value;
22110 g_object_get (G_OBJECT (object), "status", &value, NULL);
22111 return value;
22112}
22113
22114/**
22115 * flash_set_status: (skip)
22116 * @object: A #Flash.
22117 * @value: The value to set.
22118 *
22119 * Sets the <link linkend="gdbus-property-org-openbmc-Flash.status">"status"</link> D-Bus property to @value.
22120 *
22121 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
22122 */
22123void
22124flash_set_status (Flash *object, const gchar *value)
22125{
22126 g_object_set (G_OBJECT (object), "status", value, NULL);
22127}
22128
22129/**
Norman James362a80f2015-09-14 14:04:39 -050022130 * flash_emit_updated:
22131 * @object: A #Flash.
22132 *
22133 * Emits the <link linkend="gdbus-signal-org-openbmc-Flash.Updated">"Updated"</link> D-Bus signal.
22134 */
22135void
22136flash_emit_updated (
22137 Flash *object)
22138{
22139 g_signal_emit_by_name (object, "updated");
22140}
22141
22142/**
Norman Jamesf066e872015-10-07 15:29:51 -050022143 * flash_emit_download:
22144 * @object: A #Flash.
22145 * @arg_url: Argument to pass with the signal.
22146 * @arg_filename: Argument to pass with the signal.
22147 *
22148 * Emits the <link linkend="gdbus-signal-org-openbmc-Flash.Download">"Download"</link> D-Bus signal.
22149 */
22150void
22151flash_emit_download (
22152 Flash *object,
22153 const gchar *arg_url,
22154 const gchar *arg_filename)
22155{
22156 g_signal_emit_by_name (object, "download", arg_url, arg_filename);
22157}
22158
22159/**
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022160 * flash_call_update:
Norman James362a80f2015-09-14 14:04:39 -050022161 * @proxy: A #FlashProxy.
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022162 * @arg_filename: Argument to pass with the method invocation.
Norman James362a80f2015-09-14 14:04:39 -050022163 * @cancellable: (allow-none): A #GCancellable or %NULL.
22164 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
22165 * @user_data: User data to pass to @callback.
22166 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022167 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.update">update()</link> D-Bus method on @proxy.
Norman James362a80f2015-09-14 14:04:39 -050022168 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022169 * You can then call flash_call_update_finish() to get the result of the operation.
Norman James362a80f2015-09-14 14:04:39 -050022170 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022171 * See flash_call_update_sync() for the synchronous, blocking version of this method.
Norman James362a80f2015-09-14 14:04:39 -050022172 */
22173void
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022174flash_call_update (
Norman James362a80f2015-09-14 14:04:39 -050022175 Flash *proxy,
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022176 const gchar *arg_filename,
Norman James362a80f2015-09-14 14:04:39 -050022177 GCancellable *cancellable,
22178 GAsyncReadyCallback callback,
22179 gpointer user_data)
22180{
22181 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022182 "update",
Norman James362a80f2015-09-14 14:04:39 -050022183 g_variant_new ("(s)",
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022184 arg_filename),
Norman James362a80f2015-09-14 14:04:39 -050022185 G_DBUS_CALL_FLAGS_NONE,
22186 -1,
22187 cancellable,
22188 callback,
22189 user_data);
22190}
22191
22192/**
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022193 * flash_call_update_finish:
Norman James362a80f2015-09-14 14:04:39 -050022194 * @proxy: A #FlashProxy.
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022195 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_update().
Norman James362a80f2015-09-14 14:04:39 -050022196 * @error: Return location for error or %NULL.
22197 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022198 * Finishes an operation started with flash_call_update().
Norman James362a80f2015-09-14 14:04:39 -050022199 *
22200 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
22201 */
22202gboolean
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022203flash_call_update_finish (
Norman James362a80f2015-09-14 14:04:39 -050022204 Flash *proxy,
22205 GAsyncResult *res,
22206 GError **error)
22207{
22208 GVariant *_ret;
22209 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
22210 if (_ret == NULL)
22211 goto _out;
22212 g_variant_get (_ret,
22213 "()");
22214 g_variant_unref (_ret);
22215_out:
22216 return _ret != NULL;
22217}
22218
22219/**
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022220 * flash_call_update_sync:
Norman James362a80f2015-09-14 14:04:39 -050022221 * @proxy: A #FlashProxy.
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022222 * @arg_filename: Argument to pass with the method invocation.
Norman James362a80f2015-09-14 14:04:39 -050022223 * @cancellable: (allow-none): A #GCancellable or %NULL.
22224 * @error: Return location for error or %NULL.
22225 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022226 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.update">update()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
Norman James362a80f2015-09-14 14:04:39 -050022227 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022228 * See flash_call_update() for the asynchronous version of this method.
Norman James362a80f2015-09-14 14:04:39 -050022229 *
22230 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
22231 */
22232gboolean
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022233flash_call_update_sync (
Norman James362a80f2015-09-14 14:04:39 -050022234 Flash *proxy,
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022235 const gchar *arg_filename,
Norman James362a80f2015-09-14 14:04:39 -050022236 GCancellable *cancellable,
22237 GError **error)
22238{
22239 GVariant *_ret;
22240 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022241 "update",
Norman James362a80f2015-09-14 14:04:39 -050022242 g_variant_new ("(s)",
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022243 arg_filename),
Norman James362a80f2015-09-14 14:04:39 -050022244 G_DBUS_CALL_FLAGS_NONE,
22245 -1,
22246 cancellable,
22247 error);
22248 if (_ret == NULL)
22249 goto _out;
22250 g_variant_get (_ret,
22251 "()");
22252 g_variant_unref (_ret);
22253_out:
22254 return _ret != NULL;
22255}
22256
22257/**
Norman James166acf42015-10-22 07:11:51 -050022258 * flash_call_error:
22259 * @proxy: A #FlashProxy.
22260 * @arg_message: Argument to pass with the method invocation.
22261 * @cancellable: (allow-none): A #GCancellable or %NULL.
22262 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
22263 * @user_data: User data to pass to @callback.
22264 *
22265 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.error">error()</link> D-Bus method on @proxy.
22266 * 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.
22267 * You can then call flash_call_error_finish() to get the result of the operation.
22268 *
22269 * See flash_call_error_sync() for the synchronous, blocking version of this method.
22270 */
22271void
22272flash_call_error (
22273 Flash *proxy,
22274 const gchar *arg_message,
22275 GCancellable *cancellable,
22276 GAsyncReadyCallback callback,
22277 gpointer user_data)
22278{
22279 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
22280 "error",
22281 g_variant_new ("(s)",
22282 arg_message),
22283 G_DBUS_CALL_FLAGS_NONE,
22284 -1,
22285 cancellable,
22286 callback,
22287 user_data);
22288}
22289
22290/**
22291 * flash_call_error_finish:
22292 * @proxy: A #FlashProxy.
22293 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_error().
22294 * @error: Return location for error or %NULL.
22295 *
22296 * Finishes an operation started with flash_call_error().
22297 *
22298 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
22299 */
22300gboolean
22301flash_call_error_finish (
22302 Flash *proxy,
22303 GAsyncResult *res,
22304 GError **error)
22305{
22306 GVariant *_ret;
22307 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
22308 if (_ret == NULL)
22309 goto _out;
22310 g_variant_get (_ret,
22311 "()");
22312 g_variant_unref (_ret);
22313_out:
22314 return _ret != NULL;
22315}
22316
22317/**
22318 * flash_call_error_sync:
22319 * @proxy: A #FlashProxy.
22320 * @arg_message: Argument to pass with the method invocation.
22321 * @cancellable: (allow-none): A #GCancellable or %NULL.
22322 * @error: Return location for error or %NULL.
22323 *
22324 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.error">error()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
22325 *
22326 * See flash_call_error() for the asynchronous version of this method.
22327 *
22328 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
22329 */
22330gboolean
22331flash_call_error_sync (
22332 Flash *proxy,
22333 const gchar *arg_message,
22334 GCancellable *cancellable,
22335 GError **error)
22336{
22337 GVariant *_ret;
22338 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
22339 "error",
22340 g_variant_new ("(s)",
22341 arg_message),
22342 G_DBUS_CALL_FLAGS_NONE,
22343 -1,
22344 cancellable,
22345 error);
22346 if (_ret == NULL)
22347 goto _out;
22348 g_variant_get (_ret,
22349 "()");
22350 g_variant_unref (_ret);
22351_out:
22352 return _ret != NULL;
22353}
22354
22355/**
22356 * flash_call_done:
22357 * @proxy: A #FlashProxy.
22358 * @cancellable: (allow-none): A #GCancellable or %NULL.
22359 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
22360 * @user_data: User data to pass to @callback.
22361 *
22362 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.done">done()</link> D-Bus method on @proxy.
22363 * 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.
22364 * You can then call flash_call_done_finish() to get the result of the operation.
22365 *
22366 * See flash_call_done_sync() for the synchronous, blocking version of this method.
22367 */
22368void
22369flash_call_done (
22370 Flash *proxy,
22371 GCancellable *cancellable,
22372 GAsyncReadyCallback callback,
22373 gpointer user_data)
22374{
22375 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
22376 "done",
22377 g_variant_new ("()"),
22378 G_DBUS_CALL_FLAGS_NONE,
22379 -1,
22380 cancellable,
22381 callback,
22382 user_data);
22383}
22384
22385/**
22386 * flash_call_done_finish:
22387 * @proxy: A #FlashProxy.
22388 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_done().
22389 * @error: Return location for error or %NULL.
22390 *
22391 * Finishes an operation started with flash_call_done().
22392 *
22393 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
22394 */
22395gboolean
22396flash_call_done_finish (
22397 Flash *proxy,
22398 GAsyncResult *res,
22399 GError **error)
22400{
22401 GVariant *_ret;
22402 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
22403 if (_ret == NULL)
22404 goto _out;
22405 g_variant_get (_ret,
22406 "()");
22407 g_variant_unref (_ret);
22408_out:
22409 return _ret != NULL;
22410}
22411
22412/**
22413 * flash_call_done_sync:
22414 * @proxy: A #FlashProxy.
22415 * @cancellable: (allow-none): A #GCancellable or %NULL.
22416 * @error: Return location for error or %NULL.
22417 *
22418 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.done">done()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
22419 *
22420 * See flash_call_done() for the asynchronous version of this method.
22421 *
22422 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
22423 */
22424gboolean
22425flash_call_done_sync (
22426 Flash *proxy,
22427 GCancellable *cancellable,
22428 GError **error)
22429{
22430 GVariant *_ret;
22431 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
22432 "done",
22433 g_variant_new ("()"),
22434 G_DBUS_CALL_FLAGS_NONE,
22435 -1,
22436 cancellable,
22437 error);
22438 if (_ret == NULL)
22439 goto _out;
22440 g_variant_get (_ret,
22441 "()");
22442 g_variant_unref (_ret);
22443_out:
22444 return _ret != NULL;
22445}
22446
22447/**
Norman Jamesf066e872015-10-07 15:29:51 -050022448 * flash_call_update_via_tftp:
22449 * @proxy: A #FlashProxy.
22450 * @arg_url: Argument to pass with the method invocation.
22451 * @arg_filename: Argument to pass with the method invocation.
22452 * @cancellable: (allow-none): A #GCancellable or %NULL.
22453 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
22454 * @user_data: User data to pass to @callback.
22455 *
22456 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.updateViaTftp">updateViaTftp()</link> D-Bus method on @proxy.
22457 * 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.
22458 * You can then call flash_call_update_via_tftp_finish() to get the result of the operation.
22459 *
22460 * See flash_call_update_via_tftp_sync() for the synchronous, blocking version of this method.
22461 */
22462void
22463flash_call_update_via_tftp (
22464 Flash *proxy,
22465 const gchar *arg_url,
22466 const gchar *arg_filename,
22467 GCancellable *cancellable,
22468 GAsyncReadyCallback callback,
22469 gpointer user_data)
22470{
22471 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
22472 "updateViaTftp",
22473 g_variant_new ("(ss)",
22474 arg_url,
22475 arg_filename),
22476 G_DBUS_CALL_FLAGS_NONE,
22477 -1,
22478 cancellable,
22479 callback,
22480 user_data);
22481}
22482
22483/**
22484 * flash_call_update_via_tftp_finish:
22485 * @proxy: A #FlashProxy.
22486 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_update_via_tftp().
22487 * @error: Return location for error or %NULL.
22488 *
22489 * Finishes an operation started with flash_call_update_via_tftp().
22490 *
22491 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
22492 */
22493gboolean
22494flash_call_update_via_tftp_finish (
22495 Flash *proxy,
22496 GAsyncResult *res,
22497 GError **error)
22498{
22499 GVariant *_ret;
22500 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
22501 if (_ret == NULL)
22502 goto _out;
22503 g_variant_get (_ret,
22504 "()");
22505 g_variant_unref (_ret);
22506_out:
22507 return _ret != NULL;
22508}
22509
22510/**
22511 * flash_call_update_via_tftp_sync:
22512 * @proxy: A #FlashProxy.
22513 * @arg_url: Argument to pass with the method invocation.
22514 * @arg_filename: Argument to pass with the method invocation.
22515 * @cancellable: (allow-none): A #GCancellable or %NULL.
22516 * @error: Return location for error or %NULL.
22517 *
22518 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.updateViaTftp">updateViaTftp()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
22519 *
22520 * See flash_call_update_via_tftp() for the asynchronous version of this method.
22521 *
22522 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
22523 */
22524gboolean
22525flash_call_update_via_tftp_sync (
22526 Flash *proxy,
22527 const gchar *arg_url,
22528 const gchar *arg_filename,
22529 GCancellable *cancellable,
22530 GError **error)
22531{
22532 GVariant *_ret;
22533 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
22534 "updateViaTftp",
22535 g_variant_new ("(ss)",
22536 arg_url,
22537 arg_filename),
22538 G_DBUS_CALL_FLAGS_NONE,
22539 -1,
22540 cancellable,
22541 error);
22542 if (_ret == NULL)
22543 goto _out;
22544 g_variant_get (_ret,
22545 "()");
22546 g_variant_unref (_ret);
22547_out:
22548 return _ret != NULL;
22549}
22550
22551/**
Norman James362a80f2015-09-14 14:04:39 -050022552 * flash_call_init:
22553 * @proxy: A #FlashProxy.
22554 * @cancellable: (allow-none): A #GCancellable or %NULL.
22555 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
22556 * @user_data: User data to pass to @callback.
22557 *
22558 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.init">init()</link> D-Bus method on @proxy.
22559 * 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.
22560 * You can then call flash_call_init_finish() to get the result of the operation.
22561 *
22562 * See flash_call_init_sync() for the synchronous, blocking version of this method.
22563 */
22564void
22565flash_call_init (
22566 Flash *proxy,
22567 GCancellable *cancellable,
22568 GAsyncReadyCallback callback,
22569 gpointer user_data)
22570{
22571 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
22572 "init",
22573 g_variant_new ("()"),
22574 G_DBUS_CALL_FLAGS_NONE,
22575 -1,
22576 cancellable,
22577 callback,
22578 user_data);
22579}
22580
22581/**
22582 * flash_call_init_finish:
22583 * @proxy: A #FlashProxy.
22584 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_init().
22585 * @error: Return location for error or %NULL.
22586 *
22587 * Finishes an operation started with flash_call_init().
22588 *
22589 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
22590 */
22591gboolean
22592flash_call_init_finish (
22593 Flash *proxy,
22594 GAsyncResult *res,
22595 GError **error)
22596{
22597 GVariant *_ret;
22598 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
22599 if (_ret == NULL)
22600 goto _out;
22601 g_variant_get (_ret,
22602 "()");
22603 g_variant_unref (_ret);
22604_out:
22605 return _ret != NULL;
22606}
22607
22608/**
22609 * flash_call_init_sync:
22610 * @proxy: A #FlashProxy.
22611 * @cancellable: (allow-none): A #GCancellable or %NULL.
22612 * @error: Return location for error or %NULL.
22613 *
22614 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.init">init()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
22615 *
22616 * See flash_call_init() for the asynchronous version of this method.
22617 *
22618 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
22619 */
22620gboolean
22621flash_call_init_sync (
22622 Flash *proxy,
22623 GCancellable *cancellable,
22624 GError **error)
22625{
22626 GVariant *_ret;
22627 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
22628 "init",
22629 g_variant_new ("()"),
22630 G_DBUS_CALL_FLAGS_NONE,
22631 -1,
22632 cancellable,
22633 error);
22634 if (_ret == NULL)
22635 goto _out;
22636 g_variant_get (_ret,
22637 "()");
22638 g_variant_unref (_ret);
22639_out:
22640 return _ret != NULL;
22641}
22642
22643/**
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022644 * flash_complete_update:
Norman James362a80f2015-09-14 14:04:39 -050022645 * @object: A #Flash.
22646 * @invocation: (transfer full): A #GDBusMethodInvocation.
22647 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022648 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Flash.update">update()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
Norman James362a80f2015-09-14 14:04:39 -050022649 *
22650 * This method will free @invocation, you cannot use it afterwards.
22651 */
22652void
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022653flash_complete_update (
Norman James362a80f2015-09-14 14:04:39 -050022654 Flash *object,
22655 GDBusMethodInvocation *invocation)
22656{
22657 g_dbus_method_invocation_return_value (invocation,
22658 g_variant_new ("()"));
22659}
22660
22661/**
Norman James166acf42015-10-22 07:11:51 -050022662 * flash_complete_error:
22663 * @object: A #Flash.
22664 * @invocation: (transfer full): A #GDBusMethodInvocation.
22665 *
22666 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Flash.error">error()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
22667 *
22668 * This method will free @invocation, you cannot use it afterwards.
22669 */
22670void
22671flash_complete_error (
22672 Flash *object,
22673 GDBusMethodInvocation *invocation)
22674{
22675 g_dbus_method_invocation_return_value (invocation,
22676 g_variant_new ("()"));
22677}
22678
22679/**
22680 * flash_complete_done:
22681 * @object: A #Flash.
22682 * @invocation: (transfer full): A #GDBusMethodInvocation.
22683 *
22684 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Flash.done">done()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
22685 *
22686 * This method will free @invocation, you cannot use it afterwards.
22687 */
22688void
22689flash_complete_done (
22690 Flash *object,
22691 GDBusMethodInvocation *invocation)
22692{
22693 g_dbus_method_invocation_return_value (invocation,
22694 g_variant_new ("()"));
22695}
22696
22697/**
Norman Jamesf066e872015-10-07 15:29:51 -050022698 * flash_complete_update_via_tftp:
22699 * @object: A #Flash.
22700 * @invocation: (transfer full): A #GDBusMethodInvocation.
22701 *
22702 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Flash.updateViaTftp">updateViaTftp()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
22703 *
22704 * This method will free @invocation, you cannot use it afterwards.
22705 */
22706void
22707flash_complete_update_via_tftp (
22708 Flash *object,
22709 GDBusMethodInvocation *invocation)
22710{
22711 g_dbus_method_invocation_return_value (invocation,
22712 g_variant_new ("()"));
22713}
22714
22715/**
Norman James362a80f2015-09-14 14:04:39 -050022716 * flash_complete_init:
22717 * @object: A #Flash.
22718 * @invocation: (transfer full): A #GDBusMethodInvocation.
22719 *
22720 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Flash.init">init()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
22721 *
22722 * This method will free @invocation, you cannot use it afterwards.
22723 */
22724void
22725flash_complete_init (
22726 Flash *object,
22727 GDBusMethodInvocation *invocation)
22728{
22729 g_dbus_method_invocation_return_value (invocation,
22730 g_variant_new ("()"));
22731}
22732
22733/* ------------------------------------------------------------------------ */
22734
22735/**
22736 * FlashProxy:
22737 *
22738 * The #FlashProxy structure contains only private data and should only be accessed using the provided API.
22739 */
22740
22741/**
22742 * FlashProxyClass:
22743 * @parent_class: The parent class.
22744 *
22745 * Class structure for #FlashProxy.
22746 */
22747
22748struct _FlashProxyPrivate
22749{
22750 GData *qdata;
22751};
22752
22753static void flash_proxy_iface_init (FlashIface *iface);
22754
22755#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
22756G_DEFINE_TYPE_WITH_CODE (FlashProxy, flash_proxy, G_TYPE_DBUS_PROXY,
22757 G_ADD_PRIVATE (FlashProxy)
22758 G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_proxy_iface_init));
22759
22760#else
22761G_DEFINE_TYPE_WITH_CODE (FlashProxy, flash_proxy, G_TYPE_DBUS_PROXY,
22762 G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_proxy_iface_init));
22763
22764#endif
22765static void
22766flash_proxy_finalize (GObject *object)
22767{
22768 FlashProxy *proxy = FLASH_PROXY (object);
22769 g_datalist_clear (&proxy->priv->qdata);
22770 G_OBJECT_CLASS (flash_proxy_parent_class)->finalize (object);
22771}
22772
22773static void
22774flash_proxy_get_property (GObject *object,
22775 guint prop_id,
22776 GValue *value,
22777 GParamSpec *pspec G_GNUC_UNUSED)
22778{
Norman James18998182015-10-11 21:54:53 -050022779 const _ExtendedGDBusPropertyInfo *info;
22780 GVariant *variant;
Norman James166acf42015-10-22 07:11:51 -050022781 g_assert (prop_id != 0 && prop_id - 1 < 5);
Norman James18998182015-10-11 21:54:53 -050022782 info = _flash_property_info_pointers[prop_id - 1];
22783 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
22784 if (info->use_gvariant)
22785 {
22786 g_value_set_variant (value, variant);
22787 }
22788 else
22789 {
22790 if (variant != NULL)
22791 g_dbus_gvariant_to_gvalue (variant, value);
22792 }
22793 if (variant != NULL)
22794 g_variant_unref (variant);
22795}
22796
22797static void
22798flash_proxy_set_property_cb (GDBusProxy *proxy,
22799 GAsyncResult *res,
22800 gpointer user_data)
22801{
22802 const _ExtendedGDBusPropertyInfo *info = user_data;
22803 GError *error;
22804 GVariant *_ret;
22805 error = NULL;
22806 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
22807 if (!_ret)
22808 {
22809 g_warning ("Error setting property '%s' on interface org.openbmc.Flash: %s (%s, %d)",
22810 info->parent_struct.name,
22811 error->message, g_quark_to_string (error->domain), error->code);
22812 g_error_free (error);
22813 }
22814 else
22815 {
22816 g_variant_unref (_ret);
22817 }
Norman James362a80f2015-09-14 14:04:39 -050022818}
22819
22820static void
22821flash_proxy_set_property (GObject *object,
22822 guint prop_id,
22823 const GValue *value,
22824 GParamSpec *pspec G_GNUC_UNUSED)
22825{
Norman James18998182015-10-11 21:54:53 -050022826 const _ExtendedGDBusPropertyInfo *info;
22827 GVariant *variant;
Norman James166acf42015-10-22 07:11:51 -050022828 g_assert (prop_id != 0 && prop_id - 1 < 5);
Norman James18998182015-10-11 21:54:53 -050022829 info = _flash_property_info_pointers[prop_id - 1];
22830 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
22831 g_dbus_proxy_call (G_DBUS_PROXY (object),
22832 "org.freedesktop.DBus.Properties.Set",
22833 g_variant_new ("(ssv)", "org.openbmc.Flash", info->parent_struct.name, variant),
22834 G_DBUS_CALL_FLAGS_NONE,
22835 -1,
22836 NULL, (GAsyncReadyCallback) flash_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
22837 g_variant_unref (variant);
Norman James362a80f2015-09-14 14:04:39 -050022838}
22839
22840static void
22841flash_proxy_g_signal (GDBusProxy *proxy,
22842 const gchar *sender_name G_GNUC_UNUSED,
22843 const gchar *signal_name,
22844 GVariant *parameters)
22845{
22846 _ExtendedGDBusSignalInfo *info;
22847 GVariantIter iter;
22848 GVariant *child;
22849 GValue *paramv;
22850 guint num_params;
22851 guint n;
22852 guint signal_id;
22853 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, signal_name);
22854 if (info == NULL)
22855 return;
22856 num_params = g_variant_n_children (parameters);
22857 paramv = g_new0 (GValue, num_params + 1);
22858 g_value_init (&paramv[0], TYPE_FLASH);
22859 g_value_set_object (&paramv[0], proxy);
22860 g_variant_iter_init (&iter, parameters);
22861 n = 1;
22862 while ((child = g_variant_iter_next_value (&iter)) != NULL)
22863 {
22864 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
22865 if (arg_info->use_gvariant)
22866 {
22867 g_value_init (&paramv[n], G_TYPE_VARIANT);
22868 g_value_set_variant (&paramv[n], child);
22869 n++;
22870 }
22871 else
22872 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
22873 g_variant_unref (child);
22874 }
22875 signal_id = g_signal_lookup (info->signal_name, TYPE_FLASH);
22876 g_signal_emitv (paramv, signal_id, 0, NULL);
22877 for (n = 0; n < num_params + 1; n++)
22878 g_value_unset (&paramv[n]);
22879 g_free (paramv);
22880}
22881
22882static void
22883flash_proxy_g_properties_changed (GDBusProxy *_proxy,
22884 GVariant *changed_properties,
22885 const gchar *const *invalidated_properties)
22886{
22887 FlashProxy *proxy = FLASH_PROXY (_proxy);
22888 guint n;
22889 const gchar *key;
22890 GVariantIter *iter;
22891 _ExtendedGDBusPropertyInfo *info;
22892 g_variant_get (changed_properties, "a{sv}", &iter);
22893 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
22894 {
22895 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, key);
22896 g_datalist_remove_data (&proxy->priv->qdata, key);
22897 if (info != NULL)
22898 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
22899 }
22900 g_variant_iter_free (iter);
22901 for (n = 0; invalidated_properties[n] != NULL; n++)
22902 {
22903 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, invalidated_properties[n]);
22904 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
22905 if (info != NULL)
22906 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
22907 }
22908}
22909
Norman James18998182015-10-11 21:54:53 -050022910static const gchar *
22911flash_proxy_get_filename (Flash *object)
22912{
22913 FlashProxy *proxy = FLASH_PROXY (object);
22914 GVariant *variant;
22915 const gchar *value = NULL;
22916 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "filename");
22917 if (variant != NULL)
22918 {
22919 value = g_variant_get_string (variant, NULL);
22920 g_variant_unref (variant);
22921 }
22922 return value;
22923}
22924
22925static const gchar *
22926flash_proxy_get_flasher_path (Flash *object)
22927{
22928 FlashProxy *proxy = FLASH_PROXY (object);
22929 GVariant *variant;
22930 const gchar *value = NULL;
22931 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "flasher_path");
22932 if (variant != NULL)
22933 {
22934 value = g_variant_get_string (variant, NULL);
22935 g_variant_unref (variant);
22936 }
22937 return value;
22938}
22939
22940static const gchar *
22941flash_proxy_get_flasher_name (Flash *object)
22942{
22943 FlashProxy *proxy = FLASH_PROXY (object);
22944 GVariant *variant;
22945 const gchar *value = NULL;
22946 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "flasher_name");
22947 if (variant != NULL)
22948 {
22949 value = g_variant_get_string (variant, NULL);
22950 g_variant_unref (variant);
22951 }
22952 return value;
22953}
22954
22955static const gchar *
22956flash_proxy_get_flasher_instance (Flash *object)
22957{
22958 FlashProxy *proxy = FLASH_PROXY (object);
22959 GVariant *variant;
22960 const gchar *value = NULL;
22961 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "flasher_instance");
22962 if (variant != NULL)
22963 {
22964 value = g_variant_get_string (variant, NULL);
22965 g_variant_unref (variant);
22966 }
22967 return value;
22968}
22969
Norman James166acf42015-10-22 07:11:51 -050022970static const gchar *
22971flash_proxy_get_status (Flash *object)
22972{
22973 FlashProxy *proxy = FLASH_PROXY (object);
22974 GVariant *variant;
22975 const gchar *value = NULL;
22976 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "status");
22977 if (variant != NULL)
22978 {
22979 value = g_variant_get_string (variant, NULL);
22980 g_variant_unref (variant);
22981 }
22982 return value;
22983}
22984
Norman James362a80f2015-09-14 14:04:39 -050022985static void
22986flash_proxy_init (FlashProxy *proxy)
22987{
22988#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
22989 proxy->priv = flash_proxy_get_instance_private (proxy);
22990#else
22991 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_FLASH_PROXY, FlashProxyPrivate);
22992#endif
22993
22994 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), flash_interface_info ());
22995}
22996
22997static void
22998flash_proxy_class_init (FlashProxyClass *klass)
22999{
23000 GObjectClass *gobject_class;
23001 GDBusProxyClass *proxy_class;
23002
23003 gobject_class = G_OBJECT_CLASS (klass);
23004 gobject_class->finalize = flash_proxy_finalize;
23005 gobject_class->get_property = flash_proxy_get_property;
23006 gobject_class->set_property = flash_proxy_set_property;
23007
23008 proxy_class = G_DBUS_PROXY_CLASS (klass);
23009 proxy_class->g_signal = flash_proxy_g_signal;
23010 proxy_class->g_properties_changed = flash_proxy_g_properties_changed;
23011
Norman James18998182015-10-11 21:54:53 -050023012 flash_override_properties (gobject_class, 1);
23013
Norman James362a80f2015-09-14 14:04:39 -050023014#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
23015 g_type_class_add_private (klass, sizeof (FlashProxyPrivate));
23016#endif
23017}
23018
23019static void
23020flash_proxy_iface_init (FlashIface *iface)
23021{
Norman James18998182015-10-11 21:54:53 -050023022 iface->get_filename = flash_proxy_get_filename;
23023 iface->get_flasher_path = flash_proxy_get_flasher_path;
23024 iface->get_flasher_name = flash_proxy_get_flasher_name;
23025 iface->get_flasher_instance = flash_proxy_get_flasher_instance;
Norman James166acf42015-10-22 07:11:51 -050023026 iface->get_status = flash_proxy_get_status;
Norman James362a80f2015-09-14 14:04:39 -050023027}
23028
23029/**
23030 * flash_proxy_new:
23031 * @connection: A #GDBusConnection.
23032 * @flags: Flags from the #GDBusProxyFlags enumeration.
23033 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
23034 * @object_path: An object path.
23035 * @cancellable: (allow-none): A #GCancellable or %NULL.
23036 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
23037 * @user_data: User data to pass to @callback.
23038 *
23039 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>. See g_dbus_proxy_new() for more details.
23040 *
23041 * 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.
23042 * You can then call flash_proxy_new_finish() to get the result of the operation.
23043 *
23044 * See flash_proxy_new_sync() for the synchronous, blocking version of this constructor.
23045 */
23046void
23047flash_proxy_new (
23048 GDBusConnection *connection,
23049 GDBusProxyFlags flags,
23050 const gchar *name,
23051 const gchar *object_path,
23052 GCancellable *cancellable,
23053 GAsyncReadyCallback callback,
23054 gpointer user_data)
23055{
23056 g_async_initable_new_async (TYPE_FLASH_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.Flash", NULL);
23057}
23058
23059/**
23060 * flash_proxy_new_finish:
23061 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_proxy_new().
23062 * @error: Return location for error or %NULL
23063 *
23064 * Finishes an operation started with flash_proxy_new().
23065 *
23066 * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set.
23067 */
23068Flash *
23069flash_proxy_new_finish (
23070 GAsyncResult *res,
23071 GError **error)
23072{
23073 GObject *ret;
23074 GObject *source_object;
23075 source_object = g_async_result_get_source_object (res);
23076 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
23077 g_object_unref (source_object);
23078 if (ret != NULL)
23079 return FLASH (ret);
23080 else
23081 return NULL;
23082}
23083
23084/**
23085 * flash_proxy_new_sync:
23086 * @connection: A #GDBusConnection.
23087 * @flags: Flags from the #GDBusProxyFlags enumeration.
23088 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
23089 * @object_path: An object path.
23090 * @cancellable: (allow-none): A #GCancellable or %NULL.
23091 * @error: Return location for error or %NULL
23092 *
23093 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>. See g_dbus_proxy_new_sync() for more details.
23094 *
23095 * The calling thread is blocked until a reply is received.
23096 *
23097 * See flash_proxy_new() for the asynchronous version of this constructor.
23098 *
23099 * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set.
23100 */
23101Flash *
23102flash_proxy_new_sync (
23103 GDBusConnection *connection,
23104 GDBusProxyFlags flags,
23105 const gchar *name,
23106 const gchar *object_path,
23107 GCancellable *cancellable,
23108 GError **error)
23109{
23110 GInitable *ret;
23111 ret = g_initable_new (TYPE_FLASH_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.Flash", NULL);
23112 if (ret != NULL)
23113 return FLASH (ret);
23114 else
23115 return NULL;
23116}
23117
23118
23119/**
23120 * flash_proxy_new_for_bus:
23121 * @bus_type: A #GBusType.
23122 * @flags: Flags from the #GDBusProxyFlags enumeration.
23123 * @name: A bus name (well-known or unique).
23124 * @object_path: An object path.
23125 * @cancellable: (allow-none): A #GCancellable or %NULL.
23126 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
23127 * @user_data: User data to pass to @callback.
23128 *
23129 * Like flash_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
23130 *
23131 * 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.
23132 * You can then call flash_proxy_new_for_bus_finish() to get the result of the operation.
23133 *
23134 * See flash_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
23135 */
23136void
23137flash_proxy_new_for_bus (
23138 GBusType bus_type,
23139 GDBusProxyFlags flags,
23140 const gchar *name,
23141 const gchar *object_path,
23142 GCancellable *cancellable,
23143 GAsyncReadyCallback callback,
23144 gpointer user_data)
23145{
23146 g_async_initable_new_async (TYPE_FLASH_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.Flash", NULL);
23147}
23148
23149/**
23150 * flash_proxy_new_for_bus_finish:
23151 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_proxy_new_for_bus().
23152 * @error: Return location for error or %NULL
23153 *
23154 * Finishes an operation started with flash_proxy_new_for_bus().
23155 *
23156 * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set.
23157 */
23158Flash *
23159flash_proxy_new_for_bus_finish (
23160 GAsyncResult *res,
23161 GError **error)
23162{
23163 GObject *ret;
23164 GObject *source_object;
23165 source_object = g_async_result_get_source_object (res);
23166 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
23167 g_object_unref (source_object);
23168 if (ret != NULL)
23169 return FLASH (ret);
23170 else
23171 return NULL;
23172}
23173
23174/**
23175 * flash_proxy_new_for_bus_sync:
23176 * @bus_type: A #GBusType.
23177 * @flags: Flags from the #GDBusProxyFlags enumeration.
23178 * @name: A bus name (well-known or unique).
23179 * @object_path: An object path.
23180 * @cancellable: (allow-none): A #GCancellable or %NULL.
23181 * @error: Return location for error or %NULL
23182 *
23183 * Like flash_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
23184 *
23185 * The calling thread is blocked until a reply is received.
23186 *
23187 * See flash_proxy_new_for_bus() for the asynchronous version of this constructor.
23188 *
23189 * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set.
23190 */
23191Flash *
23192flash_proxy_new_for_bus_sync (
23193 GBusType bus_type,
23194 GDBusProxyFlags flags,
23195 const gchar *name,
23196 const gchar *object_path,
23197 GCancellable *cancellable,
23198 GError **error)
23199{
23200 GInitable *ret;
23201 ret = g_initable_new (TYPE_FLASH_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.Flash", NULL);
23202 if (ret != NULL)
23203 return FLASH (ret);
23204 else
23205 return NULL;
23206}
23207
23208
23209/* ------------------------------------------------------------------------ */
23210
23211/**
23212 * FlashSkeleton:
23213 *
23214 * The #FlashSkeleton structure contains only private data and should only be accessed using the provided API.
23215 */
23216
23217/**
23218 * FlashSkeletonClass:
23219 * @parent_class: The parent class.
23220 *
23221 * Class structure for #FlashSkeleton.
23222 */
23223
23224struct _FlashSkeletonPrivate
23225{
23226 GValue *properties;
23227 GList *changed_properties;
23228 GSource *changed_properties_idle_source;
23229 GMainContext *context;
23230 GMutex lock;
23231};
23232
23233static void
23234_flash_skeleton_handle_method_call (
23235 GDBusConnection *connection G_GNUC_UNUSED,
23236 const gchar *sender G_GNUC_UNUSED,
23237 const gchar *object_path G_GNUC_UNUSED,
23238 const gchar *interface_name,
23239 const gchar *method_name,
23240 GVariant *parameters,
23241 GDBusMethodInvocation *invocation,
23242 gpointer user_data)
23243{
23244 FlashSkeleton *skeleton = FLASH_SKELETON (user_data);
23245 _ExtendedGDBusMethodInfo *info;
23246 GVariantIter iter;
23247 GVariant *child;
23248 GValue *paramv;
23249 guint num_params;
23250 guint num_extra;
23251 guint n;
23252 guint signal_id;
23253 GValue return_value = G_VALUE_INIT;
23254 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
23255 g_assert (info != NULL);
23256 num_params = g_variant_n_children (parameters);
23257 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
23258 n = 0;
23259 g_value_init (&paramv[n], TYPE_FLASH);
23260 g_value_set_object (&paramv[n++], skeleton);
23261 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
23262 g_value_set_object (&paramv[n++], invocation);
23263 if (info->pass_fdlist)
23264 {
23265#ifdef G_OS_UNIX
23266 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
23267 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
23268#else
23269 g_assert_not_reached ();
23270#endif
23271 }
23272 g_variant_iter_init (&iter, parameters);
23273 while ((child = g_variant_iter_next_value (&iter)) != NULL)
23274 {
23275 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
23276 if (arg_info->use_gvariant)
23277 {
23278 g_value_init (&paramv[n], G_TYPE_VARIANT);
23279 g_value_set_variant (&paramv[n], child);
23280 n++;
23281 }
23282 else
23283 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
23284 g_variant_unref (child);
23285 }
23286 signal_id = g_signal_lookup (info->signal_name, TYPE_FLASH);
23287 g_value_init (&return_value, G_TYPE_BOOLEAN);
23288 g_signal_emitv (paramv, signal_id, 0, &return_value);
23289 if (!g_value_get_boolean (&return_value))
23290 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);
23291 g_value_unset (&return_value);
23292 for (n = 0; n < num_params + num_extra; n++)
23293 g_value_unset (&paramv[n]);
23294 g_free (paramv);
23295}
23296
23297static GVariant *
23298_flash_skeleton_handle_get_property (
23299 GDBusConnection *connection G_GNUC_UNUSED,
23300 const gchar *sender G_GNUC_UNUSED,
23301 const gchar *object_path G_GNUC_UNUSED,
23302 const gchar *interface_name G_GNUC_UNUSED,
23303 const gchar *property_name,
23304 GError **error,
23305 gpointer user_data)
23306{
23307 FlashSkeleton *skeleton = FLASH_SKELETON (user_data);
23308 GValue value = G_VALUE_INIT;
23309 GParamSpec *pspec;
23310 _ExtendedGDBusPropertyInfo *info;
23311 GVariant *ret;
23312 ret = NULL;
23313 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, property_name);
23314 g_assert (info != NULL);
23315 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
23316 if (pspec == NULL)
23317 {
23318 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
23319 }
23320 else
23321 {
23322 g_value_init (&value, pspec->value_type);
23323 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
23324 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
23325 g_value_unset (&value);
23326 }
23327 return ret;
23328}
23329
23330static gboolean
23331_flash_skeleton_handle_set_property (
23332 GDBusConnection *connection G_GNUC_UNUSED,
23333 const gchar *sender G_GNUC_UNUSED,
23334 const gchar *object_path G_GNUC_UNUSED,
23335 const gchar *interface_name G_GNUC_UNUSED,
23336 const gchar *property_name,
23337 GVariant *variant,
23338 GError **error,
23339 gpointer user_data)
23340{
23341 FlashSkeleton *skeleton = FLASH_SKELETON (user_data);
23342 GValue value = G_VALUE_INIT;
23343 GParamSpec *pspec;
23344 _ExtendedGDBusPropertyInfo *info;
23345 gboolean ret;
23346 ret = FALSE;
23347 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, property_name);
23348 g_assert (info != NULL);
23349 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
23350 if (pspec == NULL)
23351 {
23352 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
23353 }
23354 else
23355 {
23356 if (info->use_gvariant)
23357 g_value_set_variant (&value, variant);
23358 else
23359 g_dbus_gvariant_to_gvalue (variant, &value);
23360 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
23361 g_value_unset (&value);
23362 ret = TRUE;
23363 }
23364 return ret;
23365}
23366
23367static const GDBusInterfaceVTable _flash_skeleton_vtable =
23368{
23369 _flash_skeleton_handle_method_call,
23370 _flash_skeleton_handle_get_property,
23371 _flash_skeleton_handle_set_property,
23372 {NULL}
23373};
23374
23375static GDBusInterfaceInfo *
23376flash_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
23377{
23378 return flash_interface_info ();
23379}
23380
23381static GDBusInterfaceVTable *
23382flash_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
23383{
23384 return (GDBusInterfaceVTable *) &_flash_skeleton_vtable;
23385}
23386
23387static GVariant *
23388flash_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
23389{
23390 FlashSkeleton *skeleton = FLASH_SKELETON (_skeleton);
23391
23392 GVariantBuilder builder;
23393 guint n;
23394 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
23395 if (_flash_interface_info.parent_struct.properties == NULL)
23396 goto out;
23397 for (n = 0; _flash_interface_info.parent_struct.properties[n] != NULL; n++)
23398 {
23399 GDBusPropertyInfo *info = _flash_interface_info.parent_struct.properties[n];
23400 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
23401 {
23402 GVariant *value;
23403 value = _flash_skeleton_handle_get_property (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Flash", info->name, NULL, skeleton);
23404 if (value != NULL)
23405 {
23406 g_variant_take_ref (value);
23407 g_variant_builder_add (&builder, "{sv}", info->name, value);
23408 g_variant_unref (value);
23409 }
23410 }
23411 }
23412out:
23413 return g_variant_builder_end (&builder);
23414}
23415
Norman James18998182015-10-11 21:54:53 -050023416static gboolean _flash_emit_changed (gpointer user_data);
23417
Norman James362a80f2015-09-14 14:04:39 -050023418static void
23419flash_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
23420{
Norman James18998182015-10-11 21:54:53 -050023421 FlashSkeleton *skeleton = FLASH_SKELETON (_skeleton);
23422 gboolean emit_changed = FALSE;
23423
23424 g_mutex_lock (&skeleton->priv->lock);
23425 if (skeleton->priv->changed_properties_idle_source != NULL)
23426 {
23427 g_source_destroy (skeleton->priv->changed_properties_idle_source);
23428 skeleton->priv->changed_properties_idle_source = NULL;
23429 emit_changed = TRUE;
23430 }
23431 g_mutex_unlock (&skeleton->priv->lock);
23432
23433 if (emit_changed)
23434 _flash_emit_changed (skeleton);
Norman James362a80f2015-09-14 14:04:39 -050023435}
23436
23437static void
23438_flash_on_signal_updated (
23439 Flash *object)
23440{
23441 FlashSkeleton *skeleton = FLASH_SKELETON (object);
23442
23443 GList *connections, *l;
23444 GVariant *signal_variant;
23445 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
23446
23447 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
23448 for (l = connections; l != NULL; l = l->next)
23449 {
23450 GDBusConnection *connection = l->data;
23451 g_dbus_connection_emit_signal (connection,
23452 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Flash", "Updated",
23453 signal_variant, NULL);
23454 }
23455 g_variant_unref (signal_variant);
23456 g_list_free_full (connections, g_object_unref);
23457}
23458
Norman Jamesf066e872015-10-07 15:29:51 -050023459static void
23460_flash_on_signal_download (
23461 Flash *object,
23462 const gchar *arg_url,
23463 const gchar *arg_filename)
23464{
23465 FlashSkeleton *skeleton = FLASH_SKELETON (object);
23466
23467 GList *connections, *l;
23468 GVariant *signal_variant;
23469 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
23470
23471 signal_variant = g_variant_ref_sink (g_variant_new ("(ss)",
23472 arg_url,
23473 arg_filename));
23474 for (l = connections; l != NULL; l = l->next)
23475 {
23476 GDBusConnection *connection = l->data;
23477 g_dbus_connection_emit_signal (connection,
23478 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Flash", "Download",
23479 signal_variant, NULL);
23480 }
23481 g_variant_unref (signal_variant);
23482 g_list_free_full (connections, g_object_unref);
23483}
23484
Norman James362a80f2015-09-14 14:04:39 -050023485static void flash_skeleton_iface_init (FlashIface *iface);
23486#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
23487G_DEFINE_TYPE_WITH_CODE (FlashSkeleton, flash_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
23488 G_ADD_PRIVATE (FlashSkeleton)
23489 G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_skeleton_iface_init));
23490
23491#else
23492G_DEFINE_TYPE_WITH_CODE (FlashSkeleton, flash_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
23493 G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_skeleton_iface_init));
23494
23495#endif
23496static void
23497flash_skeleton_finalize (GObject *object)
23498{
23499 FlashSkeleton *skeleton = FLASH_SKELETON (object);
Norman James18998182015-10-11 21:54:53 -050023500 guint n;
Norman James166acf42015-10-22 07:11:51 -050023501 for (n = 0; n < 5; n++)
Norman James18998182015-10-11 21:54:53 -050023502 g_value_unset (&skeleton->priv->properties[n]);
23503 g_free (skeleton->priv->properties);
Norman James362a80f2015-09-14 14:04:39 -050023504 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
23505 if (skeleton->priv->changed_properties_idle_source != NULL)
23506 g_source_destroy (skeleton->priv->changed_properties_idle_source);
23507 g_main_context_unref (skeleton->priv->context);
23508 g_mutex_clear (&skeleton->priv->lock);
23509 G_OBJECT_CLASS (flash_skeleton_parent_class)->finalize (object);
23510}
23511
23512static void
Norman James18998182015-10-11 21:54:53 -050023513flash_skeleton_get_property (GObject *object,
23514 guint prop_id,
23515 GValue *value,
23516 GParamSpec *pspec G_GNUC_UNUSED)
23517{
23518 FlashSkeleton *skeleton = FLASH_SKELETON (object);
Norman James166acf42015-10-22 07:11:51 -050023519 g_assert (prop_id != 0 && prop_id - 1 < 5);
Norman James18998182015-10-11 21:54:53 -050023520 g_mutex_lock (&skeleton->priv->lock);
23521 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
23522 g_mutex_unlock (&skeleton->priv->lock);
23523}
23524
23525static gboolean
23526_flash_emit_changed (gpointer user_data)
23527{
23528 FlashSkeleton *skeleton = FLASH_SKELETON (user_data);
23529 GList *l;
23530 GVariantBuilder builder;
23531 GVariantBuilder invalidated_builder;
23532 guint num_changes;
23533
23534 g_mutex_lock (&skeleton->priv->lock);
23535 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
23536 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
23537 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
23538 {
23539 ChangedProperty *cp = l->data;
23540 GVariant *variant;
23541 const GValue *cur_value;
23542
23543 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
23544 if (!_g_value_equal (cur_value, &cp->orig_value))
23545 {
23546 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
23547 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
23548 g_variant_unref (variant);
23549 num_changes++;
23550 }
23551 }
23552 if (num_changes > 0)
23553 {
23554 GList *connections, *ll;
23555 GVariant *signal_variant;
23556 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Flash",
23557 &builder, &invalidated_builder));
23558 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
23559 for (ll = connections; ll != NULL; ll = ll->next)
23560 {
23561 GDBusConnection *connection = ll->data;
23562
23563 g_dbus_connection_emit_signal (connection,
23564 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
23565 "org.freedesktop.DBus.Properties",
23566 "PropertiesChanged",
23567 signal_variant,
23568 NULL);
23569 }
23570 g_variant_unref (signal_variant);
23571 g_list_free_full (connections, g_object_unref);
23572 }
23573 else
23574 {
23575 g_variant_builder_clear (&builder);
23576 g_variant_builder_clear (&invalidated_builder);
23577 }
23578 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
23579 skeleton->priv->changed_properties = NULL;
23580 skeleton->priv->changed_properties_idle_source = NULL;
23581 g_mutex_unlock (&skeleton->priv->lock);
23582 return FALSE;
23583}
23584
23585static void
23586_flash_schedule_emit_changed (FlashSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
23587{
23588 ChangedProperty *cp;
23589 GList *l;
23590 cp = NULL;
23591 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
23592 {
23593 ChangedProperty *i_cp = l->data;
23594 if (i_cp->info == info)
23595 {
23596 cp = i_cp;
23597 break;
23598 }
23599 }
23600 if (cp == NULL)
23601 {
23602 cp = g_new0 (ChangedProperty, 1);
23603 cp->prop_id = prop_id;
23604 cp->info = info;
23605 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
23606 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
23607 g_value_copy (orig_value, &cp->orig_value);
23608 }
23609}
23610
23611static void
23612flash_skeleton_notify (GObject *object,
23613 GParamSpec *pspec G_GNUC_UNUSED)
23614{
23615 FlashSkeleton *skeleton = FLASH_SKELETON (object);
23616 g_mutex_lock (&skeleton->priv->lock);
23617 if (skeleton->priv->changed_properties != NULL &&
23618 skeleton->priv->changed_properties_idle_source == NULL)
23619 {
23620 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
23621 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
23622 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _flash_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
Adriana Kobylakfd778822016-06-16 09:08:37 -050023623 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _flash_emit_changed");
Norman James18998182015-10-11 21:54:53 -050023624 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
23625 g_source_unref (skeleton->priv->changed_properties_idle_source);
23626 }
23627 g_mutex_unlock (&skeleton->priv->lock);
23628}
23629
23630static void
23631flash_skeleton_set_property (GObject *object,
23632 guint prop_id,
23633 const GValue *value,
23634 GParamSpec *pspec)
23635{
23636 FlashSkeleton *skeleton = FLASH_SKELETON (object);
Norman James166acf42015-10-22 07:11:51 -050023637 g_assert (prop_id != 0 && prop_id - 1 < 5);
Norman James18998182015-10-11 21:54:53 -050023638 g_mutex_lock (&skeleton->priv->lock);
23639 g_object_freeze_notify (object);
23640 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
23641 {
23642 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
23643 _flash_schedule_emit_changed (skeleton, _flash_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
23644 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
23645 g_object_notify_by_pspec (object, pspec);
23646 }
23647 g_mutex_unlock (&skeleton->priv->lock);
23648 g_object_thaw_notify (object);
23649}
23650
23651static void
Norman James362a80f2015-09-14 14:04:39 -050023652flash_skeleton_init (FlashSkeleton *skeleton)
23653{
23654#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
23655 skeleton->priv = flash_skeleton_get_instance_private (skeleton);
23656#else
23657 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_FLASH_SKELETON, FlashSkeletonPrivate);
23658#endif
23659
23660 g_mutex_init (&skeleton->priv->lock);
23661 skeleton->priv->context = g_main_context_ref_thread_default ();
Norman James166acf42015-10-22 07:11:51 -050023662 skeleton->priv->properties = g_new0 (GValue, 5);
Norman James18998182015-10-11 21:54:53 -050023663 g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING);
23664 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
23665 g_value_init (&skeleton->priv->properties[2], G_TYPE_STRING);
23666 g_value_init (&skeleton->priv->properties[3], G_TYPE_STRING);
Norman James166acf42015-10-22 07:11:51 -050023667 g_value_init (&skeleton->priv->properties[4], G_TYPE_STRING);
Norman James18998182015-10-11 21:54:53 -050023668}
23669
23670static const gchar *
23671flash_skeleton_get_filename (Flash *object)
23672{
23673 FlashSkeleton *skeleton = FLASH_SKELETON (object);
23674 const gchar *value;
23675 g_mutex_lock (&skeleton->priv->lock);
23676 value = g_value_get_string (&(skeleton->priv->properties[0]));
23677 g_mutex_unlock (&skeleton->priv->lock);
23678 return value;
23679}
23680
23681static const gchar *
23682flash_skeleton_get_flasher_path (Flash *object)
23683{
23684 FlashSkeleton *skeleton = FLASH_SKELETON (object);
23685 const gchar *value;
23686 g_mutex_lock (&skeleton->priv->lock);
23687 value = g_value_get_string (&(skeleton->priv->properties[1]));
23688 g_mutex_unlock (&skeleton->priv->lock);
23689 return value;
23690}
23691
23692static const gchar *
23693flash_skeleton_get_flasher_name (Flash *object)
23694{
23695 FlashSkeleton *skeleton = FLASH_SKELETON (object);
23696 const gchar *value;
23697 g_mutex_lock (&skeleton->priv->lock);
23698 value = g_value_get_string (&(skeleton->priv->properties[2]));
23699 g_mutex_unlock (&skeleton->priv->lock);
23700 return value;
23701}
23702
23703static const gchar *
23704flash_skeleton_get_flasher_instance (Flash *object)
23705{
23706 FlashSkeleton *skeleton = FLASH_SKELETON (object);
23707 const gchar *value;
23708 g_mutex_lock (&skeleton->priv->lock);
23709 value = g_value_get_string (&(skeleton->priv->properties[3]));
23710 g_mutex_unlock (&skeleton->priv->lock);
23711 return value;
Norman James362a80f2015-09-14 14:04:39 -050023712}
23713
Norman James166acf42015-10-22 07:11:51 -050023714static const gchar *
23715flash_skeleton_get_status (Flash *object)
23716{
23717 FlashSkeleton *skeleton = FLASH_SKELETON (object);
23718 const gchar *value;
23719 g_mutex_lock (&skeleton->priv->lock);
23720 value = g_value_get_string (&(skeleton->priv->properties[4]));
23721 g_mutex_unlock (&skeleton->priv->lock);
23722 return value;
23723}
23724
Norman James362a80f2015-09-14 14:04:39 -050023725static void
23726flash_skeleton_class_init (FlashSkeletonClass *klass)
23727{
23728 GObjectClass *gobject_class;
23729 GDBusInterfaceSkeletonClass *skeleton_class;
23730
23731 gobject_class = G_OBJECT_CLASS (klass);
23732 gobject_class->finalize = flash_skeleton_finalize;
Norman James18998182015-10-11 21:54:53 -050023733 gobject_class->get_property = flash_skeleton_get_property;
23734 gobject_class->set_property = flash_skeleton_set_property;
23735 gobject_class->notify = flash_skeleton_notify;
23736
23737
23738 flash_override_properties (gobject_class, 1);
Norman James362a80f2015-09-14 14:04:39 -050023739
23740 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
23741 skeleton_class->get_info = flash_skeleton_dbus_interface_get_info;
23742 skeleton_class->get_properties = flash_skeleton_dbus_interface_get_properties;
23743 skeleton_class->flush = flash_skeleton_dbus_interface_flush;
23744 skeleton_class->get_vtable = flash_skeleton_dbus_interface_get_vtable;
23745
23746#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
23747 g_type_class_add_private (klass, sizeof (FlashSkeletonPrivate));
23748#endif
23749}
23750
23751static void
23752flash_skeleton_iface_init (FlashIface *iface)
23753{
23754 iface->updated = _flash_on_signal_updated;
Norman Jamesf066e872015-10-07 15:29:51 -050023755 iface->download = _flash_on_signal_download;
Norman James18998182015-10-11 21:54:53 -050023756 iface->get_filename = flash_skeleton_get_filename;
23757 iface->get_flasher_path = flash_skeleton_get_flasher_path;
23758 iface->get_flasher_name = flash_skeleton_get_flasher_name;
23759 iface->get_flasher_instance = flash_skeleton_get_flasher_instance;
Norman James166acf42015-10-22 07:11:51 -050023760 iface->get_status = flash_skeleton_get_status;
Norman James362a80f2015-09-14 14:04:39 -050023761}
23762
23763/**
23764 * flash_skeleton_new:
23765 *
23766 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>.
23767 *
23768 * Returns: (transfer full) (type FlashSkeleton): The skeleton object.
23769 */
23770Flash *
23771flash_skeleton_new (void)
23772{
23773 return FLASH (g_object_new (TYPE_FLASH_SKELETON, NULL));
23774}
23775
23776/* ------------------------------------------------------------------------
Norman James18998182015-10-11 21:54:53 -050023777 * Code for interface org.openbmc.FlashControl
23778 * ------------------------------------------------------------------------
23779 */
23780
23781/**
23782 * SECTION:FlashControl
23783 * @title: FlashControl
23784 * @short_description: Generated C code for the org.openbmc.FlashControl D-Bus interface
23785 *
23786 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link> D-Bus interface in C.
23787 */
23788
23789/* ---- Introspection data for org.openbmc.FlashControl ---- */
23790
23791static const _ExtendedGDBusArgInfo _flash_control_method_info_flash_IN_ARG_type =
23792{
23793 {
23794 -1,
23795 (gchar *) "type",
23796 (gchar *) "s",
23797 NULL
23798 },
23799 FALSE
23800};
23801
23802static const _ExtendedGDBusArgInfo _flash_control_method_info_flash_IN_ARG_filename =
23803{
23804 {
23805 -1,
23806 (gchar *) "filename",
23807 (gchar *) "s",
23808 NULL
23809 },
23810 FALSE
23811};
23812
23813static const _ExtendedGDBusArgInfo * const _flash_control_method_info_flash_IN_ARG_pointers[] =
23814{
23815 &_flash_control_method_info_flash_IN_ARG_type,
23816 &_flash_control_method_info_flash_IN_ARG_filename,
23817 NULL
23818};
23819
23820static const _ExtendedGDBusMethodInfo _flash_control_method_info_flash =
23821{
23822 {
23823 -1,
23824 (gchar *) "flash",
23825 (GDBusArgInfo **) &_flash_control_method_info_flash_IN_ARG_pointers,
23826 NULL,
23827 NULL
23828 },
23829 "handle-flash",
23830 FALSE
23831};
23832
23833static const _ExtendedGDBusMethodInfo * const _flash_control_method_info_pointers[] =
23834{
23835 &_flash_control_method_info_flash,
23836 NULL
23837};
23838
23839static const _ExtendedGDBusArgInfo _flash_control_signal_info_done_ARG_filename =
23840{
23841 {
23842 -1,
23843 (gchar *) "filename",
23844 (gchar *) "s",
23845 NULL
23846 },
23847 FALSE
23848};
23849
23850static const _ExtendedGDBusArgInfo * const _flash_control_signal_info_done_ARG_pointers[] =
23851{
23852 &_flash_control_signal_info_done_ARG_filename,
23853 NULL
23854};
23855
23856static const _ExtendedGDBusSignalInfo _flash_control_signal_info_done =
23857{
23858 {
23859 -1,
23860 (gchar *) "Done",
23861 (GDBusArgInfo **) &_flash_control_signal_info_done_ARG_pointers,
23862 NULL
23863 },
23864 "done"
23865};
23866
23867static const _ExtendedGDBusArgInfo _flash_control_signal_info_error_ARG_filename =
23868{
23869 {
23870 -1,
23871 (gchar *) "filename",
23872 (gchar *) "s",
23873 NULL
23874 },
23875 FALSE
23876};
23877
23878static const _ExtendedGDBusArgInfo * const _flash_control_signal_info_error_ARG_pointers[] =
23879{
23880 &_flash_control_signal_info_error_ARG_filename,
23881 NULL
23882};
23883
23884static const _ExtendedGDBusSignalInfo _flash_control_signal_info_error =
23885{
23886 {
23887 -1,
23888 (gchar *) "Error",
23889 (GDBusArgInfo **) &_flash_control_signal_info_error_ARG_pointers,
23890 NULL
23891 },
23892 "error"
23893};
23894
23895static const _ExtendedGDBusArgInfo _flash_control_signal_info_progress_ARG_filename =
23896{
23897 {
23898 -1,
23899 (gchar *) "filename",
23900 (gchar *) "s",
23901 NULL
23902 },
23903 FALSE
23904};
23905
23906static const _ExtendedGDBusArgInfo _flash_control_signal_info_progress_ARG_progress =
23907{
23908 {
23909 -1,
23910 (gchar *) "progress",
23911 (gchar *) "y",
23912 NULL
23913 },
23914 FALSE
23915};
23916
23917static const _ExtendedGDBusArgInfo * const _flash_control_signal_info_progress_ARG_pointers[] =
23918{
23919 &_flash_control_signal_info_progress_ARG_filename,
23920 &_flash_control_signal_info_progress_ARG_progress,
23921 NULL
23922};
23923
23924static const _ExtendedGDBusSignalInfo _flash_control_signal_info_progress =
23925{
23926 {
23927 -1,
23928 (gchar *) "Progress",
23929 (GDBusArgInfo **) &_flash_control_signal_info_progress_ARG_pointers,
23930 NULL
23931 },
23932 "progress"
23933};
23934
23935static const _ExtendedGDBusSignalInfo * const _flash_control_signal_info_pointers[] =
23936{
23937 &_flash_control_signal_info_done,
23938 &_flash_control_signal_info_error,
23939 &_flash_control_signal_info_progress,
23940 NULL
23941};
23942
23943static const _ExtendedGDBusPropertyInfo _flash_control_property_info_filename =
23944{
23945 {
23946 -1,
23947 (gchar *) "filename",
23948 (gchar *) "s",
23949 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
23950 NULL
23951 },
23952 "filename",
23953 FALSE
23954};
23955
23956static const _ExtendedGDBusPropertyInfo _flash_control_property_info_type_ =
23957{
23958 {
23959 -1,
23960 (gchar *) "type",
23961 (gchar *) "s",
23962 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
23963 NULL
23964 },
23965 "type",
23966 FALSE
23967};
23968
23969static const _ExtendedGDBusPropertyInfo * const _flash_control_property_info_pointers[] =
23970{
23971 &_flash_control_property_info_filename,
23972 &_flash_control_property_info_type_,
23973 NULL
23974};
23975
23976static const _ExtendedGDBusInterfaceInfo _flash_control_interface_info =
23977{
23978 {
23979 -1,
23980 (gchar *) "org.openbmc.FlashControl",
23981 (GDBusMethodInfo **) &_flash_control_method_info_pointers,
23982 (GDBusSignalInfo **) &_flash_control_signal_info_pointers,
23983 (GDBusPropertyInfo **) &_flash_control_property_info_pointers,
23984 NULL
23985 },
23986 "flash-control",
23987};
23988
23989
23990/**
23991 * flash_control_interface_info:
23992 *
23993 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link> D-Bus interface.
23994 *
23995 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
23996 */
23997GDBusInterfaceInfo *
23998flash_control_interface_info (void)
23999{
24000 return (GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct;
24001}
24002
24003/**
24004 * flash_control_override_properties:
24005 * @klass: The class structure for a #GObject<!-- -->-derived class.
24006 * @property_id_begin: The property id to assign to the first overridden property.
24007 *
24008 * Overrides all #GObject properties in the #FlashControl interface for a concrete class.
24009 * The properties are overridden in the order they are defined.
24010 *
24011 * Returns: The last property id.
24012 */
24013guint
24014flash_control_override_properties (GObjectClass *klass, guint property_id_begin)
24015{
24016 g_object_class_override_property (klass, property_id_begin++, "filename");
24017 g_object_class_override_property (klass, property_id_begin++, "type");
24018 return property_id_begin - 1;
24019}
24020
24021
24022
24023/**
24024 * FlashControl:
24025 *
24026 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link>.
24027 */
24028
24029/**
24030 * FlashControlIface:
24031 * @parent_iface: The parent interface.
24032 * @handle_flash: Handler for the #FlashControl::handle-flash signal.
24033 * @get_filename: Getter for the #FlashControl:filename property.
24034 * @get_type_: Getter for the #FlashControl:type property.
24035 * @done: Handler for the #FlashControl::done signal.
24036 * @error: Handler for the #FlashControl::error signal.
24037 * @progress: Handler for the #FlashControl::progress signal.
24038 *
24039 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link>.
24040 */
24041
24042typedef FlashControlIface FlashControlInterface;
24043G_DEFINE_INTERFACE (FlashControl, flash_control, G_TYPE_OBJECT);
24044
24045static void
24046flash_control_default_init (FlashControlIface *iface)
24047{
24048 /* GObject signals for incoming D-Bus method calls: */
24049 /**
24050 * FlashControl::handle-flash:
24051 * @object: A #FlashControl.
24052 * @invocation: A #GDBusMethodInvocation.
24053 * @arg_type: Argument passed by remote caller.
24054 * @arg_filename: Argument passed by remote caller.
24055 *
24056 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-FlashControl.flash">flash()</link> D-Bus method.
24057 *
24058 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call flash_control_complete_flash() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
24059 *
24060 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
24061 */
24062 g_signal_new ("handle-flash",
24063 G_TYPE_FROM_INTERFACE (iface),
24064 G_SIGNAL_RUN_LAST,
24065 G_STRUCT_OFFSET (FlashControlIface, handle_flash),
24066 g_signal_accumulator_true_handled,
24067 NULL,
24068 g_cclosure_marshal_generic,
24069 G_TYPE_BOOLEAN,
24070 3,
24071 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_STRING);
24072
24073 /* GObject signals for received D-Bus signals: */
24074 /**
24075 * FlashControl::done:
24076 * @object: A #FlashControl.
24077 * @arg_filename: Argument.
24078 *
24079 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-FlashControl.Done">"Done"</link> is received.
24080 *
24081 * 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.
24082 */
24083 g_signal_new ("done",
24084 G_TYPE_FROM_INTERFACE (iface),
24085 G_SIGNAL_RUN_LAST,
24086 G_STRUCT_OFFSET (FlashControlIface, done),
24087 NULL,
24088 NULL,
24089 g_cclosure_marshal_generic,
24090 G_TYPE_NONE,
24091 1, G_TYPE_STRING);
24092
24093 /**
24094 * FlashControl::error:
24095 * @object: A #FlashControl.
24096 * @arg_filename: Argument.
24097 *
24098 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-FlashControl.Error">"Error"</link> is received.
24099 *
24100 * 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.
24101 */
24102 g_signal_new ("error",
24103 G_TYPE_FROM_INTERFACE (iface),
24104 G_SIGNAL_RUN_LAST,
24105 G_STRUCT_OFFSET (FlashControlIface, error),
24106 NULL,
24107 NULL,
24108 g_cclosure_marshal_generic,
24109 G_TYPE_NONE,
24110 1, G_TYPE_STRING);
24111
24112 /**
24113 * FlashControl::progress:
24114 * @object: A #FlashControl.
24115 * @arg_filename: Argument.
24116 * @arg_progress: Argument.
24117 *
24118 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-FlashControl.Progress">"Progress"</link> is received.
24119 *
24120 * 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.
24121 */
24122 g_signal_new ("progress",
24123 G_TYPE_FROM_INTERFACE (iface),
24124 G_SIGNAL_RUN_LAST,
24125 G_STRUCT_OFFSET (FlashControlIface, progress),
24126 NULL,
24127 NULL,
24128 g_cclosure_marshal_generic,
24129 G_TYPE_NONE,
24130 2, G_TYPE_STRING, G_TYPE_UCHAR);
24131
24132 /* GObject properties for D-Bus properties: */
24133 /**
24134 * FlashControl:filename:
24135 *
24136 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-FlashControl.filename">"filename"</link>.
24137 *
24138 * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.
24139 */
24140 g_object_interface_install_property (iface,
24141 g_param_spec_string ("filename", "filename", "filename", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
24142 /**
24143 * FlashControl:type:
24144 *
24145 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-FlashControl.type">"type"</link>.
24146 *
24147 * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.
24148 */
24149 g_object_interface_install_property (iface,
24150 g_param_spec_string ("type", "type", "type", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
24151}
24152
24153/**
24154 * flash_control_get_filename: (skip)
24155 * @object: A #FlashControl.
24156 *
24157 * Gets the value of the <link linkend="gdbus-property-org-openbmc-FlashControl.filename">"filename"</link> D-Bus property.
24158 *
24159 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
24160 *
24161 * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use flash_control_dup_filename() if on another thread.</warning>
24162 *
24163 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
24164 */
24165const gchar *
24166flash_control_get_filename (FlashControl *object)
24167{
24168 return FLASH_CONTROL_GET_IFACE (object)->get_filename (object);
24169}
24170
24171/**
24172 * flash_control_dup_filename: (skip)
24173 * @object: A #FlashControl.
24174 *
24175 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-FlashControl.filename">"filename"</link> D-Bus property.
24176 *
24177 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
24178 *
24179 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
24180 */
24181gchar *
24182flash_control_dup_filename (FlashControl *object)
24183{
24184 gchar *value;
24185 g_object_get (G_OBJECT (object), "filename", &value, NULL);
24186 return value;
24187}
24188
24189/**
24190 * flash_control_set_filename: (skip)
24191 * @object: A #FlashControl.
24192 * @value: The value to set.
24193 *
24194 * Sets the <link linkend="gdbus-property-org-openbmc-FlashControl.filename">"filename"</link> D-Bus property to @value.
24195 *
24196 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
24197 */
24198void
24199flash_control_set_filename (FlashControl *object, const gchar *value)
24200{
24201 g_object_set (G_OBJECT (object), "filename", value, NULL);
24202}
24203
24204/**
24205 * flash_control_get_type_: (skip)
24206 * @object: A #FlashControl.
24207 *
24208 * Gets the value of the <link linkend="gdbus-property-org-openbmc-FlashControl.type">"type"</link> D-Bus property.
24209 *
24210 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
24211 *
24212 * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use flash_control_dup_type_() if on another thread.</warning>
24213 *
24214 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
24215 */
24216const gchar *
24217flash_control_get_type_ (FlashControl *object)
24218{
24219 return FLASH_CONTROL_GET_IFACE (object)->get_type_ (object);
24220}
24221
24222/**
24223 * flash_control_dup_type_: (skip)
24224 * @object: A #FlashControl.
24225 *
24226 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-FlashControl.type">"type"</link> D-Bus property.
24227 *
24228 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
24229 *
24230 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
24231 */
24232gchar *
24233flash_control_dup_type_ (FlashControl *object)
24234{
24235 gchar *value;
24236 g_object_get (G_OBJECT (object), "type", &value, NULL);
24237 return value;
24238}
24239
24240/**
24241 * flash_control_set_type_: (skip)
24242 * @object: A #FlashControl.
24243 * @value: The value to set.
24244 *
24245 * Sets the <link linkend="gdbus-property-org-openbmc-FlashControl.type">"type"</link> D-Bus property to @value.
24246 *
24247 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
24248 */
24249void
24250flash_control_set_type_ (FlashControl *object, const gchar *value)
24251{
24252 g_object_set (G_OBJECT (object), "type", value, NULL);
24253}
24254
24255/**
24256 * flash_control_emit_done:
24257 * @object: A #FlashControl.
24258 * @arg_filename: Argument to pass with the signal.
24259 *
24260 * Emits the <link linkend="gdbus-signal-org-openbmc-FlashControl.Done">"Done"</link> D-Bus signal.
24261 */
24262void
24263flash_control_emit_done (
24264 FlashControl *object,
24265 const gchar *arg_filename)
24266{
24267 g_signal_emit_by_name (object, "done", arg_filename);
24268}
24269
24270/**
24271 * flash_control_emit_error:
24272 * @object: A #FlashControl.
24273 * @arg_filename: Argument to pass with the signal.
24274 *
24275 * Emits the <link linkend="gdbus-signal-org-openbmc-FlashControl.Error">"Error"</link> D-Bus signal.
24276 */
24277void
24278flash_control_emit_error (
24279 FlashControl *object,
24280 const gchar *arg_filename)
24281{
24282 g_signal_emit_by_name (object, "error", arg_filename);
24283}
24284
24285/**
24286 * flash_control_emit_progress:
24287 * @object: A #FlashControl.
24288 * @arg_filename: Argument to pass with the signal.
24289 * @arg_progress: Argument to pass with the signal.
24290 *
24291 * Emits the <link linkend="gdbus-signal-org-openbmc-FlashControl.Progress">"Progress"</link> D-Bus signal.
24292 */
24293void
24294flash_control_emit_progress (
24295 FlashControl *object,
24296 const gchar *arg_filename,
24297 guchar arg_progress)
24298{
24299 g_signal_emit_by_name (object, "progress", arg_filename, arg_progress);
24300}
24301
24302/**
24303 * flash_control_call_flash:
24304 * @proxy: A #FlashControlProxy.
24305 * @arg_type: Argument to pass with the method invocation.
24306 * @arg_filename: Argument to pass with the method invocation.
24307 * @cancellable: (allow-none): A #GCancellable or %NULL.
24308 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
24309 * @user_data: User data to pass to @callback.
24310 *
24311 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-FlashControl.flash">flash()</link> D-Bus method on @proxy.
24312 * 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.
24313 * You can then call flash_control_call_flash_finish() to get the result of the operation.
24314 *
24315 * See flash_control_call_flash_sync() for the synchronous, blocking version of this method.
24316 */
24317void
24318flash_control_call_flash (
24319 FlashControl *proxy,
24320 const gchar *arg_type,
24321 const gchar *arg_filename,
24322 GCancellable *cancellable,
24323 GAsyncReadyCallback callback,
24324 gpointer user_data)
24325{
24326 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
24327 "flash",
24328 g_variant_new ("(ss)",
24329 arg_type,
24330 arg_filename),
24331 G_DBUS_CALL_FLAGS_NONE,
24332 -1,
24333 cancellable,
24334 callback,
24335 user_data);
24336}
24337
24338/**
24339 * flash_control_call_flash_finish:
24340 * @proxy: A #FlashControlProxy.
24341 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_control_call_flash().
24342 * @error: Return location for error or %NULL.
24343 *
24344 * Finishes an operation started with flash_control_call_flash().
24345 *
24346 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
24347 */
24348gboolean
24349flash_control_call_flash_finish (
24350 FlashControl *proxy,
24351 GAsyncResult *res,
24352 GError **error)
24353{
24354 GVariant *_ret;
24355 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
24356 if (_ret == NULL)
24357 goto _out;
24358 g_variant_get (_ret,
24359 "()");
24360 g_variant_unref (_ret);
24361_out:
24362 return _ret != NULL;
24363}
24364
24365/**
24366 * flash_control_call_flash_sync:
24367 * @proxy: A #FlashControlProxy.
24368 * @arg_type: Argument to pass with the method invocation.
24369 * @arg_filename: Argument to pass with the method invocation.
24370 * @cancellable: (allow-none): A #GCancellable or %NULL.
24371 * @error: Return location for error or %NULL.
24372 *
24373 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-FlashControl.flash">flash()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
24374 *
24375 * See flash_control_call_flash() for the asynchronous version of this method.
24376 *
24377 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
24378 */
24379gboolean
24380flash_control_call_flash_sync (
24381 FlashControl *proxy,
24382 const gchar *arg_type,
24383 const gchar *arg_filename,
24384 GCancellable *cancellable,
24385 GError **error)
24386{
24387 GVariant *_ret;
24388 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
24389 "flash",
24390 g_variant_new ("(ss)",
24391 arg_type,
24392 arg_filename),
24393 G_DBUS_CALL_FLAGS_NONE,
24394 -1,
24395 cancellable,
24396 error);
24397 if (_ret == NULL)
24398 goto _out;
24399 g_variant_get (_ret,
24400 "()");
24401 g_variant_unref (_ret);
24402_out:
24403 return _ret != NULL;
24404}
24405
24406/**
24407 * flash_control_complete_flash:
24408 * @object: A #FlashControl.
24409 * @invocation: (transfer full): A #GDBusMethodInvocation.
24410 *
24411 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-FlashControl.flash">flash()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
24412 *
24413 * This method will free @invocation, you cannot use it afterwards.
24414 */
24415void
24416flash_control_complete_flash (
24417 FlashControl *object,
24418 GDBusMethodInvocation *invocation)
24419{
24420 g_dbus_method_invocation_return_value (invocation,
24421 g_variant_new ("()"));
24422}
24423
24424/* ------------------------------------------------------------------------ */
24425
24426/**
24427 * FlashControlProxy:
24428 *
24429 * The #FlashControlProxy structure contains only private data and should only be accessed using the provided API.
24430 */
24431
24432/**
24433 * FlashControlProxyClass:
24434 * @parent_class: The parent class.
24435 *
24436 * Class structure for #FlashControlProxy.
24437 */
24438
24439struct _FlashControlProxyPrivate
24440{
24441 GData *qdata;
24442};
24443
24444static void flash_control_proxy_iface_init (FlashControlIface *iface);
24445
24446#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
24447G_DEFINE_TYPE_WITH_CODE (FlashControlProxy, flash_control_proxy, G_TYPE_DBUS_PROXY,
24448 G_ADD_PRIVATE (FlashControlProxy)
24449 G_IMPLEMENT_INTERFACE (TYPE_FLASH_CONTROL, flash_control_proxy_iface_init));
24450
24451#else
24452G_DEFINE_TYPE_WITH_CODE (FlashControlProxy, flash_control_proxy, G_TYPE_DBUS_PROXY,
24453 G_IMPLEMENT_INTERFACE (TYPE_FLASH_CONTROL, flash_control_proxy_iface_init));
24454
24455#endif
24456static void
24457flash_control_proxy_finalize (GObject *object)
24458{
24459 FlashControlProxy *proxy = FLASH_CONTROL_PROXY (object);
24460 g_datalist_clear (&proxy->priv->qdata);
24461 G_OBJECT_CLASS (flash_control_proxy_parent_class)->finalize (object);
24462}
24463
24464static void
24465flash_control_proxy_get_property (GObject *object,
24466 guint prop_id,
24467 GValue *value,
24468 GParamSpec *pspec G_GNUC_UNUSED)
24469{
24470 const _ExtendedGDBusPropertyInfo *info;
24471 GVariant *variant;
24472 g_assert (prop_id != 0 && prop_id - 1 < 2);
24473 info = _flash_control_property_info_pointers[prop_id - 1];
24474 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
24475 if (info->use_gvariant)
24476 {
24477 g_value_set_variant (value, variant);
24478 }
24479 else
24480 {
24481 if (variant != NULL)
24482 g_dbus_gvariant_to_gvalue (variant, value);
24483 }
24484 if (variant != NULL)
24485 g_variant_unref (variant);
24486}
24487
24488static void
24489flash_control_proxy_set_property_cb (GDBusProxy *proxy,
24490 GAsyncResult *res,
24491 gpointer user_data)
24492{
24493 const _ExtendedGDBusPropertyInfo *info = user_data;
24494 GError *error;
24495 GVariant *_ret;
24496 error = NULL;
24497 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
24498 if (!_ret)
24499 {
24500 g_warning ("Error setting property '%s' on interface org.openbmc.FlashControl: %s (%s, %d)",
24501 info->parent_struct.name,
24502 error->message, g_quark_to_string (error->domain), error->code);
24503 g_error_free (error);
24504 }
24505 else
24506 {
24507 g_variant_unref (_ret);
24508 }
24509}
24510
24511static void
24512flash_control_proxy_set_property (GObject *object,
24513 guint prop_id,
24514 const GValue *value,
24515 GParamSpec *pspec G_GNUC_UNUSED)
24516{
24517 const _ExtendedGDBusPropertyInfo *info;
24518 GVariant *variant;
24519 g_assert (prop_id != 0 && prop_id - 1 < 2);
24520 info = _flash_control_property_info_pointers[prop_id - 1];
24521 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
24522 g_dbus_proxy_call (G_DBUS_PROXY (object),
24523 "org.freedesktop.DBus.Properties.Set",
24524 g_variant_new ("(ssv)", "org.openbmc.FlashControl", info->parent_struct.name, variant),
24525 G_DBUS_CALL_FLAGS_NONE,
24526 -1,
24527 NULL, (GAsyncReadyCallback) flash_control_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
24528 g_variant_unref (variant);
24529}
24530
24531static void
24532flash_control_proxy_g_signal (GDBusProxy *proxy,
24533 const gchar *sender_name G_GNUC_UNUSED,
24534 const gchar *signal_name,
24535 GVariant *parameters)
24536{
24537 _ExtendedGDBusSignalInfo *info;
24538 GVariantIter iter;
24539 GVariant *child;
24540 GValue *paramv;
24541 guint num_params;
24542 guint n;
24543 guint signal_id;
24544 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct, signal_name);
24545 if (info == NULL)
24546 return;
24547 num_params = g_variant_n_children (parameters);
24548 paramv = g_new0 (GValue, num_params + 1);
24549 g_value_init (&paramv[0], TYPE_FLASH_CONTROL);
24550 g_value_set_object (&paramv[0], proxy);
24551 g_variant_iter_init (&iter, parameters);
24552 n = 1;
24553 while ((child = g_variant_iter_next_value (&iter)) != NULL)
24554 {
24555 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
24556 if (arg_info->use_gvariant)
24557 {
24558 g_value_init (&paramv[n], G_TYPE_VARIANT);
24559 g_value_set_variant (&paramv[n], child);
24560 n++;
24561 }
24562 else
24563 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
24564 g_variant_unref (child);
24565 }
24566 signal_id = g_signal_lookup (info->signal_name, TYPE_FLASH_CONTROL);
24567 g_signal_emitv (paramv, signal_id, 0, NULL);
24568 for (n = 0; n < num_params + 1; n++)
24569 g_value_unset (&paramv[n]);
24570 g_free (paramv);
24571}
24572
24573static void
24574flash_control_proxy_g_properties_changed (GDBusProxy *_proxy,
24575 GVariant *changed_properties,
24576 const gchar *const *invalidated_properties)
24577{
24578 FlashControlProxy *proxy = FLASH_CONTROL_PROXY (_proxy);
24579 guint n;
24580 const gchar *key;
24581 GVariantIter *iter;
24582 _ExtendedGDBusPropertyInfo *info;
24583 g_variant_get (changed_properties, "a{sv}", &iter);
24584 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
24585 {
24586 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct, key);
24587 g_datalist_remove_data (&proxy->priv->qdata, key);
24588 if (info != NULL)
24589 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
24590 }
24591 g_variant_iter_free (iter);
24592 for (n = 0; invalidated_properties[n] != NULL; n++)
24593 {
24594 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct, invalidated_properties[n]);
24595 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
24596 if (info != NULL)
24597 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
24598 }
24599}
24600
24601static const gchar *
24602flash_control_proxy_get_filename (FlashControl *object)
24603{
24604 FlashControlProxy *proxy = FLASH_CONTROL_PROXY (object);
24605 GVariant *variant;
24606 const gchar *value = NULL;
24607 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "filename");
24608 if (variant != NULL)
24609 {
24610 value = g_variant_get_string (variant, NULL);
24611 g_variant_unref (variant);
24612 }
24613 return value;
24614}
24615
24616static const gchar *
24617flash_control_proxy_get_type_ (FlashControl *object)
24618{
24619 FlashControlProxy *proxy = FLASH_CONTROL_PROXY (object);
24620 GVariant *variant;
24621 const gchar *value = NULL;
24622 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "type");
24623 if (variant != NULL)
24624 {
24625 value = g_variant_get_string (variant, NULL);
24626 g_variant_unref (variant);
24627 }
24628 return value;
24629}
24630
24631static void
24632flash_control_proxy_init (FlashControlProxy *proxy)
24633{
24634#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
24635 proxy->priv = flash_control_proxy_get_instance_private (proxy);
24636#else
24637 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_FLASH_CONTROL_PROXY, FlashControlProxyPrivate);
24638#endif
24639
24640 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), flash_control_interface_info ());
24641}
24642
24643static void
24644flash_control_proxy_class_init (FlashControlProxyClass *klass)
24645{
24646 GObjectClass *gobject_class;
24647 GDBusProxyClass *proxy_class;
24648
24649 gobject_class = G_OBJECT_CLASS (klass);
24650 gobject_class->finalize = flash_control_proxy_finalize;
24651 gobject_class->get_property = flash_control_proxy_get_property;
24652 gobject_class->set_property = flash_control_proxy_set_property;
24653
24654 proxy_class = G_DBUS_PROXY_CLASS (klass);
24655 proxy_class->g_signal = flash_control_proxy_g_signal;
24656 proxy_class->g_properties_changed = flash_control_proxy_g_properties_changed;
24657
24658 flash_control_override_properties (gobject_class, 1);
24659
24660#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
24661 g_type_class_add_private (klass, sizeof (FlashControlProxyPrivate));
24662#endif
24663}
24664
24665static void
24666flash_control_proxy_iface_init (FlashControlIface *iface)
24667{
24668 iface->get_filename = flash_control_proxy_get_filename;
24669 iface->get_type_ = flash_control_proxy_get_type_;
24670}
24671
24672/**
24673 * flash_control_proxy_new:
24674 * @connection: A #GDBusConnection.
24675 * @flags: Flags from the #GDBusProxyFlags enumeration.
24676 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
24677 * @object_path: An object path.
24678 * @cancellable: (allow-none): A #GCancellable or %NULL.
24679 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
24680 * @user_data: User data to pass to @callback.
24681 *
24682 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link>. See g_dbus_proxy_new() for more details.
24683 *
24684 * 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.
24685 * You can then call flash_control_proxy_new_finish() to get the result of the operation.
24686 *
24687 * See flash_control_proxy_new_sync() for the synchronous, blocking version of this constructor.
24688 */
24689void
24690flash_control_proxy_new (
24691 GDBusConnection *connection,
24692 GDBusProxyFlags flags,
24693 const gchar *name,
24694 const gchar *object_path,
24695 GCancellable *cancellable,
24696 GAsyncReadyCallback callback,
24697 gpointer user_data)
24698{
24699 g_async_initable_new_async (TYPE_FLASH_CONTROL_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.FlashControl", NULL);
24700}
24701
24702/**
24703 * flash_control_proxy_new_finish:
24704 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_control_proxy_new().
24705 * @error: Return location for error or %NULL
24706 *
24707 * Finishes an operation started with flash_control_proxy_new().
24708 *
24709 * Returns: (transfer full) (type FlashControlProxy): The constructed proxy object or %NULL if @error is set.
24710 */
24711FlashControl *
24712flash_control_proxy_new_finish (
24713 GAsyncResult *res,
24714 GError **error)
24715{
24716 GObject *ret;
24717 GObject *source_object;
24718 source_object = g_async_result_get_source_object (res);
24719 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
24720 g_object_unref (source_object);
24721 if (ret != NULL)
24722 return FLASH_CONTROL (ret);
24723 else
24724 return NULL;
24725}
24726
24727/**
24728 * flash_control_proxy_new_sync:
24729 * @connection: A #GDBusConnection.
24730 * @flags: Flags from the #GDBusProxyFlags enumeration.
24731 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
24732 * @object_path: An object path.
24733 * @cancellable: (allow-none): A #GCancellable or %NULL.
24734 * @error: Return location for error or %NULL
24735 *
24736 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link>. See g_dbus_proxy_new_sync() for more details.
24737 *
24738 * The calling thread is blocked until a reply is received.
24739 *
24740 * See flash_control_proxy_new() for the asynchronous version of this constructor.
24741 *
24742 * Returns: (transfer full) (type FlashControlProxy): The constructed proxy object or %NULL if @error is set.
24743 */
24744FlashControl *
24745flash_control_proxy_new_sync (
24746 GDBusConnection *connection,
24747 GDBusProxyFlags flags,
24748 const gchar *name,
24749 const gchar *object_path,
24750 GCancellable *cancellable,
24751 GError **error)
24752{
24753 GInitable *ret;
24754 ret = g_initable_new (TYPE_FLASH_CONTROL_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.FlashControl", NULL);
24755 if (ret != NULL)
24756 return FLASH_CONTROL (ret);
24757 else
24758 return NULL;
24759}
24760
24761
24762/**
24763 * flash_control_proxy_new_for_bus:
24764 * @bus_type: A #GBusType.
24765 * @flags: Flags from the #GDBusProxyFlags enumeration.
24766 * @name: A bus name (well-known or unique).
24767 * @object_path: An object path.
24768 * @cancellable: (allow-none): A #GCancellable or %NULL.
24769 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
24770 * @user_data: User data to pass to @callback.
24771 *
24772 * Like flash_control_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
24773 *
24774 * 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.
24775 * You can then call flash_control_proxy_new_for_bus_finish() to get the result of the operation.
24776 *
24777 * See flash_control_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
24778 */
24779void
24780flash_control_proxy_new_for_bus (
24781 GBusType bus_type,
24782 GDBusProxyFlags flags,
24783 const gchar *name,
24784 const gchar *object_path,
24785 GCancellable *cancellable,
24786 GAsyncReadyCallback callback,
24787 gpointer user_data)
24788{
24789 g_async_initable_new_async (TYPE_FLASH_CONTROL_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.FlashControl", NULL);
24790}
24791
24792/**
24793 * flash_control_proxy_new_for_bus_finish:
24794 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_control_proxy_new_for_bus().
24795 * @error: Return location for error or %NULL
24796 *
24797 * Finishes an operation started with flash_control_proxy_new_for_bus().
24798 *
24799 * Returns: (transfer full) (type FlashControlProxy): The constructed proxy object or %NULL if @error is set.
24800 */
24801FlashControl *
24802flash_control_proxy_new_for_bus_finish (
24803 GAsyncResult *res,
24804 GError **error)
24805{
24806 GObject *ret;
24807 GObject *source_object;
24808 source_object = g_async_result_get_source_object (res);
24809 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
24810 g_object_unref (source_object);
24811 if (ret != NULL)
24812 return FLASH_CONTROL (ret);
24813 else
24814 return NULL;
24815}
24816
24817/**
24818 * flash_control_proxy_new_for_bus_sync:
24819 * @bus_type: A #GBusType.
24820 * @flags: Flags from the #GDBusProxyFlags enumeration.
24821 * @name: A bus name (well-known or unique).
24822 * @object_path: An object path.
24823 * @cancellable: (allow-none): A #GCancellable or %NULL.
24824 * @error: Return location for error or %NULL
24825 *
24826 * Like flash_control_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
24827 *
24828 * The calling thread is blocked until a reply is received.
24829 *
24830 * See flash_control_proxy_new_for_bus() for the asynchronous version of this constructor.
24831 *
24832 * Returns: (transfer full) (type FlashControlProxy): The constructed proxy object or %NULL if @error is set.
24833 */
24834FlashControl *
24835flash_control_proxy_new_for_bus_sync (
24836 GBusType bus_type,
24837 GDBusProxyFlags flags,
24838 const gchar *name,
24839 const gchar *object_path,
24840 GCancellable *cancellable,
24841 GError **error)
24842{
24843 GInitable *ret;
24844 ret = g_initable_new (TYPE_FLASH_CONTROL_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.FlashControl", NULL);
24845 if (ret != NULL)
24846 return FLASH_CONTROL (ret);
24847 else
24848 return NULL;
24849}
24850
24851
24852/* ------------------------------------------------------------------------ */
24853
24854/**
24855 * FlashControlSkeleton:
24856 *
24857 * The #FlashControlSkeleton structure contains only private data and should only be accessed using the provided API.
24858 */
24859
24860/**
24861 * FlashControlSkeletonClass:
24862 * @parent_class: The parent class.
24863 *
24864 * Class structure for #FlashControlSkeleton.
24865 */
24866
24867struct _FlashControlSkeletonPrivate
24868{
24869 GValue *properties;
24870 GList *changed_properties;
24871 GSource *changed_properties_idle_source;
24872 GMainContext *context;
24873 GMutex lock;
24874};
24875
24876static void
24877_flash_control_skeleton_handle_method_call (
24878 GDBusConnection *connection G_GNUC_UNUSED,
24879 const gchar *sender G_GNUC_UNUSED,
24880 const gchar *object_path G_GNUC_UNUSED,
24881 const gchar *interface_name,
24882 const gchar *method_name,
24883 GVariant *parameters,
24884 GDBusMethodInvocation *invocation,
24885 gpointer user_data)
24886{
24887 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (user_data);
24888 _ExtendedGDBusMethodInfo *info;
24889 GVariantIter iter;
24890 GVariant *child;
24891 GValue *paramv;
24892 guint num_params;
24893 guint num_extra;
24894 guint n;
24895 guint signal_id;
24896 GValue return_value = G_VALUE_INIT;
24897 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
24898 g_assert (info != NULL);
24899 num_params = g_variant_n_children (parameters);
24900 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
24901 n = 0;
24902 g_value_init (&paramv[n], TYPE_FLASH_CONTROL);
24903 g_value_set_object (&paramv[n++], skeleton);
24904 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
24905 g_value_set_object (&paramv[n++], invocation);
24906 if (info->pass_fdlist)
24907 {
24908#ifdef G_OS_UNIX
24909 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
24910 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
24911#else
24912 g_assert_not_reached ();
24913#endif
24914 }
24915 g_variant_iter_init (&iter, parameters);
24916 while ((child = g_variant_iter_next_value (&iter)) != NULL)
24917 {
24918 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
24919 if (arg_info->use_gvariant)
24920 {
24921 g_value_init (&paramv[n], G_TYPE_VARIANT);
24922 g_value_set_variant (&paramv[n], child);
24923 n++;
24924 }
24925 else
24926 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
24927 g_variant_unref (child);
24928 }
24929 signal_id = g_signal_lookup (info->signal_name, TYPE_FLASH_CONTROL);
24930 g_value_init (&return_value, G_TYPE_BOOLEAN);
24931 g_signal_emitv (paramv, signal_id, 0, &return_value);
24932 if (!g_value_get_boolean (&return_value))
24933 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);
24934 g_value_unset (&return_value);
24935 for (n = 0; n < num_params + num_extra; n++)
24936 g_value_unset (&paramv[n]);
24937 g_free (paramv);
24938}
24939
24940static GVariant *
24941_flash_control_skeleton_handle_get_property (
24942 GDBusConnection *connection G_GNUC_UNUSED,
24943 const gchar *sender G_GNUC_UNUSED,
24944 const gchar *object_path G_GNUC_UNUSED,
24945 const gchar *interface_name G_GNUC_UNUSED,
24946 const gchar *property_name,
24947 GError **error,
24948 gpointer user_data)
24949{
24950 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (user_data);
24951 GValue value = G_VALUE_INIT;
24952 GParamSpec *pspec;
24953 _ExtendedGDBusPropertyInfo *info;
24954 GVariant *ret;
24955 ret = NULL;
24956 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct, property_name);
24957 g_assert (info != NULL);
24958 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
24959 if (pspec == NULL)
24960 {
24961 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
24962 }
24963 else
24964 {
24965 g_value_init (&value, pspec->value_type);
24966 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
24967 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
24968 g_value_unset (&value);
24969 }
24970 return ret;
24971}
24972
24973static gboolean
24974_flash_control_skeleton_handle_set_property (
24975 GDBusConnection *connection G_GNUC_UNUSED,
24976 const gchar *sender G_GNUC_UNUSED,
24977 const gchar *object_path G_GNUC_UNUSED,
24978 const gchar *interface_name G_GNUC_UNUSED,
24979 const gchar *property_name,
24980 GVariant *variant,
24981 GError **error,
24982 gpointer user_data)
24983{
24984 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (user_data);
24985 GValue value = G_VALUE_INIT;
24986 GParamSpec *pspec;
24987 _ExtendedGDBusPropertyInfo *info;
24988 gboolean ret;
24989 ret = FALSE;
24990 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct, property_name);
24991 g_assert (info != NULL);
24992 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
24993 if (pspec == NULL)
24994 {
24995 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
24996 }
24997 else
24998 {
24999 if (info->use_gvariant)
25000 g_value_set_variant (&value, variant);
25001 else
25002 g_dbus_gvariant_to_gvalue (variant, &value);
25003 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
25004 g_value_unset (&value);
25005 ret = TRUE;
25006 }
25007 return ret;
25008}
25009
25010static const GDBusInterfaceVTable _flash_control_skeleton_vtable =
25011{
25012 _flash_control_skeleton_handle_method_call,
25013 _flash_control_skeleton_handle_get_property,
25014 _flash_control_skeleton_handle_set_property,
25015 {NULL}
25016};
25017
25018static GDBusInterfaceInfo *
25019flash_control_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
25020{
25021 return flash_control_interface_info ();
25022}
25023
25024static GDBusInterfaceVTable *
25025flash_control_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
25026{
25027 return (GDBusInterfaceVTable *) &_flash_control_skeleton_vtable;
25028}
25029
25030static GVariant *
25031flash_control_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
25032{
25033 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (_skeleton);
25034
25035 GVariantBuilder builder;
25036 guint n;
25037 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
25038 if (_flash_control_interface_info.parent_struct.properties == NULL)
25039 goto out;
25040 for (n = 0; _flash_control_interface_info.parent_struct.properties[n] != NULL; n++)
25041 {
25042 GDBusPropertyInfo *info = _flash_control_interface_info.parent_struct.properties[n];
25043 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
25044 {
25045 GVariant *value;
25046 value = _flash_control_skeleton_handle_get_property (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.FlashControl", info->name, NULL, skeleton);
25047 if (value != NULL)
25048 {
25049 g_variant_take_ref (value);
25050 g_variant_builder_add (&builder, "{sv}", info->name, value);
25051 g_variant_unref (value);
25052 }
25053 }
25054 }
25055out:
25056 return g_variant_builder_end (&builder);
25057}
25058
25059static gboolean _flash_control_emit_changed (gpointer user_data);
25060
25061static void
25062flash_control_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
25063{
25064 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (_skeleton);
25065 gboolean emit_changed = FALSE;
25066
25067 g_mutex_lock (&skeleton->priv->lock);
25068 if (skeleton->priv->changed_properties_idle_source != NULL)
25069 {
25070 g_source_destroy (skeleton->priv->changed_properties_idle_source);
25071 skeleton->priv->changed_properties_idle_source = NULL;
25072 emit_changed = TRUE;
25073 }
25074 g_mutex_unlock (&skeleton->priv->lock);
25075
25076 if (emit_changed)
25077 _flash_control_emit_changed (skeleton);
25078}
25079
25080static void
25081_flash_control_on_signal_done (
25082 FlashControl *object,
25083 const gchar *arg_filename)
25084{
25085 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
25086
25087 GList *connections, *l;
25088 GVariant *signal_variant;
25089 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
25090
25091 signal_variant = g_variant_ref_sink (g_variant_new ("(s)",
25092 arg_filename));
25093 for (l = connections; l != NULL; l = l->next)
25094 {
25095 GDBusConnection *connection = l->data;
25096 g_dbus_connection_emit_signal (connection,
25097 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.FlashControl", "Done",
25098 signal_variant, NULL);
25099 }
25100 g_variant_unref (signal_variant);
25101 g_list_free_full (connections, g_object_unref);
25102}
25103
25104static void
25105_flash_control_on_signal_error (
25106 FlashControl *object,
25107 const gchar *arg_filename)
25108{
25109 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
25110
25111 GList *connections, *l;
25112 GVariant *signal_variant;
25113 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
25114
25115 signal_variant = g_variant_ref_sink (g_variant_new ("(s)",
25116 arg_filename));
25117 for (l = connections; l != NULL; l = l->next)
25118 {
25119 GDBusConnection *connection = l->data;
25120 g_dbus_connection_emit_signal (connection,
25121 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.FlashControl", "Error",
25122 signal_variant, NULL);
25123 }
25124 g_variant_unref (signal_variant);
25125 g_list_free_full (connections, g_object_unref);
25126}
25127
25128static void
25129_flash_control_on_signal_progress (
25130 FlashControl *object,
25131 const gchar *arg_filename,
25132 guchar arg_progress)
25133{
25134 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
25135
25136 GList *connections, *l;
25137 GVariant *signal_variant;
25138 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
25139
25140 signal_variant = g_variant_ref_sink (g_variant_new ("(sy)",
25141 arg_filename,
25142 arg_progress));
25143 for (l = connections; l != NULL; l = l->next)
25144 {
25145 GDBusConnection *connection = l->data;
25146 g_dbus_connection_emit_signal (connection,
25147 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.FlashControl", "Progress",
25148 signal_variant, NULL);
25149 }
25150 g_variant_unref (signal_variant);
25151 g_list_free_full (connections, g_object_unref);
25152}
25153
25154static void flash_control_skeleton_iface_init (FlashControlIface *iface);
25155#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
25156G_DEFINE_TYPE_WITH_CODE (FlashControlSkeleton, flash_control_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
25157 G_ADD_PRIVATE (FlashControlSkeleton)
25158 G_IMPLEMENT_INTERFACE (TYPE_FLASH_CONTROL, flash_control_skeleton_iface_init));
25159
25160#else
25161G_DEFINE_TYPE_WITH_CODE (FlashControlSkeleton, flash_control_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
25162 G_IMPLEMENT_INTERFACE (TYPE_FLASH_CONTROL, flash_control_skeleton_iface_init));
25163
25164#endif
25165static void
25166flash_control_skeleton_finalize (GObject *object)
25167{
25168 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
25169 guint n;
25170 for (n = 0; n < 2; n++)
25171 g_value_unset (&skeleton->priv->properties[n]);
25172 g_free (skeleton->priv->properties);
25173 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
25174 if (skeleton->priv->changed_properties_idle_source != NULL)
25175 g_source_destroy (skeleton->priv->changed_properties_idle_source);
25176 g_main_context_unref (skeleton->priv->context);
25177 g_mutex_clear (&skeleton->priv->lock);
25178 G_OBJECT_CLASS (flash_control_skeleton_parent_class)->finalize (object);
25179}
25180
25181static void
25182flash_control_skeleton_get_property (GObject *object,
25183 guint prop_id,
25184 GValue *value,
25185 GParamSpec *pspec G_GNUC_UNUSED)
25186{
25187 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
25188 g_assert (prop_id != 0 && prop_id - 1 < 2);
25189 g_mutex_lock (&skeleton->priv->lock);
25190 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
25191 g_mutex_unlock (&skeleton->priv->lock);
25192}
25193
25194static gboolean
25195_flash_control_emit_changed (gpointer user_data)
25196{
25197 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (user_data);
25198 GList *l;
25199 GVariantBuilder builder;
25200 GVariantBuilder invalidated_builder;
25201 guint num_changes;
25202
25203 g_mutex_lock (&skeleton->priv->lock);
25204 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
25205 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
25206 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
25207 {
25208 ChangedProperty *cp = l->data;
25209 GVariant *variant;
25210 const GValue *cur_value;
25211
25212 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
25213 if (!_g_value_equal (cur_value, &cp->orig_value))
25214 {
25215 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
25216 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
25217 g_variant_unref (variant);
25218 num_changes++;
25219 }
25220 }
25221 if (num_changes > 0)
25222 {
25223 GList *connections, *ll;
25224 GVariant *signal_variant;
25225 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.FlashControl",
25226 &builder, &invalidated_builder));
25227 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
25228 for (ll = connections; ll != NULL; ll = ll->next)
25229 {
25230 GDBusConnection *connection = ll->data;
25231
25232 g_dbus_connection_emit_signal (connection,
25233 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
25234 "org.freedesktop.DBus.Properties",
25235 "PropertiesChanged",
25236 signal_variant,
25237 NULL);
25238 }
25239 g_variant_unref (signal_variant);
25240 g_list_free_full (connections, g_object_unref);
25241 }
25242 else
25243 {
25244 g_variant_builder_clear (&builder);
25245 g_variant_builder_clear (&invalidated_builder);
25246 }
25247 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
25248 skeleton->priv->changed_properties = NULL;
25249 skeleton->priv->changed_properties_idle_source = NULL;
25250 g_mutex_unlock (&skeleton->priv->lock);
25251 return FALSE;
25252}
25253
25254static void
25255_flash_control_schedule_emit_changed (FlashControlSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
25256{
25257 ChangedProperty *cp;
25258 GList *l;
25259 cp = NULL;
25260 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
25261 {
25262 ChangedProperty *i_cp = l->data;
25263 if (i_cp->info == info)
25264 {
25265 cp = i_cp;
25266 break;
25267 }
25268 }
25269 if (cp == NULL)
25270 {
25271 cp = g_new0 (ChangedProperty, 1);
25272 cp->prop_id = prop_id;
25273 cp->info = info;
25274 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
25275 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
25276 g_value_copy (orig_value, &cp->orig_value);
25277 }
25278}
25279
25280static void
25281flash_control_skeleton_notify (GObject *object,
25282 GParamSpec *pspec G_GNUC_UNUSED)
25283{
25284 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
25285 g_mutex_lock (&skeleton->priv->lock);
25286 if (skeleton->priv->changed_properties != NULL &&
25287 skeleton->priv->changed_properties_idle_source == NULL)
25288 {
25289 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
25290 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
25291 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _flash_control_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
Adriana Kobylakfd778822016-06-16 09:08:37 -050025292 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _flash_control_emit_changed");
Norman James18998182015-10-11 21:54:53 -050025293 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
25294 g_source_unref (skeleton->priv->changed_properties_idle_source);
25295 }
25296 g_mutex_unlock (&skeleton->priv->lock);
25297}
25298
25299static void
25300flash_control_skeleton_set_property (GObject *object,
25301 guint prop_id,
25302 const GValue *value,
25303 GParamSpec *pspec)
25304{
25305 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
25306 g_assert (prop_id != 0 && prop_id - 1 < 2);
25307 g_mutex_lock (&skeleton->priv->lock);
25308 g_object_freeze_notify (object);
25309 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
25310 {
25311 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
25312 _flash_control_schedule_emit_changed (skeleton, _flash_control_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
25313 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
25314 g_object_notify_by_pspec (object, pspec);
25315 }
25316 g_mutex_unlock (&skeleton->priv->lock);
25317 g_object_thaw_notify (object);
25318}
25319
25320static void
25321flash_control_skeleton_init (FlashControlSkeleton *skeleton)
25322{
25323#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
25324 skeleton->priv = flash_control_skeleton_get_instance_private (skeleton);
25325#else
25326 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_FLASH_CONTROL_SKELETON, FlashControlSkeletonPrivate);
25327#endif
25328
25329 g_mutex_init (&skeleton->priv->lock);
25330 skeleton->priv->context = g_main_context_ref_thread_default ();
25331 skeleton->priv->properties = g_new0 (GValue, 2);
25332 g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING);
25333 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
25334}
25335
25336static const gchar *
25337flash_control_skeleton_get_filename (FlashControl *object)
25338{
25339 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
25340 const gchar *value;
25341 g_mutex_lock (&skeleton->priv->lock);
25342 value = g_value_get_string (&(skeleton->priv->properties[0]));
25343 g_mutex_unlock (&skeleton->priv->lock);
25344 return value;
25345}
25346
25347static const gchar *
25348flash_control_skeleton_get_type_ (FlashControl *object)
25349{
25350 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
25351 const gchar *value;
25352 g_mutex_lock (&skeleton->priv->lock);
25353 value = g_value_get_string (&(skeleton->priv->properties[1]));
25354 g_mutex_unlock (&skeleton->priv->lock);
25355 return value;
25356}
25357
25358static void
25359flash_control_skeleton_class_init (FlashControlSkeletonClass *klass)
25360{
25361 GObjectClass *gobject_class;
25362 GDBusInterfaceSkeletonClass *skeleton_class;
25363
25364 gobject_class = G_OBJECT_CLASS (klass);
25365 gobject_class->finalize = flash_control_skeleton_finalize;
25366 gobject_class->get_property = flash_control_skeleton_get_property;
25367 gobject_class->set_property = flash_control_skeleton_set_property;
25368 gobject_class->notify = flash_control_skeleton_notify;
25369
25370
25371 flash_control_override_properties (gobject_class, 1);
25372
25373 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
25374 skeleton_class->get_info = flash_control_skeleton_dbus_interface_get_info;
25375 skeleton_class->get_properties = flash_control_skeleton_dbus_interface_get_properties;
25376 skeleton_class->flush = flash_control_skeleton_dbus_interface_flush;
25377 skeleton_class->get_vtable = flash_control_skeleton_dbus_interface_get_vtable;
25378
25379#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
25380 g_type_class_add_private (klass, sizeof (FlashControlSkeletonPrivate));
25381#endif
25382}
25383
25384static void
25385flash_control_skeleton_iface_init (FlashControlIface *iface)
25386{
25387 iface->done = _flash_control_on_signal_done;
25388 iface->error = _flash_control_on_signal_error;
25389 iface->progress = _flash_control_on_signal_progress;
25390 iface->get_filename = flash_control_skeleton_get_filename;
25391 iface->get_type_ = flash_control_skeleton_get_type_;
25392}
25393
25394/**
25395 * flash_control_skeleton_new:
25396 *
25397 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link>.
25398 *
25399 * Returns: (transfer full) (type FlashControlSkeleton): The skeleton object.
25400 */
25401FlashControl *
25402flash_control_skeleton_new (void)
25403{
25404 return FLASH_CONTROL (g_object_new (TYPE_FLASH_CONTROL_SKELETON, NULL));
25405}
25406
25407/* ------------------------------------------------------------------------
Norman James362a80f2015-09-14 14:04:39 -050025408 * Code for interface org.openbmc.Button
25409 * ------------------------------------------------------------------------
25410 */
25411
25412/**
25413 * SECTION:Button
25414 * @title: Button
25415 * @short_description: Generated C code for the org.openbmc.Button D-Bus interface
25416 *
25417 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link> D-Bus interface in C.
25418 */
25419
25420/* ---- Introspection data for org.openbmc.Button ---- */
25421
25422static const _ExtendedGDBusArgInfo _button_method_info_is_on_OUT_ARG_state =
25423{
25424 {
25425 -1,
25426 (gchar *) "state",
25427 (gchar *) "b",
25428 NULL
25429 },
25430 FALSE
25431};
25432
25433static const _ExtendedGDBusArgInfo * const _button_method_info_is_on_OUT_ARG_pointers[] =
25434{
25435 &_button_method_info_is_on_OUT_ARG_state,
25436 NULL
25437};
25438
25439static const _ExtendedGDBusMethodInfo _button_method_info_is_on =
25440{
25441 {
25442 -1,
25443 (gchar *) "isOn",
25444 NULL,
25445 (GDBusArgInfo **) &_button_method_info_is_on_OUT_ARG_pointers,
25446 NULL
25447 },
25448 "handle-is-on",
25449 FALSE
25450};
25451
Norman James493996c2015-10-31 17:27:13 -050025452static const _ExtendedGDBusMethodInfo _button_method_info_sim_press =
Norman James362a80f2015-09-14 14:04:39 -050025453{
25454 {
25455 -1,
Norman James493996c2015-10-31 17:27:13 -050025456 (gchar *) "simPress",
Norman James362a80f2015-09-14 14:04:39 -050025457 NULL,
25458 NULL,
25459 NULL
25460 },
Norman James493996c2015-10-31 17:27:13 -050025461 "handle-sim-press",
Norman James362a80f2015-09-14 14:04:39 -050025462 FALSE
25463};
25464
Norman James493996c2015-10-31 17:27:13 -050025465static const _ExtendedGDBusMethodInfo _button_method_info_sim_long_press =
Norman James362a80f2015-09-14 14:04:39 -050025466{
25467 {
25468 -1,
Norman James493996c2015-10-31 17:27:13 -050025469 (gchar *) "simLongPress",
Norman James362a80f2015-09-14 14:04:39 -050025470 NULL,
25471 NULL,
25472 NULL
25473 },
Norman James493996c2015-10-31 17:27:13 -050025474 "handle-sim-long-press",
Norman James362a80f2015-09-14 14:04:39 -050025475 FALSE
25476};
25477
25478static const _ExtendedGDBusMethodInfo * const _button_method_info_pointers[] =
25479{
25480 &_button_method_info_is_on,
Norman James493996c2015-10-31 17:27:13 -050025481 &_button_method_info_sim_press,
25482 &_button_method_info_sim_long_press,
Norman James362a80f2015-09-14 14:04:39 -050025483 NULL
25484};
25485
Norman James493996c2015-10-31 17:27:13 -050025486static const _ExtendedGDBusSignalInfo _button_signal_info_released =
Norman James362a80f2015-09-14 14:04:39 -050025487{
25488 {
25489 -1,
Norman James493996c2015-10-31 17:27:13 -050025490 (gchar *) "Released",
Norman James362a80f2015-09-14 14:04:39 -050025491 NULL,
25492 NULL
25493 },
Norman James493996c2015-10-31 17:27:13 -050025494 "released"
Norman James362a80f2015-09-14 14:04:39 -050025495};
25496
Norman James493996c2015-10-31 17:27:13 -050025497static const _ExtendedGDBusSignalInfo _button_signal_info_pressed =
Norman James362a80f2015-09-14 14:04:39 -050025498{
25499 {
25500 -1,
Norman James493996c2015-10-31 17:27:13 -050025501 (gchar *) "Pressed",
Norman James362a80f2015-09-14 14:04:39 -050025502 NULL,
25503 NULL
25504 },
Norman James493996c2015-10-31 17:27:13 -050025505 "pressed"
Norman James362a80f2015-09-14 14:04:39 -050025506};
25507
Norman James493996c2015-10-31 17:27:13 -050025508static const _ExtendedGDBusSignalInfo _button_signal_info_pressed_long =
Norman James362a80f2015-09-14 14:04:39 -050025509{
25510 {
25511 -1,
Norman James493996c2015-10-31 17:27:13 -050025512 (gchar *) "PressedLong",
Norman James362a80f2015-09-14 14:04:39 -050025513 NULL,
25514 NULL
25515 },
Norman James493996c2015-10-31 17:27:13 -050025516 "pressed-long"
Norman James362a80f2015-09-14 14:04:39 -050025517};
25518
25519static const _ExtendedGDBusSignalInfo * const _button_signal_info_pointers[] =
25520{
Norman James493996c2015-10-31 17:27:13 -050025521 &_button_signal_info_released,
25522 &_button_signal_info_pressed,
25523 &_button_signal_info_pressed_long,
Norman James362a80f2015-09-14 14:04:39 -050025524 NULL
25525};
25526
25527static const _ExtendedGDBusPropertyInfo _button_property_info_state =
25528{
25529 {
25530 -1,
25531 (gchar *) "state",
25532 (gchar *) "b",
25533 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
25534 NULL
25535 },
25536 "state",
25537 FALSE
25538};
25539
Norman James493996c2015-10-31 17:27:13 -050025540static const _ExtendedGDBusPropertyInfo _button_property_info_timer =
25541{
25542 {
25543 -1,
25544 (gchar *) "timer",
25545 (gchar *) "t",
25546 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
25547 NULL
25548 },
25549 "timer",
25550 FALSE
25551};
25552
Norman James362a80f2015-09-14 14:04:39 -050025553static const _ExtendedGDBusPropertyInfo * const _button_property_info_pointers[] =
25554{
25555 &_button_property_info_state,
Norman James493996c2015-10-31 17:27:13 -050025556 &_button_property_info_timer,
Norman James362a80f2015-09-14 14:04:39 -050025557 NULL
25558};
25559
25560static const _ExtendedGDBusInterfaceInfo _button_interface_info =
25561{
25562 {
25563 -1,
25564 (gchar *) "org.openbmc.Button",
25565 (GDBusMethodInfo **) &_button_method_info_pointers,
25566 (GDBusSignalInfo **) &_button_signal_info_pointers,
25567 (GDBusPropertyInfo **) &_button_property_info_pointers,
25568 NULL
25569 },
25570 "button",
25571};
25572
25573
25574/**
25575 * button_interface_info:
25576 *
25577 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link> D-Bus interface.
25578 *
25579 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
25580 */
25581GDBusInterfaceInfo *
25582button_interface_info (void)
25583{
25584 return (GDBusInterfaceInfo *) &_button_interface_info.parent_struct;
25585}
25586
25587/**
25588 * button_override_properties:
25589 * @klass: The class structure for a #GObject<!-- -->-derived class.
25590 * @property_id_begin: The property id to assign to the first overridden property.
25591 *
25592 * Overrides all #GObject properties in the #Button interface for a concrete class.
25593 * The properties are overridden in the order they are defined.
25594 *
25595 * Returns: The last property id.
25596 */
25597guint
25598button_override_properties (GObjectClass *klass, guint property_id_begin)
25599{
25600 g_object_class_override_property (klass, property_id_begin++, "state");
Norman James493996c2015-10-31 17:27:13 -050025601 g_object_class_override_property (klass, property_id_begin++, "timer");
Norman James362a80f2015-09-14 14:04:39 -050025602 return property_id_begin - 1;
25603}
25604
25605
25606
25607/**
25608 * Button:
25609 *
25610 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link>.
25611 */
25612
25613/**
25614 * ButtonIface:
25615 * @parent_iface: The parent interface.
25616 * @handle_is_on: Handler for the #Button::handle-is-on signal.
Norman James493996c2015-10-31 17:27:13 -050025617 * @handle_sim_long_press: Handler for the #Button::handle-sim-long-press signal.
25618 * @handle_sim_press: Handler for the #Button::handle-sim-press signal.
Norman James362a80f2015-09-14 14:04:39 -050025619 * @get_state: Getter for the #Button:state property.
Norman James493996c2015-10-31 17:27:13 -050025620 * @get_timer: Getter for the #Button:timer property.
25621 * @pressed: Handler for the #Button::pressed signal.
25622 * @pressed_long: Handler for the #Button::pressed-long signal.
25623 * @released: Handler for the #Button::released signal.
Norman James362a80f2015-09-14 14:04:39 -050025624 *
25625 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link>.
25626 */
25627
25628typedef ButtonIface ButtonInterface;
25629G_DEFINE_INTERFACE (Button, button, G_TYPE_OBJECT);
25630
25631static void
25632button_default_init (ButtonIface *iface)
25633{
25634 /* GObject signals for incoming D-Bus method calls: */
25635 /**
25636 * Button::handle-is-on:
25637 * @object: A #Button.
25638 * @invocation: A #GDBusMethodInvocation.
25639 *
25640 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Button.isOn">isOn()</link> D-Bus method.
25641 *
25642 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call button_complete_is_on() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
25643 *
25644 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
25645 */
25646 g_signal_new ("handle-is-on",
25647 G_TYPE_FROM_INTERFACE (iface),
25648 G_SIGNAL_RUN_LAST,
25649 G_STRUCT_OFFSET (ButtonIface, handle_is_on),
25650 g_signal_accumulator_true_handled,
25651 NULL,
25652 g_cclosure_marshal_generic,
25653 G_TYPE_BOOLEAN,
25654 1,
25655 G_TYPE_DBUS_METHOD_INVOCATION);
25656
25657 /**
Norman James493996c2015-10-31 17:27:13 -050025658 * Button::handle-sim-press:
Norman James362a80f2015-09-14 14:04:39 -050025659 * @object: A #Button.
25660 * @invocation: A #GDBusMethodInvocation.
25661 *
Norman James493996c2015-10-31 17:27:13 -050025662 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Button.simPress">simPress()</link> D-Bus method.
Norman James362a80f2015-09-14 14:04:39 -050025663 *
Norman James493996c2015-10-31 17:27:13 -050025664 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call button_complete_sim_press() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
Norman James362a80f2015-09-14 14:04:39 -050025665 *
25666 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
25667 */
Norman James493996c2015-10-31 17:27:13 -050025668 g_signal_new ("handle-sim-press",
Norman James362a80f2015-09-14 14:04:39 -050025669 G_TYPE_FROM_INTERFACE (iface),
25670 G_SIGNAL_RUN_LAST,
Norman James493996c2015-10-31 17:27:13 -050025671 G_STRUCT_OFFSET (ButtonIface, handle_sim_press),
Norman James362a80f2015-09-14 14:04:39 -050025672 g_signal_accumulator_true_handled,
25673 NULL,
25674 g_cclosure_marshal_generic,
25675 G_TYPE_BOOLEAN,
25676 1,
25677 G_TYPE_DBUS_METHOD_INVOCATION);
25678
25679 /**
Norman James493996c2015-10-31 17:27:13 -050025680 * Button::handle-sim-long-press:
Norman James362a80f2015-09-14 14:04:39 -050025681 * @object: A #Button.
25682 * @invocation: A #GDBusMethodInvocation.
25683 *
Norman James493996c2015-10-31 17:27:13 -050025684 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Button.simLongPress">simLongPress()</link> D-Bus method.
Norman James362a80f2015-09-14 14:04:39 -050025685 *
Norman James493996c2015-10-31 17:27:13 -050025686 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call button_complete_sim_long_press() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
Norman James362a80f2015-09-14 14:04:39 -050025687 *
25688 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
25689 */
Norman James493996c2015-10-31 17:27:13 -050025690 g_signal_new ("handle-sim-long-press",
Norman James362a80f2015-09-14 14:04:39 -050025691 G_TYPE_FROM_INTERFACE (iface),
25692 G_SIGNAL_RUN_LAST,
Norman James493996c2015-10-31 17:27:13 -050025693 G_STRUCT_OFFSET (ButtonIface, handle_sim_long_press),
Norman James362a80f2015-09-14 14:04:39 -050025694 g_signal_accumulator_true_handled,
25695 NULL,
25696 g_cclosure_marshal_generic,
25697 G_TYPE_BOOLEAN,
25698 1,
25699 G_TYPE_DBUS_METHOD_INVOCATION);
25700
25701 /* GObject signals for received D-Bus signals: */
25702 /**
Norman James493996c2015-10-31 17:27:13 -050025703 * Button::released:
Norman James362a80f2015-09-14 14:04:39 -050025704 * @object: A #Button.
25705 *
Norman James493996c2015-10-31 17:27:13 -050025706 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Button.Released">"Released"</link> is received.
Norman James362a80f2015-09-14 14:04:39 -050025707 *
25708 * 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.
25709 */
Norman James493996c2015-10-31 17:27:13 -050025710 g_signal_new ("released",
Norman James362a80f2015-09-14 14:04:39 -050025711 G_TYPE_FROM_INTERFACE (iface),
25712 G_SIGNAL_RUN_LAST,
Norman James493996c2015-10-31 17:27:13 -050025713 G_STRUCT_OFFSET (ButtonIface, released),
Norman James362a80f2015-09-14 14:04:39 -050025714 NULL,
25715 NULL,
25716 g_cclosure_marshal_generic,
25717 G_TYPE_NONE,
25718 0);
25719
25720 /**
Norman James493996c2015-10-31 17:27:13 -050025721 * Button::pressed:
Norman James362a80f2015-09-14 14:04:39 -050025722 * @object: A #Button.
25723 *
Norman James493996c2015-10-31 17:27:13 -050025724 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Button.Pressed">"Pressed"</link> is received.
Norman James362a80f2015-09-14 14:04:39 -050025725 *
25726 * 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.
25727 */
Norman James493996c2015-10-31 17:27:13 -050025728 g_signal_new ("pressed",
Norman James362a80f2015-09-14 14:04:39 -050025729 G_TYPE_FROM_INTERFACE (iface),
25730 G_SIGNAL_RUN_LAST,
Norman James493996c2015-10-31 17:27:13 -050025731 G_STRUCT_OFFSET (ButtonIface, pressed),
Norman James362a80f2015-09-14 14:04:39 -050025732 NULL,
25733 NULL,
25734 g_cclosure_marshal_generic,
25735 G_TYPE_NONE,
25736 0);
25737
25738 /**
Norman James493996c2015-10-31 17:27:13 -050025739 * Button::pressed-long:
Norman James362a80f2015-09-14 14:04:39 -050025740 * @object: A #Button.
25741 *
Norman James493996c2015-10-31 17:27:13 -050025742 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Button.PressedLong">"PressedLong"</link> is received.
Norman James362a80f2015-09-14 14:04:39 -050025743 *
25744 * 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.
25745 */
Norman James493996c2015-10-31 17:27:13 -050025746 g_signal_new ("pressed-long",
Norman James362a80f2015-09-14 14:04:39 -050025747 G_TYPE_FROM_INTERFACE (iface),
25748 G_SIGNAL_RUN_LAST,
Norman James493996c2015-10-31 17:27:13 -050025749 G_STRUCT_OFFSET (ButtonIface, pressed_long),
Norman James362a80f2015-09-14 14:04:39 -050025750 NULL,
25751 NULL,
25752 g_cclosure_marshal_generic,
25753 G_TYPE_NONE,
25754 0);
25755
25756 /* GObject properties for D-Bus properties: */
25757 /**
25758 * Button:state:
25759 *
25760 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Button.state">"state"</link>.
25761 *
25762 * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.
25763 */
25764 g_object_interface_install_property (iface,
25765 g_param_spec_boolean ("state", "state", "state", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Norman James493996c2015-10-31 17:27:13 -050025766 /**
25767 * Button:timer:
25768 *
25769 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Button.timer">"timer"</link>.
25770 *
25771 * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.
25772 */
25773 g_object_interface_install_property (iface,
25774 g_param_spec_uint64 ("timer", "timer", "timer", 0, G_MAXUINT64, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Norman James362a80f2015-09-14 14:04:39 -050025775}
25776
25777/**
25778 * button_get_state: (skip)
25779 * @object: A #Button.
25780 *
25781 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Button.state">"state"</link> D-Bus property.
25782 *
25783 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
25784 *
25785 * Returns: The property value.
25786 */
25787gboolean
25788button_get_state (Button *object)
25789{
25790 return BUTTON_GET_IFACE (object)->get_state (object);
25791}
25792
25793/**
25794 * button_set_state: (skip)
25795 * @object: A #Button.
25796 * @value: The value to set.
25797 *
25798 * Sets the <link linkend="gdbus-property-org-openbmc-Button.state">"state"</link> D-Bus property to @value.
25799 *
25800 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
25801 */
25802void
25803button_set_state (Button *object, gboolean value)
25804{
25805 g_object_set (G_OBJECT (object), "state", value, NULL);
25806}
25807
25808/**
Norman James493996c2015-10-31 17:27:13 -050025809 * button_get_timer: (skip)
Norman James362a80f2015-09-14 14:04:39 -050025810 * @object: A #Button.
25811 *
Norman James493996c2015-10-31 17:27:13 -050025812 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Button.timer">"timer"</link> D-Bus property.
25813 *
25814 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
25815 *
25816 * Returns: The property value.
Norman James362a80f2015-09-14 14:04:39 -050025817 */
Norman James493996c2015-10-31 17:27:13 -050025818guint64
25819button_get_timer (Button *object)
Norman James362a80f2015-09-14 14:04:39 -050025820{
Norman James493996c2015-10-31 17:27:13 -050025821 return BUTTON_GET_IFACE (object)->get_timer (object);
Norman James362a80f2015-09-14 14:04:39 -050025822}
25823
25824/**
Norman James493996c2015-10-31 17:27:13 -050025825 * button_set_timer: (skip)
Norman James362a80f2015-09-14 14:04:39 -050025826 * @object: A #Button.
Norman James493996c2015-10-31 17:27:13 -050025827 * @value: The value to set.
Norman James362a80f2015-09-14 14:04:39 -050025828 *
Norman James493996c2015-10-31 17:27:13 -050025829 * Sets the <link linkend="gdbus-property-org-openbmc-Button.timer">"timer"</link> D-Bus property to @value.
25830 *
25831 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
Norman James362a80f2015-09-14 14:04:39 -050025832 */
25833void
Norman James493996c2015-10-31 17:27:13 -050025834button_set_timer (Button *object, guint64 value)
Norman James362a80f2015-09-14 14:04:39 -050025835{
Norman James493996c2015-10-31 17:27:13 -050025836 g_object_set (G_OBJECT (object), "timer", value, NULL);
Norman James362a80f2015-09-14 14:04:39 -050025837}
25838
25839/**
Norman James493996c2015-10-31 17:27:13 -050025840 * button_emit_released:
Norman James362a80f2015-09-14 14:04:39 -050025841 * @object: A #Button.
25842 *
Norman James493996c2015-10-31 17:27:13 -050025843 * Emits the <link linkend="gdbus-signal-org-openbmc-Button.Released">"Released"</link> D-Bus signal.
Norman James362a80f2015-09-14 14:04:39 -050025844 */
25845void
Norman James493996c2015-10-31 17:27:13 -050025846button_emit_released (
Norman James362a80f2015-09-14 14:04:39 -050025847 Button *object)
25848{
Norman James493996c2015-10-31 17:27:13 -050025849 g_signal_emit_by_name (object, "released");
25850}
25851
25852/**
25853 * button_emit_pressed:
25854 * @object: A #Button.
25855 *
25856 * Emits the <link linkend="gdbus-signal-org-openbmc-Button.Pressed">"Pressed"</link> D-Bus signal.
25857 */
25858void
25859button_emit_pressed (
25860 Button *object)
25861{
25862 g_signal_emit_by_name (object, "pressed");
25863}
25864
25865/**
25866 * button_emit_pressed_long:
25867 * @object: A #Button.
25868 *
25869 * Emits the <link linkend="gdbus-signal-org-openbmc-Button.PressedLong">"PressedLong"</link> D-Bus signal.
25870 */
25871void
25872button_emit_pressed_long (
25873 Button *object)
25874{
25875 g_signal_emit_by_name (object, "pressed-long");
Norman James362a80f2015-09-14 14:04:39 -050025876}
25877
25878/**
25879 * button_call_is_on:
25880 * @proxy: A #ButtonProxy.
25881 * @cancellable: (allow-none): A #GCancellable or %NULL.
25882 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
25883 * @user_data: User data to pass to @callback.
25884 *
25885 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.isOn">isOn()</link> D-Bus method on @proxy.
25886 * 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.
25887 * You can then call button_call_is_on_finish() to get the result of the operation.
25888 *
25889 * See button_call_is_on_sync() for the synchronous, blocking version of this method.
25890 */
25891void
25892button_call_is_on (
25893 Button *proxy,
25894 GCancellable *cancellable,
25895 GAsyncReadyCallback callback,
25896 gpointer user_data)
25897{
25898 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
25899 "isOn",
25900 g_variant_new ("()"),
25901 G_DBUS_CALL_FLAGS_NONE,
25902 -1,
25903 cancellable,
25904 callback,
25905 user_data);
25906}
25907
25908/**
25909 * button_call_is_on_finish:
25910 * @proxy: A #ButtonProxy.
25911 * @out_state: (out): Return location for return parameter or %NULL to ignore.
25912 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_call_is_on().
25913 * @error: Return location for error or %NULL.
25914 *
25915 * Finishes an operation started with button_call_is_on().
25916 *
25917 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
25918 */
25919gboolean
25920button_call_is_on_finish (
25921 Button *proxy,
25922 gboolean *out_state,
25923 GAsyncResult *res,
25924 GError **error)
25925{
25926 GVariant *_ret;
25927 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
25928 if (_ret == NULL)
25929 goto _out;
25930 g_variant_get (_ret,
25931 "(b)",
25932 out_state);
25933 g_variant_unref (_ret);
25934_out:
25935 return _ret != NULL;
25936}
25937
25938/**
25939 * button_call_is_on_sync:
25940 * @proxy: A #ButtonProxy.
25941 * @out_state: (out): Return location for return parameter or %NULL to ignore.
25942 * @cancellable: (allow-none): A #GCancellable or %NULL.
25943 * @error: Return location for error or %NULL.
25944 *
25945 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.isOn">isOn()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
25946 *
25947 * See button_call_is_on() for the asynchronous version of this method.
25948 *
25949 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
25950 */
25951gboolean
25952button_call_is_on_sync (
25953 Button *proxy,
25954 gboolean *out_state,
25955 GCancellable *cancellable,
25956 GError **error)
25957{
25958 GVariant *_ret;
25959 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
25960 "isOn",
25961 g_variant_new ("()"),
25962 G_DBUS_CALL_FLAGS_NONE,
25963 -1,
25964 cancellable,
25965 error);
25966 if (_ret == NULL)
25967 goto _out;
25968 g_variant_get (_ret,
25969 "(b)",
25970 out_state);
25971 g_variant_unref (_ret);
25972_out:
25973 return _ret != NULL;
25974}
25975
25976/**
Norman James493996c2015-10-31 17:27:13 -050025977 * button_call_sim_press:
Norman James362a80f2015-09-14 14:04:39 -050025978 * @proxy: A #ButtonProxy.
25979 * @cancellable: (allow-none): A #GCancellable or %NULL.
25980 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
25981 * @user_data: User data to pass to @callback.
25982 *
Norman James493996c2015-10-31 17:27:13 -050025983 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.simPress">simPress()</link> D-Bus method on @proxy.
Norman James362a80f2015-09-14 14:04:39 -050025984 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
Norman James493996c2015-10-31 17:27:13 -050025985 * You can then call button_call_sim_press_finish() to get the result of the operation.
Norman James362a80f2015-09-14 14:04:39 -050025986 *
Norman James493996c2015-10-31 17:27:13 -050025987 * See button_call_sim_press_sync() for the synchronous, blocking version of this method.
Norman James362a80f2015-09-14 14:04:39 -050025988 */
25989void
Norman James493996c2015-10-31 17:27:13 -050025990button_call_sim_press (
Norman James362a80f2015-09-14 14:04:39 -050025991 Button *proxy,
25992 GCancellable *cancellable,
25993 GAsyncReadyCallback callback,
25994 gpointer user_data)
25995{
25996 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
Norman James493996c2015-10-31 17:27:13 -050025997 "simPress",
Norman James362a80f2015-09-14 14:04:39 -050025998 g_variant_new ("()"),
25999 G_DBUS_CALL_FLAGS_NONE,
26000 -1,
26001 cancellable,
26002 callback,
26003 user_data);
26004}
26005
26006/**
Norman James493996c2015-10-31 17:27:13 -050026007 * button_call_sim_press_finish:
Norman James362a80f2015-09-14 14:04:39 -050026008 * @proxy: A #ButtonProxy.
Norman James493996c2015-10-31 17:27:13 -050026009 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_call_sim_press().
Norman James362a80f2015-09-14 14:04:39 -050026010 * @error: Return location for error or %NULL.
26011 *
Norman James493996c2015-10-31 17:27:13 -050026012 * Finishes an operation started with button_call_sim_press().
Norman James362a80f2015-09-14 14:04:39 -050026013 *
26014 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
26015 */
26016gboolean
Norman James493996c2015-10-31 17:27:13 -050026017button_call_sim_press_finish (
Norman James362a80f2015-09-14 14:04:39 -050026018 Button *proxy,
26019 GAsyncResult *res,
26020 GError **error)
26021{
26022 GVariant *_ret;
26023 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
26024 if (_ret == NULL)
26025 goto _out;
26026 g_variant_get (_ret,
26027 "()");
26028 g_variant_unref (_ret);
26029_out:
26030 return _ret != NULL;
26031}
26032
26033/**
Norman James493996c2015-10-31 17:27:13 -050026034 * button_call_sim_press_sync:
Norman James362a80f2015-09-14 14:04:39 -050026035 * @proxy: A #ButtonProxy.
26036 * @cancellable: (allow-none): A #GCancellable or %NULL.
26037 * @error: Return location for error or %NULL.
26038 *
Norman James493996c2015-10-31 17:27:13 -050026039 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.simPress">simPress()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
Norman James362a80f2015-09-14 14:04:39 -050026040 *
Norman James493996c2015-10-31 17:27:13 -050026041 * See button_call_sim_press() for the asynchronous version of this method.
Norman James362a80f2015-09-14 14:04:39 -050026042 *
26043 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
26044 */
26045gboolean
Norman James493996c2015-10-31 17:27:13 -050026046button_call_sim_press_sync (
Norman James362a80f2015-09-14 14:04:39 -050026047 Button *proxy,
26048 GCancellable *cancellable,
26049 GError **error)
26050{
26051 GVariant *_ret;
26052 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
Norman James493996c2015-10-31 17:27:13 -050026053 "simPress",
Norman James362a80f2015-09-14 14:04:39 -050026054 g_variant_new ("()"),
26055 G_DBUS_CALL_FLAGS_NONE,
26056 -1,
26057 cancellable,
26058 error);
26059 if (_ret == NULL)
26060 goto _out;
26061 g_variant_get (_ret,
26062 "()");
26063 g_variant_unref (_ret);
26064_out:
26065 return _ret != NULL;
26066}
26067
26068/**
Norman James493996c2015-10-31 17:27:13 -050026069 * button_call_sim_long_press:
Norman James362a80f2015-09-14 14:04:39 -050026070 * @proxy: A #ButtonProxy.
26071 * @cancellable: (allow-none): A #GCancellable or %NULL.
26072 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
26073 * @user_data: User data to pass to @callback.
26074 *
Norman James493996c2015-10-31 17:27:13 -050026075 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.simLongPress">simLongPress()</link> D-Bus method on @proxy.
Norman James362a80f2015-09-14 14:04:39 -050026076 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
Norman James493996c2015-10-31 17:27:13 -050026077 * You can then call button_call_sim_long_press_finish() to get the result of the operation.
Norman James362a80f2015-09-14 14:04:39 -050026078 *
Norman James493996c2015-10-31 17:27:13 -050026079 * See button_call_sim_long_press_sync() for the synchronous, blocking version of this method.
Norman James362a80f2015-09-14 14:04:39 -050026080 */
26081void
Norman James493996c2015-10-31 17:27:13 -050026082button_call_sim_long_press (
Norman James362a80f2015-09-14 14:04:39 -050026083 Button *proxy,
26084 GCancellable *cancellable,
26085 GAsyncReadyCallback callback,
26086 gpointer user_data)
26087{
26088 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
Norman James493996c2015-10-31 17:27:13 -050026089 "simLongPress",
Norman James362a80f2015-09-14 14:04:39 -050026090 g_variant_new ("()"),
26091 G_DBUS_CALL_FLAGS_NONE,
26092 -1,
26093 cancellable,
26094 callback,
26095 user_data);
26096}
26097
26098/**
Norman James493996c2015-10-31 17:27:13 -050026099 * button_call_sim_long_press_finish:
Norman James362a80f2015-09-14 14:04:39 -050026100 * @proxy: A #ButtonProxy.
Norman James493996c2015-10-31 17:27:13 -050026101 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_call_sim_long_press().
Norman James362a80f2015-09-14 14:04:39 -050026102 * @error: Return location for error or %NULL.
26103 *
Norman James493996c2015-10-31 17:27:13 -050026104 * Finishes an operation started with button_call_sim_long_press().
Norman James362a80f2015-09-14 14:04:39 -050026105 *
26106 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
26107 */
26108gboolean
Norman James493996c2015-10-31 17:27:13 -050026109button_call_sim_long_press_finish (
Norman James362a80f2015-09-14 14:04:39 -050026110 Button *proxy,
26111 GAsyncResult *res,
26112 GError **error)
26113{
26114 GVariant *_ret;
26115 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
26116 if (_ret == NULL)
26117 goto _out;
26118 g_variant_get (_ret,
26119 "()");
26120 g_variant_unref (_ret);
26121_out:
26122 return _ret != NULL;
26123}
26124
26125/**
Norman James493996c2015-10-31 17:27:13 -050026126 * button_call_sim_long_press_sync:
Norman James362a80f2015-09-14 14:04:39 -050026127 * @proxy: A #ButtonProxy.
26128 * @cancellable: (allow-none): A #GCancellable or %NULL.
26129 * @error: Return location for error or %NULL.
26130 *
Norman James493996c2015-10-31 17:27:13 -050026131 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.simLongPress">simLongPress()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
Norman James362a80f2015-09-14 14:04:39 -050026132 *
Norman James493996c2015-10-31 17:27:13 -050026133 * See button_call_sim_long_press() for the asynchronous version of this method.
Norman James362a80f2015-09-14 14:04:39 -050026134 *
26135 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
26136 */
26137gboolean
Norman James493996c2015-10-31 17:27:13 -050026138button_call_sim_long_press_sync (
Norman James362a80f2015-09-14 14:04:39 -050026139 Button *proxy,
26140 GCancellable *cancellable,
26141 GError **error)
26142{
26143 GVariant *_ret;
26144 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
Norman James493996c2015-10-31 17:27:13 -050026145 "simLongPress",
Norman James362a80f2015-09-14 14:04:39 -050026146 g_variant_new ("()"),
26147 G_DBUS_CALL_FLAGS_NONE,
26148 -1,
26149 cancellable,
26150 error);
26151 if (_ret == NULL)
26152 goto _out;
26153 g_variant_get (_ret,
26154 "()");
26155 g_variant_unref (_ret);
26156_out:
26157 return _ret != NULL;
26158}
26159
26160/**
26161 * button_complete_is_on:
26162 * @object: A #Button.
26163 * @invocation: (transfer full): A #GDBusMethodInvocation.
26164 * @state: Parameter to return.
26165 *
26166 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Button.isOn">isOn()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
26167 *
26168 * This method will free @invocation, you cannot use it afterwards.
26169 */
26170void
26171button_complete_is_on (
26172 Button *object,
26173 GDBusMethodInvocation *invocation,
26174 gboolean state)
26175{
26176 g_dbus_method_invocation_return_value (invocation,
26177 g_variant_new ("(b)",
26178 state));
26179}
26180
26181/**
Norman James493996c2015-10-31 17:27:13 -050026182 * button_complete_sim_press:
Norman James362a80f2015-09-14 14:04:39 -050026183 * @object: A #Button.
26184 * @invocation: (transfer full): A #GDBusMethodInvocation.
26185 *
Norman James493996c2015-10-31 17:27:13 -050026186 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Button.simPress">simPress()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
Norman James362a80f2015-09-14 14:04:39 -050026187 *
26188 * This method will free @invocation, you cannot use it afterwards.
26189 */
26190void
Norman James493996c2015-10-31 17:27:13 -050026191button_complete_sim_press (
Norman James362a80f2015-09-14 14:04:39 -050026192 Button *object,
26193 GDBusMethodInvocation *invocation)
26194{
26195 g_dbus_method_invocation_return_value (invocation,
26196 g_variant_new ("()"));
26197}
26198
26199/**
Norman James493996c2015-10-31 17:27:13 -050026200 * button_complete_sim_long_press:
Norman James362a80f2015-09-14 14:04:39 -050026201 * @object: A #Button.
26202 * @invocation: (transfer full): A #GDBusMethodInvocation.
26203 *
Norman James493996c2015-10-31 17:27:13 -050026204 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Button.simLongPress">simLongPress()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
Norman James362a80f2015-09-14 14:04:39 -050026205 *
26206 * This method will free @invocation, you cannot use it afterwards.
26207 */
26208void
Norman James493996c2015-10-31 17:27:13 -050026209button_complete_sim_long_press (
Norman James362a80f2015-09-14 14:04:39 -050026210 Button *object,
26211 GDBusMethodInvocation *invocation)
26212{
26213 g_dbus_method_invocation_return_value (invocation,
26214 g_variant_new ("()"));
26215}
26216
26217/* ------------------------------------------------------------------------ */
26218
26219/**
26220 * ButtonProxy:
26221 *
26222 * The #ButtonProxy structure contains only private data and should only be accessed using the provided API.
26223 */
26224
26225/**
26226 * ButtonProxyClass:
26227 * @parent_class: The parent class.
26228 *
26229 * Class structure for #ButtonProxy.
26230 */
26231
26232struct _ButtonProxyPrivate
26233{
26234 GData *qdata;
26235};
26236
26237static void button_proxy_iface_init (ButtonIface *iface);
26238
26239#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
26240G_DEFINE_TYPE_WITH_CODE (ButtonProxy, button_proxy, G_TYPE_DBUS_PROXY,
26241 G_ADD_PRIVATE (ButtonProxy)
26242 G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_proxy_iface_init));
26243
26244#else
26245G_DEFINE_TYPE_WITH_CODE (ButtonProxy, button_proxy, G_TYPE_DBUS_PROXY,
26246 G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_proxy_iface_init));
26247
26248#endif
26249static void
26250button_proxy_finalize (GObject *object)
26251{
26252 ButtonProxy *proxy = BUTTON_PROXY (object);
26253 g_datalist_clear (&proxy->priv->qdata);
26254 G_OBJECT_CLASS (button_proxy_parent_class)->finalize (object);
26255}
26256
26257static void
26258button_proxy_get_property (GObject *object,
26259 guint prop_id,
26260 GValue *value,
26261 GParamSpec *pspec G_GNUC_UNUSED)
26262{
26263 const _ExtendedGDBusPropertyInfo *info;
26264 GVariant *variant;
Norman James493996c2015-10-31 17:27:13 -050026265 g_assert (prop_id != 0 && prop_id - 1 < 2);
Norman James362a80f2015-09-14 14:04:39 -050026266 info = _button_property_info_pointers[prop_id - 1];
26267 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
26268 if (info->use_gvariant)
26269 {
26270 g_value_set_variant (value, variant);
26271 }
26272 else
26273 {
26274 if (variant != NULL)
26275 g_dbus_gvariant_to_gvalue (variant, value);
26276 }
26277 if (variant != NULL)
26278 g_variant_unref (variant);
26279}
26280
26281static void
26282button_proxy_set_property_cb (GDBusProxy *proxy,
26283 GAsyncResult *res,
26284 gpointer user_data)
26285{
26286 const _ExtendedGDBusPropertyInfo *info = user_data;
26287 GError *error;
26288 GVariant *_ret;
26289 error = NULL;
26290 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
26291 if (!_ret)
26292 {
26293 g_warning ("Error setting property '%s' on interface org.openbmc.Button: %s (%s, %d)",
26294 info->parent_struct.name,
26295 error->message, g_quark_to_string (error->domain), error->code);
26296 g_error_free (error);
26297 }
26298 else
26299 {
26300 g_variant_unref (_ret);
26301 }
26302}
26303
26304static void
26305button_proxy_set_property (GObject *object,
26306 guint prop_id,
26307 const GValue *value,
26308 GParamSpec *pspec G_GNUC_UNUSED)
26309{
26310 const _ExtendedGDBusPropertyInfo *info;
26311 GVariant *variant;
Norman James493996c2015-10-31 17:27:13 -050026312 g_assert (prop_id != 0 && prop_id - 1 < 2);
Norman James362a80f2015-09-14 14:04:39 -050026313 info = _button_property_info_pointers[prop_id - 1];
26314 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
26315 g_dbus_proxy_call (G_DBUS_PROXY (object),
26316 "org.freedesktop.DBus.Properties.Set",
26317 g_variant_new ("(ssv)", "org.openbmc.Button", info->parent_struct.name, variant),
26318 G_DBUS_CALL_FLAGS_NONE,
26319 -1,
26320 NULL, (GAsyncReadyCallback) button_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
26321 g_variant_unref (variant);
26322}
26323
26324static void
26325button_proxy_g_signal (GDBusProxy *proxy,
26326 const gchar *sender_name G_GNUC_UNUSED,
26327 const gchar *signal_name,
26328 GVariant *parameters)
26329{
26330 _ExtendedGDBusSignalInfo *info;
26331 GVariantIter iter;
26332 GVariant *child;
26333 GValue *paramv;
26334 guint num_params;
26335 guint n;
26336 guint signal_id;
26337 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, signal_name);
26338 if (info == NULL)
26339 return;
26340 num_params = g_variant_n_children (parameters);
26341 paramv = g_new0 (GValue, num_params + 1);
26342 g_value_init (&paramv[0], TYPE_BUTTON);
26343 g_value_set_object (&paramv[0], proxy);
26344 g_variant_iter_init (&iter, parameters);
26345 n = 1;
26346 while ((child = g_variant_iter_next_value (&iter)) != NULL)
26347 {
26348 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
26349 if (arg_info->use_gvariant)
26350 {
26351 g_value_init (&paramv[n], G_TYPE_VARIANT);
26352 g_value_set_variant (&paramv[n], child);
26353 n++;
26354 }
26355 else
26356 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
26357 g_variant_unref (child);
26358 }
26359 signal_id = g_signal_lookup (info->signal_name, TYPE_BUTTON);
26360 g_signal_emitv (paramv, signal_id, 0, NULL);
26361 for (n = 0; n < num_params + 1; n++)
26362 g_value_unset (&paramv[n]);
26363 g_free (paramv);
26364}
26365
26366static void
26367button_proxy_g_properties_changed (GDBusProxy *_proxy,
26368 GVariant *changed_properties,
26369 const gchar *const *invalidated_properties)
26370{
26371 ButtonProxy *proxy = BUTTON_PROXY (_proxy);
26372 guint n;
26373 const gchar *key;
26374 GVariantIter *iter;
26375 _ExtendedGDBusPropertyInfo *info;
26376 g_variant_get (changed_properties, "a{sv}", &iter);
26377 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
26378 {
26379 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, key);
26380 g_datalist_remove_data (&proxy->priv->qdata, key);
26381 if (info != NULL)
26382 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
26383 }
26384 g_variant_iter_free (iter);
26385 for (n = 0; invalidated_properties[n] != NULL; n++)
26386 {
26387 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, invalidated_properties[n]);
26388 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
26389 if (info != NULL)
26390 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
26391 }
26392}
26393
26394static gboolean
26395button_proxy_get_state (Button *object)
26396{
26397 ButtonProxy *proxy = BUTTON_PROXY (object);
26398 GVariant *variant;
26399 gboolean value = 0;
26400 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state");
26401 if (variant != NULL)
26402 {
26403 value = g_variant_get_boolean (variant);
26404 g_variant_unref (variant);
26405 }
26406 return value;
26407}
26408
Norman James493996c2015-10-31 17:27:13 -050026409static guint64
26410button_proxy_get_timer (Button *object)
26411{
26412 ButtonProxy *proxy = BUTTON_PROXY (object);
26413 GVariant *variant;
26414 guint64 value = 0;
26415 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "timer");
26416 if (variant != NULL)
26417 {
26418 value = g_variant_get_uint64 (variant);
26419 g_variant_unref (variant);
26420 }
26421 return value;
26422}
26423
Norman James362a80f2015-09-14 14:04:39 -050026424static void
26425button_proxy_init (ButtonProxy *proxy)
26426{
26427#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
26428 proxy->priv = button_proxy_get_instance_private (proxy);
26429#else
26430 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_BUTTON_PROXY, ButtonProxyPrivate);
26431#endif
26432
26433 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), button_interface_info ());
26434}
26435
26436static void
26437button_proxy_class_init (ButtonProxyClass *klass)
26438{
26439 GObjectClass *gobject_class;
26440 GDBusProxyClass *proxy_class;
26441
26442 gobject_class = G_OBJECT_CLASS (klass);
26443 gobject_class->finalize = button_proxy_finalize;
26444 gobject_class->get_property = button_proxy_get_property;
26445 gobject_class->set_property = button_proxy_set_property;
26446
26447 proxy_class = G_DBUS_PROXY_CLASS (klass);
26448 proxy_class->g_signal = button_proxy_g_signal;
26449 proxy_class->g_properties_changed = button_proxy_g_properties_changed;
26450
26451 button_override_properties (gobject_class, 1);
26452
26453#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
26454 g_type_class_add_private (klass, sizeof (ButtonProxyPrivate));
26455#endif
26456}
26457
26458static void
26459button_proxy_iface_init (ButtonIface *iface)
26460{
26461 iface->get_state = button_proxy_get_state;
Norman James493996c2015-10-31 17:27:13 -050026462 iface->get_timer = button_proxy_get_timer;
Norman James362a80f2015-09-14 14:04:39 -050026463}
26464
26465/**
26466 * button_proxy_new:
26467 * @connection: A #GDBusConnection.
26468 * @flags: Flags from the #GDBusProxyFlags enumeration.
26469 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
26470 * @object_path: An object path.
26471 * @cancellable: (allow-none): A #GCancellable or %NULL.
26472 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
26473 * @user_data: User data to pass to @callback.
26474 *
26475 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link>. See g_dbus_proxy_new() for more details.
26476 *
26477 * 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.
26478 * You can then call button_proxy_new_finish() to get the result of the operation.
26479 *
26480 * See button_proxy_new_sync() for the synchronous, blocking version of this constructor.
26481 */
26482void
26483button_proxy_new (
26484 GDBusConnection *connection,
26485 GDBusProxyFlags flags,
26486 const gchar *name,
26487 const gchar *object_path,
26488 GCancellable *cancellable,
26489 GAsyncReadyCallback callback,
26490 gpointer user_data)
26491{
26492 g_async_initable_new_async (TYPE_BUTTON_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.Button", NULL);
26493}
26494
26495/**
26496 * button_proxy_new_finish:
26497 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_proxy_new().
26498 * @error: Return location for error or %NULL
26499 *
26500 * Finishes an operation started with button_proxy_new().
26501 *
26502 * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set.
26503 */
26504Button *
26505button_proxy_new_finish (
26506 GAsyncResult *res,
26507 GError **error)
26508{
26509 GObject *ret;
26510 GObject *source_object;
26511 source_object = g_async_result_get_source_object (res);
26512 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
26513 g_object_unref (source_object);
26514 if (ret != NULL)
26515 return BUTTON (ret);
26516 else
26517 return NULL;
26518}
26519
26520/**
26521 * button_proxy_new_sync:
26522 * @connection: A #GDBusConnection.
26523 * @flags: Flags from the #GDBusProxyFlags enumeration.
26524 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
26525 * @object_path: An object path.
26526 * @cancellable: (allow-none): A #GCancellable or %NULL.
26527 * @error: Return location for error or %NULL
26528 *
26529 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link>. See g_dbus_proxy_new_sync() for more details.
26530 *
26531 * The calling thread is blocked until a reply is received.
26532 *
26533 * See button_proxy_new() for the asynchronous version of this constructor.
26534 *
26535 * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set.
26536 */
26537Button *
26538button_proxy_new_sync (
26539 GDBusConnection *connection,
26540 GDBusProxyFlags flags,
26541 const gchar *name,
26542 const gchar *object_path,
26543 GCancellable *cancellable,
26544 GError **error)
26545{
26546 GInitable *ret;
26547 ret = g_initable_new (TYPE_BUTTON_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.Button", NULL);
26548 if (ret != NULL)
26549 return BUTTON (ret);
26550 else
26551 return NULL;
26552}
26553
26554
26555/**
26556 * button_proxy_new_for_bus:
26557 * @bus_type: A #GBusType.
26558 * @flags: Flags from the #GDBusProxyFlags enumeration.
26559 * @name: A bus name (well-known or unique).
26560 * @object_path: An object path.
26561 * @cancellable: (allow-none): A #GCancellable or %NULL.
26562 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
26563 * @user_data: User data to pass to @callback.
26564 *
26565 * Like button_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
26566 *
26567 * 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.
26568 * You can then call button_proxy_new_for_bus_finish() to get the result of the operation.
26569 *
26570 * See button_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
26571 */
26572void
26573button_proxy_new_for_bus (
26574 GBusType bus_type,
26575 GDBusProxyFlags flags,
26576 const gchar *name,
26577 const gchar *object_path,
26578 GCancellable *cancellable,
26579 GAsyncReadyCallback callback,
26580 gpointer user_data)
26581{
26582 g_async_initable_new_async (TYPE_BUTTON_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.Button", NULL);
26583}
26584
26585/**
26586 * button_proxy_new_for_bus_finish:
26587 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_proxy_new_for_bus().
26588 * @error: Return location for error or %NULL
26589 *
26590 * Finishes an operation started with button_proxy_new_for_bus().
26591 *
26592 * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set.
26593 */
26594Button *
26595button_proxy_new_for_bus_finish (
26596 GAsyncResult *res,
26597 GError **error)
26598{
26599 GObject *ret;
26600 GObject *source_object;
26601 source_object = g_async_result_get_source_object (res);
26602 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
26603 g_object_unref (source_object);
26604 if (ret != NULL)
26605 return BUTTON (ret);
26606 else
26607 return NULL;
26608}
26609
26610/**
26611 * button_proxy_new_for_bus_sync:
26612 * @bus_type: A #GBusType.
26613 * @flags: Flags from the #GDBusProxyFlags enumeration.
26614 * @name: A bus name (well-known or unique).
26615 * @object_path: An object path.
26616 * @cancellable: (allow-none): A #GCancellable or %NULL.
26617 * @error: Return location for error or %NULL
26618 *
26619 * Like button_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
26620 *
26621 * The calling thread is blocked until a reply is received.
26622 *
26623 * See button_proxy_new_for_bus() for the asynchronous version of this constructor.
26624 *
26625 * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set.
26626 */
26627Button *
26628button_proxy_new_for_bus_sync (
26629 GBusType bus_type,
26630 GDBusProxyFlags flags,
26631 const gchar *name,
26632 const gchar *object_path,
26633 GCancellable *cancellable,
26634 GError **error)
26635{
26636 GInitable *ret;
26637 ret = g_initable_new (TYPE_BUTTON_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.Button", NULL);
26638 if (ret != NULL)
26639 return BUTTON (ret);
26640 else
26641 return NULL;
26642}
26643
26644
26645/* ------------------------------------------------------------------------ */
26646
26647/**
26648 * ButtonSkeleton:
26649 *
26650 * The #ButtonSkeleton structure contains only private data and should only be accessed using the provided API.
26651 */
26652
26653/**
26654 * ButtonSkeletonClass:
26655 * @parent_class: The parent class.
26656 *
26657 * Class structure for #ButtonSkeleton.
26658 */
26659
26660struct _ButtonSkeletonPrivate
26661{
26662 GValue *properties;
26663 GList *changed_properties;
26664 GSource *changed_properties_idle_source;
26665 GMainContext *context;
26666 GMutex lock;
26667};
26668
26669static void
26670_button_skeleton_handle_method_call (
26671 GDBusConnection *connection G_GNUC_UNUSED,
26672 const gchar *sender G_GNUC_UNUSED,
26673 const gchar *object_path G_GNUC_UNUSED,
26674 const gchar *interface_name,
26675 const gchar *method_name,
26676 GVariant *parameters,
26677 GDBusMethodInvocation *invocation,
26678 gpointer user_data)
26679{
26680 ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data);
26681 _ExtendedGDBusMethodInfo *info;
26682 GVariantIter iter;
26683 GVariant *child;
26684 GValue *paramv;
26685 guint num_params;
26686 guint num_extra;
26687 guint n;
26688 guint signal_id;
26689 GValue return_value = G_VALUE_INIT;
26690 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
26691 g_assert (info != NULL);
26692 num_params = g_variant_n_children (parameters);
26693 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
26694 n = 0;
26695 g_value_init (&paramv[n], TYPE_BUTTON);
26696 g_value_set_object (&paramv[n++], skeleton);
26697 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
26698 g_value_set_object (&paramv[n++], invocation);
26699 if (info->pass_fdlist)
26700 {
26701#ifdef G_OS_UNIX
26702 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
26703 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
26704#else
26705 g_assert_not_reached ();
26706#endif
26707 }
26708 g_variant_iter_init (&iter, parameters);
26709 while ((child = g_variant_iter_next_value (&iter)) != NULL)
26710 {
26711 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
26712 if (arg_info->use_gvariant)
26713 {
26714 g_value_init (&paramv[n], G_TYPE_VARIANT);
26715 g_value_set_variant (&paramv[n], child);
26716 n++;
26717 }
26718 else
26719 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
26720 g_variant_unref (child);
26721 }
26722 signal_id = g_signal_lookup (info->signal_name, TYPE_BUTTON);
26723 g_value_init (&return_value, G_TYPE_BOOLEAN);
26724 g_signal_emitv (paramv, signal_id, 0, &return_value);
26725 if (!g_value_get_boolean (&return_value))
26726 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);
26727 g_value_unset (&return_value);
26728 for (n = 0; n < num_params + num_extra; n++)
26729 g_value_unset (&paramv[n]);
26730 g_free (paramv);
26731}
26732
26733static GVariant *
26734_button_skeleton_handle_get_property (
26735 GDBusConnection *connection G_GNUC_UNUSED,
26736 const gchar *sender G_GNUC_UNUSED,
26737 const gchar *object_path G_GNUC_UNUSED,
26738 const gchar *interface_name G_GNUC_UNUSED,
26739 const gchar *property_name,
26740 GError **error,
26741 gpointer user_data)
26742{
26743 ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data);
26744 GValue value = G_VALUE_INIT;
26745 GParamSpec *pspec;
26746 _ExtendedGDBusPropertyInfo *info;
26747 GVariant *ret;
26748 ret = NULL;
26749 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, property_name);
26750 g_assert (info != NULL);
26751 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
26752 if (pspec == NULL)
26753 {
26754 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
26755 }
26756 else
26757 {
26758 g_value_init (&value, pspec->value_type);
26759 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
26760 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
26761 g_value_unset (&value);
26762 }
26763 return ret;
26764}
26765
26766static gboolean
26767_button_skeleton_handle_set_property (
26768 GDBusConnection *connection G_GNUC_UNUSED,
26769 const gchar *sender G_GNUC_UNUSED,
26770 const gchar *object_path G_GNUC_UNUSED,
26771 const gchar *interface_name G_GNUC_UNUSED,
26772 const gchar *property_name,
26773 GVariant *variant,
26774 GError **error,
26775 gpointer user_data)
26776{
26777 ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data);
26778 GValue value = G_VALUE_INIT;
26779 GParamSpec *pspec;
26780 _ExtendedGDBusPropertyInfo *info;
26781 gboolean ret;
26782 ret = FALSE;
26783 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, property_name);
26784 g_assert (info != NULL);
26785 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
26786 if (pspec == NULL)
26787 {
26788 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
26789 }
26790 else
26791 {
26792 if (info->use_gvariant)
26793 g_value_set_variant (&value, variant);
26794 else
26795 g_dbus_gvariant_to_gvalue (variant, &value);
26796 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
26797 g_value_unset (&value);
26798 ret = TRUE;
26799 }
26800 return ret;
26801}
26802
26803static const GDBusInterfaceVTable _button_skeleton_vtable =
26804{
26805 _button_skeleton_handle_method_call,
26806 _button_skeleton_handle_get_property,
26807 _button_skeleton_handle_set_property,
26808 {NULL}
26809};
26810
26811static GDBusInterfaceInfo *
26812button_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
26813{
26814 return button_interface_info ();
26815}
26816
26817static GDBusInterfaceVTable *
26818button_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
26819{
26820 return (GDBusInterfaceVTable *) &_button_skeleton_vtable;
26821}
26822
26823static GVariant *
26824button_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
26825{
26826 ButtonSkeleton *skeleton = BUTTON_SKELETON (_skeleton);
26827
26828 GVariantBuilder builder;
26829 guint n;
26830 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
26831 if (_button_interface_info.parent_struct.properties == NULL)
26832 goto out;
26833 for (n = 0; _button_interface_info.parent_struct.properties[n] != NULL; n++)
26834 {
26835 GDBusPropertyInfo *info = _button_interface_info.parent_struct.properties[n];
26836 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
26837 {
26838 GVariant *value;
26839 value = _button_skeleton_handle_get_property (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Button", info->name, NULL, skeleton);
26840 if (value != NULL)
26841 {
26842 g_variant_take_ref (value);
26843 g_variant_builder_add (&builder, "{sv}", info->name, value);
26844 g_variant_unref (value);
26845 }
26846 }
26847 }
26848out:
26849 return g_variant_builder_end (&builder);
26850}
26851
26852static gboolean _button_emit_changed (gpointer user_data);
26853
26854static void
26855button_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
26856{
26857 ButtonSkeleton *skeleton = BUTTON_SKELETON (_skeleton);
26858 gboolean emit_changed = FALSE;
26859
26860 g_mutex_lock (&skeleton->priv->lock);
26861 if (skeleton->priv->changed_properties_idle_source != NULL)
26862 {
26863 g_source_destroy (skeleton->priv->changed_properties_idle_source);
26864 skeleton->priv->changed_properties_idle_source = NULL;
26865 emit_changed = TRUE;
26866 }
26867 g_mutex_unlock (&skeleton->priv->lock);
26868
26869 if (emit_changed)
26870 _button_emit_changed (skeleton);
26871}
26872
26873static void
Norman James493996c2015-10-31 17:27:13 -050026874_button_on_signal_released (
Norman James362a80f2015-09-14 14:04:39 -050026875 Button *object)
26876{
26877 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
26878
26879 GList *connections, *l;
26880 GVariant *signal_variant;
26881 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
26882
26883 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
26884 for (l = connections; l != NULL; l = l->next)
26885 {
26886 GDBusConnection *connection = l->data;
26887 g_dbus_connection_emit_signal (connection,
Norman James493996c2015-10-31 17:27:13 -050026888 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Button", "Released",
Norman James362a80f2015-09-14 14:04:39 -050026889 signal_variant, NULL);
26890 }
26891 g_variant_unref (signal_variant);
26892 g_list_free_full (connections, g_object_unref);
26893}
26894
26895static void
Norman James493996c2015-10-31 17:27:13 -050026896_button_on_signal_pressed (
Norman James362a80f2015-09-14 14:04:39 -050026897 Button *object)
26898{
26899 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
26900
26901 GList *connections, *l;
26902 GVariant *signal_variant;
26903 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
26904
26905 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
26906 for (l = connections; l != NULL; l = l->next)
26907 {
26908 GDBusConnection *connection = l->data;
26909 g_dbus_connection_emit_signal (connection,
Norman James493996c2015-10-31 17:27:13 -050026910 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Button", "Pressed",
Norman James362a80f2015-09-14 14:04:39 -050026911 signal_variant, NULL);
26912 }
26913 g_variant_unref (signal_variant);
26914 g_list_free_full (connections, g_object_unref);
26915}
26916
26917static void
Norman James493996c2015-10-31 17:27:13 -050026918_button_on_signal_pressed_long (
Norman James362a80f2015-09-14 14:04:39 -050026919 Button *object)
26920{
26921 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
26922
26923 GList *connections, *l;
26924 GVariant *signal_variant;
26925 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
26926
26927 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
26928 for (l = connections; l != NULL; l = l->next)
26929 {
26930 GDBusConnection *connection = l->data;
26931 g_dbus_connection_emit_signal (connection,
Norman James493996c2015-10-31 17:27:13 -050026932 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Button", "PressedLong",
Norman James362a80f2015-09-14 14:04:39 -050026933 signal_variant, NULL);
26934 }
26935 g_variant_unref (signal_variant);
26936 g_list_free_full (connections, g_object_unref);
26937}
26938
26939static void button_skeleton_iface_init (ButtonIface *iface);
26940#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
26941G_DEFINE_TYPE_WITH_CODE (ButtonSkeleton, button_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
26942 G_ADD_PRIVATE (ButtonSkeleton)
26943 G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_skeleton_iface_init));
26944
26945#else
26946G_DEFINE_TYPE_WITH_CODE (ButtonSkeleton, button_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
26947 G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_skeleton_iface_init));
26948
26949#endif
26950static void
26951button_skeleton_finalize (GObject *object)
26952{
26953 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
26954 guint n;
Norman James493996c2015-10-31 17:27:13 -050026955 for (n = 0; n < 2; n++)
Norman James362a80f2015-09-14 14:04:39 -050026956 g_value_unset (&skeleton->priv->properties[n]);
26957 g_free (skeleton->priv->properties);
26958 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
26959 if (skeleton->priv->changed_properties_idle_source != NULL)
26960 g_source_destroy (skeleton->priv->changed_properties_idle_source);
26961 g_main_context_unref (skeleton->priv->context);
26962 g_mutex_clear (&skeleton->priv->lock);
26963 G_OBJECT_CLASS (button_skeleton_parent_class)->finalize (object);
26964}
26965
26966static void
26967button_skeleton_get_property (GObject *object,
26968 guint prop_id,
26969 GValue *value,
26970 GParamSpec *pspec G_GNUC_UNUSED)
26971{
26972 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
Norman James493996c2015-10-31 17:27:13 -050026973 g_assert (prop_id != 0 && prop_id - 1 < 2);
Norman James362a80f2015-09-14 14:04:39 -050026974 g_mutex_lock (&skeleton->priv->lock);
26975 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
26976 g_mutex_unlock (&skeleton->priv->lock);
26977}
26978
26979static gboolean
26980_button_emit_changed (gpointer user_data)
26981{
26982 ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data);
26983 GList *l;
26984 GVariantBuilder builder;
26985 GVariantBuilder invalidated_builder;
26986 guint num_changes;
26987
26988 g_mutex_lock (&skeleton->priv->lock);
26989 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
26990 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
26991 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
26992 {
26993 ChangedProperty *cp = l->data;
26994 GVariant *variant;
26995 const GValue *cur_value;
26996
26997 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
26998 if (!_g_value_equal (cur_value, &cp->orig_value))
26999 {
27000 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
27001 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
27002 g_variant_unref (variant);
27003 num_changes++;
27004 }
27005 }
27006 if (num_changes > 0)
27007 {
27008 GList *connections, *ll;
27009 GVariant *signal_variant;
27010 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Button",
27011 &builder, &invalidated_builder));
27012 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
27013 for (ll = connections; ll != NULL; ll = ll->next)
27014 {
27015 GDBusConnection *connection = ll->data;
27016
27017 g_dbus_connection_emit_signal (connection,
27018 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
27019 "org.freedesktop.DBus.Properties",
27020 "PropertiesChanged",
27021 signal_variant,
27022 NULL);
27023 }
27024 g_variant_unref (signal_variant);
27025 g_list_free_full (connections, g_object_unref);
27026 }
27027 else
27028 {
27029 g_variant_builder_clear (&builder);
27030 g_variant_builder_clear (&invalidated_builder);
27031 }
27032 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
27033 skeleton->priv->changed_properties = NULL;
27034 skeleton->priv->changed_properties_idle_source = NULL;
27035 g_mutex_unlock (&skeleton->priv->lock);
27036 return FALSE;
27037}
27038
27039static void
27040_button_schedule_emit_changed (ButtonSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
27041{
27042 ChangedProperty *cp;
27043 GList *l;
27044 cp = NULL;
27045 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
27046 {
27047 ChangedProperty *i_cp = l->data;
27048 if (i_cp->info == info)
27049 {
27050 cp = i_cp;
27051 break;
27052 }
27053 }
27054 if (cp == NULL)
27055 {
27056 cp = g_new0 (ChangedProperty, 1);
27057 cp->prop_id = prop_id;
27058 cp->info = info;
27059 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
27060 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
27061 g_value_copy (orig_value, &cp->orig_value);
27062 }
27063}
27064
27065static void
27066button_skeleton_notify (GObject *object,
27067 GParamSpec *pspec G_GNUC_UNUSED)
27068{
27069 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
27070 g_mutex_lock (&skeleton->priv->lock);
27071 if (skeleton->priv->changed_properties != NULL &&
27072 skeleton->priv->changed_properties_idle_source == NULL)
27073 {
27074 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
27075 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
27076 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _button_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
Adriana Kobylakfd778822016-06-16 09:08:37 -050027077 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _button_emit_changed");
Norman James362a80f2015-09-14 14:04:39 -050027078 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
27079 g_source_unref (skeleton->priv->changed_properties_idle_source);
27080 }
27081 g_mutex_unlock (&skeleton->priv->lock);
27082}
27083
27084static void
27085button_skeleton_set_property (GObject *object,
27086 guint prop_id,
27087 const GValue *value,
27088 GParamSpec *pspec)
27089{
27090 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
Norman James493996c2015-10-31 17:27:13 -050027091 g_assert (prop_id != 0 && prop_id - 1 < 2);
Norman James362a80f2015-09-14 14:04:39 -050027092 g_mutex_lock (&skeleton->priv->lock);
27093 g_object_freeze_notify (object);
27094 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
27095 {
27096 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
27097 _button_schedule_emit_changed (skeleton, _button_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
27098 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
27099 g_object_notify_by_pspec (object, pspec);
27100 }
27101 g_mutex_unlock (&skeleton->priv->lock);
27102 g_object_thaw_notify (object);
27103}
27104
27105static void
27106button_skeleton_init (ButtonSkeleton *skeleton)
27107{
27108#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
27109 skeleton->priv = button_skeleton_get_instance_private (skeleton);
27110#else
27111 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_BUTTON_SKELETON, ButtonSkeletonPrivate);
27112#endif
27113
27114 g_mutex_init (&skeleton->priv->lock);
27115 skeleton->priv->context = g_main_context_ref_thread_default ();
Norman James493996c2015-10-31 17:27:13 -050027116 skeleton->priv->properties = g_new0 (GValue, 2);
Norman James362a80f2015-09-14 14:04:39 -050027117 g_value_init (&skeleton->priv->properties[0], G_TYPE_BOOLEAN);
Norman James493996c2015-10-31 17:27:13 -050027118 g_value_init (&skeleton->priv->properties[1], G_TYPE_UINT64);
Norman James362a80f2015-09-14 14:04:39 -050027119}
27120
27121static gboolean
27122button_skeleton_get_state (Button *object)
27123{
27124 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
27125 gboolean value;
27126 g_mutex_lock (&skeleton->priv->lock);
27127 value = g_value_get_boolean (&(skeleton->priv->properties[0]));
27128 g_mutex_unlock (&skeleton->priv->lock);
27129 return value;
27130}
27131
Norman James493996c2015-10-31 17:27:13 -050027132static guint64
27133button_skeleton_get_timer (Button *object)
27134{
27135 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
27136 guint64 value;
27137 g_mutex_lock (&skeleton->priv->lock);
27138 value = g_value_get_uint64 (&(skeleton->priv->properties[1]));
27139 g_mutex_unlock (&skeleton->priv->lock);
27140 return value;
27141}
27142
Norman James362a80f2015-09-14 14:04:39 -050027143static void
27144button_skeleton_class_init (ButtonSkeletonClass *klass)
27145{
27146 GObjectClass *gobject_class;
27147 GDBusInterfaceSkeletonClass *skeleton_class;
27148
27149 gobject_class = G_OBJECT_CLASS (klass);
27150 gobject_class->finalize = button_skeleton_finalize;
27151 gobject_class->get_property = button_skeleton_get_property;
27152 gobject_class->set_property = button_skeleton_set_property;
27153 gobject_class->notify = button_skeleton_notify;
27154
27155
27156 button_override_properties (gobject_class, 1);
27157
27158 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
27159 skeleton_class->get_info = button_skeleton_dbus_interface_get_info;
27160 skeleton_class->get_properties = button_skeleton_dbus_interface_get_properties;
27161 skeleton_class->flush = button_skeleton_dbus_interface_flush;
27162 skeleton_class->get_vtable = button_skeleton_dbus_interface_get_vtable;
27163
27164#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
27165 g_type_class_add_private (klass, sizeof (ButtonSkeletonPrivate));
27166#endif
27167}
27168
27169static void
27170button_skeleton_iface_init (ButtonIface *iface)
27171{
Norman James493996c2015-10-31 17:27:13 -050027172 iface->released = _button_on_signal_released;
27173 iface->pressed = _button_on_signal_pressed;
27174 iface->pressed_long = _button_on_signal_pressed_long;
Norman James362a80f2015-09-14 14:04:39 -050027175 iface->get_state = button_skeleton_get_state;
Norman James493996c2015-10-31 17:27:13 -050027176 iface->get_timer = button_skeleton_get_timer;
Norman James362a80f2015-09-14 14:04:39 -050027177}
27178
27179/**
27180 * button_skeleton_new:
27181 *
27182 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link>.
27183 *
27184 * Returns: (transfer full) (type ButtonSkeleton): The skeleton object.
27185 */
27186Button *
27187button_skeleton_new (void)
27188{
27189 return BUTTON (g_object_new (TYPE_BUTTON_SKELETON, NULL));
27190}
27191
27192/* ------------------------------------------------------------------------
27193 * Code for interface org.openbmc.Led
27194 * ------------------------------------------------------------------------
27195 */
27196
27197/**
27198 * SECTION:Led
27199 * @title: Led
27200 * @short_description: Generated C code for the org.openbmc.Led D-Bus interface
27201 *
27202 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link> D-Bus interface in C.
27203 */
27204
27205/* ---- Introspection data for org.openbmc.Led ---- */
27206
27207static const _ExtendedGDBusMethodInfo _led_method_info_set_on =
27208{
27209 {
27210 -1,
27211 (gchar *) "setOn",
27212 NULL,
27213 NULL,
27214 NULL
27215 },
27216 "handle-set-on",
27217 FALSE
27218};
27219
27220static const _ExtendedGDBusMethodInfo _led_method_info_set_off =
27221{
27222 {
27223 -1,
27224 (gchar *) "setOff",
27225 NULL,
27226 NULL,
27227 NULL
27228 },
27229 "handle-set-off",
27230 FALSE
27231};
27232
27233static const _ExtendedGDBusMethodInfo _led_method_info_set_blink_slow =
27234{
27235 {
27236 -1,
27237 (gchar *) "setBlinkSlow",
27238 NULL,
27239 NULL,
27240 NULL
27241 },
27242 "handle-set-blink-slow",
27243 FALSE
27244};
27245
27246static const _ExtendedGDBusMethodInfo _led_method_info_set_blink_fast =
27247{
27248 {
27249 -1,
27250 (gchar *) "setBlinkFast",
27251 NULL,
27252 NULL,
27253 NULL
27254 },
27255 "handle-set-blink-fast",
27256 FALSE
27257};
27258
27259static const _ExtendedGDBusMethodInfo * const _led_method_info_pointers[] =
27260{
27261 &_led_method_info_set_on,
27262 &_led_method_info_set_off,
27263 &_led_method_info_set_blink_slow,
27264 &_led_method_info_set_blink_fast,
27265 NULL
27266};
27267
27268static const _ExtendedGDBusPropertyInfo _led_property_info_color =
27269{
27270 {
27271 -1,
27272 (gchar *) "color",
27273 (gchar *) "i",
27274 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
27275 NULL
27276 },
27277 "color",
27278 FALSE
27279};
27280
27281static const _ExtendedGDBusPropertyInfo _led_property_info_function =
27282{
27283 {
27284 -1,
27285 (gchar *) "function",
27286 (gchar *) "s",
27287 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
27288 NULL
27289 },
27290 "function",
27291 FALSE
27292};
27293
Norman James493996c2015-10-31 17:27:13 -050027294static const _ExtendedGDBusPropertyInfo _led_property_info_state =
27295{
27296 {
27297 -1,
27298 (gchar *) "state",
27299 (gchar *) "s",
27300 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
27301 NULL
27302 },
27303 "state",
27304 FALSE
27305};
27306
Norman James362a80f2015-09-14 14:04:39 -050027307static const _ExtendedGDBusPropertyInfo * const _led_property_info_pointers[] =
27308{
27309 &_led_property_info_color,
27310 &_led_property_info_function,
Norman James493996c2015-10-31 17:27:13 -050027311 &_led_property_info_state,
Norman James362a80f2015-09-14 14:04:39 -050027312 NULL
27313};
27314
27315static const _ExtendedGDBusInterfaceInfo _led_interface_info =
27316{
27317 {
27318 -1,
27319 (gchar *) "org.openbmc.Led",
27320 (GDBusMethodInfo **) &_led_method_info_pointers,
27321 NULL,
27322 (GDBusPropertyInfo **) &_led_property_info_pointers,
27323 NULL
27324 },
27325 "led",
27326};
27327
27328
27329/**
27330 * led_interface_info:
27331 *
27332 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link> D-Bus interface.
27333 *
27334 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
27335 */
27336GDBusInterfaceInfo *
27337led_interface_info (void)
27338{
27339 return (GDBusInterfaceInfo *) &_led_interface_info.parent_struct;
27340}
27341
27342/**
27343 * led_override_properties:
27344 * @klass: The class structure for a #GObject<!-- -->-derived class.
27345 * @property_id_begin: The property id to assign to the first overridden property.
27346 *
27347 * Overrides all #GObject properties in the #Led interface for a concrete class.
27348 * The properties are overridden in the order they are defined.
27349 *
27350 * Returns: The last property id.
27351 */
27352guint
27353led_override_properties (GObjectClass *klass, guint property_id_begin)
27354{
27355 g_object_class_override_property (klass, property_id_begin++, "color");
27356 g_object_class_override_property (klass, property_id_begin++, "function");
Norman James493996c2015-10-31 17:27:13 -050027357 g_object_class_override_property (klass, property_id_begin++, "state");
Norman James362a80f2015-09-14 14:04:39 -050027358 return property_id_begin - 1;
27359}
27360
27361
27362
27363/**
27364 * Led:
27365 *
27366 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>.
27367 */
27368
27369/**
27370 * LedIface:
27371 * @parent_iface: The parent interface.
27372 * @handle_set_blink_fast: Handler for the #Led::handle-set-blink-fast signal.
27373 * @handle_set_blink_slow: Handler for the #Led::handle-set-blink-slow signal.
27374 * @handle_set_off: Handler for the #Led::handle-set-off signal.
27375 * @handle_set_on: Handler for the #Led::handle-set-on signal.
27376 * @get_color: Getter for the #Led:color property.
27377 * @get_function: Getter for the #Led:function property.
Norman James493996c2015-10-31 17:27:13 -050027378 * @get_state: Getter for the #Led:state property.
Norman James362a80f2015-09-14 14:04:39 -050027379 *
27380 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>.
27381 */
27382
27383typedef LedIface LedInterface;
27384G_DEFINE_INTERFACE (Led, led, G_TYPE_OBJECT);
27385
27386static void
27387led_default_init (LedIface *iface)
27388{
27389 /* GObject signals for incoming D-Bus method calls: */
27390 /**
27391 * Led::handle-set-on:
27392 * @object: A #Led.
27393 * @invocation: A #GDBusMethodInvocation.
27394 *
27395 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setOn">setOn()</link> D-Bus method.
27396 *
27397 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call led_complete_set_on() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
27398 *
27399 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
27400 */
27401 g_signal_new ("handle-set-on",
27402 G_TYPE_FROM_INTERFACE (iface),
27403 G_SIGNAL_RUN_LAST,
27404 G_STRUCT_OFFSET (LedIface, handle_set_on),
27405 g_signal_accumulator_true_handled,
27406 NULL,
27407 g_cclosure_marshal_generic,
27408 G_TYPE_BOOLEAN,
27409 1,
27410 G_TYPE_DBUS_METHOD_INVOCATION);
27411
27412 /**
27413 * Led::handle-set-off:
27414 * @object: A #Led.
27415 * @invocation: A #GDBusMethodInvocation.
27416 *
27417 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setOff">setOff()</link> D-Bus method.
27418 *
27419 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call led_complete_set_off() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
27420 *
27421 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
27422 */
27423 g_signal_new ("handle-set-off",
27424 G_TYPE_FROM_INTERFACE (iface),
27425 G_SIGNAL_RUN_LAST,
27426 G_STRUCT_OFFSET (LedIface, handle_set_off),
27427 g_signal_accumulator_true_handled,
27428 NULL,
27429 g_cclosure_marshal_generic,
27430 G_TYPE_BOOLEAN,
27431 1,
27432 G_TYPE_DBUS_METHOD_INVOCATION);
27433
27434 /**
27435 * Led::handle-set-blink-slow:
27436 * @object: A #Led.
27437 * @invocation: A #GDBusMethodInvocation.
27438 *
27439 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setBlinkSlow">setBlinkSlow()</link> D-Bus method.
27440 *
27441 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call led_complete_set_blink_slow() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
27442 *
27443 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
27444 */
27445 g_signal_new ("handle-set-blink-slow",
27446 G_TYPE_FROM_INTERFACE (iface),
27447 G_SIGNAL_RUN_LAST,
27448 G_STRUCT_OFFSET (LedIface, handle_set_blink_slow),
27449 g_signal_accumulator_true_handled,
27450 NULL,
27451 g_cclosure_marshal_generic,
27452 G_TYPE_BOOLEAN,
27453 1,
27454 G_TYPE_DBUS_METHOD_INVOCATION);
27455
27456 /**
27457 * Led::handle-set-blink-fast:
27458 * @object: A #Led.
27459 * @invocation: A #GDBusMethodInvocation.
27460 *
27461 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setBlinkFast">setBlinkFast()</link> D-Bus method.
27462 *
27463 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call led_complete_set_blink_fast() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
27464 *
27465 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
27466 */
27467 g_signal_new ("handle-set-blink-fast",
27468 G_TYPE_FROM_INTERFACE (iface),
27469 G_SIGNAL_RUN_LAST,
27470 G_STRUCT_OFFSET (LedIface, handle_set_blink_fast),
27471 g_signal_accumulator_true_handled,
27472 NULL,
27473 g_cclosure_marshal_generic,
27474 G_TYPE_BOOLEAN,
27475 1,
27476 G_TYPE_DBUS_METHOD_INVOCATION);
27477
27478 /* GObject properties for D-Bus properties: */
27479 /**
27480 * Led:color:
27481 *
27482 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Led.color">"color"</link>.
27483 *
27484 * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.
27485 */
27486 g_object_interface_install_property (iface,
27487 g_param_spec_int ("color", "color", "color", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
27488 /**
27489 * Led:function:
27490 *
27491 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link>.
27492 *
27493 * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.
27494 */
27495 g_object_interface_install_property (iface,
27496 g_param_spec_string ("function", "function", "function", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Norman James493996c2015-10-31 17:27:13 -050027497 /**
27498 * Led:state:
27499 *
27500 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Led.state">"state"</link>.
27501 *
27502 * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.
27503 */
27504 g_object_interface_install_property (iface,
27505 g_param_spec_string ("state", "state", "state", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Norman James362a80f2015-09-14 14:04:39 -050027506}
27507
27508/**
27509 * led_get_color: (skip)
27510 * @object: A #Led.
27511 *
27512 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Led.color">"color"</link> D-Bus property.
27513 *
27514 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
27515 *
27516 * Returns: The property value.
27517 */
27518gint
27519led_get_color (Led *object)
27520{
27521 return LED_GET_IFACE (object)->get_color (object);
27522}
27523
27524/**
27525 * led_set_color: (skip)
27526 * @object: A #Led.
27527 * @value: The value to set.
27528 *
27529 * Sets the <link linkend="gdbus-property-org-openbmc-Led.color">"color"</link> D-Bus property to @value.
27530 *
27531 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
27532 */
27533void
27534led_set_color (Led *object, gint value)
27535{
27536 g_object_set (G_OBJECT (object), "color", value, NULL);
27537}
27538
27539/**
27540 * led_get_function: (skip)
27541 * @object: A #Led.
27542 *
27543 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link> D-Bus property.
27544 *
27545 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
27546 *
27547 * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use led_dup_function() if on another thread.</warning>
27548 *
27549 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
27550 */
27551const gchar *
27552led_get_function (Led *object)
27553{
27554 return LED_GET_IFACE (object)->get_function (object);
27555}
27556
27557/**
27558 * led_dup_function: (skip)
27559 * @object: A #Led.
27560 *
27561 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link> D-Bus property.
27562 *
27563 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
27564 *
27565 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
27566 */
27567gchar *
27568led_dup_function (Led *object)
27569{
27570 gchar *value;
27571 g_object_get (G_OBJECT (object), "function", &value, NULL);
27572 return value;
27573}
27574
27575/**
27576 * led_set_function: (skip)
27577 * @object: A #Led.
27578 * @value: The value to set.
27579 *
27580 * Sets the <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link> D-Bus property to @value.
27581 *
27582 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
27583 */
27584void
27585led_set_function (Led *object, const gchar *value)
27586{
27587 g_object_set (G_OBJECT (object), "function", value, NULL);
27588}
27589
27590/**
Norman James493996c2015-10-31 17:27:13 -050027591 * led_get_state: (skip)
27592 * @object: A #Led.
27593 *
27594 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Led.state">"state"</link> D-Bus property.
27595 *
27596 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
27597 *
27598 * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use led_dup_state() if on another thread.</warning>
27599 *
27600 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
27601 */
27602const gchar *
27603led_get_state (Led *object)
27604{
27605 return LED_GET_IFACE (object)->get_state (object);
27606}
27607
27608/**
27609 * led_dup_state: (skip)
27610 * @object: A #Led.
27611 *
27612 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Led.state">"state"</link> D-Bus property.
27613 *
27614 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
27615 *
27616 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
27617 */
27618gchar *
27619led_dup_state (Led *object)
27620{
27621 gchar *value;
27622 g_object_get (G_OBJECT (object), "state", &value, NULL);
27623 return value;
27624}
27625
27626/**
27627 * led_set_state: (skip)
27628 * @object: A #Led.
27629 * @value: The value to set.
27630 *
27631 * Sets the <link linkend="gdbus-property-org-openbmc-Led.state">"state"</link> D-Bus property to @value.
27632 *
27633 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
27634 */
27635void
27636led_set_state (Led *object, const gchar *value)
27637{
27638 g_object_set (G_OBJECT (object), "state", value, NULL);
27639}
27640
27641/**
Norman James362a80f2015-09-14 14:04:39 -050027642 * led_call_set_on:
27643 * @proxy: A #LedProxy.
27644 * @cancellable: (allow-none): A #GCancellable or %NULL.
27645 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
27646 * @user_data: User data to pass to @callback.
27647 *
27648 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setOn">setOn()</link> D-Bus method on @proxy.
27649 * 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.
27650 * You can then call led_call_set_on_finish() to get the result of the operation.
27651 *
27652 * See led_call_set_on_sync() for the synchronous, blocking version of this method.
27653 */
27654void
27655led_call_set_on (
27656 Led *proxy,
27657 GCancellable *cancellable,
27658 GAsyncReadyCallback callback,
27659 gpointer user_data)
27660{
27661 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
27662 "setOn",
27663 g_variant_new ("()"),
27664 G_DBUS_CALL_FLAGS_NONE,
27665 -1,
27666 cancellable,
27667 callback,
27668 user_data);
27669}
27670
27671/**
27672 * led_call_set_on_finish:
27673 * @proxy: A #LedProxy.
27674 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_on().
27675 * @error: Return location for error or %NULL.
27676 *
27677 * Finishes an operation started with led_call_set_on().
27678 *
27679 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
27680 */
27681gboolean
27682led_call_set_on_finish (
27683 Led *proxy,
27684 GAsyncResult *res,
27685 GError **error)
27686{
27687 GVariant *_ret;
27688 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
27689 if (_ret == NULL)
27690 goto _out;
27691 g_variant_get (_ret,
27692 "()");
27693 g_variant_unref (_ret);
27694_out:
27695 return _ret != NULL;
27696}
27697
27698/**
27699 * led_call_set_on_sync:
27700 * @proxy: A #LedProxy.
27701 * @cancellable: (allow-none): A #GCancellable or %NULL.
27702 * @error: Return location for error or %NULL.
27703 *
27704 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setOn">setOn()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
27705 *
27706 * See led_call_set_on() for the asynchronous version of this method.
27707 *
27708 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
27709 */
27710gboolean
27711led_call_set_on_sync (
27712 Led *proxy,
27713 GCancellable *cancellable,
27714 GError **error)
27715{
27716 GVariant *_ret;
27717 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
27718 "setOn",
27719 g_variant_new ("()"),
27720 G_DBUS_CALL_FLAGS_NONE,
27721 -1,
27722 cancellable,
27723 error);
27724 if (_ret == NULL)
27725 goto _out;
27726 g_variant_get (_ret,
27727 "()");
27728 g_variant_unref (_ret);
27729_out:
27730 return _ret != NULL;
27731}
27732
27733/**
27734 * led_call_set_off:
27735 * @proxy: A #LedProxy.
27736 * @cancellable: (allow-none): A #GCancellable or %NULL.
27737 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
27738 * @user_data: User data to pass to @callback.
27739 *
27740 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setOff">setOff()</link> D-Bus method on @proxy.
27741 * 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.
27742 * You can then call led_call_set_off_finish() to get the result of the operation.
27743 *
27744 * See led_call_set_off_sync() for the synchronous, blocking version of this method.
27745 */
27746void
27747led_call_set_off (
27748 Led *proxy,
27749 GCancellable *cancellable,
27750 GAsyncReadyCallback callback,
27751 gpointer user_data)
27752{
27753 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
27754 "setOff",
27755 g_variant_new ("()"),
27756 G_DBUS_CALL_FLAGS_NONE,
27757 -1,
27758 cancellable,
27759 callback,
27760 user_data);
27761}
27762
27763/**
27764 * led_call_set_off_finish:
27765 * @proxy: A #LedProxy.
27766 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_off().
27767 * @error: Return location for error or %NULL.
27768 *
27769 * Finishes an operation started with led_call_set_off().
27770 *
27771 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
27772 */
27773gboolean
27774led_call_set_off_finish (
27775 Led *proxy,
27776 GAsyncResult *res,
27777 GError **error)
27778{
27779 GVariant *_ret;
27780 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
27781 if (_ret == NULL)
27782 goto _out;
27783 g_variant_get (_ret,
27784 "()");
27785 g_variant_unref (_ret);
27786_out:
27787 return _ret != NULL;
27788}
27789
27790/**
27791 * led_call_set_off_sync:
27792 * @proxy: A #LedProxy.
27793 * @cancellable: (allow-none): A #GCancellable or %NULL.
27794 * @error: Return location for error or %NULL.
27795 *
27796 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setOff">setOff()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
27797 *
27798 * See led_call_set_off() for the asynchronous version of this method.
27799 *
27800 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
27801 */
27802gboolean
27803led_call_set_off_sync (
27804 Led *proxy,
27805 GCancellable *cancellable,
27806 GError **error)
27807{
27808 GVariant *_ret;
27809 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
27810 "setOff",
27811 g_variant_new ("()"),
27812 G_DBUS_CALL_FLAGS_NONE,
27813 -1,
27814 cancellable,
27815 error);
27816 if (_ret == NULL)
27817 goto _out;
27818 g_variant_get (_ret,
27819 "()");
27820 g_variant_unref (_ret);
27821_out:
27822 return _ret != NULL;
27823}
27824
27825/**
27826 * led_call_set_blink_slow:
27827 * @proxy: A #LedProxy.
27828 * @cancellable: (allow-none): A #GCancellable or %NULL.
27829 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
27830 * @user_data: User data to pass to @callback.
27831 *
27832 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setBlinkSlow">setBlinkSlow()</link> D-Bus method on @proxy.
27833 * 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.
27834 * You can then call led_call_set_blink_slow_finish() to get the result of the operation.
27835 *
27836 * See led_call_set_blink_slow_sync() for the synchronous, blocking version of this method.
27837 */
27838void
27839led_call_set_blink_slow (
27840 Led *proxy,
27841 GCancellable *cancellable,
27842 GAsyncReadyCallback callback,
27843 gpointer user_data)
27844{
27845 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
27846 "setBlinkSlow",
27847 g_variant_new ("()"),
27848 G_DBUS_CALL_FLAGS_NONE,
27849 -1,
27850 cancellable,
27851 callback,
27852 user_data);
27853}
27854
27855/**
27856 * led_call_set_blink_slow_finish:
27857 * @proxy: A #LedProxy.
27858 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_blink_slow().
27859 * @error: Return location for error or %NULL.
27860 *
27861 * Finishes an operation started with led_call_set_blink_slow().
27862 *
27863 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
27864 */
27865gboolean
27866led_call_set_blink_slow_finish (
27867 Led *proxy,
27868 GAsyncResult *res,
27869 GError **error)
27870{
27871 GVariant *_ret;
27872 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
27873 if (_ret == NULL)
27874 goto _out;
27875 g_variant_get (_ret,
27876 "()");
27877 g_variant_unref (_ret);
27878_out:
27879 return _ret != NULL;
27880}
27881
27882/**
27883 * led_call_set_blink_slow_sync:
27884 * @proxy: A #LedProxy.
27885 * @cancellable: (allow-none): A #GCancellable or %NULL.
27886 * @error: Return location for error or %NULL.
27887 *
27888 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setBlinkSlow">setBlinkSlow()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
27889 *
27890 * See led_call_set_blink_slow() for the asynchronous version of this method.
27891 *
27892 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
27893 */
27894gboolean
27895led_call_set_blink_slow_sync (
27896 Led *proxy,
27897 GCancellable *cancellable,
27898 GError **error)
27899{
27900 GVariant *_ret;
27901 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
27902 "setBlinkSlow",
27903 g_variant_new ("()"),
27904 G_DBUS_CALL_FLAGS_NONE,
27905 -1,
27906 cancellable,
27907 error);
27908 if (_ret == NULL)
27909 goto _out;
27910 g_variant_get (_ret,
27911 "()");
27912 g_variant_unref (_ret);
27913_out:
27914 return _ret != NULL;
27915}
27916
27917/**
27918 * led_call_set_blink_fast:
27919 * @proxy: A #LedProxy.
27920 * @cancellable: (allow-none): A #GCancellable or %NULL.
27921 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
27922 * @user_data: User data to pass to @callback.
27923 *
27924 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setBlinkFast">setBlinkFast()</link> D-Bus method on @proxy.
27925 * 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.
27926 * You can then call led_call_set_blink_fast_finish() to get the result of the operation.
27927 *
27928 * See led_call_set_blink_fast_sync() for the synchronous, blocking version of this method.
27929 */
27930void
27931led_call_set_blink_fast (
27932 Led *proxy,
27933 GCancellable *cancellable,
27934 GAsyncReadyCallback callback,
27935 gpointer user_data)
27936{
27937 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
27938 "setBlinkFast",
27939 g_variant_new ("()"),
27940 G_DBUS_CALL_FLAGS_NONE,
27941 -1,
27942 cancellable,
27943 callback,
27944 user_data);
27945}
27946
27947/**
27948 * led_call_set_blink_fast_finish:
27949 * @proxy: A #LedProxy.
27950 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_blink_fast().
27951 * @error: Return location for error or %NULL.
27952 *
27953 * Finishes an operation started with led_call_set_blink_fast().
27954 *
27955 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
27956 */
27957gboolean
27958led_call_set_blink_fast_finish (
27959 Led *proxy,
27960 GAsyncResult *res,
27961 GError **error)
27962{
27963 GVariant *_ret;
27964 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
27965 if (_ret == NULL)
27966 goto _out;
27967 g_variant_get (_ret,
27968 "()");
27969 g_variant_unref (_ret);
27970_out:
27971 return _ret != NULL;
27972}
27973
27974/**
27975 * led_call_set_blink_fast_sync:
27976 * @proxy: A #LedProxy.
27977 * @cancellable: (allow-none): A #GCancellable or %NULL.
27978 * @error: Return location for error or %NULL.
27979 *
27980 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setBlinkFast">setBlinkFast()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
27981 *
27982 * See led_call_set_blink_fast() for the asynchronous version of this method.
27983 *
27984 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
27985 */
27986gboolean
27987led_call_set_blink_fast_sync (
27988 Led *proxy,
27989 GCancellable *cancellable,
27990 GError **error)
27991{
27992 GVariant *_ret;
27993 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
27994 "setBlinkFast",
27995 g_variant_new ("()"),
27996 G_DBUS_CALL_FLAGS_NONE,
27997 -1,
27998 cancellable,
27999 error);
28000 if (_ret == NULL)
28001 goto _out;
28002 g_variant_get (_ret,
28003 "()");
28004 g_variant_unref (_ret);
28005_out:
28006 return _ret != NULL;
28007}
28008
28009/**
28010 * led_complete_set_on:
28011 * @object: A #Led.
28012 * @invocation: (transfer full): A #GDBusMethodInvocation.
28013 *
28014 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Led.setOn">setOn()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
28015 *
28016 * This method will free @invocation, you cannot use it afterwards.
28017 */
28018void
28019led_complete_set_on (
28020 Led *object,
28021 GDBusMethodInvocation *invocation)
28022{
28023 g_dbus_method_invocation_return_value (invocation,
28024 g_variant_new ("()"));
28025}
28026
28027/**
28028 * led_complete_set_off:
28029 * @object: A #Led.
28030 * @invocation: (transfer full): A #GDBusMethodInvocation.
28031 *
28032 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Led.setOff">setOff()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
28033 *
28034 * This method will free @invocation, you cannot use it afterwards.
28035 */
28036void
28037led_complete_set_off (
28038 Led *object,
28039 GDBusMethodInvocation *invocation)
28040{
28041 g_dbus_method_invocation_return_value (invocation,
28042 g_variant_new ("()"));
28043}
28044
28045/**
28046 * led_complete_set_blink_slow:
28047 * @object: A #Led.
28048 * @invocation: (transfer full): A #GDBusMethodInvocation.
28049 *
28050 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Led.setBlinkSlow">setBlinkSlow()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
28051 *
28052 * This method will free @invocation, you cannot use it afterwards.
28053 */
28054void
28055led_complete_set_blink_slow (
28056 Led *object,
28057 GDBusMethodInvocation *invocation)
28058{
28059 g_dbus_method_invocation_return_value (invocation,
28060 g_variant_new ("()"));
28061}
28062
28063/**
28064 * led_complete_set_blink_fast:
28065 * @object: A #Led.
28066 * @invocation: (transfer full): A #GDBusMethodInvocation.
28067 *
28068 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Led.setBlinkFast">setBlinkFast()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
28069 *
28070 * This method will free @invocation, you cannot use it afterwards.
28071 */
28072void
28073led_complete_set_blink_fast (
28074 Led *object,
28075 GDBusMethodInvocation *invocation)
28076{
28077 g_dbus_method_invocation_return_value (invocation,
28078 g_variant_new ("()"));
28079}
28080
28081/* ------------------------------------------------------------------------ */
28082
28083/**
28084 * LedProxy:
28085 *
28086 * The #LedProxy structure contains only private data and should only be accessed using the provided API.
28087 */
28088
28089/**
28090 * LedProxyClass:
28091 * @parent_class: The parent class.
28092 *
28093 * Class structure for #LedProxy.
28094 */
28095
28096struct _LedProxyPrivate
28097{
28098 GData *qdata;
28099};
28100
28101static void led_proxy_iface_init (LedIface *iface);
28102
28103#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
28104G_DEFINE_TYPE_WITH_CODE (LedProxy, led_proxy, G_TYPE_DBUS_PROXY,
28105 G_ADD_PRIVATE (LedProxy)
28106 G_IMPLEMENT_INTERFACE (TYPE_LED, led_proxy_iface_init));
28107
28108#else
28109G_DEFINE_TYPE_WITH_CODE (LedProxy, led_proxy, G_TYPE_DBUS_PROXY,
28110 G_IMPLEMENT_INTERFACE (TYPE_LED, led_proxy_iface_init));
28111
28112#endif
28113static void
28114led_proxy_finalize (GObject *object)
28115{
28116 LedProxy *proxy = LED_PROXY (object);
28117 g_datalist_clear (&proxy->priv->qdata);
28118 G_OBJECT_CLASS (led_proxy_parent_class)->finalize (object);
28119}
28120
28121static void
28122led_proxy_get_property (GObject *object,
28123 guint prop_id,
28124 GValue *value,
28125 GParamSpec *pspec G_GNUC_UNUSED)
28126{
28127 const _ExtendedGDBusPropertyInfo *info;
28128 GVariant *variant;
Norman James493996c2015-10-31 17:27:13 -050028129 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -050028130 info = _led_property_info_pointers[prop_id - 1];
28131 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
28132 if (info->use_gvariant)
28133 {
28134 g_value_set_variant (value, variant);
28135 }
28136 else
28137 {
28138 if (variant != NULL)
28139 g_dbus_gvariant_to_gvalue (variant, value);
28140 }
28141 if (variant != NULL)
28142 g_variant_unref (variant);
28143}
28144
28145static void
28146led_proxy_set_property_cb (GDBusProxy *proxy,
28147 GAsyncResult *res,
28148 gpointer user_data)
28149{
28150 const _ExtendedGDBusPropertyInfo *info = user_data;
28151 GError *error;
28152 GVariant *_ret;
28153 error = NULL;
28154 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
28155 if (!_ret)
28156 {
28157 g_warning ("Error setting property '%s' on interface org.openbmc.Led: %s (%s, %d)",
28158 info->parent_struct.name,
28159 error->message, g_quark_to_string (error->domain), error->code);
28160 g_error_free (error);
28161 }
28162 else
28163 {
28164 g_variant_unref (_ret);
28165 }
28166}
28167
28168static void
28169led_proxy_set_property (GObject *object,
28170 guint prop_id,
28171 const GValue *value,
28172 GParamSpec *pspec G_GNUC_UNUSED)
28173{
28174 const _ExtendedGDBusPropertyInfo *info;
28175 GVariant *variant;
Norman James493996c2015-10-31 17:27:13 -050028176 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -050028177 info = _led_property_info_pointers[prop_id - 1];
28178 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
28179 g_dbus_proxy_call (G_DBUS_PROXY (object),
28180 "org.freedesktop.DBus.Properties.Set",
28181 g_variant_new ("(ssv)", "org.openbmc.Led", info->parent_struct.name, variant),
28182 G_DBUS_CALL_FLAGS_NONE,
28183 -1,
28184 NULL, (GAsyncReadyCallback) led_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
28185 g_variant_unref (variant);
28186}
28187
28188static void
28189led_proxy_g_signal (GDBusProxy *proxy,
28190 const gchar *sender_name G_GNUC_UNUSED,
28191 const gchar *signal_name,
28192 GVariant *parameters)
28193{
28194 _ExtendedGDBusSignalInfo *info;
28195 GVariantIter iter;
28196 GVariant *child;
28197 GValue *paramv;
28198 guint num_params;
28199 guint n;
28200 guint signal_id;
28201 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, signal_name);
28202 if (info == NULL)
28203 return;
28204 num_params = g_variant_n_children (parameters);
28205 paramv = g_new0 (GValue, num_params + 1);
28206 g_value_init (&paramv[0], TYPE_LED);
28207 g_value_set_object (&paramv[0], proxy);
28208 g_variant_iter_init (&iter, parameters);
28209 n = 1;
28210 while ((child = g_variant_iter_next_value (&iter)) != NULL)
28211 {
28212 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
28213 if (arg_info->use_gvariant)
28214 {
28215 g_value_init (&paramv[n], G_TYPE_VARIANT);
28216 g_value_set_variant (&paramv[n], child);
28217 n++;
28218 }
28219 else
28220 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
28221 g_variant_unref (child);
28222 }
28223 signal_id = g_signal_lookup (info->signal_name, TYPE_LED);
28224 g_signal_emitv (paramv, signal_id, 0, NULL);
28225 for (n = 0; n < num_params + 1; n++)
28226 g_value_unset (&paramv[n]);
28227 g_free (paramv);
28228}
28229
28230static void
28231led_proxy_g_properties_changed (GDBusProxy *_proxy,
28232 GVariant *changed_properties,
28233 const gchar *const *invalidated_properties)
28234{
28235 LedProxy *proxy = LED_PROXY (_proxy);
28236 guint n;
28237 const gchar *key;
28238 GVariantIter *iter;
28239 _ExtendedGDBusPropertyInfo *info;
28240 g_variant_get (changed_properties, "a{sv}", &iter);
28241 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
28242 {
28243 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, key);
28244 g_datalist_remove_data (&proxy->priv->qdata, key);
28245 if (info != NULL)
28246 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
28247 }
28248 g_variant_iter_free (iter);
28249 for (n = 0; invalidated_properties[n] != NULL; n++)
28250 {
28251 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, invalidated_properties[n]);
28252 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
28253 if (info != NULL)
28254 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
28255 }
28256}
28257
28258static gint
28259led_proxy_get_color (Led *object)
28260{
28261 LedProxy *proxy = LED_PROXY (object);
28262 GVariant *variant;
28263 gint value = 0;
28264 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "color");
28265 if (variant != NULL)
28266 {
28267 value = g_variant_get_int32 (variant);
28268 g_variant_unref (variant);
28269 }
28270 return value;
28271}
28272
28273static const gchar *
28274led_proxy_get_function (Led *object)
28275{
28276 LedProxy *proxy = LED_PROXY (object);
28277 GVariant *variant;
28278 const gchar *value = NULL;
28279 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "function");
28280 if (variant != NULL)
28281 {
28282 value = g_variant_get_string (variant, NULL);
28283 g_variant_unref (variant);
28284 }
28285 return value;
28286}
28287
Norman James493996c2015-10-31 17:27:13 -050028288static const gchar *
28289led_proxy_get_state (Led *object)
28290{
28291 LedProxy *proxy = LED_PROXY (object);
28292 GVariant *variant;
28293 const gchar *value = NULL;
28294 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state");
28295 if (variant != NULL)
28296 {
28297 value = g_variant_get_string (variant, NULL);
28298 g_variant_unref (variant);
28299 }
28300 return value;
28301}
28302
Norman James362a80f2015-09-14 14:04:39 -050028303static void
28304led_proxy_init (LedProxy *proxy)
28305{
28306#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
28307 proxy->priv = led_proxy_get_instance_private (proxy);
28308#else
28309 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_LED_PROXY, LedProxyPrivate);
28310#endif
28311
28312 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), led_interface_info ());
28313}
28314
28315static void
28316led_proxy_class_init (LedProxyClass *klass)
28317{
28318 GObjectClass *gobject_class;
28319 GDBusProxyClass *proxy_class;
28320
28321 gobject_class = G_OBJECT_CLASS (klass);
28322 gobject_class->finalize = led_proxy_finalize;
28323 gobject_class->get_property = led_proxy_get_property;
28324 gobject_class->set_property = led_proxy_set_property;
28325
28326 proxy_class = G_DBUS_PROXY_CLASS (klass);
28327 proxy_class->g_signal = led_proxy_g_signal;
28328 proxy_class->g_properties_changed = led_proxy_g_properties_changed;
28329
28330 led_override_properties (gobject_class, 1);
28331
28332#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
28333 g_type_class_add_private (klass, sizeof (LedProxyPrivate));
28334#endif
28335}
28336
28337static void
28338led_proxy_iface_init (LedIface *iface)
28339{
28340 iface->get_color = led_proxy_get_color;
28341 iface->get_function = led_proxy_get_function;
Norman James493996c2015-10-31 17:27:13 -050028342 iface->get_state = led_proxy_get_state;
Norman James362a80f2015-09-14 14:04:39 -050028343}
28344
28345/**
28346 * led_proxy_new:
28347 * @connection: A #GDBusConnection.
28348 * @flags: Flags from the #GDBusProxyFlags enumeration.
28349 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
28350 * @object_path: An object path.
28351 * @cancellable: (allow-none): A #GCancellable or %NULL.
28352 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
28353 * @user_data: User data to pass to @callback.
28354 *
28355 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>. See g_dbus_proxy_new() for more details.
28356 *
28357 * 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.
28358 * You can then call led_proxy_new_finish() to get the result of the operation.
28359 *
28360 * See led_proxy_new_sync() for the synchronous, blocking version of this constructor.
28361 */
28362void
28363led_proxy_new (
28364 GDBusConnection *connection,
28365 GDBusProxyFlags flags,
28366 const gchar *name,
28367 const gchar *object_path,
28368 GCancellable *cancellable,
28369 GAsyncReadyCallback callback,
28370 gpointer user_data)
28371{
28372 g_async_initable_new_async (TYPE_LED_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.Led", NULL);
28373}
28374
28375/**
28376 * led_proxy_new_finish:
28377 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_proxy_new().
28378 * @error: Return location for error or %NULL
28379 *
28380 * Finishes an operation started with led_proxy_new().
28381 *
28382 * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set.
28383 */
28384Led *
28385led_proxy_new_finish (
28386 GAsyncResult *res,
28387 GError **error)
28388{
28389 GObject *ret;
28390 GObject *source_object;
28391 source_object = g_async_result_get_source_object (res);
28392 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
28393 g_object_unref (source_object);
28394 if (ret != NULL)
28395 return LED (ret);
28396 else
28397 return NULL;
28398}
28399
28400/**
28401 * led_proxy_new_sync:
28402 * @connection: A #GDBusConnection.
28403 * @flags: Flags from the #GDBusProxyFlags enumeration.
28404 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
28405 * @object_path: An object path.
28406 * @cancellable: (allow-none): A #GCancellable or %NULL.
28407 * @error: Return location for error or %NULL
28408 *
28409 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>. See g_dbus_proxy_new_sync() for more details.
28410 *
28411 * The calling thread is blocked until a reply is received.
28412 *
28413 * See led_proxy_new() for the asynchronous version of this constructor.
28414 *
28415 * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set.
28416 */
28417Led *
28418led_proxy_new_sync (
28419 GDBusConnection *connection,
28420 GDBusProxyFlags flags,
28421 const gchar *name,
28422 const gchar *object_path,
28423 GCancellable *cancellable,
28424 GError **error)
28425{
28426 GInitable *ret;
28427 ret = g_initable_new (TYPE_LED_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.Led", NULL);
28428 if (ret != NULL)
28429 return LED (ret);
28430 else
28431 return NULL;
28432}
28433
28434
28435/**
28436 * led_proxy_new_for_bus:
28437 * @bus_type: A #GBusType.
28438 * @flags: Flags from the #GDBusProxyFlags enumeration.
28439 * @name: A bus name (well-known or unique).
28440 * @object_path: An object path.
28441 * @cancellable: (allow-none): A #GCancellable or %NULL.
28442 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
28443 * @user_data: User data to pass to @callback.
28444 *
28445 * Like led_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
28446 *
28447 * 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.
28448 * You can then call led_proxy_new_for_bus_finish() to get the result of the operation.
28449 *
28450 * See led_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
28451 */
28452void
28453led_proxy_new_for_bus (
28454 GBusType bus_type,
28455 GDBusProxyFlags flags,
28456 const gchar *name,
28457 const gchar *object_path,
28458 GCancellable *cancellable,
28459 GAsyncReadyCallback callback,
28460 gpointer user_data)
28461{
28462 g_async_initable_new_async (TYPE_LED_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.Led", NULL);
28463}
28464
28465/**
28466 * led_proxy_new_for_bus_finish:
28467 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_proxy_new_for_bus().
28468 * @error: Return location for error or %NULL
28469 *
28470 * Finishes an operation started with led_proxy_new_for_bus().
28471 *
28472 * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set.
28473 */
28474Led *
28475led_proxy_new_for_bus_finish (
28476 GAsyncResult *res,
28477 GError **error)
28478{
28479 GObject *ret;
28480 GObject *source_object;
28481 source_object = g_async_result_get_source_object (res);
28482 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
28483 g_object_unref (source_object);
28484 if (ret != NULL)
28485 return LED (ret);
28486 else
28487 return NULL;
28488}
28489
28490/**
28491 * led_proxy_new_for_bus_sync:
28492 * @bus_type: A #GBusType.
28493 * @flags: Flags from the #GDBusProxyFlags enumeration.
28494 * @name: A bus name (well-known or unique).
28495 * @object_path: An object path.
28496 * @cancellable: (allow-none): A #GCancellable or %NULL.
28497 * @error: Return location for error or %NULL
28498 *
28499 * Like led_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
28500 *
28501 * The calling thread is blocked until a reply is received.
28502 *
28503 * See led_proxy_new_for_bus() for the asynchronous version of this constructor.
28504 *
28505 * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set.
28506 */
28507Led *
28508led_proxy_new_for_bus_sync (
28509 GBusType bus_type,
28510 GDBusProxyFlags flags,
28511 const gchar *name,
28512 const gchar *object_path,
28513 GCancellable *cancellable,
28514 GError **error)
28515{
28516 GInitable *ret;
28517 ret = g_initable_new (TYPE_LED_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.Led", NULL);
28518 if (ret != NULL)
28519 return LED (ret);
28520 else
28521 return NULL;
28522}
28523
28524
28525/* ------------------------------------------------------------------------ */
28526
28527/**
28528 * LedSkeleton:
28529 *
28530 * The #LedSkeleton structure contains only private data and should only be accessed using the provided API.
28531 */
28532
28533/**
28534 * LedSkeletonClass:
28535 * @parent_class: The parent class.
28536 *
28537 * Class structure for #LedSkeleton.
28538 */
28539
28540struct _LedSkeletonPrivate
28541{
28542 GValue *properties;
28543 GList *changed_properties;
28544 GSource *changed_properties_idle_source;
28545 GMainContext *context;
28546 GMutex lock;
28547};
28548
28549static void
28550_led_skeleton_handle_method_call (
28551 GDBusConnection *connection G_GNUC_UNUSED,
28552 const gchar *sender G_GNUC_UNUSED,
28553 const gchar *object_path G_GNUC_UNUSED,
28554 const gchar *interface_name,
28555 const gchar *method_name,
28556 GVariant *parameters,
28557 GDBusMethodInvocation *invocation,
28558 gpointer user_data)
28559{
28560 LedSkeleton *skeleton = LED_SKELETON (user_data);
28561 _ExtendedGDBusMethodInfo *info;
28562 GVariantIter iter;
28563 GVariant *child;
28564 GValue *paramv;
28565 guint num_params;
28566 guint num_extra;
28567 guint n;
28568 guint signal_id;
28569 GValue return_value = G_VALUE_INIT;
28570 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
28571 g_assert (info != NULL);
28572 num_params = g_variant_n_children (parameters);
28573 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
28574 n = 0;
28575 g_value_init (&paramv[n], TYPE_LED);
28576 g_value_set_object (&paramv[n++], skeleton);
28577 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
28578 g_value_set_object (&paramv[n++], invocation);
28579 if (info->pass_fdlist)
28580 {
28581#ifdef G_OS_UNIX
28582 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
28583 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
28584#else
28585 g_assert_not_reached ();
28586#endif
28587 }
28588 g_variant_iter_init (&iter, parameters);
28589 while ((child = g_variant_iter_next_value (&iter)) != NULL)
28590 {
28591 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
28592 if (arg_info->use_gvariant)
28593 {
28594 g_value_init (&paramv[n], G_TYPE_VARIANT);
28595 g_value_set_variant (&paramv[n], child);
28596 n++;
28597 }
28598 else
28599 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
28600 g_variant_unref (child);
28601 }
28602 signal_id = g_signal_lookup (info->signal_name, TYPE_LED);
28603 g_value_init (&return_value, G_TYPE_BOOLEAN);
28604 g_signal_emitv (paramv, signal_id, 0, &return_value);
28605 if (!g_value_get_boolean (&return_value))
28606 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);
28607 g_value_unset (&return_value);
28608 for (n = 0; n < num_params + num_extra; n++)
28609 g_value_unset (&paramv[n]);
28610 g_free (paramv);
28611}
28612
28613static GVariant *
28614_led_skeleton_handle_get_property (
28615 GDBusConnection *connection G_GNUC_UNUSED,
28616 const gchar *sender G_GNUC_UNUSED,
28617 const gchar *object_path G_GNUC_UNUSED,
28618 const gchar *interface_name G_GNUC_UNUSED,
28619 const gchar *property_name,
28620 GError **error,
28621 gpointer user_data)
28622{
28623 LedSkeleton *skeleton = LED_SKELETON (user_data);
28624 GValue value = G_VALUE_INIT;
28625 GParamSpec *pspec;
28626 _ExtendedGDBusPropertyInfo *info;
28627 GVariant *ret;
28628 ret = NULL;
28629 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, property_name);
28630 g_assert (info != NULL);
28631 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
28632 if (pspec == NULL)
28633 {
28634 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
28635 }
28636 else
28637 {
28638 g_value_init (&value, pspec->value_type);
28639 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
28640 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
28641 g_value_unset (&value);
28642 }
28643 return ret;
28644}
28645
28646static gboolean
28647_led_skeleton_handle_set_property (
28648 GDBusConnection *connection G_GNUC_UNUSED,
28649 const gchar *sender G_GNUC_UNUSED,
28650 const gchar *object_path G_GNUC_UNUSED,
28651 const gchar *interface_name G_GNUC_UNUSED,
28652 const gchar *property_name,
28653 GVariant *variant,
28654 GError **error,
28655 gpointer user_data)
28656{
28657 LedSkeleton *skeleton = LED_SKELETON (user_data);
28658 GValue value = G_VALUE_INIT;
28659 GParamSpec *pspec;
28660 _ExtendedGDBusPropertyInfo *info;
28661 gboolean ret;
28662 ret = FALSE;
28663 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, property_name);
28664 g_assert (info != NULL);
28665 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
28666 if (pspec == NULL)
28667 {
28668 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
28669 }
28670 else
28671 {
28672 if (info->use_gvariant)
28673 g_value_set_variant (&value, variant);
28674 else
28675 g_dbus_gvariant_to_gvalue (variant, &value);
28676 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
28677 g_value_unset (&value);
28678 ret = TRUE;
28679 }
28680 return ret;
28681}
28682
28683static const GDBusInterfaceVTable _led_skeleton_vtable =
28684{
28685 _led_skeleton_handle_method_call,
28686 _led_skeleton_handle_get_property,
28687 _led_skeleton_handle_set_property,
28688 {NULL}
28689};
28690
28691static GDBusInterfaceInfo *
28692led_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
28693{
28694 return led_interface_info ();
28695}
28696
28697static GDBusInterfaceVTable *
28698led_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
28699{
28700 return (GDBusInterfaceVTable *) &_led_skeleton_vtable;
28701}
28702
28703static GVariant *
28704led_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
28705{
28706 LedSkeleton *skeleton = LED_SKELETON (_skeleton);
28707
28708 GVariantBuilder builder;
28709 guint n;
28710 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
28711 if (_led_interface_info.parent_struct.properties == NULL)
28712 goto out;
28713 for (n = 0; _led_interface_info.parent_struct.properties[n] != NULL; n++)
28714 {
28715 GDBusPropertyInfo *info = _led_interface_info.parent_struct.properties[n];
28716 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
28717 {
28718 GVariant *value;
28719 value = _led_skeleton_handle_get_property (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Led", info->name, NULL, skeleton);
28720 if (value != NULL)
28721 {
28722 g_variant_take_ref (value);
28723 g_variant_builder_add (&builder, "{sv}", info->name, value);
28724 g_variant_unref (value);
28725 }
28726 }
28727 }
28728out:
28729 return g_variant_builder_end (&builder);
28730}
28731
28732static gboolean _led_emit_changed (gpointer user_data);
28733
28734static void
28735led_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
28736{
28737 LedSkeleton *skeleton = LED_SKELETON (_skeleton);
28738 gboolean emit_changed = FALSE;
28739
28740 g_mutex_lock (&skeleton->priv->lock);
28741 if (skeleton->priv->changed_properties_idle_source != NULL)
28742 {
28743 g_source_destroy (skeleton->priv->changed_properties_idle_source);
28744 skeleton->priv->changed_properties_idle_source = NULL;
28745 emit_changed = TRUE;
28746 }
28747 g_mutex_unlock (&skeleton->priv->lock);
28748
28749 if (emit_changed)
28750 _led_emit_changed (skeleton);
28751}
28752
28753static void led_skeleton_iface_init (LedIface *iface);
28754#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
28755G_DEFINE_TYPE_WITH_CODE (LedSkeleton, led_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
28756 G_ADD_PRIVATE (LedSkeleton)
28757 G_IMPLEMENT_INTERFACE (TYPE_LED, led_skeleton_iface_init));
28758
28759#else
28760G_DEFINE_TYPE_WITH_CODE (LedSkeleton, led_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
28761 G_IMPLEMENT_INTERFACE (TYPE_LED, led_skeleton_iface_init));
28762
28763#endif
28764static void
28765led_skeleton_finalize (GObject *object)
28766{
28767 LedSkeleton *skeleton = LED_SKELETON (object);
28768 guint n;
Norman James493996c2015-10-31 17:27:13 -050028769 for (n = 0; n < 3; n++)
Norman James362a80f2015-09-14 14:04:39 -050028770 g_value_unset (&skeleton->priv->properties[n]);
28771 g_free (skeleton->priv->properties);
28772 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
28773 if (skeleton->priv->changed_properties_idle_source != NULL)
28774 g_source_destroy (skeleton->priv->changed_properties_idle_source);
28775 g_main_context_unref (skeleton->priv->context);
28776 g_mutex_clear (&skeleton->priv->lock);
28777 G_OBJECT_CLASS (led_skeleton_parent_class)->finalize (object);
28778}
28779
28780static void
28781led_skeleton_get_property (GObject *object,
28782 guint prop_id,
28783 GValue *value,
28784 GParamSpec *pspec G_GNUC_UNUSED)
28785{
28786 LedSkeleton *skeleton = LED_SKELETON (object);
Norman James493996c2015-10-31 17:27:13 -050028787 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -050028788 g_mutex_lock (&skeleton->priv->lock);
28789 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
28790 g_mutex_unlock (&skeleton->priv->lock);
28791}
28792
28793static gboolean
28794_led_emit_changed (gpointer user_data)
28795{
28796 LedSkeleton *skeleton = LED_SKELETON (user_data);
28797 GList *l;
28798 GVariantBuilder builder;
28799 GVariantBuilder invalidated_builder;
28800 guint num_changes;
28801
28802 g_mutex_lock (&skeleton->priv->lock);
28803 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
28804 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
28805 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
28806 {
28807 ChangedProperty *cp = l->data;
28808 GVariant *variant;
28809 const GValue *cur_value;
28810
28811 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
28812 if (!_g_value_equal (cur_value, &cp->orig_value))
28813 {
28814 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
28815 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
28816 g_variant_unref (variant);
28817 num_changes++;
28818 }
28819 }
28820 if (num_changes > 0)
28821 {
28822 GList *connections, *ll;
28823 GVariant *signal_variant;
28824 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Led",
28825 &builder, &invalidated_builder));
28826 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
28827 for (ll = connections; ll != NULL; ll = ll->next)
28828 {
28829 GDBusConnection *connection = ll->data;
28830
28831 g_dbus_connection_emit_signal (connection,
28832 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
28833 "org.freedesktop.DBus.Properties",
28834 "PropertiesChanged",
28835 signal_variant,
28836 NULL);
28837 }
28838 g_variant_unref (signal_variant);
28839 g_list_free_full (connections, g_object_unref);
28840 }
28841 else
28842 {
28843 g_variant_builder_clear (&builder);
28844 g_variant_builder_clear (&invalidated_builder);
28845 }
28846 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
28847 skeleton->priv->changed_properties = NULL;
28848 skeleton->priv->changed_properties_idle_source = NULL;
28849 g_mutex_unlock (&skeleton->priv->lock);
28850 return FALSE;
28851}
28852
28853static void
28854_led_schedule_emit_changed (LedSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
28855{
28856 ChangedProperty *cp;
28857 GList *l;
28858 cp = NULL;
28859 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
28860 {
28861 ChangedProperty *i_cp = l->data;
28862 if (i_cp->info == info)
28863 {
28864 cp = i_cp;
28865 break;
28866 }
28867 }
28868 if (cp == NULL)
28869 {
28870 cp = g_new0 (ChangedProperty, 1);
28871 cp->prop_id = prop_id;
28872 cp->info = info;
28873 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
28874 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
28875 g_value_copy (orig_value, &cp->orig_value);
28876 }
28877}
28878
28879static void
28880led_skeleton_notify (GObject *object,
28881 GParamSpec *pspec G_GNUC_UNUSED)
28882{
28883 LedSkeleton *skeleton = LED_SKELETON (object);
28884 g_mutex_lock (&skeleton->priv->lock);
28885 if (skeleton->priv->changed_properties != NULL &&
28886 skeleton->priv->changed_properties_idle_source == NULL)
28887 {
28888 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
28889 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
28890 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _led_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
Adriana Kobylakfd778822016-06-16 09:08:37 -050028891 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _led_emit_changed");
Norman James362a80f2015-09-14 14:04:39 -050028892 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
28893 g_source_unref (skeleton->priv->changed_properties_idle_source);
28894 }
28895 g_mutex_unlock (&skeleton->priv->lock);
28896}
28897
28898static void
28899led_skeleton_set_property (GObject *object,
28900 guint prop_id,
28901 const GValue *value,
28902 GParamSpec *pspec)
28903{
28904 LedSkeleton *skeleton = LED_SKELETON (object);
Norman James493996c2015-10-31 17:27:13 -050028905 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -050028906 g_mutex_lock (&skeleton->priv->lock);
28907 g_object_freeze_notify (object);
28908 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
28909 {
28910 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
28911 _led_schedule_emit_changed (skeleton, _led_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
28912 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
28913 g_object_notify_by_pspec (object, pspec);
28914 }
28915 g_mutex_unlock (&skeleton->priv->lock);
28916 g_object_thaw_notify (object);
28917}
28918
28919static void
28920led_skeleton_init (LedSkeleton *skeleton)
28921{
28922#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
28923 skeleton->priv = led_skeleton_get_instance_private (skeleton);
28924#else
28925 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_LED_SKELETON, LedSkeletonPrivate);
28926#endif
28927
28928 g_mutex_init (&skeleton->priv->lock);
28929 skeleton->priv->context = g_main_context_ref_thread_default ();
Norman James493996c2015-10-31 17:27:13 -050028930 skeleton->priv->properties = g_new0 (GValue, 3);
Norman James362a80f2015-09-14 14:04:39 -050028931 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
28932 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
Norman James493996c2015-10-31 17:27:13 -050028933 g_value_init (&skeleton->priv->properties[2], G_TYPE_STRING);
Norman James362a80f2015-09-14 14:04:39 -050028934}
28935
28936static gint
28937led_skeleton_get_color (Led *object)
28938{
28939 LedSkeleton *skeleton = LED_SKELETON (object);
28940 gint value;
28941 g_mutex_lock (&skeleton->priv->lock);
28942 value = g_value_get_int (&(skeleton->priv->properties[0]));
28943 g_mutex_unlock (&skeleton->priv->lock);
28944 return value;
28945}
28946
28947static const gchar *
28948led_skeleton_get_function (Led *object)
28949{
28950 LedSkeleton *skeleton = LED_SKELETON (object);
28951 const gchar *value;
28952 g_mutex_lock (&skeleton->priv->lock);
28953 value = g_value_get_string (&(skeleton->priv->properties[1]));
28954 g_mutex_unlock (&skeleton->priv->lock);
28955 return value;
28956}
28957
Norman James493996c2015-10-31 17:27:13 -050028958static const gchar *
28959led_skeleton_get_state (Led *object)
28960{
28961 LedSkeleton *skeleton = LED_SKELETON (object);
28962 const gchar *value;
28963 g_mutex_lock (&skeleton->priv->lock);
28964 value = g_value_get_string (&(skeleton->priv->properties[2]));
28965 g_mutex_unlock (&skeleton->priv->lock);
28966 return value;
28967}
28968
Norman James362a80f2015-09-14 14:04:39 -050028969static void
28970led_skeleton_class_init (LedSkeletonClass *klass)
28971{
28972 GObjectClass *gobject_class;
28973 GDBusInterfaceSkeletonClass *skeleton_class;
28974
28975 gobject_class = G_OBJECT_CLASS (klass);
28976 gobject_class->finalize = led_skeleton_finalize;
28977 gobject_class->get_property = led_skeleton_get_property;
28978 gobject_class->set_property = led_skeleton_set_property;
28979 gobject_class->notify = led_skeleton_notify;
28980
28981
28982 led_override_properties (gobject_class, 1);
28983
28984 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
28985 skeleton_class->get_info = led_skeleton_dbus_interface_get_info;
28986 skeleton_class->get_properties = led_skeleton_dbus_interface_get_properties;
28987 skeleton_class->flush = led_skeleton_dbus_interface_flush;
28988 skeleton_class->get_vtable = led_skeleton_dbus_interface_get_vtable;
28989
28990#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
28991 g_type_class_add_private (klass, sizeof (LedSkeletonPrivate));
28992#endif
28993}
28994
28995static void
28996led_skeleton_iface_init (LedIface *iface)
28997{
28998 iface->get_color = led_skeleton_get_color;
28999 iface->get_function = led_skeleton_get_function;
Norman James493996c2015-10-31 17:27:13 -050029000 iface->get_state = led_skeleton_get_state;
Norman James362a80f2015-09-14 14:04:39 -050029001}
29002
29003/**
29004 * led_skeleton_new:
29005 *
29006 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>.
29007 *
29008 * Returns: (transfer full) (type LedSkeleton): The skeleton object.
29009 */
29010Led *
29011led_skeleton_new (void)
29012{
29013 return LED (g_object_new (TYPE_LED_SKELETON, NULL));
29014}
29015
29016/* ------------------------------------------------------------------------
Norman Jamesdbcffbd2015-10-06 16:53:06 -050029017 * Code for interface org.openbmc.HostIpmi
29018 * ------------------------------------------------------------------------
29019 */
29020
29021/**
29022 * SECTION:HostIpmi
29023 * @title: HostIpmi
29024 * @short_description: Generated C code for the org.openbmc.HostIpmi D-Bus interface
29025 *
29026 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link> D-Bus interface in C.
29027 */
29028
29029/* ---- Introspection data for org.openbmc.HostIpmi ---- */
29030
29031static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_IN_ARG_seq =
29032{
29033 {
29034 -1,
29035 (gchar *) "seq",
29036 (gchar *) "y",
29037 NULL
29038 },
29039 FALSE
29040};
29041
29042static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_IN_ARG_netfn =
29043{
29044 {
29045 -1,
29046 (gchar *) "netfn",
29047 (gchar *) "y",
29048 NULL
29049 },
29050 FALSE
29051};
29052
29053static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_IN_ARG_cmd =
29054{
29055 {
29056 -1,
29057 (gchar *) "cmd",
29058 (gchar *) "y",
29059 NULL
29060 },
29061 FALSE
29062};
29063
29064static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_IN_ARG_data =
29065{
29066 {
29067 -1,
29068 (gchar *) "data",
29069 (gchar *) "ay",
29070 NULL
29071 },
29072 FALSE
29073};
29074
29075static const _ExtendedGDBusArgInfo * const _host_ipmi_method_info_send_message_IN_ARG_pointers[] =
29076{
29077 &_host_ipmi_method_info_send_message_IN_ARG_seq,
29078 &_host_ipmi_method_info_send_message_IN_ARG_netfn,
29079 &_host_ipmi_method_info_send_message_IN_ARG_cmd,
29080 &_host_ipmi_method_info_send_message_IN_ARG_data,
29081 NULL
29082};
29083
29084static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_OUT_ARG_unnamed_arg4 =
29085{
29086 {
29087 -1,
29088 (gchar *) "unnamed_arg4",
29089 (gchar *) "x",
29090 NULL
29091 },
29092 FALSE
29093};
29094
29095static const _ExtendedGDBusArgInfo * const _host_ipmi_method_info_send_message_OUT_ARG_pointers[] =
29096{
29097 &_host_ipmi_method_info_send_message_OUT_ARG_unnamed_arg4,
29098 NULL
29099};
29100
29101static const _ExtendedGDBusMethodInfo _host_ipmi_method_info_send_message =
29102{
29103 {
29104 -1,
29105 (gchar *) "sendMessage",
29106 (GDBusArgInfo **) &_host_ipmi_method_info_send_message_IN_ARG_pointers,
29107 (GDBusArgInfo **) &_host_ipmi_method_info_send_message_OUT_ARG_pointers,
29108 NULL
29109 },
29110 "handle-send-message",
29111 FALSE
29112};
29113
29114static const _ExtendedGDBusMethodInfo * const _host_ipmi_method_info_pointers[] =
29115{
29116 &_host_ipmi_method_info_send_message,
29117 NULL
29118};
29119
29120static const _ExtendedGDBusArgInfo _host_ipmi_signal_info_received_message_ARG_seq =
29121{
29122 {
29123 -1,
29124 (gchar *) "seq",
29125 (gchar *) "y",
29126 NULL
29127 },
29128 FALSE
29129};
29130
29131static const _ExtendedGDBusArgInfo _host_ipmi_signal_info_received_message_ARG_netfn =
29132{
29133 {
29134 -1,
29135 (gchar *) "netfn",
29136 (gchar *) "y",
29137 NULL
29138 },
29139 FALSE
29140};
29141
29142static const _ExtendedGDBusArgInfo _host_ipmi_signal_info_received_message_ARG_cmd =
29143{
29144 {
29145 -1,
29146 (gchar *) "cmd",
29147 (gchar *) "y",
29148 NULL
29149 },
29150 FALSE
29151};
29152
29153static const _ExtendedGDBusArgInfo _host_ipmi_signal_info_received_message_ARG_data =
29154{
29155 {
29156 -1,
29157 (gchar *) "data",
29158 (gchar *) "ay",
29159 NULL
29160 },
29161 FALSE
29162};
29163
29164static const _ExtendedGDBusArgInfo * const _host_ipmi_signal_info_received_message_ARG_pointers[] =
29165{
29166 &_host_ipmi_signal_info_received_message_ARG_seq,
29167 &_host_ipmi_signal_info_received_message_ARG_netfn,
29168 &_host_ipmi_signal_info_received_message_ARG_cmd,
29169 &_host_ipmi_signal_info_received_message_ARG_data,
29170 NULL
29171};
29172
29173static const _ExtendedGDBusSignalInfo _host_ipmi_signal_info_received_message =
29174{
29175 {
29176 -1,
29177 (gchar *) "ReceivedMessage",
29178 (GDBusArgInfo **) &_host_ipmi_signal_info_received_message_ARG_pointers,
29179 NULL
29180 },
29181 "received-message"
29182};
29183
29184static const _ExtendedGDBusSignalInfo * const _host_ipmi_signal_info_pointers[] =
29185{
29186 &_host_ipmi_signal_info_received_message,
29187 NULL
29188};
29189
29190static const _ExtendedGDBusInterfaceInfo _host_ipmi_interface_info =
29191{
29192 {
29193 -1,
29194 (gchar *) "org.openbmc.HostIpmi",
29195 (GDBusMethodInfo **) &_host_ipmi_method_info_pointers,
29196 (GDBusSignalInfo **) &_host_ipmi_signal_info_pointers,
29197 NULL,
29198 NULL
29199 },
29200 "host-ipmi",
29201};
29202
29203
29204/**
29205 * host_ipmi_interface_info:
29206 *
29207 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link> D-Bus interface.
29208 *
29209 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
29210 */
29211GDBusInterfaceInfo *
29212host_ipmi_interface_info (void)
29213{
29214 return (GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct;
29215}
29216
29217/**
29218 * host_ipmi_override_properties:
29219 * @klass: The class structure for a #GObject<!-- -->-derived class.
29220 * @property_id_begin: The property id to assign to the first overridden property.
29221 *
29222 * Overrides all #GObject properties in the #HostIpmi interface for a concrete class.
29223 * The properties are overridden in the order they are defined.
29224 *
29225 * Returns: The last property id.
29226 */
29227guint
29228host_ipmi_override_properties (GObjectClass *klass, guint property_id_begin)
29229{
29230 return property_id_begin - 1;
29231}
29232
29233
29234
29235/**
29236 * HostIpmi:
29237 *
29238 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link>.
29239 */
29240
29241/**
29242 * HostIpmiIface:
29243 * @parent_iface: The parent interface.
29244 * @handle_send_message: Handler for the #HostIpmi::handle-send-message signal.
29245 * @received_message: Handler for the #HostIpmi::received-message signal.
29246 *
29247 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link>.
29248 */
29249
29250typedef HostIpmiIface HostIpmiInterface;
29251G_DEFINE_INTERFACE (HostIpmi, host_ipmi, G_TYPE_OBJECT);
29252
29253static void
29254host_ipmi_default_init (HostIpmiIface *iface)
29255{
29256 /* GObject signals for incoming D-Bus method calls: */
29257 /**
29258 * HostIpmi::handle-send-message:
29259 * @object: A #HostIpmi.
29260 * @invocation: A #GDBusMethodInvocation.
29261 * @arg_seq: Argument passed by remote caller.
29262 * @arg_netfn: Argument passed by remote caller.
29263 * @arg_cmd: Argument passed by remote caller.
29264 * @arg_data: Argument passed by remote caller.
29265 *
29266 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-HostIpmi.sendMessage">sendMessage()</link> D-Bus method.
29267 *
29268 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call host_ipmi_complete_send_message() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
29269 *
29270 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
29271 */
29272 g_signal_new ("handle-send-message",
29273 G_TYPE_FROM_INTERFACE (iface),
29274 G_SIGNAL_RUN_LAST,
29275 G_STRUCT_OFFSET (HostIpmiIface, handle_send_message),
29276 g_signal_accumulator_true_handled,
29277 NULL,
29278 g_cclosure_marshal_generic,
29279 G_TYPE_BOOLEAN,
29280 5,
29281 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_UCHAR, G_TYPE_UCHAR, G_TYPE_UCHAR, G_TYPE_STRING);
29282
29283 /* GObject signals for received D-Bus signals: */
29284 /**
29285 * HostIpmi::received-message:
29286 * @object: A #HostIpmi.
29287 * @arg_seq: Argument.
29288 * @arg_netfn: Argument.
29289 * @arg_cmd: Argument.
29290 * @arg_data: Argument.
29291 *
29292 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-HostIpmi.ReceivedMessage">"ReceivedMessage"</link> is received.
29293 *
29294 * 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.
29295 */
29296 g_signal_new ("received-message",
29297 G_TYPE_FROM_INTERFACE (iface),
29298 G_SIGNAL_RUN_LAST,
29299 G_STRUCT_OFFSET (HostIpmiIface, received_message),
29300 NULL,
29301 NULL,
29302 g_cclosure_marshal_generic,
29303 G_TYPE_NONE,
29304 4, G_TYPE_UCHAR, G_TYPE_UCHAR, G_TYPE_UCHAR, G_TYPE_STRING);
29305
29306}
29307
29308/**
29309 * host_ipmi_emit_received_message:
29310 * @object: A #HostIpmi.
29311 * @arg_seq: Argument to pass with the signal.
29312 * @arg_netfn: Argument to pass with the signal.
29313 * @arg_cmd: Argument to pass with the signal.
29314 * @arg_data: Argument to pass with the signal.
29315 *
29316 * Emits the <link linkend="gdbus-signal-org-openbmc-HostIpmi.ReceivedMessage">"ReceivedMessage"</link> D-Bus signal.
29317 */
29318void
29319host_ipmi_emit_received_message (
29320 HostIpmi *object,
29321 guchar arg_seq,
29322 guchar arg_netfn,
29323 guchar arg_cmd,
29324 const gchar *arg_data)
29325{
29326 g_signal_emit_by_name (object, "received-message", arg_seq, arg_netfn, arg_cmd, arg_data);
29327}
29328
29329/**
29330 * host_ipmi_call_send_message:
29331 * @proxy: A #HostIpmiProxy.
29332 * @arg_seq: Argument to pass with the method invocation.
29333 * @arg_netfn: Argument to pass with the method invocation.
29334 * @arg_cmd: Argument to pass with the method invocation.
29335 * @arg_data: Argument to pass with the method invocation.
29336 * @cancellable: (allow-none): A #GCancellable or %NULL.
29337 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
29338 * @user_data: User data to pass to @callback.
29339 *
29340 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-HostIpmi.sendMessage">sendMessage()</link> D-Bus method on @proxy.
29341 * 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.
29342 * You can then call host_ipmi_call_send_message_finish() to get the result of the operation.
29343 *
29344 * See host_ipmi_call_send_message_sync() for the synchronous, blocking version of this method.
29345 */
29346void
29347host_ipmi_call_send_message (
29348 HostIpmi *proxy,
29349 guchar arg_seq,
29350 guchar arg_netfn,
29351 guchar arg_cmd,
29352 const gchar *arg_data,
29353 GCancellable *cancellable,
29354 GAsyncReadyCallback callback,
29355 gpointer user_data)
29356{
29357 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
29358 "sendMessage",
29359 g_variant_new ("(yyy^ay)",
29360 arg_seq,
29361 arg_netfn,
29362 arg_cmd,
29363 arg_data),
29364 G_DBUS_CALL_FLAGS_NONE,
29365 -1,
29366 cancellable,
29367 callback,
29368 user_data);
29369}
29370
29371/**
29372 * host_ipmi_call_send_message_finish:
29373 * @proxy: A #HostIpmiProxy.
29374 * @out_unnamed_arg4: (out): Return location for return parameter or %NULL to ignore.
29375 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to host_ipmi_call_send_message().
29376 * @error: Return location for error or %NULL.
29377 *
29378 * Finishes an operation started with host_ipmi_call_send_message().
29379 *
29380 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
29381 */
29382gboolean
29383host_ipmi_call_send_message_finish (
29384 HostIpmi *proxy,
29385 gint64 *out_unnamed_arg4,
29386 GAsyncResult *res,
29387 GError **error)
29388{
29389 GVariant *_ret;
29390 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
29391 if (_ret == NULL)
29392 goto _out;
29393 g_variant_get (_ret,
29394 "(x)",
29395 out_unnamed_arg4);
29396 g_variant_unref (_ret);
29397_out:
29398 return _ret != NULL;
29399}
29400
29401/**
29402 * host_ipmi_call_send_message_sync:
29403 * @proxy: A #HostIpmiProxy.
29404 * @arg_seq: Argument to pass with the method invocation.
29405 * @arg_netfn: Argument to pass with the method invocation.
29406 * @arg_cmd: Argument to pass with the method invocation.
29407 * @arg_data: Argument to pass with the method invocation.
29408 * @out_unnamed_arg4: (out): Return location for return parameter or %NULL to ignore.
29409 * @cancellable: (allow-none): A #GCancellable or %NULL.
29410 * @error: Return location for error or %NULL.
29411 *
29412 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-HostIpmi.sendMessage">sendMessage()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
29413 *
29414 * See host_ipmi_call_send_message() for the asynchronous version of this method.
29415 *
29416 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
29417 */
29418gboolean
29419host_ipmi_call_send_message_sync (
29420 HostIpmi *proxy,
29421 guchar arg_seq,
29422 guchar arg_netfn,
29423 guchar arg_cmd,
29424 const gchar *arg_data,
29425 gint64 *out_unnamed_arg4,
29426 GCancellable *cancellable,
29427 GError **error)
29428{
29429 GVariant *_ret;
29430 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
29431 "sendMessage",
29432 g_variant_new ("(yyy^ay)",
29433 arg_seq,
29434 arg_netfn,
29435 arg_cmd,
29436 arg_data),
29437 G_DBUS_CALL_FLAGS_NONE,
29438 -1,
29439 cancellable,
29440 error);
29441 if (_ret == NULL)
29442 goto _out;
29443 g_variant_get (_ret,
29444 "(x)",
29445 out_unnamed_arg4);
29446 g_variant_unref (_ret);
29447_out:
29448 return _ret != NULL;
29449}
29450
29451/**
29452 * host_ipmi_complete_send_message:
29453 * @object: A #HostIpmi.
29454 * @invocation: (transfer full): A #GDBusMethodInvocation.
29455 * @unnamed_arg4: Parameter to return.
29456 *
29457 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-HostIpmi.sendMessage">sendMessage()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
29458 *
29459 * This method will free @invocation, you cannot use it afterwards.
29460 */
29461void
29462host_ipmi_complete_send_message (
29463 HostIpmi *object,
29464 GDBusMethodInvocation *invocation,
29465 gint64 unnamed_arg4)
29466{
29467 g_dbus_method_invocation_return_value (invocation,
29468 g_variant_new ("(x)",
29469 unnamed_arg4));
29470}
29471
29472/* ------------------------------------------------------------------------ */
29473
29474/**
29475 * HostIpmiProxy:
29476 *
29477 * The #HostIpmiProxy structure contains only private data and should only be accessed using the provided API.
29478 */
29479
29480/**
29481 * HostIpmiProxyClass:
29482 * @parent_class: The parent class.
29483 *
29484 * Class structure for #HostIpmiProxy.
29485 */
29486
29487struct _HostIpmiProxyPrivate
29488{
29489 GData *qdata;
29490};
29491
29492static void host_ipmi_proxy_iface_init (HostIpmiIface *iface);
29493
29494#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
29495G_DEFINE_TYPE_WITH_CODE (HostIpmiProxy, host_ipmi_proxy, G_TYPE_DBUS_PROXY,
29496 G_ADD_PRIVATE (HostIpmiProxy)
29497 G_IMPLEMENT_INTERFACE (TYPE_HOST_IPMI, host_ipmi_proxy_iface_init));
29498
29499#else
29500G_DEFINE_TYPE_WITH_CODE (HostIpmiProxy, host_ipmi_proxy, G_TYPE_DBUS_PROXY,
29501 G_IMPLEMENT_INTERFACE (TYPE_HOST_IPMI, host_ipmi_proxy_iface_init));
29502
29503#endif
29504static void
29505host_ipmi_proxy_finalize (GObject *object)
29506{
29507 HostIpmiProxy *proxy = HOST_IPMI_PROXY (object);
29508 g_datalist_clear (&proxy->priv->qdata);
29509 G_OBJECT_CLASS (host_ipmi_proxy_parent_class)->finalize (object);
29510}
29511
29512static void
29513host_ipmi_proxy_get_property (GObject *object,
29514 guint prop_id,
29515 GValue *value,
29516 GParamSpec *pspec G_GNUC_UNUSED)
29517{
29518}
29519
29520static void
29521host_ipmi_proxy_set_property (GObject *object,
29522 guint prop_id,
29523 const GValue *value,
29524 GParamSpec *pspec G_GNUC_UNUSED)
29525{
29526}
29527
29528static void
29529host_ipmi_proxy_g_signal (GDBusProxy *proxy,
29530 const gchar *sender_name G_GNUC_UNUSED,
29531 const gchar *signal_name,
29532 GVariant *parameters)
29533{
29534 _ExtendedGDBusSignalInfo *info;
29535 GVariantIter iter;
29536 GVariant *child;
29537 GValue *paramv;
29538 guint num_params;
29539 guint n;
29540 guint signal_id;
29541 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, signal_name);
29542 if (info == NULL)
29543 return;
29544 num_params = g_variant_n_children (parameters);
29545 paramv = g_new0 (GValue, num_params + 1);
29546 g_value_init (&paramv[0], TYPE_HOST_IPMI);
29547 g_value_set_object (&paramv[0], proxy);
29548 g_variant_iter_init (&iter, parameters);
29549 n = 1;
29550 while ((child = g_variant_iter_next_value (&iter)) != NULL)
29551 {
29552 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
29553 if (arg_info->use_gvariant)
29554 {
29555 g_value_init (&paramv[n], G_TYPE_VARIANT);
29556 g_value_set_variant (&paramv[n], child);
29557 n++;
29558 }
29559 else
29560 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
29561 g_variant_unref (child);
29562 }
29563 signal_id = g_signal_lookup (info->signal_name, TYPE_HOST_IPMI);
29564 g_signal_emitv (paramv, signal_id, 0, NULL);
29565 for (n = 0; n < num_params + 1; n++)
29566 g_value_unset (&paramv[n]);
29567 g_free (paramv);
29568}
29569
29570static void
29571host_ipmi_proxy_g_properties_changed (GDBusProxy *_proxy,
29572 GVariant *changed_properties,
29573 const gchar *const *invalidated_properties)
29574{
29575 HostIpmiProxy *proxy = HOST_IPMI_PROXY (_proxy);
29576 guint n;
29577 const gchar *key;
29578 GVariantIter *iter;
29579 _ExtendedGDBusPropertyInfo *info;
29580 g_variant_get (changed_properties, "a{sv}", &iter);
29581 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
29582 {
29583 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, key);
29584 g_datalist_remove_data (&proxy->priv->qdata, key);
29585 if (info != NULL)
29586 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
29587 }
29588 g_variant_iter_free (iter);
29589 for (n = 0; invalidated_properties[n] != NULL; n++)
29590 {
29591 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, invalidated_properties[n]);
29592 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
29593 if (info != NULL)
29594 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
29595 }
29596}
29597
29598static void
29599host_ipmi_proxy_init (HostIpmiProxy *proxy)
29600{
29601#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
29602 proxy->priv = host_ipmi_proxy_get_instance_private (proxy);
29603#else
29604 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_HOST_IPMI_PROXY, HostIpmiProxyPrivate);
29605#endif
29606
29607 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), host_ipmi_interface_info ());
29608}
29609
29610static void
29611host_ipmi_proxy_class_init (HostIpmiProxyClass *klass)
29612{
29613 GObjectClass *gobject_class;
29614 GDBusProxyClass *proxy_class;
29615
29616 gobject_class = G_OBJECT_CLASS (klass);
29617 gobject_class->finalize = host_ipmi_proxy_finalize;
29618 gobject_class->get_property = host_ipmi_proxy_get_property;
29619 gobject_class->set_property = host_ipmi_proxy_set_property;
29620
29621 proxy_class = G_DBUS_PROXY_CLASS (klass);
29622 proxy_class->g_signal = host_ipmi_proxy_g_signal;
29623 proxy_class->g_properties_changed = host_ipmi_proxy_g_properties_changed;
29624
29625#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
29626 g_type_class_add_private (klass, sizeof (HostIpmiProxyPrivate));
29627#endif
29628}
29629
29630static void
29631host_ipmi_proxy_iface_init (HostIpmiIface *iface)
29632{
29633}
29634
29635/**
29636 * host_ipmi_proxy_new:
29637 * @connection: A #GDBusConnection.
29638 * @flags: Flags from the #GDBusProxyFlags enumeration.
29639 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
29640 * @object_path: An object path.
29641 * @cancellable: (allow-none): A #GCancellable or %NULL.
29642 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
29643 * @user_data: User data to pass to @callback.
29644 *
29645 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link>. See g_dbus_proxy_new() for more details.
29646 *
29647 * 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.
29648 * You can then call host_ipmi_proxy_new_finish() to get the result of the operation.
29649 *
29650 * See host_ipmi_proxy_new_sync() for the synchronous, blocking version of this constructor.
29651 */
29652void
29653host_ipmi_proxy_new (
29654 GDBusConnection *connection,
29655 GDBusProxyFlags flags,
29656 const gchar *name,
29657 const gchar *object_path,
29658 GCancellable *cancellable,
29659 GAsyncReadyCallback callback,
29660 gpointer user_data)
29661{
29662 g_async_initable_new_async (TYPE_HOST_IPMI_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.HostIpmi", NULL);
29663}
29664
29665/**
29666 * host_ipmi_proxy_new_finish:
29667 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to host_ipmi_proxy_new().
29668 * @error: Return location for error or %NULL
29669 *
29670 * Finishes an operation started with host_ipmi_proxy_new().
29671 *
29672 * Returns: (transfer full) (type HostIpmiProxy): The constructed proxy object or %NULL if @error is set.
29673 */
29674HostIpmi *
29675host_ipmi_proxy_new_finish (
29676 GAsyncResult *res,
29677 GError **error)
29678{
29679 GObject *ret;
29680 GObject *source_object;
29681 source_object = g_async_result_get_source_object (res);
29682 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
29683 g_object_unref (source_object);
29684 if (ret != NULL)
29685 return HOST_IPMI (ret);
29686 else
29687 return NULL;
29688}
29689
29690/**
29691 * host_ipmi_proxy_new_sync:
29692 * @connection: A #GDBusConnection.
29693 * @flags: Flags from the #GDBusProxyFlags enumeration.
29694 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
29695 * @object_path: An object path.
29696 * @cancellable: (allow-none): A #GCancellable or %NULL.
29697 * @error: Return location for error or %NULL
29698 *
29699 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link>. See g_dbus_proxy_new_sync() for more details.
29700 *
29701 * The calling thread is blocked until a reply is received.
29702 *
29703 * See host_ipmi_proxy_new() for the asynchronous version of this constructor.
29704 *
29705 * Returns: (transfer full) (type HostIpmiProxy): The constructed proxy object or %NULL if @error is set.
29706 */
29707HostIpmi *
29708host_ipmi_proxy_new_sync (
29709 GDBusConnection *connection,
29710 GDBusProxyFlags flags,
29711 const gchar *name,
29712 const gchar *object_path,
29713 GCancellable *cancellable,
29714 GError **error)
29715{
29716 GInitable *ret;
29717 ret = g_initable_new (TYPE_HOST_IPMI_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.HostIpmi", NULL);
29718 if (ret != NULL)
29719 return HOST_IPMI (ret);
29720 else
29721 return NULL;
29722}
29723
29724
29725/**
29726 * host_ipmi_proxy_new_for_bus:
29727 * @bus_type: A #GBusType.
29728 * @flags: Flags from the #GDBusProxyFlags enumeration.
29729 * @name: A bus name (well-known or unique).
29730 * @object_path: An object path.
29731 * @cancellable: (allow-none): A #GCancellable or %NULL.
29732 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
29733 * @user_data: User data to pass to @callback.
29734 *
29735 * Like host_ipmi_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
29736 *
29737 * 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.
29738 * You can then call host_ipmi_proxy_new_for_bus_finish() to get the result of the operation.
29739 *
29740 * See host_ipmi_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
29741 */
29742void
29743host_ipmi_proxy_new_for_bus (
29744 GBusType bus_type,
29745 GDBusProxyFlags flags,
29746 const gchar *name,
29747 const gchar *object_path,
29748 GCancellable *cancellable,
29749 GAsyncReadyCallback callback,
29750 gpointer user_data)
29751{
29752 g_async_initable_new_async (TYPE_HOST_IPMI_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.HostIpmi", NULL);
29753}
29754
29755/**
29756 * host_ipmi_proxy_new_for_bus_finish:
29757 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to host_ipmi_proxy_new_for_bus().
29758 * @error: Return location for error or %NULL
29759 *
29760 * Finishes an operation started with host_ipmi_proxy_new_for_bus().
29761 *
29762 * Returns: (transfer full) (type HostIpmiProxy): The constructed proxy object or %NULL if @error is set.
29763 */
29764HostIpmi *
29765host_ipmi_proxy_new_for_bus_finish (
29766 GAsyncResult *res,
29767 GError **error)
29768{
29769 GObject *ret;
29770 GObject *source_object;
29771 source_object = g_async_result_get_source_object (res);
29772 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
29773 g_object_unref (source_object);
29774 if (ret != NULL)
29775 return HOST_IPMI (ret);
29776 else
29777 return NULL;
29778}
29779
29780/**
29781 * host_ipmi_proxy_new_for_bus_sync:
29782 * @bus_type: A #GBusType.
29783 * @flags: Flags from the #GDBusProxyFlags enumeration.
29784 * @name: A bus name (well-known or unique).
29785 * @object_path: An object path.
29786 * @cancellable: (allow-none): A #GCancellable or %NULL.
29787 * @error: Return location for error or %NULL
29788 *
29789 * Like host_ipmi_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
29790 *
29791 * The calling thread is blocked until a reply is received.
29792 *
29793 * See host_ipmi_proxy_new_for_bus() for the asynchronous version of this constructor.
29794 *
29795 * Returns: (transfer full) (type HostIpmiProxy): The constructed proxy object or %NULL if @error is set.
29796 */
29797HostIpmi *
29798host_ipmi_proxy_new_for_bus_sync (
29799 GBusType bus_type,
29800 GDBusProxyFlags flags,
29801 const gchar *name,
29802 const gchar *object_path,
29803 GCancellable *cancellable,
29804 GError **error)
29805{
29806 GInitable *ret;
29807 ret = g_initable_new (TYPE_HOST_IPMI_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.HostIpmi", NULL);
29808 if (ret != NULL)
29809 return HOST_IPMI (ret);
29810 else
29811 return NULL;
29812}
29813
29814
29815/* ------------------------------------------------------------------------ */
29816
29817/**
29818 * HostIpmiSkeleton:
29819 *
29820 * The #HostIpmiSkeleton structure contains only private data and should only be accessed using the provided API.
29821 */
29822
29823/**
29824 * HostIpmiSkeletonClass:
29825 * @parent_class: The parent class.
29826 *
29827 * Class structure for #HostIpmiSkeleton.
29828 */
29829
29830struct _HostIpmiSkeletonPrivate
29831{
29832 GValue *properties;
29833 GList *changed_properties;
29834 GSource *changed_properties_idle_source;
29835 GMainContext *context;
29836 GMutex lock;
29837};
29838
29839static void
29840_host_ipmi_skeleton_handle_method_call (
29841 GDBusConnection *connection G_GNUC_UNUSED,
29842 const gchar *sender G_GNUC_UNUSED,
29843 const gchar *object_path G_GNUC_UNUSED,
29844 const gchar *interface_name,
29845 const gchar *method_name,
29846 GVariant *parameters,
29847 GDBusMethodInvocation *invocation,
29848 gpointer user_data)
29849{
29850 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (user_data);
29851 _ExtendedGDBusMethodInfo *info;
29852 GVariantIter iter;
29853 GVariant *child;
29854 GValue *paramv;
29855 guint num_params;
29856 guint num_extra;
29857 guint n;
29858 guint signal_id;
29859 GValue return_value = G_VALUE_INIT;
29860 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
29861 g_assert (info != NULL);
29862 num_params = g_variant_n_children (parameters);
29863 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
29864 n = 0;
29865 g_value_init (&paramv[n], TYPE_HOST_IPMI);
29866 g_value_set_object (&paramv[n++], skeleton);
29867 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
29868 g_value_set_object (&paramv[n++], invocation);
29869 if (info->pass_fdlist)
29870 {
29871#ifdef G_OS_UNIX
29872 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
29873 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
29874#else
29875 g_assert_not_reached ();
29876#endif
29877 }
29878 g_variant_iter_init (&iter, parameters);
29879 while ((child = g_variant_iter_next_value (&iter)) != NULL)
29880 {
29881 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
29882 if (arg_info->use_gvariant)
29883 {
29884 g_value_init (&paramv[n], G_TYPE_VARIANT);
29885 g_value_set_variant (&paramv[n], child);
29886 n++;
29887 }
29888 else
29889 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
29890 g_variant_unref (child);
29891 }
29892 signal_id = g_signal_lookup (info->signal_name, TYPE_HOST_IPMI);
29893 g_value_init (&return_value, G_TYPE_BOOLEAN);
29894 g_signal_emitv (paramv, signal_id, 0, &return_value);
29895 if (!g_value_get_boolean (&return_value))
29896 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);
29897 g_value_unset (&return_value);
29898 for (n = 0; n < num_params + num_extra; n++)
29899 g_value_unset (&paramv[n]);
29900 g_free (paramv);
29901}
29902
29903static GVariant *
29904_host_ipmi_skeleton_handle_get_property (
29905 GDBusConnection *connection G_GNUC_UNUSED,
29906 const gchar *sender G_GNUC_UNUSED,
29907 const gchar *object_path G_GNUC_UNUSED,
29908 const gchar *interface_name G_GNUC_UNUSED,
29909 const gchar *property_name,
29910 GError **error,
29911 gpointer user_data)
29912{
29913 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (user_data);
29914 GValue value = G_VALUE_INIT;
29915 GParamSpec *pspec;
29916 _ExtendedGDBusPropertyInfo *info;
29917 GVariant *ret;
29918 ret = NULL;
29919 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, property_name);
29920 g_assert (info != NULL);
29921 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
29922 if (pspec == NULL)
29923 {
29924 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
29925 }
29926 else
29927 {
29928 g_value_init (&value, pspec->value_type);
29929 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
29930 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
29931 g_value_unset (&value);
29932 }
29933 return ret;
29934}
29935
29936static gboolean
29937_host_ipmi_skeleton_handle_set_property (
29938 GDBusConnection *connection G_GNUC_UNUSED,
29939 const gchar *sender G_GNUC_UNUSED,
29940 const gchar *object_path G_GNUC_UNUSED,
29941 const gchar *interface_name G_GNUC_UNUSED,
29942 const gchar *property_name,
29943 GVariant *variant,
29944 GError **error,
29945 gpointer user_data)
29946{
29947 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (user_data);
29948 GValue value = G_VALUE_INIT;
29949 GParamSpec *pspec;
29950 _ExtendedGDBusPropertyInfo *info;
29951 gboolean ret;
29952 ret = FALSE;
29953 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, property_name);
29954 g_assert (info != NULL);
29955 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
29956 if (pspec == NULL)
29957 {
29958 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
29959 }
29960 else
29961 {
29962 if (info->use_gvariant)
29963 g_value_set_variant (&value, variant);
29964 else
29965 g_dbus_gvariant_to_gvalue (variant, &value);
29966 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
29967 g_value_unset (&value);
29968 ret = TRUE;
29969 }
29970 return ret;
29971}
29972
29973static const GDBusInterfaceVTable _host_ipmi_skeleton_vtable =
29974{
29975 _host_ipmi_skeleton_handle_method_call,
29976 _host_ipmi_skeleton_handle_get_property,
29977 _host_ipmi_skeleton_handle_set_property,
29978 {NULL}
29979};
29980
29981static GDBusInterfaceInfo *
29982host_ipmi_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
29983{
29984 return host_ipmi_interface_info ();
29985}
29986
29987static GDBusInterfaceVTable *
29988host_ipmi_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
29989{
29990 return (GDBusInterfaceVTable *) &_host_ipmi_skeleton_vtable;
29991}
29992
29993static GVariant *
29994host_ipmi_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
29995{
29996 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (_skeleton);
29997
29998 GVariantBuilder builder;
29999 guint n;
30000 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
30001 if (_host_ipmi_interface_info.parent_struct.properties == NULL)
30002 goto out;
30003 for (n = 0; _host_ipmi_interface_info.parent_struct.properties[n] != NULL; n++)
30004 {
30005 GDBusPropertyInfo *info = _host_ipmi_interface_info.parent_struct.properties[n];
30006 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
30007 {
30008 GVariant *value;
30009 value = _host_ipmi_skeleton_handle_get_property (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.HostIpmi", info->name, NULL, skeleton);
30010 if (value != NULL)
30011 {
30012 g_variant_take_ref (value);
30013 g_variant_builder_add (&builder, "{sv}", info->name, value);
30014 g_variant_unref (value);
30015 }
30016 }
30017 }
30018out:
30019 return g_variant_builder_end (&builder);
30020}
30021
30022static void
30023host_ipmi_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
30024{
30025}
30026
30027static void
30028_host_ipmi_on_signal_received_message (
30029 HostIpmi *object,
30030 guchar arg_seq,
30031 guchar arg_netfn,
30032 guchar arg_cmd,
30033 const gchar *arg_data)
30034{
30035 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (object);
30036
30037 GList *connections, *l;
30038 GVariant *signal_variant;
30039 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
30040
30041 signal_variant = g_variant_ref_sink (g_variant_new ("(yyy^ay)",
30042 arg_seq,
30043 arg_netfn,
30044 arg_cmd,
30045 arg_data));
30046 for (l = connections; l != NULL; l = l->next)
30047 {
30048 GDBusConnection *connection = l->data;
30049 g_dbus_connection_emit_signal (connection,
30050 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.HostIpmi", "ReceivedMessage",
30051 signal_variant, NULL);
30052 }
30053 g_variant_unref (signal_variant);
30054 g_list_free_full (connections, g_object_unref);
30055}
30056
30057static void host_ipmi_skeleton_iface_init (HostIpmiIface *iface);
30058#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
30059G_DEFINE_TYPE_WITH_CODE (HostIpmiSkeleton, host_ipmi_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
30060 G_ADD_PRIVATE (HostIpmiSkeleton)
30061 G_IMPLEMENT_INTERFACE (TYPE_HOST_IPMI, host_ipmi_skeleton_iface_init));
30062
30063#else
30064G_DEFINE_TYPE_WITH_CODE (HostIpmiSkeleton, host_ipmi_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
30065 G_IMPLEMENT_INTERFACE (TYPE_HOST_IPMI, host_ipmi_skeleton_iface_init));
30066
30067#endif
30068static void
30069host_ipmi_skeleton_finalize (GObject *object)
30070{
30071 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (object);
30072 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
30073 if (skeleton->priv->changed_properties_idle_source != NULL)
30074 g_source_destroy (skeleton->priv->changed_properties_idle_source);
30075 g_main_context_unref (skeleton->priv->context);
30076 g_mutex_clear (&skeleton->priv->lock);
30077 G_OBJECT_CLASS (host_ipmi_skeleton_parent_class)->finalize (object);
30078}
30079
30080static void
30081host_ipmi_skeleton_init (HostIpmiSkeleton *skeleton)
30082{
30083#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
30084 skeleton->priv = host_ipmi_skeleton_get_instance_private (skeleton);
30085#else
30086 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_HOST_IPMI_SKELETON, HostIpmiSkeletonPrivate);
30087#endif
30088
30089 g_mutex_init (&skeleton->priv->lock);
30090 skeleton->priv->context = g_main_context_ref_thread_default ();
30091}
30092
30093static void
30094host_ipmi_skeleton_class_init (HostIpmiSkeletonClass *klass)
30095{
30096 GObjectClass *gobject_class;
30097 GDBusInterfaceSkeletonClass *skeleton_class;
30098
30099 gobject_class = G_OBJECT_CLASS (klass);
30100 gobject_class->finalize = host_ipmi_skeleton_finalize;
30101
30102 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
30103 skeleton_class->get_info = host_ipmi_skeleton_dbus_interface_get_info;
30104 skeleton_class->get_properties = host_ipmi_skeleton_dbus_interface_get_properties;
30105 skeleton_class->flush = host_ipmi_skeleton_dbus_interface_flush;
30106 skeleton_class->get_vtable = host_ipmi_skeleton_dbus_interface_get_vtable;
30107
30108#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
30109 g_type_class_add_private (klass, sizeof (HostIpmiSkeletonPrivate));
30110#endif
30111}
30112
30113static void
30114host_ipmi_skeleton_iface_init (HostIpmiIface *iface)
30115{
30116 iface->received_message = _host_ipmi_on_signal_received_message;
30117}
30118
30119/**
30120 * host_ipmi_skeleton_new:
30121 *
30122 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link>.
30123 *
30124 * Returns: (transfer full) (type HostIpmiSkeleton): The skeleton object.
30125 */
30126HostIpmi *
30127host_ipmi_skeleton_new (void)
30128{
30129 return HOST_IPMI (g_object_new (TYPE_HOST_IPMI_SKELETON, NULL));
30130}
30131
30132/* ------------------------------------------------------------------------
Norman James362a80f2015-09-14 14:04:39 -050030133 * Code for Object, ObjectProxy and ObjectSkeleton
30134 * ------------------------------------------------------------------------
30135 */
30136
30137/**
30138 * SECTION:Object
30139 * @title: Object
30140 * @short_description: Specialized GDBusObject types
30141 *
30142 * This section contains the #Object, #ObjectProxy, and #ObjectSkeleton types which make it easier to work with objects implementing generated types for D-Bus interfaces.
30143 */
30144
30145/**
30146 * Object:
30147 *
30148 * The #Object type is a specialized container of interfaces.
30149 */
30150
30151/**
30152 * ObjectIface:
30153 * @parent_iface: The parent interface.
30154 *
30155 * Virtual table for the #Object interface.
30156 */
30157
30158typedef ObjectIface ObjectInterface;
30159G_DEFINE_INTERFACE_WITH_CODE (Object, object, G_TYPE_OBJECT, g_type_interface_add_prerequisite (g_define_type_id, G_TYPE_DBUS_OBJECT));
30160
30161static void
30162object_default_init (ObjectIface *iface)
30163{
30164 /**
Norman James5236a8f2015-11-05 20:39:31 -060030165 * Object:hwmon:
30166 *
30167 * The #Hwmon instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Hwmon.top_of_page">org.openbmc.Hwmon</link>, if any.
30168 *
30169 * Connect to the #GObject::notify signal to get informed of property changes.
30170 */
30171 g_object_interface_install_property (iface, g_param_spec_object ("hwmon", "hwmon", "hwmon", TYPE_HWMON, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
30172
30173 /**
Norman James362a80f2015-09-14 14:04:39 -050030174 * Object:fan:
30175 *
30176 * The #Fan instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link>, if any.
30177 *
30178 * Connect to the #GObject::notify signal to get informed of property changes.
30179 */
30180 g_object_interface_install_property (iface, g_param_spec_object ("fan", "fan", "fan", TYPE_FAN, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
30181
30182 /**
30183 * Object:sensor-value:
30184 *
30185 * The #SensorValue instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link>, if any.
30186 *
30187 * Connect to the #GObject::notify signal to get informed of property changes.
30188 */
30189 g_object_interface_install_property (iface, g_param_spec_object ("sensor-value", "sensor-value", "sensor-value", TYPE_SENSOR_VALUE, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
30190
30191 /**
30192 * Object:sensor-threshold:
30193 *
30194 * The #SensorThreshold instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link>, if any.
30195 *
30196 * Connect to the #GObject::notify signal to get informed of property changes.
30197 */
30198 g_object_interface_install_property (iface, g_param_spec_object ("sensor-threshold", "sensor-threshold", "sensor-threshold", TYPE_SENSOR_THRESHOLD, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
30199
30200 /**
30201 * Object:sensor-i2c:
30202 *
30203 * The #SensorI2c instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>, if any.
30204 *
30205 * Connect to the #GObject::notify signal to get informed of property changes.
30206 */
30207 g_object_interface_install_property (iface, g_param_spec_object ("sensor-i2c", "sensor-i2c", "sensor-i2c", TYPE_SENSOR_I2C, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
30208
30209 /**
30210 * Object:sensor-match:
30211 *
30212 * The #SensorMatch instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>, if any.
30213 *
30214 * Connect to the #GObject::notify signal to get informed of property changes.
30215 */
30216 g_object_interface_install_property (iface, g_param_spec_object ("sensor-match", "sensor-match", "sensor-match", TYPE_SENSOR_MATCH, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
30217
30218 /**
30219 * Object:process:
30220 *
30221 * The #Process instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link>, if any.
30222 *
30223 * Connect to the #GObject::notify signal to get informed of property changes.
30224 */
30225 g_object_interface_install_property (iface, g_param_spec_object ("process", "process", "process", TYPE_PROCESS, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
30226
30227 /**
Norman James18998182015-10-11 21:54:53 -050030228 * Object:shared-resource:
30229 *
30230 * The #SharedResource instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link>, if any.
30231 *
30232 * Connect to the #GObject::notify signal to get informed of property changes.
30233 */
30234 g_object_interface_install_property (iface, g_param_spec_object ("shared-resource", "shared-resource", "shared-resource", TYPE_SHARED_RESOURCE, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
30235
30236 /**
Norman James362a80f2015-09-14 14:04:39 -050030237 * Object:control:
30238 *
30239 * The #Control instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link>, if any.
30240 *
30241 * Connect to the #GObject::notify signal to get informed of property changes.
30242 */
30243 g_object_interface_install_property (iface, g_param_spec_object ("control", "control", "control", TYPE_CONTROL, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
30244
30245 /**
30246 * Object:control-bmc:
30247 *
30248 * The #ControlBmc instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Bmc.top_of_page">org.openbmc.control.Bmc</link>, if any.
30249 *
30250 * Connect to the #GObject::notify signal to get informed of property changes.
30251 */
30252 g_object_interface_install_property (iface, g_param_spec_object ("control-bmc", "control-bmc", "control-bmc", TYPE_CONTROL_BMC, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
30253
30254 /**
30255 * Object:control-host:
30256 *
30257 * The #ControlHost instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link>, if any.
30258 *
30259 * Connect to the #GObject::notify signal to get informed of property changes.
30260 */
30261 g_object_interface_install_property (iface, g_param_spec_object ("control-host", "control-host", "control-host", TYPE_CONTROL_HOST, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
30262
30263 /**
30264 * Object:control-power:
30265 *
30266 * The #ControlPower instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Power.top_of_page">org.openbmc.control.Power</link>, if any.
30267 *
30268 * Connect to the #GObject::notify signal to get informed of property changes.
30269 */
30270 g_object_interface_install_property (iface, g_param_spec_object ("control-power", "control-power", "control-power", TYPE_CONTROL_POWER, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
30271
30272 /**
Adriana Kobylakfd778822016-06-16 09:08:37 -050030273 * Object:control-checkstop:
30274 *
30275 * The #ControlCheckstop instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Checkstop.top_of_page">org.openbmc.control.Checkstop</link>, if any.
30276 *
30277 * Connect to the #GObject::notify signal to get informed of property changes.
30278 */
30279 g_object_interface_install_property (iface, g_param_spec_object ("control-checkstop", "control-checkstop", "control-checkstop", TYPE_CONTROL_CHECKSTOP, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
30280
30281 /**
Norman James362a80f2015-09-14 14:04:39 -050030282 * Object:watchdog:
30283 *
30284 * The #Watchdog instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link>, if any.
30285 *
30286 * Connect to the #GObject::notify signal to get informed of property changes.
30287 */
30288 g_object_interface_install_property (iface, g_param_spec_object ("watchdog", "watchdog", "watchdog", TYPE_WATCHDOG, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
30289
30290 /**
30291 * Object:event-log:
30292 *
30293 * The #EventLog instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>, if any.
30294 *
30295 * Connect to the #GObject::notify signal to get informed of property changes.
30296 */
30297 g_object_interface_install_property (iface, g_param_spec_object ("event-log", "event-log", "event-log", TYPE_EVENT_LOG, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
30298
30299 /**
30300 * Object:flash:
30301 *
30302 * The #Flash instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>, if any.
30303 *
30304 * Connect to the #GObject::notify signal to get informed of property changes.
30305 */
30306 g_object_interface_install_property (iface, g_param_spec_object ("flash", "flash", "flash", TYPE_FLASH, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
30307
30308 /**
Norman James18998182015-10-11 21:54:53 -050030309 * Object:flash-control:
30310 *
30311 * The #FlashControl instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link>, if any.
30312 *
30313 * Connect to the #GObject::notify signal to get informed of property changes.
30314 */
30315 g_object_interface_install_property (iface, g_param_spec_object ("flash-control", "flash-control", "flash-control", TYPE_FLASH_CONTROL, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
30316
30317 /**
Norman James362a80f2015-09-14 14:04:39 -050030318 * Object:button:
30319 *
30320 * The #Button instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link>, if any.
30321 *
30322 * Connect to the #GObject::notify signal to get informed of property changes.
30323 */
30324 g_object_interface_install_property (iface, g_param_spec_object ("button", "button", "button", TYPE_BUTTON, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
30325
30326 /**
30327 * Object:led:
30328 *
30329 * The #Led instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>, if any.
30330 *
30331 * Connect to the #GObject::notify signal to get informed of property changes.
30332 */
30333 g_object_interface_install_property (iface, g_param_spec_object ("led", "led", "led", TYPE_LED, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
30334
Norman Jamesdbcffbd2015-10-06 16:53:06 -050030335 /**
30336 * Object:host-ipmi:
30337 *
30338 * The #HostIpmi instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link>, if any.
30339 *
30340 * Connect to the #GObject::notify signal to get informed of property changes.
30341 */
30342 g_object_interface_install_property (iface, g_param_spec_object ("host-ipmi", "host-ipmi", "host-ipmi", TYPE_HOST_IPMI, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
30343
Norman James362a80f2015-09-14 14:04:39 -050030344}
30345
30346/**
Norman James5236a8f2015-11-05 20:39:31 -060030347 * object_get_hwmon:
30348 * @object: A #Object.
30349 *
30350 * Gets the #Hwmon instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Hwmon.top_of_page">org.openbmc.Hwmon</link> on @object, if any.
30351 *
30352 * Returns: (transfer full): A #Hwmon that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
30353 */
30354Hwmon *object_get_hwmon (Object *object)
30355{
30356 GDBusInterface *ret;
30357 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Hwmon");
30358 if (ret == NULL)
30359 return NULL;
30360 return HWMON (ret);
30361}
30362
30363/**
Norman James362a80f2015-09-14 14:04:39 -050030364 * object_get_fan:
30365 * @object: A #Object.
30366 *
30367 * Gets the #Fan instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link> on @object, if any.
30368 *
30369 * Returns: (transfer full): A #Fan that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
30370 */
30371Fan *object_get_fan (Object *object)
30372{
30373 GDBusInterface *ret;
30374 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan");
30375 if (ret == NULL)
30376 return NULL;
30377 return FAN (ret);
30378}
30379
30380/**
30381 * object_get_sensor_value:
30382 * @object: A #Object.
30383 *
30384 * Gets the #SensorValue instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link> on @object, if any.
30385 *
30386 * Returns: (transfer full): A #SensorValue that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
30387 */
30388SensorValue *object_get_sensor_value (Object *object)
30389{
30390 GDBusInterface *ret;
30391 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue");
30392 if (ret == NULL)
30393 return NULL;
30394 return SENSOR_VALUE (ret);
30395}
30396
30397/**
30398 * object_get_sensor_threshold:
30399 * @object: A #Object.
30400 *
30401 * Gets the #SensorThreshold instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link> on @object, if any.
30402 *
30403 * Returns: (transfer full): A #SensorThreshold that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
30404 */
30405SensorThreshold *object_get_sensor_threshold (Object *object)
30406{
30407 GDBusInterface *ret;
30408 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold");
30409 if (ret == NULL)
30410 return NULL;
30411 return SENSOR_THRESHOLD (ret);
30412}
30413
30414/**
30415 * object_get_sensor_i2c:
30416 * @object: A #Object.
30417 *
30418 * Gets the #SensorI2c instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link> on @object, if any.
30419 *
30420 * Returns: (transfer full): A #SensorI2c that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
30421 */
30422SensorI2c *object_get_sensor_i2c (Object *object)
30423{
30424 GDBusInterface *ret;
30425 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
30426 if (ret == NULL)
30427 return NULL;
30428 return SENSOR_I2C (ret);
30429}
30430
30431/**
30432 * object_get_sensor_match:
30433 * @object: A #Object.
30434 *
30435 * Gets the #SensorMatch instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link> on @object, if any.
30436 *
30437 * Returns: (transfer full): A #SensorMatch that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
30438 */
30439SensorMatch *object_get_sensor_match (Object *object)
30440{
30441 GDBusInterface *ret;
30442 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch");
30443 if (ret == NULL)
30444 return NULL;
30445 return SENSOR_MATCH (ret);
30446}
30447
30448/**
30449 * object_get_process:
30450 * @object: A #Object.
30451 *
30452 * Gets the #Process instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link> on @object, if any.
30453 *
30454 * Returns: (transfer full): A #Process that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
30455 */
30456Process *object_get_process (Object *object)
30457{
30458 GDBusInterface *ret;
30459 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process");
30460 if (ret == NULL)
30461 return NULL;
30462 return PROCESS (ret);
30463}
30464
30465/**
Norman James18998182015-10-11 21:54:53 -050030466 * object_get_shared_resource:
30467 * @object: A #Object.
30468 *
30469 * Gets the #SharedResource instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link> on @object, if any.
30470 *
30471 * Returns: (transfer full): A #SharedResource that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
30472 */
30473SharedResource *object_get_shared_resource (Object *object)
30474{
30475 GDBusInterface *ret;
30476 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SharedResource");
30477 if (ret == NULL)
30478 return NULL;
30479 return SHARED_RESOURCE (ret);
30480}
30481
30482/**
Norman James362a80f2015-09-14 14:04:39 -050030483 * object_get_control:
30484 * @object: A #Object.
30485 *
30486 * Gets the #Control instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link> on @object, if any.
30487 *
30488 * Returns: (transfer full): A #Control that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
30489 */
30490Control *object_get_control (Object *object)
30491{
30492 GDBusInterface *ret;
30493 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control");
30494 if (ret == NULL)
30495 return NULL;
30496 return CONTROL (ret);
30497}
30498
30499/**
30500 * object_get_control_bmc:
30501 * @object: A #Object.
30502 *
30503 * Gets the #ControlBmc instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Bmc.top_of_page">org.openbmc.control.Bmc</link> on @object, if any.
30504 *
30505 * Returns: (transfer full): A #ControlBmc that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
30506 */
30507ControlBmc *object_get_control_bmc (Object *object)
30508{
30509 GDBusInterface *ret;
30510 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc");
30511 if (ret == NULL)
30512 return NULL;
30513 return CONTROL_BMC (ret);
30514}
30515
30516/**
30517 * object_get_control_host:
30518 * @object: A #Object.
30519 *
30520 * Gets the #ControlHost instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link> on @object, if any.
30521 *
30522 * Returns: (transfer full): A #ControlHost that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
30523 */
30524ControlHost *object_get_control_host (Object *object)
30525{
30526 GDBusInterface *ret;
30527 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
30528 if (ret == NULL)
30529 return NULL;
30530 return CONTROL_HOST (ret);
30531}
30532
30533/**
30534 * object_get_control_power:
30535 * @object: A #Object.
30536 *
30537 * Gets the #ControlPower instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Power.top_of_page">org.openbmc.control.Power</link> on @object, if any.
30538 *
30539 * Returns: (transfer full): A #ControlPower that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
30540 */
30541ControlPower *object_get_control_power (Object *object)
30542{
30543 GDBusInterface *ret;
30544 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power");
30545 if (ret == NULL)
30546 return NULL;
30547 return CONTROL_POWER (ret);
30548}
30549
30550/**
Adriana Kobylakfd778822016-06-16 09:08:37 -050030551 * object_get_control_checkstop:
30552 * @object: A #Object.
30553 *
30554 * Gets the #ControlCheckstop instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Checkstop.top_of_page">org.openbmc.control.Checkstop</link> on @object, if any.
30555 *
30556 * Returns: (transfer full): A #ControlCheckstop that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
30557 */
30558ControlCheckstop *object_get_control_checkstop (Object *object)
30559{
30560 GDBusInterface *ret;
30561 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Checkstop");
30562 if (ret == NULL)
30563 return NULL;
30564 return CONTROL_CHECKSTOP (ret);
30565}
30566
30567/**
Norman James362a80f2015-09-14 14:04:39 -050030568 * object_get_watchdog:
30569 * @object: A #Object.
30570 *
30571 * Gets the #Watchdog instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link> on @object, if any.
30572 *
30573 * Returns: (transfer full): A #Watchdog that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
30574 */
30575Watchdog *object_get_watchdog (Object *object)
30576{
30577 GDBusInterface *ret;
30578 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog");
30579 if (ret == NULL)
30580 return NULL;
30581 return WATCHDOG (ret);
30582}
30583
30584/**
30585 * object_get_event_log:
30586 * @object: A #Object.
30587 *
30588 * Gets the #EventLog instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link> on @object, if any.
30589 *
30590 * Returns: (transfer full): A #EventLog that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
30591 */
30592EventLog *object_get_event_log (Object *object)
30593{
30594 GDBusInterface *ret;
30595 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
30596 if (ret == NULL)
30597 return NULL;
30598 return EVENT_LOG (ret);
30599}
30600
30601/**
30602 * object_get_flash:
30603 * @object: A #Object.
30604 *
30605 * Gets the #Flash instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link> on @object, if any.
30606 *
30607 * Returns: (transfer full): A #Flash that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
30608 */
30609Flash *object_get_flash (Object *object)
30610{
30611 GDBusInterface *ret;
30612 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash");
30613 if (ret == NULL)
30614 return NULL;
30615 return FLASH (ret);
30616}
30617
30618/**
Norman James18998182015-10-11 21:54:53 -050030619 * object_get_flash_control:
30620 * @object: A #Object.
30621 *
30622 * Gets the #FlashControl instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link> on @object, if any.
30623 *
30624 * Returns: (transfer full): A #FlashControl that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
30625 */
30626FlashControl *object_get_flash_control (Object *object)
30627{
30628 GDBusInterface *ret;
30629 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.FlashControl");
30630 if (ret == NULL)
30631 return NULL;
30632 return FLASH_CONTROL (ret);
30633}
30634
30635/**
Norman James362a80f2015-09-14 14:04:39 -050030636 * object_get_button:
30637 * @object: A #Object.
30638 *
30639 * Gets the #Button instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link> on @object, if any.
30640 *
30641 * Returns: (transfer full): A #Button that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
30642 */
30643Button *object_get_button (Object *object)
30644{
30645 GDBusInterface *ret;
30646 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button");
30647 if (ret == NULL)
30648 return NULL;
30649 return BUTTON (ret);
30650}
30651
30652/**
30653 * object_get_led:
30654 * @object: A #Object.
30655 *
30656 * Gets the #Led instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link> on @object, if any.
30657 *
30658 * Returns: (transfer full): A #Led that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
30659 */
30660Led *object_get_led (Object *object)
30661{
30662 GDBusInterface *ret;
30663 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led");
30664 if (ret == NULL)
30665 return NULL;
30666 return LED (ret);
30667}
30668
Norman Jamesdbcffbd2015-10-06 16:53:06 -050030669/**
30670 * object_get_host_ipmi:
30671 * @object: A #Object.
30672 *
30673 * Gets the #HostIpmi instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link> on @object, if any.
30674 *
30675 * Returns: (transfer full): A #HostIpmi that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
30676 */
30677HostIpmi *object_get_host_ipmi (Object *object)
30678{
30679 GDBusInterface *ret;
30680 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.HostIpmi");
30681 if (ret == NULL)
30682 return NULL;
30683 return HOST_IPMI (ret);
30684}
30685
Norman James362a80f2015-09-14 14:04:39 -050030686
30687/**
Norman James5236a8f2015-11-05 20:39:31 -060030688 * object_peek_hwmon: (skip)
30689 * @object: A #Object.
30690 *
30691 * Like object_get_hwmon() but doesn't increase the reference count on the returned object.
30692 *
30693 * <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>
30694 *
30695 * Returns: (transfer none): A #Hwmon or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
30696 */
30697Hwmon *object_peek_hwmon (Object *object)
30698{
30699 GDBusInterface *ret;
30700 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Hwmon");
30701 if (ret == NULL)
30702 return NULL;
30703 g_object_unref (ret);
30704 return HWMON (ret);
30705}
30706
30707/**
Norman James362a80f2015-09-14 14:04:39 -050030708 * object_peek_fan: (skip)
30709 * @object: A #Object.
30710 *
30711 * Like object_get_fan() but doesn't increase the reference count on the returned object.
30712 *
30713 * <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>
30714 *
30715 * Returns: (transfer none): A #Fan or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
30716 */
30717Fan *object_peek_fan (Object *object)
30718{
30719 GDBusInterface *ret;
30720 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan");
30721 if (ret == NULL)
30722 return NULL;
30723 g_object_unref (ret);
30724 return FAN (ret);
30725}
30726
30727/**
30728 * object_peek_sensor_value: (skip)
30729 * @object: A #Object.
30730 *
30731 * Like object_get_sensor_value() but doesn't increase the reference count on the returned object.
30732 *
30733 * <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>
30734 *
30735 * Returns: (transfer none): A #SensorValue or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
30736 */
30737SensorValue *object_peek_sensor_value (Object *object)
30738{
30739 GDBusInterface *ret;
30740 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue");
30741 if (ret == NULL)
30742 return NULL;
30743 g_object_unref (ret);
30744 return SENSOR_VALUE (ret);
30745}
30746
30747/**
30748 * object_peek_sensor_threshold: (skip)
30749 * @object: A #Object.
30750 *
30751 * Like object_get_sensor_threshold() but doesn't increase the reference count on the returned object.
30752 *
30753 * <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>
30754 *
30755 * Returns: (transfer none): A #SensorThreshold or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
30756 */
30757SensorThreshold *object_peek_sensor_threshold (Object *object)
30758{
30759 GDBusInterface *ret;
30760 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold");
30761 if (ret == NULL)
30762 return NULL;
30763 g_object_unref (ret);
30764 return SENSOR_THRESHOLD (ret);
30765}
30766
30767/**
30768 * object_peek_sensor_i2c: (skip)
30769 * @object: A #Object.
30770 *
30771 * Like object_get_sensor_i2c() but doesn't increase the reference count on the returned object.
30772 *
30773 * <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>
30774 *
30775 * Returns: (transfer none): A #SensorI2c or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
30776 */
30777SensorI2c *object_peek_sensor_i2c (Object *object)
30778{
30779 GDBusInterface *ret;
30780 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
30781 if (ret == NULL)
30782 return NULL;
30783 g_object_unref (ret);
30784 return SENSOR_I2C (ret);
30785}
30786
30787/**
30788 * object_peek_sensor_match: (skip)
30789 * @object: A #Object.
30790 *
30791 * Like object_get_sensor_match() but doesn't increase the reference count on the returned object.
30792 *
30793 * <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>
30794 *
30795 * Returns: (transfer none): A #SensorMatch or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
30796 */
30797SensorMatch *object_peek_sensor_match (Object *object)
30798{
30799 GDBusInterface *ret;
30800 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch");
30801 if (ret == NULL)
30802 return NULL;
30803 g_object_unref (ret);
30804 return SENSOR_MATCH (ret);
30805}
30806
30807/**
30808 * object_peek_process: (skip)
30809 * @object: A #Object.
30810 *
30811 * Like object_get_process() but doesn't increase the reference count on the returned object.
30812 *
30813 * <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>
30814 *
30815 * Returns: (transfer none): A #Process or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
30816 */
30817Process *object_peek_process (Object *object)
30818{
30819 GDBusInterface *ret;
30820 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process");
30821 if (ret == NULL)
30822 return NULL;
30823 g_object_unref (ret);
30824 return PROCESS (ret);
30825}
30826
30827/**
Norman James18998182015-10-11 21:54:53 -050030828 * object_peek_shared_resource: (skip)
30829 * @object: A #Object.
30830 *
30831 * Like object_get_shared_resource() but doesn't increase the reference count on the returned object.
30832 *
30833 * <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>
30834 *
30835 * Returns: (transfer none): A #SharedResource or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
30836 */
30837SharedResource *object_peek_shared_resource (Object *object)
30838{
30839 GDBusInterface *ret;
30840 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SharedResource");
30841 if (ret == NULL)
30842 return NULL;
30843 g_object_unref (ret);
30844 return SHARED_RESOURCE (ret);
30845}
30846
30847/**
Norman James362a80f2015-09-14 14:04:39 -050030848 * object_peek_control: (skip)
30849 * @object: A #Object.
30850 *
30851 * Like object_get_control() but doesn't increase the reference count on the returned object.
30852 *
30853 * <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>
30854 *
30855 * Returns: (transfer none): A #Control or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
30856 */
30857Control *object_peek_control (Object *object)
30858{
30859 GDBusInterface *ret;
30860 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control");
30861 if (ret == NULL)
30862 return NULL;
30863 g_object_unref (ret);
30864 return CONTROL (ret);
30865}
30866
30867/**
30868 * object_peek_control_bmc: (skip)
30869 * @object: A #Object.
30870 *
30871 * Like object_get_control_bmc() but doesn't increase the reference count on the returned object.
30872 *
30873 * <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>
30874 *
30875 * Returns: (transfer none): A #ControlBmc or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
30876 */
30877ControlBmc *object_peek_control_bmc (Object *object)
30878{
30879 GDBusInterface *ret;
30880 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc");
30881 if (ret == NULL)
30882 return NULL;
30883 g_object_unref (ret);
30884 return CONTROL_BMC (ret);
30885}
30886
30887/**
30888 * object_peek_control_host: (skip)
30889 * @object: A #Object.
30890 *
30891 * Like object_get_control_host() but doesn't increase the reference count on the returned object.
30892 *
30893 * <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>
30894 *
30895 * Returns: (transfer none): A #ControlHost or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
30896 */
30897ControlHost *object_peek_control_host (Object *object)
30898{
30899 GDBusInterface *ret;
30900 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
30901 if (ret == NULL)
30902 return NULL;
30903 g_object_unref (ret);
30904 return CONTROL_HOST (ret);
30905}
30906
30907/**
30908 * object_peek_control_power: (skip)
30909 * @object: A #Object.
30910 *
30911 * Like object_get_control_power() but doesn't increase the reference count on the returned object.
30912 *
30913 * <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>
30914 *
30915 * Returns: (transfer none): A #ControlPower or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
30916 */
30917ControlPower *object_peek_control_power (Object *object)
30918{
30919 GDBusInterface *ret;
30920 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power");
30921 if (ret == NULL)
30922 return NULL;
30923 g_object_unref (ret);
30924 return CONTROL_POWER (ret);
30925}
30926
30927/**
Adriana Kobylakfd778822016-06-16 09:08:37 -050030928 * object_peek_control_checkstop: (skip)
30929 * @object: A #Object.
30930 *
30931 * Like object_get_control_checkstop() but doesn't increase the reference count on the returned object.
30932 *
30933 * <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>
30934 *
30935 * Returns: (transfer none): A #ControlCheckstop or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
30936 */
30937ControlCheckstop *object_peek_control_checkstop (Object *object)
30938{
30939 GDBusInterface *ret;
30940 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Checkstop");
30941 if (ret == NULL)
30942 return NULL;
30943 g_object_unref (ret);
30944 return CONTROL_CHECKSTOP (ret);
30945}
30946
30947/**
Norman James362a80f2015-09-14 14:04:39 -050030948 * object_peek_watchdog: (skip)
30949 * @object: A #Object.
30950 *
30951 * Like object_get_watchdog() but doesn't increase the reference count on the returned object.
30952 *
30953 * <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>
30954 *
30955 * Returns: (transfer none): A #Watchdog or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
30956 */
30957Watchdog *object_peek_watchdog (Object *object)
30958{
30959 GDBusInterface *ret;
30960 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog");
30961 if (ret == NULL)
30962 return NULL;
30963 g_object_unref (ret);
30964 return WATCHDOG (ret);
30965}
30966
30967/**
30968 * object_peek_event_log: (skip)
30969 * @object: A #Object.
30970 *
30971 * Like object_get_event_log() but doesn't increase the reference count on the returned object.
30972 *
30973 * <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>
30974 *
30975 * Returns: (transfer none): A #EventLog or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
30976 */
30977EventLog *object_peek_event_log (Object *object)
30978{
30979 GDBusInterface *ret;
30980 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
30981 if (ret == NULL)
30982 return NULL;
30983 g_object_unref (ret);
30984 return EVENT_LOG (ret);
30985}
30986
30987/**
30988 * object_peek_flash: (skip)
30989 * @object: A #Object.
30990 *
30991 * Like object_get_flash() but doesn't increase the reference count on the returned object.
30992 *
30993 * <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>
30994 *
30995 * Returns: (transfer none): A #Flash or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
30996 */
30997Flash *object_peek_flash (Object *object)
30998{
30999 GDBusInterface *ret;
31000 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash");
31001 if (ret == NULL)
31002 return NULL;
31003 g_object_unref (ret);
31004 return FLASH (ret);
31005}
31006
31007/**
Norman James18998182015-10-11 21:54:53 -050031008 * object_peek_flash_control: (skip)
31009 * @object: A #Object.
31010 *
31011 * Like object_get_flash_control() but doesn't increase the reference count on the returned object.
31012 *
31013 * <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>
31014 *
31015 * Returns: (transfer none): A #FlashControl or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
31016 */
31017FlashControl *object_peek_flash_control (Object *object)
31018{
31019 GDBusInterface *ret;
31020 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.FlashControl");
31021 if (ret == NULL)
31022 return NULL;
31023 g_object_unref (ret);
31024 return FLASH_CONTROL (ret);
31025}
31026
31027/**
Norman James362a80f2015-09-14 14:04:39 -050031028 * object_peek_button: (skip)
31029 * @object: A #Object.
31030 *
31031 * Like object_get_button() but doesn't increase the reference count on the returned object.
31032 *
31033 * <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>
31034 *
31035 * Returns: (transfer none): A #Button or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
31036 */
31037Button *object_peek_button (Object *object)
31038{
31039 GDBusInterface *ret;
31040 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button");
31041 if (ret == NULL)
31042 return NULL;
31043 g_object_unref (ret);
31044 return BUTTON (ret);
31045}
31046
31047/**
31048 * object_peek_led: (skip)
31049 * @object: A #Object.
31050 *
31051 * Like object_get_led() but doesn't increase the reference count on the returned object.
31052 *
31053 * <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>
31054 *
31055 * Returns: (transfer none): A #Led or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
31056 */
31057Led *object_peek_led (Object *object)
31058{
31059 GDBusInterface *ret;
31060 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led");
31061 if (ret == NULL)
31062 return NULL;
31063 g_object_unref (ret);
31064 return LED (ret);
31065}
31066
Norman Jamesdbcffbd2015-10-06 16:53:06 -050031067/**
31068 * object_peek_host_ipmi: (skip)
31069 * @object: A #Object.
31070 *
31071 * Like object_get_host_ipmi() but doesn't increase the reference count on the returned object.
31072 *
31073 * <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>
31074 *
31075 * Returns: (transfer none): A #HostIpmi or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
31076 */
31077HostIpmi *object_peek_host_ipmi (Object *object)
31078{
31079 GDBusInterface *ret;
31080 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.HostIpmi");
31081 if (ret == NULL)
31082 return NULL;
31083 g_object_unref (ret);
31084 return HOST_IPMI (ret);
31085}
31086
Norman James362a80f2015-09-14 14:04:39 -050031087
31088static void
31089object_notify (GDBusObject *object, GDBusInterface *interface)
31090{
31091 _ExtendedGDBusInterfaceInfo *info = (_ExtendedGDBusInterfaceInfo *) g_dbus_interface_get_info (interface);
31092 /* info can be NULL if the other end is using a D-Bus interface we don't know
31093 * anything about, for example old generated code in this process talking to
31094 * newer generated code in the other process. */
31095 if (info != NULL)
31096 g_object_notify (G_OBJECT (object), info->hyphen_name);
31097}
31098
31099/**
31100 * ObjectProxy:
31101 *
31102 * The #ObjectProxy structure contains only private data and should only be accessed using the provided API.
31103 */
31104
31105/**
31106 * ObjectProxyClass:
31107 * @parent_class: The parent class.
31108 *
31109 * Class structure for #ObjectProxy.
31110 */
31111
31112static void
31113object_proxy__object_iface_init (ObjectIface *iface G_GNUC_UNUSED)
31114{
31115}
31116
31117static void
31118object_proxy__g_dbus_object_iface_init (GDBusObjectIface *iface)
31119{
31120 iface->interface_added = object_notify;
31121 iface->interface_removed = object_notify;
31122}
31123
31124
31125G_DEFINE_TYPE_WITH_CODE (ObjectProxy, object_proxy, G_TYPE_DBUS_OBJECT_PROXY,
31126 G_IMPLEMENT_INTERFACE (TYPE_OBJECT, object_proxy__object_iface_init)
31127 G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, object_proxy__g_dbus_object_iface_init));
31128
31129static void
31130object_proxy_init (ObjectProxy *object G_GNUC_UNUSED)
31131{
31132}
31133
31134static void
31135object_proxy_set_property (GObject *gobject,
31136 guint prop_id,
31137 const GValue *value G_GNUC_UNUSED,
31138 GParamSpec *pspec)
31139{
31140 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
31141}
31142
31143static void
31144object_proxy_get_property (GObject *gobject,
31145 guint prop_id,
31146 GValue *value,
31147 GParamSpec *pspec)
31148{
31149 ObjectProxy *object = OBJECT_PROXY (gobject);
31150 GDBusInterface *interface;
31151
31152 switch (prop_id)
31153 {
31154 case 1:
Norman James5236a8f2015-11-05 20:39:31 -060031155 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Hwmon");
Norman James362a80f2015-09-14 14:04:39 -050031156 g_value_take_object (value, interface);
31157 break;
31158
Brad Bishop6bbf6462016-06-21 15:12:19 -040031159 case 2:
Norman James5236a8f2015-11-05 20:39:31 -060031160 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan");
Norman James362a80f2015-09-14 14:04:39 -050031161 g_value_take_object (value, interface);
31162 break;
31163
Brad Bishop6bbf6462016-06-21 15:12:19 -040031164 case 3:
Norman James5236a8f2015-11-05 20:39:31 -060031165 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue");
Norman James362a80f2015-09-14 14:04:39 -050031166 g_value_take_object (value, interface);
31167 break;
31168
Brad Bishop6bbf6462016-06-21 15:12:19 -040031169 case 4:
Norman James5236a8f2015-11-05 20:39:31 -060031170 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold");
Norman James362a80f2015-09-14 14:04:39 -050031171 g_value_take_object (value, interface);
31172 break;
31173
Brad Bishop6bbf6462016-06-21 15:12:19 -040031174 case 5:
Norman James5236a8f2015-11-05 20:39:31 -060031175 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
Norman James362a80f2015-09-14 14:04:39 -050031176 g_value_take_object (value, interface);
31177 break;
31178
Brad Bishop6bbf6462016-06-21 15:12:19 -040031179 case 6:
Norman James5236a8f2015-11-05 20:39:31 -060031180 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch");
Norman James362a80f2015-09-14 14:04:39 -050031181 g_value_take_object (value, interface);
31182 break;
31183
Brad Bishop6bbf6462016-06-21 15:12:19 -040031184 case 7:
Norman James5236a8f2015-11-05 20:39:31 -060031185 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process");
Norman James362a80f2015-09-14 14:04:39 -050031186 g_value_take_object (value, interface);
31187 break;
31188
Brad Bishop6bbf6462016-06-21 15:12:19 -040031189 case 8:
Norman James5236a8f2015-11-05 20:39:31 -060031190 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SharedResource");
Norman James362a80f2015-09-14 14:04:39 -050031191 g_value_take_object (value, interface);
31192 break;
31193
Brad Bishop6bbf6462016-06-21 15:12:19 -040031194 case 9:
Norman James5236a8f2015-11-05 20:39:31 -060031195 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control");
Norman James362a80f2015-09-14 14:04:39 -050031196 g_value_take_object (value, interface);
31197 break;
31198
Brad Bishop6bbf6462016-06-21 15:12:19 -040031199 case 10:
Norman James5236a8f2015-11-05 20:39:31 -060031200 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc");
Norman James362a80f2015-09-14 14:04:39 -050031201 g_value_take_object (value, interface);
31202 break;
31203
Brad Bishop6bbf6462016-06-21 15:12:19 -040031204 case 11:
Norman James5236a8f2015-11-05 20:39:31 -060031205 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
Norman James362a80f2015-09-14 14:04:39 -050031206 g_value_take_object (value, interface);
31207 break;
31208
Brad Bishop6bbf6462016-06-21 15:12:19 -040031209 case 12:
Norman James5236a8f2015-11-05 20:39:31 -060031210 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power");
Norman James362a80f2015-09-14 14:04:39 -050031211 g_value_take_object (value, interface);
31212 break;
31213
Brad Bishop6bbf6462016-06-21 15:12:19 -040031214 case 13:
Adriana Kobylakfd778822016-06-16 09:08:37 -050031215 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Checkstop");
Norman Jamesdfdaca92015-09-27 22:11:15 -050031216 g_value_take_object (value, interface);
31217 break;
31218
Brad Bishop6bbf6462016-06-21 15:12:19 -040031219 case 14:
Adriana Kobylakfd778822016-06-16 09:08:37 -050031220 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog");
Norman James362a80f2015-09-14 14:04:39 -050031221 g_value_take_object (value, interface);
31222 break;
31223
Brad Bishop6bbf6462016-06-21 15:12:19 -040031224 case 15:
Adriana Kobylakfd778822016-06-16 09:08:37 -050031225 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
Norman James18998182015-10-11 21:54:53 -050031226 g_value_take_object (value, interface);
31227 break;
31228
Brad Bishop6bbf6462016-06-21 15:12:19 -040031229 case 16:
Adriana Kobylakfd778822016-06-16 09:08:37 -050031230 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash");
Norman James18998182015-10-11 21:54:53 -050031231 g_value_take_object (value, interface);
31232 break;
31233
Brad Bishop6bbf6462016-06-21 15:12:19 -040031234 case 17:
Adriana Kobylakfd778822016-06-16 09:08:37 -050031235 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.FlashControl");
Norman James493996c2015-10-31 17:27:13 -050031236 g_value_take_object (value, interface);
31237 break;
31238
Brad Bishop6bbf6462016-06-21 15:12:19 -040031239 case 18:
Adriana Kobylakfd778822016-06-16 09:08:37 -050031240 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button");
Norman James5236a8f2015-11-05 20:39:31 -060031241 g_value_take_object (value, interface);
31242 break;
31243
Brad Bishop6bbf6462016-06-21 15:12:19 -040031244 case 19:
Adriana Kobylakfd778822016-06-16 09:08:37 -050031245 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led");
31246 g_value_take_object (value, interface);
31247 break;
31248
Brad Bishop6bbf6462016-06-21 15:12:19 -040031249 case 20:
Norman Jamesdbcffbd2015-10-06 16:53:06 -050031250 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.HostIpmi");
31251 g_value_take_object (value, interface);
31252 break;
31253
Norman James362a80f2015-09-14 14:04:39 -050031254 default:
31255 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
31256 break;
31257 }
31258}
31259
31260static void
31261object_proxy_class_init (ObjectProxyClass *klass)
31262{
31263 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
31264
31265 gobject_class->set_property = object_proxy_set_property;
31266 gobject_class->get_property = object_proxy_get_property;
31267
Brad Bishop6bbf6462016-06-21 15:12:19 -040031268 g_object_class_override_property (gobject_class, 1, "hwmon");
31269 g_object_class_override_property (gobject_class, 2, "fan");
31270 g_object_class_override_property (gobject_class, 3, "sensor-value");
31271 g_object_class_override_property (gobject_class, 4, "sensor-threshold");
31272 g_object_class_override_property (gobject_class, 5, "sensor-i2c");
31273 g_object_class_override_property (gobject_class, 6, "sensor-match");
31274 g_object_class_override_property (gobject_class, 7, "process");
31275 g_object_class_override_property (gobject_class, 8, "shared-resource");
31276 g_object_class_override_property (gobject_class, 9, "control");
31277 g_object_class_override_property (gobject_class, 10, "control-bmc");
31278 g_object_class_override_property (gobject_class, 11, "control-host");
31279 g_object_class_override_property (gobject_class, 12, "control-power");
31280 g_object_class_override_property (gobject_class, 13, "control-checkstop");
31281 g_object_class_override_property (gobject_class, 14, "watchdog");
31282 g_object_class_override_property (gobject_class, 15, "event-log");
31283 g_object_class_override_property (gobject_class, 16, "flash");
31284 g_object_class_override_property (gobject_class, 17, "flash-control");
31285 g_object_class_override_property (gobject_class, 18, "button");
31286 g_object_class_override_property (gobject_class, 19, "led");
31287 g_object_class_override_property (gobject_class, 20, "host-ipmi");
Norman James362a80f2015-09-14 14:04:39 -050031288}
31289
31290/**
31291 * object_proxy_new:
31292 * @connection: A #GDBusConnection.
31293 * @object_path: An object path.
31294 *
31295 * Creates a new proxy object.
31296 *
31297 * Returns: (transfer full): The proxy object.
31298 */
31299ObjectProxy *
31300object_proxy_new (GDBusConnection *connection,
31301 const gchar *object_path)
31302{
31303 g_return_val_if_fail (G_IS_DBUS_CONNECTION (connection), NULL);
31304 g_return_val_if_fail (g_variant_is_object_path (object_path), NULL);
31305 return OBJECT_PROXY (g_object_new (TYPE_OBJECT_PROXY, "g-connection", connection, "g-object-path", object_path, NULL));
31306}
31307
31308/**
31309 * ObjectSkeleton:
31310 *
31311 * The #ObjectSkeleton structure contains only private data and should only be accessed using the provided API.
31312 */
31313
31314/**
31315 * ObjectSkeletonClass:
31316 * @parent_class: The parent class.
31317 *
31318 * Class structure for #ObjectSkeleton.
31319 */
31320
31321static void
31322object_skeleton__object_iface_init (ObjectIface *iface G_GNUC_UNUSED)
31323{
31324}
31325
31326
31327static void
31328object_skeleton__g_dbus_object_iface_init (GDBusObjectIface *iface)
31329{
31330 iface->interface_added = object_notify;
31331 iface->interface_removed = object_notify;
31332}
31333
31334G_DEFINE_TYPE_WITH_CODE (ObjectSkeleton, object_skeleton, G_TYPE_DBUS_OBJECT_SKELETON,
31335 G_IMPLEMENT_INTERFACE (TYPE_OBJECT, object_skeleton__object_iface_init)
31336 G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, object_skeleton__g_dbus_object_iface_init));
31337
31338static void
31339object_skeleton_init (ObjectSkeleton *object G_GNUC_UNUSED)
31340{
31341}
31342
31343static void
31344object_skeleton_set_property (GObject *gobject,
31345 guint prop_id,
31346 const GValue *value,
31347 GParamSpec *pspec)
31348{
31349 ObjectSkeleton *object = OBJECT_SKELETON (gobject);
31350 GDBusInterfaceSkeleton *interface;
31351
31352 switch (prop_id)
31353 {
31354 case 1:
31355 interface = g_value_get_object (value);
31356 if (interface != NULL)
31357 {
Norman James5236a8f2015-11-05 20:39:31 -060031358 g_warn_if_fail (IS_HWMON (interface));
31359 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
31360 }
31361 else
31362 {
31363 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Hwmon");
31364 }
31365 break;
31366
Brad Bishop6bbf6462016-06-21 15:12:19 -040031367 case 2:
Norman James5236a8f2015-11-05 20:39:31 -060031368 interface = g_value_get_object (value);
31369 if (interface != NULL)
31370 {
Norman James362a80f2015-09-14 14:04:39 -050031371 g_warn_if_fail (IS_FAN (interface));
31372 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
31373 }
31374 else
31375 {
31376 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Fan");
31377 }
31378 break;
31379
Brad Bishop6bbf6462016-06-21 15:12:19 -040031380 case 3:
Norman James362a80f2015-09-14 14:04:39 -050031381 interface = g_value_get_object (value);
31382 if (interface != NULL)
31383 {
31384 g_warn_if_fail (IS_SENSOR_VALUE (interface));
31385 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
31386 }
31387 else
31388 {
31389 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorValue");
31390 }
31391 break;
31392
Brad Bishop6bbf6462016-06-21 15:12:19 -040031393 case 4:
Norman James362a80f2015-09-14 14:04:39 -050031394 interface = g_value_get_object (value);
31395 if (interface != NULL)
31396 {
31397 g_warn_if_fail (IS_SENSOR_THRESHOLD (interface));
31398 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
31399 }
31400 else
31401 {
31402 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorThreshold");
31403 }
31404 break;
31405
Brad Bishop6bbf6462016-06-21 15:12:19 -040031406 case 5:
Norman James362a80f2015-09-14 14:04:39 -050031407 interface = g_value_get_object (value);
31408 if (interface != NULL)
31409 {
31410 g_warn_if_fail (IS_SENSOR_I2C (interface));
31411 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
31412 }
31413 else
31414 {
31415 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorI2c");
31416 }
31417 break;
31418
Brad Bishop6bbf6462016-06-21 15:12:19 -040031419 case 6:
Norman James362a80f2015-09-14 14:04:39 -050031420 interface = g_value_get_object (value);
31421 if (interface != NULL)
31422 {
31423 g_warn_if_fail (IS_SENSOR_MATCH (interface));
31424 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
31425 }
31426 else
31427 {
31428 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorMatch");
31429 }
31430 break;
31431
Brad Bishop6bbf6462016-06-21 15:12:19 -040031432 case 7:
Norman James362a80f2015-09-14 14:04:39 -050031433 interface = g_value_get_object (value);
31434 if (interface != NULL)
31435 {
31436 g_warn_if_fail (IS_PROCESS (interface));
31437 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
31438 }
31439 else
31440 {
31441 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Process");
31442 }
31443 break;
31444
Brad Bishop6bbf6462016-06-21 15:12:19 -040031445 case 8:
Norman James362a80f2015-09-14 14:04:39 -050031446 interface = g_value_get_object (value);
31447 if (interface != NULL)
31448 {
Norman James18998182015-10-11 21:54:53 -050031449 g_warn_if_fail (IS_SHARED_RESOURCE (interface));
31450 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
31451 }
31452 else
31453 {
31454 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SharedResource");
31455 }
31456 break;
31457
Brad Bishop6bbf6462016-06-21 15:12:19 -040031458 case 9:
Norman James18998182015-10-11 21:54:53 -050031459 interface = g_value_get_object (value);
31460 if (interface != NULL)
31461 {
Norman James362a80f2015-09-14 14:04:39 -050031462 g_warn_if_fail (IS_CONTROL (interface));
31463 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
31464 }
31465 else
31466 {
31467 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Control");
31468 }
31469 break;
31470
Brad Bishop6bbf6462016-06-21 15:12:19 -040031471 case 10:
Norman James362a80f2015-09-14 14:04:39 -050031472 interface = g_value_get_object (value);
31473 if (interface != NULL)
31474 {
31475 g_warn_if_fail (IS_CONTROL_BMC (interface));
31476 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
31477 }
31478 else
31479 {
31480 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.control.Bmc");
31481 }
31482 break;
31483
Brad Bishop6bbf6462016-06-21 15:12:19 -040031484 case 11:
Norman James362a80f2015-09-14 14:04:39 -050031485 interface = g_value_get_object (value);
31486 if (interface != NULL)
31487 {
31488 g_warn_if_fail (IS_CONTROL_HOST (interface));
31489 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
31490 }
31491 else
31492 {
31493 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.control.Host");
31494 }
31495 break;
31496
Brad Bishop6bbf6462016-06-21 15:12:19 -040031497 case 12:
Norman James362a80f2015-09-14 14:04:39 -050031498 interface = g_value_get_object (value);
31499 if (interface != NULL)
31500 {
31501 g_warn_if_fail (IS_CONTROL_POWER (interface));
31502 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
31503 }
31504 else
31505 {
31506 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.control.Power");
31507 }
31508 break;
31509
Brad Bishop6bbf6462016-06-21 15:12:19 -040031510 case 13:
Norman James362a80f2015-09-14 14:04:39 -050031511 interface = g_value_get_object (value);
31512 if (interface != NULL)
31513 {
Adriana Kobylakfd778822016-06-16 09:08:37 -050031514 g_warn_if_fail (IS_CONTROL_CHECKSTOP (interface));
31515 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
31516 }
31517 else
31518 {
31519 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.control.Checkstop");
31520 }
31521 break;
31522
Brad Bishop6bbf6462016-06-21 15:12:19 -040031523 case 14:
Adriana Kobylakfd778822016-06-16 09:08:37 -050031524 interface = g_value_get_object (value);
31525 if (interface != NULL)
31526 {
Norman James362a80f2015-09-14 14:04:39 -050031527 g_warn_if_fail (IS_WATCHDOG (interface));
31528 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
31529 }
31530 else
31531 {
31532 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Watchdog");
31533 }
31534 break;
31535
Brad Bishop6bbf6462016-06-21 15:12:19 -040031536 case 15:
Norman James362a80f2015-09-14 14:04:39 -050031537 interface = g_value_get_object (value);
31538 if (interface != NULL)
31539 {
31540 g_warn_if_fail (IS_EVENT_LOG (interface));
31541 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
31542 }
31543 else
31544 {
31545 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.EventLog");
31546 }
31547 break;
31548
Brad Bishop6bbf6462016-06-21 15:12:19 -040031549 case 16:
Norman James362a80f2015-09-14 14:04:39 -050031550 interface = g_value_get_object (value);
31551 if (interface != NULL)
31552 {
31553 g_warn_if_fail (IS_FLASH (interface));
31554 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
31555 }
31556 else
31557 {
31558 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Flash");
31559 }
31560 break;
31561
Brad Bishop6bbf6462016-06-21 15:12:19 -040031562 case 17:
Norman James18998182015-10-11 21:54:53 -050031563 interface = g_value_get_object (value);
31564 if (interface != NULL)
31565 {
31566 g_warn_if_fail (IS_FLASH_CONTROL (interface));
31567 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
31568 }
31569 else
31570 {
31571 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.FlashControl");
31572 }
31573 break;
31574
Brad Bishop6bbf6462016-06-21 15:12:19 -040031575 case 18:
Norman James362a80f2015-09-14 14:04:39 -050031576 interface = g_value_get_object (value);
31577 if (interface != NULL)
31578 {
31579 g_warn_if_fail (IS_BUTTON (interface));
31580 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
31581 }
31582 else
31583 {
31584 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Button");
31585 }
31586 break;
31587
Brad Bishop6bbf6462016-06-21 15:12:19 -040031588 case 19:
Norman James362a80f2015-09-14 14:04:39 -050031589 interface = g_value_get_object (value);
31590 if (interface != NULL)
31591 {
31592 g_warn_if_fail (IS_LED (interface));
31593 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
31594 }
31595 else
31596 {
31597 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Led");
31598 }
31599 break;
31600
Brad Bishop6bbf6462016-06-21 15:12:19 -040031601 case 20:
Norman Jamesdbcffbd2015-10-06 16:53:06 -050031602 interface = g_value_get_object (value);
31603 if (interface != NULL)
31604 {
31605 g_warn_if_fail (IS_HOST_IPMI (interface));
31606 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
31607 }
31608 else
31609 {
31610 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.HostIpmi");
31611 }
31612 break;
31613
Norman James362a80f2015-09-14 14:04:39 -050031614 default:
31615 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
31616 break;
31617 }
31618}
31619
31620static void
31621object_skeleton_get_property (GObject *gobject,
31622 guint prop_id,
31623 GValue *value,
31624 GParamSpec *pspec)
31625{
31626 ObjectSkeleton *object = OBJECT_SKELETON (gobject);
31627 GDBusInterface *interface;
31628
31629 switch (prop_id)
31630 {
31631 case 1:
Norman James5236a8f2015-11-05 20:39:31 -060031632 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Hwmon");
Norman James362a80f2015-09-14 14:04:39 -050031633 g_value_take_object (value, interface);
31634 break;
31635
Brad Bishop6bbf6462016-06-21 15:12:19 -040031636 case 2:
Norman James5236a8f2015-11-05 20:39:31 -060031637 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan");
Norman James362a80f2015-09-14 14:04:39 -050031638 g_value_take_object (value, interface);
31639 break;
31640
Brad Bishop6bbf6462016-06-21 15:12:19 -040031641 case 3:
Norman James5236a8f2015-11-05 20:39:31 -060031642 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue");
Norman James362a80f2015-09-14 14:04:39 -050031643 g_value_take_object (value, interface);
31644 break;
31645
Brad Bishop6bbf6462016-06-21 15:12:19 -040031646 case 4:
Norman James5236a8f2015-11-05 20:39:31 -060031647 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold");
Norman James362a80f2015-09-14 14:04:39 -050031648 g_value_take_object (value, interface);
31649 break;
31650
Brad Bishop6bbf6462016-06-21 15:12:19 -040031651 case 5:
Norman James5236a8f2015-11-05 20:39:31 -060031652 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
Norman James362a80f2015-09-14 14:04:39 -050031653 g_value_take_object (value, interface);
31654 break;
31655
Brad Bishop6bbf6462016-06-21 15:12:19 -040031656 case 6:
Norman James5236a8f2015-11-05 20:39:31 -060031657 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch");
Norman James362a80f2015-09-14 14:04:39 -050031658 g_value_take_object (value, interface);
31659 break;
31660
Brad Bishop6bbf6462016-06-21 15:12:19 -040031661 case 7:
Norman James5236a8f2015-11-05 20:39:31 -060031662 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process");
Norman James362a80f2015-09-14 14:04:39 -050031663 g_value_take_object (value, interface);
31664 break;
31665
Brad Bishop6bbf6462016-06-21 15:12:19 -040031666 case 8:
Norman James5236a8f2015-11-05 20:39:31 -060031667 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SharedResource");
Norman James362a80f2015-09-14 14:04:39 -050031668 g_value_take_object (value, interface);
31669 break;
31670
Brad Bishop6bbf6462016-06-21 15:12:19 -040031671 case 9:
Norman James5236a8f2015-11-05 20:39:31 -060031672 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control");
Norman James362a80f2015-09-14 14:04:39 -050031673 g_value_take_object (value, interface);
31674 break;
31675
Brad Bishop6bbf6462016-06-21 15:12:19 -040031676 case 10:
Norman James5236a8f2015-11-05 20:39:31 -060031677 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc");
Norman James362a80f2015-09-14 14:04:39 -050031678 g_value_take_object (value, interface);
31679 break;
31680
Brad Bishop6bbf6462016-06-21 15:12:19 -040031681 case 11:
Norman James5236a8f2015-11-05 20:39:31 -060031682 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
Norman James362a80f2015-09-14 14:04:39 -050031683 g_value_take_object (value, interface);
31684 break;
31685
Brad Bishop6bbf6462016-06-21 15:12:19 -040031686 case 12:
Norman James5236a8f2015-11-05 20:39:31 -060031687 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power");
Norman James362a80f2015-09-14 14:04:39 -050031688 g_value_take_object (value, interface);
31689 break;
31690
Brad Bishop6bbf6462016-06-21 15:12:19 -040031691 case 13:
Adriana Kobylakfd778822016-06-16 09:08:37 -050031692 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Checkstop");
Norman Jamesdfdaca92015-09-27 22:11:15 -050031693 g_value_take_object (value, interface);
31694 break;
31695
Brad Bishop6bbf6462016-06-21 15:12:19 -040031696 case 14:
Adriana Kobylakfd778822016-06-16 09:08:37 -050031697 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog");
Norman James362a80f2015-09-14 14:04:39 -050031698 g_value_take_object (value, interface);
31699 break;
31700
Brad Bishop6bbf6462016-06-21 15:12:19 -040031701 case 15:
Adriana Kobylakfd778822016-06-16 09:08:37 -050031702 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
Norman James18998182015-10-11 21:54:53 -050031703 g_value_take_object (value, interface);
31704 break;
31705
Brad Bishop6bbf6462016-06-21 15:12:19 -040031706 case 16:
Adriana Kobylakfd778822016-06-16 09:08:37 -050031707 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash");
Norman James18998182015-10-11 21:54:53 -050031708 g_value_take_object (value, interface);
31709 break;
31710
Brad Bishop6bbf6462016-06-21 15:12:19 -040031711 case 17:
Adriana Kobylakfd778822016-06-16 09:08:37 -050031712 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.FlashControl");
Norman James493996c2015-10-31 17:27:13 -050031713 g_value_take_object (value, interface);
31714 break;
31715
Brad Bishop6bbf6462016-06-21 15:12:19 -040031716 case 18:
Adriana Kobylakfd778822016-06-16 09:08:37 -050031717 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button");
Norman James5236a8f2015-11-05 20:39:31 -060031718 g_value_take_object (value, interface);
31719 break;
31720
Brad Bishop6bbf6462016-06-21 15:12:19 -040031721 case 19:
Adriana Kobylakfd778822016-06-16 09:08:37 -050031722 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led");
31723 g_value_take_object (value, interface);
31724 break;
31725
Brad Bishop6bbf6462016-06-21 15:12:19 -040031726 case 20:
Norman Jamesdbcffbd2015-10-06 16:53:06 -050031727 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.HostIpmi");
31728 g_value_take_object (value, interface);
31729 break;
31730
Norman James362a80f2015-09-14 14:04:39 -050031731 default:
31732 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
31733 break;
31734 }
31735}
31736
31737static void
31738object_skeleton_class_init (ObjectSkeletonClass *klass)
31739{
31740 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
31741
31742 gobject_class->set_property = object_skeleton_set_property;
31743 gobject_class->get_property = object_skeleton_get_property;
31744
Brad Bishop6bbf6462016-06-21 15:12:19 -040031745 g_object_class_override_property (gobject_class, 1, "hwmon");
31746 g_object_class_override_property (gobject_class, 2, "fan");
31747 g_object_class_override_property (gobject_class, 3, "sensor-value");
31748 g_object_class_override_property (gobject_class, 4, "sensor-threshold");
31749 g_object_class_override_property (gobject_class, 5, "sensor-i2c");
31750 g_object_class_override_property (gobject_class, 6, "sensor-match");
31751 g_object_class_override_property (gobject_class, 7, "process");
31752 g_object_class_override_property (gobject_class, 8, "shared-resource");
31753 g_object_class_override_property (gobject_class, 9, "control");
31754 g_object_class_override_property (gobject_class, 10, "control-bmc");
31755 g_object_class_override_property (gobject_class, 11, "control-host");
31756 g_object_class_override_property (gobject_class, 12, "control-power");
31757 g_object_class_override_property (gobject_class, 13, "control-checkstop");
31758 g_object_class_override_property (gobject_class, 14, "watchdog");
31759 g_object_class_override_property (gobject_class, 15, "event-log");
31760 g_object_class_override_property (gobject_class, 16, "flash");
31761 g_object_class_override_property (gobject_class, 17, "flash-control");
31762 g_object_class_override_property (gobject_class, 18, "button");
31763 g_object_class_override_property (gobject_class, 19, "led");
31764 g_object_class_override_property (gobject_class, 20, "host-ipmi");
Norman James362a80f2015-09-14 14:04:39 -050031765}
31766
31767/**
31768 * object_skeleton_new:
31769 * @object_path: An object path.
31770 *
31771 * Creates a new skeleton object.
31772 *
31773 * Returns: (transfer full): The skeleton object.
31774 */
31775ObjectSkeleton *
31776object_skeleton_new (const gchar *object_path)
31777{
31778 g_return_val_if_fail (g_variant_is_object_path (object_path), NULL);
31779 return OBJECT_SKELETON (g_object_new (TYPE_OBJECT_SKELETON, "g-object-path", object_path, NULL));
31780}
31781
31782/**
Norman James5236a8f2015-11-05 20:39:31 -060031783 * object_skeleton_set_hwmon:
31784 * @object: A #ObjectSkeleton.
31785 * @interface_: (allow-none): A #Hwmon or %NULL to clear the interface.
31786 *
31787 * Sets the #Hwmon instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Hwmon.top_of_page">org.openbmc.Hwmon</link> on @object.
31788 */
31789void object_skeleton_set_hwmon (ObjectSkeleton *object, Hwmon *interface_)
31790{
31791 g_object_set (G_OBJECT (object), "hwmon", interface_, NULL);
31792}
31793
31794/**
Norman James362a80f2015-09-14 14:04:39 -050031795 * object_skeleton_set_fan:
31796 * @object: A #ObjectSkeleton.
31797 * @interface_: (allow-none): A #Fan or %NULL to clear the interface.
31798 *
31799 * Sets the #Fan instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link> on @object.
31800 */
31801void object_skeleton_set_fan (ObjectSkeleton *object, Fan *interface_)
31802{
31803 g_object_set (G_OBJECT (object), "fan", interface_, NULL);
31804}
31805
31806/**
31807 * object_skeleton_set_sensor_value:
31808 * @object: A #ObjectSkeleton.
31809 * @interface_: (allow-none): A #SensorValue or %NULL to clear the interface.
31810 *
31811 * Sets the #SensorValue instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link> on @object.
31812 */
31813void object_skeleton_set_sensor_value (ObjectSkeleton *object, SensorValue *interface_)
31814{
31815 g_object_set (G_OBJECT (object), "sensor-value", interface_, NULL);
31816}
31817
31818/**
31819 * object_skeleton_set_sensor_threshold:
31820 * @object: A #ObjectSkeleton.
31821 * @interface_: (allow-none): A #SensorThreshold or %NULL to clear the interface.
31822 *
31823 * Sets the #SensorThreshold instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link> on @object.
31824 */
31825void object_skeleton_set_sensor_threshold (ObjectSkeleton *object, SensorThreshold *interface_)
31826{
31827 g_object_set (G_OBJECT (object), "sensor-threshold", interface_, NULL);
31828}
31829
31830/**
31831 * object_skeleton_set_sensor_i2c:
31832 * @object: A #ObjectSkeleton.
31833 * @interface_: (allow-none): A #SensorI2c or %NULL to clear the interface.
31834 *
31835 * Sets the #SensorI2c instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link> on @object.
31836 */
31837void object_skeleton_set_sensor_i2c (ObjectSkeleton *object, SensorI2c *interface_)
31838{
31839 g_object_set (G_OBJECT (object), "sensor-i2c", interface_, NULL);
31840}
31841
31842/**
31843 * object_skeleton_set_sensor_match:
31844 * @object: A #ObjectSkeleton.
31845 * @interface_: (allow-none): A #SensorMatch or %NULL to clear the interface.
31846 *
31847 * Sets the #SensorMatch instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link> on @object.
31848 */
31849void object_skeleton_set_sensor_match (ObjectSkeleton *object, SensorMatch *interface_)
31850{
31851 g_object_set (G_OBJECT (object), "sensor-match", interface_, NULL);
31852}
31853
31854/**
31855 * object_skeleton_set_process:
31856 * @object: A #ObjectSkeleton.
31857 * @interface_: (allow-none): A #Process or %NULL to clear the interface.
31858 *
31859 * Sets the #Process instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link> on @object.
31860 */
31861void object_skeleton_set_process (ObjectSkeleton *object, Process *interface_)
31862{
31863 g_object_set (G_OBJECT (object), "process", interface_, NULL);
31864}
31865
31866/**
Norman James18998182015-10-11 21:54:53 -050031867 * object_skeleton_set_shared_resource:
31868 * @object: A #ObjectSkeleton.
31869 * @interface_: (allow-none): A #SharedResource or %NULL to clear the interface.
31870 *
31871 * Sets the #SharedResource instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link> on @object.
31872 */
31873void object_skeleton_set_shared_resource (ObjectSkeleton *object, SharedResource *interface_)
31874{
31875 g_object_set (G_OBJECT (object), "shared-resource", interface_, NULL);
31876}
31877
31878/**
Norman James362a80f2015-09-14 14:04:39 -050031879 * object_skeleton_set_control:
31880 * @object: A #ObjectSkeleton.
31881 * @interface_: (allow-none): A #Control or %NULL to clear the interface.
31882 *
31883 * Sets the #Control instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link> on @object.
31884 */
31885void object_skeleton_set_control (ObjectSkeleton *object, Control *interface_)
31886{
31887 g_object_set (G_OBJECT (object), "control", interface_, NULL);
31888}
31889
31890/**
31891 * object_skeleton_set_control_bmc:
31892 * @object: A #ObjectSkeleton.
31893 * @interface_: (allow-none): A #ControlBmc or %NULL to clear the interface.
31894 *
31895 * Sets the #ControlBmc instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Bmc.top_of_page">org.openbmc.control.Bmc</link> on @object.
31896 */
31897void object_skeleton_set_control_bmc (ObjectSkeleton *object, ControlBmc *interface_)
31898{
31899 g_object_set (G_OBJECT (object), "control-bmc", interface_, NULL);
31900}
31901
31902/**
31903 * object_skeleton_set_control_host:
31904 * @object: A #ObjectSkeleton.
31905 * @interface_: (allow-none): A #ControlHost or %NULL to clear the interface.
31906 *
31907 * Sets the #ControlHost instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link> on @object.
31908 */
31909void object_skeleton_set_control_host (ObjectSkeleton *object, ControlHost *interface_)
31910{
31911 g_object_set (G_OBJECT (object), "control-host", interface_, NULL);
31912}
31913
31914/**
31915 * object_skeleton_set_control_power:
31916 * @object: A #ObjectSkeleton.
31917 * @interface_: (allow-none): A #ControlPower or %NULL to clear the interface.
31918 *
31919 * Sets the #ControlPower instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Power.top_of_page">org.openbmc.control.Power</link> on @object.
31920 */
31921void object_skeleton_set_control_power (ObjectSkeleton *object, ControlPower *interface_)
31922{
31923 g_object_set (G_OBJECT (object), "control-power", interface_, NULL);
31924}
31925
31926/**
Adriana Kobylakfd778822016-06-16 09:08:37 -050031927 * object_skeleton_set_control_checkstop:
31928 * @object: A #ObjectSkeleton.
31929 * @interface_: (allow-none): A #ControlCheckstop or %NULL to clear the interface.
31930 *
31931 * Sets the #ControlCheckstop instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Checkstop.top_of_page">org.openbmc.control.Checkstop</link> on @object.
31932 */
31933void object_skeleton_set_control_checkstop (ObjectSkeleton *object, ControlCheckstop *interface_)
31934{
31935 g_object_set (G_OBJECT (object), "control-checkstop", interface_, NULL);
31936}
31937
31938/**
Norman James362a80f2015-09-14 14:04:39 -050031939 * object_skeleton_set_watchdog:
31940 * @object: A #ObjectSkeleton.
31941 * @interface_: (allow-none): A #Watchdog or %NULL to clear the interface.
31942 *
31943 * Sets the #Watchdog instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link> on @object.
31944 */
31945void object_skeleton_set_watchdog (ObjectSkeleton *object, Watchdog *interface_)
31946{
31947 g_object_set (G_OBJECT (object), "watchdog", interface_, NULL);
31948}
31949
31950/**
31951 * object_skeleton_set_event_log:
31952 * @object: A #ObjectSkeleton.
31953 * @interface_: (allow-none): A #EventLog or %NULL to clear the interface.
31954 *
31955 * Sets the #EventLog instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link> on @object.
31956 */
31957void object_skeleton_set_event_log (ObjectSkeleton *object, EventLog *interface_)
31958{
31959 g_object_set (G_OBJECT (object), "event-log", interface_, NULL);
31960}
31961
31962/**
31963 * object_skeleton_set_flash:
31964 * @object: A #ObjectSkeleton.
31965 * @interface_: (allow-none): A #Flash or %NULL to clear the interface.
31966 *
31967 * Sets the #Flash instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link> on @object.
31968 */
31969void object_skeleton_set_flash (ObjectSkeleton *object, Flash *interface_)
31970{
31971 g_object_set (G_OBJECT (object), "flash", interface_, NULL);
31972}
31973
31974/**
Norman James18998182015-10-11 21:54:53 -050031975 * object_skeleton_set_flash_control:
31976 * @object: A #ObjectSkeleton.
31977 * @interface_: (allow-none): A #FlashControl or %NULL to clear the interface.
31978 *
31979 * Sets the #FlashControl instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link> on @object.
31980 */
31981void object_skeleton_set_flash_control (ObjectSkeleton *object, FlashControl *interface_)
31982{
31983 g_object_set (G_OBJECT (object), "flash-control", interface_, NULL);
31984}
31985
31986/**
Norman James362a80f2015-09-14 14:04:39 -050031987 * object_skeleton_set_button:
31988 * @object: A #ObjectSkeleton.
31989 * @interface_: (allow-none): A #Button or %NULL to clear the interface.
31990 *
31991 * Sets the #Button instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link> on @object.
31992 */
31993void object_skeleton_set_button (ObjectSkeleton *object, Button *interface_)
31994{
31995 g_object_set (G_OBJECT (object), "button", interface_, NULL);
31996}
31997
31998/**
31999 * object_skeleton_set_led:
32000 * @object: A #ObjectSkeleton.
32001 * @interface_: (allow-none): A #Led or %NULL to clear the interface.
32002 *
32003 * Sets the #Led instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link> on @object.
32004 */
32005void object_skeleton_set_led (ObjectSkeleton *object, Led *interface_)
32006{
32007 g_object_set (G_OBJECT (object), "led", interface_, NULL);
32008}
32009
Norman Jamesdbcffbd2015-10-06 16:53:06 -050032010/**
32011 * object_skeleton_set_host_ipmi:
32012 * @object: A #ObjectSkeleton.
32013 * @interface_: (allow-none): A #HostIpmi or %NULL to clear the interface.
32014 *
32015 * Sets the #HostIpmi instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link> on @object.
32016 */
32017void object_skeleton_set_host_ipmi (ObjectSkeleton *object, HostIpmi *interface_)
32018{
32019 g_object_set (G_OBJECT (object), "host-ipmi", interface_, NULL);
32020}
32021
Norman James362a80f2015-09-14 14:04:39 -050032022
32023/* ------------------------------------------------------------------------
32024 * Code for ObjectManager client
32025 * ------------------------------------------------------------------------
32026 */
32027
32028/**
32029 * SECTION:ObjectManagerClient
32030 * @title: ObjectManagerClient
32031 * @short_description: Generated GDBusObjectManagerClient type
32032 *
32033 * This section contains a #GDBusObjectManagerClient that uses object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc.
32034 */
32035
32036/**
32037 * ObjectManagerClient:
32038 *
32039 * The #ObjectManagerClient structure contains only private data and should only be accessed using the provided API.
32040 */
32041
32042/**
32043 * ObjectManagerClientClass:
32044 * @parent_class: The parent class.
32045 *
32046 * Class structure for #ObjectManagerClient.
32047 */
32048
32049G_DEFINE_TYPE (ObjectManagerClient, object_manager_client, G_TYPE_DBUS_OBJECT_MANAGER_CLIENT);
32050
32051static void
32052object_manager_client_init (ObjectManagerClient *manager G_GNUC_UNUSED)
32053{
32054}
32055
32056static void
32057object_manager_client_class_init (ObjectManagerClientClass *klass G_GNUC_UNUSED)
32058{
32059}
32060
32061/**
32062 * object_manager_client_get_proxy_type:
32063 * @manager: A #GDBusObjectManagerClient.
32064 * @object_path: The object path of the remote object (unused).
32065 * @interface_name: (allow-none): Interface name of the remote object or %NULL to get the object proxy #GType.
32066 * @user_data: User data (unused).
32067 *
32068 * A #GDBusProxyTypeFunc that maps @interface_name to the generated #GDBusObjectProxy<!-- -->- and #GDBusProxy<!-- -->-derived types.
32069 *
32070 * Returns: A #GDBusProxy<!-- -->-derived #GType if @interface_name is not %NULL, otherwise the #GType for #ObjectProxy.
32071 */
32072GType
32073object_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)
32074{
32075 static gsize once_init_value = 0;
32076 static GHashTable *lookup_hash;
32077 GType ret;
32078
32079 if (interface_name == NULL)
32080 return TYPE_OBJECT_PROXY;
32081 if (g_once_init_enter (&once_init_value))
32082 {
32083 lookup_hash = g_hash_table_new (g_str_hash, g_str_equal);
Norman James5236a8f2015-11-05 20:39:31 -060032084 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Hwmon", GSIZE_TO_POINTER (TYPE_HWMON_PROXY));
Norman James362a80f2015-09-14 14:04:39 -050032085 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Fan", GSIZE_TO_POINTER (TYPE_FAN_PROXY));
32086 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorValue", GSIZE_TO_POINTER (TYPE_SENSOR_VALUE_PROXY));
Norman James362a80f2015-09-14 14:04:39 -050032087 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorThreshold", GSIZE_TO_POINTER (TYPE_SENSOR_THRESHOLD_PROXY));
32088 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorI2c", GSIZE_TO_POINTER (TYPE_SENSOR_I2C_PROXY));
32089 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorMatch", GSIZE_TO_POINTER (TYPE_SENSOR_MATCH_PROXY));
32090 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Process", GSIZE_TO_POINTER (TYPE_PROCESS_PROXY));
Norman James18998182015-10-11 21:54:53 -050032091 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SharedResource", GSIZE_TO_POINTER (TYPE_SHARED_RESOURCE_PROXY));
Norman James362a80f2015-09-14 14:04:39 -050032092 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Control", GSIZE_TO_POINTER (TYPE_CONTROL_PROXY));
32093 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.control.Bmc", GSIZE_TO_POINTER (TYPE_CONTROL_BMC_PROXY));
32094 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.control.Host", GSIZE_TO_POINTER (TYPE_CONTROL_HOST_PROXY));
32095 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.control.Power", GSIZE_TO_POINTER (TYPE_CONTROL_POWER_PROXY));
Adriana Kobylakfd778822016-06-16 09:08:37 -050032096 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.control.Checkstop", GSIZE_TO_POINTER (TYPE_CONTROL_CHECKSTOP_PROXY));
Norman James362a80f2015-09-14 14:04:39 -050032097 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Watchdog", GSIZE_TO_POINTER (TYPE_WATCHDOG_PROXY));
32098 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.EventLog", GSIZE_TO_POINTER (TYPE_EVENT_LOG_PROXY));
32099 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Flash", GSIZE_TO_POINTER (TYPE_FLASH_PROXY));
Norman James18998182015-10-11 21:54:53 -050032100 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.FlashControl", GSIZE_TO_POINTER (TYPE_FLASH_CONTROL_PROXY));
Norman James362a80f2015-09-14 14:04:39 -050032101 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Button", GSIZE_TO_POINTER (TYPE_BUTTON_PROXY));
32102 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Led", GSIZE_TO_POINTER (TYPE_LED_PROXY));
Norman Jamesdbcffbd2015-10-06 16:53:06 -050032103 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.HostIpmi", GSIZE_TO_POINTER (TYPE_HOST_IPMI_PROXY));
Norman James362a80f2015-09-14 14:04:39 -050032104 g_once_init_leave (&once_init_value, 1);
32105 }
32106 ret = (GType) GPOINTER_TO_SIZE (g_hash_table_lookup (lookup_hash, interface_name));
32107 if (ret == (GType) 0)
32108 ret = G_TYPE_DBUS_PROXY;
32109 return ret;
32110}
32111
32112/**
32113 * object_manager_client_new:
32114 * @connection: A #GDBusConnection.
32115 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
32116 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
32117 * @object_path: An object path.
32118 * @cancellable: (allow-none): A #GCancellable or %NULL.
32119 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
32120 * @user_data: User data to pass to @callback.
32121 *
32122 * Asynchronously creates #GDBusObjectManagerClient using object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new() for more details.
32123 *
32124 * 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.
32125 * You can then call object_manager_client_new_finish() to get the result of the operation.
32126 *
32127 * See object_manager_client_new_sync() for the synchronous, blocking version of this constructor.
32128 */
32129void
32130object_manager_client_new (
32131 GDBusConnection *connection,
32132 GDBusObjectManagerClientFlags flags,
32133 const gchar *name,
32134 const gchar *object_path,
32135 GCancellable *cancellable,
32136 GAsyncReadyCallback callback,
32137 gpointer user_data)
32138{
32139 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);
32140}
32141
32142/**
32143 * object_manager_client_new_finish:
32144 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_manager_client_new().
32145 * @error: Return location for error or %NULL
32146 *
32147 * Finishes an operation started with object_manager_client_new().
32148 *
32149 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
32150 */
32151GDBusObjectManager *
32152object_manager_client_new_finish (
32153 GAsyncResult *res,
32154 GError **error)
32155{
32156 GObject *ret;
32157 GObject *source_object;
32158 source_object = g_async_result_get_source_object (res);
32159 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
32160 g_object_unref (source_object);
32161 if (ret != NULL)
32162 return G_DBUS_OBJECT_MANAGER (ret);
32163 else
32164 return NULL;
32165}
32166
32167/**
32168 * object_manager_client_new_sync:
32169 * @connection: A #GDBusConnection.
32170 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
32171 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
32172 * @object_path: An object path.
32173 * @cancellable: (allow-none): A #GCancellable or %NULL.
32174 * @error: Return location for error or %NULL
32175 *
32176 * Synchronously creates #GDBusObjectManagerClient using object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new_sync() for more details.
32177 *
32178 * The calling thread is blocked until a reply is received.
32179 *
32180 * See object_manager_client_new() for the asynchronous version of this constructor.
32181 *
32182 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
32183 */
32184GDBusObjectManager *
32185object_manager_client_new_sync (
32186 GDBusConnection *connection,
32187 GDBusObjectManagerClientFlags flags,
32188 const gchar *name,
32189 const gchar *object_path,
32190 GCancellable *cancellable,
32191 GError **error)
32192{
32193 GInitable *ret;
32194 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);
32195 if (ret != NULL)
32196 return G_DBUS_OBJECT_MANAGER (ret);
32197 else
32198 return NULL;
32199}
32200
32201
32202/**
32203 * object_manager_client_new_for_bus:
32204 * @bus_type: A #GBusType.
32205 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
32206 * @name: A bus name (well-known or unique).
32207 * @object_path: An object path.
32208 * @cancellable: (allow-none): A #GCancellable or %NULL.
32209 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
32210 * @user_data: User data to pass to @callback.
32211 *
32212 * Like object_manager_client_new() but takes a #GBusType instead of a #GDBusConnection.
32213 *
32214 * 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.
32215 * You can then call object_manager_client_new_for_bus_finish() to get the result of the operation.
32216 *
32217 * See object_manager_client_new_for_bus_sync() for the synchronous, blocking version of this constructor.
32218 */
32219void
32220object_manager_client_new_for_bus (
32221 GBusType bus_type,
32222 GDBusObjectManagerClientFlags flags,
32223 const gchar *name,
32224 const gchar *object_path,
32225 GCancellable *cancellable,
32226 GAsyncReadyCallback callback,
32227 gpointer user_data)
32228{
32229 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);
32230}
32231
32232/**
32233 * object_manager_client_new_for_bus_finish:
32234 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_manager_client_new_for_bus().
32235 * @error: Return location for error or %NULL
32236 *
32237 * Finishes an operation started with object_manager_client_new_for_bus().
32238 *
32239 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
32240 */
32241GDBusObjectManager *
32242object_manager_client_new_for_bus_finish (
32243 GAsyncResult *res,
32244 GError **error)
32245{
32246 GObject *ret;
32247 GObject *source_object;
32248 source_object = g_async_result_get_source_object (res);
32249 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
32250 g_object_unref (source_object);
32251 if (ret != NULL)
32252 return G_DBUS_OBJECT_MANAGER (ret);
32253 else
32254 return NULL;
32255}
32256
32257/**
32258 * object_manager_client_new_for_bus_sync:
32259 * @bus_type: A #GBusType.
32260 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
32261 * @name: A bus name (well-known or unique).
32262 * @object_path: An object path.
32263 * @cancellable: (allow-none): A #GCancellable or %NULL.
32264 * @error: Return location for error or %NULL
32265 *
32266 * Like object_manager_client_new_sync() but takes a #GBusType instead of a #GDBusConnection.
32267 *
32268 * The calling thread is blocked until a reply is received.
32269 *
32270 * See object_manager_client_new_for_bus() for the asynchronous version of this constructor.
32271 *
32272 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
32273 */
32274GDBusObjectManager *
32275object_manager_client_new_for_bus_sync (
32276 GBusType bus_type,
32277 GDBusObjectManagerClientFlags flags,
32278 const gchar *name,
32279 const gchar *object_path,
32280 GCancellable *cancellable,
32281 GError **error)
32282{
32283 GInitable *ret;
32284 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);
32285 if (ret != NULL)
32286 return G_DBUS_OBJECT_MANAGER (ret);
32287 else
32288 return NULL;
32289}
32290
32291