blob: f682ade2ead82ae5d8611f3b6119cd68a87b53fb [file] [log] [blame]
Norman James362a80f2015-09-14 14:04:39 -05001/*
Nan Li44dd5a62016-08-24 17:13:06 +08002 * Generated by gdbus-codegen 2.40.2. DO NOT EDIT.
Norman James362a80f2015-09-14 14:04:39 -05003 *
4 * The license of this code is the same as for the source it was derived from.
5 */
6
7#ifdef HAVE_CONFIG_H
8# include "config.h"
9#endif
10
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);
1236 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
1237 g_source_unref (skeleton->priv->changed_properties_idle_source);
1238 }
1239 g_mutex_unlock (&skeleton->priv->lock);
1240}
1241
1242static void
1243hwmon_skeleton_set_property (GObject *object,
1244 guint prop_id,
1245 const GValue *value,
1246 GParamSpec *pspec)
1247{
1248 HwmonSkeleton *skeleton = HWMON_SKELETON (object);
1249 g_assert (prop_id != 0 && prop_id - 1 < 3);
1250 g_mutex_lock (&skeleton->priv->lock);
1251 g_object_freeze_notify (object);
1252 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
1253 {
1254 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
1255 _hwmon_schedule_emit_changed (skeleton, _hwmon_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
1256 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
1257 g_object_notify_by_pspec (object, pspec);
1258 }
1259 g_mutex_unlock (&skeleton->priv->lock);
1260 g_object_thaw_notify (object);
1261}
1262
1263static void
1264hwmon_skeleton_init (HwmonSkeleton *skeleton)
1265{
1266#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
1267 skeleton->priv = hwmon_skeleton_get_instance_private (skeleton);
1268#else
1269 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_HWMON_SKELETON, HwmonSkeletonPrivate);
1270#endif
1271
1272 g_mutex_init (&skeleton->priv->lock);
1273 skeleton->priv->context = g_main_context_ref_thread_default ();
1274 skeleton->priv->properties = g_new0 (GValue, 3);
1275 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
1276 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
Norman James74828452015-11-17 13:10:34 -06001277 g_value_init (&skeleton->priv->properties[2], G_TYPE_INT);
Norman James5236a8f2015-11-05 20:39:31 -06001278}
1279
1280static gint
1281hwmon_skeleton_get_poll_interval (Hwmon *object)
1282{
1283 HwmonSkeleton *skeleton = HWMON_SKELETON (object);
1284 gint value;
1285 g_mutex_lock (&skeleton->priv->lock);
1286 value = g_value_get_int (&(skeleton->priv->properties[0]));
1287 g_mutex_unlock (&skeleton->priv->lock);
1288 return value;
1289}
1290
1291static const gchar *
1292hwmon_skeleton_get_sysfs_path (Hwmon *object)
1293{
1294 HwmonSkeleton *skeleton = HWMON_SKELETON (object);
1295 const gchar *value;
1296 g_mutex_lock (&skeleton->priv->lock);
1297 value = g_value_get_string (&(skeleton->priv->properties[1]));
1298 g_mutex_unlock (&skeleton->priv->lock);
1299 return value;
1300}
1301
Norman James74828452015-11-17 13:10:34 -06001302static gint
1303hwmon_skeleton_get_scale (Hwmon *object)
Norman James5236a8f2015-11-05 20:39:31 -06001304{
1305 HwmonSkeleton *skeleton = HWMON_SKELETON (object);
Norman James74828452015-11-17 13:10:34 -06001306 gint value;
Norman James5236a8f2015-11-05 20:39:31 -06001307 g_mutex_lock (&skeleton->priv->lock);
Norman James74828452015-11-17 13:10:34 -06001308 value = g_value_get_int (&(skeleton->priv->properties[2]));
Norman James5236a8f2015-11-05 20:39:31 -06001309 g_mutex_unlock (&skeleton->priv->lock);
1310 return value;
1311}
1312
1313static void
1314hwmon_skeleton_class_init (HwmonSkeletonClass *klass)
1315{
1316 GObjectClass *gobject_class;
1317 GDBusInterfaceSkeletonClass *skeleton_class;
1318
1319 gobject_class = G_OBJECT_CLASS (klass);
1320 gobject_class->finalize = hwmon_skeleton_finalize;
1321 gobject_class->get_property = hwmon_skeleton_get_property;
1322 gobject_class->set_property = hwmon_skeleton_set_property;
1323 gobject_class->notify = hwmon_skeleton_notify;
1324
1325
1326 hwmon_override_properties (gobject_class, 1);
1327
1328 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
1329 skeleton_class->get_info = hwmon_skeleton_dbus_interface_get_info;
1330 skeleton_class->get_properties = hwmon_skeleton_dbus_interface_get_properties;
1331 skeleton_class->flush = hwmon_skeleton_dbus_interface_flush;
1332 skeleton_class->get_vtable = hwmon_skeleton_dbus_interface_get_vtable;
1333
1334#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
1335 g_type_class_add_private (klass, sizeof (HwmonSkeletonPrivate));
1336#endif
1337}
1338
1339static void
1340hwmon_skeleton_iface_init (HwmonIface *iface)
1341{
1342 iface->get_poll_interval = hwmon_skeleton_get_poll_interval;
1343 iface->get_sysfs_path = hwmon_skeleton_get_sysfs_path;
Norman James74828452015-11-17 13:10:34 -06001344 iface->get_scale = hwmon_skeleton_get_scale;
Norman James5236a8f2015-11-05 20:39:31 -06001345}
1346
1347/**
1348 * hwmon_skeleton_new:
1349 *
1350 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Hwmon.top_of_page">org.openbmc.Hwmon</link>.
1351 *
1352 * Returns: (transfer full) (type HwmonSkeleton): The skeleton object.
1353 */
1354Hwmon *
1355hwmon_skeleton_new (void)
1356{
1357 return HWMON (g_object_new (TYPE_HWMON_SKELETON, NULL));
1358}
1359
1360/* ------------------------------------------------------------------------
Norman James362a80f2015-09-14 14:04:39 -05001361 * Code for interface org.openbmc.Fan
1362 * ------------------------------------------------------------------------
1363 */
1364
1365/**
1366 * SECTION:Fan
1367 * @title: Fan
1368 * @short_description: Generated C code for the org.openbmc.Fan D-Bus interface
1369 *
1370 * 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.
1371 */
1372
1373/* ---- Introspection data for org.openbmc.Fan ---- */
1374
1375static const _ExtendedGDBusArgInfo _fan_method_info_set_cooling_zone_IN_ARG_cooling_zone =
1376{
1377 {
1378 -1,
1379 (gchar *) "cooling_zone",
1380 (gchar *) "i",
1381 NULL
1382 },
1383 FALSE
1384};
1385
1386static const _ExtendedGDBusArgInfo * const _fan_method_info_set_cooling_zone_IN_ARG_pointers[] =
1387{
1388 &_fan_method_info_set_cooling_zone_IN_ARG_cooling_zone,
1389 NULL
1390};
1391
1392static const _ExtendedGDBusMethodInfo _fan_method_info_set_cooling_zone =
1393{
1394 {
1395 -1,
1396 (gchar *) "setCoolingZone",
1397 (GDBusArgInfo **) &_fan_method_info_set_cooling_zone_IN_ARG_pointers,
1398 NULL,
1399 NULL
1400 },
1401 "handle-set-cooling-zone",
1402 FALSE
1403};
1404
1405static const _ExtendedGDBusArgInfo _fan_method_info_get_speed_OUT_ARG_speed =
1406{
1407 {
1408 -1,
1409 (gchar *) "speed",
1410 (gchar *) "i",
1411 NULL
1412 },
1413 FALSE
1414};
1415
1416static const _ExtendedGDBusArgInfo * const _fan_method_info_get_speed_OUT_ARG_pointers[] =
1417{
1418 &_fan_method_info_get_speed_OUT_ARG_speed,
1419 NULL
1420};
1421
1422static const _ExtendedGDBusMethodInfo _fan_method_info_get_speed =
1423{
1424 {
1425 -1,
1426 (gchar *) "getSpeed",
1427 NULL,
1428 (GDBusArgInfo **) &_fan_method_info_get_speed_OUT_ARG_pointers,
1429 NULL
1430 },
1431 "handle-get-speed",
1432 FALSE
1433};
1434
1435static const _ExtendedGDBusArgInfo _fan_method_info_set_speed_IN_ARG_speed =
1436{
1437 {
1438 -1,
1439 (gchar *) "speed",
1440 (gchar *) "i",
1441 NULL
1442 },
1443 FALSE
1444};
1445
1446static const _ExtendedGDBusArgInfo * const _fan_method_info_set_speed_IN_ARG_pointers[] =
1447{
1448 &_fan_method_info_set_speed_IN_ARG_speed,
1449 NULL
1450};
1451
1452static const _ExtendedGDBusMethodInfo _fan_method_info_set_speed =
1453{
1454 {
1455 -1,
1456 (gchar *) "setSpeed",
1457 (GDBusArgInfo **) &_fan_method_info_set_speed_IN_ARG_pointers,
1458 NULL,
1459 NULL
1460 },
1461 "handle-set-speed",
1462 FALSE
1463};
1464
1465static const _ExtendedGDBusMethodInfo * const _fan_method_info_pointers[] =
1466{
1467 &_fan_method_info_set_cooling_zone,
1468 &_fan_method_info_get_speed,
1469 &_fan_method_info_set_speed,
1470 NULL
1471};
1472
1473static const _ExtendedGDBusArgInfo _fan_signal_info_speed_changed_ARG_speed =
1474{
1475 {
1476 -1,
1477 (gchar *) "speed",
1478 (gchar *) "i",
1479 NULL
1480 },
1481 FALSE
1482};
1483
1484static const _ExtendedGDBusArgInfo * const _fan_signal_info_speed_changed_ARG_pointers[] =
1485{
1486 &_fan_signal_info_speed_changed_ARG_speed,
1487 NULL
1488};
1489
1490static const _ExtendedGDBusSignalInfo _fan_signal_info_speed_changed =
1491{
1492 {
1493 -1,
1494 (gchar *) "SpeedChanged",
1495 (GDBusArgInfo **) &_fan_signal_info_speed_changed_ARG_pointers,
1496 NULL
1497 },
1498 "speed-changed"
1499};
1500
1501static const _ExtendedGDBusSignalInfo _fan_signal_info_tach_error =
1502{
1503 {
1504 -1,
1505 (gchar *) "TachError",
1506 NULL,
1507 NULL
1508 },
1509 "tach-error"
1510};
1511
1512static const _ExtendedGDBusSignalInfo * const _fan_signal_info_pointers[] =
1513{
1514 &_fan_signal_info_speed_changed,
1515 &_fan_signal_info_tach_error,
1516 NULL
1517};
1518
1519static const _ExtendedGDBusPropertyInfo _fan_property_info_speed =
1520{
1521 {
1522 -1,
1523 (gchar *) "speed",
1524 (gchar *) "i",
1525 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
1526 NULL
1527 },
1528 "speed",
1529 FALSE
1530};
1531
1532static const _ExtendedGDBusPropertyInfo _fan_property_info_cooling_zone =
1533{
1534 {
1535 -1,
1536 (gchar *) "cooling_zone",
1537 (gchar *) "i",
1538 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
1539 NULL
1540 },
1541 "cooling-zone",
1542 FALSE
1543};
1544
1545static const _ExtendedGDBusPropertyInfo _fan_property_info_pwm_num =
1546{
1547 {
1548 -1,
1549 (gchar *) "pwm_num",
1550 (gchar *) "i",
1551 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
1552 NULL
1553 },
1554 "pwm-num",
1555 FALSE
1556};
1557
1558static const _ExtendedGDBusPropertyInfo * const _fan_property_info_pointers[] =
1559{
1560 &_fan_property_info_speed,
1561 &_fan_property_info_cooling_zone,
1562 &_fan_property_info_pwm_num,
1563 NULL
1564};
1565
1566static const _ExtendedGDBusInterfaceInfo _fan_interface_info =
1567{
1568 {
1569 -1,
1570 (gchar *) "org.openbmc.Fan",
1571 (GDBusMethodInfo **) &_fan_method_info_pointers,
1572 (GDBusSignalInfo **) &_fan_signal_info_pointers,
1573 (GDBusPropertyInfo **) &_fan_property_info_pointers,
1574 NULL
1575 },
1576 "fan",
1577};
1578
1579
1580/**
1581 * fan_interface_info:
1582 *
1583 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link> D-Bus interface.
1584 *
1585 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
1586 */
1587GDBusInterfaceInfo *
1588fan_interface_info (void)
1589{
1590 return (GDBusInterfaceInfo *) &_fan_interface_info.parent_struct;
1591}
1592
1593/**
1594 * fan_override_properties:
1595 * @klass: The class structure for a #GObject<!-- -->-derived class.
1596 * @property_id_begin: The property id to assign to the first overridden property.
1597 *
1598 * Overrides all #GObject properties in the #Fan interface for a concrete class.
1599 * The properties are overridden in the order they are defined.
1600 *
1601 * Returns: The last property id.
1602 */
1603guint
1604fan_override_properties (GObjectClass *klass, guint property_id_begin)
1605{
1606 g_object_class_override_property (klass, property_id_begin++, "speed");
1607 g_object_class_override_property (klass, property_id_begin++, "cooling-zone");
1608 g_object_class_override_property (klass, property_id_begin++, "pwm-num");
1609 return property_id_begin - 1;
1610}
1611
1612
1613
1614/**
1615 * Fan:
1616 *
1617 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link>.
1618 */
1619
1620/**
1621 * FanIface:
1622 * @parent_iface: The parent interface.
1623 * @handle_get_speed: Handler for the #Fan::handle-get-speed signal.
1624 * @handle_set_cooling_zone: Handler for the #Fan::handle-set-cooling-zone signal.
1625 * @handle_set_speed: Handler for the #Fan::handle-set-speed signal.
1626 * @get_cooling_zone: Getter for the #Fan:cooling-zone property.
1627 * @get_pwm_num: Getter for the #Fan:pwm-num property.
1628 * @get_speed: Getter for the #Fan:speed property.
1629 * @speed_changed: Handler for the #Fan::speed-changed signal.
1630 * @tach_error: Handler for the #Fan::tach-error signal.
1631 *
1632 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link>.
1633 */
1634
1635typedef FanIface FanInterface;
1636G_DEFINE_INTERFACE (Fan, fan, G_TYPE_OBJECT);
1637
1638static void
1639fan_default_init (FanIface *iface)
1640{
1641 /* GObject signals for incoming D-Bus method calls: */
1642 /**
1643 * Fan::handle-set-cooling-zone:
1644 * @object: A #Fan.
1645 * @invocation: A #GDBusMethodInvocation.
1646 * @arg_cooling_zone: Argument passed by remote caller.
1647 *
1648 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Fan.setCoolingZone">setCoolingZone()</link> D-Bus method.
1649 *
1650 * 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.
1651 *
1652 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
1653 */
1654 g_signal_new ("handle-set-cooling-zone",
1655 G_TYPE_FROM_INTERFACE (iface),
1656 G_SIGNAL_RUN_LAST,
1657 G_STRUCT_OFFSET (FanIface, handle_set_cooling_zone),
1658 g_signal_accumulator_true_handled,
1659 NULL,
1660 g_cclosure_marshal_generic,
1661 G_TYPE_BOOLEAN,
1662 2,
1663 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT);
1664
1665 /**
1666 * Fan::handle-get-speed:
1667 * @object: A #Fan.
1668 * @invocation: A #GDBusMethodInvocation.
1669 *
1670 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Fan.getSpeed">getSpeed()</link> D-Bus method.
1671 *
1672 * 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.
1673 *
1674 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
1675 */
1676 g_signal_new ("handle-get-speed",
1677 G_TYPE_FROM_INTERFACE (iface),
1678 G_SIGNAL_RUN_LAST,
1679 G_STRUCT_OFFSET (FanIface, handle_get_speed),
1680 g_signal_accumulator_true_handled,
1681 NULL,
1682 g_cclosure_marshal_generic,
1683 G_TYPE_BOOLEAN,
1684 1,
1685 G_TYPE_DBUS_METHOD_INVOCATION);
1686
1687 /**
1688 * Fan::handle-set-speed:
1689 * @object: A #Fan.
1690 * @invocation: A #GDBusMethodInvocation.
1691 * @arg_speed: Argument passed by remote caller.
1692 *
1693 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Fan.setSpeed">setSpeed()</link> D-Bus method.
1694 *
1695 * 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.
1696 *
1697 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
1698 */
1699 g_signal_new ("handle-set-speed",
1700 G_TYPE_FROM_INTERFACE (iface),
1701 G_SIGNAL_RUN_LAST,
1702 G_STRUCT_OFFSET (FanIface, handle_set_speed),
1703 g_signal_accumulator_true_handled,
1704 NULL,
1705 g_cclosure_marshal_generic,
1706 G_TYPE_BOOLEAN,
1707 2,
1708 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT);
1709
1710 /* GObject signals for received D-Bus signals: */
1711 /**
1712 * Fan::speed-changed:
1713 * @object: A #Fan.
1714 * @arg_speed: Argument.
1715 *
1716 * 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.
1717 *
1718 * 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.
1719 */
1720 g_signal_new ("speed-changed",
1721 G_TYPE_FROM_INTERFACE (iface),
1722 G_SIGNAL_RUN_LAST,
1723 G_STRUCT_OFFSET (FanIface, speed_changed),
1724 NULL,
1725 NULL,
1726 g_cclosure_marshal_generic,
1727 G_TYPE_NONE,
1728 1, G_TYPE_INT);
1729
1730 /**
1731 * Fan::tach-error:
1732 * @object: A #Fan.
1733 *
1734 * 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.
1735 *
1736 * 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.
1737 */
1738 g_signal_new ("tach-error",
1739 G_TYPE_FROM_INTERFACE (iface),
1740 G_SIGNAL_RUN_LAST,
1741 G_STRUCT_OFFSET (FanIface, tach_error),
1742 NULL,
1743 NULL,
1744 g_cclosure_marshal_generic,
1745 G_TYPE_NONE,
1746 0);
1747
1748 /* GObject properties for D-Bus properties: */
1749 /**
1750 * Fan:speed:
1751 *
1752 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fan.speed">"speed"</link>.
1753 *
1754 * 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.
1755 */
1756 g_object_interface_install_property (iface,
1757 g_param_spec_int ("speed", "speed", "speed", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
1758 /**
1759 * Fan:cooling-zone:
1760 *
1761 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fan.cooling_zone">"cooling_zone"</link>.
1762 *
1763 * 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.
1764 */
1765 g_object_interface_install_property (iface,
1766 g_param_spec_int ("cooling-zone", "cooling_zone", "cooling_zone", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
1767 /**
1768 * Fan:pwm-num:
1769 *
1770 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fan.pwm_num">"pwm_num"</link>.
1771 *
1772 * 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.
1773 */
1774 g_object_interface_install_property (iface,
1775 g_param_spec_int ("pwm-num", "pwm_num", "pwm_num", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
1776}
1777
1778/**
1779 * fan_get_speed: (skip)
1780 * @object: A #Fan.
1781 *
1782 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fan.speed">"speed"</link> D-Bus property.
1783 *
1784 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
1785 *
1786 * Returns: The property value.
1787 */
1788gint
1789fan_get_speed (Fan *object)
1790{
1791 return FAN_GET_IFACE (object)->get_speed (object);
1792}
1793
1794/**
1795 * fan_set_speed: (skip)
1796 * @object: A #Fan.
1797 * @value: The value to set.
1798 *
1799 * Sets the <link linkend="gdbus-property-org-openbmc-Fan.speed">"speed"</link> D-Bus property to @value.
1800 *
1801 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
1802 */
1803void
1804fan_set_speed (Fan *object, gint value)
1805{
1806 g_object_set (G_OBJECT (object), "speed", value, NULL);
1807}
1808
1809/**
1810 * fan_get_cooling_zone: (skip)
1811 * @object: A #Fan.
1812 *
1813 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fan.cooling_zone">"cooling_zone"</link> D-Bus property.
1814 *
1815 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
1816 *
1817 * Returns: The property value.
1818 */
1819gint
1820fan_get_cooling_zone (Fan *object)
1821{
1822 return FAN_GET_IFACE (object)->get_cooling_zone (object);
1823}
1824
1825/**
1826 * fan_set_cooling_zone: (skip)
1827 * @object: A #Fan.
1828 * @value: The value to set.
1829 *
1830 * Sets the <link linkend="gdbus-property-org-openbmc-Fan.cooling_zone">"cooling_zone"</link> D-Bus property to @value.
1831 *
1832 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
1833 */
1834void
1835fan_set_cooling_zone (Fan *object, gint value)
1836{
1837 g_object_set (G_OBJECT (object), "cooling-zone", value, NULL);
1838}
1839
1840/**
1841 * fan_get_pwm_num: (skip)
1842 * @object: A #Fan.
1843 *
1844 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fan.pwm_num">"pwm_num"</link> D-Bus property.
1845 *
1846 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
1847 *
1848 * Returns: The property value.
1849 */
1850gint
1851fan_get_pwm_num (Fan *object)
1852{
1853 return FAN_GET_IFACE (object)->get_pwm_num (object);
1854}
1855
1856/**
1857 * fan_set_pwm_num: (skip)
1858 * @object: A #Fan.
1859 * @value: The value to set.
1860 *
1861 * Sets the <link linkend="gdbus-property-org-openbmc-Fan.pwm_num">"pwm_num"</link> D-Bus property to @value.
1862 *
1863 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
1864 */
1865void
1866fan_set_pwm_num (Fan *object, gint value)
1867{
1868 g_object_set (G_OBJECT (object), "pwm-num", value, NULL);
1869}
1870
1871/**
1872 * fan_emit_speed_changed:
1873 * @object: A #Fan.
1874 * @arg_speed: Argument to pass with the signal.
1875 *
1876 * Emits the <link linkend="gdbus-signal-org-openbmc-Fan.SpeedChanged">"SpeedChanged"</link> D-Bus signal.
1877 */
1878void
1879fan_emit_speed_changed (
1880 Fan *object,
1881 gint arg_speed)
1882{
1883 g_signal_emit_by_name (object, "speed-changed", arg_speed);
1884}
1885
1886/**
1887 * fan_emit_tach_error:
1888 * @object: A #Fan.
1889 *
1890 * Emits the <link linkend="gdbus-signal-org-openbmc-Fan.TachError">"TachError"</link> D-Bus signal.
1891 */
1892void
1893fan_emit_tach_error (
1894 Fan *object)
1895{
1896 g_signal_emit_by_name (object, "tach-error");
1897}
1898
1899/**
1900 * fan_call_set_cooling_zone:
1901 * @proxy: A #FanProxy.
1902 * @arg_cooling_zone: Argument to pass with the method invocation.
1903 * @cancellable: (allow-none): A #GCancellable or %NULL.
1904 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
1905 * @user_data: User data to pass to @callback.
1906 *
1907 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Fan.setCoolingZone">setCoolingZone()</link> D-Bus method on @proxy.
1908 * 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.
1909 * You can then call fan_call_set_cooling_zone_finish() to get the result of the operation.
1910 *
1911 * See fan_call_set_cooling_zone_sync() for the synchronous, blocking version of this method.
1912 */
1913void
1914fan_call_set_cooling_zone (
1915 Fan *proxy,
1916 gint arg_cooling_zone,
1917 GCancellable *cancellable,
1918 GAsyncReadyCallback callback,
1919 gpointer user_data)
1920{
1921 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
1922 "setCoolingZone",
1923 g_variant_new ("(i)",
1924 arg_cooling_zone),
1925 G_DBUS_CALL_FLAGS_NONE,
1926 -1,
1927 cancellable,
1928 callback,
1929 user_data);
1930}
1931
1932/**
1933 * fan_call_set_cooling_zone_finish:
1934 * @proxy: A #FanProxy.
1935 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_call_set_cooling_zone().
1936 * @error: Return location for error or %NULL.
1937 *
1938 * Finishes an operation started with fan_call_set_cooling_zone().
1939 *
1940 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
1941 */
1942gboolean
1943fan_call_set_cooling_zone_finish (
1944 Fan *proxy,
1945 GAsyncResult *res,
1946 GError **error)
1947{
1948 GVariant *_ret;
1949 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
1950 if (_ret == NULL)
1951 goto _out;
1952 g_variant_get (_ret,
1953 "()");
1954 g_variant_unref (_ret);
1955_out:
1956 return _ret != NULL;
1957}
1958
1959/**
1960 * fan_call_set_cooling_zone_sync:
1961 * @proxy: A #FanProxy.
1962 * @arg_cooling_zone: Argument to pass with the method invocation.
1963 * @cancellable: (allow-none): A #GCancellable or %NULL.
1964 * @error: Return location for error or %NULL.
1965 *
1966 * 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.
1967 *
1968 * See fan_call_set_cooling_zone() for the asynchronous version of this method.
1969 *
1970 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
1971 */
1972gboolean
1973fan_call_set_cooling_zone_sync (
1974 Fan *proxy,
1975 gint arg_cooling_zone,
1976 GCancellable *cancellable,
1977 GError **error)
1978{
1979 GVariant *_ret;
1980 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
1981 "setCoolingZone",
1982 g_variant_new ("(i)",
1983 arg_cooling_zone),
1984 G_DBUS_CALL_FLAGS_NONE,
1985 -1,
1986 cancellable,
1987 error);
1988 if (_ret == NULL)
1989 goto _out;
1990 g_variant_get (_ret,
1991 "()");
1992 g_variant_unref (_ret);
1993_out:
1994 return _ret != NULL;
1995}
1996
1997/**
1998 * fan_call_get_speed:
1999 * @proxy: A #FanProxy.
2000 * @cancellable: (allow-none): A #GCancellable or %NULL.
2001 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
2002 * @user_data: User data to pass to @callback.
2003 *
2004 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Fan.getSpeed">getSpeed()</link> D-Bus method on @proxy.
2005 * 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.
2006 * You can then call fan_call_get_speed_finish() to get the result of the operation.
2007 *
2008 * See fan_call_get_speed_sync() for the synchronous, blocking version of this method.
2009 */
2010void
2011fan_call_get_speed (
2012 Fan *proxy,
2013 GCancellable *cancellable,
2014 GAsyncReadyCallback callback,
2015 gpointer user_data)
2016{
2017 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
2018 "getSpeed",
2019 g_variant_new ("()"),
2020 G_DBUS_CALL_FLAGS_NONE,
2021 -1,
2022 cancellable,
2023 callback,
2024 user_data);
2025}
2026
2027/**
2028 * fan_call_get_speed_finish:
2029 * @proxy: A #FanProxy.
2030 * @out_speed: (out): Return location for return parameter or %NULL to ignore.
2031 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_call_get_speed().
2032 * @error: Return location for error or %NULL.
2033 *
2034 * Finishes an operation started with fan_call_get_speed().
2035 *
2036 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
2037 */
2038gboolean
2039fan_call_get_speed_finish (
2040 Fan *proxy,
2041 gint *out_speed,
2042 GAsyncResult *res,
2043 GError **error)
2044{
2045 GVariant *_ret;
2046 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
2047 if (_ret == NULL)
2048 goto _out;
2049 g_variant_get (_ret,
2050 "(i)",
2051 out_speed);
2052 g_variant_unref (_ret);
2053_out:
2054 return _ret != NULL;
2055}
2056
2057/**
2058 * fan_call_get_speed_sync:
2059 * @proxy: A #FanProxy.
2060 * @out_speed: (out): Return location for return parameter or %NULL to ignore.
2061 * @cancellable: (allow-none): A #GCancellable or %NULL.
2062 * @error: Return location for error or %NULL.
2063 *
2064 * 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.
2065 *
2066 * See fan_call_get_speed() for the asynchronous version of this method.
2067 *
2068 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
2069 */
2070gboolean
2071fan_call_get_speed_sync (
2072 Fan *proxy,
2073 gint *out_speed,
2074 GCancellable *cancellable,
2075 GError **error)
2076{
2077 GVariant *_ret;
2078 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
2079 "getSpeed",
2080 g_variant_new ("()"),
2081 G_DBUS_CALL_FLAGS_NONE,
2082 -1,
2083 cancellable,
2084 error);
2085 if (_ret == NULL)
2086 goto _out;
2087 g_variant_get (_ret,
2088 "(i)",
2089 out_speed);
2090 g_variant_unref (_ret);
2091_out:
2092 return _ret != NULL;
2093}
2094
2095/**
2096 * fan_call_set_speed:
2097 * @proxy: A #FanProxy.
2098 * @arg_speed: Argument to pass with the method invocation.
2099 * @cancellable: (allow-none): A #GCancellable or %NULL.
2100 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
2101 * @user_data: User data to pass to @callback.
2102 *
2103 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Fan.setSpeed">setSpeed()</link> D-Bus method on @proxy.
2104 * 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.
2105 * You can then call fan_call_set_speed_finish() to get the result of the operation.
2106 *
2107 * See fan_call_set_speed_sync() for the synchronous, blocking version of this method.
2108 */
2109void
2110fan_call_set_speed (
2111 Fan *proxy,
2112 gint arg_speed,
2113 GCancellable *cancellable,
2114 GAsyncReadyCallback callback,
2115 gpointer user_data)
2116{
2117 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
2118 "setSpeed",
2119 g_variant_new ("(i)",
2120 arg_speed),
2121 G_DBUS_CALL_FLAGS_NONE,
2122 -1,
2123 cancellable,
2124 callback,
2125 user_data);
2126}
2127
2128/**
2129 * fan_call_set_speed_finish:
2130 * @proxy: A #FanProxy.
2131 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_call_set_speed().
2132 * @error: Return location for error or %NULL.
2133 *
2134 * Finishes an operation started with fan_call_set_speed().
2135 *
2136 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
2137 */
2138gboolean
2139fan_call_set_speed_finish (
2140 Fan *proxy,
2141 GAsyncResult *res,
2142 GError **error)
2143{
2144 GVariant *_ret;
2145 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
2146 if (_ret == NULL)
2147 goto _out;
2148 g_variant_get (_ret,
2149 "()");
2150 g_variant_unref (_ret);
2151_out:
2152 return _ret != NULL;
2153}
2154
2155/**
2156 * fan_call_set_speed_sync:
2157 * @proxy: A #FanProxy.
2158 * @arg_speed: Argument to pass with the method invocation.
2159 * @cancellable: (allow-none): A #GCancellable or %NULL.
2160 * @error: Return location for error or %NULL.
2161 *
2162 * 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.
2163 *
2164 * See fan_call_set_speed() for the asynchronous version of this method.
2165 *
2166 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
2167 */
2168gboolean
2169fan_call_set_speed_sync (
2170 Fan *proxy,
2171 gint arg_speed,
2172 GCancellable *cancellable,
2173 GError **error)
2174{
2175 GVariant *_ret;
2176 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
2177 "setSpeed",
2178 g_variant_new ("(i)",
2179 arg_speed),
2180 G_DBUS_CALL_FLAGS_NONE,
2181 -1,
2182 cancellable,
2183 error);
2184 if (_ret == NULL)
2185 goto _out;
2186 g_variant_get (_ret,
2187 "()");
2188 g_variant_unref (_ret);
2189_out:
2190 return _ret != NULL;
2191}
2192
2193/**
2194 * fan_complete_set_cooling_zone:
2195 * @object: A #Fan.
2196 * @invocation: (transfer full): A #GDBusMethodInvocation.
2197 *
2198 * 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.
2199 *
2200 * This method will free @invocation, you cannot use it afterwards.
2201 */
2202void
2203fan_complete_set_cooling_zone (
2204 Fan *object,
2205 GDBusMethodInvocation *invocation)
2206{
2207 g_dbus_method_invocation_return_value (invocation,
2208 g_variant_new ("()"));
2209}
2210
2211/**
2212 * fan_complete_get_speed:
2213 * @object: A #Fan.
2214 * @invocation: (transfer full): A #GDBusMethodInvocation.
2215 * @speed: Parameter to return.
2216 *
2217 * 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.
2218 *
2219 * This method will free @invocation, you cannot use it afterwards.
2220 */
2221void
2222fan_complete_get_speed (
2223 Fan *object,
2224 GDBusMethodInvocation *invocation,
2225 gint speed)
2226{
2227 g_dbus_method_invocation_return_value (invocation,
2228 g_variant_new ("(i)",
2229 speed));
2230}
2231
2232/**
2233 * fan_complete_set_speed:
2234 * @object: A #Fan.
2235 * @invocation: (transfer full): A #GDBusMethodInvocation.
2236 *
2237 * 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.
2238 *
2239 * This method will free @invocation, you cannot use it afterwards.
2240 */
2241void
2242fan_complete_set_speed (
2243 Fan *object,
2244 GDBusMethodInvocation *invocation)
2245{
2246 g_dbus_method_invocation_return_value (invocation,
2247 g_variant_new ("()"));
2248}
2249
2250/* ------------------------------------------------------------------------ */
2251
2252/**
2253 * FanProxy:
2254 *
2255 * The #FanProxy structure contains only private data and should only be accessed using the provided API.
2256 */
2257
2258/**
2259 * FanProxyClass:
2260 * @parent_class: The parent class.
2261 *
2262 * Class structure for #FanProxy.
2263 */
2264
2265struct _FanProxyPrivate
2266{
2267 GData *qdata;
2268};
2269
2270static void fan_proxy_iface_init (FanIface *iface);
2271
2272#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
2273G_DEFINE_TYPE_WITH_CODE (FanProxy, fan_proxy, G_TYPE_DBUS_PROXY,
2274 G_ADD_PRIVATE (FanProxy)
2275 G_IMPLEMENT_INTERFACE (TYPE_FAN, fan_proxy_iface_init));
2276
2277#else
2278G_DEFINE_TYPE_WITH_CODE (FanProxy, fan_proxy, G_TYPE_DBUS_PROXY,
2279 G_IMPLEMENT_INTERFACE (TYPE_FAN, fan_proxy_iface_init));
2280
2281#endif
2282static void
2283fan_proxy_finalize (GObject *object)
2284{
2285 FanProxy *proxy = FAN_PROXY (object);
2286 g_datalist_clear (&proxy->priv->qdata);
2287 G_OBJECT_CLASS (fan_proxy_parent_class)->finalize (object);
2288}
2289
2290static void
2291fan_proxy_get_property (GObject *object,
2292 guint prop_id,
2293 GValue *value,
2294 GParamSpec *pspec G_GNUC_UNUSED)
2295{
2296 const _ExtendedGDBusPropertyInfo *info;
2297 GVariant *variant;
2298 g_assert (prop_id != 0 && prop_id - 1 < 3);
2299 info = _fan_property_info_pointers[prop_id - 1];
2300 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
2301 if (info->use_gvariant)
2302 {
2303 g_value_set_variant (value, variant);
2304 }
2305 else
2306 {
2307 if (variant != NULL)
2308 g_dbus_gvariant_to_gvalue (variant, value);
2309 }
2310 if (variant != NULL)
2311 g_variant_unref (variant);
2312}
2313
2314static void
2315fan_proxy_set_property_cb (GDBusProxy *proxy,
2316 GAsyncResult *res,
2317 gpointer user_data)
2318{
2319 const _ExtendedGDBusPropertyInfo *info = user_data;
2320 GError *error;
2321 GVariant *_ret;
2322 error = NULL;
2323 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
2324 if (!_ret)
2325 {
2326 g_warning ("Error setting property '%s' on interface org.openbmc.Fan: %s (%s, %d)",
2327 info->parent_struct.name,
2328 error->message, g_quark_to_string (error->domain), error->code);
2329 g_error_free (error);
2330 }
2331 else
2332 {
2333 g_variant_unref (_ret);
2334 }
2335}
2336
2337static void
2338fan_proxy_set_property (GObject *object,
2339 guint prop_id,
2340 const GValue *value,
2341 GParamSpec *pspec G_GNUC_UNUSED)
2342{
2343 const _ExtendedGDBusPropertyInfo *info;
2344 GVariant *variant;
2345 g_assert (prop_id != 0 && prop_id - 1 < 3);
2346 info = _fan_property_info_pointers[prop_id - 1];
2347 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
2348 g_dbus_proxy_call (G_DBUS_PROXY (object),
2349 "org.freedesktop.DBus.Properties.Set",
2350 g_variant_new ("(ssv)", "org.openbmc.Fan", info->parent_struct.name, variant),
2351 G_DBUS_CALL_FLAGS_NONE,
2352 -1,
2353 NULL, (GAsyncReadyCallback) fan_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
2354 g_variant_unref (variant);
2355}
2356
2357static void
2358fan_proxy_g_signal (GDBusProxy *proxy,
2359 const gchar *sender_name G_GNUC_UNUSED,
2360 const gchar *signal_name,
2361 GVariant *parameters)
2362{
2363 _ExtendedGDBusSignalInfo *info;
2364 GVariantIter iter;
2365 GVariant *child;
2366 GValue *paramv;
2367 guint num_params;
2368 guint n;
2369 guint signal_id;
2370 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, signal_name);
2371 if (info == NULL)
2372 return;
2373 num_params = g_variant_n_children (parameters);
2374 paramv = g_new0 (GValue, num_params + 1);
2375 g_value_init (&paramv[0], TYPE_FAN);
2376 g_value_set_object (&paramv[0], proxy);
2377 g_variant_iter_init (&iter, parameters);
2378 n = 1;
2379 while ((child = g_variant_iter_next_value (&iter)) != NULL)
2380 {
2381 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
2382 if (arg_info->use_gvariant)
2383 {
2384 g_value_init (&paramv[n], G_TYPE_VARIANT);
2385 g_value_set_variant (&paramv[n], child);
2386 n++;
2387 }
2388 else
2389 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
2390 g_variant_unref (child);
2391 }
2392 signal_id = g_signal_lookup (info->signal_name, TYPE_FAN);
2393 g_signal_emitv (paramv, signal_id, 0, NULL);
2394 for (n = 0; n < num_params + 1; n++)
2395 g_value_unset (&paramv[n]);
2396 g_free (paramv);
2397}
2398
2399static void
2400fan_proxy_g_properties_changed (GDBusProxy *_proxy,
2401 GVariant *changed_properties,
2402 const gchar *const *invalidated_properties)
2403{
2404 FanProxy *proxy = FAN_PROXY (_proxy);
2405 guint n;
2406 const gchar *key;
2407 GVariantIter *iter;
2408 _ExtendedGDBusPropertyInfo *info;
2409 g_variant_get (changed_properties, "a{sv}", &iter);
2410 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
2411 {
2412 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, key);
2413 g_datalist_remove_data (&proxy->priv->qdata, key);
2414 if (info != NULL)
2415 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
2416 }
2417 g_variant_iter_free (iter);
2418 for (n = 0; invalidated_properties[n] != NULL; n++)
2419 {
2420 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, invalidated_properties[n]);
2421 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
2422 if (info != NULL)
2423 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
2424 }
2425}
2426
2427static gint
2428fan_proxy_get_speed (Fan *object)
2429{
2430 FanProxy *proxy = FAN_PROXY (object);
2431 GVariant *variant;
2432 gint value = 0;
2433 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "speed");
2434 if (variant != NULL)
2435 {
2436 value = g_variant_get_int32 (variant);
2437 g_variant_unref (variant);
2438 }
2439 return value;
2440}
2441
2442static gint
2443fan_proxy_get_cooling_zone (Fan *object)
2444{
2445 FanProxy *proxy = FAN_PROXY (object);
2446 GVariant *variant;
2447 gint value = 0;
2448 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "cooling_zone");
2449 if (variant != NULL)
2450 {
2451 value = g_variant_get_int32 (variant);
2452 g_variant_unref (variant);
2453 }
2454 return value;
2455}
2456
2457static gint
2458fan_proxy_get_pwm_num (Fan *object)
2459{
2460 FanProxy *proxy = FAN_PROXY (object);
2461 GVariant *variant;
2462 gint value = 0;
2463 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "pwm_num");
2464 if (variant != NULL)
2465 {
2466 value = g_variant_get_int32 (variant);
2467 g_variant_unref (variant);
2468 }
2469 return value;
2470}
2471
2472static void
2473fan_proxy_init (FanProxy *proxy)
2474{
2475#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
2476 proxy->priv = fan_proxy_get_instance_private (proxy);
2477#else
2478 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_FAN_PROXY, FanProxyPrivate);
2479#endif
2480
2481 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), fan_interface_info ());
2482}
2483
2484static void
2485fan_proxy_class_init (FanProxyClass *klass)
2486{
2487 GObjectClass *gobject_class;
2488 GDBusProxyClass *proxy_class;
2489
2490 gobject_class = G_OBJECT_CLASS (klass);
2491 gobject_class->finalize = fan_proxy_finalize;
2492 gobject_class->get_property = fan_proxy_get_property;
2493 gobject_class->set_property = fan_proxy_set_property;
2494
2495 proxy_class = G_DBUS_PROXY_CLASS (klass);
2496 proxy_class->g_signal = fan_proxy_g_signal;
2497 proxy_class->g_properties_changed = fan_proxy_g_properties_changed;
2498
2499 fan_override_properties (gobject_class, 1);
2500
2501#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
2502 g_type_class_add_private (klass, sizeof (FanProxyPrivate));
2503#endif
2504}
2505
2506static void
2507fan_proxy_iface_init (FanIface *iface)
2508{
2509 iface->get_speed = fan_proxy_get_speed;
2510 iface->get_cooling_zone = fan_proxy_get_cooling_zone;
2511 iface->get_pwm_num = fan_proxy_get_pwm_num;
2512}
2513
2514/**
2515 * fan_proxy_new:
2516 * @connection: A #GDBusConnection.
2517 * @flags: Flags from the #GDBusProxyFlags enumeration.
2518 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
2519 * @object_path: An object path.
2520 * @cancellable: (allow-none): A #GCancellable or %NULL.
2521 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
2522 * @user_data: User data to pass to @callback.
2523 *
2524 * 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.
2525 *
2526 * 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.
2527 * You can then call fan_proxy_new_finish() to get the result of the operation.
2528 *
2529 * See fan_proxy_new_sync() for the synchronous, blocking version of this constructor.
2530 */
2531void
2532fan_proxy_new (
2533 GDBusConnection *connection,
2534 GDBusProxyFlags flags,
2535 const gchar *name,
2536 const gchar *object_path,
2537 GCancellable *cancellable,
2538 GAsyncReadyCallback callback,
2539 gpointer user_data)
2540{
2541 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);
2542}
2543
2544/**
2545 * fan_proxy_new_finish:
2546 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_proxy_new().
2547 * @error: Return location for error or %NULL
2548 *
2549 * Finishes an operation started with fan_proxy_new().
2550 *
2551 * Returns: (transfer full) (type FanProxy): The constructed proxy object or %NULL if @error is set.
2552 */
2553Fan *
2554fan_proxy_new_finish (
2555 GAsyncResult *res,
2556 GError **error)
2557{
2558 GObject *ret;
2559 GObject *source_object;
2560 source_object = g_async_result_get_source_object (res);
2561 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
2562 g_object_unref (source_object);
2563 if (ret != NULL)
2564 return FAN (ret);
2565 else
2566 return NULL;
2567}
2568
2569/**
2570 * fan_proxy_new_sync:
2571 * @connection: A #GDBusConnection.
2572 * @flags: Flags from the #GDBusProxyFlags enumeration.
2573 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
2574 * @object_path: An object path.
2575 * @cancellable: (allow-none): A #GCancellable or %NULL.
2576 * @error: Return location for error or %NULL
2577 *
2578 * 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.
2579 *
2580 * The calling thread is blocked until a reply is received.
2581 *
2582 * See fan_proxy_new() for the asynchronous version of this constructor.
2583 *
2584 * Returns: (transfer full) (type FanProxy): The constructed proxy object or %NULL if @error is set.
2585 */
2586Fan *
2587fan_proxy_new_sync (
2588 GDBusConnection *connection,
2589 GDBusProxyFlags flags,
2590 const gchar *name,
2591 const gchar *object_path,
2592 GCancellable *cancellable,
2593 GError **error)
2594{
2595 GInitable *ret;
2596 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);
2597 if (ret != NULL)
2598 return FAN (ret);
2599 else
2600 return NULL;
2601}
2602
2603
2604/**
2605 * fan_proxy_new_for_bus:
2606 * @bus_type: A #GBusType.
2607 * @flags: Flags from the #GDBusProxyFlags enumeration.
2608 * @name: A bus name (well-known or unique).
2609 * @object_path: An object path.
2610 * @cancellable: (allow-none): A #GCancellable or %NULL.
2611 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
2612 * @user_data: User data to pass to @callback.
2613 *
2614 * Like fan_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
2615 *
2616 * 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.
2617 * You can then call fan_proxy_new_for_bus_finish() to get the result of the operation.
2618 *
2619 * See fan_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
2620 */
2621void
2622fan_proxy_new_for_bus (
2623 GBusType bus_type,
2624 GDBusProxyFlags flags,
2625 const gchar *name,
2626 const gchar *object_path,
2627 GCancellable *cancellable,
2628 GAsyncReadyCallback callback,
2629 gpointer user_data)
2630{
2631 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);
2632}
2633
2634/**
2635 * fan_proxy_new_for_bus_finish:
2636 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_proxy_new_for_bus().
2637 * @error: Return location for error or %NULL
2638 *
2639 * Finishes an operation started with fan_proxy_new_for_bus().
2640 *
2641 * Returns: (transfer full) (type FanProxy): The constructed proxy object or %NULL if @error is set.
2642 */
2643Fan *
2644fan_proxy_new_for_bus_finish (
2645 GAsyncResult *res,
2646 GError **error)
2647{
2648 GObject *ret;
2649 GObject *source_object;
2650 source_object = g_async_result_get_source_object (res);
2651 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
2652 g_object_unref (source_object);
2653 if (ret != NULL)
2654 return FAN (ret);
2655 else
2656 return NULL;
2657}
2658
2659/**
2660 * fan_proxy_new_for_bus_sync:
2661 * @bus_type: A #GBusType.
2662 * @flags: Flags from the #GDBusProxyFlags enumeration.
2663 * @name: A bus name (well-known or unique).
2664 * @object_path: An object path.
2665 * @cancellable: (allow-none): A #GCancellable or %NULL.
2666 * @error: Return location for error or %NULL
2667 *
2668 * Like fan_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
2669 *
2670 * The calling thread is blocked until a reply is received.
2671 *
2672 * See fan_proxy_new_for_bus() for the asynchronous version of this constructor.
2673 *
2674 * Returns: (transfer full) (type FanProxy): The constructed proxy object or %NULL if @error is set.
2675 */
2676Fan *
2677fan_proxy_new_for_bus_sync (
2678 GBusType bus_type,
2679 GDBusProxyFlags flags,
2680 const gchar *name,
2681 const gchar *object_path,
2682 GCancellable *cancellable,
2683 GError **error)
2684{
2685 GInitable *ret;
2686 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);
2687 if (ret != NULL)
2688 return FAN (ret);
2689 else
2690 return NULL;
2691}
2692
2693
2694/* ------------------------------------------------------------------------ */
2695
2696/**
2697 * FanSkeleton:
2698 *
2699 * The #FanSkeleton structure contains only private data and should only be accessed using the provided API.
2700 */
2701
2702/**
2703 * FanSkeletonClass:
2704 * @parent_class: The parent class.
2705 *
2706 * Class structure for #FanSkeleton.
2707 */
2708
2709struct _FanSkeletonPrivate
2710{
2711 GValue *properties;
2712 GList *changed_properties;
2713 GSource *changed_properties_idle_source;
2714 GMainContext *context;
2715 GMutex lock;
2716};
2717
2718static void
2719_fan_skeleton_handle_method_call (
2720 GDBusConnection *connection G_GNUC_UNUSED,
2721 const gchar *sender G_GNUC_UNUSED,
2722 const gchar *object_path G_GNUC_UNUSED,
2723 const gchar *interface_name,
2724 const gchar *method_name,
2725 GVariant *parameters,
2726 GDBusMethodInvocation *invocation,
2727 gpointer user_data)
2728{
2729 FanSkeleton *skeleton = FAN_SKELETON (user_data);
2730 _ExtendedGDBusMethodInfo *info;
2731 GVariantIter iter;
2732 GVariant *child;
2733 GValue *paramv;
2734 guint num_params;
2735 guint num_extra;
2736 guint n;
2737 guint signal_id;
2738 GValue return_value = G_VALUE_INIT;
2739 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
2740 g_assert (info != NULL);
2741 num_params = g_variant_n_children (parameters);
2742 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
2743 n = 0;
2744 g_value_init (&paramv[n], TYPE_FAN);
2745 g_value_set_object (&paramv[n++], skeleton);
2746 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
2747 g_value_set_object (&paramv[n++], invocation);
2748 if (info->pass_fdlist)
2749 {
2750#ifdef G_OS_UNIX
2751 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
2752 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
2753#else
2754 g_assert_not_reached ();
2755#endif
2756 }
2757 g_variant_iter_init (&iter, parameters);
2758 while ((child = g_variant_iter_next_value (&iter)) != NULL)
2759 {
2760 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
2761 if (arg_info->use_gvariant)
2762 {
2763 g_value_init (&paramv[n], G_TYPE_VARIANT);
2764 g_value_set_variant (&paramv[n], child);
2765 n++;
2766 }
2767 else
2768 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
2769 g_variant_unref (child);
2770 }
2771 signal_id = g_signal_lookup (info->signal_name, TYPE_FAN);
2772 g_value_init (&return_value, G_TYPE_BOOLEAN);
2773 g_signal_emitv (paramv, signal_id, 0, &return_value);
2774 if (!g_value_get_boolean (&return_value))
2775 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);
2776 g_value_unset (&return_value);
2777 for (n = 0; n < num_params + num_extra; n++)
2778 g_value_unset (&paramv[n]);
2779 g_free (paramv);
2780}
2781
2782static GVariant *
2783_fan_skeleton_handle_get_property (
2784 GDBusConnection *connection G_GNUC_UNUSED,
2785 const gchar *sender G_GNUC_UNUSED,
2786 const gchar *object_path G_GNUC_UNUSED,
2787 const gchar *interface_name G_GNUC_UNUSED,
2788 const gchar *property_name,
2789 GError **error,
2790 gpointer user_data)
2791{
2792 FanSkeleton *skeleton = FAN_SKELETON (user_data);
2793 GValue value = G_VALUE_INIT;
2794 GParamSpec *pspec;
2795 _ExtendedGDBusPropertyInfo *info;
2796 GVariant *ret;
2797 ret = NULL;
2798 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, property_name);
2799 g_assert (info != NULL);
2800 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
2801 if (pspec == NULL)
2802 {
2803 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
2804 }
2805 else
2806 {
2807 g_value_init (&value, pspec->value_type);
2808 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
2809 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
2810 g_value_unset (&value);
2811 }
2812 return ret;
2813}
2814
2815static gboolean
2816_fan_skeleton_handle_set_property (
2817 GDBusConnection *connection G_GNUC_UNUSED,
2818 const gchar *sender G_GNUC_UNUSED,
2819 const gchar *object_path G_GNUC_UNUSED,
2820 const gchar *interface_name G_GNUC_UNUSED,
2821 const gchar *property_name,
2822 GVariant *variant,
2823 GError **error,
2824 gpointer user_data)
2825{
2826 FanSkeleton *skeleton = FAN_SKELETON (user_data);
2827 GValue value = G_VALUE_INIT;
2828 GParamSpec *pspec;
2829 _ExtendedGDBusPropertyInfo *info;
2830 gboolean ret;
2831 ret = FALSE;
2832 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, property_name);
2833 g_assert (info != NULL);
2834 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
2835 if (pspec == NULL)
2836 {
2837 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
2838 }
2839 else
2840 {
2841 if (info->use_gvariant)
2842 g_value_set_variant (&value, variant);
2843 else
2844 g_dbus_gvariant_to_gvalue (variant, &value);
2845 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
2846 g_value_unset (&value);
2847 ret = TRUE;
2848 }
2849 return ret;
2850}
2851
2852static const GDBusInterfaceVTable _fan_skeleton_vtable =
2853{
2854 _fan_skeleton_handle_method_call,
2855 _fan_skeleton_handle_get_property,
2856 _fan_skeleton_handle_set_property,
2857 {NULL}
2858};
2859
2860static GDBusInterfaceInfo *
2861fan_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
2862{
2863 return fan_interface_info ();
2864}
2865
2866static GDBusInterfaceVTable *
2867fan_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
2868{
2869 return (GDBusInterfaceVTable *) &_fan_skeleton_vtable;
2870}
2871
2872static GVariant *
2873fan_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
2874{
2875 FanSkeleton *skeleton = FAN_SKELETON (_skeleton);
2876
2877 GVariantBuilder builder;
2878 guint n;
2879 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
2880 if (_fan_interface_info.parent_struct.properties == NULL)
2881 goto out;
2882 for (n = 0; _fan_interface_info.parent_struct.properties[n] != NULL; n++)
2883 {
2884 GDBusPropertyInfo *info = _fan_interface_info.parent_struct.properties[n];
2885 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
2886 {
2887 GVariant *value;
2888 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);
2889 if (value != NULL)
2890 {
2891 g_variant_take_ref (value);
2892 g_variant_builder_add (&builder, "{sv}", info->name, value);
2893 g_variant_unref (value);
2894 }
2895 }
2896 }
2897out:
2898 return g_variant_builder_end (&builder);
2899}
2900
2901static gboolean _fan_emit_changed (gpointer user_data);
2902
2903static void
2904fan_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
2905{
2906 FanSkeleton *skeleton = FAN_SKELETON (_skeleton);
2907 gboolean emit_changed = FALSE;
2908
2909 g_mutex_lock (&skeleton->priv->lock);
2910 if (skeleton->priv->changed_properties_idle_source != NULL)
2911 {
2912 g_source_destroy (skeleton->priv->changed_properties_idle_source);
2913 skeleton->priv->changed_properties_idle_source = NULL;
2914 emit_changed = TRUE;
2915 }
2916 g_mutex_unlock (&skeleton->priv->lock);
2917
2918 if (emit_changed)
2919 _fan_emit_changed (skeleton);
2920}
2921
2922static void
2923_fan_on_signal_speed_changed (
2924 Fan *object,
2925 gint arg_speed)
2926{
2927 FanSkeleton *skeleton = FAN_SKELETON (object);
2928
2929 GList *connections, *l;
2930 GVariant *signal_variant;
2931 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
2932
2933 signal_variant = g_variant_ref_sink (g_variant_new ("(i)",
2934 arg_speed));
2935 for (l = connections; l != NULL; l = l->next)
2936 {
2937 GDBusConnection *connection = l->data;
2938 g_dbus_connection_emit_signal (connection,
2939 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Fan", "SpeedChanged",
2940 signal_variant, NULL);
2941 }
2942 g_variant_unref (signal_variant);
2943 g_list_free_full (connections, g_object_unref);
2944}
2945
2946static void
2947_fan_on_signal_tach_error (
2948 Fan *object)
2949{
2950 FanSkeleton *skeleton = FAN_SKELETON (object);
2951
2952 GList *connections, *l;
2953 GVariant *signal_variant;
2954 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
2955
2956 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
2957 for (l = connections; l != NULL; l = l->next)
2958 {
2959 GDBusConnection *connection = l->data;
2960 g_dbus_connection_emit_signal (connection,
2961 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Fan", "TachError",
2962 signal_variant, NULL);
2963 }
2964 g_variant_unref (signal_variant);
2965 g_list_free_full (connections, g_object_unref);
2966}
2967
2968static void fan_skeleton_iface_init (FanIface *iface);
2969#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
2970G_DEFINE_TYPE_WITH_CODE (FanSkeleton, fan_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
2971 G_ADD_PRIVATE (FanSkeleton)
2972 G_IMPLEMENT_INTERFACE (TYPE_FAN, fan_skeleton_iface_init));
2973
2974#else
2975G_DEFINE_TYPE_WITH_CODE (FanSkeleton, fan_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
2976 G_IMPLEMENT_INTERFACE (TYPE_FAN, fan_skeleton_iface_init));
2977
2978#endif
2979static void
2980fan_skeleton_finalize (GObject *object)
2981{
2982 FanSkeleton *skeleton = FAN_SKELETON (object);
2983 guint n;
2984 for (n = 0; n < 3; n++)
2985 g_value_unset (&skeleton->priv->properties[n]);
2986 g_free (skeleton->priv->properties);
2987 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
2988 if (skeleton->priv->changed_properties_idle_source != NULL)
2989 g_source_destroy (skeleton->priv->changed_properties_idle_source);
2990 g_main_context_unref (skeleton->priv->context);
2991 g_mutex_clear (&skeleton->priv->lock);
2992 G_OBJECT_CLASS (fan_skeleton_parent_class)->finalize (object);
2993}
2994
2995static void
2996fan_skeleton_get_property (GObject *object,
2997 guint prop_id,
2998 GValue *value,
2999 GParamSpec *pspec G_GNUC_UNUSED)
3000{
3001 FanSkeleton *skeleton = FAN_SKELETON (object);
3002 g_assert (prop_id != 0 && prop_id - 1 < 3);
3003 g_mutex_lock (&skeleton->priv->lock);
3004 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
3005 g_mutex_unlock (&skeleton->priv->lock);
3006}
3007
3008static gboolean
3009_fan_emit_changed (gpointer user_data)
3010{
3011 FanSkeleton *skeleton = FAN_SKELETON (user_data);
3012 GList *l;
3013 GVariantBuilder builder;
3014 GVariantBuilder invalidated_builder;
3015 guint num_changes;
3016
3017 g_mutex_lock (&skeleton->priv->lock);
3018 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
3019 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
3020 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
3021 {
3022 ChangedProperty *cp = l->data;
3023 GVariant *variant;
3024 const GValue *cur_value;
3025
3026 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
3027 if (!_g_value_equal (cur_value, &cp->orig_value))
3028 {
3029 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
3030 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
3031 g_variant_unref (variant);
3032 num_changes++;
3033 }
3034 }
3035 if (num_changes > 0)
3036 {
3037 GList *connections, *ll;
3038 GVariant *signal_variant;
3039 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Fan",
3040 &builder, &invalidated_builder));
3041 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
3042 for (ll = connections; ll != NULL; ll = ll->next)
3043 {
3044 GDBusConnection *connection = ll->data;
3045
3046 g_dbus_connection_emit_signal (connection,
3047 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
3048 "org.freedesktop.DBus.Properties",
3049 "PropertiesChanged",
3050 signal_variant,
3051 NULL);
3052 }
3053 g_variant_unref (signal_variant);
3054 g_list_free_full (connections, g_object_unref);
3055 }
3056 else
3057 {
3058 g_variant_builder_clear (&builder);
3059 g_variant_builder_clear (&invalidated_builder);
3060 }
3061 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
3062 skeleton->priv->changed_properties = NULL;
3063 skeleton->priv->changed_properties_idle_source = NULL;
3064 g_mutex_unlock (&skeleton->priv->lock);
3065 return FALSE;
3066}
3067
3068static void
3069_fan_schedule_emit_changed (FanSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
3070{
3071 ChangedProperty *cp;
3072 GList *l;
3073 cp = NULL;
3074 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
3075 {
3076 ChangedProperty *i_cp = l->data;
3077 if (i_cp->info == info)
3078 {
3079 cp = i_cp;
3080 break;
3081 }
3082 }
3083 if (cp == NULL)
3084 {
3085 cp = g_new0 (ChangedProperty, 1);
3086 cp->prop_id = prop_id;
3087 cp->info = info;
3088 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
3089 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
3090 g_value_copy (orig_value, &cp->orig_value);
3091 }
3092}
3093
3094static void
3095fan_skeleton_notify (GObject *object,
3096 GParamSpec *pspec G_GNUC_UNUSED)
3097{
3098 FanSkeleton *skeleton = FAN_SKELETON (object);
3099 g_mutex_lock (&skeleton->priv->lock);
3100 if (skeleton->priv->changed_properties != NULL &&
3101 skeleton->priv->changed_properties_idle_source == NULL)
3102 {
3103 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
3104 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
3105 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _fan_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
3106 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
3107 g_source_unref (skeleton->priv->changed_properties_idle_source);
3108 }
3109 g_mutex_unlock (&skeleton->priv->lock);
3110}
3111
3112static void
3113fan_skeleton_set_property (GObject *object,
3114 guint prop_id,
3115 const GValue *value,
3116 GParamSpec *pspec)
3117{
3118 FanSkeleton *skeleton = FAN_SKELETON (object);
3119 g_assert (prop_id != 0 && prop_id - 1 < 3);
3120 g_mutex_lock (&skeleton->priv->lock);
3121 g_object_freeze_notify (object);
3122 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
3123 {
3124 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
3125 _fan_schedule_emit_changed (skeleton, _fan_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
3126 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
3127 g_object_notify_by_pspec (object, pspec);
3128 }
3129 g_mutex_unlock (&skeleton->priv->lock);
3130 g_object_thaw_notify (object);
3131}
3132
3133static void
3134fan_skeleton_init (FanSkeleton *skeleton)
3135{
3136#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
3137 skeleton->priv = fan_skeleton_get_instance_private (skeleton);
3138#else
3139 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_FAN_SKELETON, FanSkeletonPrivate);
3140#endif
3141
3142 g_mutex_init (&skeleton->priv->lock);
3143 skeleton->priv->context = g_main_context_ref_thread_default ();
3144 skeleton->priv->properties = g_new0 (GValue, 3);
3145 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
3146 g_value_init (&skeleton->priv->properties[1], G_TYPE_INT);
3147 g_value_init (&skeleton->priv->properties[2], G_TYPE_INT);
3148}
3149
3150static gint
3151fan_skeleton_get_speed (Fan *object)
3152{
3153 FanSkeleton *skeleton = FAN_SKELETON (object);
3154 gint value;
3155 g_mutex_lock (&skeleton->priv->lock);
3156 value = g_value_get_int (&(skeleton->priv->properties[0]));
3157 g_mutex_unlock (&skeleton->priv->lock);
3158 return value;
3159}
3160
3161static gint
3162fan_skeleton_get_cooling_zone (Fan *object)
3163{
3164 FanSkeleton *skeleton = FAN_SKELETON (object);
3165 gint value;
3166 g_mutex_lock (&skeleton->priv->lock);
3167 value = g_value_get_int (&(skeleton->priv->properties[1]));
3168 g_mutex_unlock (&skeleton->priv->lock);
3169 return value;
3170}
3171
3172static gint
3173fan_skeleton_get_pwm_num (Fan *object)
3174{
3175 FanSkeleton *skeleton = FAN_SKELETON (object);
3176 gint value;
3177 g_mutex_lock (&skeleton->priv->lock);
3178 value = g_value_get_int (&(skeleton->priv->properties[2]));
3179 g_mutex_unlock (&skeleton->priv->lock);
3180 return value;
3181}
3182
3183static void
3184fan_skeleton_class_init (FanSkeletonClass *klass)
3185{
3186 GObjectClass *gobject_class;
3187 GDBusInterfaceSkeletonClass *skeleton_class;
3188
3189 gobject_class = G_OBJECT_CLASS (klass);
3190 gobject_class->finalize = fan_skeleton_finalize;
3191 gobject_class->get_property = fan_skeleton_get_property;
3192 gobject_class->set_property = fan_skeleton_set_property;
3193 gobject_class->notify = fan_skeleton_notify;
3194
3195
3196 fan_override_properties (gobject_class, 1);
3197
3198 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
3199 skeleton_class->get_info = fan_skeleton_dbus_interface_get_info;
3200 skeleton_class->get_properties = fan_skeleton_dbus_interface_get_properties;
3201 skeleton_class->flush = fan_skeleton_dbus_interface_flush;
3202 skeleton_class->get_vtable = fan_skeleton_dbus_interface_get_vtable;
3203
3204#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
3205 g_type_class_add_private (klass, sizeof (FanSkeletonPrivate));
3206#endif
3207}
3208
3209static void
3210fan_skeleton_iface_init (FanIface *iface)
3211{
3212 iface->speed_changed = _fan_on_signal_speed_changed;
3213 iface->tach_error = _fan_on_signal_tach_error;
3214 iface->get_speed = fan_skeleton_get_speed;
3215 iface->get_cooling_zone = fan_skeleton_get_cooling_zone;
3216 iface->get_pwm_num = fan_skeleton_get_pwm_num;
3217}
3218
3219/**
3220 * fan_skeleton_new:
3221 *
3222 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link>.
3223 *
3224 * Returns: (transfer full) (type FanSkeleton): The skeleton object.
3225 */
3226Fan *
3227fan_skeleton_new (void)
3228{
3229 return FAN (g_object_new (TYPE_FAN_SKELETON, NULL));
3230}
3231
3232/* ------------------------------------------------------------------------
3233 * Code for interface org.openbmc.SensorValue
3234 * ------------------------------------------------------------------------
3235 */
3236
3237/**
3238 * SECTION:SensorValue
3239 * @title: SensorValue
3240 * @short_description: Generated C code for the org.openbmc.SensorValue D-Bus interface
3241 *
3242 * 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.
3243 */
3244
3245/* ---- Introspection data for org.openbmc.SensorValue ---- */
3246
3247static const _ExtendedGDBusMethodInfo _sensor_value_method_info_init =
3248{
3249 {
3250 -1,
3251 (gchar *) "init",
3252 NULL,
3253 NULL,
3254 NULL
3255 },
3256 "handle-init",
3257 FALSE
3258};
3259
3260static const _ExtendedGDBusArgInfo _sensor_value_method_info_get_value_OUT_ARG_value =
3261{
3262 {
3263 -1,
3264 (gchar *) "value",
3265 (gchar *) "v",
3266 NULL
3267 },
3268 FALSE
3269};
3270
3271static const _ExtendedGDBusArgInfo * const _sensor_value_method_info_get_value_OUT_ARG_pointers[] =
3272{
3273 &_sensor_value_method_info_get_value_OUT_ARG_value,
3274 NULL
3275};
3276
3277static const _ExtendedGDBusMethodInfo _sensor_value_method_info_get_value =
3278{
3279 {
3280 -1,
3281 (gchar *) "getValue",
3282 NULL,
3283 (GDBusArgInfo **) &_sensor_value_method_info_get_value_OUT_ARG_pointers,
3284 NULL
3285 },
3286 "handle-get-value",
3287 FALSE
3288};
3289
Norman James19e45912015-10-04 20:19:41 -05003290static const _ExtendedGDBusArgInfo _sensor_value_method_info_set_value_IN_ARG_value =
3291{
3292 {
3293 -1,
3294 (gchar *) "value",
3295 (gchar *) "v",
3296 NULL
3297 },
3298 FALSE
3299};
3300
3301static const _ExtendedGDBusArgInfo * const _sensor_value_method_info_set_value_IN_ARG_pointers[] =
3302{
3303 &_sensor_value_method_info_set_value_IN_ARG_value,
3304 NULL
3305};
3306
3307static const _ExtendedGDBusMethodInfo _sensor_value_method_info_set_value =
3308{
3309 {
3310 -1,
3311 (gchar *) "setValue",
3312 (GDBusArgInfo **) &_sensor_value_method_info_set_value_IN_ARG_pointers,
3313 NULL,
3314 NULL
3315 },
3316 "handle-set-value",
3317 FALSE
3318};
3319
Norman James362a80f2015-09-14 14:04:39 -05003320static const _ExtendedGDBusMethodInfo * const _sensor_value_method_info_pointers[] =
3321{
3322 &_sensor_value_method_info_init,
3323 &_sensor_value_method_info_get_value,
Norman James19e45912015-10-04 20:19:41 -05003324 &_sensor_value_method_info_set_value,
Norman James362a80f2015-09-14 14:04:39 -05003325 NULL
3326};
3327
3328static const _ExtendedGDBusArgInfo _sensor_value_signal_info_changed_ARG_value =
3329{
3330 {
3331 -1,
3332 (gchar *) "value",
3333 (gchar *) "v",
3334 NULL
3335 },
3336 FALSE
3337};
3338
3339static const _ExtendedGDBusArgInfo _sensor_value_signal_info_changed_ARG_units =
3340{
3341 {
3342 -1,
3343 (gchar *) "units",
3344 (gchar *) "s",
3345 NULL
3346 },
3347 FALSE
3348};
3349
3350static const _ExtendedGDBusArgInfo * const _sensor_value_signal_info_changed_ARG_pointers[] =
3351{
3352 &_sensor_value_signal_info_changed_ARG_value,
3353 &_sensor_value_signal_info_changed_ARG_units,
3354 NULL
3355};
3356
3357static const _ExtendedGDBusSignalInfo _sensor_value_signal_info_changed =
3358{
3359 {
3360 -1,
3361 (gchar *) "Changed",
3362 (GDBusArgInfo **) &_sensor_value_signal_info_changed_ARG_pointers,
3363 NULL
3364 },
3365 "changed"
3366};
3367
Norman James32e74e22015-09-15 21:28:06 -05003368static const _ExtendedGDBusSignalInfo _sensor_value_signal_info_error =
3369{
3370 {
3371 -1,
3372 (gchar *) "Error",
3373 NULL,
3374 NULL
3375 },
3376 "error"
3377};
3378
Norman James362a80f2015-09-14 14:04:39 -05003379static const _ExtendedGDBusArgInfo _sensor_value_signal_info_heartbeat_ARG_bus_name =
3380{
3381 {
3382 -1,
3383 (gchar *) "bus_name",
3384 (gchar *) "s",
3385 NULL
3386 },
3387 FALSE
3388};
3389
3390static const _ExtendedGDBusArgInfo * const _sensor_value_signal_info_heartbeat_ARG_pointers[] =
3391{
3392 &_sensor_value_signal_info_heartbeat_ARG_bus_name,
3393 NULL
3394};
3395
3396static const _ExtendedGDBusSignalInfo _sensor_value_signal_info_heartbeat =
3397{
3398 {
3399 -1,
3400 (gchar *) "Heartbeat",
3401 (GDBusArgInfo **) &_sensor_value_signal_info_heartbeat_ARG_pointers,
3402 NULL
3403 },
3404 "heartbeat"
3405};
3406
3407static const _ExtendedGDBusSignalInfo * const _sensor_value_signal_info_pointers[] =
3408{
3409 &_sensor_value_signal_info_changed,
Norman James32e74e22015-09-15 21:28:06 -05003410 &_sensor_value_signal_info_error,
Norman James362a80f2015-09-14 14:04:39 -05003411 &_sensor_value_signal_info_heartbeat,
3412 NULL
3413};
3414
3415static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_value =
3416{
3417 {
3418 -1,
3419 (gchar *) "value",
3420 (gchar *) "v",
3421 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
3422 NULL
3423 },
3424 "value",
3425 FALSE
3426};
3427
3428static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_units =
3429{
3430 {
3431 -1,
3432 (gchar *) "units",
3433 (gchar *) "s",
3434 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
3435 NULL
3436 },
3437 "units",
3438 FALSE
3439};
3440
3441static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_poll_interval =
3442{
3443 {
3444 -1,
3445 (gchar *) "poll_interval",
3446 (gchar *) "i",
3447 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
3448 NULL
3449 },
3450 "poll-interval",
3451 FALSE
3452};
3453
3454static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_heatbeat =
3455{
3456 {
3457 -1,
3458 (gchar *) "heatbeat",
3459 (gchar *) "i",
3460 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
3461 NULL
3462 },
3463 "heatbeat",
3464 FALSE
3465};
3466
3467static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_settable =
3468{
3469 {
3470 -1,
3471 (gchar *) "settable",
3472 (gchar *) "b",
3473 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
3474 NULL
3475 },
3476 "settable",
3477 FALSE
3478};
3479
Norman James362a80f2015-09-14 14:04:39 -05003480static const _ExtendedGDBusPropertyInfo * const _sensor_value_property_info_pointers[] =
3481{
3482 &_sensor_value_property_info_value,
3483 &_sensor_value_property_info_units,
3484 &_sensor_value_property_info_poll_interval,
3485 &_sensor_value_property_info_heatbeat,
3486 &_sensor_value_property_info_settable,
Norman James362a80f2015-09-14 14:04:39 -05003487 NULL
3488};
3489
3490static const _ExtendedGDBusInterfaceInfo _sensor_value_interface_info =
3491{
3492 {
3493 -1,
3494 (gchar *) "org.openbmc.SensorValue",
3495 (GDBusMethodInfo **) &_sensor_value_method_info_pointers,
3496 (GDBusSignalInfo **) &_sensor_value_signal_info_pointers,
3497 (GDBusPropertyInfo **) &_sensor_value_property_info_pointers,
3498 NULL
3499 },
3500 "sensor-value",
3501};
3502
3503
3504/**
3505 * sensor_value_interface_info:
3506 *
3507 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link> D-Bus interface.
3508 *
3509 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
3510 */
3511GDBusInterfaceInfo *
3512sensor_value_interface_info (void)
3513{
3514 return (GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct;
3515}
3516
3517/**
3518 * sensor_value_override_properties:
3519 * @klass: The class structure for a #GObject<!-- -->-derived class.
3520 * @property_id_begin: The property id to assign to the first overridden property.
3521 *
3522 * Overrides all #GObject properties in the #SensorValue interface for a concrete class.
3523 * The properties are overridden in the order they are defined.
3524 *
3525 * Returns: The last property id.
3526 */
3527guint
3528sensor_value_override_properties (GObjectClass *klass, guint property_id_begin)
3529{
3530 g_object_class_override_property (klass, property_id_begin++, "value");
3531 g_object_class_override_property (klass, property_id_begin++, "units");
3532 g_object_class_override_property (klass, property_id_begin++, "poll-interval");
3533 g_object_class_override_property (klass, property_id_begin++, "heatbeat");
3534 g_object_class_override_property (klass, property_id_begin++, "settable");
Norman James362a80f2015-09-14 14:04:39 -05003535 return property_id_begin - 1;
3536}
3537
3538
3539
3540/**
3541 * SensorValue:
3542 *
3543 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link>.
3544 */
3545
3546/**
3547 * SensorValueIface:
3548 * @parent_iface: The parent interface.
3549 * @handle_get_value: Handler for the #SensorValue::handle-get-value signal.
3550 * @handle_init: Handler for the #SensorValue::handle-init signal.
Norman James19e45912015-10-04 20:19:41 -05003551 * @handle_set_value: Handler for the #SensorValue::handle-set-value signal.
Norman James362a80f2015-09-14 14:04:39 -05003552 * @get_heatbeat: Getter for the #SensorValue:heatbeat property.
Norman James362a80f2015-09-14 14:04:39 -05003553 * @get_poll_interval: Getter for the #SensorValue:poll-interval property.
3554 * @get_settable: Getter for the #SensorValue:settable property.
3555 * @get_units: Getter for the #SensorValue:units property.
3556 * @get_value: Getter for the #SensorValue:value property.
3557 * @changed: Handler for the #SensorValue::changed signal.
Norman James32e74e22015-09-15 21:28:06 -05003558 * @error: Handler for the #SensorValue::error signal.
Norman James362a80f2015-09-14 14:04:39 -05003559 * @heartbeat: Handler for the #SensorValue::heartbeat signal.
3560 *
3561 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link>.
3562 */
3563
3564typedef SensorValueIface SensorValueInterface;
3565G_DEFINE_INTERFACE (SensorValue, sensor_value, G_TYPE_OBJECT);
3566
3567static void
3568sensor_value_default_init (SensorValueIface *iface)
3569{
3570 /* GObject signals for incoming D-Bus method calls: */
3571 /**
3572 * SensorValue::handle-init:
3573 * @object: A #SensorValue.
3574 * @invocation: A #GDBusMethodInvocation.
3575 *
3576 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorValue.init">init()</link> D-Bus method.
3577 *
3578 * 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.
3579 *
3580 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
3581 */
3582 g_signal_new ("handle-init",
3583 G_TYPE_FROM_INTERFACE (iface),
3584 G_SIGNAL_RUN_LAST,
3585 G_STRUCT_OFFSET (SensorValueIface, handle_init),
3586 g_signal_accumulator_true_handled,
3587 NULL,
3588 g_cclosure_marshal_generic,
3589 G_TYPE_BOOLEAN,
3590 1,
3591 G_TYPE_DBUS_METHOD_INVOCATION);
3592
3593 /**
3594 * SensorValue::handle-get-value:
3595 * @object: A #SensorValue.
3596 * @invocation: A #GDBusMethodInvocation.
3597 *
3598 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorValue.getValue">getValue()</link> D-Bus method.
3599 *
3600 * 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.
3601 *
3602 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
3603 */
3604 g_signal_new ("handle-get-value",
3605 G_TYPE_FROM_INTERFACE (iface),
3606 G_SIGNAL_RUN_LAST,
3607 G_STRUCT_OFFSET (SensorValueIface, handle_get_value),
3608 g_signal_accumulator_true_handled,
3609 NULL,
3610 g_cclosure_marshal_generic,
3611 G_TYPE_BOOLEAN,
3612 1,
3613 G_TYPE_DBUS_METHOD_INVOCATION);
3614
Norman James19e45912015-10-04 20:19:41 -05003615 /**
3616 * SensorValue::handle-set-value:
3617 * @object: A #SensorValue.
3618 * @invocation: A #GDBusMethodInvocation.
3619 * @arg_value: Argument passed by remote caller.
3620 *
3621 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorValue.setValue">setValue()</link> D-Bus method.
3622 *
3623 * 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.
3624 *
3625 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
3626 */
3627 g_signal_new ("handle-set-value",
3628 G_TYPE_FROM_INTERFACE (iface),
3629 G_SIGNAL_RUN_LAST,
3630 G_STRUCT_OFFSET (SensorValueIface, handle_set_value),
3631 g_signal_accumulator_true_handled,
3632 NULL,
3633 g_cclosure_marshal_generic,
3634 G_TYPE_BOOLEAN,
3635 2,
3636 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_VARIANT);
3637
Norman James362a80f2015-09-14 14:04:39 -05003638 /* GObject signals for received D-Bus signals: */
3639 /**
3640 * SensorValue::changed:
3641 * @object: A #SensorValue.
3642 * @arg_value: Argument.
3643 * @arg_units: Argument.
3644 *
3645 * 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.
3646 *
3647 * 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.
3648 */
3649 g_signal_new ("changed",
3650 G_TYPE_FROM_INTERFACE (iface),
3651 G_SIGNAL_RUN_LAST,
3652 G_STRUCT_OFFSET (SensorValueIface, changed),
3653 NULL,
3654 NULL,
3655 g_cclosure_marshal_generic,
3656 G_TYPE_NONE,
3657 2, G_TYPE_VARIANT, G_TYPE_STRING);
3658
3659 /**
Norman James32e74e22015-09-15 21:28:06 -05003660 * SensorValue::error:
3661 * @object: A #SensorValue.
3662 *
3663 * 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.
3664 *
3665 * 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.
3666 */
3667 g_signal_new ("error",
3668 G_TYPE_FROM_INTERFACE (iface),
3669 G_SIGNAL_RUN_LAST,
3670 G_STRUCT_OFFSET (SensorValueIface, error),
3671 NULL,
3672 NULL,
3673 g_cclosure_marshal_generic,
3674 G_TYPE_NONE,
3675 0);
3676
3677 /**
Norman James362a80f2015-09-14 14:04:39 -05003678 * SensorValue::heartbeat:
3679 * @object: A #SensorValue.
3680 * @arg_bus_name: Argument.
3681 *
3682 * 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.
3683 *
3684 * 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.
3685 */
3686 g_signal_new ("heartbeat",
3687 G_TYPE_FROM_INTERFACE (iface),
3688 G_SIGNAL_RUN_LAST,
3689 G_STRUCT_OFFSET (SensorValueIface, heartbeat),
3690 NULL,
3691 NULL,
3692 g_cclosure_marshal_generic,
3693 G_TYPE_NONE,
3694 1, G_TYPE_STRING);
3695
3696 /* GObject properties for D-Bus properties: */
3697 /**
3698 * SensorValue:value:
3699 *
3700 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link>.
3701 *
3702 * 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.
3703 */
3704 g_object_interface_install_property (iface,
3705 g_param_spec_variant ("value", "value", "value", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
3706 /**
3707 * SensorValue:units:
3708 *
3709 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link>.
3710 *
3711 * 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.
3712 */
3713 g_object_interface_install_property (iface,
3714 g_param_spec_string ("units", "units", "units", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
3715 /**
3716 * SensorValue:poll-interval:
3717 *
3718 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.poll_interval">"poll_interval"</link>.
3719 *
3720 * 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.
3721 */
3722 g_object_interface_install_property (iface,
3723 g_param_spec_int ("poll-interval", "poll_interval", "poll_interval", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
3724 /**
3725 * SensorValue:heatbeat:
3726 *
3727 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.heatbeat">"heatbeat"</link>.
3728 *
3729 * 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.
3730 */
3731 g_object_interface_install_property (iface,
3732 g_param_spec_int ("heatbeat", "heatbeat", "heatbeat", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
3733 /**
3734 * SensorValue:settable:
3735 *
3736 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.settable">"settable"</link>.
3737 *
3738 * 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.
3739 */
3740 g_object_interface_install_property (iface,
3741 g_param_spec_boolean ("settable", "settable", "settable", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Norman James362a80f2015-09-14 14:04:39 -05003742}
3743
3744/**
3745 * sensor_value_get_value: (skip)
3746 * @object: A #SensorValue.
3747 *
3748 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link> D-Bus property.
3749 *
3750 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
3751 *
3752 * <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>
3753 *
3754 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
3755 */
3756GVariant *
3757sensor_value_get_value (SensorValue *object)
3758{
3759 return SENSOR_VALUE_GET_IFACE (object)->get_value (object);
3760}
3761
3762/**
3763 * sensor_value_dup_value: (skip)
3764 * @object: A #SensorValue.
3765 *
3766 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link> D-Bus property.
3767 *
3768 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
3769 *
3770 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
3771 */
3772GVariant *
3773sensor_value_dup_value (SensorValue *object)
3774{
3775 GVariant *value;
3776 g_object_get (G_OBJECT (object), "value", &value, NULL);
3777 return value;
3778}
3779
3780/**
3781 * sensor_value_set_value: (skip)
3782 * @object: A #SensorValue.
3783 * @value: The value to set.
3784 *
3785 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link> D-Bus property to @value.
3786 *
3787 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
3788 */
3789void
3790sensor_value_set_value (SensorValue *object, GVariant *value)
3791{
3792 g_object_set (G_OBJECT (object), "value", value, NULL);
3793}
3794
3795/**
3796 * sensor_value_get_units: (skip)
3797 * @object: A #SensorValue.
3798 *
3799 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link> D-Bus property.
3800 *
3801 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
3802 *
3803 * <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>
3804 *
3805 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
3806 */
3807const gchar *
3808sensor_value_get_units (SensorValue *object)
3809{
3810 return SENSOR_VALUE_GET_IFACE (object)->get_units (object);
3811}
3812
3813/**
3814 * sensor_value_dup_units: (skip)
3815 * @object: A #SensorValue.
3816 *
3817 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link> D-Bus property.
3818 *
3819 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
3820 *
3821 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
3822 */
3823gchar *
3824sensor_value_dup_units (SensorValue *object)
3825{
3826 gchar *value;
3827 g_object_get (G_OBJECT (object), "units", &value, NULL);
3828 return value;
3829}
3830
3831/**
3832 * sensor_value_set_units: (skip)
3833 * @object: A #SensorValue.
3834 * @value: The value to set.
3835 *
3836 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link> D-Bus property to @value.
3837 *
3838 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
3839 */
3840void
3841sensor_value_set_units (SensorValue *object, const gchar *value)
3842{
3843 g_object_set (G_OBJECT (object), "units", value, NULL);
3844}
3845
3846/**
3847 * sensor_value_get_poll_interval: (skip)
3848 * @object: A #SensorValue.
3849 *
3850 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.poll_interval">"poll_interval"</link> D-Bus property.
3851 *
3852 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
3853 *
3854 * Returns: The property value.
3855 */
3856gint
3857sensor_value_get_poll_interval (SensorValue *object)
3858{
3859 return SENSOR_VALUE_GET_IFACE (object)->get_poll_interval (object);
3860}
3861
3862/**
3863 * sensor_value_set_poll_interval: (skip)
3864 * @object: A #SensorValue.
3865 * @value: The value to set.
3866 *
3867 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.poll_interval">"poll_interval"</link> D-Bus property to @value.
3868 *
3869 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
3870 */
3871void
3872sensor_value_set_poll_interval (SensorValue *object, gint value)
3873{
3874 g_object_set (G_OBJECT (object), "poll-interval", value, NULL);
3875}
3876
3877/**
3878 * sensor_value_get_heatbeat: (skip)
3879 * @object: A #SensorValue.
3880 *
3881 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.heatbeat">"heatbeat"</link> D-Bus property.
3882 *
3883 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
3884 *
3885 * Returns: The property value.
3886 */
3887gint
3888sensor_value_get_heatbeat (SensorValue *object)
3889{
3890 return SENSOR_VALUE_GET_IFACE (object)->get_heatbeat (object);
3891}
3892
3893/**
3894 * sensor_value_set_heatbeat: (skip)
3895 * @object: A #SensorValue.
3896 * @value: The value to set.
3897 *
3898 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.heatbeat">"heatbeat"</link> D-Bus property to @value.
3899 *
3900 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
3901 */
3902void
3903sensor_value_set_heatbeat (SensorValue *object, gint value)
3904{
3905 g_object_set (G_OBJECT (object), "heatbeat", value, NULL);
3906}
3907
3908/**
3909 * sensor_value_get_settable: (skip)
3910 * @object: A #SensorValue.
3911 *
3912 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.settable">"settable"</link> D-Bus property.
3913 *
3914 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
3915 *
3916 * Returns: The property value.
3917 */
3918gboolean
3919sensor_value_get_settable (SensorValue *object)
3920{
3921 return SENSOR_VALUE_GET_IFACE (object)->get_settable (object);
3922}
3923
3924/**
3925 * sensor_value_set_settable: (skip)
3926 * @object: A #SensorValue.
3927 * @value: The value to set.
3928 *
3929 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.settable">"settable"</link> D-Bus property to @value.
3930 *
3931 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
3932 */
3933void
3934sensor_value_set_settable (SensorValue *object, gboolean value)
3935{
3936 g_object_set (G_OBJECT (object), "settable", value, NULL);
3937}
3938
3939/**
Norman James362a80f2015-09-14 14:04:39 -05003940 * sensor_value_emit_changed:
3941 * @object: A #SensorValue.
3942 * @arg_value: Argument to pass with the signal.
3943 * @arg_units: Argument to pass with the signal.
3944 *
3945 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorValue.Changed">"Changed"</link> D-Bus signal.
3946 */
3947void
3948sensor_value_emit_changed (
3949 SensorValue *object,
3950 GVariant *arg_value,
3951 const gchar *arg_units)
3952{
3953 g_signal_emit_by_name (object, "changed", arg_value, arg_units);
3954}
3955
3956/**
Norman James32e74e22015-09-15 21:28:06 -05003957 * sensor_value_emit_error:
3958 * @object: A #SensorValue.
3959 *
3960 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorValue.Error">"Error"</link> D-Bus signal.
3961 */
3962void
3963sensor_value_emit_error (
3964 SensorValue *object)
3965{
3966 g_signal_emit_by_name (object, "error");
3967}
3968
3969/**
Norman James362a80f2015-09-14 14:04:39 -05003970 * sensor_value_emit_heartbeat:
3971 * @object: A #SensorValue.
3972 * @arg_bus_name: Argument to pass with the signal.
3973 *
3974 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorValue.Heartbeat">"Heartbeat"</link> D-Bus signal.
3975 */
3976void
3977sensor_value_emit_heartbeat (
3978 SensorValue *object,
3979 const gchar *arg_bus_name)
3980{
3981 g_signal_emit_by_name (object, "heartbeat", arg_bus_name);
3982}
3983
3984/**
3985 * sensor_value_call_init:
3986 * @proxy: A #SensorValueProxy.
3987 * @cancellable: (allow-none): A #GCancellable or %NULL.
3988 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
3989 * @user_data: User data to pass to @callback.
3990 *
3991 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorValue.init">init()</link> D-Bus method on @proxy.
3992 * 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.
3993 * You can then call sensor_value_call_init_finish() to get the result of the operation.
3994 *
3995 * See sensor_value_call_init_sync() for the synchronous, blocking version of this method.
3996 */
3997void
3998sensor_value_call_init (
3999 SensorValue *proxy,
4000 GCancellable *cancellable,
4001 GAsyncReadyCallback callback,
4002 gpointer user_data)
4003{
4004 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
4005 "init",
4006 g_variant_new ("()"),
4007 G_DBUS_CALL_FLAGS_NONE,
4008 -1,
4009 cancellable,
4010 callback,
4011 user_data);
4012}
4013
4014/**
4015 * sensor_value_call_init_finish:
4016 * @proxy: A #SensorValueProxy.
4017 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_call_init().
4018 * @error: Return location for error or %NULL.
4019 *
4020 * Finishes an operation started with sensor_value_call_init().
4021 *
4022 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
4023 */
4024gboolean
4025sensor_value_call_init_finish (
4026 SensorValue *proxy,
4027 GAsyncResult *res,
4028 GError **error)
4029{
4030 GVariant *_ret;
4031 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
4032 if (_ret == NULL)
4033 goto _out;
4034 g_variant_get (_ret,
4035 "()");
4036 g_variant_unref (_ret);
4037_out:
4038 return _ret != NULL;
4039}
4040
4041/**
4042 * sensor_value_call_init_sync:
4043 * @proxy: A #SensorValueProxy.
4044 * @cancellable: (allow-none): A #GCancellable or %NULL.
4045 * @error: Return location for error or %NULL.
4046 *
4047 * 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.
4048 *
4049 * See sensor_value_call_init() for the asynchronous version of this method.
4050 *
4051 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
4052 */
4053gboolean
4054sensor_value_call_init_sync (
4055 SensorValue *proxy,
4056 GCancellable *cancellable,
4057 GError **error)
4058{
4059 GVariant *_ret;
4060 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
4061 "init",
4062 g_variant_new ("()"),
4063 G_DBUS_CALL_FLAGS_NONE,
4064 -1,
4065 cancellable,
4066 error);
4067 if (_ret == NULL)
4068 goto _out;
4069 g_variant_get (_ret,
4070 "()");
4071 g_variant_unref (_ret);
4072_out:
4073 return _ret != NULL;
4074}
4075
4076/**
4077 * sensor_value_call_get_value:
4078 * @proxy: A #SensorValueProxy.
4079 * @cancellable: (allow-none): A #GCancellable or %NULL.
4080 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
4081 * @user_data: User data to pass to @callback.
4082 *
4083 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorValue.getValue">getValue()</link> D-Bus method on @proxy.
4084 * 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.
4085 * You can then call sensor_value_call_get_value_finish() to get the result of the operation.
4086 *
4087 * See sensor_value_call_get_value_sync() for the synchronous, blocking version of this method.
4088 */
4089void
4090sensor_value_call_get_value (
4091 SensorValue *proxy,
4092 GCancellable *cancellable,
4093 GAsyncReadyCallback callback,
4094 gpointer user_data)
4095{
4096 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
4097 "getValue",
4098 g_variant_new ("()"),
4099 G_DBUS_CALL_FLAGS_NONE,
4100 -1,
4101 cancellable,
4102 callback,
4103 user_data);
4104}
4105
4106/**
4107 * sensor_value_call_get_value_finish:
4108 * @proxy: A #SensorValueProxy.
4109 * @out_value: (out): Return location for return parameter or %NULL to ignore.
4110 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_call_get_value().
4111 * @error: Return location for error or %NULL.
4112 *
4113 * Finishes an operation started with sensor_value_call_get_value().
4114 *
4115 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
4116 */
4117gboolean
4118sensor_value_call_get_value_finish (
4119 SensorValue *proxy,
4120 GVariant **out_value,
4121 GAsyncResult *res,
4122 GError **error)
4123{
4124 GVariant *_ret;
4125 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
4126 if (_ret == NULL)
4127 goto _out;
4128 g_variant_get (_ret,
4129 "(@v)",
4130 out_value);
4131 g_variant_unref (_ret);
4132_out:
4133 return _ret != NULL;
4134}
4135
4136/**
4137 * sensor_value_call_get_value_sync:
4138 * @proxy: A #SensorValueProxy.
4139 * @out_value: (out): Return location for return parameter or %NULL to ignore.
4140 * @cancellable: (allow-none): A #GCancellable or %NULL.
4141 * @error: Return location for error or %NULL.
4142 *
4143 * 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.
4144 *
4145 * See sensor_value_call_get_value() for the asynchronous version of this method.
4146 *
4147 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
4148 */
4149gboolean
4150sensor_value_call_get_value_sync (
4151 SensorValue *proxy,
4152 GVariant **out_value,
4153 GCancellable *cancellable,
4154 GError **error)
4155{
4156 GVariant *_ret;
4157 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
4158 "getValue",
4159 g_variant_new ("()"),
4160 G_DBUS_CALL_FLAGS_NONE,
4161 -1,
4162 cancellable,
4163 error);
4164 if (_ret == NULL)
4165 goto _out;
4166 g_variant_get (_ret,
4167 "(@v)",
4168 out_value);
4169 g_variant_unref (_ret);
4170_out:
4171 return _ret != NULL;
4172}
4173
4174/**
Norman James19e45912015-10-04 20:19:41 -05004175 * sensor_value_call_set_value:
4176 * @proxy: A #SensorValueProxy.
4177 * @arg_value: Argument to pass with the method invocation.
4178 * @cancellable: (allow-none): A #GCancellable or %NULL.
4179 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
4180 * @user_data: User data to pass to @callback.
4181 *
4182 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorValue.setValue">setValue()</link> D-Bus method on @proxy.
4183 * 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.
4184 * You can then call sensor_value_call_set_value_finish() to get the result of the operation.
4185 *
4186 * See sensor_value_call_set_value_sync() for the synchronous, blocking version of this method.
4187 */
4188void
4189sensor_value_call_set_value (
4190 SensorValue *proxy,
4191 GVariant *arg_value,
4192 GCancellable *cancellable,
4193 GAsyncReadyCallback callback,
4194 gpointer user_data)
4195{
4196 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
4197 "setValue",
4198 g_variant_new ("(@v)",
4199 arg_value),
4200 G_DBUS_CALL_FLAGS_NONE,
4201 -1,
4202 cancellable,
4203 callback,
4204 user_data);
4205}
4206
4207/**
4208 * sensor_value_call_set_value_finish:
4209 * @proxy: A #SensorValueProxy.
4210 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_call_set_value().
4211 * @error: Return location for error or %NULL.
4212 *
4213 * Finishes an operation started with sensor_value_call_set_value().
4214 *
4215 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
4216 */
4217gboolean
4218sensor_value_call_set_value_finish (
4219 SensorValue *proxy,
4220 GAsyncResult *res,
4221 GError **error)
4222{
4223 GVariant *_ret;
4224 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
4225 if (_ret == NULL)
4226 goto _out;
4227 g_variant_get (_ret,
4228 "()");
4229 g_variant_unref (_ret);
4230_out:
4231 return _ret != NULL;
4232}
4233
4234/**
4235 * sensor_value_call_set_value_sync:
4236 * @proxy: A #SensorValueProxy.
4237 * @arg_value: Argument to pass with the method invocation.
4238 * @cancellable: (allow-none): A #GCancellable or %NULL.
4239 * @error: Return location for error or %NULL.
4240 *
4241 * 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.
4242 *
4243 * See sensor_value_call_set_value() for the asynchronous version of this method.
4244 *
4245 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
4246 */
4247gboolean
4248sensor_value_call_set_value_sync (
4249 SensorValue *proxy,
4250 GVariant *arg_value,
4251 GCancellable *cancellable,
4252 GError **error)
4253{
4254 GVariant *_ret;
4255 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
4256 "setValue",
4257 g_variant_new ("(@v)",
4258 arg_value),
4259 G_DBUS_CALL_FLAGS_NONE,
4260 -1,
4261 cancellable,
4262 error);
4263 if (_ret == NULL)
4264 goto _out;
4265 g_variant_get (_ret,
4266 "()");
4267 g_variant_unref (_ret);
4268_out:
4269 return _ret != NULL;
4270}
4271
4272/**
Norman James362a80f2015-09-14 14:04:39 -05004273 * sensor_value_complete_init:
4274 * @object: A #SensorValue.
4275 * @invocation: (transfer full): A #GDBusMethodInvocation.
4276 *
4277 * 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.
4278 *
4279 * This method will free @invocation, you cannot use it afterwards.
4280 */
4281void
4282sensor_value_complete_init (
4283 SensorValue *object,
4284 GDBusMethodInvocation *invocation)
4285{
4286 g_dbus_method_invocation_return_value (invocation,
4287 g_variant_new ("()"));
4288}
4289
4290/**
4291 * sensor_value_complete_get_value:
4292 * @object: A #SensorValue.
4293 * @invocation: (transfer full): A #GDBusMethodInvocation.
4294 * @value: Parameter to return.
4295 *
4296 * 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.
4297 *
4298 * This method will free @invocation, you cannot use it afterwards.
4299 */
4300void
4301sensor_value_complete_get_value (
4302 SensorValue *object,
4303 GDBusMethodInvocation *invocation,
4304 GVariant *value)
4305{
4306 g_dbus_method_invocation_return_value (invocation,
4307 g_variant_new ("(@v)",
4308 value));
4309}
4310
Norman James19e45912015-10-04 20:19:41 -05004311/**
4312 * sensor_value_complete_set_value:
4313 * @object: A #SensorValue.
4314 * @invocation: (transfer full): A #GDBusMethodInvocation.
4315 *
4316 * 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.
4317 *
4318 * This method will free @invocation, you cannot use it afterwards.
4319 */
4320void
4321sensor_value_complete_set_value (
4322 SensorValue *object,
4323 GDBusMethodInvocation *invocation)
4324{
4325 g_dbus_method_invocation_return_value (invocation,
4326 g_variant_new ("()"));
4327}
4328
Norman James362a80f2015-09-14 14:04:39 -05004329/* ------------------------------------------------------------------------ */
4330
4331/**
4332 * SensorValueProxy:
4333 *
4334 * The #SensorValueProxy structure contains only private data and should only be accessed using the provided API.
4335 */
4336
4337/**
4338 * SensorValueProxyClass:
4339 * @parent_class: The parent class.
4340 *
4341 * Class structure for #SensorValueProxy.
4342 */
4343
4344struct _SensorValueProxyPrivate
4345{
4346 GData *qdata;
4347};
4348
4349static void sensor_value_proxy_iface_init (SensorValueIface *iface);
4350
4351#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
4352G_DEFINE_TYPE_WITH_CODE (SensorValueProxy, sensor_value_proxy, G_TYPE_DBUS_PROXY,
4353 G_ADD_PRIVATE (SensorValueProxy)
4354 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_proxy_iface_init));
4355
4356#else
4357G_DEFINE_TYPE_WITH_CODE (SensorValueProxy, sensor_value_proxy, G_TYPE_DBUS_PROXY,
4358 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_proxy_iface_init));
4359
4360#endif
4361static void
4362sensor_value_proxy_finalize (GObject *object)
4363{
4364 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
4365 g_datalist_clear (&proxy->priv->qdata);
4366 G_OBJECT_CLASS (sensor_value_proxy_parent_class)->finalize (object);
4367}
4368
4369static void
4370sensor_value_proxy_get_property (GObject *object,
4371 guint prop_id,
4372 GValue *value,
4373 GParamSpec *pspec G_GNUC_UNUSED)
4374{
4375 const _ExtendedGDBusPropertyInfo *info;
4376 GVariant *variant;
Norman Jamesdfdaca92015-09-27 22:11:15 -05004377 g_assert (prop_id != 0 && prop_id - 1 < 5);
Norman James362a80f2015-09-14 14:04:39 -05004378 info = _sensor_value_property_info_pointers[prop_id - 1];
4379 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
4380 if (info->use_gvariant)
4381 {
4382 g_value_set_variant (value, variant);
4383 }
4384 else
4385 {
4386 if (variant != NULL)
4387 g_dbus_gvariant_to_gvalue (variant, value);
4388 }
4389 if (variant != NULL)
4390 g_variant_unref (variant);
4391}
4392
4393static void
4394sensor_value_proxy_set_property_cb (GDBusProxy *proxy,
4395 GAsyncResult *res,
4396 gpointer user_data)
4397{
4398 const _ExtendedGDBusPropertyInfo *info = user_data;
4399 GError *error;
4400 GVariant *_ret;
4401 error = NULL;
4402 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
4403 if (!_ret)
4404 {
4405 g_warning ("Error setting property '%s' on interface org.openbmc.SensorValue: %s (%s, %d)",
4406 info->parent_struct.name,
4407 error->message, g_quark_to_string (error->domain), error->code);
4408 g_error_free (error);
4409 }
4410 else
4411 {
4412 g_variant_unref (_ret);
4413 }
4414}
4415
4416static void
4417sensor_value_proxy_set_property (GObject *object,
4418 guint prop_id,
4419 const GValue *value,
4420 GParamSpec *pspec G_GNUC_UNUSED)
4421{
4422 const _ExtendedGDBusPropertyInfo *info;
4423 GVariant *variant;
Norman Jamesdfdaca92015-09-27 22:11:15 -05004424 g_assert (prop_id != 0 && prop_id - 1 < 5);
Norman James362a80f2015-09-14 14:04:39 -05004425 info = _sensor_value_property_info_pointers[prop_id - 1];
4426 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
4427 g_dbus_proxy_call (G_DBUS_PROXY (object),
4428 "org.freedesktop.DBus.Properties.Set",
4429 g_variant_new ("(ssv)", "org.openbmc.SensorValue", info->parent_struct.name, variant),
4430 G_DBUS_CALL_FLAGS_NONE,
4431 -1,
4432 NULL, (GAsyncReadyCallback) sensor_value_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
4433 g_variant_unref (variant);
4434}
4435
4436static void
4437sensor_value_proxy_g_signal (GDBusProxy *proxy,
4438 const gchar *sender_name G_GNUC_UNUSED,
4439 const gchar *signal_name,
4440 GVariant *parameters)
4441{
4442 _ExtendedGDBusSignalInfo *info;
4443 GVariantIter iter;
4444 GVariant *child;
4445 GValue *paramv;
4446 guint num_params;
4447 guint n;
4448 guint signal_id;
4449 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, signal_name);
4450 if (info == NULL)
4451 return;
4452 num_params = g_variant_n_children (parameters);
4453 paramv = g_new0 (GValue, num_params + 1);
4454 g_value_init (&paramv[0], TYPE_SENSOR_VALUE);
4455 g_value_set_object (&paramv[0], proxy);
4456 g_variant_iter_init (&iter, parameters);
4457 n = 1;
4458 while ((child = g_variant_iter_next_value (&iter)) != NULL)
4459 {
4460 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
4461 if (arg_info->use_gvariant)
4462 {
4463 g_value_init (&paramv[n], G_TYPE_VARIANT);
4464 g_value_set_variant (&paramv[n], child);
4465 n++;
4466 }
4467 else
4468 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
4469 g_variant_unref (child);
4470 }
4471 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_VALUE);
4472 g_signal_emitv (paramv, signal_id, 0, NULL);
4473 for (n = 0; n < num_params + 1; n++)
4474 g_value_unset (&paramv[n]);
4475 g_free (paramv);
4476}
4477
4478static void
4479sensor_value_proxy_g_properties_changed (GDBusProxy *_proxy,
4480 GVariant *changed_properties,
4481 const gchar *const *invalidated_properties)
4482{
4483 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (_proxy);
4484 guint n;
4485 const gchar *key;
4486 GVariantIter *iter;
4487 _ExtendedGDBusPropertyInfo *info;
4488 g_variant_get (changed_properties, "a{sv}", &iter);
4489 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
4490 {
4491 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, key);
4492 g_datalist_remove_data (&proxy->priv->qdata, key);
4493 if (info != NULL)
4494 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
4495 }
4496 g_variant_iter_free (iter);
4497 for (n = 0; invalidated_properties[n] != NULL; n++)
4498 {
4499 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, invalidated_properties[n]);
4500 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
4501 if (info != NULL)
4502 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
4503 }
4504}
4505
4506static GVariant *
4507sensor_value_proxy_get_value (SensorValue *object)
4508{
4509 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
4510 GVariant *variant;
4511 GVariant *value = NULL;
4512 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "value");
4513 value = variant;
4514 if (variant != NULL)
4515 g_variant_unref (variant);
4516 return value;
4517}
4518
4519static const gchar *
4520sensor_value_proxy_get_units (SensorValue *object)
4521{
4522 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
4523 GVariant *variant;
4524 const gchar *value = NULL;
4525 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "units");
4526 if (variant != NULL)
4527 {
4528 value = g_variant_get_string (variant, NULL);
4529 g_variant_unref (variant);
4530 }
4531 return value;
4532}
4533
4534static gint
4535sensor_value_proxy_get_poll_interval (SensorValue *object)
4536{
4537 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
4538 GVariant *variant;
4539 gint value = 0;
4540 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "poll_interval");
4541 if (variant != NULL)
4542 {
4543 value = g_variant_get_int32 (variant);
4544 g_variant_unref (variant);
4545 }
4546 return value;
4547}
4548
4549static gint
4550sensor_value_proxy_get_heatbeat (SensorValue *object)
4551{
4552 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
4553 GVariant *variant;
4554 gint value = 0;
4555 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "heatbeat");
4556 if (variant != NULL)
4557 {
4558 value = g_variant_get_int32 (variant);
4559 g_variant_unref (variant);
4560 }
4561 return value;
4562}
4563
4564static gboolean
4565sensor_value_proxy_get_settable (SensorValue *object)
4566{
4567 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
4568 GVariant *variant;
4569 gboolean value = 0;
4570 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "settable");
4571 if (variant != NULL)
4572 {
4573 value = g_variant_get_boolean (variant);
4574 g_variant_unref (variant);
4575 }
4576 return value;
4577}
4578
Norman James362a80f2015-09-14 14:04:39 -05004579static void
4580sensor_value_proxy_init (SensorValueProxy *proxy)
4581{
4582#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
4583 proxy->priv = sensor_value_proxy_get_instance_private (proxy);
4584#else
4585 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_VALUE_PROXY, SensorValueProxyPrivate);
4586#endif
4587
4588 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_value_interface_info ());
4589}
4590
4591static void
4592sensor_value_proxy_class_init (SensorValueProxyClass *klass)
4593{
4594 GObjectClass *gobject_class;
4595 GDBusProxyClass *proxy_class;
4596
4597 gobject_class = G_OBJECT_CLASS (klass);
4598 gobject_class->finalize = sensor_value_proxy_finalize;
4599 gobject_class->get_property = sensor_value_proxy_get_property;
4600 gobject_class->set_property = sensor_value_proxy_set_property;
4601
4602 proxy_class = G_DBUS_PROXY_CLASS (klass);
4603 proxy_class->g_signal = sensor_value_proxy_g_signal;
4604 proxy_class->g_properties_changed = sensor_value_proxy_g_properties_changed;
4605
4606 sensor_value_override_properties (gobject_class, 1);
4607
4608#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
4609 g_type_class_add_private (klass, sizeof (SensorValueProxyPrivate));
4610#endif
4611}
4612
4613static void
4614sensor_value_proxy_iface_init (SensorValueIface *iface)
4615{
4616 iface->get_value = sensor_value_proxy_get_value;
4617 iface->get_units = sensor_value_proxy_get_units;
4618 iface->get_poll_interval = sensor_value_proxy_get_poll_interval;
4619 iface->get_heatbeat = sensor_value_proxy_get_heatbeat;
4620 iface->get_settable = sensor_value_proxy_get_settable;
Norman James362a80f2015-09-14 14:04:39 -05004621}
4622
4623/**
4624 * sensor_value_proxy_new:
4625 * @connection: A #GDBusConnection.
4626 * @flags: Flags from the #GDBusProxyFlags enumeration.
4627 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
4628 * @object_path: An object path.
4629 * @cancellable: (allow-none): A #GCancellable or %NULL.
4630 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
4631 * @user_data: User data to pass to @callback.
4632 *
4633 * 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.
4634 *
4635 * 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.
4636 * You can then call sensor_value_proxy_new_finish() to get the result of the operation.
4637 *
4638 * See sensor_value_proxy_new_sync() for the synchronous, blocking version of this constructor.
4639 */
4640void
4641sensor_value_proxy_new (
4642 GDBusConnection *connection,
4643 GDBusProxyFlags flags,
4644 const gchar *name,
4645 const gchar *object_path,
4646 GCancellable *cancellable,
4647 GAsyncReadyCallback callback,
4648 gpointer user_data)
4649{
4650 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);
4651}
4652
4653/**
4654 * sensor_value_proxy_new_finish:
4655 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_proxy_new().
4656 * @error: Return location for error or %NULL
4657 *
4658 * Finishes an operation started with sensor_value_proxy_new().
4659 *
4660 * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set.
4661 */
4662SensorValue *
4663sensor_value_proxy_new_finish (
4664 GAsyncResult *res,
4665 GError **error)
4666{
4667 GObject *ret;
4668 GObject *source_object;
4669 source_object = g_async_result_get_source_object (res);
4670 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
4671 g_object_unref (source_object);
4672 if (ret != NULL)
4673 return SENSOR_VALUE (ret);
4674 else
4675 return NULL;
4676}
4677
4678/**
4679 * sensor_value_proxy_new_sync:
4680 * @connection: A #GDBusConnection.
4681 * @flags: Flags from the #GDBusProxyFlags enumeration.
4682 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
4683 * @object_path: An object path.
4684 * @cancellable: (allow-none): A #GCancellable or %NULL.
4685 * @error: Return location for error or %NULL
4686 *
4687 * 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.
4688 *
4689 * The calling thread is blocked until a reply is received.
4690 *
4691 * See sensor_value_proxy_new() for the asynchronous version of this constructor.
4692 *
4693 * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set.
4694 */
4695SensorValue *
4696sensor_value_proxy_new_sync (
4697 GDBusConnection *connection,
4698 GDBusProxyFlags flags,
4699 const gchar *name,
4700 const gchar *object_path,
4701 GCancellable *cancellable,
4702 GError **error)
4703{
4704 GInitable *ret;
4705 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);
4706 if (ret != NULL)
4707 return SENSOR_VALUE (ret);
4708 else
4709 return NULL;
4710}
4711
4712
4713/**
4714 * sensor_value_proxy_new_for_bus:
4715 * @bus_type: A #GBusType.
4716 * @flags: Flags from the #GDBusProxyFlags enumeration.
4717 * @name: A bus name (well-known or unique).
4718 * @object_path: An object path.
4719 * @cancellable: (allow-none): A #GCancellable or %NULL.
4720 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
4721 * @user_data: User data to pass to @callback.
4722 *
4723 * Like sensor_value_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
4724 *
4725 * 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.
4726 * You can then call sensor_value_proxy_new_for_bus_finish() to get the result of the operation.
4727 *
4728 * See sensor_value_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
4729 */
4730void
4731sensor_value_proxy_new_for_bus (
4732 GBusType bus_type,
4733 GDBusProxyFlags flags,
4734 const gchar *name,
4735 const gchar *object_path,
4736 GCancellable *cancellable,
4737 GAsyncReadyCallback callback,
4738 gpointer user_data)
4739{
4740 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);
4741}
4742
4743/**
4744 * sensor_value_proxy_new_for_bus_finish:
4745 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_proxy_new_for_bus().
4746 * @error: Return location for error or %NULL
4747 *
4748 * Finishes an operation started with sensor_value_proxy_new_for_bus().
4749 *
4750 * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set.
4751 */
4752SensorValue *
4753sensor_value_proxy_new_for_bus_finish (
4754 GAsyncResult *res,
4755 GError **error)
4756{
4757 GObject *ret;
4758 GObject *source_object;
4759 source_object = g_async_result_get_source_object (res);
4760 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
4761 g_object_unref (source_object);
4762 if (ret != NULL)
4763 return SENSOR_VALUE (ret);
4764 else
4765 return NULL;
4766}
4767
4768/**
4769 * sensor_value_proxy_new_for_bus_sync:
4770 * @bus_type: A #GBusType.
4771 * @flags: Flags from the #GDBusProxyFlags enumeration.
4772 * @name: A bus name (well-known or unique).
4773 * @object_path: An object path.
4774 * @cancellable: (allow-none): A #GCancellable or %NULL.
4775 * @error: Return location for error or %NULL
4776 *
4777 * Like sensor_value_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
4778 *
4779 * The calling thread is blocked until a reply is received.
4780 *
4781 * See sensor_value_proxy_new_for_bus() for the asynchronous version of this constructor.
4782 *
4783 * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set.
4784 */
4785SensorValue *
4786sensor_value_proxy_new_for_bus_sync (
4787 GBusType bus_type,
4788 GDBusProxyFlags flags,
4789 const gchar *name,
4790 const gchar *object_path,
4791 GCancellable *cancellable,
4792 GError **error)
4793{
4794 GInitable *ret;
4795 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);
4796 if (ret != NULL)
4797 return SENSOR_VALUE (ret);
4798 else
4799 return NULL;
4800}
4801
4802
4803/* ------------------------------------------------------------------------ */
4804
4805/**
4806 * SensorValueSkeleton:
4807 *
4808 * The #SensorValueSkeleton structure contains only private data and should only be accessed using the provided API.
4809 */
4810
4811/**
4812 * SensorValueSkeletonClass:
4813 * @parent_class: The parent class.
4814 *
4815 * Class structure for #SensorValueSkeleton.
4816 */
4817
4818struct _SensorValueSkeletonPrivate
4819{
4820 GValue *properties;
4821 GList *changed_properties;
4822 GSource *changed_properties_idle_source;
4823 GMainContext *context;
4824 GMutex lock;
4825};
4826
4827static void
4828_sensor_value_skeleton_handle_method_call (
4829 GDBusConnection *connection G_GNUC_UNUSED,
4830 const gchar *sender G_GNUC_UNUSED,
4831 const gchar *object_path G_GNUC_UNUSED,
4832 const gchar *interface_name,
4833 const gchar *method_name,
4834 GVariant *parameters,
4835 GDBusMethodInvocation *invocation,
4836 gpointer user_data)
4837{
4838 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data);
4839 _ExtendedGDBusMethodInfo *info;
4840 GVariantIter iter;
4841 GVariant *child;
4842 GValue *paramv;
4843 guint num_params;
4844 guint num_extra;
4845 guint n;
4846 guint signal_id;
4847 GValue return_value = G_VALUE_INIT;
4848 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
4849 g_assert (info != NULL);
4850 num_params = g_variant_n_children (parameters);
4851 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
4852 n = 0;
4853 g_value_init (&paramv[n], TYPE_SENSOR_VALUE);
4854 g_value_set_object (&paramv[n++], skeleton);
4855 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
4856 g_value_set_object (&paramv[n++], invocation);
4857 if (info->pass_fdlist)
4858 {
4859#ifdef G_OS_UNIX
4860 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
4861 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
4862#else
4863 g_assert_not_reached ();
4864#endif
4865 }
4866 g_variant_iter_init (&iter, parameters);
4867 while ((child = g_variant_iter_next_value (&iter)) != NULL)
4868 {
4869 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
4870 if (arg_info->use_gvariant)
4871 {
4872 g_value_init (&paramv[n], G_TYPE_VARIANT);
4873 g_value_set_variant (&paramv[n], child);
4874 n++;
4875 }
4876 else
4877 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
4878 g_variant_unref (child);
4879 }
4880 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_VALUE);
4881 g_value_init (&return_value, G_TYPE_BOOLEAN);
4882 g_signal_emitv (paramv, signal_id, 0, &return_value);
4883 if (!g_value_get_boolean (&return_value))
4884 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);
4885 g_value_unset (&return_value);
4886 for (n = 0; n < num_params + num_extra; n++)
4887 g_value_unset (&paramv[n]);
4888 g_free (paramv);
4889}
4890
4891static GVariant *
4892_sensor_value_skeleton_handle_get_property (
4893 GDBusConnection *connection G_GNUC_UNUSED,
4894 const gchar *sender G_GNUC_UNUSED,
4895 const gchar *object_path G_GNUC_UNUSED,
4896 const gchar *interface_name G_GNUC_UNUSED,
4897 const gchar *property_name,
4898 GError **error,
4899 gpointer user_data)
4900{
4901 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data);
4902 GValue value = G_VALUE_INIT;
4903 GParamSpec *pspec;
4904 _ExtendedGDBusPropertyInfo *info;
4905 GVariant *ret;
4906 ret = NULL;
4907 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, property_name);
4908 g_assert (info != NULL);
4909 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
4910 if (pspec == NULL)
4911 {
4912 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
4913 }
4914 else
4915 {
4916 g_value_init (&value, pspec->value_type);
4917 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
4918 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
4919 g_value_unset (&value);
4920 }
4921 return ret;
4922}
4923
4924static gboolean
4925_sensor_value_skeleton_handle_set_property (
4926 GDBusConnection *connection G_GNUC_UNUSED,
4927 const gchar *sender G_GNUC_UNUSED,
4928 const gchar *object_path G_GNUC_UNUSED,
4929 const gchar *interface_name G_GNUC_UNUSED,
4930 const gchar *property_name,
4931 GVariant *variant,
4932 GError **error,
4933 gpointer user_data)
4934{
4935 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data);
4936 GValue value = G_VALUE_INIT;
4937 GParamSpec *pspec;
4938 _ExtendedGDBusPropertyInfo *info;
4939 gboolean ret;
4940 ret = FALSE;
4941 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, property_name);
4942 g_assert (info != NULL);
4943 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
4944 if (pspec == NULL)
4945 {
4946 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
4947 }
4948 else
4949 {
4950 if (info->use_gvariant)
4951 g_value_set_variant (&value, variant);
4952 else
4953 g_dbus_gvariant_to_gvalue (variant, &value);
4954 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
4955 g_value_unset (&value);
4956 ret = TRUE;
4957 }
4958 return ret;
4959}
4960
4961static const GDBusInterfaceVTable _sensor_value_skeleton_vtable =
4962{
4963 _sensor_value_skeleton_handle_method_call,
4964 _sensor_value_skeleton_handle_get_property,
4965 _sensor_value_skeleton_handle_set_property,
4966 {NULL}
4967};
4968
4969static GDBusInterfaceInfo *
4970sensor_value_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
4971{
4972 return sensor_value_interface_info ();
4973}
4974
4975static GDBusInterfaceVTable *
4976sensor_value_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
4977{
4978 return (GDBusInterfaceVTable *) &_sensor_value_skeleton_vtable;
4979}
4980
4981static GVariant *
4982sensor_value_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
4983{
4984 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (_skeleton);
4985
4986 GVariantBuilder builder;
4987 guint n;
4988 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
4989 if (_sensor_value_interface_info.parent_struct.properties == NULL)
4990 goto out;
4991 for (n = 0; _sensor_value_interface_info.parent_struct.properties[n] != NULL; n++)
4992 {
4993 GDBusPropertyInfo *info = _sensor_value_interface_info.parent_struct.properties[n];
4994 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
4995 {
4996 GVariant *value;
4997 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);
4998 if (value != NULL)
4999 {
5000 g_variant_take_ref (value);
5001 g_variant_builder_add (&builder, "{sv}", info->name, value);
5002 g_variant_unref (value);
5003 }
5004 }
5005 }
5006out:
5007 return g_variant_builder_end (&builder);
5008}
5009
5010static gboolean _sensor_value_emit_changed (gpointer user_data);
5011
5012static void
5013sensor_value_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
5014{
5015 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (_skeleton);
5016 gboolean emit_changed = FALSE;
5017
5018 g_mutex_lock (&skeleton->priv->lock);
5019 if (skeleton->priv->changed_properties_idle_source != NULL)
5020 {
5021 g_source_destroy (skeleton->priv->changed_properties_idle_source);
5022 skeleton->priv->changed_properties_idle_source = NULL;
5023 emit_changed = TRUE;
5024 }
5025 g_mutex_unlock (&skeleton->priv->lock);
5026
5027 if (emit_changed)
5028 _sensor_value_emit_changed (skeleton);
5029}
5030
5031static void
5032_sensor_value_on_signal_changed (
5033 SensorValue *object,
5034 GVariant *arg_value,
5035 const gchar *arg_units)
5036{
5037 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5038
5039 GList *connections, *l;
5040 GVariant *signal_variant;
5041 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
5042
5043 signal_variant = g_variant_ref_sink (g_variant_new ("(@vs)",
5044 arg_value,
5045 arg_units));
5046 for (l = connections; l != NULL; l = l->next)
5047 {
5048 GDBusConnection *connection = l->data;
5049 g_dbus_connection_emit_signal (connection,
5050 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorValue", "Changed",
5051 signal_variant, NULL);
5052 }
5053 g_variant_unref (signal_variant);
5054 g_list_free_full (connections, g_object_unref);
5055}
5056
5057static void
Norman James32e74e22015-09-15 21:28:06 -05005058_sensor_value_on_signal_error (
5059 SensorValue *object)
5060{
5061 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5062
5063 GList *connections, *l;
5064 GVariant *signal_variant;
5065 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
5066
5067 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
5068 for (l = connections; l != NULL; l = l->next)
5069 {
5070 GDBusConnection *connection = l->data;
5071 g_dbus_connection_emit_signal (connection,
5072 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorValue", "Error",
5073 signal_variant, NULL);
5074 }
5075 g_variant_unref (signal_variant);
5076 g_list_free_full (connections, g_object_unref);
5077}
5078
5079static void
Norman James362a80f2015-09-14 14:04:39 -05005080_sensor_value_on_signal_heartbeat (
5081 SensorValue *object,
5082 const gchar *arg_bus_name)
5083{
5084 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5085
5086 GList *connections, *l;
5087 GVariant *signal_variant;
5088 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
5089
5090 signal_variant = g_variant_ref_sink (g_variant_new ("(s)",
5091 arg_bus_name));
5092 for (l = connections; l != NULL; l = l->next)
5093 {
5094 GDBusConnection *connection = l->data;
5095 g_dbus_connection_emit_signal (connection,
5096 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorValue", "Heartbeat",
5097 signal_variant, NULL);
5098 }
5099 g_variant_unref (signal_variant);
5100 g_list_free_full (connections, g_object_unref);
5101}
5102
5103static void sensor_value_skeleton_iface_init (SensorValueIface *iface);
5104#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
5105G_DEFINE_TYPE_WITH_CODE (SensorValueSkeleton, sensor_value_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
5106 G_ADD_PRIVATE (SensorValueSkeleton)
5107 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_skeleton_iface_init));
5108
5109#else
5110G_DEFINE_TYPE_WITH_CODE (SensorValueSkeleton, sensor_value_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
5111 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_skeleton_iface_init));
5112
5113#endif
5114static void
5115sensor_value_skeleton_finalize (GObject *object)
5116{
5117 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5118 guint n;
Norman Jamesdfdaca92015-09-27 22:11:15 -05005119 for (n = 0; n < 5; n++)
Norman James362a80f2015-09-14 14:04:39 -05005120 g_value_unset (&skeleton->priv->properties[n]);
5121 g_free (skeleton->priv->properties);
5122 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
5123 if (skeleton->priv->changed_properties_idle_source != NULL)
5124 g_source_destroy (skeleton->priv->changed_properties_idle_source);
5125 g_main_context_unref (skeleton->priv->context);
5126 g_mutex_clear (&skeleton->priv->lock);
5127 G_OBJECT_CLASS (sensor_value_skeleton_parent_class)->finalize (object);
5128}
5129
5130static void
5131sensor_value_skeleton_get_property (GObject *object,
5132 guint prop_id,
5133 GValue *value,
5134 GParamSpec *pspec G_GNUC_UNUSED)
5135{
5136 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
Norman Jamesdfdaca92015-09-27 22:11:15 -05005137 g_assert (prop_id != 0 && prop_id - 1 < 5);
Norman James362a80f2015-09-14 14:04:39 -05005138 g_mutex_lock (&skeleton->priv->lock);
5139 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
5140 g_mutex_unlock (&skeleton->priv->lock);
5141}
5142
5143static gboolean
5144_sensor_value_emit_changed (gpointer user_data)
5145{
5146 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data);
5147 GList *l;
5148 GVariantBuilder builder;
5149 GVariantBuilder invalidated_builder;
5150 guint num_changes;
5151
5152 g_mutex_lock (&skeleton->priv->lock);
5153 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
5154 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
5155 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
5156 {
5157 ChangedProperty *cp = l->data;
5158 GVariant *variant;
5159 const GValue *cur_value;
5160
5161 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
5162 if (!_g_value_equal (cur_value, &cp->orig_value))
5163 {
5164 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
5165 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
5166 g_variant_unref (variant);
5167 num_changes++;
5168 }
5169 }
5170 if (num_changes > 0)
5171 {
5172 GList *connections, *ll;
5173 GVariant *signal_variant;
5174 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorValue",
5175 &builder, &invalidated_builder));
5176 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
5177 for (ll = connections; ll != NULL; ll = ll->next)
5178 {
5179 GDBusConnection *connection = ll->data;
5180
5181 g_dbus_connection_emit_signal (connection,
5182 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
5183 "org.freedesktop.DBus.Properties",
5184 "PropertiesChanged",
5185 signal_variant,
5186 NULL);
5187 }
5188 g_variant_unref (signal_variant);
5189 g_list_free_full (connections, g_object_unref);
5190 }
5191 else
5192 {
5193 g_variant_builder_clear (&builder);
5194 g_variant_builder_clear (&invalidated_builder);
5195 }
5196 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
5197 skeleton->priv->changed_properties = NULL;
5198 skeleton->priv->changed_properties_idle_source = NULL;
5199 g_mutex_unlock (&skeleton->priv->lock);
5200 return FALSE;
5201}
5202
5203static void
5204_sensor_value_schedule_emit_changed (SensorValueSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
5205{
5206 ChangedProperty *cp;
5207 GList *l;
5208 cp = NULL;
5209 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
5210 {
5211 ChangedProperty *i_cp = l->data;
5212 if (i_cp->info == info)
5213 {
5214 cp = i_cp;
5215 break;
5216 }
5217 }
5218 if (cp == NULL)
5219 {
5220 cp = g_new0 (ChangedProperty, 1);
5221 cp->prop_id = prop_id;
5222 cp->info = info;
5223 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
5224 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
5225 g_value_copy (orig_value, &cp->orig_value);
5226 }
5227}
5228
5229static void
5230sensor_value_skeleton_notify (GObject *object,
5231 GParamSpec *pspec G_GNUC_UNUSED)
5232{
5233 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5234 g_mutex_lock (&skeleton->priv->lock);
5235 if (skeleton->priv->changed_properties != NULL &&
5236 skeleton->priv->changed_properties_idle_source == NULL)
5237 {
5238 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
5239 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
5240 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_value_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
5241 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
5242 g_source_unref (skeleton->priv->changed_properties_idle_source);
5243 }
5244 g_mutex_unlock (&skeleton->priv->lock);
5245}
5246
5247static void
5248sensor_value_skeleton_set_property (GObject *object,
5249 guint prop_id,
5250 const GValue *value,
5251 GParamSpec *pspec)
5252{
5253 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
Norman Jamesdfdaca92015-09-27 22:11:15 -05005254 g_assert (prop_id != 0 && prop_id - 1 < 5);
Norman James362a80f2015-09-14 14:04:39 -05005255 g_mutex_lock (&skeleton->priv->lock);
5256 g_object_freeze_notify (object);
5257 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
5258 {
5259 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
5260 _sensor_value_schedule_emit_changed (skeleton, _sensor_value_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
5261 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
5262 g_object_notify_by_pspec (object, pspec);
5263 }
5264 g_mutex_unlock (&skeleton->priv->lock);
5265 g_object_thaw_notify (object);
5266}
5267
5268static void
5269sensor_value_skeleton_init (SensorValueSkeleton *skeleton)
5270{
5271#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
5272 skeleton->priv = sensor_value_skeleton_get_instance_private (skeleton);
5273#else
5274 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_VALUE_SKELETON, SensorValueSkeletonPrivate);
5275#endif
5276
5277 g_mutex_init (&skeleton->priv->lock);
5278 skeleton->priv->context = g_main_context_ref_thread_default ();
Norman Jamesdfdaca92015-09-27 22:11:15 -05005279 skeleton->priv->properties = g_new0 (GValue, 5);
Norman James362a80f2015-09-14 14:04:39 -05005280 g_value_init (&skeleton->priv->properties[0], G_TYPE_VARIANT);
5281 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
5282 g_value_init (&skeleton->priv->properties[2], G_TYPE_INT);
5283 g_value_init (&skeleton->priv->properties[3], G_TYPE_INT);
5284 g_value_init (&skeleton->priv->properties[4], G_TYPE_BOOLEAN);
Norman James362a80f2015-09-14 14:04:39 -05005285}
5286
5287static GVariant *
5288sensor_value_skeleton_get_value (SensorValue *object)
5289{
5290 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5291 GVariant *value;
5292 g_mutex_lock (&skeleton->priv->lock);
5293 value = g_value_get_variant (&(skeleton->priv->properties[0]));
5294 g_mutex_unlock (&skeleton->priv->lock);
5295 return value;
5296}
5297
5298static const gchar *
5299sensor_value_skeleton_get_units (SensorValue *object)
5300{
5301 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5302 const gchar *value;
5303 g_mutex_lock (&skeleton->priv->lock);
5304 value = g_value_get_string (&(skeleton->priv->properties[1]));
5305 g_mutex_unlock (&skeleton->priv->lock);
5306 return value;
5307}
5308
5309static gint
5310sensor_value_skeleton_get_poll_interval (SensorValue *object)
5311{
5312 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5313 gint value;
5314 g_mutex_lock (&skeleton->priv->lock);
5315 value = g_value_get_int (&(skeleton->priv->properties[2]));
5316 g_mutex_unlock (&skeleton->priv->lock);
5317 return value;
5318}
5319
5320static gint
5321sensor_value_skeleton_get_heatbeat (SensorValue *object)
5322{
5323 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5324 gint value;
5325 g_mutex_lock (&skeleton->priv->lock);
5326 value = g_value_get_int (&(skeleton->priv->properties[3]));
5327 g_mutex_unlock (&skeleton->priv->lock);
5328 return value;
5329}
5330
5331static gboolean
5332sensor_value_skeleton_get_settable (SensorValue *object)
5333{
5334 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5335 gboolean value;
5336 g_mutex_lock (&skeleton->priv->lock);
5337 value = g_value_get_boolean (&(skeleton->priv->properties[4]));
5338 g_mutex_unlock (&skeleton->priv->lock);
5339 return value;
5340}
5341
Norman James362a80f2015-09-14 14:04:39 -05005342static void
5343sensor_value_skeleton_class_init (SensorValueSkeletonClass *klass)
5344{
5345 GObjectClass *gobject_class;
5346 GDBusInterfaceSkeletonClass *skeleton_class;
5347
5348 gobject_class = G_OBJECT_CLASS (klass);
5349 gobject_class->finalize = sensor_value_skeleton_finalize;
5350 gobject_class->get_property = sensor_value_skeleton_get_property;
5351 gobject_class->set_property = sensor_value_skeleton_set_property;
5352 gobject_class->notify = sensor_value_skeleton_notify;
5353
5354
5355 sensor_value_override_properties (gobject_class, 1);
5356
5357 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
5358 skeleton_class->get_info = sensor_value_skeleton_dbus_interface_get_info;
5359 skeleton_class->get_properties = sensor_value_skeleton_dbus_interface_get_properties;
5360 skeleton_class->flush = sensor_value_skeleton_dbus_interface_flush;
5361 skeleton_class->get_vtable = sensor_value_skeleton_dbus_interface_get_vtable;
5362
5363#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
5364 g_type_class_add_private (klass, sizeof (SensorValueSkeletonPrivate));
5365#endif
5366}
5367
5368static void
5369sensor_value_skeleton_iface_init (SensorValueIface *iface)
5370{
5371 iface->changed = _sensor_value_on_signal_changed;
Norman James32e74e22015-09-15 21:28:06 -05005372 iface->error = _sensor_value_on_signal_error;
Norman James362a80f2015-09-14 14:04:39 -05005373 iface->heartbeat = _sensor_value_on_signal_heartbeat;
5374 iface->get_value = sensor_value_skeleton_get_value;
5375 iface->get_units = sensor_value_skeleton_get_units;
5376 iface->get_poll_interval = sensor_value_skeleton_get_poll_interval;
5377 iface->get_heatbeat = sensor_value_skeleton_get_heatbeat;
5378 iface->get_settable = sensor_value_skeleton_get_settable;
Norman James362a80f2015-09-14 14:04:39 -05005379}
5380
5381/**
5382 * sensor_value_skeleton_new:
5383 *
5384 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link>.
5385 *
5386 * Returns: (transfer full) (type SensorValueSkeleton): The skeleton object.
5387 */
5388SensorValue *
5389sensor_value_skeleton_new (void)
5390{
5391 return SENSOR_VALUE (g_object_new (TYPE_SENSOR_VALUE_SKELETON, NULL));
5392}
5393
5394/* ------------------------------------------------------------------------
5395 * Code for interface org.openbmc.SensorThreshold
5396 * ------------------------------------------------------------------------
5397 */
5398
5399/**
5400 * SECTION:SensorThreshold
5401 * @title: SensorThreshold
5402 * @short_description: Generated C code for the org.openbmc.SensorThreshold D-Bus interface
5403 *
5404 * 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.
5405 */
5406
5407/* ---- Introspection data for org.openbmc.SensorThreshold ---- */
5408
5409static const _ExtendedGDBusArgInfo _sensor_threshold_method_info_get_state_OUT_ARG_state =
5410{
5411 {
5412 -1,
5413 (gchar *) "state",
5414 (gchar *) "y",
5415 NULL
5416 },
5417 FALSE
5418};
5419
5420static const _ExtendedGDBusArgInfo * const _sensor_threshold_method_info_get_state_OUT_ARG_pointers[] =
5421{
5422 &_sensor_threshold_method_info_get_state_OUT_ARG_state,
5423 NULL
5424};
5425
5426static const _ExtendedGDBusMethodInfo _sensor_threshold_method_info_get_state =
5427{
5428 {
5429 -1,
5430 (gchar *) "getState",
5431 NULL,
5432 (GDBusArgInfo **) &_sensor_threshold_method_info_get_state_OUT_ARG_pointers,
5433 NULL
5434 },
5435 "handle-get-state",
5436 FALSE
5437};
5438
5439static const _ExtendedGDBusMethodInfo * const _sensor_threshold_method_info_pointers[] =
5440{
5441 &_sensor_threshold_method_info_get_state,
5442 NULL
5443};
5444
5445static const _ExtendedGDBusSignalInfo _sensor_threshold_signal_info_warning =
5446{
5447 {
5448 -1,
5449 (gchar *) "Warning",
5450 NULL,
5451 NULL
5452 },
5453 "warning"
5454};
5455
5456static const _ExtendedGDBusSignalInfo _sensor_threshold_signal_info_critical =
5457{
5458 {
5459 -1,
5460 (gchar *) "Critical",
5461 NULL,
5462 NULL
5463 },
5464 "critical"
5465};
5466
5467static const _ExtendedGDBusSignalInfo _sensor_threshold_signal_info_normal =
5468{
5469 {
5470 -1,
5471 (gchar *) "Normal",
5472 NULL,
5473 NULL
5474 },
5475 "normal"
5476};
5477
5478static const _ExtendedGDBusSignalInfo * const _sensor_threshold_signal_info_pointers[] =
5479{
5480 &_sensor_threshold_signal_info_warning,
5481 &_sensor_threshold_signal_info_critical,
5482 &_sensor_threshold_signal_info_normal,
5483 NULL
5484};
5485
5486static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_lower_critical =
5487{
5488 {
5489 -1,
5490 (gchar *) "lower_critical",
5491 (gchar *) "v",
5492 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
5493 NULL
5494 },
5495 "lower-critical",
5496 FALSE
5497};
5498
5499static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_lower_warning =
5500{
5501 {
5502 -1,
5503 (gchar *) "lower_warning",
5504 (gchar *) "v",
5505 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
5506 NULL
5507 },
5508 "lower-warning",
5509 FALSE
5510};
5511
5512static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_upper_warning =
5513{
5514 {
5515 -1,
5516 (gchar *) "upper_warning",
5517 (gchar *) "v",
5518 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
5519 NULL
5520 },
5521 "upper-warning",
5522 FALSE
5523};
5524
5525static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_upper_critical =
5526{
5527 {
5528 -1,
5529 (gchar *) "upper_critical",
5530 (gchar *) "v",
5531 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
5532 NULL
5533 },
5534 "upper-critical",
5535 FALSE
5536};
5537
5538static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_state =
5539{
5540 {
5541 -1,
5542 (gchar *) "state",
5543 (gchar *) "y",
5544 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
5545 NULL
5546 },
5547 "state",
5548 FALSE
5549};
5550
5551static const _ExtendedGDBusPropertyInfo * const _sensor_threshold_property_info_pointers[] =
5552{
5553 &_sensor_threshold_property_info_lower_critical,
5554 &_sensor_threshold_property_info_lower_warning,
5555 &_sensor_threshold_property_info_upper_warning,
5556 &_sensor_threshold_property_info_upper_critical,
5557 &_sensor_threshold_property_info_state,
5558 NULL
5559};
5560
5561static const _ExtendedGDBusInterfaceInfo _sensor_threshold_interface_info =
5562{
5563 {
5564 -1,
5565 (gchar *) "org.openbmc.SensorThreshold",
5566 (GDBusMethodInfo **) &_sensor_threshold_method_info_pointers,
5567 (GDBusSignalInfo **) &_sensor_threshold_signal_info_pointers,
5568 (GDBusPropertyInfo **) &_sensor_threshold_property_info_pointers,
5569 NULL
5570 },
5571 "sensor-threshold",
5572};
5573
5574
5575/**
5576 * sensor_threshold_interface_info:
5577 *
5578 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link> D-Bus interface.
5579 *
5580 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
5581 */
5582GDBusInterfaceInfo *
5583sensor_threshold_interface_info (void)
5584{
5585 return (GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct;
5586}
5587
5588/**
5589 * sensor_threshold_override_properties:
5590 * @klass: The class structure for a #GObject<!-- -->-derived class.
5591 * @property_id_begin: The property id to assign to the first overridden property.
5592 *
5593 * Overrides all #GObject properties in the #SensorThreshold interface for a concrete class.
5594 * The properties are overridden in the order they are defined.
5595 *
5596 * Returns: The last property id.
5597 */
5598guint
5599sensor_threshold_override_properties (GObjectClass *klass, guint property_id_begin)
5600{
5601 g_object_class_override_property (klass, property_id_begin++, "lower-critical");
5602 g_object_class_override_property (klass, property_id_begin++, "lower-warning");
5603 g_object_class_override_property (klass, property_id_begin++, "upper-warning");
5604 g_object_class_override_property (klass, property_id_begin++, "upper-critical");
5605 g_object_class_override_property (klass, property_id_begin++, "state");
5606 return property_id_begin - 1;
5607}
5608
5609
5610
5611/**
5612 * SensorThreshold:
5613 *
5614 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link>.
5615 */
5616
5617/**
5618 * SensorThresholdIface:
5619 * @parent_iface: The parent interface.
5620 * @handle_get_state: Handler for the #SensorThreshold::handle-get-state signal.
5621 * @get_lower_critical: Getter for the #SensorThreshold:lower-critical property.
5622 * @get_lower_warning: Getter for the #SensorThreshold:lower-warning property.
5623 * @get_state: Getter for the #SensorThreshold:state property.
5624 * @get_upper_critical: Getter for the #SensorThreshold:upper-critical property.
5625 * @get_upper_warning: Getter for the #SensorThreshold:upper-warning property.
5626 * @critical: Handler for the #SensorThreshold::critical signal.
5627 * @normal: Handler for the #SensorThreshold::normal signal.
5628 * @warning: Handler for the #SensorThreshold::warning signal.
5629 *
5630 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link>.
5631 */
5632
5633typedef SensorThresholdIface SensorThresholdInterface;
5634G_DEFINE_INTERFACE (SensorThreshold, sensor_threshold, G_TYPE_OBJECT);
5635
5636static void
5637sensor_threshold_default_init (SensorThresholdIface *iface)
5638{
5639 /* GObject signals for incoming D-Bus method calls: */
5640 /**
5641 * SensorThreshold::handle-get-state:
5642 * @object: A #SensorThreshold.
5643 * @invocation: A #GDBusMethodInvocation.
5644 *
5645 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorThreshold.getState">getState()</link> D-Bus method.
5646 *
5647 * 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.
5648 *
5649 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
5650 */
5651 g_signal_new ("handle-get-state",
5652 G_TYPE_FROM_INTERFACE (iface),
5653 G_SIGNAL_RUN_LAST,
5654 G_STRUCT_OFFSET (SensorThresholdIface, handle_get_state),
5655 g_signal_accumulator_true_handled,
5656 NULL,
5657 g_cclosure_marshal_generic,
5658 G_TYPE_BOOLEAN,
5659 1,
5660 G_TYPE_DBUS_METHOD_INVOCATION);
5661
5662 /* GObject signals for received D-Bus signals: */
5663 /**
5664 * SensorThreshold::warning:
5665 * @object: A #SensorThreshold.
5666 *
5667 * 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.
5668 *
5669 * 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.
5670 */
5671 g_signal_new ("warning",
5672 G_TYPE_FROM_INTERFACE (iface),
5673 G_SIGNAL_RUN_LAST,
5674 G_STRUCT_OFFSET (SensorThresholdIface, warning),
5675 NULL,
5676 NULL,
5677 g_cclosure_marshal_generic,
5678 G_TYPE_NONE,
5679 0);
5680
5681 /**
5682 * SensorThreshold::critical:
5683 * @object: A #SensorThreshold.
5684 *
5685 * 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.
5686 *
5687 * 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.
5688 */
5689 g_signal_new ("critical",
5690 G_TYPE_FROM_INTERFACE (iface),
5691 G_SIGNAL_RUN_LAST,
5692 G_STRUCT_OFFSET (SensorThresholdIface, critical),
5693 NULL,
5694 NULL,
5695 g_cclosure_marshal_generic,
5696 G_TYPE_NONE,
5697 0);
5698
5699 /**
5700 * SensorThreshold::normal:
5701 * @object: A #SensorThreshold.
5702 *
5703 * 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.
5704 *
5705 * 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.
5706 */
5707 g_signal_new ("normal",
5708 G_TYPE_FROM_INTERFACE (iface),
5709 G_SIGNAL_RUN_LAST,
5710 G_STRUCT_OFFSET (SensorThresholdIface, normal),
5711 NULL,
5712 NULL,
5713 g_cclosure_marshal_generic,
5714 G_TYPE_NONE,
5715 0);
5716
5717 /* GObject properties for D-Bus properties: */
5718 /**
5719 * SensorThreshold:lower-critical:
5720 *
5721 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link>.
5722 *
5723 * 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.
5724 */
5725 g_object_interface_install_property (iface,
5726 g_param_spec_variant ("lower-critical", "lower_critical", "lower_critical", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
5727 /**
5728 * SensorThreshold:lower-warning:
5729 *
5730 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link>.
5731 *
5732 * 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.
5733 */
5734 g_object_interface_install_property (iface,
5735 g_param_spec_variant ("lower-warning", "lower_warning", "lower_warning", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
5736 /**
5737 * SensorThreshold:upper-warning:
5738 *
5739 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link>.
5740 *
5741 * 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.
5742 */
5743 g_object_interface_install_property (iface,
5744 g_param_spec_variant ("upper-warning", "upper_warning", "upper_warning", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
5745 /**
5746 * SensorThreshold:upper-critical:
5747 *
5748 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link>.
5749 *
5750 * 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.
5751 */
5752 g_object_interface_install_property (iface,
5753 g_param_spec_variant ("upper-critical", "upper_critical", "upper_critical", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
5754 /**
5755 * SensorThreshold:state:
5756 *
5757 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.state">"state"</link>.
5758 *
5759 * 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.
5760 */
5761 g_object_interface_install_property (iface,
5762 g_param_spec_uchar ("state", "state", "state", 0, 255, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
5763}
5764
5765/**
5766 * sensor_threshold_get_lower_critical: (skip)
5767 * @object: A #SensorThreshold.
5768 *
5769 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link> D-Bus property.
5770 *
5771 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
5772 *
5773 * <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>
5774 *
5775 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
5776 */
5777GVariant *
5778sensor_threshold_get_lower_critical (SensorThreshold *object)
5779{
5780 return SENSOR_THRESHOLD_GET_IFACE (object)->get_lower_critical (object);
5781}
5782
5783/**
5784 * sensor_threshold_dup_lower_critical: (skip)
5785 * @object: A #SensorThreshold.
5786 *
5787 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link> D-Bus property.
5788 *
5789 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
5790 *
5791 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
5792 */
5793GVariant *
5794sensor_threshold_dup_lower_critical (SensorThreshold *object)
5795{
5796 GVariant *value;
5797 g_object_get (G_OBJECT (object), "lower-critical", &value, NULL);
5798 return value;
5799}
5800
5801/**
5802 * sensor_threshold_set_lower_critical: (skip)
5803 * @object: A #SensorThreshold.
5804 * @value: The value to set.
5805 *
5806 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link> D-Bus property to @value.
5807 *
5808 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
5809 */
5810void
5811sensor_threshold_set_lower_critical (SensorThreshold *object, GVariant *value)
5812{
5813 g_object_set (G_OBJECT (object), "lower-critical", value, NULL);
5814}
5815
5816/**
5817 * sensor_threshold_get_lower_warning: (skip)
5818 * @object: A #SensorThreshold.
5819 *
5820 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link> D-Bus property.
5821 *
5822 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
5823 *
5824 * <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>
5825 *
5826 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
5827 */
5828GVariant *
5829sensor_threshold_get_lower_warning (SensorThreshold *object)
5830{
5831 return SENSOR_THRESHOLD_GET_IFACE (object)->get_lower_warning (object);
5832}
5833
5834/**
5835 * sensor_threshold_dup_lower_warning: (skip)
5836 * @object: A #SensorThreshold.
5837 *
5838 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link> D-Bus property.
5839 *
5840 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
5841 *
5842 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
5843 */
5844GVariant *
5845sensor_threshold_dup_lower_warning (SensorThreshold *object)
5846{
5847 GVariant *value;
5848 g_object_get (G_OBJECT (object), "lower-warning", &value, NULL);
5849 return value;
5850}
5851
5852/**
5853 * sensor_threshold_set_lower_warning: (skip)
5854 * @object: A #SensorThreshold.
5855 * @value: The value to set.
5856 *
5857 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link> D-Bus property to @value.
5858 *
5859 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
5860 */
5861void
5862sensor_threshold_set_lower_warning (SensorThreshold *object, GVariant *value)
5863{
5864 g_object_set (G_OBJECT (object), "lower-warning", value, NULL);
5865}
5866
5867/**
5868 * sensor_threshold_get_upper_warning: (skip)
5869 * @object: A #SensorThreshold.
5870 *
5871 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link> D-Bus property.
5872 *
5873 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
5874 *
5875 * <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>
5876 *
5877 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
5878 */
5879GVariant *
5880sensor_threshold_get_upper_warning (SensorThreshold *object)
5881{
5882 return SENSOR_THRESHOLD_GET_IFACE (object)->get_upper_warning (object);
5883}
5884
5885/**
5886 * sensor_threshold_dup_upper_warning: (skip)
5887 * @object: A #SensorThreshold.
5888 *
5889 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link> D-Bus property.
5890 *
5891 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
5892 *
5893 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
5894 */
5895GVariant *
5896sensor_threshold_dup_upper_warning (SensorThreshold *object)
5897{
5898 GVariant *value;
5899 g_object_get (G_OBJECT (object), "upper-warning", &value, NULL);
5900 return value;
5901}
5902
5903/**
5904 * sensor_threshold_set_upper_warning: (skip)
5905 * @object: A #SensorThreshold.
5906 * @value: The value to set.
5907 *
5908 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link> D-Bus property to @value.
5909 *
5910 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
5911 */
5912void
5913sensor_threshold_set_upper_warning (SensorThreshold *object, GVariant *value)
5914{
5915 g_object_set (G_OBJECT (object), "upper-warning", value, NULL);
5916}
5917
5918/**
5919 * sensor_threshold_get_upper_critical: (skip)
5920 * @object: A #SensorThreshold.
5921 *
5922 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link> D-Bus property.
5923 *
5924 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
5925 *
5926 * <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>
5927 *
5928 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
5929 */
5930GVariant *
5931sensor_threshold_get_upper_critical (SensorThreshold *object)
5932{
5933 return SENSOR_THRESHOLD_GET_IFACE (object)->get_upper_critical (object);
5934}
5935
5936/**
5937 * sensor_threshold_dup_upper_critical: (skip)
5938 * @object: A #SensorThreshold.
5939 *
5940 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link> D-Bus property.
5941 *
5942 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
5943 *
5944 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
5945 */
5946GVariant *
5947sensor_threshold_dup_upper_critical (SensorThreshold *object)
5948{
5949 GVariant *value;
5950 g_object_get (G_OBJECT (object), "upper-critical", &value, NULL);
5951 return value;
5952}
5953
5954/**
5955 * sensor_threshold_set_upper_critical: (skip)
5956 * @object: A #SensorThreshold.
5957 * @value: The value to set.
5958 *
5959 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link> D-Bus property to @value.
5960 *
5961 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
5962 */
5963void
5964sensor_threshold_set_upper_critical (SensorThreshold *object, GVariant *value)
5965{
5966 g_object_set (G_OBJECT (object), "upper-critical", value, NULL);
5967}
5968
5969/**
5970 * sensor_threshold_get_state: (skip)
5971 * @object: A #SensorThreshold.
5972 *
5973 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.state">"state"</link> D-Bus property.
5974 *
5975 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
5976 *
5977 * Returns: The property value.
5978 */
5979guchar
5980sensor_threshold_get_state (SensorThreshold *object)
5981{
5982 return SENSOR_THRESHOLD_GET_IFACE (object)->get_state (object);
5983}
5984
5985/**
5986 * sensor_threshold_set_state: (skip)
5987 * @object: A #SensorThreshold.
5988 * @value: The value to set.
5989 *
5990 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.state">"state"</link> D-Bus property to @value.
5991 *
5992 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
5993 */
5994void
5995sensor_threshold_set_state (SensorThreshold *object, guchar value)
5996{
5997 g_object_set (G_OBJECT (object), "state", value, NULL);
5998}
5999
6000/**
6001 * sensor_threshold_emit_warning:
6002 * @object: A #SensorThreshold.
6003 *
6004 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorThreshold.Warning">"Warning"</link> D-Bus signal.
6005 */
6006void
6007sensor_threshold_emit_warning (
6008 SensorThreshold *object)
6009{
6010 g_signal_emit_by_name (object, "warning");
6011}
6012
6013/**
6014 * sensor_threshold_emit_critical:
6015 * @object: A #SensorThreshold.
6016 *
6017 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorThreshold.Critical">"Critical"</link> D-Bus signal.
6018 */
6019void
6020sensor_threshold_emit_critical (
6021 SensorThreshold *object)
6022{
6023 g_signal_emit_by_name (object, "critical");
6024}
6025
6026/**
6027 * sensor_threshold_emit_normal:
6028 * @object: A #SensorThreshold.
6029 *
6030 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorThreshold.Normal">"Normal"</link> D-Bus signal.
6031 */
6032void
6033sensor_threshold_emit_normal (
6034 SensorThreshold *object)
6035{
6036 g_signal_emit_by_name (object, "normal");
6037}
6038
6039/**
6040 * sensor_threshold_call_get_state:
6041 * @proxy: A #SensorThresholdProxy.
6042 * @cancellable: (allow-none): A #GCancellable or %NULL.
6043 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
6044 * @user_data: User data to pass to @callback.
6045 *
6046 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorThreshold.getState">getState()</link> D-Bus method on @proxy.
6047 * 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.
6048 * You can then call sensor_threshold_call_get_state_finish() to get the result of the operation.
6049 *
6050 * See sensor_threshold_call_get_state_sync() for the synchronous, blocking version of this method.
6051 */
6052void
6053sensor_threshold_call_get_state (
6054 SensorThreshold *proxy,
6055 GCancellable *cancellable,
6056 GAsyncReadyCallback callback,
6057 gpointer user_data)
6058{
6059 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
6060 "getState",
6061 g_variant_new ("()"),
6062 G_DBUS_CALL_FLAGS_NONE,
6063 -1,
6064 cancellable,
6065 callback,
6066 user_data);
6067}
6068
6069/**
6070 * sensor_threshold_call_get_state_finish:
6071 * @proxy: A #SensorThresholdProxy.
6072 * @out_state: (out): Return location for return parameter or %NULL to ignore.
6073 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_threshold_call_get_state().
6074 * @error: Return location for error or %NULL.
6075 *
6076 * Finishes an operation started with sensor_threshold_call_get_state().
6077 *
6078 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
6079 */
6080gboolean
6081sensor_threshold_call_get_state_finish (
6082 SensorThreshold *proxy,
6083 guchar *out_state,
6084 GAsyncResult *res,
6085 GError **error)
6086{
6087 GVariant *_ret;
6088 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
6089 if (_ret == NULL)
6090 goto _out;
6091 g_variant_get (_ret,
6092 "(y)",
6093 out_state);
6094 g_variant_unref (_ret);
6095_out:
6096 return _ret != NULL;
6097}
6098
6099/**
6100 * sensor_threshold_call_get_state_sync:
6101 * @proxy: A #SensorThresholdProxy.
6102 * @out_state: (out): Return location for return parameter or %NULL to ignore.
6103 * @cancellable: (allow-none): A #GCancellable or %NULL.
6104 * @error: Return location for error or %NULL.
6105 *
6106 * 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.
6107 *
6108 * See sensor_threshold_call_get_state() for the asynchronous version of this method.
6109 *
6110 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
6111 */
6112gboolean
6113sensor_threshold_call_get_state_sync (
6114 SensorThreshold *proxy,
6115 guchar *out_state,
6116 GCancellable *cancellable,
6117 GError **error)
6118{
6119 GVariant *_ret;
6120 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
6121 "getState",
6122 g_variant_new ("()"),
6123 G_DBUS_CALL_FLAGS_NONE,
6124 -1,
6125 cancellable,
6126 error);
6127 if (_ret == NULL)
6128 goto _out;
6129 g_variant_get (_ret,
6130 "(y)",
6131 out_state);
6132 g_variant_unref (_ret);
6133_out:
6134 return _ret != NULL;
6135}
6136
6137/**
6138 * sensor_threshold_complete_get_state:
6139 * @object: A #SensorThreshold.
6140 * @invocation: (transfer full): A #GDBusMethodInvocation.
6141 * @state: Parameter to return.
6142 *
6143 * 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.
6144 *
6145 * This method will free @invocation, you cannot use it afterwards.
6146 */
6147void
6148sensor_threshold_complete_get_state (
6149 SensorThreshold *object,
6150 GDBusMethodInvocation *invocation,
6151 guchar state)
6152{
6153 g_dbus_method_invocation_return_value (invocation,
6154 g_variant_new ("(y)",
6155 state));
6156}
6157
6158/* ------------------------------------------------------------------------ */
6159
6160/**
6161 * SensorThresholdProxy:
6162 *
6163 * The #SensorThresholdProxy structure contains only private data and should only be accessed using the provided API.
6164 */
6165
6166/**
6167 * SensorThresholdProxyClass:
6168 * @parent_class: The parent class.
6169 *
6170 * Class structure for #SensorThresholdProxy.
6171 */
6172
6173struct _SensorThresholdProxyPrivate
6174{
6175 GData *qdata;
6176};
6177
6178static void sensor_threshold_proxy_iface_init (SensorThresholdIface *iface);
6179
6180#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
6181G_DEFINE_TYPE_WITH_CODE (SensorThresholdProxy, sensor_threshold_proxy, G_TYPE_DBUS_PROXY,
6182 G_ADD_PRIVATE (SensorThresholdProxy)
6183 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_proxy_iface_init));
6184
6185#else
6186G_DEFINE_TYPE_WITH_CODE (SensorThresholdProxy, sensor_threshold_proxy, G_TYPE_DBUS_PROXY,
6187 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_proxy_iface_init));
6188
6189#endif
6190static void
6191sensor_threshold_proxy_finalize (GObject *object)
6192{
6193 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
6194 g_datalist_clear (&proxy->priv->qdata);
6195 G_OBJECT_CLASS (sensor_threshold_proxy_parent_class)->finalize (object);
6196}
6197
6198static void
6199sensor_threshold_proxy_get_property (GObject *object,
6200 guint prop_id,
6201 GValue *value,
6202 GParamSpec *pspec G_GNUC_UNUSED)
6203{
6204 const _ExtendedGDBusPropertyInfo *info;
6205 GVariant *variant;
6206 g_assert (prop_id != 0 && prop_id - 1 < 5);
6207 info = _sensor_threshold_property_info_pointers[prop_id - 1];
6208 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
6209 if (info->use_gvariant)
6210 {
6211 g_value_set_variant (value, variant);
6212 }
6213 else
6214 {
6215 if (variant != NULL)
6216 g_dbus_gvariant_to_gvalue (variant, value);
6217 }
6218 if (variant != NULL)
6219 g_variant_unref (variant);
6220}
6221
6222static void
6223sensor_threshold_proxy_set_property_cb (GDBusProxy *proxy,
6224 GAsyncResult *res,
6225 gpointer user_data)
6226{
6227 const _ExtendedGDBusPropertyInfo *info = user_data;
6228 GError *error;
6229 GVariant *_ret;
6230 error = NULL;
6231 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
6232 if (!_ret)
6233 {
6234 g_warning ("Error setting property '%s' on interface org.openbmc.SensorThreshold: %s (%s, %d)",
6235 info->parent_struct.name,
6236 error->message, g_quark_to_string (error->domain), error->code);
6237 g_error_free (error);
6238 }
6239 else
6240 {
6241 g_variant_unref (_ret);
6242 }
6243}
6244
6245static void
6246sensor_threshold_proxy_set_property (GObject *object,
6247 guint prop_id,
6248 const GValue *value,
6249 GParamSpec *pspec G_GNUC_UNUSED)
6250{
6251 const _ExtendedGDBusPropertyInfo *info;
6252 GVariant *variant;
6253 g_assert (prop_id != 0 && prop_id - 1 < 5);
6254 info = _sensor_threshold_property_info_pointers[prop_id - 1];
6255 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
6256 g_dbus_proxy_call (G_DBUS_PROXY (object),
6257 "org.freedesktop.DBus.Properties.Set",
6258 g_variant_new ("(ssv)", "org.openbmc.SensorThreshold", info->parent_struct.name, variant),
6259 G_DBUS_CALL_FLAGS_NONE,
6260 -1,
6261 NULL, (GAsyncReadyCallback) sensor_threshold_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
6262 g_variant_unref (variant);
6263}
6264
6265static void
6266sensor_threshold_proxy_g_signal (GDBusProxy *proxy,
6267 const gchar *sender_name G_GNUC_UNUSED,
6268 const gchar *signal_name,
6269 GVariant *parameters)
6270{
6271 _ExtendedGDBusSignalInfo *info;
6272 GVariantIter iter;
6273 GVariant *child;
6274 GValue *paramv;
6275 guint num_params;
6276 guint n;
6277 guint signal_id;
6278 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, signal_name);
6279 if (info == NULL)
6280 return;
6281 num_params = g_variant_n_children (parameters);
6282 paramv = g_new0 (GValue, num_params + 1);
6283 g_value_init (&paramv[0], TYPE_SENSOR_THRESHOLD);
6284 g_value_set_object (&paramv[0], proxy);
6285 g_variant_iter_init (&iter, parameters);
6286 n = 1;
6287 while ((child = g_variant_iter_next_value (&iter)) != NULL)
6288 {
6289 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
6290 if (arg_info->use_gvariant)
6291 {
6292 g_value_init (&paramv[n], G_TYPE_VARIANT);
6293 g_value_set_variant (&paramv[n], child);
6294 n++;
6295 }
6296 else
6297 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
6298 g_variant_unref (child);
6299 }
6300 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_THRESHOLD);
6301 g_signal_emitv (paramv, signal_id, 0, NULL);
6302 for (n = 0; n < num_params + 1; n++)
6303 g_value_unset (&paramv[n]);
6304 g_free (paramv);
6305}
6306
6307static void
6308sensor_threshold_proxy_g_properties_changed (GDBusProxy *_proxy,
6309 GVariant *changed_properties,
6310 const gchar *const *invalidated_properties)
6311{
6312 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (_proxy);
6313 guint n;
6314 const gchar *key;
6315 GVariantIter *iter;
6316 _ExtendedGDBusPropertyInfo *info;
6317 g_variant_get (changed_properties, "a{sv}", &iter);
6318 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
6319 {
6320 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, key);
6321 g_datalist_remove_data (&proxy->priv->qdata, key);
6322 if (info != NULL)
6323 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
6324 }
6325 g_variant_iter_free (iter);
6326 for (n = 0; invalidated_properties[n] != NULL; n++)
6327 {
6328 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, invalidated_properties[n]);
6329 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
6330 if (info != NULL)
6331 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
6332 }
6333}
6334
6335static GVariant *
6336sensor_threshold_proxy_get_lower_critical (SensorThreshold *object)
6337{
6338 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
6339 GVariant *variant;
6340 GVariant *value = NULL;
6341 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "lower_critical");
6342 value = variant;
6343 if (variant != NULL)
6344 g_variant_unref (variant);
6345 return value;
6346}
6347
6348static GVariant *
6349sensor_threshold_proxy_get_lower_warning (SensorThreshold *object)
6350{
6351 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
6352 GVariant *variant;
6353 GVariant *value = NULL;
6354 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "lower_warning");
6355 value = variant;
6356 if (variant != NULL)
6357 g_variant_unref (variant);
6358 return value;
6359}
6360
6361static GVariant *
6362sensor_threshold_proxy_get_upper_warning (SensorThreshold *object)
6363{
6364 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
6365 GVariant *variant;
6366 GVariant *value = NULL;
6367 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "upper_warning");
6368 value = variant;
6369 if (variant != NULL)
6370 g_variant_unref (variant);
6371 return value;
6372}
6373
6374static GVariant *
6375sensor_threshold_proxy_get_upper_critical (SensorThreshold *object)
6376{
6377 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
6378 GVariant *variant;
6379 GVariant *value = NULL;
6380 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "upper_critical");
6381 value = variant;
6382 if (variant != NULL)
6383 g_variant_unref (variant);
6384 return value;
6385}
6386
6387static guchar
6388sensor_threshold_proxy_get_state (SensorThreshold *object)
6389{
6390 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
6391 GVariant *variant;
6392 guchar value = 0;
6393 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state");
6394 if (variant != NULL)
6395 {
6396 value = g_variant_get_byte (variant);
6397 g_variant_unref (variant);
6398 }
6399 return value;
6400}
6401
6402static void
6403sensor_threshold_proxy_init (SensorThresholdProxy *proxy)
6404{
6405#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
6406 proxy->priv = sensor_threshold_proxy_get_instance_private (proxy);
6407#else
6408 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_THRESHOLD_PROXY, SensorThresholdProxyPrivate);
6409#endif
6410
6411 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_threshold_interface_info ());
6412}
6413
6414static void
6415sensor_threshold_proxy_class_init (SensorThresholdProxyClass *klass)
6416{
6417 GObjectClass *gobject_class;
6418 GDBusProxyClass *proxy_class;
6419
6420 gobject_class = G_OBJECT_CLASS (klass);
6421 gobject_class->finalize = sensor_threshold_proxy_finalize;
6422 gobject_class->get_property = sensor_threshold_proxy_get_property;
6423 gobject_class->set_property = sensor_threshold_proxy_set_property;
6424
6425 proxy_class = G_DBUS_PROXY_CLASS (klass);
6426 proxy_class->g_signal = sensor_threshold_proxy_g_signal;
6427 proxy_class->g_properties_changed = sensor_threshold_proxy_g_properties_changed;
6428
6429 sensor_threshold_override_properties (gobject_class, 1);
6430
6431#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
6432 g_type_class_add_private (klass, sizeof (SensorThresholdProxyPrivate));
6433#endif
6434}
6435
6436static void
6437sensor_threshold_proxy_iface_init (SensorThresholdIface *iface)
6438{
6439 iface->get_lower_critical = sensor_threshold_proxy_get_lower_critical;
6440 iface->get_lower_warning = sensor_threshold_proxy_get_lower_warning;
6441 iface->get_upper_warning = sensor_threshold_proxy_get_upper_warning;
6442 iface->get_upper_critical = sensor_threshold_proxy_get_upper_critical;
6443 iface->get_state = sensor_threshold_proxy_get_state;
6444}
6445
6446/**
6447 * sensor_threshold_proxy_new:
6448 * @connection: A #GDBusConnection.
6449 * @flags: Flags from the #GDBusProxyFlags enumeration.
6450 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
6451 * @object_path: An object path.
6452 * @cancellable: (allow-none): A #GCancellable or %NULL.
6453 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
6454 * @user_data: User data to pass to @callback.
6455 *
6456 * 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.
6457 *
6458 * 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.
6459 * You can then call sensor_threshold_proxy_new_finish() to get the result of the operation.
6460 *
6461 * See sensor_threshold_proxy_new_sync() for the synchronous, blocking version of this constructor.
6462 */
6463void
6464sensor_threshold_proxy_new (
6465 GDBusConnection *connection,
6466 GDBusProxyFlags flags,
6467 const gchar *name,
6468 const gchar *object_path,
6469 GCancellable *cancellable,
6470 GAsyncReadyCallback callback,
6471 gpointer user_data)
6472{
6473 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);
6474}
6475
6476/**
6477 * sensor_threshold_proxy_new_finish:
6478 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_threshold_proxy_new().
6479 * @error: Return location for error or %NULL
6480 *
6481 * Finishes an operation started with sensor_threshold_proxy_new().
6482 *
6483 * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set.
6484 */
6485SensorThreshold *
6486sensor_threshold_proxy_new_finish (
6487 GAsyncResult *res,
6488 GError **error)
6489{
6490 GObject *ret;
6491 GObject *source_object;
6492 source_object = g_async_result_get_source_object (res);
6493 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
6494 g_object_unref (source_object);
6495 if (ret != NULL)
6496 return SENSOR_THRESHOLD (ret);
6497 else
6498 return NULL;
6499}
6500
6501/**
6502 * sensor_threshold_proxy_new_sync:
6503 * @connection: A #GDBusConnection.
6504 * @flags: Flags from the #GDBusProxyFlags enumeration.
6505 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
6506 * @object_path: An object path.
6507 * @cancellable: (allow-none): A #GCancellable or %NULL.
6508 * @error: Return location for error or %NULL
6509 *
6510 * 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.
6511 *
6512 * The calling thread is blocked until a reply is received.
6513 *
6514 * See sensor_threshold_proxy_new() for the asynchronous version of this constructor.
6515 *
6516 * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set.
6517 */
6518SensorThreshold *
6519sensor_threshold_proxy_new_sync (
6520 GDBusConnection *connection,
6521 GDBusProxyFlags flags,
6522 const gchar *name,
6523 const gchar *object_path,
6524 GCancellable *cancellable,
6525 GError **error)
6526{
6527 GInitable *ret;
6528 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);
6529 if (ret != NULL)
6530 return SENSOR_THRESHOLD (ret);
6531 else
6532 return NULL;
6533}
6534
6535
6536/**
6537 * sensor_threshold_proxy_new_for_bus:
6538 * @bus_type: A #GBusType.
6539 * @flags: Flags from the #GDBusProxyFlags enumeration.
6540 * @name: A bus name (well-known or unique).
6541 * @object_path: An object path.
6542 * @cancellable: (allow-none): A #GCancellable or %NULL.
6543 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
6544 * @user_data: User data to pass to @callback.
6545 *
6546 * Like sensor_threshold_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
6547 *
6548 * 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.
6549 * You can then call sensor_threshold_proxy_new_for_bus_finish() to get the result of the operation.
6550 *
6551 * See sensor_threshold_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
6552 */
6553void
6554sensor_threshold_proxy_new_for_bus (
6555 GBusType bus_type,
6556 GDBusProxyFlags flags,
6557 const gchar *name,
6558 const gchar *object_path,
6559 GCancellable *cancellable,
6560 GAsyncReadyCallback callback,
6561 gpointer user_data)
6562{
6563 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);
6564}
6565
6566/**
6567 * sensor_threshold_proxy_new_for_bus_finish:
6568 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_threshold_proxy_new_for_bus().
6569 * @error: Return location for error or %NULL
6570 *
6571 * Finishes an operation started with sensor_threshold_proxy_new_for_bus().
6572 *
6573 * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set.
6574 */
6575SensorThreshold *
6576sensor_threshold_proxy_new_for_bus_finish (
6577 GAsyncResult *res,
6578 GError **error)
6579{
6580 GObject *ret;
6581 GObject *source_object;
6582 source_object = g_async_result_get_source_object (res);
6583 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
6584 g_object_unref (source_object);
6585 if (ret != NULL)
6586 return SENSOR_THRESHOLD (ret);
6587 else
6588 return NULL;
6589}
6590
6591/**
6592 * sensor_threshold_proxy_new_for_bus_sync:
6593 * @bus_type: A #GBusType.
6594 * @flags: Flags from the #GDBusProxyFlags enumeration.
6595 * @name: A bus name (well-known or unique).
6596 * @object_path: An object path.
6597 * @cancellable: (allow-none): A #GCancellable or %NULL.
6598 * @error: Return location for error or %NULL
6599 *
6600 * Like sensor_threshold_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
6601 *
6602 * The calling thread is blocked until a reply is received.
6603 *
6604 * See sensor_threshold_proxy_new_for_bus() for the asynchronous version of this constructor.
6605 *
6606 * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set.
6607 */
6608SensorThreshold *
6609sensor_threshold_proxy_new_for_bus_sync (
6610 GBusType bus_type,
6611 GDBusProxyFlags flags,
6612 const gchar *name,
6613 const gchar *object_path,
6614 GCancellable *cancellable,
6615 GError **error)
6616{
6617 GInitable *ret;
6618 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);
6619 if (ret != NULL)
6620 return SENSOR_THRESHOLD (ret);
6621 else
6622 return NULL;
6623}
6624
6625
6626/* ------------------------------------------------------------------------ */
6627
6628/**
6629 * SensorThresholdSkeleton:
6630 *
6631 * The #SensorThresholdSkeleton structure contains only private data and should only be accessed using the provided API.
6632 */
6633
6634/**
6635 * SensorThresholdSkeletonClass:
6636 * @parent_class: The parent class.
6637 *
6638 * Class structure for #SensorThresholdSkeleton.
6639 */
6640
6641struct _SensorThresholdSkeletonPrivate
6642{
6643 GValue *properties;
6644 GList *changed_properties;
6645 GSource *changed_properties_idle_source;
6646 GMainContext *context;
6647 GMutex lock;
6648};
6649
6650static void
6651_sensor_threshold_skeleton_handle_method_call (
6652 GDBusConnection *connection G_GNUC_UNUSED,
6653 const gchar *sender G_GNUC_UNUSED,
6654 const gchar *object_path G_GNUC_UNUSED,
6655 const gchar *interface_name,
6656 const gchar *method_name,
6657 GVariant *parameters,
6658 GDBusMethodInvocation *invocation,
6659 gpointer user_data)
6660{
6661 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data);
6662 _ExtendedGDBusMethodInfo *info;
6663 GVariantIter iter;
6664 GVariant *child;
6665 GValue *paramv;
6666 guint num_params;
6667 guint num_extra;
6668 guint n;
6669 guint signal_id;
6670 GValue return_value = G_VALUE_INIT;
6671 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
6672 g_assert (info != NULL);
6673 num_params = g_variant_n_children (parameters);
6674 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
6675 n = 0;
6676 g_value_init (&paramv[n], TYPE_SENSOR_THRESHOLD);
6677 g_value_set_object (&paramv[n++], skeleton);
6678 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
6679 g_value_set_object (&paramv[n++], invocation);
6680 if (info->pass_fdlist)
6681 {
6682#ifdef G_OS_UNIX
6683 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
6684 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
6685#else
6686 g_assert_not_reached ();
6687#endif
6688 }
6689 g_variant_iter_init (&iter, parameters);
6690 while ((child = g_variant_iter_next_value (&iter)) != NULL)
6691 {
6692 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
6693 if (arg_info->use_gvariant)
6694 {
6695 g_value_init (&paramv[n], G_TYPE_VARIANT);
6696 g_value_set_variant (&paramv[n], child);
6697 n++;
6698 }
6699 else
6700 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
6701 g_variant_unref (child);
6702 }
6703 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_THRESHOLD);
6704 g_value_init (&return_value, G_TYPE_BOOLEAN);
6705 g_signal_emitv (paramv, signal_id, 0, &return_value);
6706 if (!g_value_get_boolean (&return_value))
6707 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);
6708 g_value_unset (&return_value);
6709 for (n = 0; n < num_params + num_extra; n++)
6710 g_value_unset (&paramv[n]);
6711 g_free (paramv);
6712}
6713
6714static GVariant *
6715_sensor_threshold_skeleton_handle_get_property (
6716 GDBusConnection *connection G_GNUC_UNUSED,
6717 const gchar *sender G_GNUC_UNUSED,
6718 const gchar *object_path G_GNUC_UNUSED,
6719 const gchar *interface_name G_GNUC_UNUSED,
6720 const gchar *property_name,
6721 GError **error,
6722 gpointer user_data)
6723{
6724 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data);
6725 GValue value = G_VALUE_INIT;
6726 GParamSpec *pspec;
6727 _ExtendedGDBusPropertyInfo *info;
6728 GVariant *ret;
6729 ret = NULL;
6730 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, property_name);
6731 g_assert (info != NULL);
6732 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
6733 if (pspec == NULL)
6734 {
6735 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
6736 }
6737 else
6738 {
6739 g_value_init (&value, pspec->value_type);
6740 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
6741 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
6742 g_value_unset (&value);
6743 }
6744 return ret;
6745}
6746
6747static gboolean
6748_sensor_threshold_skeleton_handle_set_property (
6749 GDBusConnection *connection G_GNUC_UNUSED,
6750 const gchar *sender G_GNUC_UNUSED,
6751 const gchar *object_path G_GNUC_UNUSED,
6752 const gchar *interface_name G_GNUC_UNUSED,
6753 const gchar *property_name,
6754 GVariant *variant,
6755 GError **error,
6756 gpointer user_data)
6757{
6758 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data);
6759 GValue value = G_VALUE_INIT;
6760 GParamSpec *pspec;
6761 _ExtendedGDBusPropertyInfo *info;
6762 gboolean ret;
6763 ret = FALSE;
6764 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, property_name);
6765 g_assert (info != NULL);
6766 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
6767 if (pspec == NULL)
6768 {
6769 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
6770 }
6771 else
6772 {
6773 if (info->use_gvariant)
6774 g_value_set_variant (&value, variant);
6775 else
6776 g_dbus_gvariant_to_gvalue (variant, &value);
6777 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
6778 g_value_unset (&value);
6779 ret = TRUE;
6780 }
6781 return ret;
6782}
6783
6784static const GDBusInterfaceVTable _sensor_threshold_skeleton_vtable =
6785{
6786 _sensor_threshold_skeleton_handle_method_call,
6787 _sensor_threshold_skeleton_handle_get_property,
6788 _sensor_threshold_skeleton_handle_set_property,
6789 {NULL}
6790};
6791
6792static GDBusInterfaceInfo *
6793sensor_threshold_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
6794{
6795 return sensor_threshold_interface_info ();
6796}
6797
6798static GDBusInterfaceVTable *
6799sensor_threshold_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
6800{
6801 return (GDBusInterfaceVTable *) &_sensor_threshold_skeleton_vtable;
6802}
6803
6804static GVariant *
6805sensor_threshold_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
6806{
6807 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (_skeleton);
6808
6809 GVariantBuilder builder;
6810 guint n;
6811 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
6812 if (_sensor_threshold_interface_info.parent_struct.properties == NULL)
6813 goto out;
6814 for (n = 0; _sensor_threshold_interface_info.parent_struct.properties[n] != NULL; n++)
6815 {
6816 GDBusPropertyInfo *info = _sensor_threshold_interface_info.parent_struct.properties[n];
6817 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
6818 {
6819 GVariant *value;
6820 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);
6821 if (value != NULL)
6822 {
6823 g_variant_take_ref (value);
6824 g_variant_builder_add (&builder, "{sv}", info->name, value);
6825 g_variant_unref (value);
6826 }
6827 }
6828 }
6829out:
6830 return g_variant_builder_end (&builder);
6831}
6832
6833static gboolean _sensor_threshold_emit_changed (gpointer user_data);
6834
6835static void
6836sensor_threshold_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
6837{
6838 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (_skeleton);
6839 gboolean emit_changed = FALSE;
6840
6841 g_mutex_lock (&skeleton->priv->lock);
6842 if (skeleton->priv->changed_properties_idle_source != NULL)
6843 {
6844 g_source_destroy (skeleton->priv->changed_properties_idle_source);
6845 skeleton->priv->changed_properties_idle_source = NULL;
6846 emit_changed = TRUE;
6847 }
6848 g_mutex_unlock (&skeleton->priv->lock);
6849
6850 if (emit_changed)
6851 _sensor_threshold_emit_changed (skeleton);
6852}
6853
6854static void
6855_sensor_threshold_on_signal_warning (
6856 SensorThreshold *object)
6857{
6858 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
6859
6860 GList *connections, *l;
6861 GVariant *signal_variant;
6862 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
6863
6864 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
6865 for (l = connections; l != NULL; l = l->next)
6866 {
6867 GDBusConnection *connection = l->data;
6868 g_dbus_connection_emit_signal (connection,
6869 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorThreshold", "Warning",
6870 signal_variant, NULL);
6871 }
6872 g_variant_unref (signal_variant);
6873 g_list_free_full (connections, g_object_unref);
6874}
6875
6876static void
6877_sensor_threshold_on_signal_critical (
6878 SensorThreshold *object)
6879{
6880 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
6881
6882 GList *connections, *l;
6883 GVariant *signal_variant;
6884 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
6885
6886 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
6887 for (l = connections; l != NULL; l = l->next)
6888 {
6889 GDBusConnection *connection = l->data;
6890 g_dbus_connection_emit_signal (connection,
6891 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorThreshold", "Critical",
6892 signal_variant, NULL);
6893 }
6894 g_variant_unref (signal_variant);
6895 g_list_free_full (connections, g_object_unref);
6896}
6897
6898static void
6899_sensor_threshold_on_signal_normal (
6900 SensorThreshold *object)
6901{
6902 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
6903
6904 GList *connections, *l;
6905 GVariant *signal_variant;
6906 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
6907
6908 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
6909 for (l = connections; l != NULL; l = l->next)
6910 {
6911 GDBusConnection *connection = l->data;
6912 g_dbus_connection_emit_signal (connection,
6913 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorThreshold", "Normal",
6914 signal_variant, NULL);
6915 }
6916 g_variant_unref (signal_variant);
6917 g_list_free_full (connections, g_object_unref);
6918}
6919
6920static void sensor_threshold_skeleton_iface_init (SensorThresholdIface *iface);
6921#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
6922G_DEFINE_TYPE_WITH_CODE (SensorThresholdSkeleton, sensor_threshold_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
6923 G_ADD_PRIVATE (SensorThresholdSkeleton)
6924 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_skeleton_iface_init));
6925
6926#else
6927G_DEFINE_TYPE_WITH_CODE (SensorThresholdSkeleton, sensor_threshold_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
6928 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_skeleton_iface_init));
6929
6930#endif
6931static void
6932sensor_threshold_skeleton_finalize (GObject *object)
6933{
6934 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
6935 guint n;
6936 for (n = 0; n < 5; n++)
6937 g_value_unset (&skeleton->priv->properties[n]);
6938 g_free (skeleton->priv->properties);
6939 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
6940 if (skeleton->priv->changed_properties_idle_source != NULL)
6941 g_source_destroy (skeleton->priv->changed_properties_idle_source);
6942 g_main_context_unref (skeleton->priv->context);
6943 g_mutex_clear (&skeleton->priv->lock);
6944 G_OBJECT_CLASS (sensor_threshold_skeleton_parent_class)->finalize (object);
6945}
6946
6947static void
6948sensor_threshold_skeleton_get_property (GObject *object,
6949 guint prop_id,
6950 GValue *value,
6951 GParamSpec *pspec G_GNUC_UNUSED)
6952{
6953 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
6954 g_assert (prop_id != 0 && prop_id - 1 < 5);
6955 g_mutex_lock (&skeleton->priv->lock);
6956 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
6957 g_mutex_unlock (&skeleton->priv->lock);
6958}
6959
6960static gboolean
6961_sensor_threshold_emit_changed (gpointer user_data)
6962{
6963 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data);
6964 GList *l;
6965 GVariantBuilder builder;
6966 GVariantBuilder invalidated_builder;
6967 guint num_changes;
6968
6969 g_mutex_lock (&skeleton->priv->lock);
6970 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
6971 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
6972 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
6973 {
6974 ChangedProperty *cp = l->data;
6975 GVariant *variant;
6976 const GValue *cur_value;
6977
6978 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
6979 if (!_g_value_equal (cur_value, &cp->orig_value))
6980 {
6981 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
6982 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
6983 g_variant_unref (variant);
6984 num_changes++;
6985 }
6986 }
6987 if (num_changes > 0)
6988 {
6989 GList *connections, *ll;
6990 GVariant *signal_variant;
6991 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorThreshold",
6992 &builder, &invalidated_builder));
6993 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
6994 for (ll = connections; ll != NULL; ll = ll->next)
6995 {
6996 GDBusConnection *connection = ll->data;
6997
6998 g_dbus_connection_emit_signal (connection,
6999 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
7000 "org.freedesktop.DBus.Properties",
7001 "PropertiesChanged",
7002 signal_variant,
7003 NULL);
7004 }
7005 g_variant_unref (signal_variant);
7006 g_list_free_full (connections, g_object_unref);
7007 }
7008 else
7009 {
7010 g_variant_builder_clear (&builder);
7011 g_variant_builder_clear (&invalidated_builder);
7012 }
7013 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
7014 skeleton->priv->changed_properties = NULL;
7015 skeleton->priv->changed_properties_idle_source = NULL;
7016 g_mutex_unlock (&skeleton->priv->lock);
7017 return FALSE;
7018}
7019
7020static void
7021_sensor_threshold_schedule_emit_changed (SensorThresholdSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
7022{
7023 ChangedProperty *cp;
7024 GList *l;
7025 cp = NULL;
7026 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
7027 {
7028 ChangedProperty *i_cp = l->data;
7029 if (i_cp->info == info)
7030 {
7031 cp = i_cp;
7032 break;
7033 }
7034 }
7035 if (cp == NULL)
7036 {
7037 cp = g_new0 (ChangedProperty, 1);
7038 cp->prop_id = prop_id;
7039 cp->info = info;
7040 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
7041 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
7042 g_value_copy (orig_value, &cp->orig_value);
7043 }
7044}
7045
7046static void
7047sensor_threshold_skeleton_notify (GObject *object,
7048 GParamSpec *pspec G_GNUC_UNUSED)
7049{
7050 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7051 g_mutex_lock (&skeleton->priv->lock);
7052 if (skeleton->priv->changed_properties != NULL &&
7053 skeleton->priv->changed_properties_idle_source == NULL)
7054 {
7055 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
7056 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
7057 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_threshold_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
7058 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
7059 g_source_unref (skeleton->priv->changed_properties_idle_source);
7060 }
7061 g_mutex_unlock (&skeleton->priv->lock);
7062}
7063
7064static void
7065sensor_threshold_skeleton_set_property (GObject *object,
7066 guint prop_id,
7067 const GValue *value,
7068 GParamSpec *pspec)
7069{
7070 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7071 g_assert (prop_id != 0 && prop_id - 1 < 5);
7072 g_mutex_lock (&skeleton->priv->lock);
7073 g_object_freeze_notify (object);
7074 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
7075 {
7076 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
7077 _sensor_threshold_schedule_emit_changed (skeleton, _sensor_threshold_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
7078 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
7079 g_object_notify_by_pspec (object, pspec);
7080 }
7081 g_mutex_unlock (&skeleton->priv->lock);
7082 g_object_thaw_notify (object);
7083}
7084
7085static void
7086sensor_threshold_skeleton_init (SensorThresholdSkeleton *skeleton)
7087{
7088#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
7089 skeleton->priv = sensor_threshold_skeleton_get_instance_private (skeleton);
7090#else
7091 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_THRESHOLD_SKELETON, SensorThresholdSkeletonPrivate);
7092#endif
7093
7094 g_mutex_init (&skeleton->priv->lock);
7095 skeleton->priv->context = g_main_context_ref_thread_default ();
7096 skeleton->priv->properties = g_new0 (GValue, 5);
7097 g_value_init (&skeleton->priv->properties[0], G_TYPE_VARIANT);
7098 g_value_init (&skeleton->priv->properties[1], G_TYPE_VARIANT);
7099 g_value_init (&skeleton->priv->properties[2], G_TYPE_VARIANT);
7100 g_value_init (&skeleton->priv->properties[3], G_TYPE_VARIANT);
7101 g_value_init (&skeleton->priv->properties[4], G_TYPE_UCHAR);
7102}
7103
7104static GVariant *
7105sensor_threshold_skeleton_get_lower_critical (SensorThreshold *object)
7106{
7107 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7108 GVariant *value;
7109 g_mutex_lock (&skeleton->priv->lock);
7110 value = g_value_get_variant (&(skeleton->priv->properties[0]));
7111 g_mutex_unlock (&skeleton->priv->lock);
7112 return value;
7113}
7114
7115static GVariant *
7116sensor_threshold_skeleton_get_lower_warning (SensorThreshold *object)
7117{
7118 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7119 GVariant *value;
7120 g_mutex_lock (&skeleton->priv->lock);
7121 value = g_value_get_variant (&(skeleton->priv->properties[1]));
7122 g_mutex_unlock (&skeleton->priv->lock);
7123 return value;
7124}
7125
7126static GVariant *
7127sensor_threshold_skeleton_get_upper_warning (SensorThreshold *object)
7128{
7129 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7130 GVariant *value;
7131 g_mutex_lock (&skeleton->priv->lock);
7132 value = g_value_get_variant (&(skeleton->priv->properties[2]));
7133 g_mutex_unlock (&skeleton->priv->lock);
7134 return value;
7135}
7136
7137static GVariant *
7138sensor_threshold_skeleton_get_upper_critical (SensorThreshold *object)
7139{
7140 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7141 GVariant *value;
7142 g_mutex_lock (&skeleton->priv->lock);
7143 value = g_value_get_variant (&(skeleton->priv->properties[3]));
7144 g_mutex_unlock (&skeleton->priv->lock);
7145 return value;
7146}
7147
7148static guchar
7149sensor_threshold_skeleton_get_state (SensorThreshold *object)
7150{
7151 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7152 guchar value;
7153 g_mutex_lock (&skeleton->priv->lock);
7154 value = g_value_get_uchar (&(skeleton->priv->properties[4]));
7155 g_mutex_unlock (&skeleton->priv->lock);
7156 return value;
7157}
7158
7159static void
7160sensor_threshold_skeleton_class_init (SensorThresholdSkeletonClass *klass)
7161{
7162 GObjectClass *gobject_class;
7163 GDBusInterfaceSkeletonClass *skeleton_class;
7164
7165 gobject_class = G_OBJECT_CLASS (klass);
7166 gobject_class->finalize = sensor_threshold_skeleton_finalize;
7167 gobject_class->get_property = sensor_threshold_skeleton_get_property;
7168 gobject_class->set_property = sensor_threshold_skeleton_set_property;
7169 gobject_class->notify = sensor_threshold_skeleton_notify;
7170
7171
7172 sensor_threshold_override_properties (gobject_class, 1);
7173
7174 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
7175 skeleton_class->get_info = sensor_threshold_skeleton_dbus_interface_get_info;
7176 skeleton_class->get_properties = sensor_threshold_skeleton_dbus_interface_get_properties;
7177 skeleton_class->flush = sensor_threshold_skeleton_dbus_interface_flush;
7178 skeleton_class->get_vtable = sensor_threshold_skeleton_dbus_interface_get_vtable;
7179
7180#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
7181 g_type_class_add_private (klass, sizeof (SensorThresholdSkeletonPrivate));
7182#endif
7183}
7184
7185static void
7186sensor_threshold_skeleton_iface_init (SensorThresholdIface *iface)
7187{
7188 iface->warning = _sensor_threshold_on_signal_warning;
7189 iface->critical = _sensor_threshold_on_signal_critical;
7190 iface->normal = _sensor_threshold_on_signal_normal;
7191 iface->get_lower_critical = sensor_threshold_skeleton_get_lower_critical;
7192 iface->get_lower_warning = sensor_threshold_skeleton_get_lower_warning;
7193 iface->get_upper_warning = sensor_threshold_skeleton_get_upper_warning;
7194 iface->get_upper_critical = sensor_threshold_skeleton_get_upper_critical;
7195 iface->get_state = sensor_threshold_skeleton_get_state;
7196}
7197
7198/**
7199 * sensor_threshold_skeleton_new:
7200 *
7201 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link>.
7202 *
7203 * Returns: (transfer full) (type SensorThresholdSkeleton): The skeleton object.
7204 */
7205SensorThreshold *
7206sensor_threshold_skeleton_new (void)
7207{
7208 return SENSOR_THRESHOLD (g_object_new (TYPE_SENSOR_THRESHOLD_SKELETON, NULL));
7209}
7210
7211/* ------------------------------------------------------------------------
7212 * Code for interface org.openbmc.SensorI2c
7213 * ------------------------------------------------------------------------
7214 */
7215
7216/**
7217 * SECTION:SensorI2c
7218 * @title: SensorI2c
7219 * @short_description: Generated C code for the org.openbmc.SensorI2c D-Bus interface
7220 *
7221 * 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.
7222 */
7223
7224/* ---- Introspection data for org.openbmc.SensorI2c ---- */
7225
7226static const _ExtendedGDBusPropertyInfo _sensor_i2c_property_info_dev_path =
7227{
7228 {
7229 -1,
7230 (gchar *) "dev_path",
7231 (gchar *) "s",
7232 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
7233 NULL
7234 },
7235 "dev-path",
7236 FALSE
7237};
7238
7239static const _ExtendedGDBusPropertyInfo _sensor_i2c_property_info_address =
7240{
7241 {
7242 -1,
7243 (gchar *) "address",
7244 (gchar *) "s",
7245 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
7246 NULL
7247 },
7248 "address",
7249 FALSE
7250};
7251
7252static const _ExtendedGDBusPropertyInfo * const _sensor_i2c_property_info_pointers[] =
7253{
7254 &_sensor_i2c_property_info_dev_path,
7255 &_sensor_i2c_property_info_address,
7256 NULL
7257};
7258
7259static const _ExtendedGDBusInterfaceInfo _sensor_i2c_interface_info =
7260{
7261 {
7262 -1,
7263 (gchar *) "org.openbmc.SensorI2c",
7264 NULL,
7265 NULL,
7266 (GDBusPropertyInfo **) &_sensor_i2c_property_info_pointers,
7267 NULL
7268 },
7269 "sensor-i2c",
7270};
7271
7272
7273/**
7274 * sensor_i2c_interface_info:
7275 *
7276 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link> D-Bus interface.
7277 *
7278 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
7279 */
7280GDBusInterfaceInfo *
7281sensor_i2c_interface_info (void)
7282{
7283 return (GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct;
7284}
7285
7286/**
7287 * sensor_i2c_override_properties:
7288 * @klass: The class structure for a #GObject<!-- -->-derived class.
7289 * @property_id_begin: The property id to assign to the first overridden property.
7290 *
7291 * Overrides all #GObject properties in the #SensorI2c interface for a concrete class.
7292 * The properties are overridden in the order they are defined.
7293 *
7294 * Returns: The last property id.
7295 */
7296guint
7297sensor_i2c_override_properties (GObjectClass *klass, guint property_id_begin)
7298{
7299 g_object_class_override_property (klass, property_id_begin++, "dev-path");
7300 g_object_class_override_property (klass, property_id_begin++, "address");
7301 return property_id_begin - 1;
7302}
7303
7304
7305
7306/**
7307 * SensorI2c:
7308 *
7309 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>.
7310 */
7311
7312/**
7313 * SensorI2cIface:
7314 * @parent_iface: The parent interface.
7315 * @get_address: Getter for the #SensorI2c:address property.
7316 * @get_dev_path: Getter for the #SensorI2c:dev-path property.
7317 *
7318 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>.
7319 */
7320
7321typedef SensorI2cIface SensorI2cInterface;
7322G_DEFINE_INTERFACE (SensorI2c, sensor_i2c, G_TYPE_OBJECT);
7323
7324static void
7325sensor_i2c_default_init (SensorI2cIface *iface)
7326{
7327 /* GObject properties for D-Bus properties: */
7328 /**
7329 * SensorI2c:dev-path:
7330 *
7331 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link>.
7332 *
7333 * 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.
7334 */
7335 g_object_interface_install_property (iface,
7336 g_param_spec_string ("dev-path", "dev_path", "dev_path", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
7337 /**
7338 * SensorI2c:address:
7339 *
7340 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link>.
7341 *
7342 * 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.
7343 */
7344 g_object_interface_install_property (iface,
7345 g_param_spec_string ("address", "address", "address", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
7346}
7347
7348/**
7349 * sensor_i2c_get_dev_path: (skip)
7350 * @object: A #SensorI2c.
7351 *
7352 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link> D-Bus property.
7353 *
7354 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
7355 *
7356 * <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>
7357 *
7358 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
7359 */
7360const gchar *
7361sensor_i2c_get_dev_path (SensorI2c *object)
7362{
7363 return SENSOR_I2C_GET_IFACE (object)->get_dev_path (object);
7364}
7365
7366/**
7367 * sensor_i2c_dup_dev_path: (skip)
7368 * @object: A #SensorI2c.
7369 *
7370 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link> D-Bus property.
7371 *
7372 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
7373 *
7374 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
7375 */
7376gchar *
7377sensor_i2c_dup_dev_path (SensorI2c *object)
7378{
7379 gchar *value;
7380 g_object_get (G_OBJECT (object), "dev-path", &value, NULL);
7381 return value;
7382}
7383
7384/**
7385 * sensor_i2c_set_dev_path: (skip)
7386 * @object: A #SensorI2c.
7387 * @value: The value to set.
7388 *
7389 * Sets the <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link> D-Bus property to @value.
7390 *
7391 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
7392 */
7393void
7394sensor_i2c_set_dev_path (SensorI2c *object, const gchar *value)
7395{
7396 g_object_set (G_OBJECT (object), "dev-path", value, NULL);
7397}
7398
7399/**
7400 * sensor_i2c_get_address: (skip)
7401 * @object: A #SensorI2c.
7402 *
7403 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link> D-Bus property.
7404 *
7405 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
7406 *
7407 * <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>
7408 *
7409 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
7410 */
7411const gchar *
7412sensor_i2c_get_address (SensorI2c *object)
7413{
7414 return SENSOR_I2C_GET_IFACE (object)->get_address (object);
7415}
7416
7417/**
7418 * sensor_i2c_dup_address: (skip)
7419 * @object: A #SensorI2c.
7420 *
7421 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link> D-Bus property.
7422 *
7423 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
7424 *
7425 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
7426 */
7427gchar *
7428sensor_i2c_dup_address (SensorI2c *object)
7429{
7430 gchar *value;
7431 g_object_get (G_OBJECT (object), "address", &value, NULL);
7432 return value;
7433}
7434
7435/**
7436 * sensor_i2c_set_address: (skip)
7437 * @object: A #SensorI2c.
7438 * @value: The value to set.
7439 *
7440 * Sets the <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link> D-Bus property to @value.
7441 *
7442 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
7443 */
7444void
7445sensor_i2c_set_address (SensorI2c *object, const gchar *value)
7446{
7447 g_object_set (G_OBJECT (object), "address", value, NULL);
7448}
7449
7450/* ------------------------------------------------------------------------ */
7451
7452/**
7453 * SensorI2cProxy:
7454 *
7455 * The #SensorI2cProxy structure contains only private data and should only be accessed using the provided API.
7456 */
7457
7458/**
7459 * SensorI2cProxyClass:
7460 * @parent_class: The parent class.
7461 *
7462 * Class structure for #SensorI2cProxy.
7463 */
7464
7465struct _SensorI2cProxyPrivate
7466{
7467 GData *qdata;
7468};
7469
7470static void sensor_i2c_proxy_iface_init (SensorI2cIface *iface);
7471
7472#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
7473G_DEFINE_TYPE_WITH_CODE (SensorI2cProxy, sensor_i2c_proxy, G_TYPE_DBUS_PROXY,
7474 G_ADD_PRIVATE (SensorI2cProxy)
7475 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_proxy_iface_init));
7476
7477#else
7478G_DEFINE_TYPE_WITH_CODE (SensorI2cProxy, sensor_i2c_proxy, G_TYPE_DBUS_PROXY,
7479 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_proxy_iface_init));
7480
7481#endif
7482static void
7483sensor_i2c_proxy_finalize (GObject *object)
7484{
7485 SensorI2cProxy *proxy = SENSOR_I2C_PROXY (object);
7486 g_datalist_clear (&proxy->priv->qdata);
7487 G_OBJECT_CLASS (sensor_i2c_proxy_parent_class)->finalize (object);
7488}
7489
7490static void
7491sensor_i2c_proxy_get_property (GObject *object,
7492 guint prop_id,
7493 GValue *value,
7494 GParamSpec *pspec G_GNUC_UNUSED)
7495{
7496 const _ExtendedGDBusPropertyInfo *info;
7497 GVariant *variant;
7498 g_assert (prop_id != 0 && prop_id - 1 < 2);
7499 info = _sensor_i2c_property_info_pointers[prop_id - 1];
7500 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
7501 if (info->use_gvariant)
7502 {
7503 g_value_set_variant (value, variant);
7504 }
7505 else
7506 {
7507 if (variant != NULL)
7508 g_dbus_gvariant_to_gvalue (variant, value);
7509 }
7510 if (variant != NULL)
7511 g_variant_unref (variant);
7512}
7513
7514static void
7515sensor_i2c_proxy_set_property_cb (GDBusProxy *proxy,
7516 GAsyncResult *res,
7517 gpointer user_data)
7518{
7519 const _ExtendedGDBusPropertyInfo *info = user_data;
7520 GError *error;
7521 GVariant *_ret;
7522 error = NULL;
7523 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
7524 if (!_ret)
7525 {
7526 g_warning ("Error setting property '%s' on interface org.openbmc.SensorI2c: %s (%s, %d)",
7527 info->parent_struct.name,
7528 error->message, g_quark_to_string (error->domain), error->code);
7529 g_error_free (error);
7530 }
7531 else
7532 {
7533 g_variant_unref (_ret);
7534 }
7535}
7536
7537static void
7538sensor_i2c_proxy_set_property (GObject *object,
7539 guint prop_id,
7540 const GValue *value,
7541 GParamSpec *pspec G_GNUC_UNUSED)
7542{
7543 const _ExtendedGDBusPropertyInfo *info;
7544 GVariant *variant;
7545 g_assert (prop_id != 0 && prop_id - 1 < 2);
7546 info = _sensor_i2c_property_info_pointers[prop_id - 1];
7547 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
7548 g_dbus_proxy_call (G_DBUS_PROXY (object),
7549 "org.freedesktop.DBus.Properties.Set",
7550 g_variant_new ("(ssv)", "org.openbmc.SensorI2c", info->parent_struct.name, variant),
7551 G_DBUS_CALL_FLAGS_NONE,
7552 -1,
7553 NULL, (GAsyncReadyCallback) sensor_i2c_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
7554 g_variant_unref (variant);
7555}
7556
7557static void
7558sensor_i2c_proxy_g_signal (GDBusProxy *proxy,
7559 const gchar *sender_name G_GNUC_UNUSED,
7560 const gchar *signal_name,
7561 GVariant *parameters)
7562{
7563 _ExtendedGDBusSignalInfo *info;
7564 GVariantIter iter;
7565 GVariant *child;
7566 GValue *paramv;
7567 guint num_params;
7568 guint n;
7569 guint signal_id;
7570 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, signal_name);
7571 if (info == NULL)
7572 return;
7573 num_params = g_variant_n_children (parameters);
7574 paramv = g_new0 (GValue, num_params + 1);
7575 g_value_init (&paramv[0], TYPE_SENSOR_I2C);
7576 g_value_set_object (&paramv[0], proxy);
7577 g_variant_iter_init (&iter, parameters);
7578 n = 1;
7579 while ((child = g_variant_iter_next_value (&iter)) != NULL)
7580 {
7581 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
7582 if (arg_info->use_gvariant)
7583 {
7584 g_value_init (&paramv[n], G_TYPE_VARIANT);
7585 g_value_set_variant (&paramv[n], child);
7586 n++;
7587 }
7588 else
7589 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
7590 g_variant_unref (child);
7591 }
7592 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_I2C);
7593 g_signal_emitv (paramv, signal_id, 0, NULL);
7594 for (n = 0; n < num_params + 1; n++)
7595 g_value_unset (&paramv[n]);
7596 g_free (paramv);
7597}
7598
7599static void
7600sensor_i2c_proxy_g_properties_changed (GDBusProxy *_proxy,
7601 GVariant *changed_properties,
7602 const gchar *const *invalidated_properties)
7603{
7604 SensorI2cProxy *proxy = SENSOR_I2C_PROXY (_proxy);
7605 guint n;
7606 const gchar *key;
7607 GVariantIter *iter;
7608 _ExtendedGDBusPropertyInfo *info;
7609 g_variant_get (changed_properties, "a{sv}", &iter);
7610 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
7611 {
7612 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, key);
7613 g_datalist_remove_data (&proxy->priv->qdata, key);
7614 if (info != NULL)
7615 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
7616 }
7617 g_variant_iter_free (iter);
7618 for (n = 0; invalidated_properties[n] != NULL; n++)
7619 {
7620 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, invalidated_properties[n]);
7621 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
7622 if (info != NULL)
7623 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
7624 }
7625}
7626
7627static const gchar *
7628sensor_i2c_proxy_get_dev_path (SensorI2c *object)
7629{
7630 SensorI2cProxy *proxy = SENSOR_I2C_PROXY (object);
7631 GVariant *variant;
7632 const gchar *value = NULL;
7633 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "dev_path");
7634 if (variant != NULL)
7635 {
7636 value = g_variant_get_string (variant, NULL);
7637 g_variant_unref (variant);
7638 }
7639 return value;
7640}
7641
7642static const gchar *
7643sensor_i2c_proxy_get_address (SensorI2c *object)
7644{
7645 SensorI2cProxy *proxy = SENSOR_I2C_PROXY (object);
7646 GVariant *variant;
7647 const gchar *value = NULL;
7648 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "address");
7649 if (variant != NULL)
7650 {
7651 value = g_variant_get_string (variant, NULL);
7652 g_variant_unref (variant);
7653 }
7654 return value;
7655}
7656
7657static void
7658sensor_i2c_proxy_init (SensorI2cProxy *proxy)
7659{
7660#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
7661 proxy->priv = sensor_i2c_proxy_get_instance_private (proxy);
7662#else
7663 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_I2C_PROXY, SensorI2cProxyPrivate);
7664#endif
7665
7666 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_i2c_interface_info ());
7667}
7668
7669static void
7670sensor_i2c_proxy_class_init (SensorI2cProxyClass *klass)
7671{
7672 GObjectClass *gobject_class;
7673 GDBusProxyClass *proxy_class;
7674
7675 gobject_class = G_OBJECT_CLASS (klass);
7676 gobject_class->finalize = sensor_i2c_proxy_finalize;
7677 gobject_class->get_property = sensor_i2c_proxy_get_property;
7678 gobject_class->set_property = sensor_i2c_proxy_set_property;
7679
7680 proxy_class = G_DBUS_PROXY_CLASS (klass);
7681 proxy_class->g_signal = sensor_i2c_proxy_g_signal;
7682 proxy_class->g_properties_changed = sensor_i2c_proxy_g_properties_changed;
7683
7684 sensor_i2c_override_properties (gobject_class, 1);
7685
7686#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
7687 g_type_class_add_private (klass, sizeof (SensorI2cProxyPrivate));
7688#endif
7689}
7690
7691static void
7692sensor_i2c_proxy_iface_init (SensorI2cIface *iface)
7693{
7694 iface->get_dev_path = sensor_i2c_proxy_get_dev_path;
7695 iface->get_address = sensor_i2c_proxy_get_address;
7696}
7697
7698/**
7699 * sensor_i2c_proxy_new:
7700 * @connection: A #GDBusConnection.
7701 * @flags: Flags from the #GDBusProxyFlags enumeration.
7702 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
7703 * @object_path: An object path.
7704 * @cancellable: (allow-none): A #GCancellable or %NULL.
7705 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
7706 * @user_data: User data to pass to @callback.
7707 *
7708 * 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.
7709 *
7710 * 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.
7711 * You can then call sensor_i2c_proxy_new_finish() to get the result of the operation.
7712 *
7713 * See sensor_i2c_proxy_new_sync() for the synchronous, blocking version of this constructor.
7714 */
7715void
7716sensor_i2c_proxy_new (
7717 GDBusConnection *connection,
7718 GDBusProxyFlags flags,
7719 const gchar *name,
7720 const gchar *object_path,
7721 GCancellable *cancellable,
7722 GAsyncReadyCallback callback,
7723 gpointer user_data)
7724{
7725 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);
7726}
7727
7728/**
7729 * sensor_i2c_proxy_new_finish:
7730 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_i2c_proxy_new().
7731 * @error: Return location for error or %NULL
7732 *
7733 * Finishes an operation started with sensor_i2c_proxy_new().
7734 *
7735 * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set.
7736 */
7737SensorI2c *
7738sensor_i2c_proxy_new_finish (
7739 GAsyncResult *res,
7740 GError **error)
7741{
7742 GObject *ret;
7743 GObject *source_object;
7744 source_object = g_async_result_get_source_object (res);
7745 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
7746 g_object_unref (source_object);
7747 if (ret != NULL)
7748 return SENSOR_I2C (ret);
7749 else
7750 return NULL;
7751}
7752
7753/**
7754 * sensor_i2c_proxy_new_sync:
7755 * @connection: A #GDBusConnection.
7756 * @flags: Flags from the #GDBusProxyFlags enumeration.
7757 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
7758 * @object_path: An object path.
7759 * @cancellable: (allow-none): A #GCancellable or %NULL.
7760 * @error: Return location for error or %NULL
7761 *
7762 * 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.
7763 *
7764 * The calling thread is blocked until a reply is received.
7765 *
7766 * See sensor_i2c_proxy_new() for the asynchronous version of this constructor.
7767 *
7768 * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set.
7769 */
7770SensorI2c *
7771sensor_i2c_proxy_new_sync (
7772 GDBusConnection *connection,
7773 GDBusProxyFlags flags,
7774 const gchar *name,
7775 const gchar *object_path,
7776 GCancellable *cancellable,
7777 GError **error)
7778{
7779 GInitable *ret;
7780 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);
7781 if (ret != NULL)
7782 return SENSOR_I2C (ret);
7783 else
7784 return NULL;
7785}
7786
7787
7788/**
7789 * sensor_i2c_proxy_new_for_bus:
7790 * @bus_type: A #GBusType.
7791 * @flags: Flags from the #GDBusProxyFlags enumeration.
7792 * @name: A bus name (well-known or unique).
7793 * @object_path: An object path.
7794 * @cancellable: (allow-none): A #GCancellable or %NULL.
7795 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
7796 * @user_data: User data to pass to @callback.
7797 *
7798 * Like sensor_i2c_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
7799 *
7800 * 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.
7801 * You can then call sensor_i2c_proxy_new_for_bus_finish() to get the result of the operation.
7802 *
7803 * See sensor_i2c_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
7804 */
7805void
7806sensor_i2c_proxy_new_for_bus (
7807 GBusType bus_type,
7808 GDBusProxyFlags flags,
7809 const gchar *name,
7810 const gchar *object_path,
7811 GCancellable *cancellable,
7812 GAsyncReadyCallback callback,
7813 gpointer user_data)
7814{
7815 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);
7816}
7817
7818/**
7819 * sensor_i2c_proxy_new_for_bus_finish:
7820 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_i2c_proxy_new_for_bus().
7821 * @error: Return location for error or %NULL
7822 *
7823 * Finishes an operation started with sensor_i2c_proxy_new_for_bus().
7824 *
7825 * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set.
7826 */
7827SensorI2c *
7828sensor_i2c_proxy_new_for_bus_finish (
7829 GAsyncResult *res,
7830 GError **error)
7831{
7832 GObject *ret;
7833 GObject *source_object;
7834 source_object = g_async_result_get_source_object (res);
7835 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
7836 g_object_unref (source_object);
7837 if (ret != NULL)
7838 return SENSOR_I2C (ret);
7839 else
7840 return NULL;
7841}
7842
7843/**
7844 * sensor_i2c_proxy_new_for_bus_sync:
7845 * @bus_type: A #GBusType.
7846 * @flags: Flags from the #GDBusProxyFlags enumeration.
7847 * @name: A bus name (well-known or unique).
7848 * @object_path: An object path.
7849 * @cancellable: (allow-none): A #GCancellable or %NULL.
7850 * @error: Return location for error or %NULL
7851 *
7852 * Like sensor_i2c_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
7853 *
7854 * The calling thread is blocked until a reply is received.
7855 *
7856 * See sensor_i2c_proxy_new_for_bus() for the asynchronous version of this constructor.
7857 *
7858 * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set.
7859 */
7860SensorI2c *
7861sensor_i2c_proxy_new_for_bus_sync (
7862 GBusType bus_type,
7863 GDBusProxyFlags flags,
7864 const gchar *name,
7865 const gchar *object_path,
7866 GCancellable *cancellable,
7867 GError **error)
7868{
7869 GInitable *ret;
7870 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);
7871 if (ret != NULL)
7872 return SENSOR_I2C (ret);
7873 else
7874 return NULL;
7875}
7876
7877
7878/* ------------------------------------------------------------------------ */
7879
7880/**
7881 * SensorI2cSkeleton:
7882 *
7883 * The #SensorI2cSkeleton structure contains only private data and should only be accessed using the provided API.
7884 */
7885
7886/**
7887 * SensorI2cSkeletonClass:
7888 * @parent_class: The parent class.
7889 *
7890 * Class structure for #SensorI2cSkeleton.
7891 */
7892
7893struct _SensorI2cSkeletonPrivate
7894{
7895 GValue *properties;
7896 GList *changed_properties;
7897 GSource *changed_properties_idle_source;
7898 GMainContext *context;
7899 GMutex lock;
7900};
7901
7902static void
7903_sensor_i2c_skeleton_handle_method_call (
7904 GDBusConnection *connection G_GNUC_UNUSED,
7905 const gchar *sender G_GNUC_UNUSED,
7906 const gchar *object_path G_GNUC_UNUSED,
7907 const gchar *interface_name,
7908 const gchar *method_name,
7909 GVariant *parameters,
7910 GDBusMethodInvocation *invocation,
7911 gpointer user_data)
7912{
7913 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data);
7914 _ExtendedGDBusMethodInfo *info;
7915 GVariantIter iter;
7916 GVariant *child;
7917 GValue *paramv;
7918 guint num_params;
7919 guint num_extra;
7920 guint n;
7921 guint signal_id;
7922 GValue return_value = G_VALUE_INIT;
7923 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
7924 g_assert (info != NULL);
7925 num_params = g_variant_n_children (parameters);
7926 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
7927 n = 0;
7928 g_value_init (&paramv[n], TYPE_SENSOR_I2C);
7929 g_value_set_object (&paramv[n++], skeleton);
7930 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
7931 g_value_set_object (&paramv[n++], invocation);
7932 if (info->pass_fdlist)
7933 {
7934#ifdef G_OS_UNIX
7935 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
7936 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
7937#else
7938 g_assert_not_reached ();
7939#endif
7940 }
7941 g_variant_iter_init (&iter, parameters);
7942 while ((child = g_variant_iter_next_value (&iter)) != NULL)
7943 {
7944 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
7945 if (arg_info->use_gvariant)
7946 {
7947 g_value_init (&paramv[n], G_TYPE_VARIANT);
7948 g_value_set_variant (&paramv[n], child);
7949 n++;
7950 }
7951 else
7952 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
7953 g_variant_unref (child);
7954 }
7955 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_I2C);
7956 g_value_init (&return_value, G_TYPE_BOOLEAN);
7957 g_signal_emitv (paramv, signal_id, 0, &return_value);
7958 if (!g_value_get_boolean (&return_value))
7959 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);
7960 g_value_unset (&return_value);
7961 for (n = 0; n < num_params + num_extra; n++)
7962 g_value_unset (&paramv[n]);
7963 g_free (paramv);
7964}
7965
7966static GVariant *
7967_sensor_i2c_skeleton_handle_get_property (
7968 GDBusConnection *connection G_GNUC_UNUSED,
7969 const gchar *sender G_GNUC_UNUSED,
7970 const gchar *object_path G_GNUC_UNUSED,
7971 const gchar *interface_name G_GNUC_UNUSED,
7972 const gchar *property_name,
7973 GError **error,
7974 gpointer user_data)
7975{
7976 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data);
7977 GValue value = G_VALUE_INIT;
7978 GParamSpec *pspec;
7979 _ExtendedGDBusPropertyInfo *info;
7980 GVariant *ret;
7981 ret = NULL;
7982 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, property_name);
7983 g_assert (info != NULL);
7984 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
7985 if (pspec == NULL)
7986 {
7987 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
7988 }
7989 else
7990 {
7991 g_value_init (&value, pspec->value_type);
7992 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
7993 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
7994 g_value_unset (&value);
7995 }
7996 return ret;
7997}
7998
7999static gboolean
8000_sensor_i2c_skeleton_handle_set_property (
8001 GDBusConnection *connection G_GNUC_UNUSED,
8002 const gchar *sender G_GNUC_UNUSED,
8003 const gchar *object_path G_GNUC_UNUSED,
8004 const gchar *interface_name G_GNUC_UNUSED,
8005 const gchar *property_name,
8006 GVariant *variant,
8007 GError **error,
8008 gpointer user_data)
8009{
8010 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data);
8011 GValue value = G_VALUE_INIT;
8012 GParamSpec *pspec;
8013 _ExtendedGDBusPropertyInfo *info;
8014 gboolean ret;
8015 ret = FALSE;
8016 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, property_name);
8017 g_assert (info != NULL);
8018 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
8019 if (pspec == NULL)
8020 {
8021 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
8022 }
8023 else
8024 {
8025 if (info->use_gvariant)
8026 g_value_set_variant (&value, variant);
8027 else
8028 g_dbus_gvariant_to_gvalue (variant, &value);
8029 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
8030 g_value_unset (&value);
8031 ret = TRUE;
8032 }
8033 return ret;
8034}
8035
8036static const GDBusInterfaceVTable _sensor_i2c_skeleton_vtable =
8037{
8038 _sensor_i2c_skeleton_handle_method_call,
8039 _sensor_i2c_skeleton_handle_get_property,
8040 _sensor_i2c_skeleton_handle_set_property,
8041 {NULL}
8042};
8043
8044static GDBusInterfaceInfo *
8045sensor_i2c_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
8046{
8047 return sensor_i2c_interface_info ();
8048}
8049
8050static GDBusInterfaceVTable *
8051sensor_i2c_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
8052{
8053 return (GDBusInterfaceVTable *) &_sensor_i2c_skeleton_vtable;
8054}
8055
8056static GVariant *
8057sensor_i2c_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
8058{
8059 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (_skeleton);
8060
8061 GVariantBuilder builder;
8062 guint n;
8063 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
8064 if (_sensor_i2c_interface_info.parent_struct.properties == NULL)
8065 goto out;
8066 for (n = 0; _sensor_i2c_interface_info.parent_struct.properties[n] != NULL; n++)
8067 {
8068 GDBusPropertyInfo *info = _sensor_i2c_interface_info.parent_struct.properties[n];
8069 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
8070 {
8071 GVariant *value;
8072 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);
8073 if (value != NULL)
8074 {
8075 g_variant_take_ref (value);
8076 g_variant_builder_add (&builder, "{sv}", info->name, value);
8077 g_variant_unref (value);
8078 }
8079 }
8080 }
8081out:
8082 return g_variant_builder_end (&builder);
8083}
8084
8085static gboolean _sensor_i2c_emit_changed (gpointer user_data);
8086
8087static void
8088sensor_i2c_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
8089{
8090 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (_skeleton);
8091 gboolean emit_changed = FALSE;
8092
8093 g_mutex_lock (&skeleton->priv->lock);
8094 if (skeleton->priv->changed_properties_idle_source != NULL)
8095 {
8096 g_source_destroy (skeleton->priv->changed_properties_idle_source);
8097 skeleton->priv->changed_properties_idle_source = NULL;
8098 emit_changed = TRUE;
8099 }
8100 g_mutex_unlock (&skeleton->priv->lock);
8101
8102 if (emit_changed)
8103 _sensor_i2c_emit_changed (skeleton);
8104}
8105
8106static void sensor_i2c_skeleton_iface_init (SensorI2cIface *iface);
8107#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
8108G_DEFINE_TYPE_WITH_CODE (SensorI2cSkeleton, sensor_i2c_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
8109 G_ADD_PRIVATE (SensorI2cSkeleton)
8110 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_skeleton_iface_init));
8111
8112#else
8113G_DEFINE_TYPE_WITH_CODE (SensorI2cSkeleton, sensor_i2c_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
8114 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_skeleton_iface_init));
8115
8116#endif
8117static void
8118sensor_i2c_skeleton_finalize (GObject *object)
8119{
8120 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
8121 guint n;
8122 for (n = 0; n < 2; n++)
8123 g_value_unset (&skeleton->priv->properties[n]);
8124 g_free (skeleton->priv->properties);
8125 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
8126 if (skeleton->priv->changed_properties_idle_source != NULL)
8127 g_source_destroy (skeleton->priv->changed_properties_idle_source);
8128 g_main_context_unref (skeleton->priv->context);
8129 g_mutex_clear (&skeleton->priv->lock);
8130 G_OBJECT_CLASS (sensor_i2c_skeleton_parent_class)->finalize (object);
8131}
8132
8133static void
8134sensor_i2c_skeleton_get_property (GObject *object,
8135 guint prop_id,
8136 GValue *value,
8137 GParamSpec *pspec G_GNUC_UNUSED)
8138{
8139 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
8140 g_assert (prop_id != 0 && prop_id - 1 < 2);
8141 g_mutex_lock (&skeleton->priv->lock);
8142 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
8143 g_mutex_unlock (&skeleton->priv->lock);
8144}
8145
8146static gboolean
8147_sensor_i2c_emit_changed (gpointer user_data)
8148{
8149 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data);
8150 GList *l;
8151 GVariantBuilder builder;
8152 GVariantBuilder invalidated_builder;
8153 guint num_changes;
8154
8155 g_mutex_lock (&skeleton->priv->lock);
8156 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
8157 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
8158 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
8159 {
8160 ChangedProperty *cp = l->data;
8161 GVariant *variant;
8162 const GValue *cur_value;
8163
8164 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
8165 if (!_g_value_equal (cur_value, &cp->orig_value))
8166 {
8167 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
8168 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
8169 g_variant_unref (variant);
8170 num_changes++;
8171 }
8172 }
8173 if (num_changes > 0)
8174 {
8175 GList *connections, *ll;
8176 GVariant *signal_variant;
8177 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorI2c",
8178 &builder, &invalidated_builder));
8179 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
8180 for (ll = connections; ll != NULL; ll = ll->next)
8181 {
8182 GDBusConnection *connection = ll->data;
8183
8184 g_dbus_connection_emit_signal (connection,
8185 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
8186 "org.freedesktop.DBus.Properties",
8187 "PropertiesChanged",
8188 signal_variant,
8189 NULL);
8190 }
8191 g_variant_unref (signal_variant);
8192 g_list_free_full (connections, g_object_unref);
8193 }
8194 else
8195 {
8196 g_variant_builder_clear (&builder);
8197 g_variant_builder_clear (&invalidated_builder);
8198 }
8199 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
8200 skeleton->priv->changed_properties = NULL;
8201 skeleton->priv->changed_properties_idle_source = NULL;
8202 g_mutex_unlock (&skeleton->priv->lock);
8203 return FALSE;
8204}
8205
8206static void
8207_sensor_i2c_schedule_emit_changed (SensorI2cSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
8208{
8209 ChangedProperty *cp;
8210 GList *l;
8211 cp = NULL;
8212 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
8213 {
8214 ChangedProperty *i_cp = l->data;
8215 if (i_cp->info == info)
8216 {
8217 cp = i_cp;
8218 break;
8219 }
8220 }
8221 if (cp == NULL)
8222 {
8223 cp = g_new0 (ChangedProperty, 1);
8224 cp->prop_id = prop_id;
8225 cp->info = info;
8226 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
8227 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
8228 g_value_copy (orig_value, &cp->orig_value);
8229 }
8230}
8231
8232static void
8233sensor_i2c_skeleton_notify (GObject *object,
8234 GParamSpec *pspec G_GNUC_UNUSED)
8235{
8236 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
8237 g_mutex_lock (&skeleton->priv->lock);
8238 if (skeleton->priv->changed_properties != NULL &&
8239 skeleton->priv->changed_properties_idle_source == NULL)
8240 {
8241 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
8242 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
8243 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_i2c_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
8244 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
8245 g_source_unref (skeleton->priv->changed_properties_idle_source);
8246 }
8247 g_mutex_unlock (&skeleton->priv->lock);
8248}
8249
8250static void
8251sensor_i2c_skeleton_set_property (GObject *object,
8252 guint prop_id,
8253 const GValue *value,
8254 GParamSpec *pspec)
8255{
8256 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
8257 g_assert (prop_id != 0 && prop_id - 1 < 2);
8258 g_mutex_lock (&skeleton->priv->lock);
8259 g_object_freeze_notify (object);
8260 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
8261 {
8262 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
8263 _sensor_i2c_schedule_emit_changed (skeleton, _sensor_i2c_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
8264 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
8265 g_object_notify_by_pspec (object, pspec);
8266 }
8267 g_mutex_unlock (&skeleton->priv->lock);
8268 g_object_thaw_notify (object);
8269}
8270
8271static void
8272sensor_i2c_skeleton_init (SensorI2cSkeleton *skeleton)
8273{
8274#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
8275 skeleton->priv = sensor_i2c_skeleton_get_instance_private (skeleton);
8276#else
8277 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_I2C_SKELETON, SensorI2cSkeletonPrivate);
8278#endif
8279
8280 g_mutex_init (&skeleton->priv->lock);
8281 skeleton->priv->context = g_main_context_ref_thread_default ();
8282 skeleton->priv->properties = g_new0 (GValue, 2);
8283 g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING);
8284 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
8285}
8286
8287static const gchar *
8288sensor_i2c_skeleton_get_dev_path (SensorI2c *object)
8289{
8290 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
8291 const gchar *value;
8292 g_mutex_lock (&skeleton->priv->lock);
8293 value = g_value_get_string (&(skeleton->priv->properties[0]));
8294 g_mutex_unlock (&skeleton->priv->lock);
8295 return value;
8296}
8297
8298static const gchar *
8299sensor_i2c_skeleton_get_address (SensorI2c *object)
8300{
8301 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
8302 const gchar *value;
8303 g_mutex_lock (&skeleton->priv->lock);
8304 value = g_value_get_string (&(skeleton->priv->properties[1]));
8305 g_mutex_unlock (&skeleton->priv->lock);
8306 return value;
8307}
8308
8309static void
8310sensor_i2c_skeleton_class_init (SensorI2cSkeletonClass *klass)
8311{
8312 GObjectClass *gobject_class;
8313 GDBusInterfaceSkeletonClass *skeleton_class;
8314
8315 gobject_class = G_OBJECT_CLASS (klass);
8316 gobject_class->finalize = sensor_i2c_skeleton_finalize;
8317 gobject_class->get_property = sensor_i2c_skeleton_get_property;
8318 gobject_class->set_property = sensor_i2c_skeleton_set_property;
8319 gobject_class->notify = sensor_i2c_skeleton_notify;
8320
8321
8322 sensor_i2c_override_properties (gobject_class, 1);
8323
8324 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
8325 skeleton_class->get_info = sensor_i2c_skeleton_dbus_interface_get_info;
8326 skeleton_class->get_properties = sensor_i2c_skeleton_dbus_interface_get_properties;
8327 skeleton_class->flush = sensor_i2c_skeleton_dbus_interface_flush;
8328 skeleton_class->get_vtable = sensor_i2c_skeleton_dbus_interface_get_vtable;
8329
8330#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
8331 g_type_class_add_private (klass, sizeof (SensorI2cSkeletonPrivate));
8332#endif
8333}
8334
8335static void
8336sensor_i2c_skeleton_iface_init (SensorI2cIface *iface)
8337{
8338 iface->get_dev_path = sensor_i2c_skeleton_get_dev_path;
8339 iface->get_address = sensor_i2c_skeleton_get_address;
8340}
8341
8342/**
8343 * sensor_i2c_skeleton_new:
8344 *
8345 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>.
8346 *
8347 * Returns: (transfer full) (type SensorI2cSkeleton): The skeleton object.
8348 */
8349SensorI2c *
8350sensor_i2c_skeleton_new (void)
8351{
8352 return SENSOR_I2C (g_object_new (TYPE_SENSOR_I2C_SKELETON, NULL));
8353}
8354
8355/* ------------------------------------------------------------------------
8356 * Code for interface org.openbmc.SensorMatch
8357 * ------------------------------------------------------------------------
8358 */
8359
8360/**
8361 * SECTION:SensorMatch
8362 * @title: SensorMatch
8363 * @short_description: Generated C code for the org.openbmc.SensorMatch D-Bus interface
8364 *
8365 * 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.
8366 */
8367
8368/* ---- Introspection data for org.openbmc.SensorMatch ---- */
8369
8370static const _ExtendedGDBusArgInfo _sensor_match_signal_info_sensor_match_ARG_state =
8371{
8372 {
8373 -1,
8374 (gchar *) "state",
8375 (gchar *) "y",
8376 NULL
8377 },
8378 FALSE
8379};
8380
8381static const _ExtendedGDBusArgInfo * const _sensor_match_signal_info_sensor_match_ARG_pointers[] =
8382{
8383 &_sensor_match_signal_info_sensor_match_ARG_state,
8384 NULL
8385};
8386
8387static const _ExtendedGDBusSignalInfo _sensor_match_signal_info_sensor_match =
8388{
8389 {
8390 -1,
8391 (gchar *) "SensorMatch",
8392 (GDBusArgInfo **) &_sensor_match_signal_info_sensor_match_ARG_pointers,
8393 NULL
8394 },
8395 "sensor-match"
8396};
8397
8398static const _ExtendedGDBusSignalInfo * const _sensor_match_signal_info_pointers[] =
8399{
8400 &_sensor_match_signal_info_sensor_match,
8401 NULL
8402};
8403
8404static const _ExtendedGDBusPropertyInfo _sensor_match_property_info_match_value =
8405{
8406 {
8407 -1,
8408 (gchar *) "match_value",
8409 (gchar *) "v",
8410 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
8411 NULL
8412 },
8413 "match-value",
8414 FALSE
8415};
8416
8417static const _ExtendedGDBusPropertyInfo _sensor_match_property_info_state =
8418{
8419 {
8420 -1,
8421 (gchar *) "state",
8422 (gchar *) "y",
8423 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
8424 NULL
8425 },
8426 "state",
8427 FALSE
8428};
8429
8430static const _ExtendedGDBusPropertyInfo * const _sensor_match_property_info_pointers[] =
8431{
8432 &_sensor_match_property_info_match_value,
8433 &_sensor_match_property_info_state,
8434 NULL
8435};
8436
8437static const _ExtendedGDBusInterfaceInfo _sensor_match_interface_info =
8438{
8439 {
8440 -1,
8441 (gchar *) "org.openbmc.SensorMatch",
8442 NULL,
8443 (GDBusSignalInfo **) &_sensor_match_signal_info_pointers,
8444 (GDBusPropertyInfo **) &_sensor_match_property_info_pointers,
8445 NULL
8446 },
8447 "sensor-match",
8448};
8449
8450
8451/**
8452 * sensor_match_interface_info:
8453 *
8454 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link> D-Bus interface.
8455 *
8456 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
8457 */
8458GDBusInterfaceInfo *
8459sensor_match_interface_info (void)
8460{
8461 return (GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct;
8462}
8463
8464/**
8465 * sensor_match_override_properties:
8466 * @klass: The class structure for a #GObject<!-- -->-derived class.
8467 * @property_id_begin: The property id to assign to the first overridden property.
8468 *
8469 * Overrides all #GObject properties in the #SensorMatch interface for a concrete class.
8470 * The properties are overridden in the order they are defined.
8471 *
8472 * Returns: The last property id.
8473 */
8474guint
8475sensor_match_override_properties (GObjectClass *klass, guint property_id_begin)
8476{
8477 g_object_class_override_property (klass, property_id_begin++, "match-value");
8478 g_object_class_override_property (klass, property_id_begin++, "state");
8479 return property_id_begin - 1;
8480}
8481
8482
8483
8484/**
8485 * SensorMatch:
8486 *
8487 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>.
8488 */
8489
8490/**
8491 * SensorMatchIface:
8492 * @parent_iface: The parent interface.
8493 * @get_match_value: Getter for the #SensorMatch:match-value property.
8494 * @get_state: Getter for the #SensorMatch:state property.
8495 * @sensor_match: Handler for the #SensorMatch::sensor-match signal.
8496 *
8497 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>.
8498 */
8499
8500typedef SensorMatchIface SensorMatchInterface;
8501G_DEFINE_INTERFACE (SensorMatch, sensor_match, G_TYPE_OBJECT);
8502
8503static void
8504sensor_match_default_init (SensorMatchIface *iface)
8505{
8506 /* GObject signals for received D-Bus signals: */
8507 /**
8508 * SensorMatch::sensor-match:
8509 * @object: A #SensorMatch.
8510 * @arg_state: Argument.
8511 *
8512 * 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.
8513 *
8514 * 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.
8515 */
8516 g_signal_new ("sensor-match",
8517 G_TYPE_FROM_INTERFACE (iface),
8518 G_SIGNAL_RUN_LAST,
8519 G_STRUCT_OFFSET (SensorMatchIface, sensor_match),
8520 NULL,
8521 NULL,
8522 g_cclosure_marshal_generic,
8523 G_TYPE_NONE,
8524 1, G_TYPE_UCHAR);
8525
8526 /* GObject properties for D-Bus properties: */
8527 /**
8528 * SensorMatch:match-value:
8529 *
8530 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link>.
8531 *
8532 * 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.
8533 */
8534 g_object_interface_install_property (iface,
8535 g_param_spec_variant ("match-value", "match_value", "match_value", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
8536 /**
8537 * SensorMatch:state:
8538 *
8539 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorMatch.state">"state"</link>.
8540 *
8541 * 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.
8542 */
8543 g_object_interface_install_property (iface,
8544 g_param_spec_uchar ("state", "state", "state", 0, 255, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
8545}
8546
8547/**
8548 * sensor_match_get_match_value: (skip)
8549 * @object: A #SensorMatch.
8550 *
8551 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link> D-Bus property.
8552 *
8553 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
8554 *
8555 * <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>
8556 *
8557 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
8558 */
8559GVariant *
8560sensor_match_get_match_value (SensorMatch *object)
8561{
8562 return SENSOR_MATCH_GET_IFACE (object)->get_match_value (object);
8563}
8564
8565/**
8566 * sensor_match_dup_match_value: (skip)
8567 * @object: A #SensorMatch.
8568 *
8569 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link> D-Bus property.
8570 *
8571 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
8572 *
8573 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
8574 */
8575GVariant *
8576sensor_match_dup_match_value (SensorMatch *object)
8577{
8578 GVariant *value;
8579 g_object_get (G_OBJECT (object), "match-value", &value, NULL);
8580 return value;
8581}
8582
8583/**
8584 * sensor_match_set_match_value: (skip)
8585 * @object: A #SensorMatch.
8586 * @value: The value to set.
8587 *
8588 * Sets the <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link> D-Bus property to @value.
8589 *
8590 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
8591 */
8592void
8593sensor_match_set_match_value (SensorMatch *object, GVariant *value)
8594{
8595 g_object_set (G_OBJECT (object), "match-value", value, NULL);
8596}
8597
8598/**
8599 * sensor_match_get_state: (skip)
8600 * @object: A #SensorMatch.
8601 *
8602 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorMatch.state">"state"</link> D-Bus property.
8603 *
8604 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
8605 *
8606 * Returns: The property value.
8607 */
8608guchar
8609sensor_match_get_state (SensorMatch *object)
8610{
8611 return SENSOR_MATCH_GET_IFACE (object)->get_state (object);
8612}
8613
8614/**
8615 * sensor_match_set_state: (skip)
8616 * @object: A #SensorMatch.
8617 * @value: The value to set.
8618 *
8619 * Sets the <link linkend="gdbus-property-org-openbmc-SensorMatch.state">"state"</link> D-Bus property to @value.
8620 *
8621 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
8622 */
8623void
8624sensor_match_set_state (SensorMatch *object, guchar value)
8625{
8626 g_object_set (G_OBJECT (object), "state", value, NULL);
8627}
8628
8629/**
8630 * sensor_match_emit_sensor_match:
8631 * @object: A #SensorMatch.
8632 * @arg_state: Argument to pass with the signal.
8633 *
8634 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorMatch.SensorMatch">"SensorMatch"</link> D-Bus signal.
8635 */
8636void
8637sensor_match_emit_sensor_match (
8638 SensorMatch *object,
8639 guchar arg_state)
8640{
8641 g_signal_emit_by_name (object, "sensor-match", arg_state);
8642}
8643
8644/* ------------------------------------------------------------------------ */
8645
8646/**
8647 * SensorMatchProxy:
8648 *
8649 * The #SensorMatchProxy structure contains only private data and should only be accessed using the provided API.
8650 */
8651
8652/**
8653 * SensorMatchProxyClass:
8654 * @parent_class: The parent class.
8655 *
8656 * Class structure for #SensorMatchProxy.
8657 */
8658
8659struct _SensorMatchProxyPrivate
8660{
8661 GData *qdata;
8662};
8663
8664static void sensor_match_proxy_iface_init (SensorMatchIface *iface);
8665
8666#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
8667G_DEFINE_TYPE_WITH_CODE (SensorMatchProxy, sensor_match_proxy, G_TYPE_DBUS_PROXY,
8668 G_ADD_PRIVATE (SensorMatchProxy)
8669 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_proxy_iface_init));
8670
8671#else
8672G_DEFINE_TYPE_WITH_CODE (SensorMatchProxy, sensor_match_proxy, G_TYPE_DBUS_PROXY,
8673 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_proxy_iface_init));
8674
8675#endif
8676static void
8677sensor_match_proxy_finalize (GObject *object)
8678{
8679 SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (object);
8680 g_datalist_clear (&proxy->priv->qdata);
8681 G_OBJECT_CLASS (sensor_match_proxy_parent_class)->finalize (object);
8682}
8683
8684static void
8685sensor_match_proxy_get_property (GObject *object,
8686 guint prop_id,
8687 GValue *value,
8688 GParamSpec *pspec G_GNUC_UNUSED)
8689{
8690 const _ExtendedGDBusPropertyInfo *info;
8691 GVariant *variant;
8692 g_assert (prop_id != 0 && prop_id - 1 < 2);
8693 info = _sensor_match_property_info_pointers[prop_id - 1];
8694 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
8695 if (info->use_gvariant)
8696 {
8697 g_value_set_variant (value, variant);
8698 }
8699 else
8700 {
8701 if (variant != NULL)
8702 g_dbus_gvariant_to_gvalue (variant, value);
8703 }
8704 if (variant != NULL)
8705 g_variant_unref (variant);
8706}
8707
8708static void
8709sensor_match_proxy_set_property_cb (GDBusProxy *proxy,
8710 GAsyncResult *res,
8711 gpointer user_data)
8712{
8713 const _ExtendedGDBusPropertyInfo *info = user_data;
8714 GError *error;
8715 GVariant *_ret;
8716 error = NULL;
8717 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
8718 if (!_ret)
8719 {
8720 g_warning ("Error setting property '%s' on interface org.openbmc.SensorMatch: %s (%s, %d)",
8721 info->parent_struct.name,
8722 error->message, g_quark_to_string (error->domain), error->code);
8723 g_error_free (error);
8724 }
8725 else
8726 {
8727 g_variant_unref (_ret);
8728 }
8729}
8730
8731static void
8732sensor_match_proxy_set_property (GObject *object,
8733 guint prop_id,
8734 const GValue *value,
8735 GParamSpec *pspec G_GNUC_UNUSED)
8736{
8737 const _ExtendedGDBusPropertyInfo *info;
8738 GVariant *variant;
8739 g_assert (prop_id != 0 && prop_id - 1 < 2);
8740 info = _sensor_match_property_info_pointers[prop_id - 1];
8741 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
8742 g_dbus_proxy_call (G_DBUS_PROXY (object),
8743 "org.freedesktop.DBus.Properties.Set",
8744 g_variant_new ("(ssv)", "org.openbmc.SensorMatch", info->parent_struct.name, variant),
8745 G_DBUS_CALL_FLAGS_NONE,
8746 -1,
8747 NULL, (GAsyncReadyCallback) sensor_match_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
8748 g_variant_unref (variant);
8749}
8750
8751static void
8752sensor_match_proxy_g_signal (GDBusProxy *proxy,
8753 const gchar *sender_name G_GNUC_UNUSED,
8754 const gchar *signal_name,
8755 GVariant *parameters)
8756{
8757 _ExtendedGDBusSignalInfo *info;
8758 GVariantIter iter;
8759 GVariant *child;
8760 GValue *paramv;
8761 guint num_params;
8762 guint n;
8763 guint signal_id;
8764 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, signal_name);
8765 if (info == NULL)
8766 return;
8767 num_params = g_variant_n_children (parameters);
8768 paramv = g_new0 (GValue, num_params + 1);
8769 g_value_init (&paramv[0], TYPE_SENSOR_MATCH);
8770 g_value_set_object (&paramv[0], proxy);
8771 g_variant_iter_init (&iter, parameters);
8772 n = 1;
8773 while ((child = g_variant_iter_next_value (&iter)) != NULL)
8774 {
8775 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
8776 if (arg_info->use_gvariant)
8777 {
8778 g_value_init (&paramv[n], G_TYPE_VARIANT);
8779 g_value_set_variant (&paramv[n], child);
8780 n++;
8781 }
8782 else
8783 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
8784 g_variant_unref (child);
8785 }
8786 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_MATCH);
8787 g_signal_emitv (paramv, signal_id, 0, NULL);
8788 for (n = 0; n < num_params + 1; n++)
8789 g_value_unset (&paramv[n]);
8790 g_free (paramv);
8791}
8792
8793static void
8794sensor_match_proxy_g_properties_changed (GDBusProxy *_proxy,
8795 GVariant *changed_properties,
8796 const gchar *const *invalidated_properties)
8797{
8798 SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (_proxy);
8799 guint n;
8800 const gchar *key;
8801 GVariantIter *iter;
8802 _ExtendedGDBusPropertyInfo *info;
8803 g_variant_get (changed_properties, "a{sv}", &iter);
8804 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
8805 {
8806 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, key);
8807 g_datalist_remove_data (&proxy->priv->qdata, key);
8808 if (info != NULL)
8809 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
8810 }
8811 g_variant_iter_free (iter);
8812 for (n = 0; invalidated_properties[n] != NULL; n++)
8813 {
8814 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, invalidated_properties[n]);
8815 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
8816 if (info != NULL)
8817 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
8818 }
8819}
8820
8821static GVariant *
8822sensor_match_proxy_get_match_value (SensorMatch *object)
8823{
8824 SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (object);
8825 GVariant *variant;
8826 GVariant *value = NULL;
8827 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "match_value");
8828 value = variant;
8829 if (variant != NULL)
8830 g_variant_unref (variant);
8831 return value;
8832}
8833
8834static guchar
8835sensor_match_proxy_get_state (SensorMatch *object)
8836{
8837 SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (object);
8838 GVariant *variant;
8839 guchar value = 0;
8840 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state");
8841 if (variant != NULL)
8842 {
8843 value = g_variant_get_byte (variant);
8844 g_variant_unref (variant);
8845 }
8846 return value;
8847}
8848
8849static void
8850sensor_match_proxy_init (SensorMatchProxy *proxy)
8851{
8852#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
8853 proxy->priv = sensor_match_proxy_get_instance_private (proxy);
8854#else
8855 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_MATCH_PROXY, SensorMatchProxyPrivate);
8856#endif
8857
8858 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_match_interface_info ());
8859}
8860
8861static void
8862sensor_match_proxy_class_init (SensorMatchProxyClass *klass)
8863{
8864 GObjectClass *gobject_class;
8865 GDBusProxyClass *proxy_class;
8866
8867 gobject_class = G_OBJECT_CLASS (klass);
8868 gobject_class->finalize = sensor_match_proxy_finalize;
8869 gobject_class->get_property = sensor_match_proxy_get_property;
8870 gobject_class->set_property = sensor_match_proxy_set_property;
8871
8872 proxy_class = G_DBUS_PROXY_CLASS (klass);
8873 proxy_class->g_signal = sensor_match_proxy_g_signal;
8874 proxy_class->g_properties_changed = sensor_match_proxy_g_properties_changed;
8875
8876 sensor_match_override_properties (gobject_class, 1);
8877
8878#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
8879 g_type_class_add_private (klass, sizeof (SensorMatchProxyPrivate));
8880#endif
8881}
8882
8883static void
8884sensor_match_proxy_iface_init (SensorMatchIface *iface)
8885{
8886 iface->get_match_value = sensor_match_proxy_get_match_value;
8887 iface->get_state = sensor_match_proxy_get_state;
8888}
8889
8890/**
8891 * sensor_match_proxy_new:
8892 * @connection: A #GDBusConnection.
8893 * @flags: Flags from the #GDBusProxyFlags enumeration.
8894 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
8895 * @object_path: An object path.
8896 * @cancellable: (allow-none): A #GCancellable or %NULL.
8897 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
8898 * @user_data: User data to pass to @callback.
8899 *
8900 * 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.
8901 *
8902 * 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.
8903 * You can then call sensor_match_proxy_new_finish() to get the result of the operation.
8904 *
8905 * See sensor_match_proxy_new_sync() for the synchronous, blocking version of this constructor.
8906 */
8907void
8908sensor_match_proxy_new (
8909 GDBusConnection *connection,
8910 GDBusProxyFlags flags,
8911 const gchar *name,
8912 const gchar *object_path,
8913 GCancellable *cancellable,
8914 GAsyncReadyCallback callback,
8915 gpointer user_data)
8916{
8917 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);
8918}
8919
8920/**
8921 * sensor_match_proxy_new_finish:
8922 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_match_proxy_new().
8923 * @error: Return location for error or %NULL
8924 *
8925 * Finishes an operation started with sensor_match_proxy_new().
8926 *
8927 * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set.
8928 */
8929SensorMatch *
8930sensor_match_proxy_new_finish (
8931 GAsyncResult *res,
8932 GError **error)
8933{
8934 GObject *ret;
8935 GObject *source_object;
8936 source_object = g_async_result_get_source_object (res);
8937 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
8938 g_object_unref (source_object);
8939 if (ret != NULL)
8940 return SENSOR_MATCH (ret);
8941 else
8942 return NULL;
8943}
8944
8945/**
8946 * sensor_match_proxy_new_sync:
8947 * @connection: A #GDBusConnection.
8948 * @flags: Flags from the #GDBusProxyFlags enumeration.
8949 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
8950 * @object_path: An object path.
8951 * @cancellable: (allow-none): A #GCancellable or %NULL.
8952 * @error: Return location for error or %NULL
8953 *
8954 * 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.
8955 *
8956 * The calling thread is blocked until a reply is received.
8957 *
8958 * See sensor_match_proxy_new() for the asynchronous version of this constructor.
8959 *
8960 * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set.
8961 */
8962SensorMatch *
8963sensor_match_proxy_new_sync (
8964 GDBusConnection *connection,
8965 GDBusProxyFlags flags,
8966 const gchar *name,
8967 const gchar *object_path,
8968 GCancellable *cancellable,
8969 GError **error)
8970{
8971 GInitable *ret;
8972 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);
8973 if (ret != NULL)
8974 return SENSOR_MATCH (ret);
8975 else
8976 return NULL;
8977}
8978
8979
8980/**
8981 * sensor_match_proxy_new_for_bus:
8982 * @bus_type: A #GBusType.
8983 * @flags: Flags from the #GDBusProxyFlags enumeration.
8984 * @name: A bus name (well-known or unique).
8985 * @object_path: An object path.
8986 * @cancellable: (allow-none): A #GCancellable or %NULL.
8987 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
8988 * @user_data: User data to pass to @callback.
8989 *
8990 * Like sensor_match_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
8991 *
8992 * 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.
8993 * You can then call sensor_match_proxy_new_for_bus_finish() to get the result of the operation.
8994 *
8995 * See sensor_match_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
8996 */
8997void
8998sensor_match_proxy_new_for_bus (
8999 GBusType bus_type,
9000 GDBusProxyFlags flags,
9001 const gchar *name,
9002 const gchar *object_path,
9003 GCancellable *cancellable,
9004 GAsyncReadyCallback callback,
9005 gpointer user_data)
9006{
9007 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);
9008}
9009
9010/**
9011 * sensor_match_proxy_new_for_bus_finish:
9012 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_match_proxy_new_for_bus().
9013 * @error: Return location for error or %NULL
9014 *
9015 * Finishes an operation started with sensor_match_proxy_new_for_bus().
9016 *
9017 * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set.
9018 */
9019SensorMatch *
9020sensor_match_proxy_new_for_bus_finish (
9021 GAsyncResult *res,
9022 GError **error)
9023{
9024 GObject *ret;
9025 GObject *source_object;
9026 source_object = g_async_result_get_source_object (res);
9027 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
9028 g_object_unref (source_object);
9029 if (ret != NULL)
9030 return SENSOR_MATCH (ret);
9031 else
9032 return NULL;
9033}
9034
9035/**
9036 * sensor_match_proxy_new_for_bus_sync:
9037 * @bus_type: A #GBusType.
9038 * @flags: Flags from the #GDBusProxyFlags enumeration.
9039 * @name: A bus name (well-known or unique).
9040 * @object_path: An object path.
9041 * @cancellable: (allow-none): A #GCancellable or %NULL.
9042 * @error: Return location for error or %NULL
9043 *
9044 * Like sensor_match_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
9045 *
9046 * The calling thread is blocked until a reply is received.
9047 *
9048 * See sensor_match_proxy_new_for_bus() for the asynchronous version of this constructor.
9049 *
9050 * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set.
9051 */
9052SensorMatch *
9053sensor_match_proxy_new_for_bus_sync (
9054 GBusType bus_type,
9055 GDBusProxyFlags flags,
9056 const gchar *name,
9057 const gchar *object_path,
9058 GCancellable *cancellable,
9059 GError **error)
9060{
9061 GInitable *ret;
9062 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);
9063 if (ret != NULL)
9064 return SENSOR_MATCH (ret);
9065 else
9066 return NULL;
9067}
9068
9069
9070/* ------------------------------------------------------------------------ */
9071
9072/**
9073 * SensorMatchSkeleton:
9074 *
9075 * The #SensorMatchSkeleton structure contains only private data and should only be accessed using the provided API.
9076 */
9077
9078/**
9079 * SensorMatchSkeletonClass:
9080 * @parent_class: The parent class.
9081 *
9082 * Class structure for #SensorMatchSkeleton.
9083 */
9084
9085struct _SensorMatchSkeletonPrivate
9086{
9087 GValue *properties;
9088 GList *changed_properties;
9089 GSource *changed_properties_idle_source;
9090 GMainContext *context;
9091 GMutex lock;
9092};
9093
9094static void
9095_sensor_match_skeleton_handle_method_call (
9096 GDBusConnection *connection G_GNUC_UNUSED,
9097 const gchar *sender G_GNUC_UNUSED,
9098 const gchar *object_path G_GNUC_UNUSED,
9099 const gchar *interface_name,
9100 const gchar *method_name,
9101 GVariant *parameters,
9102 GDBusMethodInvocation *invocation,
9103 gpointer user_data)
9104{
9105 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data);
9106 _ExtendedGDBusMethodInfo *info;
9107 GVariantIter iter;
9108 GVariant *child;
9109 GValue *paramv;
9110 guint num_params;
9111 guint num_extra;
9112 guint n;
9113 guint signal_id;
9114 GValue return_value = G_VALUE_INIT;
9115 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
9116 g_assert (info != NULL);
9117 num_params = g_variant_n_children (parameters);
9118 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
9119 n = 0;
9120 g_value_init (&paramv[n], TYPE_SENSOR_MATCH);
9121 g_value_set_object (&paramv[n++], skeleton);
9122 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
9123 g_value_set_object (&paramv[n++], invocation);
9124 if (info->pass_fdlist)
9125 {
9126#ifdef G_OS_UNIX
9127 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
9128 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
9129#else
9130 g_assert_not_reached ();
9131#endif
9132 }
9133 g_variant_iter_init (&iter, parameters);
9134 while ((child = g_variant_iter_next_value (&iter)) != NULL)
9135 {
9136 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
9137 if (arg_info->use_gvariant)
9138 {
9139 g_value_init (&paramv[n], G_TYPE_VARIANT);
9140 g_value_set_variant (&paramv[n], child);
9141 n++;
9142 }
9143 else
9144 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
9145 g_variant_unref (child);
9146 }
9147 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_MATCH);
9148 g_value_init (&return_value, G_TYPE_BOOLEAN);
9149 g_signal_emitv (paramv, signal_id, 0, &return_value);
9150 if (!g_value_get_boolean (&return_value))
9151 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);
9152 g_value_unset (&return_value);
9153 for (n = 0; n < num_params + num_extra; n++)
9154 g_value_unset (&paramv[n]);
9155 g_free (paramv);
9156}
9157
9158static GVariant *
9159_sensor_match_skeleton_handle_get_property (
9160 GDBusConnection *connection G_GNUC_UNUSED,
9161 const gchar *sender G_GNUC_UNUSED,
9162 const gchar *object_path G_GNUC_UNUSED,
9163 const gchar *interface_name G_GNUC_UNUSED,
9164 const gchar *property_name,
9165 GError **error,
9166 gpointer user_data)
9167{
9168 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data);
9169 GValue value = G_VALUE_INIT;
9170 GParamSpec *pspec;
9171 _ExtendedGDBusPropertyInfo *info;
9172 GVariant *ret;
9173 ret = NULL;
9174 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, property_name);
9175 g_assert (info != NULL);
9176 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
9177 if (pspec == NULL)
9178 {
9179 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
9180 }
9181 else
9182 {
9183 g_value_init (&value, pspec->value_type);
9184 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
9185 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
9186 g_value_unset (&value);
9187 }
9188 return ret;
9189}
9190
9191static gboolean
9192_sensor_match_skeleton_handle_set_property (
9193 GDBusConnection *connection G_GNUC_UNUSED,
9194 const gchar *sender G_GNUC_UNUSED,
9195 const gchar *object_path G_GNUC_UNUSED,
9196 const gchar *interface_name G_GNUC_UNUSED,
9197 const gchar *property_name,
9198 GVariant *variant,
9199 GError **error,
9200 gpointer user_data)
9201{
9202 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data);
9203 GValue value = G_VALUE_INIT;
9204 GParamSpec *pspec;
9205 _ExtendedGDBusPropertyInfo *info;
9206 gboolean ret;
9207 ret = FALSE;
9208 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, property_name);
9209 g_assert (info != NULL);
9210 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
9211 if (pspec == NULL)
9212 {
9213 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
9214 }
9215 else
9216 {
9217 if (info->use_gvariant)
9218 g_value_set_variant (&value, variant);
9219 else
9220 g_dbus_gvariant_to_gvalue (variant, &value);
9221 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
9222 g_value_unset (&value);
9223 ret = TRUE;
9224 }
9225 return ret;
9226}
9227
9228static const GDBusInterfaceVTable _sensor_match_skeleton_vtable =
9229{
9230 _sensor_match_skeleton_handle_method_call,
9231 _sensor_match_skeleton_handle_get_property,
9232 _sensor_match_skeleton_handle_set_property,
9233 {NULL}
9234};
9235
9236static GDBusInterfaceInfo *
9237sensor_match_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
9238{
9239 return sensor_match_interface_info ();
9240}
9241
9242static GDBusInterfaceVTable *
9243sensor_match_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
9244{
9245 return (GDBusInterfaceVTable *) &_sensor_match_skeleton_vtable;
9246}
9247
9248static GVariant *
9249sensor_match_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
9250{
9251 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (_skeleton);
9252
9253 GVariantBuilder builder;
9254 guint n;
9255 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
9256 if (_sensor_match_interface_info.parent_struct.properties == NULL)
9257 goto out;
9258 for (n = 0; _sensor_match_interface_info.parent_struct.properties[n] != NULL; n++)
9259 {
9260 GDBusPropertyInfo *info = _sensor_match_interface_info.parent_struct.properties[n];
9261 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
9262 {
9263 GVariant *value;
9264 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);
9265 if (value != NULL)
9266 {
9267 g_variant_take_ref (value);
9268 g_variant_builder_add (&builder, "{sv}", info->name, value);
9269 g_variant_unref (value);
9270 }
9271 }
9272 }
9273out:
9274 return g_variant_builder_end (&builder);
9275}
9276
9277static gboolean _sensor_match_emit_changed (gpointer user_data);
9278
9279static void
9280sensor_match_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
9281{
9282 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (_skeleton);
9283 gboolean emit_changed = FALSE;
9284
9285 g_mutex_lock (&skeleton->priv->lock);
9286 if (skeleton->priv->changed_properties_idle_source != NULL)
9287 {
9288 g_source_destroy (skeleton->priv->changed_properties_idle_source);
9289 skeleton->priv->changed_properties_idle_source = NULL;
9290 emit_changed = TRUE;
9291 }
9292 g_mutex_unlock (&skeleton->priv->lock);
9293
9294 if (emit_changed)
9295 _sensor_match_emit_changed (skeleton);
9296}
9297
9298static void
9299_sensor_match_on_signal_sensor_match (
9300 SensorMatch *object,
9301 guchar arg_state)
9302{
9303 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
9304
9305 GList *connections, *l;
9306 GVariant *signal_variant;
9307 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
9308
9309 signal_variant = g_variant_ref_sink (g_variant_new ("(y)",
9310 arg_state));
9311 for (l = connections; l != NULL; l = l->next)
9312 {
9313 GDBusConnection *connection = l->data;
9314 g_dbus_connection_emit_signal (connection,
9315 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorMatch", "SensorMatch",
9316 signal_variant, NULL);
9317 }
9318 g_variant_unref (signal_variant);
9319 g_list_free_full (connections, g_object_unref);
9320}
9321
9322static void sensor_match_skeleton_iface_init (SensorMatchIface *iface);
9323#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
9324G_DEFINE_TYPE_WITH_CODE (SensorMatchSkeleton, sensor_match_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
9325 G_ADD_PRIVATE (SensorMatchSkeleton)
9326 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_skeleton_iface_init));
9327
9328#else
9329G_DEFINE_TYPE_WITH_CODE (SensorMatchSkeleton, sensor_match_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
9330 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_skeleton_iface_init));
9331
9332#endif
9333static void
9334sensor_match_skeleton_finalize (GObject *object)
9335{
9336 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
9337 guint n;
9338 for (n = 0; n < 2; n++)
9339 g_value_unset (&skeleton->priv->properties[n]);
9340 g_free (skeleton->priv->properties);
9341 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
9342 if (skeleton->priv->changed_properties_idle_source != NULL)
9343 g_source_destroy (skeleton->priv->changed_properties_idle_source);
9344 g_main_context_unref (skeleton->priv->context);
9345 g_mutex_clear (&skeleton->priv->lock);
9346 G_OBJECT_CLASS (sensor_match_skeleton_parent_class)->finalize (object);
9347}
9348
9349static void
9350sensor_match_skeleton_get_property (GObject *object,
9351 guint prop_id,
9352 GValue *value,
9353 GParamSpec *pspec G_GNUC_UNUSED)
9354{
9355 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
9356 g_assert (prop_id != 0 && prop_id - 1 < 2);
9357 g_mutex_lock (&skeleton->priv->lock);
9358 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
9359 g_mutex_unlock (&skeleton->priv->lock);
9360}
9361
9362static gboolean
9363_sensor_match_emit_changed (gpointer user_data)
9364{
9365 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data);
9366 GList *l;
9367 GVariantBuilder builder;
9368 GVariantBuilder invalidated_builder;
9369 guint num_changes;
9370
9371 g_mutex_lock (&skeleton->priv->lock);
9372 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
9373 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
9374 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
9375 {
9376 ChangedProperty *cp = l->data;
9377 GVariant *variant;
9378 const GValue *cur_value;
9379
9380 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
9381 if (!_g_value_equal (cur_value, &cp->orig_value))
9382 {
9383 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
9384 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
9385 g_variant_unref (variant);
9386 num_changes++;
9387 }
9388 }
9389 if (num_changes > 0)
9390 {
9391 GList *connections, *ll;
9392 GVariant *signal_variant;
9393 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorMatch",
9394 &builder, &invalidated_builder));
9395 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
9396 for (ll = connections; ll != NULL; ll = ll->next)
9397 {
9398 GDBusConnection *connection = ll->data;
9399
9400 g_dbus_connection_emit_signal (connection,
9401 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
9402 "org.freedesktop.DBus.Properties",
9403 "PropertiesChanged",
9404 signal_variant,
9405 NULL);
9406 }
9407 g_variant_unref (signal_variant);
9408 g_list_free_full (connections, g_object_unref);
9409 }
9410 else
9411 {
9412 g_variant_builder_clear (&builder);
9413 g_variant_builder_clear (&invalidated_builder);
9414 }
9415 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
9416 skeleton->priv->changed_properties = NULL;
9417 skeleton->priv->changed_properties_idle_source = NULL;
9418 g_mutex_unlock (&skeleton->priv->lock);
9419 return FALSE;
9420}
9421
9422static void
9423_sensor_match_schedule_emit_changed (SensorMatchSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
9424{
9425 ChangedProperty *cp;
9426 GList *l;
9427 cp = NULL;
9428 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
9429 {
9430 ChangedProperty *i_cp = l->data;
9431 if (i_cp->info == info)
9432 {
9433 cp = i_cp;
9434 break;
9435 }
9436 }
9437 if (cp == NULL)
9438 {
9439 cp = g_new0 (ChangedProperty, 1);
9440 cp->prop_id = prop_id;
9441 cp->info = info;
9442 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
9443 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
9444 g_value_copy (orig_value, &cp->orig_value);
9445 }
9446}
9447
9448static void
9449sensor_match_skeleton_notify (GObject *object,
9450 GParamSpec *pspec G_GNUC_UNUSED)
9451{
9452 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
9453 g_mutex_lock (&skeleton->priv->lock);
9454 if (skeleton->priv->changed_properties != NULL &&
9455 skeleton->priv->changed_properties_idle_source == NULL)
9456 {
9457 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
9458 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
9459 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_match_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
9460 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
9461 g_source_unref (skeleton->priv->changed_properties_idle_source);
9462 }
9463 g_mutex_unlock (&skeleton->priv->lock);
9464}
9465
9466static void
9467sensor_match_skeleton_set_property (GObject *object,
9468 guint prop_id,
9469 const GValue *value,
9470 GParamSpec *pspec)
9471{
9472 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
9473 g_assert (prop_id != 0 && prop_id - 1 < 2);
9474 g_mutex_lock (&skeleton->priv->lock);
9475 g_object_freeze_notify (object);
9476 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
9477 {
9478 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
9479 _sensor_match_schedule_emit_changed (skeleton, _sensor_match_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
9480 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
9481 g_object_notify_by_pspec (object, pspec);
9482 }
9483 g_mutex_unlock (&skeleton->priv->lock);
9484 g_object_thaw_notify (object);
9485}
9486
9487static void
9488sensor_match_skeleton_init (SensorMatchSkeleton *skeleton)
9489{
9490#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
9491 skeleton->priv = sensor_match_skeleton_get_instance_private (skeleton);
9492#else
9493 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_MATCH_SKELETON, SensorMatchSkeletonPrivate);
9494#endif
9495
9496 g_mutex_init (&skeleton->priv->lock);
9497 skeleton->priv->context = g_main_context_ref_thread_default ();
9498 skeleton->priv->properties = g_new0 (GValue, 2);
9499 g_value_init (&skeleton->priv->properties[0], G_TYPE_VARIANT);
9500 g_value_init (&skeleton->priv->properties[1], G_TYPE_UCHAR);
9501}
9502
9503static GVariant *
9504sensor_match_skeleton_get_match_value (SensorMatch *object)
9505{
9506 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
9507 GVariant *value;
9508 g_mutex_lock (&skeleton->priv->lock);
9509 value = g_value_get_variant (&(skeleton->priv->properties[0]));
9510 g_mutex_unlock (&skeleton->priv->lock);
9511 return value;
9512}
9513
9514static guchar
9515sensor_match_skeleton_get_state (SensorMatch *object)
9516{
9517 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
9518 guchar value;
9519 g_mutex_lock (&skeleton->priv->lock);
9520 value = g_value_get_uchar (&(skeleton->priv->properties[1]));
9521 g_mutex_unlock (&skeleton->priv->lock);
9522 return value;
9523}
9524
9525static void
9526sensor_match_skeleton_class_init (SensorMatchSkeletonClass *klass)
9527{
9528 GObjectClass *gobject_class;
9529 GDBusInterfaceSkeletonClass *skeleton_class;
9530
9531 gobject_class = G_OBJECT_CLASS (klass);
9532 gobject_class->finalize = sensor_match_skeleton_finalize;
9533 gobject_class->get_property = sensor_match_skeleton_get_property;
9534 gobject_class->set_property = sensor_match_skeleton_set_property;
9535 gobject_class->notify = sensor_match_skeleton_notify;
9536
9537
9538 sensor_match_override_properties (gobject_class, 1);
9539
9540 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
9541 skeleton_class->get_info = sensor_match_skeleton_dbus_interface_get_info;
9542 skeleton_class->get_properties = sensor_match_skeleton_dbus_interface_get_properties;
9543 skeleton_class->flush = sensor_match_skeleton_dbus_interface_flush;
9544 skeleton_class->get_vtable = sensor_match_skeleton_dbus_interface_get_vtable;
9545
9546#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
9547 g_type_class_add_private (klass, sizeof (SensorMatchSkeletonPrivate));
9548#endif
9549}
9550
9551static void
9552sensor_match_skeleton_iface_init (SensorMatchIface *iface)
9553{
9554 iface->sensor_match = _sensor_match_on_signal_sensor_match;
9555 iface->get_match_value = sensor_match_skeleton_get_match_value;
9556 iface->get_state = sensor_match_skeleton_get_state;
9557}
9558
9559/**
9560 * sensor_match_skeleton_new:
9561 *
9562 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>.
9563 *
9564 * Returns: (transfer full) (type SensorMatchSkeleton): The skeleton object.
9565 */
9566SensorMatch *
9567sensor_match_skeleton_new (void)
9568{
9569 return SENSOR_MATCH (g_object_new (TYPE_SENSOR_MATCH_SKELETON, NULL));
9570}
9571
9572/* ------------------------------------------------------------------------
9573 * Code for interface org.openbmc.Process
9574 * ------------------------------------------------------------------------
9575 */
9576
9577/**
9578 * SECTION:Process
9579 * @title: Process
9580 * @short_description: Generated C code for the org.openbmc.Process D-Bus interface
9581 *
9582 * 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.
9583 */
9584
9585/* ---- Introspection data for org.openbmc.Process ---- */
9586
9587static const _ExtendedGDBusMethodInfo _process_method_info_stop =
9588{
9589 {
9590 -1,
9591 (gchar *) "stop",
9592 NULL,
9593 NULL,
9594 NULL
9595 },
9596 "handle-stop",
9597 FALSE
9598};
9599
9600static const _ExtendedGDBusMethodInfo * const _process_method_info_pointers[] =
9601{
9602 &_process_method_info_stop,
9603 NULL
9604};
9605
9606static const _ExtendedGDBusInterfaceInfo _process_interface_info =
9607{
9608 {
9609 -1,
9610 (gchar *) "org.openbmc.Process",
9611 (GDBusMethodInfo **) &_process_method_info_pointers,
9612 NULL,
9613 NULL,
9614 NULL
9615 },
9616 "process",
9617};
9618
9619
9620/**
9621 * process_interface_info:
9622 *
9623 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link> D-Bus interface.
9624 *
9625 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
9626 */
9627GDBusInterfaceInfo *
9628process_interface_info (void)
9629{
9630 return (GDBusInterfaceInfo *) &_process_interface_info.parent_struct;
9631}
9632
9633/**
9634 * process_override_properties:
9635 * @klass: The class structure for a #GObject<!-- -->-derived class.
9636 * @property_id_begin: The property id to assign to the first overridden property.
9637 *
9638 * Overrides all #GObject properties in the #Process interface for a concrete class.
9639 * The properties are overridden in the order they are defined.
9640 *
9641 * Returns: The last property id.
9642 */
9643guint
9644process_override_properties (GObjectClass *klass, guint property_id_begin)
9645{
9646 return property_id_begin - 1;
9647}
9648
9649
9650
9651/**
9652 * Process:
9653 *
9654 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link>.
9655 */
9656
9657/**
9658 * ProcessIface:
9659 * @parent_iface: The parent interface.
9660 * @handle_stop: Handler for the #Process::handle-stop signal.
9661 *
9662 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link>.
9663 */
9664
9665typedef ProcessIface ProcessInterface;
9666G_DEFINE_INTERFACE (Process, process, G_TYPE_OBJECT);
9667
9668static void
9669process_default_init (ProcessIface *iface)
9670{
9671 /* GObject signals for incoming D-Bus method calls: */
9672 /**
9673 * Process::handle-stop:
9674 * @object: A #Process.
9675 * @invocation: A #GDBusMethodInvocation.
9676 *
9677 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Process.stop">stop()</link> D-Bus method.
9678 *
9679 * 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.
9680 *
9681 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
9682 */
9683 g_signal_new ("handle-stop",
9684 G_TYPE_FROM_INTERFACE (iface),
9685 G_SIGNAL_RUN_LAST,
9686 G_STRUCT_OFFSET (ProcessIface, handle_stop),
9687 g_signal_accumulator_true_handled,
9688 NULL,
9689 g_cclosure_marshal_generic,
9690 G_TYPE_BOOLEAN,
9691 1,
9692 G_TYPE_DBUS_METHOD_INVOCATION);
9693
9694}
9695
9696/**
9697 * process_call_stop:
9698 * @proxy: A #ProcessProxy.
9699 * @cancellable: (allow-none): A #GCancellable or %NULL.
9700 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
9701 * @user_data: User data to pass to @callback.
9702 *
9703 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Process.stop">stop()</link> D-Bus method on @proxy.
9704 * 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.
9705 * You can then call process_call_stop_finish() to get the result of the operation.
9706 *
9707 * See process_call_stop_sync() for the synchronous, blocking version of this method.
9708 */
9709void
9710process_call_stop (
9711 Process *proxy,
9712 GCancellable *cancellable,
9713 GAsyncReadyCallback callback,
9714 gpointer user_data)
9715{
9716 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
9717 "stop",
9718 g_variant_new ("()"),
9719 G_DBUS_CALL_FLAGS_NONE,
9720 -1,
9721 cancellable,
9722 callback,
9723 user_data);
9724}
9725
9726/**
9727 * process_call_stop_finish:
9728 * @proxy: A #ProcessProxy.
9729 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to process_call_stop().
9730 * @error: Return location for error or %NULL.
9731 *
9732 * Finishes an operation started with process_call_stop().
9733 *
9734 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
9735 */
9736gboolean
9737process_call_stop_finish (
9738 Process *proxy,
9739 GAsyncResult *res,
9740 GError **error)
9741{
9742 GVariant *_ret;
9743 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
9744 if (_ret == NULL)
9745 goto _out;
9746 g_variant_get (_ret,
9747 "()");
9748 g_variant_unref (_ret);
9749_out:
9750 return _ret != NULL;
9751}
9752
9753/**
9754 * process_call_stop_sync:
9755 * @proxy: A #ProcessProxy.
9756 * @cancellable: (allow-none): A #GCancellable or %NULL.
9757 * @error: Return location for error or %NULL.
9758 *
9759 * 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.
9760 *
9761 * See process_call_stop() for the asynchronous version of this method.
9762 *
9763 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
9764 */
9765gboolean
9766process_call_stop_sync (
9767 Process *proxy,
9768 GCancellable *cancellable,
9769 GError **error)
9770{
9771 GVariant *_ret;
9772 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
9773 "stop",
9774 g_variant_new ("()"),
9775 G_DBUS_CALL_FLAGS_NONE,
9776 -1,
9777 cancellable,
9778 error);
9779 if (_ret == NULL)
9780 goto _out;
9781 g_variant_get (_ret,
9782 "()");
9783 g_variant_unref (_ret);
9784_out:
9785 return _ret != NULL;
9786}
9787
9788/**
9789 * process_complete_stop:
9790 * @object: A #Process.
9791 * @invocation: (transfer full): A #GDBusMethodInvocation.
9792 *
9793 * 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.
9794 *
9795 * This method will free @invocation, you cannot use it afterwards.
9796 */
9797void
9798process_complete_stop (
9799 Process *object,
9800 GDBusMethodInvocation *invocation)
9801{
9802 g_dbus_method_invocation_return_value (invocation,
9803 g_variant_new ("()"));
9804}
9805
9806/* ------------------------------------------------------------------------ */
9807
9808/**
9809 * ProcessProxy:
9810 *
9811 * The #ProcessProxy structure contains only private data and should only be accessed using the provided API.
9812 */
9813
9814/**
9815 * ProcessProxyClass:
9816 * @parent_class: The parent class.
9817 *
9818 * Class structure for #ProcessProxy.
9819 */
9820
9821struct _ProcessProxyPrivate
9822{
9823 GData *qdata;
9824};
9825
9826static void process_proxy_iface_init (ProcessIface *iface);
9827
9828#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
9829G_DEFINE_TYPE_WITH_CODE (ProcessProxy, process_proxy, G_TYPE_DBUS_PROXY,
9830 G_ADD_PRIVATE (ProcessProxy)
9831 G_IMPLEMENT_INTERFACE (TYPE_PROCESS, process_proxy_iface_init));
9832
9833#else
9834G_DEFINE_TYPE_WITH_CODE (ProcessProxy, process_proxy, G_TYPE_DBUS_PROXY,
9835 G_IMPLEMENT_INTERFACE (TYPE_PROCESS, process_proxy_iface_init));
9836
9837#endif
9838static void
9839process_proxy_finalize (GObject *object)
9840{
9841 ProcessProxy *proxy = PROCESS_PROXY (object);
9842 g_datalist_clear (&proxy->priv->qdata);
9843 G_OBJECT_CLASS (process_proxy_parent_class)->finalize (object);
9844}
9845
9846static void
9847process_proxy_get_property (GObject *object,
9848 guint prop_id,
9849 GValue *value,
9850 GParamSpec *pspec G_GNUC_UNUSED)
9851{
9852}
9853
9854static void
9855process_proxy_set_property (GObject *object,
9856 guint prop_id,
9857 const GValue *value,
9858 GParamSpec *pspec G_GNUC_UNUSED)
9859{
9860}
9861
9862static void
9863process_proxy_g_signal (GDBusProxy *proxy,
9864 const gchar *sender_name G_GNUC_UNUSED,
9865 const gchar *signal_name,
9866 GVariant *parameters)
9867{
9868 _ExtendedGDBusSignalInfo *info;
9869 GVariantIter iter;
9870 GVariant *child;
9871 GValue *paramv;
9872 guint num_params;
9873 guint n;
9874 guint signal_id;
9875 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, signal_name);
9876 if (info == NULL)
9877 return;
9878 num_params = g_variant_n_children (parameters);
9879 paramv = g_new0 (GValue, num_params + 1);
9880 g_value_init (&paramv[0], TYPE_PROCESS);
9881 g_value_set_object (&paramv[0], proxy);
9882 g_variant_iter_init (&iter, parameters);
9883 n = 1;
9884 while ((child = g_variant_iter_next_value (&iter)) != NULL)
9885 {
9886 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
9887 if (arg_info->use_gvariant)
9888 {
9889 g_value_init (&paramv[n], G_TYPE_VARIANT);
9890 g_value_set_variant (&paramv[n], child);
9891 n++;
9892 }
9893 else
9894 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
9895 g_variant_unref (child);
9896 }
9897 signal_id = g_signal_lookup (info->signal_name, TYPE_PROCESS);
9898 g_signal_emitv (paramv, signal_id, 0, NULL);
9899 for (n = 0; n < num_params + 1; n++)
9900 g_value_unset (&paramv[n]);
9901 g_free (paramv);
9902}
9903
9904static void
9905process_proxy_g_properties_changed (GDBusProxy *_proxy,
9906 GVariant *changed_properties,
9907 const gchar *const *invalidated_properties)
9908{
9909 ProcessProxy *proxy = PROCESS_PROXY (_proxy);
9910 guint n;
9911 const gchar *key;
9912 GVariantIter *iter;
9913 _ExtendedGDBusPropertyInfo *info;
9914 g_variant_get (changed_properties, "a{sv}", &iter);
9915 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
9916 {
9917 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, key);
9918 g_datalist_remove_data (&proxy->priv->qdata, key);
9919 if (info != NULL)
9920 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
9921 }
9922 g_variant_iter_free (iter);
9923 for (n = 0; invalidated_properties[n] != NULL; n++)
9924 {
9925 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, invalidated_properties[n]);
9926 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
9927 if (info != NULL)
9928 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
9929 }
9930}
9931
9932static void
9933process_proxy_init (ProcessProxy *proxy)
9934{
9935#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
9936 proxy->priv = process_proxy_get_instance_private (proxy);
9937#else
9938 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_PROCESS_PROXY, ProcessProxyPrivate);
9939#endif
9940
9941 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), process_interface_info ());
9942}
9943
9944static void
9945process_proxy_class_init (ProcessProxyClass *klass)
9946{
9947 GObjectClass *gobject_class;
9948 GDBusProxyClass *proxy_class;
9949
9950 gobject_class = G_OBJECT_CLASS (klass);
9951 gobject_class->finalize = process_proxy_finalize;
9952 gobject_class->get_property = process_proxy_get_property;
9953 gobject_class->set_property = process_proxy_set_property;
9954
9955 proxy_class = G_DBUS_PROXY_CLASS (klass);
9956 proxy_class->g_signal = process_proxy_g_signal;
9957 proxy_class->g_properties_changed = process_proxy_g_properties_changed;
9958
9959#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
9960 g_type_class_add_private (klass, sizeof (ProcessProxyPrivate));
9961#endif
9962}
9963
9964static void
9965process_proxy_iface_init (ProcessIface *iface)
9966{
9967}
9968
9969/**
9970 * process_proxy_new:
9971 * @connection: A #GDBusConnection.
9972 * @flags: Flags from the #GDBusProxyFlags enumeration.
9973 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
9974 * @object_path: An object path.
9975 * @cancellable: (allow-none): A #GCancellable or %NULL.
9976 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
9977 * @user_data: User data to pass to @callback.
9978 *
9979 * 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.
9980 *
9981 * 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.
9982 * You can then call process_proxy_new_finish() to get the result of the operation.
9983 *
9984 * See process_proxy_new_sync() for the synchronous, blocking version of this constructor.
9985 */
9986void
9987process_proxy_new (
9988 GDBusConnection *connection,
9989 GDBusProxyFlags flags,
9990 const gchar *name,
9991 const gchar *object_path,
9992 GCancellable *cancellable,
9993 GAsyncReadyCallback callback,
9994 gpointer user_data)
9995{
9996 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);
9997}
9998
9999/**
10000 * process_proxy_new_finish:
10001 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to process_proxy_new().
10002 * @error: Return location for error or %NULL
10003 *
10004 * Finishes an operation started with process_proxy_new().
10005 *
10006 * Returns: (transfer full) (type ProcessProxy): The constructed proxy object or %NULL if @error is set.
10007 */
10008Process *
10009process_proxy_new_finish (
10010 GAsyncResult *res,
10011 GError **error)
10012{
10013 GObject *ret;
10014 GObject *source_object;
10015 source_object = g_async_result_get_source_object (res);
10016 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
10017 g_object_unref (source_object);
10018 if (ret != NULL)
10019 return PROCESS (ret);
10020 else
10021 return NULL;
10022}
10023
10024/**
10025 * process_proxy_new_sync:
10026 * @connection: A #GDBusConnection.
10027 * @flags: Flags from the #GDBusProxyFlags enumeration.
10028 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
10029 * @object_path: An object path.
10030 * @cancellable: (allow-none): A #GCancellable or %NULL.
10031 * @error: Return location for error or %NULL
10032 *
10033 * 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.
10034 *
10035 * The calling thread is blocked until a reply is received.
10036 *
10037 * See process_proxy_new() for the asynchronous version of this constructor.
10038 *
10039 * Returns: (transfer full) (type ProcessProxy): The constructed proxy object or %NULL if @error is set.
10040 */
10041Process *
10042process_proxy_new_sync (
10043 GDBusConnection *connection,
10044 GDBusProxyFlags flags,
10045 const gchar *name,
10046 const gchar *object_path,
10047 GCancellable *cancellable,
10048 GError **error)
10049{
10050 GInitable *ret;
10051 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);
10052 if (ret != NULL)
10053 return PROCESS (ret);
10054 else
10055 return NULL;
10056}
10057
10058
10059/**
10060 * process_proxy_new_for_bus:
10061 * @bus_type: A #GBusType.
10062 * @flags: Flags from the #GDBusProxyFlags enumeration.
10063 * @name: A bus name (well-known or unique).
10064 * @object_path: An object path.
10065 * @cancellable: (allow-none): A #GCancellable or %NULL.
10066 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
10067 * @user_data: User data to pass to @callback.
10068 *
10069 * Like process_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
10070 *
10071 * 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.
10072 * You can then call process_proxy_new_for_bus_finish() to get the result of the operation.
10073 *
10074 * See process_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
10075 */
10076void
10077process_proxy_new_for_bus (
10078 GBusType bus_type,
10079 GDBusProxyFlags flags,
10080 const gchar *name,
10081 const gchar *object_path,
10082 GCancellable *cancellable,
10083 GAsyncReadyCallback callback,
10084 gpointer user_data)
10085{
10086 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);
10087}
10088
10089/**
10090 * process_proxy_new_for_bus_finish:
10091 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to process_proxy_new_for_bus().
10092 * @error: Return location for error or %NULL
10093 *
10094 * Finishes an operation started with process_proxy_new_for_bus().
10095 *
10096 * Returns: (transfer full) (type ProcessProxy): The constructed proxy object or %NULL if @error is set.
10097 */
10098Process *
10099process_proxy_new_for_bus_finish (
10100 GAsyncResult *res,
10101 GError **error)
10102{
10103 GObject *ret;
10104 GObject *source_object;
10105 source_object = g_async_result_get_source_object (res);
10106 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
10107 g_object_unref (source_object);
10108 if (ret != NULL)
10109 return PROCESS (ret);
10110 else
10111 return NULL;
10112}
10113
10114/**
10115 * process_proxy_new_for_bus_sync:
10116 * @bus_type: A #GBusType.
10117 * @flags: Flags from the #GDBusProxyFlags enumeration.
10118 * @name: A bus name (well-known or unique).
10119 * @object_path: An object path.
10120 * @cancellable: (allow-none): A #GCancellable or %NULL.
10121 * @error: Return location for error or %NULL
10122 *
10123 * Like process_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
10124 *
10125 * The calling thread is blocked until a reply is received.
10126 *
10127 * See process_proxy_new_for_bus() for the asynchronous version of this constructor.
10128 *
10129 * Returns: (transfer full) (type ProcessProxy): The constructed proxy object or %NULL if @error is set.
10130 */
10131Process *
10132process_proxy_new_for_bus_sync (
10133 GBusType bus_type,
10134 GDBusProxyFlags flags,
10135 const gchar *name,
10136 const gchar *object_path,
10137 GCancellable *cancellable,
10138 GError **error)
10139{
10140 GInitable *ret;
10141 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);
10142 if (ret != NULL)
10143 return PROCESS (ret);
10144 else
10145 return NULL;
10146}
10147
10148
10149/* ------------------------------------------------------------------------ */
10150
10151/**
10152 * ProcessSkeleton:
10153 *
10154 * The #ProcessSkeleton structure contains only private data and should only be accessed using the provided API.
10155 */
10156
10157/**
10158 * ProcessSkeletonClass:
10159 * @parent_class: The parent class.
10160 *
10161 * Class structure for #ProcessSkeleton.
10162 */
10163
10164struct _ProcessSkeletonPrivate
10165{
10166 GValue *properties;
10167 GList *changed_properties;
10168 GSource *changed_properties_idle_source;
10169 GMainContext *context;
10170 GMutex lock;
10171};
10172
10173static void
10174_process_skeleton_handle_method_call (
10175 GDBusConnection *connection G_GNUC_UNUSED,
10176 const gchar *sender G_GNUC_UNUSED,
10177 const gchar *object_path G_GNUC_UNUSED,
10178 const gchar *interface_name,
10179 const gchar *method_name,
10180 GVariant *parameters,
10181 GDBusMethodInvocation *invocation,
10182 gpointer user_data)
10183{
10184 ProcessSkeleton *skeleton = PROCESS_SKELETON (user_data);
10185 _ExtendedGDBusMethodInfo *info;
10186 GVariantIter iter;
10187 GVariant *child;
10188 GValue *paramv;
10189 guint num_params;
10190 guint num_extra;
10191 guint n;
10192 guint signal_id;
10193 GValue return_value = G_VALUE_INIT;
10194 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
10195 g_assert (info != NULL);
10196 num_params = g_variant_n_children (parameters);
10197 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
10198 n = 0;
10199 g_value_init (&paramv[n], TYPE_PROCESS);
10200 g_value_set_object (&paramv[n++], skeleton);
10201 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
10202 g_value_set_object (&paramv[n++], invocation);
10203 if (info->pass_fdlist)
10204 {
10205#ifdef G_OS_UNIX
10206 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
10207 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
10208#else
10209 g_assert_not_reached ();
10210#endif
10211 }
10212 g_variant_iter_init (&iter, parameters);
10213 while ((child = g_variant_iter_next_value (&iter)) != NULL)
10214 {
10215 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
10216 if (arg_info->use_gvariant)
10217 {
10218 g_value_init (&paramv[n], G_TYPE_VARIANT);
10219 g_value_set_variant (&paramv[n], child);
10220 n++;
10221 }
10222 else
10223 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
10224 g_variant_unref (child);
10225 }
10226 signal_id = g_signal_lookup (info->signal_name, TYPE_PROCESS);
10227 g_value_init (&return_value, G_TYPE_BOOLEAN);
10228 g_signal_emitv (paramv, signal_id, 0, &return_value);
10229 if (!g_value_get_boolean (&return_value))
10230 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);
10231 g_value_unset (&return_value);
10232 for (n = 0; n < num_params + num_extra; n++)
10233 g_value_unset (&paramv[n]);
10234 g_free (paramv);
10235}
10236
10237static GVariant *
10238_process_skeleton_handle_get_property (
10239 GDBusConnection *connection G_GNUC_UNUSED,
10240 const gchar *sender G_GNUC_UNUSED,
10241 const gchar *object_path G_GNUC_UNUSED,
10242 const gchar *interface_name G_GNUC_UNUSED,
10243 const gchar *property_name,
10244 GError **error,
10245 gpointer user_data)
10246{
10247 ProcessSkeleton *skeleton = PROCESS_SKELETON (user_data);
10248 GValue value = G_VALUE_INIT;
10249 GParamSpec *pspec;
10250 _ExtendedGDBusPropertyInfo *info;
10251 GVariant *ret;
10252 ret = NULL;
10253 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, property_name);
10254 g_assert (info != NULL);
10255 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
10256 if (pspec == NULL)
10257 {
10258 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
10259 }
10260 else
10261 {
10262 g_value_init (&value, pspec->value_type);
10263 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
10264 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
10265 g_value_unset (&value);
10266 }
10267 return ret;
10268}
10269
10270static gboolean
10271_process_skeleton_handle_set_property (
10272 GDBusConnection *connection G_GNUC_UNUSED,
10273 const gchar *sender G_GNUC_UNUSED,
10274 const gchar *object_path G_GNUC_UNUSED,
10275 const gchar *interface_name G_GNUC_UNUSED,
10276 const gchar *property_name,
10277 GVariant *variant,
10278 GError **error,
10279 gpointer user_data)
10280{
10281 ProcessSkeleton *skeleton = PROCESS_SKELETON (user_data);
10282 GValue value = G_VALUE_INIT;
10283 GParamSpec *pspec;
10284 _ExtendedGDBusPropertyInfo *info;
10285 gboolean ret;
10286 ret = FALSE;
10287 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, property_name);
10288 g_assert (info != NULL);
10289 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
10290 if (pspec == NULL)
10291 {
10292 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
10293 }
10294 else
10295 {
10296 if (info->use_gvariant)
10297 g_value_set_variant (&value, variant);
10298 else
10299 g_dbus_gvariant_to_gvalue (variant, &value);
10300 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
10301 g_value_unset (&value);
10302 ret = TRUE;
10303 }
10304 return ret;
10305}
10306
10307static const GDBusInterfaceVTable _process_skeleton_vtable =
10308{
10309 _process_skeleton_handle_method_call,
10310 _process_skeleton_handle_get_property,
10311 _process_skeleton_handle_set_property,
10312 {NULL}
10313};
10314
10315static GDBusInterfaceInfo *
10316process_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
10317{
10318 return process_interface_info ();
10319}
10320
10321static GDBusInterfaceVTable *
10322process_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
10323{
10324 return (GDBusInterfaceVTable *) &_process_skeleton_vtable;
10325}
10326
10327static GVariant *
10328process_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
10329{
10330 ProcessSkeleton *skeleton = PROCESS_SKELETON (_skeleton);
10331
10332 GVariantBuilder builder;
10333 guint n;
10334 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
10335 if (_process_interface_info.parent_struct.properties == NULL)
10336 goto out;
10337 for (n = 0; _process_interface_info.parent_struct.properties[n] != NULL; n++)
10338 {
10339 GDBusPropertyInfo *info = _process_interface_info.parent_struct.properties[n];
10340 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
10341 {
10342 GVariant *value;
10343 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);
10344 if (value != NULL)
10345 {
10346 g_variant_take_ref (value);
10347 g_variant_builder_add (&builder, "{sv}", info->name, value);
10348 g_variant_unref (value);
10349 }
10350 }
10351 }
10352out:
10353 return g_variant_builder_end (&builder);
10354}
10355
10356static void
10357process_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
10358{
10359}
10360
10361static void process_skeleton_iface_init (ProcessIface *iface);
10362#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
10363G_DEFINE_TYPE_WITH_CODE (ProcessSkeleton, process_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
10364 G_ADD_PRIVATE (ProcessSkeleton)
10365 G_IMPLEMENT_INTERFACE (TYPE_PROCESS, process_skeleton_iface_init));
10366
10367#else
10368G_DEFINE_TYPE_WITH_CODE (ProcessSkeleton, process_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
10369 G_IMPLEMENT_INTERFACE (TYPE_PROCESS, process_skeleton_iface_init));
10370
10371#endif
10372static void
10373process_skeleton_finalize (GObject *object)
10374{
10375 ProcessSkeleton *skeleton = PROCESS_SKELETON (object);
10376 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
10377 if (skeleton->priv->changed_properties_idle_source != NULL)
10378 g_source_destroy (skeleton->priv->changed_properties_idle_source);
10379 g_main_context_unref (skeleton->priv->context);
10380 g_mutex_clear (&skeleton->priv->lock);
10381 G_OBJECT_CLASS (process_skeleton_parent_class)->finalize (object);
10382}
10383
10384static void
10385process_skeleton_init (ProcessSkeleton *skeleton)
10386{
10387#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
10388 skeleton->priv = process_skeleton_get_instance_private (skeleton);
10389#else
10390 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_PROCESS_SKELETON, ProcessSkeletonPrivate);
10391#endif
10392
10393 g_mutex_init (&skeleton->priv->lock);
10394 skeleton->priv->context = g_main_context_ref_thread_default ();
10395}
10396
10397static void
10398process_skeleton_class_init (ProcessSkeletonClass *klass)
10399{
10400 GObjectClass *gobject_class;
10401 GDBusInterfaceSkeletonClass *skeleton_class;
10402
10403 gobject_class = G_OBJECT_CLASS (klass);
10404 gobject_class->finalize = process_skeleton_finalize;
10405
10406 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
10407 skeleton_class->get_info = process_skeleton_dbus_interface_get_info;
10408 skeleton_class->get_properties = process_skeleton_dbus_interface_get_properties;
10409 skeleton_class->flush = process_skeleton_dbus_interface_flush;
10410 skeleton_class->get_vtable = process_skeleton_dbus_interface_get_vtable;
10411
10412#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
10413 g_type_class_add_private (klass, sizeof (ProcessSkeletonPrivate));
10414#endif
10415}
10416
10417static void
10418process_skeleton_iface_init (ProcessIface *iface)
10419{
10420}
10421
10422/**
10423 * process_skeleton_new:
10424 *
10425 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link>.
10426 *
10427 * Returns: (transfer full) (type ProcessSkeleton): The skeleton object.
10428 */
10429Process *
10430process_skeleton_new (void)
10431{
10432 return PROCESS (g_object_new (TYPE_PROCESS_SKELETON, NULL));
10433}
10434
10435/* ------------------------------------------------------------------------
Norman James18998182015-10-11 21:54:53 -050010436 * Code for interface org.openbmc.SharedResource
10437 * ------------------------------------------------------------------------
10438 */
10439
10440/**
10441 * SECTION:SharedResource
10442 * @title: SharedResource
10443 * @short_description: Generated C code for the org.openbmc.SharedResource D-Bus interface
10444 *
10445 * 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.
10446 */
10447
10448/* ---- Introspection data for org.openbmc.SharedResource ---- */
10449
10450static const _ExtendedGDBusArgInfo _shared_resource_method_info_lock_IN_ARG_name =
10451{
10452 {
10453 -1,
10454 (gchar *) "name",
10455 (gchar *) "s",
10456 NULL
10457 },
10458 FALSE
10459};
10460
10461static const _ExtendedGDBusArgInfo * const _shared_resource_method_info_lock_IN_ARG_pointers[] =
10462{
10463 &_shared_resource_method_info_lock_IN_ARG_name,
10464 NULL
10465};
10466
10467static const _ExtendedGDBusMethodInfo _shared_resource_method_info_lock =
10468{
10469 {
10470 -1,
10471 (gchar *) "lock",
10472 (GDBusArgInfo **) &_shared_resource_method_info_lock_IN_ARG_pointers,
10473 NULL,
10474 NULL
10475 },
10476 "handle-lock",
10477 FALSE
10478};
10479
10480static const _ExtendedGDBusMethodInfo _shared_resource_method_info_unlock =
10481{
10482 {
10483 -1,
10484 (gchar *) "unlock",
10485 NULL,
10486 NULL,
10487 NULL
10488 },
10489 "handle-unlock",
10490 FALSE
10491};
10492
10493static const _ExtendedGDBusArgInfo _shared_resource_method_info_is_locked_OUT_ARG_lock =
10494{
10495 {
10496 -1,
10497 (gchar *) "lock",
10498 (gchar *) "b",
10499 NULL
10500 },
10501 FALSE
10502};
10503
10504static const _ExtendedGDBusArgInfo _shared_resource_method_info_is_locked_OUT_ARG_name =
10505{
10506 {
10507 -1,
10508 (gchar *) "name",
10509 (gchar *) "s",
10510 NULL
10511 },
10512 FALSE
10513};
10514
10515static const _ExtendedGDBusArgInfo * const _shared_resource_method_info_is_locked_OUT_ARG_pointers[] =
10516{
10517 &_shared_resource_method_info_is_locked_OUT_ARG_lock,
10518 &_shared_resource_method_info_is_locked_OUT_ARG_name,
10519 NULL
10520};
10521
10522static const _ExtendedGDBusMethodInfo _shared_resource_method_info_is_locked =
10523{
10524 {
10525 -1,
10526 (gchar *) "isLocked",
10527 NULL,
10528 (GDBusArgInfo **) &_shared_resource_method_info_is_locked_OUT_ARG_pointers,
10529 NULL
10530 },
10531 "handle-is-locked",
10532 FALSE
10533};
10534
10535static const _ExtendedGDBusMethodInfo * const _shared_resource_method_info_pointers[] =
10536{
10537 &_shared_resource_method_info_lock,
10538 &_shared_resource_method_info_unlock,
10539 &_shared_resource_method_info_is_locked,
10540 NULL
10541};
10542
10543static const _ExtendedGDBusPropertyInfo _shared_resource_property_info_lock =
10544{
10545 {
10546 -1,
10547 (gchar *) "lock",
10548 (gchar *) "b",
10549 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
10550 NULL
10551 },
10552 "lock",
10553 FALSE
10554};
10555
10556static const _ExtendedGDBusPropertyInfo _shared_resource_property_info_name =
10557{
10558 {
10559 -1,
10560 (gchar *) "name",
10561 (gchar *) "s",
10562 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
10563 NULL
10564 },
10565 "name",
10566 FALSE
10567};
10568
10569static const _ExtendedGDBusPropertyInfo * const _shared_resource_property_info_pointers[] =
10570{
10571 &_shared_resource_property_info_lock,
10572 &_shared_resource_property_info_name,
10573 NULL
10574};
10575
10576static const _ExtendedGDBusInterfaceInfo _shared_resource_interface_info =
10577{
10578 {
10579 -1,
10580 (gchar *) "org.openbmc.SharedResource",
10581 (GDBusMethodInfo **) &_shared_resource_method_info_pointers,
10582 NULL,
10583 (GDBusPropertyInfo **) &_shared_resource_property_info_pointers,
10584 NULL
10585 },
10586 "shared-resource",
10587};
10588
10589
10590/**
10591 * shared_resource_interface_info:
10592 *
10593 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link> D-Bus interface.
10594 *
10595 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
10596 */
10597GDBusInterfaceInfo *
10598shared_resource_interface_info (void)
10599{
10600 return (GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct;
10601}
10602
10603/**
10604 * shared_resource_override_properties:
10605 * @klass: The class structure for a #GObject<!-- -->-derived class.
10606 * @property_id_begin: The property id to assign to the first overridden property.
10607 *
10608 * Overrides all #GObject properties in the #SharedResource interface for a concrete class.
10609 * The properties are overridden in the order they are defined.
10610 *
10611 * Returns: The last property id.
10612 */
10613guint
10614shared_resource_override_properties (GObjectClass *klass, guint property_id_begin)
10615{
10616 g_object_class_override_property (klass, property_id_begin++, "lock");
10617 g_object_class_override_property (klass, property_id_begin++, "name");
10618 return property_id_begin - 1;
10619}
10620
10621
10622
10623/**
10624 * SharedResource:
10625 *
10626 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link>.
10627 */
10628
10629/**
10630 * SharedResourceIface:
10631 * @parent_iface: The parent interface.
10632 * @handle_is_locked: Handler for the #SharedResource::handle-is-locked signal.
10633 * @handle_lock: Handler for the #SharedResource::handle-lock signal.
10634 * @handle_unlock: Handler for the #SharedResource::handle-unlock signal.
10635 * @get_lock: Getter for the #SharedResource:lock property.
10636 * @get_name: Getter for the #SharedResource:name property.
10637 *
10638 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link>.
10639 */
10640
10641typedef SharedResourceIface SharedResourceInterface;
10642G_DEFINE_INTERFACE (SharedResource, shared_resource, G_TYPE_OBJECT);
10643
10644static void
10645shared_resource_default_init (SharedResourceIface *iface)
10646{
10647 /* GObject signals for incoming D-Bus method calls: */
10648 /**
10649 * SharedResource::handle-lock:
10650 * @object: A #SharedResource.
10651 * @invocation: A #GDBusMethodInvocation.
10652 * @arg_name: Argument passed by remote caller.
10653 *
10654 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SharedResource.lock">lock()</link> D-Bus method.
10655 *
10656 * 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.
10657 *
10658 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
10659 */
10660 g_signal_new ("handle-lock",
10661 G_TYPE_FROM_INTERFACE (iface),
10662 G_SIGNAL_RUN_LAST,
10663 G_STRUCT_OFFSET (SharedResourceIface, handle_lock),
10664 g_signal_accumulator_true_handled,
10665 NULL,
10666 g_cclosure_marshal_generic,
10667 G_TYPE_BOOLEAN,
10668 2,
10669 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING);
10670
10671 /**
10672 * SharedResource::handle-unlock:
10673 * @object: A #SharedResource.
10674 * @invocation: A #GDBusMethodInvocation.
10675 *
10676 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SharedResource.unlock">unlock()</link> D-Bus method.
10677 *
10678 * 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.
10679 *
10680 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
10681 */
10682 g_signal_new ("handle-unlock",
10683 G_TYPE_FROM_INTERFACE (iface),
10684 G_SIGNAL_RUN_LAST,
10685 G_STRUCT_OFFSET (SharedResourceIface, handle_unlock),
10686 g_signal_accumulator_true_handled,
10687 NULL,
10688 g_cclosure_marshal_generic,
10689 G_TYPE_BOOLEAN,
10690 1,
10691 G_TYPE_DBUS_METHOD_INVOCATION);
10692
10693 /**
10694 * SharedResource::handle-is-locked:
10695 * @object: A #SharedResource.
10696 * @invocation: A #GDBusMethodInvocation.
10697 *
10698 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SharedResource.isLocked">isLocked()</link> D-Bus method.
10699 *
10700 * 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.
10701 *
10702 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
10703 */
10704 g_signal_new ("handle-is-locked",
10705 G_TYPE_FROM_INTERFACE (iface),
10706 G_SIGNAL_RUN_LAST,
10707 G_STRUCT_OFFSET (SharedResourceIface, handle_is_locked),
10708 g_signal_accumulator_true_handled,
10709 NULL,
10710 g_cclosure_marshal_generic,
10711 G_TYPE_BOOLEAN,
10712 1,
10713 G_TYPE_DBUS_METHOD_INVOCATION);
10714
10715 /* GObject properties for D-Bus properties: */
10716 /**
10717 * SharedResource:lock:
10718 *
10719 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SharedResource.lock">"lock"</link>.
10720 *
10721 * 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.
10722 */
10723 g_object_interface_install_property (iface,
10724 g_param_spec_boolean ("lock", "lock", "lock", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
10725 /**
10726 * SharedResource:name:
10727 *
10728 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SharedResource.name">"name"</link>.
10729 *
10730 * 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.
10731 */
10732 g_object_interface_install_property (iface,
10733 g_param_spec_string ("name", "name", "name", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
10734}
10735
10736/**
10737 * shared_resource_get_lock: (skip)
10738 * @object: A #SharedResource.
10739 *
10740 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SharedResource.lock">"lock"</link> D-Bus property.
10741 *
10742 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
10743 *
10744 * Returns: The property value.
10745 */
10746gboolean
10747shared_resource_get_lock (SharedResource *object)
10748{
10749 return SHARED_RESOURCE_GET_IFACE (object)->get_lock (object);
10750}
10751
10752/**
10753 * shared_resource_set_lock: (skip)
10754 * @object: A #SharedResource.
10755 * @value: The value to set.
10756 *
10757 * Sets the <link linkend="gdbus-property-org-openbmc-SharedResource.lock">"lock"</link> D-Bus property to @value.
10758 *
10759 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
10760 */
10761void
10762shared_resource_set_lock (SharedResource *object, gboolean value)
10763{
10764 g_object_set (G_OBJECT (object), "lock", value, NULL);
10765}
10766
10767/**
10768 * shared_resource_get_name: (skip)
10769 * @object: A #SharedResource.
10770 *
10771 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SharedResource.name">"name"</link> D-Bus property.
10772 *
10773 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
10774 *
10775 * <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>
10776 *
10777 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
10778 */
10779const gchar *
10780shared_resource_get_name (SharedResource *object)
10781{
10782 return SHARED_RESOURCE_GET_IFACE (object)->get_name (object);
10783}
10784
10785/**
10786 * shared_resource_dup_name: (skip)
10787 * @object: A #SharedResource.
10788 *
10789 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SharedResource.name">"name"</link> D-Bus property.
10790 *
10791 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
10792 *
10793 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
10794 */
10795gchar *
10796shared_resource_dup_name (SharedResource *object)
10797{
10798 gchar *value;
10799 g_object_get (G_OBJECT (object), "name", &value, NULL);
10800 return value;
10801}
10802
10803/**
10804 * shared_resource_set_name: (skip)
10805 * @object: A #SharedResource.
10806 * @value: The value to set.
10807 *
10808 * Sets the <link linkend="gdbus-property-org-openbmc-SharedResource.name">"name"</link> D-Bus property to @value.
10809 *
10810 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
10811 */
10812void
10813shared_resource_set_name (SharedResource *object, const gchar *value)
10814{
10815 g_object_set (G_OBJECT (object), "name", value, NULL);
10816}
10817
10818/**
10819 * shared_resource_call_lock:
10820 * @proxy: A #SharedResourceProxy.
10821 * @arg_name: Argument to pass with the method invocation.
10822 * @cancellable: (allow-none): A #GCancellable or %NULL.
10823 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
10824 * @user_data: User data to pass to @callback.
10825 *
10826 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SharedResource.lock">lock()</link> D-Bus method on @proxy.
10827 * 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.
10828 * You can then call shared_resource_call_lock_finish() to get the result of the operation.
10829 *
10830 * See shared_resource_call_lock_sync() for the synchronous, blocking version of this method.
10831 */
10832void
10833shared_resource_call_lock (
10834 SharedResource *proxy,
10835 const gchar *arg_name,
10836 GCancellable *cancellable,
10837 GAsyncReadyCallback callback,
10838 gpointer user_data)
10839{
10840 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
10841 "lock",
10842 g_variant_new ("(s)",
10843 arg_name),
10844 G_DBUS_CALL_FLAGS_NONE,
10845 -1,
10846 cancellable,
10847 callback,
10848 user_data);
10849}
10850
10851/**
10852 * shared_resource_call_lock_finish:
10853 * @proxy: A #SharedResourceProxy.
10854 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to shared_resource_call_lock().
10855 * @error: Return location for error or %NULL.
10856 *
10857 * Finishes an operation started with shared_resource_call_lock().
10858 *
10859 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
10860 */
10861gboolean
10862shared_resource_call_lock_finish (
10863 SharedResource *proxy,
10864 GAsyncResult *res,
10865 GError **error)
10866{
10867 GVariant *_ret;
10868 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
10869 if (_ret == NULL)
10870 goto _out;
10871 g_variant_get (_ret,
10872 "()");
10873 g_variant_unref (_ret);
10874_out:
10875 return _ret != NULL;
10876}
10877
10878/**
10879 * shared_resource_call_lock_sync:
10880 * @proxy: A #SharedResourceProxy.
10881 * @arg_name: Argument to pass with the method invocation.
10882 * @cancellable: (allow-none): A #GCancellable or %NULL.
10883 * @error: Return location for error or %NULL.
10884 *
10885 * 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.
10886 *
10887 * See shared_resource_call_lock() for the asynchronous version of this method.
10888 *
10889 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
10890 */
10891gboolean
10892shared_resource_call_lock_sync (
10893 SharedResource *proxy,
10894 const gchar *arg_name,
10895 GCancellable *cancellable,
10896 GError **error)
10897{
10898 GVariant *_ret;
10899 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
10900 "lock",
10901 g_variant_new ("(s)",
10902 arg_name),
10903 G_DBUS_CALL_FLAGS_NONE,
10904 -1,
10905 cancellable,
10906 error);
10907 if (_ret == NULL)
10908 goto _out;
10909 g_variant_get (_ret,
10910 "()");
10911 g_variant_unref (_ret);
10912_out:
10913 return _ret != NULL;
10914}
10915
10916/**
10917 * shared_resource_call_unlock:
10918 * @proxy: A #SharedResourceProxy.
10919 * @cancellable: (allow-none): A #GCancellable or %NULL.
10920 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
10921 * @user_data: User data to pass to @callback.
10922 *
10923 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SharedResource.unlock">unlock()</link> D-Bus method on @proxy.
10924 * 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.
10925 * You can then call shared_resource_call_unlock_finish() to get the result of the operation.
10926 *
10927 * See shared_resource_call_unlock_sync() for the synchronous, blocking version of this method.
10928 */
10929void
10930shared_resource_call_unlock (
10931 SharedResource *proxy,
10932 GCancellable *cancellable,
10933 GAsyncReadyCallback callback,
10934 gpointer user_data)
10935{
10936 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
10937 "unlock",
10938 g_variant_new ("()"),
10939 G_DBUS_CALL_FLAGS_NONE,
10940 -1,
10941 cancellable,
10942 callback,
10943 user_data);
10944}
10945
10946/**
10947 * shared_resource_call_unlock_finish:
10948 * @proxy: A #SharedResourceProxy.
10949 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to shared_resource_call_unlock().
10950 * @error: Return location for error or %NULL.
10951 *
10952 * Finishes an operation started with shared_resource_call_unlock().
10953 *
10954 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
10955 */
10956gboolean
10957shared_resource_call_unlock_finish (
10958 SharedResource *proxy,
10959 GAsyncResult *res,
10960 GError **error)
10961{
10962 GVariant *_ret;
10963 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
10964 if (_ret == NULL)
10965 goto _out;
10966 g_variant_get (_ret,
10967 "()");
10968 g_variant_unref (_ret);
10969_out:
10970 return _ret != NULL;
10971}
10972
10973/**
10974 * shared_resource_call_unlock_sync:
10975 * @proxy: A #SharedResourceProxy.
10976 * @cancellable: (allow-none): A #GCancellable or %NULL.
10977 * @error: Return location for error or %NULL.
10978 *
10979 * 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.
10980 *
10981 * See shared_resource_call_unlock() for the asynchronous version of this method.
10982 *
10983 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
10984 */
10985gboolean
10986shared_resource_call_unlock_sync (
10987 SharedResource *proxy,
10988 GCancellable *cancellable,
10989 GError **error)
10990{
10991 GVariant *_ret;
10992 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
10993 "unlock",
10994 g_variant_new ("()"),
10995 G_DBUS_CALL_FLAGS_NONE,
10996 -1,
10997 cancellable,
10998 error);
10999 if (_ret == NULL)
11000 goto _out;
11001 g_variant_get (_ret,
11002 "()");
11003 g_variant_unref (_ret);
11004_out:
11005 return _ret != NULL;
11006}
11007
11008/**
11009 * shared_resource_call_is_locked:
11010 * @proxy: A #SharedResourceProxy.
11011 * @cancellable: (allow-none): A #GCancellable or %NULL.
11012 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
11013 * @user_data: User data to pass to @callback.
11014 *
11015 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SharedResource.isLocked">isLocked()</link> D-Bus method on @proxy.
11016 * 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.
11017 * You can then call shared_resource_call_is_locked_finish() to get the result of the operation.
11018 *
11019 * See shared_resource_call_is_locked_sync() for the synchronous, blocking version of this method.
11020 */
11021void
11022shared_resource_call_is_locked (
11023 SharedResource *proxy,
11024 GCancellable *cancellable,
11025 GAsyncReadyCallback callback,
11026 gpointer user_data)
11027{
11028 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
11029 "isLocked",
11030 g_variant_new ("()"),
11031 G_DBUS_CALL_FLAGS_NONE,
11032 -1,
11033 cancellable,
11034 callback,
11035 user_data);
11036}
11037
11038/**
11039 * shared_resource_call_is_locked_finish:
11040 * @proxy: A #SharedResourceProxy.
11041 * @out_lock: (out): Return location for return parameter or %NULL to ignore.
11042 * @out_name: (out): Return location for return parameter or %NULL to ignore.
11043 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to shared_resource_call_is_locked().
11044 * @error: Return location for error or %NULL.
11045 *
11046 * Finishes an operation started with shared_resource_call_is_locked().
11047 *
11048 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
11049 */
11050gboolean
11051shared_resource_call_is_locked_finish (
11052 SharedResource *proxy,
11053 gboolean *out_lock,
11054 gchar **out_name,
11055 GAsyncResult *res,
11056 GError **error)
11057{
11058 GVariant *_ret;
11059 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
11060 if (_ret == NULL)
11061 goto _out;
11062 g_variant_get (_ret,
11063 "(bs)",
11064 out_lock,
11065 out_name);
11066 g_variant_unref (_ret);
11067_out:
11068 return _ret != NULL;
11069}
11070
11071/**
11072 * shared_resource_call_is_locked_sync:
11073 * @proxy: A #SharedResourceProxy.
11074 * @out_lock: (out): Return location for return parameter or %NULL to ignore.
11075 * @out_name: (out): Return location for return parameter or %NULL to ignore.
11076 * @cancellable: (allow-none): A #GCancellable or %NULL.
11077 * @error: Return location for error or %NULL.
11078 *
11079 * 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.
11080 *
11081 * See shared_resource_call_is_locked() for the asynchronous version of this method.
11082 *
11083 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
11084 */
11085gboolean
11086shared_resource_call_is_locked_sync (
11087 SharedResource *proxy,
11088 gboolean *out_lock,
11089 gchar **out_name,
11090 GCancellable *cancellable,
11091 GError **error)
11092{
11093 GVariant *_ret;
11094 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
11095 "isLocked",
11096 g_variant_new ("()"),
11097 G_DBUS_CALL_FLAGS_NONE,
11098 -1,
11099 cancellable,
11100 error);
11101 if (_ret == NULL)
11102 goto _out;
11103 g_variant_get (_ret,
11104 "(bs)",
11105 out_lock,
11106 out_name);
11107 g_variant_unref (_ret);
11108_out:
11109 return _ret != NULL;
11110}
11111
11112/**
11113 * shared_resource_complete_lock:
11114 * @object: A #SharedResource.
11115 * @invocation: (transfer full): A #GDBusMethodInvocation.
11116 *
11117 * 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.
11118 *
11119 * This method will free @invocation, you cannot use it afterwards.
11120 */
11121void
11122shared_resource_complete_lock (
11123 SharedResource *object,
11124 GDBusMethodInvocation *invocation)
11125{
11126 g_dbus_method_invocation_return_value (invocation,
11127 g_variant_new ("()"));
11128}
11129
11130/**
11131 * shared_resource_complete_unlock:
11132 * @object: A #SharedResource.
11133 * @invocation: (transfer full): A #GDBusMethodInvocation.
11134 *
11135 * 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.
11136 *
11137 * This method will free @invocation, you cannot use it afterwards.
11138 */
11139void
11140shared_resource_complete_unlock (
11141 SharedResource *object,
11142 GDBusMethodInvocation *invocation)
11143{
11144 g_dbus_method_invocation_return_value (invocation,
11145 g_variant_new ("()"));
11146}
11147
11148/**
11149 * shared_resource_complete_is_locked:
11150 * @object: A #SharedResource.
11151 * @invocation: (transfer full): A #GDBusMethodInvocation.
11152 * @lock: Parameter to return.
11153 * @name: Parameter to return.
11154 *
11155 * 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.
11156 *
11157 * This method will free @invocation, you cannot use it afterwards.
11158 */
11159void
11160shared_resource_complete_is_locked (
11161 SharedResource *object,
11162 GDBusMethodInvocation *invocation,
11163 gboolean lock,
11164 const gchar *name)
11165{
11166 g_dbus_method_invocation_return_value (invocation,
11167 g_variant_new ("(bs)",
11168 lock,
11169 name));
11170}
11171
11172/* ------------------------------------------------------------------------ */
11173
11174/**
11175 * SharedResourceProxy:
11176 *
11177 * The #SharedResourceProxy structure contains only private data and should only be accessed using the provided API.
11178 */
11179
11180/**
11181 * SharedResourceProxyClass:
11182 * @parent_class: The parent class.
11183 *
11184 * Class structure for #SharedResourceProxy.
11185 */
11186
11187struct _SharedResourceProxyPrivate
11188{
11189 GData *qdata;
11190};
11191
11192static void shared_resource_proxy_iface_init (SharedResourceIface *iface);
11193
11194#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
11195G_DEFINE_TYPE_WITH_CODE (SharedResourceProxy, shared_resource_proxy, G_TYPE_DBUS_PROXY,
11196 G_ADD_PRIVATE (SharedResourceProxy)
11197 G_IMPLEMENT_INTERFACE (TYPE_SHARED_RESOURCE, shared_resource_proxy_iface_init));
11198
11199#else
11200G_DEFINE_TYPE_WITH_CODE (SharedResourceProxy, shared_resource_proxy, G_TYPE_DBUS_PROXY,
11201 G_IMPLEMENT_INTERFACE (TYPE_SHARED_RESOURCE, shared_resource_proxy_iface_init));
11202
11203#endif
11204static void
11205shared_resource_proxy_finalize (GObject *object)
11206{
11207 SharedResourceProxy *proxy = SHARED_RESOURCE_PROXY (object);
11208 g_datalist_clear (&proxy->priv->qdata);
11209 G_OBJECT_CLASS (shared_resource_proxy_parent_class)->finalize (object);
11210}
11211
11212static void
11213shared_resource_proxy_get_property (GObject *object,
11214 guint prop_id,
11215 GValue *value,
11216 GParamSpec *pspec G_GNUC_UNUSED)
11217{
11218 const _ExtendedGDBusPropertyInfo *info;
11219 GVariant *variant;
11220 g_assert (prop_id != 0 && prop_id - 1 < 2);
11221 info = _shared_resource_property_info_pointers[prop_id - 1];
11222 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
11223 if (info->use_gvariant)
11224 {
11225 g_value_set_variant (value, variant);
11226 }
11227 else
11228 {
11229 if (variant != NULL)
11230 g_dbus_gvariant_to_gvalue (variant, value);
11231 }
11232 if (variant != NULL)
11233 g_variant_unref (variant);
11234}
11235
11236static void
11237shared_resource_proxy_set_property_cb (GDBusProxy *proxy,
11238 GAsyncResult *res,
11239 gpointer user_data)
11240{
11241 const _ExtendedGDBusPropertyInfo *info = user_data;
11242 GError *error;
11243 GVariant *_ret;
11244 error = NULL;
11245 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
11246 if (!_ret)
11247 {
11248 g_warning ("Error setting property '%s' on interface org.openbmc.SharedResource: %s (%s, %d)",
11249 info->parent_struct.name,
11250 error->message, g_quark_to_string (error->domain), error->code);
11251 g_error_free (error);
11252 }
11253 else
11254 {
11255 g_variant_unref (_ret);
11256 }
11257}
11258
11259static void
11260shared_resource_proxy_set_property (GObject *object,
11261 guint prop_id,
11262 const GValue *value,
11263 GParamSpec *pspec G_GNUC_UNUSED)
11264{
11265 const _ExtendedGDBusPropertyInfo *info;
11266 GVariant *variant;
11267 g_assert (prop_id != 0 && prop_id - 1 < 2);
11268 info = _shared_resource_property_info_pointers[prop_id - 1];
11269 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
11270 g_dbus_proxy_call (G_DBUS_PROXY (object),
11271 "org.freedesktop.DBus.Properties.Set",
11272 g_variant_new ("(ssv)", "org.openbmc.SharedResource", info->parent_struct.name, variant),
11273 G_DBUS_CALL_FLAGS_NONE,
11274 -1,
11275 NULL, (GAsyncReadyCallback) shared_resource_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
11276 g_variant_unref (variant);
11277}
11278
11279static void
11280shared_resource_proxy_g_signal (GDBusProxy *proxy,
11281 const gchar *sender_name G_GNUC_UNUSED,
11282 const gchar *signal_name,
11283 GVariant *parameters)
11284{
11285 _ExtendedGDBusSignalInfo *info;
11286 GVariantIter iter;
11287 GVariant *child;
11288 GValue *paramv;
11289 guint num_params;
11290 guint n;
11291 guint signal_id;
11292 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct, signal_name);
11293 if (info == NULL)
11294 return;
11295 num_params = g_variant_n_children (parameters);
11296 paramv = g_new0 (GValue, num_params + 1);
11297 g_value_init (&paramv[0], TYPE_SHARED_RESOURCE);
11298 g_value_set_object (&paramv[0], proxy);
11299 g_variant_iter_init (&iter, parameters);
11300 n = 1;
11301 while ((child = g_variant_iter_next_value (&iter)) != NULL)
11302 {
11303 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
11304 if (arg_info->use_gvariant)
11305 {
11306 g_value_init (&paramv[n], G_TYPE_VARIANT);
11307 g_value_set_variant (&paramv[n], child);
11308 n++;
11309 }
11310 else
11311 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
11312 g_variant_unref (child);
11313 }
11314 signal_id = g_signal_lookup (info->signal_name, TYPE_SHARED_RESOURCE);
11315 g_signal_emitv (paramv, signal_id, 0, NULL);
11316 for (n = 0; n < num_params + 1; n++)
11317 g_value_unset (&paramv[n]);
11318 g_free (paramv);
11319}
11320
11321static void
11322shared_resource_proxy_g_properties_changed (GDBusProxy *_proxy,
11323 GVariant *changed_properties,
11324 const gchar *const *invalidated_properties)
11325{
11326 SharedResourceProxy *proxy = SHARED_RESOURCE_PROXY (_proxy);
11327 guint n;
11328 const gchar *key;
11329 GVariantIter *iter;
11330 _ExtendedGDBusPropertyInfo *info;
11331 g_variant_get (changed_properties, "a{sv}", &iter);
11332 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
11333 {
11334 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct, key);
11335 g_datalist_remove_data (&proxy->priv->qdata, key);
11336 if (info != NULL)
11337 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
11338 }
11339 g_variant_iter_free (iter);
11340 for (n = 0; invalidated_properties[n] != NULL; n++)
11341 {
11342 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct, invalidated_properties[n]);
11343 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
11344 if (info != NULL)
11345 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
11346 }
11347}
11348
11349static gboolean
11350shared_resource_proxy_get_lock (SharedResource *object)
11351{
11352 SharedResourceProxy *proxy = SHARED_RESOURCE_PROXY (object);
11353 GVariant *variant;
11354 gboolean value = 0;
11355 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "lock");
11356 if (variant != NULL)
11357 {
11358 value = g_variant_get_boolean (variant);
11359 g_variant_unref (variant);
11360 }
11361 return value;
11362}
11363
11364static const gchar *
11365shared_resource_proxy_get_name (SharedResource *object)
11366{
11367 SharedResourceProxy *proxy = SHARED_RESOURCE_PROXY (object);
11368 GVariant *variant;
11369 const gchar *value = NULL;
11370 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "name");
11371 if (variant != NULL)
11372 {
11373 value = g_variant_get_string (variant, NULL);
11374 g_variant_unref (variant);
11375 }
11376 return value;
11377}
11378
11379static void
11380shared_resource_proxy_init (SharedResourceProxy *proxy)
11381{
11382#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
11383 proxy->priv = shared_resource_proxy_get_instance_private (proxy);
11384#else
11385 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SHARED_RESOURCE_PROXY, SharedResourceProxyPrivate);
11386#endif
11387
11388 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), shared_resource_interface_info ());
11389}
11390
11391static void
11392shared_resource_proxy_class_init (SharedResourceProxyClass *klass)
11393{
11394 GObjectClass *gobject_class;
11395 GDBusProxyClass *proxy_class;
11396
11397 gobject_class = G_OBJECT_CLASS (klass);
11398 gobject_class->finalize = shared_resource_proxy_finalize;
11399 gobject_class->get_property = shared_resource_proxy_get_property;
11400 gobject_class->set_property = shared_resource_proxy_set_property;
11401
11402 proxy_class = G_DBUS_PROXY_CLASS (klass);
11403 proxy_class->g_signal = shared_resource_proxy_g_signal;
11404 proxy_class->g_properties_changed = shared_resource_proxy_g_properties_changed;
11405
11406 shared_resource_override_properties (gobject_class, 1);
11407
11408#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
11409 g_type_class_add_private (klass, sizeof (SharedResourceProxyPrivate));
11410#endif
11411}
11412
11413static void
11414shared_resource_proxy_iface_init (SharedResourceIface *iface)
11415{
11416 iface->get_lock = shared_resource_proxy_get_lock;
11417 iface->get_name = shared_resource_proxy_get_name;
11418}
11419
11420/**
11421 * shared_resource_proxy_new:
11422 * @connection: A #GDBusConnection.
11423 * @flags: Flags from the #GDBusProxyFlags enumeration.
11424 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
11425 * @object_path: An object path.
11426 * @cancellable: (allow-none): A #GCancellable or %NULL.
11427 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
11428 * @user_data: User data to pass to @callback.
11429 *
11430 * 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.
11431 *
11432 * 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.
11433 * You can then call shared_resource_proxy_new_finish() to get the result of the operation.
11434 *
11435 * See shared_resource_proxy_new_sync() for the synchronous, blocking version of this constructor.
11436 */
11437void
11438shared_resource_proxy_new (
11439 GDBusConnection *connection,
11440 GDBusProxyFlags flags,
11441 const gchar *name,
11442 const gchar *object_path,
11443 GCancellable *cancellable,
11444 GAsyncReadyCallback callback,
11445 gpointer user_data)
11446{
11447 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);
11448}
11449
11450/**
11451 * shared_resource_proxy_new_finish:
11452 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to shared_resource_proxy_new().
11453 * @error: Return location for error or %NULL
11454 *
11455 * Finishes an operation started with shared_resource_proxy_new().
11456 *
11457 * Returns: (transfer full) (type SharedResourceProxy): The constructed proxy object or %NULL if @error is set.
11458 */
11459SharedResource *
11460shared_resource_proxy_new_finish (
11461 GAsyncResult *res,
11462 GError **error)
11463{
11464 GObject *ret;
11465 GObject *source_object;
11466 source_object = g_async_result_get_source_object (res);
11467 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
11468 g_object_unref (source_object);
11469 if (ret != NULL)
11470 return SHARED_RESOURCE (ret);
11471 else
11472 return NULL;
11473}
11474
11475/**
11476 * shared_resource_proxy_new_sync:
11477 * @connection: A #GDBusConnection.
11478 * @flags: Flags from the #GDBusProxyFlags enumeration.
11479 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
11480 * @object_path: An object path.
11481 * @cancellable: (allow-none): A #GCancellable or %NULL.
11482 * @error: Return location for error or %NULL
11483 *
11484 * 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.
11485 *
11486 * The calling thread is blocked until a reply is received.
11487 *
11488 * See shared_resource_proxy_new() for the asynchronous version of this constructor.
11489 *
11490 * Returns: (transfer full) (type SharedResourceProxy): The constructed proxy object or %NULL if @error is set.
11491 */
11492SharedResource *
11493shared_resource_proxy_new_sync (
11494 GDBusConnection *connection,
11495 GDBusProxyFlags flags,
11496 const gchar *name,
11497 const gchar *object_path,
11498 GCancellable *cancellable,
11499 GError **error)
11500{
11501 GInitable *ret;
11502 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);
11503 if (ret != NULL)
11504 return SHARED_RESOURCE (ret);
11505 else
11506 return NULL;
11507}
11508
11509
11510/**
11511 * shared_resource_proxy_new_for_bus:
11512 * @bus_type: A #GBusType.
11513 * @flags: Flags from the #GDBusProxyFlags enumeration.
11514 * @name: A bus name (well-known or unique).
11515 * @object_path: An object path.
11516 * @cancellable: (allow-none): A #GCancellable or %NULL.
11517 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
11518 * @user_data: User data to pass to @callback.
11519 *
11520 * Like shared_resource_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
11521 *
11522 * 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.
11523 * You can then call shared_resource_proxy_new_for_bus_finish() to get the result of the operation.
11524 *
11525 * See shared_resource_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
11526 */
11527void
11528shared_resource_proxy_new_for_bus (
11529 GBusType bus_type,
11530 GDBusProxyFlags flags,
11531 const gchar *name,
11532 const gchar *object_path,
11533 GCancellable *cancellable,
11534 GAsyncReadyCallback callback,
11535 gpointer user_data)
11536{
11537 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);
11538}
11539
11540/**
11541 * shared_resource_proxy_new_for_bus_finish:
11542 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to shared_resource_proxy_new_for_bus().
11543 * @error: Return location for error or %NULL
11544 *
11545 * Finishes an operation started with shared_resource_proxy_new_for_bus().
11546 *
11547 * Returns: (transfer full) (type SharedResourceProxy): The constructed proxy object or %NULL if @error is set.
11548 */
11549SharedResource *
11550shared_resource_proxy_new_for_bus_finish (
11551 GAsyncResult *res,
11552 GError **error)
11553{
11554 GObject *ret;
11555 GObject *source_object;
11556 source_object = g_async_result_get_source_object (res);
11557 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
11558 g_object_unref (source_object);
11559 if (ret != NULL)
11560 return SHARED_RESOURCE (ret);
11561 else
11562 return NULL;
11563}
11564
11565/**
11566 * shared_resource_proxy_new_for_bus_sync:
11567 * @bus_type: A #GBusType.
11568 * @flags: Flags from the #GDBusProxyFlags enumeration.
11569 * @name: A bus name (well-known or unique).
11570 * @object_path: An object path.
11571 * @cancellable: (allow-none): A #GCancellable or %NULL.
11572 * @error: Return location for error or %NULL
11573 *
11574 * Like shared_resource_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
11575 *
11576 * The calling thread is blocked until a reply is received.
11577 *
11578 * See shared_resource_proxy_new_for_bus() for the asynchronous version of this constructor.
11579 *
11580 * Returns: (transfer full) (type SharedResourceProxy): The constructed proxy object or %NULL if @error is set.
11581 */
11582SharedResource *
11583shared_resource_proxy_new_for_bus_sync (
11584 GBusType bus_type,
11585 GDBusProxyFlags flags,
11586 const gchar *name,
11587 const gchar *object_path,
11588 GCancellable *cancellable,
11589 GError **error)
11590{
11591 GInitable *ret;
11592 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);
11593 if (ret != NULL)
11594 return SHARED_RESOURCE (ret);
11595 else
11596 return NULL;
11597}
11598
11599
11600/* ------------------------------------------------------------------------ */
11601
11602/**
11603 * SharedResourceSkeleton:
11604 *
11605 * The #SharedResourceSkeleton structure contains only private data and should only be accessed using the provided API.
11606 */
11607
11608/**
11609 * SharedResourceSkeletonClass:
11610 * @parent_class: The parent class.
11611 *
11612 * Class structure for #SharedResourceSkeleton.
11613 */
11614
11615struct _SharedResourceSkeletonPrivate
11616{
11617 GValue *properties;
11618 GList *changed_properties;
11619 GSource *changed_properties_idle_source;
11620 GMainContext *context;
11621 GMutex lock;
11622};
11623
11624static void
11625_shared_resource_skeleton_handle_method_call (
11626 GDBusConnection *connection G_GNUC_UNUSED,
11627 const gchar *sender G_GNUC_UNUSED,
11628 const gchar *object_path G_GNUC_UNUSED,
11629 const gchar *interface_name,
11630 const gchar *method_name,
11631 GVariant *parameters,
11632 GDBusMethodInvocation *invocation,
11633 gpointer user_data)
11634{
11635 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (user_data);
11636 _ExtendedGDBusMethodInfo *info;
11637 GVariantIter iter;
11638 GVariant *child;
11639 GValue *paramv;
11640 guint num_params;
11641 guint num_extra;
11642 guint n;
11643 guint signal_id;
11644 GValue return_value = G_VALUE_INIT;
11645 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
11646 g_assert (info != NULL);
11647 num_params = g_variant_n_children (parameters);
11648 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
11649 n = 0;
11650 g_value_init (&paramv[n], TYPE_SHARED_RESOURCE);
11651 g_value_set_object (&paramv[n++], skeleton);
11652 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
11653 g_value_set_object (&paramv[n++], invocation);
11654 if (info->pass_fdlist)
11655 {
11656#ifdef G_OS_UNIX
11657 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
11658 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
11659#else
11660 g_assert_not_reached ();
11661#endif
11662 }
11663 g_variant_iter_init (&iter, parameters);
11664 while ((child = g_variant_iter_next_value (&iter)) != NULL)
11665 {
11666 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
11667 if (arg_info->use_gvariant)
11668 {
11669 g_value_init (&paramv[n], G_TYPE_VARIANT);
11670 g_value_set_variant (&paramv[n], child);
11671 n++;
11672 }
11673 else
11674 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
11675 g_variant_unref (child);
11676 }
11677 signal_id = g_signal_lookup (info->signal_name, TYPE_SHARED_RESOURCE);
11678 g_value_init (&return_value, G_TYPE_BOOLEAN);
11679 g_signal_emitv (paramv, signal_id, 0, &return_value);
11680 if (!g_value_get_boolean (&return_value))
11681 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);
11682 g_value_unset (&return_value);
11683 for (n = 0; n < num_params + num_extra; n++)
11684 g_value_unset (&paramv[n]);
11685 g_free (paramv);
11686}
11687
11688static GVariant *
11689_shared_resource_skeleton_handle_get_property (
11690 GDBusConnection *connection G_GNUC_UNUSED,
11691 const gchar *sender G_GNUC_UNUSED,
11692 const gchar *object_path G_GNUC_UNUSED,
11693 const gchar *interface_name G_GNUC_UNUSED,
11694 const gchar *property_name,
11695 GError **error,
11696 gpointer user_data)
11697{
11698 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (user_data);
11699 GValue value = G_VALUE_INIT;
11700 GParamSpec *pspec;
11701 _ExtendedGDBusPropertyInfo *info;
11702 GVariant *ret;
11703 ret = NULL;
11704 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct, property_name);
11705 g_assert (info != NULL);
11706 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
11707 if (pspec == NULL)
11708 {
11709 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
11710 }
11711 else
11712 {
11713 g_value_init (&value, pspec->value_type);
11714 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
11715 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
11716 g_value_unset (&value);
11717 }
11718 return ret;
11719}
11720
11721static gboolean
11722_shared_resource_skeleton_handle_set_property (
11723 GDBusConnection *connection G_GNUC_UNUSED,
11724 const gchar *sender G_GNUC_UNUSED,
11725 const gchar *object_path G_GNUC_UNUSED,
11726 const gchar *interface_name G_GNUC_UNUSED,
11727 const gchar *property_name,
11728 GVariant *variant,
11729 GError **error,
11730 gpointer user_data)
11731{
11732 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (user_data);
11733 GValue value = G_VALUE_INIT;
11734 GParamSpec *pspec;
11735 _ExtendedGDBusPropertyInfo *info;
11736 gboolean ret;
11737 ret = FALSE;
11738 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct, property_name);
11739 g_assert (info != NULL);
11740 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
11741 if (pspec == NULL)
11742 {
11743 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
11744 }
11745 else
11746 {
11747 if (info->use_gvariant)
11748 g_value_set_variant (&value, variant);
11749 else
11750 g_dbus_gvariant_to_gvalue (variant, &value);
11751 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
11752 g_value_unset (&value);
11753 ret = TRUE;
11754 }
11755 return ret;
11756}
11757
11758static const GDBusInterfaceVTable _shared_resource_skeleton_vtable =
11759{
11760 _shared_resource_skeleton_handle_method_call,
11761 _shared_resource_skeleton_handle_get_property,
11762 _shared_resource_skeleton_handle_set_property,
11763 {NULL}
11764};
11765
11766static GDBusInterfaceInfo *
11767shared_resource_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
11768{
11769 return shared_resource_interface_info ();
11770}
11771
11772static GDBusInterfaceVTable *
11773shared_resource_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
11774{
11775 return (GDBusInterfaceVTable *) &_shared_resource_skeleton_vtable;
11776}
11777
11778static GVariant *
11779shared_resource_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
11780{
11781 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (_skeleton);
11782
11783 GVariantBuilder builder;
11784 guint n;
11785 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
11786 if (_shared_resource_interface_info.parent_struct.properties == NULL)
11787 goto out;
11788 for (n = 0; _shared_resource_interface_info.parent_struct.properties[n] != NULL; n++)
11789 {
11790 GDBusPropertyInfo *info = _shared_resource_interface_info.parent_struct.properties[n];
11791 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
11792 {
11793 GVariant *value;
11794 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);
11795 if (value != NULL)
11796 {
11797 g_variant_take_ref (value);
11798 g_variant_builder_add (&builder, "{sv}", info->name, value);
11799 g_variant_unref (value);
11800 }
11801 }
11802 }
11803out:
11804 return g_variant_builder_end (&builder);
11805}
11806
11807static gboolean _shared_resource_emit_changed (gpointer user_data);
11808
11809static void
11810shared_resource_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
11811{
11812 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (_skeleton);
11813 gboolean emit_changed = FALSE;
11814
11815 g_mutex_lock (&skeleton->priv->lock);
11816 if (skeleton->priv->changed_properties_idle_source != NULL)
11817 {
11818 g_source_destroy (skeleton->priv->changed_properties_idle_source);
11819 skeleton->priv->changed_properties_idle_source = NULL;
11820 emit_changed = TRUE;
11821 }
11822 g_mutex_unlock (&skeleton->priv->lock);
11823
11824 if (emit_changed)
11825 _shared_resource_emit_changed (skeleton);
11826}
11827
11828static void shared_resource_skeleton_iface_init (SharedResourceIface *iface);
11829#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
11830G_DEFINE_TYPE_WITH_CODE (SharedResourceSkeleton, shared_resource_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
11831 G_ADD_PRIVATE (SharedResourceSkeleton)
11832 G_IMPLEMENT_INTERFACE (TYPE_SHARED_RESOURCE, shared_resource_skeleton_iface_init));
11833
11834#else
11835G_DEFINE_TYPE_WITH_CODE (SharedResourceSkeleton, shared_resource_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
11836 G_IMPLEMENT_INTERFACE (TYPE_SHARED_RESOURCE, shared_resource_skeleton_iface_init));
11837
11838#endif
11839static void
11840shared_resource_skeleton_finalize (GObject *object)
11841{
11842 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object);
11843 guint n;
11844 for (n = 0; n < 2; n++)
11845 g_value_unset (&skeleton->priv->properties[n]);
11846 g_free (skeleton->priv->properties);
11847 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
11848 if (skeleton->priv->changed_properties_idle_source != NULL)
11849 g_source_destroy (skeleton->priv->changed_properties_idle_source);
11850 g_main_context_unref (skeleton->priv->context);
11851 g_mutex_clear (&skeleton->priv->lock);
11852 G_OBJECT_CLASS (shared_resource_skeleton_parent_class)->finalize (object);
11853}
11854
11855static void
11856shared_resource_skeleton_get_property (GObject *object,
11857 guint prop_id,
11858 GValue *value,
11859 GParamSpec *pspec G_GNUC_UNUSED)
11860{
11861 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object);
11862 g_assert (prop_id != 0 && prop_id - 1 < 2);
11863 g_mutex_lock (&skeleton->priv->lock);
11864 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
11865 g_mutex_unlock (&skeleton->priv->lock);
11866}
11867
11868static gboolean
11869_shared_resource_emit_changed (gpointer user_data)
11870{
11871 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (user_data);
11872 GList *l;
11873 GVariantBuilder builder;
11874 GVariantBuilder invalidated_builder;
11875 guint num_changes;
11876
11877 g_mutex_lock (&skeleton->priv->lock);
11878 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
11879 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
11880 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
11881 {
11882 ChangedProperty *cp = l->data;
11883 GVariant *variant;
11884 const GValue *cur_value;
11885
11886 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
11887 if (!_g_value_equal (cur_value, &cp->orig_value))
11888 {
11889 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
11890 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
11891 g_variant_unref (variant);
11892 num_changes++;
11893 }
11894 }
11895 if (num_changes > 0)
11896 {
11897 GList *connections, *ll;
11898 GVariant *signal_variant;
11899 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SharedResource",
11900 &builder, &invalidated_builder));
11901 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
11902 for (ll = connections; ll != NULL; ll = ll->next)
11903 {
11904 GDBusConnection *connection = ll->data;
11905
11906 g_dbus_connection_emit_signal (connection,
11907 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
11908 "org.freedesktop.DBus.Properties",
11909 "PropertiesChanged",
11910 signal_variant,
11911 NULL);
11912 }
11913 g_variant_unref (signal_variant);
11914 g_list_free_full (connections, g_object_unref);
11915 }
11916 else
11917 {
11918 g_variant_builder_clear (&builder);
11919 g_variant_builder_clear (&invalidated_builder);
11920 }
11921 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
11922 skeleton->priv->changed_properties = NULL;
11923 skeleton->priv->changed_properties_idle_source = NULL;
11924 g_mutex_unlock (&skeleton->priv->lock);
11925 return FALSE;
11926}
11927
11928static void
11929_shared_resource_schedule_emit_changed (SharedResourceSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
11930{
11931 ChangedProperty *cp;
11932 GList *l;
11933 cp = NULL;
11934 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
11935 {
11936 ChangedProperty *i_cp = l->data;
11937 if (i_cp->info == info)
11938 {
11939 cp = i_cp;
11940 break;
11941 }
11942 }
11943 if (cp == NULL)
11944 {
11945 cp = g_new0 (ChangedProperty, 1);
11946 cp->prop_id = prop_id;
11947 cp->info = info;
11948 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
11949 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
11950 g_value_copy (orig_value, &cp->orig_value);
11951 }
11952}
11953
11954static void
11955shared_resource_skeleton_notify (GObject *object,
11956 GParamSpec *pspec G_GNUC_UNUSED)
11957{
11958 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object);
11959 g_mutex_lock (&skeleton->priv->lock);
11960 if (skeleton->priv->changed_properties != NULL &&
11961 skeleton->priv->changed_properties_idle_source == NULL)
11962 {
11963 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
11964 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
11965 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _shared_resource_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
11966 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
11967 g_source_unref (skeleton->priv->changed_properties_idle_source);
11968 }
11969 g_mutex_unlock (&skeleton->priv->lock);
11970}
11971
11972static void
11973shared_resource_skeleton_set_property (GObject *object,
11974 guint prop_id,
11975 const GValue *value,
11976 GParamSpec *pspec)
11977{
11978 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object);
11979 g_assert (prop_id != 0 && prop_id - 1 < 2);
11980 g_mutex_lock (&skeleton->priv->lock);
11981 g_object_freeze_notify (object);
11982 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
11983 {
11984 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
11985 _shared_resource_schedule_emit_changed (skeleton, _shared_resource_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
11986 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
11987 g_object_notify_by_pspec (object, pspec);
11988 }
11989 g_mutex_unlock (&skeleton->priv->lock);
11990 g_object_thaw_notify (object);
11991}
11992
11993static void
11994shared_resource_skeleton_init (SharedResourceSkeleton *skeleton)
11995{
11996#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
11997 skeleton->priv = shared_resource_skeleton_get_instance_private (skeleton);
11998#else
11999 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SHARED_RESOURCE_SKELETON, SharedResourceSkeletonPrivate);
12000#endif
12001
12002 g_mutex_init (&skeleton->priv->lock);
12003 skeleton->priv->context = g_main_context_ref_thread_default ();
12004 skeleton->priv->properties = g_new0 (GValue, 2);
12005 g_value_init (&skeleton->priv->properties[0], G_TYPE_BOOLEAN);
12006 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
12007}
12008
12009static gboolean
12010shared_resource_skeleton_get_lock (SharedResource *object)
12011{
12012 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object);
12013 gboolean value;
12014 g_mutex_lock (&skeleton->priv->lock);
12015 value = g_value_get_boolean (&(skeleton->priv->properties[0]));
12016 g_mutex_unlock (&skeleton->priv->lock);
12017 return value;
12018}
12019
12020static const gchar *
12021shared_resource_skeleton_get_name (SharedResource *object)
12022{
12023 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object);
12024 const gchar *value;
12025 g_mutex_lock (&skeleton->priv->lock);
12026 value = g_value_get_string (&(skeleton->priv->properties[1]));
12027 g_mutex_unlock (&skeleton->priv->lock);
12028 return value;
12029}
12030
12031static void
12032shared_resource_skeleton_class_init (SharedResourceSkeletonClass *klass)
12033{
12034 GObjectClass *gobject_class;
12035 GDBusInterfaceSkeletonClass *skeleton_class;
12036
12037 gobject_class = G_OBJECT_CLASS (klass);
12038 gobject_class->finalize = shared_resource_skeleton_finalize;
12039 gobject_class->get_property = shared_resource_skeleton_get_property;
12040 gobject_class->set_property = shared_resource_skeleton_set_property;
12041 gobject_class->notify = shared_resource_skeleton_notify;
12042
12043
12044 shared_resource_override_properties (gobject_class, 1);
12045
12046 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
12047 skeleton_class->get_info = shared_resource_skeleton_dbus_interface_get_info;
12048 skeleton_class->get_properties = shared_resource_skeleton_dbus_interface_get_properties;
12049 skeleton_class->flush = shared_resource_skeleton_dbus_interface_flush;
12050 skeleton_class->get_vtable = shared_resource_skeleton_dbus_interface_get_vtable;
12051
12052#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
12053 g_type_class_add_private (klass, sizeof (SharedResourceSkeletonPrivate));
12054#endif
12055}
12056
12057static void
12058shared_resource_skeleton_iface_init (SharedResourceIface *iface)
12059{
12060 iface->get_lock = shared_resource_skeleton_get_lock;
12061 iface->get_name = shared_resource_skeleton_get_name;
12062}
12063
12064/**
12065 * shared_resource_skeleton_new:
12066 *
12067 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link>.
12068 *
12069 * Returns: (transfer full) (type SharedResourceSkeleton): The skeleton object.
12070 */
12071SharedResource *
12072shared_resource_skeleton_new (void)
12073{
12074 return SHARED_RESOURCE (g_object_new (TYPE_SHARED_RESOURCE_SKELETON, NULL));
12075}
12076
12077/* ------------------------------------------------------------------------
Norman James362a80f2015-09-14 14:04:39 -050012078 * Code for interface org.openbmc.Control
12079 * ------------------------------------------------------------------------
12080 */
12081
12082/**
12083 * SECTION:Control
12084 * @title: Control
12085 * @short_description: Generated C code for the org.openbmc.Control D-Bus interface
12086 *
12087 * 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.
12088 */
12089
12090/* ---- Introspection data for org.openbmc.Control ---- */
12091
12092static const _ExtendedGDBusMethodInfo _control_method_info_init =
12093{
12094 {
12095 -1,
12096 (gchar *) "init",
12097 NULL,
12098 NULL,
12099 NULL
12100 },
12101 "handle-init",
12102 FALSE
12103};
12104
12105static const _ExtendedGDBusMethodInfo * const _control_method_info_pointers[] =
12106{
12107 &_control_method_info_init,
12108 NULL
12109};
12110
12111static const _ExtendedGDBusArgInfo _control_signal_info_heartbeat_ARG_bus_name =
12112{
12113 {
12114 -1,
12115 (gchar *) "bus_name",
12116 (gchar *) "s",
12117 NULL
12118 },
12119 FALSE
12120};
12121
12122static const _ExtendedGDBusArgInfo * const _control_signal_info_heartbeat_ARG_pointers[] =
12123{
12124 &_control_signal_info_heartbeat_ARG_bus_name,
12125 NULL
12126};
12127
12128static const _ExtendedGDBusSignalInfo _control_signal_info_heartbeat =
12129{
12130 {
12131 -1,
12132 (gchar *) "Heartbeat",
12133 (GDBusArgInfo **) &_control_signal_info_heartbeat_ARG_pointers,
12134 NULL
12135 },
12136 "heartbeat"
12137};
12138
12139static const _ExtendedGDBusArgInfo _control_signal_info_goto_system_state_ARG_state_name =
12140{
12141 {
12142 -1,
12143 (gchar *) "state_name",
12144 (gchar *) "s",
12145 NULL
12146 },
12147 FALSE
12148};
12149
12150static const _ExtendedGDBusArgInfo * const _control_signal_info_goto_system_state_ARG_pointers[] =
12151{
12152 &_control_signal_info_goto_system_state_ARG_state_name,
12153 NULL
12154};
12155
12156static const _ExtendedGDBusSignalInfo _control_signal_info_goto_system_state =
12157{
12158 {
12159 -1,
12160 (gchar *) "GotoSystemState",
12161 (GDBusArgInfo **) &_control_signal_info_goto_system_state_ARG_pointers,
12162 NULL
12163 },
12164 "goto-system-state"
12165};
12166
Norman Jamesa3e47c42015-10-18 14:43:10 -050012167static const _ExtendedGDBusSignalInfo _control_signal_info_started =
12168{
12169 {
12170 -1,
12171 (gchar *) "Started",
12172 NULL,
12173 NULL
12174 },
12175 "started"
12176};
12177
Norman James362a80f2015-09-14 14:04:39 -050012178static const _ExtendedGDBusSignalInfo * const _control_signal_info_pointers[] =
12179{
12180 &_control_signal_info_heartbeat,
12181 &_control_signal_info_goto_system_state,
Norman Jamesa3e47c42015-10-18 14:43:10 -050012182 &_control_signal_info_started,
Norman James362a80f2015-09-14 14:04:39 -050012183 NULL
12184};
12185
12186static const _ExtendedGDBusPropertyInfo _control_property_info_poll_interval =
12187{
12188 {
12189 -1,
12190 (gchar *) "poll_interval",
12191 (gchar *) "i",
12192 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
12193 NULL
12194 },
12195 "poll-interval",
12196 FALSE
12197};
12198
12199static const _ExtendedGDBusPropertyInfo _control_property_info_heatbeat =
12200{
12201 {
12202 -1,
12203 (gchar *) "heatbeat",
12204 (gchar *) "i",
12205 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
12206 NULL
12207 },
12208 "heatbeat",
12209 FALSE
12210};
12211
12212static const _ExtendedGDBusPropertyInfo * const _control_property_info_pointers[] =
12213{
12214 &_control_property_info_poll_interval,
12215 &_control_property_info_heatbeat,
12216 NULL
12217};
12218
12219static const _ExtendedGDBusInterfaceInfo _control_interface_info =
12220{
12221 {
12222 -1,
12223 (gchar *) "org.openbmc.Control",
12224 (GDBusMethodInfo **) &_control_method_info_pointers,
12225 (GDBusSignalInfo **) &_control_signal_info_pointers,
12226 (GDBusPropertyInfo **) &_control_property_info_pointers,
12227 NULL
12228 },
12229 "control",
12230};
12231
12232
12233/**
12234 * control_interface_info:
12235 *
12236 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link> D-Bus interface.
12237 *
12238 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
12239 */
12240GDBusInterfaceInfo *
12241control_interface_info (void)
12242{
12243 return (GDBusInterfaceInfo *) &_control_interface_info.parent_struct;
12244}
12245
12246/**
12247 * control_override_properties:
12248 * @klass: The class structure for a #GObject<!-- -->-derived class.
12249 * @property_id_begin: The property id to assign to the first overridden property.
12250 *
12251 * Overrides all #GObject properties in the #Control interface for a concrete class.
12252 * The properties are overridden in the order they are defined.
12253 *
12254 * Returns: The last property id.
12255 */
12256guint
12257control_override_properties (GObjectClass *klass, guint property_id_begin)
12258{
12259 g_object_class_override_property (klass, property_id_begin++, "poll-interval");
12260 g_object_class_override_property (klass, property_id_begin++, "heatbeat");
12261 return property_id_begin - 1;
12262}
12263
12264
12265
12266/**
12267 * Control:
12268 *
12269 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link>.
12270 */
12271
12272/**
12273 * ControlIface:
12274 * @parent_iface: The parent interface.
12275 * @handle_init: Handler for the #Control::handle-init signal.
12276 * @get_heatbeat: Getter for the #Control:heatbeat property.
12277 * @get_poll_interval: Getter for the #Control:poll-interval property.
12278 * @goto_system_state: Handler for the #Control::goto-system-state signal.
12279 * @heartbeat: Handler for the #Control::heartbeat signal.
Norman Jamesa3e47c42015-10-18 14:43:10 -050012280 * @started: Handler for the #Control::started signal.
Norman James362a80f2015-09-14 14:04:39 -050012281 *
12282 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link>.
12283 */
12284
12285typedef ControlIface ControlInterface;
12286G_DEFINE_INTERFACE (Control, control, G_TYPE_OBJECT);
12287
12288static void
12289control_default_init (ControlIface *iface)
12290{
12291 /* GObject signals for incoming D-Bus method calls: */
12292 /**
12293 * Control::handle-init:
12294 * @object: A #Control.
12295 * @invocation: A #GDBusMethodInvocation.
12296 *
12297 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Control.init">init()</link> D-Bus method.
12298 *
12299 * 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.
12300 *
12301 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
12302 */
12303 g_signal_new ("handle-init",
12304 G_TYPE_FROM_INTERFACE (iface),
12305 G_SIGNAL_RUN_LAST,
12306 G_STRUCT_OFFSET (ControlIface, handle_init),
12307 g_signal_accumulator_true_handled,
12308 NULL,
12309 g_cclosure_marshal_generic,
12310 G_TYPE_BOOLEAN,
12311 1,
12312 G_TYPE_DBUS_METHOD_INVOCATION);
12313
12314 /* GObject signals for received D-Bus signals: */
12315 /**
12316 * Control::heartbeat:
12317 * @object: A #Control.
12318 * @arg_bus_name: Argument.
12319 *
12320 * 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.
12321 *
12322 * 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.
12323 */
12324 g_signal_new ("heartbeat",
12325 G_TYPE_FROM_INTERFACE (iface),
12326 G_SIGNAL_RUN_LAST,
12327 G_STRUCT_OFFSET (ControlIface, heartbeat),
12328 NULL,
12329 NULL,
12330 g_cclosure_marshal_generic,
12331 G_TYPE_NONE,
12332 1, G_TYPE_STRING);
12333
12334 /**
12335 * Control::goto-system-state:
12336 * @object: A #Control.
12337 * @arg_state_name: Argument.
12338 *
12339 * 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.
12340 *
12341 * 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.
12342 */
12343 g_signal_new ("goto-system-state",
12344 G_TYPE_FROM_INTERFACE (iface),
12345 G_SIGNAL_RUN_LAST,
12346 G_STRUCT_OFFSET (ControlIface, goto_system_state),
12347 NULL,
12348 NULL,
12349 g_cclosure_marshal_generic,
12350 G_TYPE_NONE,
12351 1, G_TYPE_STRING);
12352
Norman Jamesa3e47c42015-10-18 14:43:10 -050012353 /**
12354 * Control::started:
12355 * @object: A #Control.
12356 *
12357 * 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.
12358 *
12359 * 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.
12360 */
12361 g_signal_new ("started",
12362 G_TYPE_FROM_INTERFACE (iface),
12363 G_SIGNAL_RUN_LAST,
12364 G_STRUCT_OFFSET (ControlIface, started),
12365 NULL,
12366 NULL,
12367 g_cclosure_marshal_generic,
12368 G_TYPE_NONE,
12369 0);
12370
Norman James362a80f2015-09-14 14:04:39 -050012371 /* GObject properties for D-Bus properties: */
12372 /**
12373 * Control:poll-interval:
12374 *
12375 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Control.poll_interval">"poll_interval"</link>.
12376 *
12377 * 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.
12378 */
12379 g_object_interface_install_property (iface,
12380 g_param_spec_int ("poll-interval", "poll_interval", "poll_interval", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
12381 /**
12382 * Control:heatbeat:
12383 *
12384 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Control.heatbeat">"heatbeat"</link>.
12385 *
12386 * 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.
12387 */
12388 g_object_interface_install_property (iface,
12389 g_param_spec_int ("heatbeat", "heatbeat", "heatbeat", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
12390}
12391
12392/**
12393 * control_get_poll_interval: (skip)
12394 * @object: A #Control.
12395 *
12396 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Control.poll_interval">"poll_interval"</link> D-Bus property.
12397 *
12398 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
12399 *
12400 * Returns: The property value.
12401 */
12402gint
12403control_get_poll_interval (Control *object)
12404{
12405 return CONTROL_GET_IFACE (object)->get_poll_interval (object);
12406}
12407
12408/**
12409 * control_set_poll_interval: (skip)
12410 * @object: A #Control.
12411 * @value: The value to set.
12412 *
12413 * Sets the <link linkend="gdbus-property-org-openbmc-Control.poll_interval">"poll_interval"</link> D-Bus property to @value.
12414 *
12415 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
12416 */
12417void
12418control_set_poll_interval (Control *object, gint value)
12419{
12420 g_object_set (G_OBJECT (object), "poll-interval", value, NULL);
12421}
12422
12423/**
12424 * control_get_heatbeat: (skip)
12425 * @object: A #Control.
12426 *
12427 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Control.heatbeat">"heatbeat"</link> D-Bus property.
12428 *
12429 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
12430 *
12431 * Returns: The property value.
12432 */
12433gint
12434control_get_heatbeat (Control *object)
12435{
12436 return CONTROL_GET_IFACE (object)->get_heatbeat (object);
12437}
12438
12439/**
12440 * control_set_heatbeat: (skip)
12441 * @object: A #Control.
12442 * @value: The value to set.
12443 *
12444 * Sets the <link linkend="gdbus-property-org-openbmc-Control.heatbeat">"heatbeat"</link> D-Bus property to @value.
12445 *
12446 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
12447 */
12448void
12449control_set_heatbeat (Control *object, gint value)
12450{
12451 g_object_set (G_OBJECT (object), "heatbeat", value, NULL);
12452}
12453
12454/**
12455 * control_emit_heartbeat:
12456 * @object: A #Control.
12457 * @arg_bus_name: Argument to pass with the signal.
12458 *
12459 * Emits the <link linkend="gdbus-signal-org-openbmc-Control.Heartbeat">"Heartbeat"</link> D-Bus signal.
12460 */
12461void
12462control_emit_heartbeat (
12463 Control *object,
12464 const gchar *arg_bus_name)
12465{
12466 g_signal_emit_by_name (object, "heartbeat", arg_bus_name);
12467}
12468
12469/**
12470 * control_emit_goto_system_state:
12471 * @object: A #Control.
12472 * @arg_state_name: Argument to pass with the signal.
12473 *
12474 * Emits the <link linkend="gdbus-signal-org-openbmc-Control.GotoSystemState">"GotoSystemState"</link> D-Bus signal.
12475 */
12476void
12477control_emit_goto_system_state (
12478 Control *object,
12479 const gchar *arg_state_name)
12480{
12481 g_signal_emit_by_name (object, "goto-system-state", arg_state_name);
12482}
12483
12484/**
Norman Jamesa3e47c42015-10-18 14:43:10 -050012485 * control_emit_started:
12486 * @object: A #Control.
12487 *
12488 * Emits the <link linkend="gdbus-signal-org-openbmc-Control.Started">"Started"</link> D-Bus signal.
12489 */
12490void
12491control_emit_started (
12492 Control *object)
12493{
12494 g_signal_emit_by_name (object, "started");
12495}
12496
12497/**
Norman James362a80f2015-09-14 14:04:39 -050012498 * control_call_init:
12499 * @proxy: A #ControlProxy.
12500 * @cancellable: (allow-none): A #GCancellable or %NULL.
12501 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
12502 * @user_data: User data to pass to @callback.
12503 *
12504 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Control.init">init()</link> D-Bus method on @proxy.
12505 * 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.
12506 * You can then call control_call_init_finish() to get the result of the operation.
12507 *
12508 * See control_call_init_sync() for the synchronous, blocking version of this method.
12509 */
12510void
12511control_call_init (
12512 Control *proxy,
12513 GCancellable *cancellable,
12514 GAsyncReadyCallback callback,
12515 gpointer user_data)
12516{
12517 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
12518 "init",
12519 g_variant_new ("()"),
12520 G_DBUS_CALL_FLAGS_NONE,
12521 -1,
12522 cancellable,
12523 callback,
12524 user_data);
12525}
12526
12527/**
12528 * control_call_init_finish:
12529 * @proxy: A #ControlProxy.
12530 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_call_init().
12531 * @error: Return location for error or %NULL.
12532 *
12533 * Finishes an operation started with control_call_init().
12534 *
12535 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
12536 */
12537gboolean
12538control_call_init_finish (
12539 Control *proxy,
12540 GAsyncResult *res,
12541 GError **error)
12542{
12543 GVariant *_ret;
12544 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
12545 if (_ret == NULL)
12546 goto _out;
12547 g_variant_get (_ret,
12548 "()");
12549 g_variant_unref (_ret);
12550_out:
12551 return _ret != NULL;
12552}
12553
12554/**
12555 * control_call_init_sync:
12556 * @proxy: A #ControlProxy.
12557 * @cancellable: (allow-none): A #GCancellable or %NULL.
12558 * @error: Return location for error or %NULL.
12559 *
12560 * 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.
12561 *
12562 * See control_call_init() for the asynchronous version of this method.
12563 *
12564 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
12565 */
12566gboolean
12567control_call_init_sync (
12568 Control *proxy,
12569 GCancellable *cancellable,
12570 GError **error)
12571{
12572 GVariant *_ret;
12573 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
12574 "init",
12575 g_variant_new ("()"),
12576 G_DBUS_CALL_FLAGS_NONE,
12577 -1,
12578 cancellable,
12579 error);
12580 if (_ret == NULL)
12581 goto _out;
12582 g_variant_get (_ret,
12583 "()");
12584 g_variant_unref (_ret);
12585_out:
12586 return _ret != NULL;
12587}
12588
12589/**
12590 * control_complete_init:
12591 * @object: A #Control.
12592 * @invocation: (transfer full): A #GDBusMethodInvocation.
12593 *
12594 * 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.
12595 *
12596 * This method will free @invocation, you cannot use it afterwards.
12597 */
12598void
12599control_complete_init (
12600 Control *object,
12601 GDBusMethodInvocation *invocation)
12602{
12603 g_dbus_method_invocation_return_value (invocation,
12604 g_variant_new ("()"));
12605}
12606
12607/* ------------------------------------------------------------------------ */
12608
12609/**
12610 * ControlProxy:
12611 *
12612 * The #ControlProxy structure contains only private data and should only be accessed using the provided API.
12613 */
12614
12615/**
12616 * ControlProxyClass:
12617 * @parent_class: The parent class.
12618 *
12619 * Class structure for #ControlProxy.
12620 */
12621
12622struct _ControlProxyPrivate
12623{
12624 GData *qdata;
12625};
12626
12627static void control_proxy_iface_init (ControlIface *iface);
12628
12629#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
12630G_DEFINE_TYPE_WITH_CODE (ControlProxy, control_proxy, G_TYPE_DBUS_PROXY,
12631 G_ADD_PRIVATE (ControlProxy)
12632 G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_proxy_iface_init));
12633
12634#else
12635G_DEFINE_TYPE_WITH_CODE (ControlProxy, control_proxy, G_TYPE_DBUS_PROXY,
12636 G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_proxy_iface_init));
12637
12638#endif
12639static void
12640control_proxy_finalize (GObject *object)
12641{
12642 ControlProxy *proxy = CONTROL_PROXY (object);
12643 g_datalist_clear (&proxy->priv->qdata);
12644 G_OBJECT_CLASS (control_proxy_parent_class)->finalize (object);
12645}
12646
12647static void
12648control_proxy_get_property (GObject *object,
12649 guint prop_id,
12650 GValue *value,
12651 GParamSpec *pspec G_GNUC_UNUSED)
12652{
12653 const _ExtendedGDBusPropertyInfo *info;
12654 GVariant *variant;
12655 g_assert (prop_id != 0 && prop_id - 1 < 2);
12656 info = _control_property_info_pointers[prop_id - 1];
12657 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
12658 if (info->use_gvariant)
12659 {
12660 g_value_set_variant (value, variant);
12661 }
12662 else
12663 {
12664 if (variant != NULL)
12665 g_dbus_gvariant_to_gvalue (variant, value);
12666 }
12667 if (variant != NULL)
12668 g_variant_unref (variant);
12669}
12670
12671static void
12672control_proxy_set_property_cb (GDBusProxy *proxy,
12673 GAsyncResult *res,
12674 gpointer user_data)
12675{
12676 const _ExtendedGDBusPropertyInfo *info = user_data;
12677 GError *error;
12678 GVariant *_ret;
12679 error = NULL;
12680 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
12681 if (!_ret)
12682 {
12683 g_warning ("Error setting property '%s' on interface org.openbmc.Control: %s (%s, %d)",
12684 info->parent_struct.name,
12685 error->message, g_quark_to_string (error->domain), error->code);
12686 g_error_free (error);
12687 }
12688 else
12689 {
12690 g_variant_unref (_ret);
12691 }
12692}
12693
12694static void
12695control_proxy_set_property (GObject *object,
12696 guint prop_id,
12697 const GValue *value,
12698 GParamSpec *pspec G_GNUC_UNUSED)
12699{
12700 const _ExtendedGDBusPropertyInfo *info;
12701 GVariant *variant;
12702 g_assert (prop_id != 0 && prop_id - 1 < 2);
12703 info = _control_property_info_pointers[prop_id - 1];
12704 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
12705 g_dbus_proxy_call (G_DBUS_PROXY (object),
12706 "org.freedesktop.DBus.Properties.Set",
12707 g_variant_new ("(ssv)", "org.openbmc.Control", info->parent_struct.name, variant),
12708 G_DBUS_CALL_FLAGS_NONE,
12709 -1,
12710 NULL, (GAsyncReadyCallback) control_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
12711 g_variant_unref (variant);
12712}
12713
12714static void
12715control_proxy_g_signal (GDBusProxy *proxy,
12716 const gchar *sender_name G_GNUC_UNUSED,
12717 const gchar *signal_name,
12718 GVariant *parameters)
12719{
12720 _ExtendedGDBusSignalInfo *info;
12721 GVariantIter iter;
12722 GVariant *child;
12723 GValue *paramv;
12724 guint num_params;
12725 guint n;
12726 guint signal_id;
12727 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, signal_name);
12728 if (info == NULL)
12729 return;
12730 num_params = g_variant_n_children (parameters);
12731 paramv = g_new0 (GValue, num_params + 1);
12732 g_value_init (&paramv[0], TYPE_CONTROL);
12733 g_value_set_object (&paramv[0], proxy);
12734 g_variant_iter_init (&iter, parameters);
12735 n = 1;
12736 while ((child = g_variant_iter_next_value (&iter)) != NULL)
12737 {
12738 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
12739 if (arg_info->use_gvariant)
12740 {
12741 g_value_init (&paramv[n], G_TYPE_VARIANT);
12742 g_value_set_variant (&paramv[n], child);
12743 n++;
12744 }
12745 else
12746 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
12747 g_variant_unref (child);
12748 }
12749 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL);
12750 g_signal_emitv (paramv, signal_id, 0, NULL);
12751 for (n = 0; n < num_params + 1; n++)
12752 g_value_unset (&paramv[n]);
12753 g_free (paramv);
12754}
12755
12756static void
12757control_proxy_g_properties_changed (GDBusProxy *_proxy,
12758 GVariant *changed_properties,
12759 const gchar *const *invalidated_properties)
12760{
12761 ControlProxy *proxy = CONTROL_PROXY (_proxy);
12762 guint n;
12763 const gchar *key;
12764 GVariantIter *iter;
12765 _ExtendedGDBusPropertyInfo *info;
12766 g_variant_get (changed_properties, "a{sv}", &iter);
12767 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
12768 {
12769 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, key);
12770 g_datalist_remove_data (&proxy->priv->qdata, key);
12771 if (info != NULL)
12772 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
12773 }
12774 g_variant_iter_free (iter);
12775 for (n = 0; invalidated_properties[n] != NULL; n++)
12776 {
12777 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, invalidated_properties[n]);
12778 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
12779 if (info != NULL)
12780 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
12781 }
12782}
12783
12784static gint
12785control_proxy_get_poll_interval (Control *object)
12786{
12787 ControlProxy *proxy = CONTROL_PROXY (object);
12788 GVariant *variant;
12789 gint value = 0;
12790 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "poll_interval");
12791 if (variant != NULL)
12792 {
12793 value = g_variant_get_int32 (variant);
12794 g_variant_unref (variant);
12795 }
12796 return value;
12797}
12798
12799static gint
12800control_proxy_get_heatbeat (Control *object)
12801{
12802 ControlProxy *proxy = CONTROL_PROXY (object);
12803 GVariant *variant;
12804 gint value = 0;
12805 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "heatbeat");
12806 if (variant != NULL)
12807 {
12808 value = g_variant_get_int32 (variant);
12809 g_variant_unref (variant);
12810 }
12811 return value;
12812}
12813
12814static void
12815control_proxy_init (ControlProxy *proxy)
12816{
12817#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
12818 proxy->priv = control_proxy_get_instance_private (proxy);
12819#else
12820 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_PROXY, ControlProxyPrivate);
12821#endif
12822
12823 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_interface_info ());
12824}
12825
12826static void
12827control_proxy_class_init (ControlProxyClass *klass)
12828{
12829 GObjectClass *gobject_class;
12830 GDBusProxyClass *proxy_class;
12831
12832 gobject_class = G_OBJECT_CLASS (klass);
12833 gobject_class->finalize = control_proxy_finalize;
12834 gobject_class->get_property = control_proxy_get_property;
12835 gobject_class->set_property = control_proxy_set_property;
12836
12837 proxy_class = G_DBUS_PROXY_CLASS (klass);
12838 proxy_class->g_signal = control_proxy_g_signal;
12839 proxy_class->g_properties_changed = control_proxy_g_properties_changed;
12840
12841 control_override_properties (gobject_class, 1);
12842
12843#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
12844 g_type_class_add_private (klass, sizeof (ControlProxyPrivate));
12845#endif
12846}
12847
12848static void
12849control_proxy_iface_init (ControlIface *iface)
12850{
12851 iface->get_poll_interval = control_proxy_get_poll_interval;
12852 iface->get_heatbeat = control_proxy_get_heatbeat;
12853}
12854
12855/**
12856 * control_proxy_new:
12857 * @connection: A #GDBusConnection.
12858 * @flags: Flags from the #GDBusProxyFlags enumeration.
12859 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
12860 * @object_path: An object path.
12861 * @cancellable: (allow-none): A #GCancellable or %NULL.
12862 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
12863 * @user_data: User data to pass to @callback.
12864 *
12865 * 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.
12866 *
12867 * 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.
12868 * You can then call control_proxy_new_finish() to get the result of the operation.
12869 *
12870 * See control_proxy_new_sync() for the synchronous, blocking version of this constructor.
12871 */
12872void
12873control_proxy_new (
12874 GDBusConnection *connection,
12875 GDBusProxyFlags flags,
12876 const gchar *name,
12877 const gchar *object_path,
12878 GCancellable *cancellable,
12879 GAsyncReadyCallback callback,
12880 gpointer user_data)
12881{
12882 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);
12883}
12884
12885/**
12886 * control_proxy_new_finish:
12887 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_proxy_new().
12888 * @error: Return location for error or %NULL
12889 *
12890 * Finishes an operation started with control_proxy_new().
12891 *
12892 * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set.
12893 */
12894Control *
12895control_proxy_new_finish (
12896 GAsyncResult *res,
12897 GError **error)
12898{
12899 GObject *ret;
12900 GObject *source_object;
12901 source_object = g_async_result_get_source_object (res);
12902 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
12903 g_object_unref (source_object);
12904 if (ret != NULL)
12905 return CONTROL (ret);
12906 else
12907 return NULL;
12908}
12909
12910/**
12911 * control_proxy_new_sync:
12912 * @connection: A #GDBusConnection.
12913 * @flags: Flags from the #GDBusProxyFlags enumeration.
12914 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
12915 * @object_path: An object path.
12916 * @cancellable: (allow-none): A #GCancellable or %NULL.
12917 * @error: Return location for error or %NULL
12918 *
12919 * 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.
12920 *
12921 * The calling thread is blocked until a reply is received.
12922 *
12923 * See control_proxy_new() for the asynchronous version of this constructor.
12924 *
12925 * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set.
12926 */
12927Control *
12928control_proxy_new_sync (
12929 GDBusConnection *connection,
12930 GDBusProxyFlags flags,
12931 const gchar *name,
12932 const gchar *object_path,
12933 GCancellable *cancellable,
12934 GError **error)
12935{
12936 GInitable *ret;
12937 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);
12938 if (ret != NULL)
12939 return CONTROL (ret);
12940 else
12941 return NULL;
12942}
12943
12944
12945/**
12946 * control_proxy_new_for_bus:
12947 * @bus_type: A #GBusType.
12948 * @flags: Flags from the #GDBusProxyFlags enumeration.
12949 * @name: A bus name (well-known or unique).
12950 * @object_path: An object path.
12951 * @cancellable: (allow-none): A #GCancellable or %NULL.
12952 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
12953 * @user_data: User data to pass to @callback.
12954 *
12955 * Like control_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
12956 *
12957 * 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.
12958 * You can then call control_proxy_new_for_bus_finish() to get the result of the operation.
12959 *
12960 * See control_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
12961 */
12962void
12963control_proxy_new_for_bus (
12964 GBusType bus_type,
12965 GDBusProxyFlags flags,
12966 const gchar *name,
12967 const gchar *object_path,
12968 GCancellable *cancellable,
12969 GAsyncReadyCallback callback,
12970 gpointer user_data)
12971{
12972 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);
12973}
12974
12975/**
12976 * control_proxy_new_for_bus_finish:
12977 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_proxy_new_for_bus().
12978 * @error: Return location for error or %NULL
12979 *
12980 * Finishes an operation started with control_proxy_new_for_bus().
12981 *
12982 * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set.
12983 */
12984Control *
12985control_proxy_new_for_bus_finish (
12986 GAsyncResult *res,
12987 GError **error)
12988{
12989 GObject *ret;
12990 GObject *source_object;
12991 source_object = g_async_result_get_source_object (res);
12992 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
12993 g_object_unref (source_object);
12994 if (ret != NULL)
12995 return CONTROL (ret);
12996 else
12997 return NULL;
12998}
12999
13000/**
13001 * control_proxy_new_for_bus_sync:
13002 * @bus_type: A #GBusType.
13003 * @flags: Flags from the #GDBusProxyFlags enumeration.
13004 * @name: A bus name (well-known or unique).
13005 * @object_path: An object path.
13006 * @cancellable: (allow-none): A #GCancellable or %NULL.
13007 * @error: Return location for error or %NULL
13008 *
13009 * Like control_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
13010 *
13011 * The calling thread is blocked until a reply is received.
13012 *
13013 * See control_proxy_new_for_bus() for the asynchronous version of this constructor.
13014 *
13015 * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set.
13016 */
13017Control *
13018control_proxy_new_for_bus_sync (
13019 GBusType bus_type,
13020 GDBusProxyFlags flags,
13021 const gchar *name,
13022 const gchar *object_path,
13023 GCancellable *cancellable,
13024 GError **error)
13025{
13026 GInitable *ret;
13027 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);
13028 if (ret != NULL)
13029 return CONTROL (ret);
13030 else
13031 return NULL;
13032}
13033
13034
13035/* ------------------------------------------------------------------------ */
13036
13037/**
13038 * ControlSkeleton:
13039 *
13040 * The #ControlSkeleton structure contains only private data and should only be accessed using the provided API.
13041 */
13042
13043/**
13044 * ControlSkeletonClass:
13045 * @parent_class: The parent class.
13046 *
13047 * Class structure for #ControlSkeleton.
13048 */
13049
13050struct _ControlSkeletonPrivate
13051{
13052 GValue *properties;
13053 GList *changed_properties;
13054 GSource *changed_properties_idle_source;
13055 GMainContext *context;
13056 GMutex lock;
13057};
13058
13059static void
13060_control_skeleton_handle_method_call (
13061 GDBusConnection *connection G_GNUC_UNUSED,
13062 const gchar *sender G_GNUC_UNUSED,
13063 const gchar *object_path G_GNUC_UNUSED,
13064 const gchar *interface_name,
13065 const gchar *method_name,
13066 GVariant *parameters,
13067 GDBusMethodInvocation *invocation,
13068 gpointer user_data)
13069{
13070 ControlSkeleton *skeleton = CONTROL_SKELETON (user_data);
13071 _ExtendedGDBusMethodInfo *info;
13072 GVariantIter iter;
13073 GVariant *child;
13074 GValue *paramv;
13075 guint num_params;
13076 guint num_extra;
13077 guint n;
13078 guint signal_id;
13079 GValue return_value = G_VALUE_INIT;
13080 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
13081 g_assert (info != NULL);
13082 num_params = g_variant_n_children (parameters);
13083 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
13084 n = 0;
13085 g_value_init (&paramv[n], TYPE_CONTROL);
13086 g_value_set_object (&paramv[n++], skeleton);
13087 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
13088 g_value_set_object (&paramv[n++], invocation);
13089 if (info->pass_fdlist)
13090 {
13091#ifdef G_OS_UNIX
13092 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
13093 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
13094#else
13095 g_assert_not_reached ();
13096#endif
13097 }
13098 g_variant_iter_init (&iter, parameters);
13099 while ((child = g_variant_iter_next_value (&iter)) != NULL)
13100 {
13101 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
13102 if (arg_info->use_gvariant)
13103 {
13104 g_value_init (&paramv[n], G_TYPE_VARIANT);
13105 g_value_set_variant (&paramv[n], child);
13106 n++;
13107 }
13108 else
13109 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
13110 g_variant_unref (child);
13111 }
13112 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL);
13113 g_value_init (&return_value, G_TYPE_BOOLEAN);
13114 g_signal_emitv (paramv, signal_id, 0, &return_value);
13115 if (!g_value_get_boolean (&return_value))
13116 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);
13117 g_value_unset (&return_value);
13118 for (n = 0; n < num_params + num_extra; n++)
13119 g_value_unset (&paramv[n]);
13120 g_free (paramv);
13121}
13122
13123static GVariant *
13124_control_skeleton_handle_get_property (
13125 GDBusConnection *connection G_GNUC_UNUSED,
13126 const gchar *sender G_GNUC_UNUSED,
13127 const gchar *object_path G_GNUC_UNUSED,
13128 const gchar *interface_name G_GNUC_UNUSED,
13129 const gchar *property_name,
13130 GError **error,
13131 gpointer user_data)
13132{
13133 ControlSkeleton *skeleton = CONTROL_SKELETON (user_data);
13134 GValue value = G_VALUE_INIT;
13135 GParamSpec *pspec;
13136 _ExtendedGDBusPropertyInfo *info;
13137 GVariant *ret;
13138 ret = NULL;
13139 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, property_name);
13140 g_assert (info != NULL);
13141 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
13142 if (pspec == NULL)
13143 {
13144 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
13145 }
13146 else
13147 {
13148 g_value_init (&value, pspec->value_type);
13149 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
13150 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
13151 g_value_unset (&value);
13152 }
13153 return ret;
13154}
13155
13156static gboolean
13157_control_skeleton_handle_set_property (
13158 GDBusConnection *connection G_GNUC_UNUSED,
13159 const gchar *sender G_GNUC_UNUSED,
13160 const gchar *object_path G_GNUC_UNUSED,
13161 const gchar *interface_name G_GNUC_UNUSED,
13162 const gchar *property_name,
13163 GVariant *variant,
13164 GError **error,
13165 gpointer user_data)
13166{
13167 ControlSkeleton *skeleton = CONTROL_SKELETON (user_data);
13168 GValue value = G_VALUE_INIT;
13169 GParamSpec *pspec;
13170 _ExtendedGDBusPropertyInfo *info;
13171 gboolean ret;
13172 ret = FALSE;
13173 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, property_name);
13174 g_assert (info != NULL);
13175 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
13176 if (pspec == NULL)
13177 {
13178 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
13179 }
13180 else
13181 {
13182 if (info->use_gvariant)
13183 g_value_set_variant (&value, variant);
13184 else
13185 g_dbus_gvariant_to_gvalue (variant, &value);
13186 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
13187 g_value_unset (&value);
13188 ret = TRUE;
13189 }
13190 return ret;
13191}
13192
13193static const GDBusInterfaceVTable _control_skeleton_vtable =
13194{
13195 _control_skeleton_handle_method_call,
13196 _control_skeleton_handle_get_property,
13197 _control_skeleton_handle_set_property,
13198 {NULL}
13199};
13200
13201static GDBusInterfaceInfo *
13202control_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
13203{
13204 return control_interface_info ();
13205}
13206
13207static GDBusInterfaceVTable *
13208control_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
13209{
13210 return (GDBusInterfaceVTable *) &_control_skeleton_vtable;
13211}
13212
13213static GVariant *
13214control_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
13215{
13216 ControlSkeleton *skeleton = CONTROL_SKELETON (_skeleton);
13217
13218 GVariantBuilder builder;
13219 guint n;
13220 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
13221 if (_control_interface_info.parent_struct.properties == NULL)
13222 goto out;
13223 for (n = 0; _control_interface_info.parent_struct.properties[n] != NULL; n++)
13224 {
13225 GDBusPropertyInfo *info = _control_interface_info.parent_struct.properties[n];
13226 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
13227 {
13228 GVariant *value;
13229 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);
13230 if (value != NULL)
13231 {
13232 g_variant_take_ref (value);
13233 g_variant_builder_add (&builder, "{sv}", info->name, value);
13234 g_variant_unref (value);
13235 }
13236 }
13237 }
13238out:
13239 return g_variant_builder_end (&builder);
13240}
13241
13242static gboolean _control_emit_changed (gpointer user_data);
13243
13244static void
13245control_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
13246{
13247 ControlSkeleton *skeleton = CONTROL_SKELETON (_skeleton);
13248 gboolean emit_changed = FALSE;
13249
13250 g_mutex_lock (&skeleton->priv->lock);
13251 if (skeleton->priv->changed_properties_idle_source != NULL)
13252 {
13253 g_source_destroy (skeleton->priv->changed_properties_idle_source);
13254 skeleton->priv->changed_properties_idle_source = NULL;
13255 emit_changed = TRUE;
13256 }
13257 g_mutex_unlock (&skeleton->priv->lock);
13258
13259 if (emit_changed)
13260 _control_emit_changed (skeleton);
13261}
13262
13263static void
13264_control_on_signal_heartbeat (
13265 Control *object,
13266 const gchar *arg_bus_name)
13267{
13268 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
13269
13270 GList *connections, *l;
13271 GVariant *signal_variant;
13272 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
13273
13274 signal_variant = g_variant_ref_sink (g_variant_new ("(s)",
13275 arg_bus_name));
13276 for (l = connections; l != NULL; l = l->next)
13277 {
13278 GDBusConnection *connection = l->data;
13279 g_dbus_connection_emit_signal (connection,
13280 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Control", "Heartbeat",
13281 signal_variant, NULL);
13282 }
13283 g_variant_unref (signal_variant);
13284 g_list_free_full (connections, g_object_unref);
13285}
13286
13287static void
13288_control_on_signal_goto_system_state (
13289 Control *object,
13290 const gchar *arg_state_name)
13291{
13292 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
13293
13294 GList *connections, *l;
13295 GVariant *signal_variant;
13296 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
13297
13298 signal_variant = g_variant_ref_sink (g_variant_new ("(s)",
13299 arg_state_name));
13300 for (l = connections; l != NULL; l = l->next)
13301 {
13302 GDBusConnection *connection = l->data;
13303 g_dbus_connection_emit_signal (connection,
13304 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Control", "GotoSystemState",
13305 signal_variant, NULL);
13306 }
13307 g_variant_unref (signal_variant);
13308 g_list_free_full (connections, g_object_unref);
13309}
13310
Norman Jamesa3e47c42015-10-18 14:43:10 -050013311static void
13312_control_on_signal_started (
13313 Control *object)
13314{
13315 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
13316
13317 GList *connections, *l;
13318 GVariant *signal_variant;
13319 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
13320
13321 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
13322 for (l = connections; l != NULL; l = l->next)
13323 {
13324 GDBusConnection *connection = l->data;
13325 g_dbus_connection_emit_signal (connection,
13326 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Control", "Started",
13327 signal_variant, NULL);
13328 }
13329 g_variant_unref (signal_variant);
13330 g_list_free_full (connections, g_object_unref);
13331}
13332
Norman James362a80f2015-09-14 14:04:39 -050013333static void control_skeleton_iface_init (ControlIface *iface);
13334#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
13335G_DEFINE_TYPE_WITH_CODE (ControlSkeleton, control_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
13336 G_ADD_PRIVATE (ControlSkeleton)
13337 G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_skeleton_iface_init));
13338
13339#else
13340G_DEFINE_TYPE_WITH_CODE (ControlSkeleton, control_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
13341 G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_skeleton_iface_init));
13342
13343#endif
13344static void
13345control_skeleton_finalize (GObject *object)
13346{
13347 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
13348 guint n;
13349 for (n = 0; n < 2; n++)
13350 g_value_unset (&skeleton->priv->properties[n]);
13351 g_free (skeleton->priv->properties);
13352 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
13353 if (skeleton->priv->changed_properties_idle_source != NULL)
13354 g_source_destroy (skeleton->priv->changed_properties_idle_source);
13355 g_main_context_unref (skeleton->priv->context);
13356 g_mutex_clear (&skeleton->priv->lock);
13357 G_OBJECT_CLASS (control_skeleton_parent_class)->finalize (object);
13358}
13359
13360static void
13361control_skeleton_get_property (GObject *object,
13362 guint prop_id,
13363 GValue *value,
13364 GParamSpec *pspec G_GNUC_UNUSED)
13365{
13366 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
13367 g_assert (prop_id != 0 && prop_id - 1 < 2);
13368 g_mutex_lock (&skeleton->priv->lock);
13369 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
13370 g_mutex_unlock (&skeleton->priv->lock);
13371}
13372
13373static gboolean
13374_control_emit_changed (gpointer user_data)
13375{
13376 ControlSkeleton *skeleton = CONTROL_SKELETON (user_data);
13377 GList *l;
13378 GVariantBuilder builder;
13379 GVariantBuilder invalidated_builder;
13380 guint num_changes;
13381
13382 g_mutex_lock (&skeleton->priv->lock);
13383 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
13384 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
13385 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
13386 {
13387 ChangedProperty *cp = l->data;
13388 GVariant *variant;
13389 const GValue *cur_value;
13390
13391 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
13392 if (!_g_value_equal (cur_value, &cp->orig_value))
13393 {
13394 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
13395 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
13396 g_variant_unref (variant);
13397 num_changes++;
13398 }
13399 }
13400 if (num_changes > 0)
13401 {
13402 GList *connections, *ll;
13403 GVariant *signal_variant;
13404 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Control",
13405 &builder, &invalidated_builder));
13406 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
13407 for (ll = connections; ll != NULL; ll = ll->next)
13408 {
13409 GDBusConnection *connection = ll->data;
13410
13411 g_dbus_connection_emit_signal (connection,
13412 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
13413 "org.freedesktop.DBus.Properties",
13414 "PropertiesChanged",
13415 signal_variant,
13416 NULL);
13417 }
13418 g_variant_unref (signal_variant);
13419 g_list_free_full (connections, g_object_unref);
13420 }
13421 else
13422 {
13423 g_variant_builder_clear (&builder);
13424 g_variant_builder_clear (&invalidated_builder);
13425 }
13426 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
13427 skeleton->priv->changed_properties = NULL;
13428 skeleton->priv->changed_properties_idle_source = NULL;
13429 g_mutex_unlock (&skeleton->priv->lock);
13430 return FALSE;
13431}
13432
13433static void
13434_control_schedule_emit_changed (ControlSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
13435{
13436 ChangedProperty *cp;
13437 GList *l;
13438 cp = NULL;
13439 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
13440 {
13441 ChangedProperty *i_cp = l->data;
13442 if (i_cp->info == info)
13443 {
13444 cp = i_cp;
13445 break;
13446 }
13447 }
13448 if (cp == NULL)
13449 {
13450 cp = g_new0 (ChangedProperty, 1);
13451 cp->prop_id = prop_id;
13452 cp->info = info;
13453 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
13454 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
13455 g_value_copy (orig_value, &cp->orig_value);
13456 }
13457}
13458
13459static void
13460control_skeleton_notify (GObject *object,
13461 GParamSpec *pspec G_GNUC_UNUSED)
13462{
13463 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
13464 g_mutex_lock (&skeleton->priv->lock);
13465 if (skeleton->priv->changed_properties != NULL &&
13466 skeleton->priv->changed_properties_idle_source == NULL)
13467 {
13468 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
13469 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
13470 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _control_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
13471 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
13472 g_source_unref (skeleton->priv->changed_properties_idle_source);
13473 }
13474 g_mutex_unlock (&skeleton->priv->lock);
13475}
13476
13477static void
13478control_skeleton_set_property (GObject *object,
13479 guint prop_id,
13480 const GValue *value,
13481 GParamSpec *pspec)
13482{
13483 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
13484 g_assert (prop_id != 0 && prop_id - 1 < 2);
13485 g_mutex_lock (&skeleton->priv->lock);
13486 g_object_freeze_notify (object);
13487 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
13488 {
13489 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
13490 _control_schedule_emit_changed (skeleton, _control_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
13491 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
13492 g_object_notify_by_pspec (object, pspec);
13493 }
13494 g_mutex_unlock (&skeleton->priv->lock);
13495 g_object_thaw_notify (object);
13496}
13497
13498static void
13499control_skeleton_init (ControlSkeleton *skeleton)
13500{
13501#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
13502 skeleton->priv = control_skeleton_get_instance_private (skeleton);
13503#else
13504 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_SKELETON, ControlSkeletonPrivate);
13505#endif
13506
13507 g_mutex_init (&skeleton->priv->lock);
13508 skeleton->priv->context = g_main_context_ref_thread_default ();
13509 skeleton->priv->properties = g_new0 (GValue, 2);
13510 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
13511 g_value_init (&skeleton->priv->properties[1], G_TYPE_INT);
13512}
13513
13514static gint
13515control_skeleton_get_poll_interval (Control *object)
13516{
13517 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
13518 gint value;
13519 g_mutex_lock (&skeleton->priv->lock);
13520 value = g_value_get_int (&(skeleton->priv->properties[0]));
13521 g_mutex_unlock (&skeleton->priv->lock);
13522 return value;
13523}
13524
13525static gint
13526control_skeleton_get_heatbeat (Control *object)
13527{
13528 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
13529 gint value;
13530 g_mutex_lock (&skeleton->priv->lock);
13531 value = g_value_get_int (&(skeleton->priv->properties[1]));
13532 g_mutex_unlock (&skeleton->priv->lock);
13533 return value;
13534}
13535
13536static void
13537control_skeleton_class_init (ControlSkeletonClass *klass)
13538{
13539 GObjectClass *gobject_class;
13540 GDBusInterfaceSkeletonClass *skeleton_class;
13541
13542 gobject_class = G_OBJECT_CLASS (klass);
13543 gobject_class->finalize = control_skeleton_finalize;
13544 gobject_class->get_property = control_skeleton_get_property;
13545 gobject_class->set_property = control_skeleton_set_property;
13546 gobject_class->notify = control_skeleton_notify;
13547
13548
13549 control_override_properties (gobject_class, 1);
13550
13551 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
13552 skeleton_class->get_info = control_skeleton_dbus_interface_get_info;
13553 skeleton_class->get_properties = control_skeleton_dbus_interface_get_properties;
13554 skeleton_class->flush = control_skeleton_dbus_interface_flush;
13555 skeleton_class->get_vtable = control_skeleton_dbus_interface_get_vtable;
13556
13557#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
13558 g_type_class_add_private (klass, sizeof (ControlSkeletonPrivate));
13559#endif
13560}
13561
13562static void
13563control_skeleton_iface_init (ControlIface *iface)
13564{
13565 iface->heartbeat = _control_on_signal_heartbeat;
13566 iface->goto_system_state = _control_on_signal_goto_system_state;
Norman Jamesa3e47c42015-10-18 14:43:10 -050013567 iface->started = _control_on_signal_started;
Norman James362a80f2015-09-14 14:04:39 -050013568 iface->get_poll_interval = control_skeleton_get_poll_interval;
13569 iface->get_heatbeat = control_skeleton_get_heatbeat;
13570}
13571
13572/**
13573 * control_skeleton_new:
13574 *
13575 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link>.
13576 *
13577 * Returns: (transfer full) (type ControlSkeleton): The skeleton object.
13578 */
13579Control *
13580control_skeleton_new (void)
13581{
13582 return CONTROL (g_object_new (TYPE_CONTROL_SKELETON, NULL));
13583}
13584
13585/* ------------------------------------------------------------------------
13586 * Code for interface org.openbmc.control.Bmc
13587 * ------------------------------------------------------------------------
13588 */
13589
13590/**
13591 * SECTION:ControlBmc
13592 * @title: ControlBmc
13593 * @short_description: Generated C code for the org.openbmc.control.Bmc D-Bus interface
13594 *
13595 * 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.
13596 */
13597
13598/* ---- Introspection data for org.openbmc.control.Bmc ---- */
13599
Nan Li44dd5a62016-08-24 17:13:06 +080013600static const _ExtendedGDBusMethodInfo _control_bmc_method_info_cold_reset =
13601{
13602 {
13603 -1,
13604 (gchar *) "coldReset",
13605 NULL,
13606 NULL,
13607 NULL
13608 },
13609 "handle-cold-reset",
13610 FALSE
13611};
13612
Williamf784d752016-01-19 12:28:49 +080013613static const _ExtendedGDBusMethodInfo _control_bmc_method_info_warm_reset =
Norman James362a80f2015-09-14 14:04:39 -050013614{
13615 {
13616 -1,
Williamf784d752016-01-19 12:28:49 +080013617 (gchar *) "warmReset",
Norman James362a80f2015-09-14 14:04:39 -050013618 NULL,
13619 NULL,
13620 NULL
13621 },
Williamf784d752016-01-19 12:28:49 +080013622 "handle-warm-reset",
Norman James362a80f2015-09-14 14:04:39 -050013623 FALSE
13624};
13625
13626static const _ExtendedGDBusMethodInfo * const _control_bmc_method_info_pointers[] =
13627{
Nan Li44dd5a62016-08-24 17:13:06 +080013628 &_control_bmc_method_info_cold_reset,
Williamf784d752016-01-19 12:28:49 +080013629 &_control_bmc_method_info_warm_reset,
Norman James362a80f2015-09-14 14:04:39 -050013630 NULL
13631};
13632
13633static const _ExtendedGDBusInterfaceInfo _control_bmc_interface_info =
13634{
13635 {
13636 -1,
13637 (gchar *) "org.openbmc.control.Bmc",
13638 (GDBusMethodInfo **) &_control_bmc_method_info_pointers,
13639 NULL,
13640 NULL,
13641 NULL
13642 },
13643 "control-bmc",
13644};
13645
13646
13647/**
13648 * control_bmc_interface_info:
13649 *
13650 * 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.
13651 *
13652 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
13653 */
13654GDBusInterfaceInfo *
13655control_bmc_interface_info (void)
13656{
13657 return (GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct;
13658}
13659
13660/**
13661 * control_bmc_override_properties:
13662 * @klass: The class structure for a #GObject<!-- -->-derived class.
13663 * @property_id_begin: The property id to assign to the first overridden property.
13664 *
13665 * Overrides all #GObject properties in the #ControlBmc interface for a concrete class.
13666 * The properties are overridden in the order they are defined.
13667 *
13668 * Returns: The last property id.
13669 */
13670guint
13671control_bmc_override_properties (GObjectClass *klass, guint property_id_begin)
13672{
13673 return property_id_begin - 1;
13674}
13675
13676
13677
13678/**
13679 * ControlBmc:
13680 *
13681 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Bmc.top_of_page">org.openbmc.control.Bmc</link>.
13682 */
13683
13684/**
13685 * ControlBmcIface:
13686 * @parent_iface: The parent interface.
Nan Li44dd5a62016-08-24 17:13:06 +080013687 * @handle_cold_reset: Handler for the #ControlBmc::handle-cold-reset signal.
Williamf784d752016-01-19 12:28:49 +080013688 * @handle_warm_reset: Handler for the #ControlBmc::handle-warm-reset signal.
Norman James362a80f2015-09-14 14:04:39 -050013689 *
13690 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Bmc.top_of_page">org.openbmc.control.Bmc</link>.
13691 */
13692
13693typedef ControlBmcIface ControlBmcInterface;
13694G_DEFINE_INTERFACE (ControlBmc, control_bmc, G_TYPE_OBJECT);
13695
13696static void
13697control_bmc_default_init (ControlBmcIface *iface)
13698{
13699 /* GObject signals for incoming D-Bus method calls: */
13700 /**
Nan Li44dd5a62016-08-24 17:13:06 +080013701 * ControlBmc::handle-cold-reset:
13702 * @object: A #ControlBmc.
13703 * @invocation: A #GDBusMethodInvocation.
13704 *
13705 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Bmc.coldReset">coldReset()</link> D-Bus method.
13706 *
13707 * 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_cold_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.
13708 *
13709 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
13710 */
13711 g_signal_new ("handle-cold-reset",
13712 G_TYPE_FROM_INTERFACE (iface),
13713 G_SIGNAL_RUN_LAST,
13714 G_STRUCT_OFFSET (ControlBmcIface, handle_cold_reset),
13715 g_signal_accumulator_true_handled,
13716 NULL,
13717 g_cclosure_marshal_generic,
13718 G_TYPE_BOOLEAN,
13719 1,
13720 G_TYPE_DBUS_METHOD_INVOCATION);
13721
13722 /**
Williamf784d752016-01-19 12:28:49 +080013723 * ControlBmc::handle-warm-reset:
Norman James362a80f2015-09-14 14:04:39 -050013724 * @object: A #ControlBmc.
13725 * @invocation: A #GDBusMethodInvocation.
13726 *
Williamf784d752016-01-19 12:28:49 +080013727 * 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 -050013728 *
Williamf784d752016-01-19 12:28:49 +080013729 * 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 -050013730 *
13731 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
13732 */
Williamf784d752016-01-19 12:28:49 +080013733 g_signal_new ("handle-warm-reset",
Norman James362a80f2015-09-14 14:04:39 -050013734 G_TYPE_FROM_INTERFACE (iface),
13735 G_SIGNAL_RUN_LAST,
Williamf784d752016-01-19 12:28:49 +080013736 G_STRUCT_OFFSET (ControlBmcIface, handle_warm_reset),
Norman James362a80f2015-09-14 14:04:39 -050013737 g_signal_accumulator_true_handled,
13738 NULL,
13739 g_cclosure_marshal_generic,
13740 G_TYPE_BOOLEAN,
13741 1,
13742 G_TYPE_DBUS_METHOD_INVOCATION);
13743
13744}
13745
13746/**
Nan Li44dd5a62016-08-24 17:13:06 +080013747 * control_bmc_call_cold_reset:
13748 * @proxy: A #ControlBmcProxy.
13749 * @cancellable: (allow-none): A #GCancellable or %NULL.
13750 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
13751 * @user_data: User data to pass to @callback.
13752 *
13753 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Bmc.coldReset">coldReset()</link> D-Bus method on @proxy.
13754 * 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.
13755 * You can then call control_bmc_call_cold_reset_finish() to get the result of the operation.
13756 *
13757 * See control_bmc_call_cold_reset_sync() for the synchronous, blocking version of this method.
13758 */
13759void
13760control_bmc_call_cold_reset (
13761 ControlBmc *proxy,
13762 GCancellable *cancellable,
13763 GAsyncReadyCallback callback,
13764 gpointer user_data)
13765{
13766 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
13767 "coldReset",
13768 g_variant_new ("()"),
13769 G_DBUS_CALL_FLAGS_NONE,
13770 -1,
13771 cancellable,
13772 callback,
13773 user_data);
13774}
13775
13776/**
13777 * control_bmc_call_cold_reset_finish:
13778 * @proxy: A #ControlBmcProxy.
13779 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_bmc_call_cold_reset().
13780 * @error: Return location for error or %NULL.
13781 *
13782 * Finishes an operation started with control_bmc_call_cold_reset().
13783 *
13784 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
13785 */
13786gboolean
13787control_bmc_call_cold_reset_finish (
13788 ControlBmc *proxy,
13789 GAsyncResult *res,
13790 GError **error)
13791{
13792 GVariant *_ret;
13793 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
13794 if (_ret == NULL)
13795 goto _out;
13796 g_variant_get (_ret,
13797 "()");
13798 g_variant_unref (_ret);
13799_out:
13800 return _ret != NULL;
13801}
13802
13803/**
13804 * control_bmc_call_cold_reset_sync:
13805 * @proxy: A #ControlBmcProxy.
13806 * @cancellable: (allow-none): A #GCancellable or %NULL.
13807 * @error: Return location for error or %NULL.
13808 *
13809 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Bmc.coldReset">coldReset()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
13810 *
13811 * See control_bmc_call_cold_reset() for the asynchronous version of this method.
13812 *
13813 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
13814 */
13815gboolean
13816control_bmc_call_cold_reset_sync (
13817 ControlBmc *proxy,
13818 GCancellable *cancellable,
13819 GError **error)
13820{
13821 GVariant *_ret;
13822 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
13823 "coldReset",
13824 g_variant_new ("()"),
13825 G_DBUS_CALL_FLAGS_NONE,
13826 -1,
13827 cancellable,
13828 error);
13829 if (_ret == NULL)
13830 goto _out;
13831 g_variant_get (_ret,
13832 "()");
13833 g_variant_unref (_ret);
13834_out:
13835 return _ret != NULL;
13836}
13837
13838/**
Williamf784d752016-01-19 12:28:49 +080013839 * control_bmc_call_warm_reset:
Norman James362a80f2015-09-14 14:04:39 -050013840 * @proxy: A #ControlBmcProxy.
13841 * @cancellable: (allow-none): A #GCancellable or %NULL.
13842 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
13843 * @user_data: User data to pass to @callback.
13844 *
Williamf784d752016-01-19 12:28:49 +080013845 * 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 -050013846 * 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 +080013847 * You can then call control_bmc_call_warm_reset_finish() to get the result of the operation.
Norman James362a80f2015-09-14 14:04:39 -050013848 *
Williamf784d752016-01-19 12:28:49 +080013849 * See control_bmc_call_warm_reset_sync() for the synchronous, blocking version of this method.
Norman James362a80f2015-09-14 14:04:39 -050013850 */
13851void
Williamf784d752016-01-19 12:28:49 +080013852control_bmc_call_warm_reset (
Norman James362a80f2015-09-14 14:04:39 -050013853 ControlBmc *proxy,
13854 GCancellable *cancellable,
13855 GAsyncReadyCallback callback,
13856 gpointer user_data)
13857{
13858 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
Williamf784d752016-01-19 12:28:49 +080013859 "warmReset",
Norman James362a80f2015-09-14 14:04:39 -050013860 g_variant_new ("()"),
13861 G_DBUS_CALL_FLAGS_NONE,
13862 -1,
13863 cancellable,
13864 callback,
13865 user_data);
13866}
13867
13868/**
Williamf784d752016-01-19 12:28:49 +080013869 * control_bmc_call_warm_reset_finish:
Norman James362a80f2015-09-14 14:04:39 -050013870 * @proxy: A #ControlBmcProxy.
Williamf784d752016-01-19 12:28:49 +080013871 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_bmc_call_warm_reset().
Norman James362a80f2015-09-14 14:04:39 -050013872 * @error: Return location for error or %NULL.
13873 *
Williamf784d752016-01-19 12:28:49 +080013874 * Finishes an operation started with control_bmc_call_warm_reset().
Norman James362a80f2015-09-14 14:04:39 -050013875 *
13876 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
13877 */
13878gboolean
Williamf784d752016-01-19 12:28:49 +080013879control_bmc_call_warm_reset_finish (
Norman James362a80f2015-09-14 14:04:39 -050013880 ControlBmc *proxy,
13881 GAsyncResult *res,
13882 GError **error)
13883{
13884 GVariant *_ret;
13885 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
13886 if (_ret == NULL)
13887 goto _out;
13888 g_variant_get (_ret,
13889 "()");
13890 g_variant_unref (_ret);
13891_out:
13892 return _ret != NULL;
13893}
13894
13895/**
Williamf784d752016-01-19 12:28:49 +080013896 * control_bmc_call_warm_reset_sync:
Norman James362a80f2015-09-14 14:04:39 -050013897 * @proxy: A #ControlBmcProxy.
13898 * @cancellable: (allow-none): A #GCancellable or %NULL.
13899 * @error: Return location for error or %NULL.
13900 *
Williamf784d752016-01-19 12:28:49 +080013901 * 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 -050013902 *
Williamf784d752016-01-19 12:28:49 +080013903 * See control_bmc_call_warm_reset() for the asynchronous version of this method.
Norman James362a80f2015-09-14 14:04:39 -050013904 *
13905 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
13906 */
13907gboolean
Williamf784d752016-01-19 12:28:49 +080013908control_bmc_call_warm_reset_sync (
Norman James362a80f2015-09-14 14:04:39 -050013909 ControlBmc *proxy,
13910 GCancellable *cancellable,
13911 GError **error)
13912{
13913 GVariant *_ret;
13914 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
Williamf784d752016-01-19 12:28:49 +080013915 "warmReset",
Norman James362a80f2015-09-14 14:04:39 -050013916 g_variant_new ("()"),
13917 G_DBUS_CALL_FLAGS_NONE,
13918 -1,
13919 cancellable,
13920 error);
13921 if (_ret == NULL)
13922 goto _out;
13923 g_variant_get (_ret,
13924 "()");
13925 g_variant_unref (_ret);
13926_out:
13927 return _ret != NULL;
13928}
13929
13930/**
Nan Li44dd5a62016-08-24 17:13:06 +080013931 * control_bmc_complete_cold_reset:
13932 * @object: A #ControlBmc.
13933 * @invocation: (transfer full): A #GDBusMethodInvocation.
13934 *
13935 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-control-Bmc.coldReset">coldReset()</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.
13936 *
13937 * This method will free @invocation, you cannot use it afterwards.
13938 */
13939void
13940control_bmc_complete_cold_reset (
13941 ControlBmc *object,
13942 GDBusMethodInvocation *invocation)
13943{
13944 g_dbus_method_invocation_return_value (invocation,
13945 g_variant_new ("()"));
13946}
13947
13948/**
Williamf784d752016-01-19 12:28:49 +080013949 * control_bmc_complete_warm_reset:
Norman James362a80f2015-09-14 14:04:39 -050013950 * @object: A #ControlBmc.
13951 * @invocation: (transfer full): A #GDBusMethodInvocation.
13952 *
Williamf784d752016-01-19 12:28:49 +080013953 * 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 -050013954 *
13955 * This method will free @invocation, you cannot use it afterwards.
13956 */
13957void
Williamf784d752016-01-19 12:28:49 +080013958control_bmc_complete_warm_reset (
Norman James362a80f2015-09-14 14:04:39 -050013959 ControlBmc *object,
13960 GDBusMethodInvocation *invocation)
13961{
13962 g_dbus_method_invocation_return_value (invocation,
13963 g_variant_new ("()"));
13964}
13965
13966/* ------------------------------------------------------------------------ */
13967
13968/**
13969 * ControlBmcProxy:
13970 *
13971 * The #ControlBmcProxy structure contains only private data and should only be accessed using the provided API.
13972 */
13973
13974/**
13975 * ControlBmcProxyClass:
13976 * @parent_class: The parent class.
13977 *
13978 * Class structure for #ControlBmcProxy.
13979 */
13980
13981struct _ControlBmcProxyPrivate
13982{
13983 GData *qdata;
13984};
13985
13986static void control_bmc_proxy_iface_init (ControlBmcIface *iface);
13987
13988#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
13989G_DEFINE_TYPE_WITH_CODE (ControlBmcProxy, control_bmc_proxy, G_TYPE_DBUS_PROXY,
13990 G_ADD_PRIVATE (ControlBmcProxy)
13991 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_BMC, control_bmc_proxy_iface_init));
13992
13993#else
13994G_DEFINE_TYPE_WITH_CODE (ControlBmcProxy, control_bmc_proxy, G_TYPE_DBUS_PROXY,
13995 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_BMC, control_bmc_proxy_iface_init));
13996
13997#endif
13998static void
13999control_bmc_proxy_finalize (GObject *object)
14000{
14001 ControlBmcProxy *proxy = CONTROL_BMC_PROXY (object);
14002 g_datalist_clear (&proxy->priv->qdata);
14003 G_OBJECT_CLASS (control_bmc_proxy_parent_class)->finalize (object);
14004}
14005
14006static void
14007control_bmc_proxy_get_property (GObject *object,
14008 guint prop_id,
14009 GValue *value,
14010 GParamSpec *pspec G_GNUC_UNUSED)
14011{
14012}
14013
14014static void
14015control_bmc_proxy_set_property (GObject *object,
14016 guint prop_id,
14017 const GValue *value,
14018 GParamSpec *pspec G_GNUC_UNUSED)
14019{
14020}
14021
14022static void
14023control_bmc_proxy_g_signal (GDBusProxy *proxy,
14024 const gchar *sender_name G_GNUC_UNUSED,
14025 const gchar *signal_name,
14026 GVariant *parameters)
14027{
14028 _ExtendedGDBusSignalInfo *info;
14029 GVariantIter iter;
14030 GVariant *child;
14031 GValue *paramv;
14032 guint num_params;
14033 guint n;
14034 guint signal_id;
14035 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, signal_name);
14036 if (info == NULL)
14037 return;
14038 num_params = g_variant_n_children (parameters);
14039 paramv = g_new0 (GValue, num_params + 1);
14040 g_value_init (&paramv[0], TYPE_CONTROL_BMC);
14041 g_value_set_object (&paramv[0], proxy);
14042 g_variant_iter_init (&iter, parameters);
14043 n = 1;
14044 while ((child = g_variant_iter_next_value (&iter)) != NULL)
14045 {
14046 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
14047 if (arg_info->use_gvariant)
14048 {
14049 g_value_init (&paramv[n], G_TYPE_VARIANT);
14050 g_value_set_variant (&paramv[n], child);
14051 n++;
14052 }
14053 else
14054 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
14055 g_variant_unref (child);
14056 }
14057 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_BMC);
14058 g_signal_emitv (paramv, signal_id, 0, NULL);
14059 for (n = 0; n < num_params + 1; n++)
14060 g_value_unset (&paramv[n]);
14061 g_free (paramv);
14062}
14063
14064static void
14065control_bmc_proxy_g_properties_changed (GDBusProxy *_proxy,
14066 GVariant *changed_properties,
14067 const gchar *const *invalidated_properties)
14068{
14069 ControlBmcProxy *proxy = CONTROL_BMC_PROXY (_proxy);
14070 guint n;
14071 const gchar *key;
14072 GVariantIter *iter;
14073 _ExtendedGDBusPropertyInfo *info;
14074 g_variant_get (changed_properties, "a{sv}", &iter);
14075 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
14076 {
14077 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, key);
14078 g_datalist_remove_data (&proxy->priv->qdata, key);
14079 if (info != NULL)
14080 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
14081 }
14082 g_variant_iter_free (iter);
14083 for (n = 0; invalidated_properties[n] != NULL; n++)
14084 {
14085 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, invalidated_properties[n]);
14086 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
14087 if (info != NULL)
14088 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
14089 }
14090}
14091
14092static void
14093control_bmc_proxy_init (ControlBmcProxy *proxy)
14094{
14095#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
14096 proxy->priv = control_bmc_proxy_get_instance_private (proxy);
14097#else
14098 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_BMC_PROXY, ControlBmcProxyPrivate);
14099#endif
14100
14101 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_bmc_interface_info ());
14102}
14103
14104static void
14105control_bmc_proxy_class_init (ControlBmcProxyClass *klass)
14106{
14107 GObjectClass *gobject_class;
14108 GDBusProxyClass *proxy_class;
14109
14110 gobject_class = G_OBJECT_CLASS (klass);
14111 gobject_class->finalize = control_bmc_proxy_finalize;
14112 gobject_class->get_property = control_bmc_proxy_get_property;
14113 gobject_class->set_property = control_bmc_proxy_set_property;
14114
14115 proxy_class = G_DBUS_PROXY_CLASS (klass);
14116 proxy_class->g_signal = control_bmc_proxy_g_signal;
14117 proxy_class->g_properties_changed = control_bmc_proxy_g_properties_changed;
14118
14119#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
14120 g_type_class_add_private (klass, sizeof (ControlBmcProxyPrivate));
14121#endif
14122}
14123
14124static void
14125control_bmc_proxy_iface_init (ControlBmcIface *iface)
14126{
14127}
14128
14129/**
14130 * control_bmc_proxy_new:
14131 * @connection: A #GDBusConnection.
14132 * @flags: Flags from the #GDBusProxyFlags enumeration.
14133 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
14134 * @object_path: An object path.
14135 * @cancellable: (allow-none): A #GCancellable or %NULL.
14136 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
14137 * @user_data: User data to pass to @callback.
14138 *
14139 * 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.
14140 *
14141 * 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.
14142 * You can then call control_bmc_proxy_new_finish() to get the result of the operation.
14143 *
14144 * See control_bmc_proxy_new_sync() for the synchronous, blocking version of this constructor.
14145 */
14146void
14147control_bmc_proxy_new (
14148 GDBusConnection *connection,
14149 GDBusProxyFlags flags,
14150 const gchar *name,
14151 const gchar *object_path,
14152 GCancellable *cancellable,
14153 GAsyncReadyCallback callback,
14154 gpointer user_data)
14155{
14156 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);
14157}
14158
14159/**
14160 * control_bmc_proxy_new_finish:
14161 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_bmc_proxy_new().
14162 * @error: Return location for error or %NULL
14163 *
14164 * Finishes an operation started with control_bmc_proxy_new().
14165 *
14166 * Returns: (transfer full) (type ControlBmcProxy): The constructed proxy object or %NULL if @error is set.
14167 */
14168ControlBmc *
14169control_bmc_proxy_new_finish (
14170 GAsyncResult *res,
14171 GError **error)
14172{
14173 GObject *ret;
14174 GObject *source_object;
14175 source_object = g_async_result_get_source_object (res);
14176 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
14177 g_object_unref (source_object);
14178 if (ret != NULL)
14179 return CONTROL_BMC (ret);
14180 else
14181 return NULL;
14182}
14183
14184/**
14185 * control_bmc_proxy_new_sync:
14186 * @connection: A #GDBusConnection.
14187 * @flags: Flags from the #GDBusProxyFlags enumeration.
14188 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
14189 * @object_path: An object path.
14190 * @cancellable: (allow-none): A #GCancellable or %NULL.
14191 * @error: Return location for error or %NULL
14192 *
14193 * 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.
14194 *
14195 * The calling thread is blocked until a reply is received.
14196 *
14197 * See control_bmc_proxy_new() for the asynchronous version of this constructor.
14198 *
14199 * Returns: (transfer full) (type ControlBmcProxy): The constructed proxy object or %NULL if @error is set.
14200 */
14201ControlBmc *
14202control_bmc_proxy_new_sync (
14203 GDBusConnection *connection,
14204 GDBusProxyFlags flags,
14205 const gchar *name,
14206 const gchar *object_path,
14207 GCancellable *cancellable,
14208 GError **error)
14209{
14210 GInitable *ret;
14211 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);
14212 if (ret != NULL)
14213 return CONTROL_BMC (ret);
14214 else
14215 return NULL;
14216}
14217
14218
14219/**
14220 * control_bmc_proxy_new_for_bus:
14221 * @bus_type: A #GBusType.
14222 * @flags: Flags from the #GDBusProxyFlags enumeration.
14223 * @name: A bus name (well-known or unique).
14224 * @object_path: An object path.
14225 * @cancellable: (allow-none): A #GCancellable or %NULL.
14226 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
14227 * @user_data: User data to pass to @callback.
14228 *
14229 * Like control_bmc_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
14230 *
14231 * 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.
14232 * You can then call control_bmc_proxy_new_for_bus_finish() to get the result of the operation.
14233 *
14234 * See control_bmc_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
14235 */
14236void
14237control_bmc_proxy_new_for_bus (
14238 GBusType bus_type,
14239 GDBusProxyFlags flags,
14240 const gchar *name,
14241 const gchar *object_path,
14242 GCancellable *cancellable,
14243 GAsyncReadyCallback callback,
14244 gpointer user_data)
14245{
14246 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);
14247}
14248
14249/**
14250 * control_bmc_proxy_new_for_bus_finish:
14251 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_bmc_proxy_new_for_bus().
14252 * @error: Return location for error or %NULL
14253 *
14254 * Finishes an operation started with control_bmc_proxy_new_for_bus().
14255 *
14256 * Returns: (transfer full) (type ControlBmcProxy): The constructed proxy object or %NULL if @error is set.
14257 */
14258ControlBmc *
14259control_bmc_proxy_new_for_bus_finish (
14260 GAsyncResult *res,
14261 GError **error)
14262{
14263 GObject *ret;
14264 GObject *source_object;
14265 source_object = g_async_result_get_source_object (res);
14266 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
14267 g_object_unref (source_object);
14268 if (ret != NULL)
14269 return CONTROL_BMC (ret);
14270 else
14271 return NULL;
14272}
14273
14274/**
14275 * control_bmc_proxy_new_for_bus_sync:
14276 * @bus_type: A #GBusType.
14277 * @flags: Flags from the #GDBusProxyFlags enumeration.
14278 * @name: A bus name (well-known or unique).
14279 * @object_path: An object path.
14280 * @cancellable: (allow-none): A #GCancellable or %NULL.
14281 * @error: Return location for error or %NULL
14282 *
14283 * Like control_bmc_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
14284 *
14285 * The calling thread is blocked until a reply is received.
14286 *
14287 * See control_bmc_proxy_new_for_bus() for the asynchronous version of this constructor.
14288 *
14289 * Returns: (transfer full) (type ControlBmcProxy): The constructed proxy object or %NULL if @error is set.
14290 */
14291ControlBmc *
14292control_bmc_proxy_new_for_bus_sync (
14293 GBusType bus_type,
14294 GDBusProxyFlags flags,
14295 const gchar *name,
14296 const gchar *object_path,
14297 GCancellable *cancellable,
14298 GError **error)
14299{
14300 GInitable *ret;
14301 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);
14302 if (ret != NULL)
14303 return CONTROL_BMC (ret);
14304 else
14305 return NULL;
14306}
14307
14308
14309/* ------------------------------------------------------------------------ */
14310
14311/**
14312 * ControlBmcSkeleton:
14313 *
14314 * The #ControlBmcSkeleton structure contains only private data and should only be accessed using the provided API.
14315 */
14316
14317/**
14318 * ControlBmcSkeletonClass:
14319 * @parent_class: The parent class.
14320 *
14321 * Class structure for #ControlBmcSkeleton.
14322 */
14323
14324struct _ControlBmcSkeletonPrivate
14325{
14326 GValue *properties;
14327 GList *changed_properties;
14328 GSource *changed_properties_idle_source;
14329 GMainContext *context;
14330 GMutex lock;
14331};
14332
14333static void
14334_control_bmc_skeleton_handle_method_call (
14335 GDBusConnection *connection G_GNUC_UNUSED,
14336 const gchar *sender G_GNUC_UNUSED,
14337 const gchar *object_path G_GNUC_UNUSED,
14338 const gchar *interface_name,
14339 const gchar *method_name,
14340 GVariant *parameters,
14341 GDBusMethodInvocation *invocation,
14342 gpointer user_data)
14343{
14344 ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (user_data);
14345 _ExtendedGDBusMethodInfo *info;
14346 GVariantIter iter;
14347 GVariant *child;
14348 GValue *paramv;
14349 guint num_params;
14350 guint num_extra;
14351 guint n;
14352 guint signal_id;
14353 GValue return_value = G_VALUE_INIT;
14354 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
14355 g_assert (info != NULL);
14356 num_params = g_variant_n_children (parameters);
14357 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
14358 n = 0;
14359 g_value_init (&paramv[n], TYPE_CONTROL_BMC);
14360 g_value_set_object (&paramv[n++], skeleton);
14361 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
14362 g_value_set_object (&paramv[n++], invocation);
14363 if (info->pass_fdlist)
14364 {
14365#ifdef G_OS_UNIX
14366 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
14367 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
14368#else
14369 g_assert_not_reached ();
14370#endif
14371 }
14372 g_variant_iter_init (&iter, parameters);
14373 while ((child = g_variant_iter_next_value (&iter)) != NULL)
14374 {
14375 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
14376 if (arg_info->use_gvariant)
14377 {
14378 g_value_init (&paramv[n], G_TYPE_VARIANT);
14379 g_value_set_variant (&paramv[n], child);
14380 n++;
14381 }
14382 else
14383 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
14384 g_variant_unref (child);
14385 }
14386 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_BMC);
14387 g_value_init (&return_value, G_TYPE_BOOLEAN);
14388 g_signal_emitv (paramv, signal_id, 0, &return_value);
14389 if (!g_value_get_boolean (&return_value))
14390 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);
14391 g_value_unset (&return_value);
14392 for (n = 0; n < num_params + num_extra; n++)
14393 g_value_unset (&paramv[n]);
14394 g_free (paramv);
14395}
14396
14397static GVariant *
14398_control_bmc_skeleton_handle_get_property (
14399 GDBusConnection *connection G_GNUC_UNUSED,
14400 const gchar *sender G_GNUC_UNUSED,
14401 const gchar *object_path G_GNUC_UNUSED,
14402 const gchar *interface_name G_GNUC_UNUSED,
14403 const gchar *property_name,
14404 GError **error,
14405 gpointer user_data)
14406{
14407 ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (user_data);
14408 GValue value = G_VALUE_INIT;
14409 GParamSpec *pspec;
14410 _ExtendedGDBusPropertyInfo *info;
14411 GVariant *ret;
14412 ret = NULL;
14413 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, property_name);
14414 g_assert (info != NULL);
14415 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
14416 if (pspec == NULL)
14417 {
14418 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
14419 }
14420 else
14421 {
14422 g_value_init (&value, pspec->value_type);
14423 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
14424 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
14425 g_value_unset (&value);
14426 }
14427 return ret;
14428}
14429
14430static gboolean
14431_control_bmc_skeleton_handle_set_property (
14432 GDBusConnection *connection G_GNUC_UNUSED,
14433 const gchar *sender G_GNUC_UNUSED,
14434 const gchar *object_path G_GNUC_UNUSED,
14435 const gchar *interface_name G_GNUC_UNUSED,
14436 const gchar *property_name,
14437 GVariant *variant,
14438 GError **error,
14439 gpointer user_data)
14440{
14441 ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (user_data);
14442 GValue value = G_VALUE_INIT;
14443 GParamSpec *pspec;
14444 _ExtendedGDBusPropertyInfo *info;
14445 gboolean ret;
14446 ret = FALSE;
14447 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, property_name);
14448 g_assert (info != NULL);
14449 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
14450 if (pspec == NULL)
14451 {
14452 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
14453 }
14454 else
14455 {
14456 if (info->use_gvariant)
14457 g_value_set_variant (&value, variant);
14458 else
14459 g_dbus_gvariant_to_gvalue (variant, &value);
14460 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
14461 g_value_unset (&value);
14462 ret = TRUE;
14463 }
14464 return ret;
14465}
14466
14467static const GDBusInterfaceVTable _control_bmc_skeleton_vtable =
14468{
14469 _control_bmc_skeleton_handle_method_call,
14470 _control_bmc_skeleton_handle_get_property,
14471 _control_bmc_skeleton_handle_set_property,
14472 {NULL}
14473};
14474
14475static GDBusInterfaceInfo *
14476control_bmc_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
14477{
14478 return control_bmc_interface_info ();
14479}
14480
14481static GDBusInterfaceVTable *
14482control_bmc_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
14483{
14484 return (GDBusInterfaceVTable *) &_control_bmc_skeleton_vtable;
14485}
14486
14487static GVariant *
14488control_bmc_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
14489{
14490 ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (_skeleton);
14491
14492 GVariantBuilder builder;
14493 guint n;
14494 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
14495 if (_control_bmc_interface_info.parent_struct.properties == NULL)
14496 goto out;
14497 for (n = 0; _control_bmc_interface_info.parent_struct.properties[n] != NULL; n++)
14498 {
14499 GDBusPropertyInfo *info = _control_bmc_interface_info.parent_struct.properties[n];
14500 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
14501 {
14502 GVariant *value;
14503 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);
14504 if (value != NULL)
14505 {
14506 g_variant_take_ref (value);
14507 g_variant_builder_add (&builder, "{sv}", info->name, value);
14508 g_variant_unref (value);
14509 }
14510 }
14511 }
14512out:
14513 return g_variant_builder_end (&builder);
14514}
14515
14516static void
14517control_bmc_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
14518{
14519}
14520
14521static void control_bmc_skeleton_iface_init (ControlBmcIface *iface);
14522#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
14523G_DEFINE_TYPE_WITH_CODE (ControlBmcSkeleton, control_bmc_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
14524 G_ADD_PRIVATE (ControlBmcSkeleton)
14525 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_BMC, control_bmc_skeleton_iface_init));
14526
14527#else
14528G_DEFINE_TYPE_WITH_CODE (ControlBmcSkeleton, control_bmc_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
14529 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_BMC, control_bmc_skeleton_iface_init));
14530
14531#endif
14532static void
14533control_bmc_skeleton_finalize (GObject *object)
14534{
14535 ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (object);
14536 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
14537 if (skeleton->priv->changed_properties_idle_source != NULL)
14538 g_source_destroy (skeleton->priv->changed_properties_idle_source);
14539 g_main_context_unref (skeleton->priv->context);
14540 g_mutex_clear (&skeleton->priv->lock);
14541 G_OBJECT_CLASS (control_bmc_skeleton_parent_class)->finalize (object);
14542}
14543
14544static void
14545control_bmc_skeleton_init (ControlBmcSkeleton *skeleton)
14546{
14547#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
14548 skeleton->priv = control_bmc_skeleton_get_instance_private (skeleton);
14549#else
14550 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_BMC_SKELETON, ControlBmcSkeletonPrivate);
14551#endif
14552
14553 g_mutex_init (&skeleton->priv->lock);
14554 skeleton->priv->context = g_main_context_ref_thread_default ();
14555}
14556
14557static void
14558control_bmc_skeleton_class_init (ControlBmcSkeletonClass *klass)
14559{
14560 GObjectClass *gobject_class;
14561 GDBusInterfaceSkeletonClass *skeleton_class;
14562
14563 gobject_class = G_OBJECT_CLASS (klass);
14564 gobject_class->finalize = control_bmc_skeleton_finalize;
14565
14566 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
14567 skeleton_class->get_info = control_bmc_skeleton_dbus_interface_get_info;
14568 skeleton_class->get_properties = control_bmc_skeleton_dbus_interface_get_properties;
14569 skeleton_class->flush = control_bmc_skeleton_dbus_interface_flush;
14570 skeleton_class->get_vtable = control_bmc_skeleton_dbus_interface_get_vtable;
14571
14572#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
14573 g_type_class_add_private (klass, sizeof (ControlBmcSkeletonPrivate));
14574#endif
14575}
14576
14577static void
14578control_bmc_skeleton_iface_init (ControlBmcIface *iface)
14579{
14580}
14581
14582/**
14583 * control_bmc_skeleton_new:
14584 *
14585 * 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>.
14586 *
14587 * Returns: (transfer full) (type ControlBmcSkeleton): The skeleton object.
14588 */
14589ControlBmc *
14590control_bmc_skeleton_new (void)
14591{
14592 return CONTROL_BMC (g_object_new (TYPE_CONTROL_BMC_SKELETON, NULL));
14593}
14594
14595/* ------------------------------------------------------------------------
14596 * Code for interface org.openbmc.control.Host
14597 * ------------------------------------------------------------------------
14598 */
14599
14600/**
14601 * SECTION:ControlHost
14602 * @title: ControlHost
14603 * @short_description: Generated C code for the org.openbmc.control.Host D-Bus interface
14604 *
14605 * 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.
14606 */
14607
14608/* ---- Introspection data for org.openbmc.control.Host ---- */
14609
14610static const _ExtendedGDBusMethodInfo _control_host_method_info_boot =
14611{
14612 {
14613 -1,
14614 (gchar *) "boot",
14615 NULL,
14616 NULL,
14617 NULL
14618 },
14619 "handle-boot",
14620 FALSE
14621};
14622
14623static const _ExtendedGDBusMethodInfo _control_host_method_info_shutdown =
14624{
14625 {
14626 -1,
14627 (gchar *) "shutdown",
14628 NULL,
14629 NULL,
14630 NULL
14631 },
14632 "handle-shutdown",
14633 FALSE
14634};
14635
14636static const _ExtendedGDBusMethodInfo _control_host_method_info_reboot =
14637{
14638 {
14639 -1,
14640 (gchar *) "reboot",
14641 NULL,
14642 NULL,
14643 NULL
14644 },
14645 "handle-reboot",
14646 FALSE
14647};
14648
14649static const _ExtendedGDBusMethodInfo * const _control_host_method_info_pointers[] =
14650{
14651 &_control_host_method_info_boot,
14652 &_control_host_method_info_shutdown,
14653 &_control_host_method_info_reboot,
14654 NULL
14655};
14656
14657static const _ExtendedGDBusSignalInfo _control_host_signal_info_booted =
14658{
14659 {
14660 -1,
14661 (gchar *) "Booted",
14662 NULL,
14663 NULL
14664 },
14665 "booted"
14666};
14667
14668static const _ExtendedGDBusSignalInfo * const _control_host_signal_info_pointers[] =
14669{
14670 &_control_host_signal_info_booted,
14671 NULL
14672};
14673
Norman James493996c2015-10-31 17:27:13 -050014674static const _ExtendedGDBusPropertyInfo _control_host_property_info_debug_mode =
14675{
14676 {
14677 -1,
14678 (gchar *) "debug_mode",
14679 (gchar *) "i",
14680 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
14681 NULL
14682 },
14683 "debug-mode",
14684 FALSE
14685};
14686
14687static const _ExtendedGDBusPropertyInfo _control_host_property_info_flash_side =
14688{
14689 {
14690 -1,
14691 (gchar *) "flash_side",
14692 (gchar *) "s",
14693 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
14694 NULL
14695 },
14696 "flash-side",
14697 FALSE
14698};
14699
14700static const _ExtendedGDBusPropertyInfo * const _control_host_property_info_pointers[] =
14701{
14702 &_control_host_property_info_debug_mode,
14703 &_control_host_property_info_flash_side,
14704 NULL
14705};
14706
Norman James362a80f2015-09-14 14:04:39 -050014707static const _ExtendedGDBusInterfaceInfo _control_host_interface_info =
14708{
14709 {
14710 -1,
14711 (gchar *) "org.openbmc.control.Host",
14712 (GDBusMethodInfo **) &_control_host_method_info_pointers,
14713 (GDBusSignalInfo **) &_control_host_signal_info_pointers,
Norman James493996c2015-10-31 17:27:13 -050014714 (GDBusPropertyInfo **) &_control_host_property_info_pointers,
Norman James362a80f2015-09-14 14:04:39 -050014715 NULL
14716 },
14717 "control-host",
14718};
14719
14720
14721/**
14722 * control_host_interface_info:
14723 *
14724 * 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.
14725 *
14726 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
14727 */
14728GDBusInterfaceInfo *
14729control_host_interface_info (void)
14730{
14731 return (GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct;
14732}
14733
14734/**
14735 * control_host_override_properties:
14736 * @klass: The class structure for a #GObject<!-- -->-derived class.
14737 * @property_id_begin: The property id to assign to the first overridden property.
14738 *
14739 * Overrides all #GObject properties in the #ControlHost interface for a concrete class.
14740 * The properties are overridden in the order they are defined.
14741 *
14742 * Returns: The last property id.
14743 */
14744guint
14745control_host_override_properties (GObjectClass *klass, guint property_id_begin)
14746{
Norman James493996c2015-10-31 17:27:13 -050014747 g_object_class_override_property (klass, property_id_begin++, "debug-mode");
14748 g_object_class_override_property (klass, property_id_begin++, "flash-side");
Norman James362a80f2015-09-14 14:04:39 -050014749 return property_id_begin - 1;
14750}
14751
14752
14753
14754/**
14755 * ControlHost:
14756 *
14757 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link>.
14758 */
14759
14760/**
14761 * ControlHostIface:
14762 * @parent_iface: The parent interface.
14763 * @handle_boot: Handler for the #ControlHost::handle-boot signal.
14764 * @handle_reboot: Handler for the #ControlHost::handle-reboot signal.
14765 * @handle_shutdown: Handler for the #ControlHost::handle-shutdown signal.
Norman James493996c2015-10-31 17:27:13 -050014766 * @get_debug_mode: Getter for the #ControlHost:debug-mode property.
14767 * @get_flash_side: Getter for the #ControlHost:flash-side property.
Norman James362a80f2015-09-14 14:04:39 -050014768 * @booted: Handler for the #ControlHost::booted signal.
14769 *
14770 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link>.
14771 */
14772
14773typedef ControlHostIface ControlHostInterface;
14774G_DEFINE_INTERFACE (ControlHost, control_host, G_TYPE_OBJECT);
14775
14776static void
14777control_host_default_init (ControlHostIface *iface)
14778{
14779 /* GObject signals for incoming D-Bus method calls: */
14780 /**
14781 * ControlHost::handle-boot:
14782 * @object: A #ControlHost.
14783 * @invocation: A #GDBusMethodInvocation.
14784 *
14785 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Host.boot">boot()</link> D-Bus method.
14786 *
14787 * 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.
14788 *
14789 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
14790 */
14791 g_signal_new ("handle-boot",
14792 G_TYPE_FROM_INTERFACE (iface),
14793 G_SIGNAL_RUN_LAST,
14794 G_STRUCT_OFFSET (ControlHostIface, handle_boot),
14795 g_signal_accumulator_true_handled,
14796 NULL,
14797 g_cclosure_marshal_generic,
14798 G_TYPE_BOOLEAN,
14799 1,
14800 G_TYPE_DBUS_METHOD_INVOCATION);
14801
14802 /**
14803 * ControlHost::handle-shutdown:
14804 * @object: A #ControlHost.
14805 * @invocation: A #GDBusMethodInvocation.
14806 *
14807 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Host.shutdown">shutdown()</link> D-Bus method.
14808 *
14809 * 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.
14810 *
14811 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
14812 */
14813 g_signal_new ("handle-shutdown",
14814 G_TYPE_FROM_INTERFACE (iface),
14815 G_SIGNAL_RUN_LAST,
14816 G_STRUCT_OFFSET (ControlHostIface, handle_shutdown),
14817 g_signal_accumulator_true_handled,
14818 NULL,
14819 g_cclosure_marshal_generic,
14820 G_TYPE_BOOLEAN,
14821 1,
14822 G_TYPE_DBUS_METHOD_INVOCATION);
14823
14824 /**
14825 * ControlHost::handle-reboot:
14826 * @object: A #ControlHost.
14827 * @invocation: A #GDBusMethodInvocation.
14828 *
14829 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Host.reboot">reboot()</link> D-Bus method.
14830 *
14831 * 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.
14832 *
14833 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
14834 */
14835 g_signal_new ("handle-reboot",
14836 G_TYPE_FROM_INTERFACE (iface),
14837 G_SIGNAL_RUN_LAST,
14838 G_STRUCT_OFFSET (ControlHostIface, handle_reboot),
14839 g_signal_accumulator_true_handled,
14840 NULL,
14841 g_cclosure_marshal_generic,
14842 G_TYPE_BOOLEAN,
14843 1,
14844 G_TYPE_DBUS_METHOD_INVOCATION);
14845
14846 /* GObject signals for received D-Bus signals: */
14847 /**
14848 * ControlHost::booted:
14849 * @object: A #ControlHost.
14850 *
14851 * 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.
14852 *
14853 * 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.
14854 */
14855 g_signal_new ("booted",
14856 G_TYPE_FROM_INTERFACE (iface),
14857 G_SIGNAL_RUN_LAST,
14858 G_STRUCT_OFFSET (ControlHostIface, booted),
14859 NULL,
14860 NULL,
14861 g_cclosure_marshal_generic,
14862 G_TYPE_NONE,
14863 0);
14864
Norman James493996c2015-10-31 17:27:13 -050014865 /* GObject properties for D-Bus properties: */
14866 /**
14867 * ControlHost:debug-mode:
14868 *
14869 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-control-Host.debug_mode">"debug_mode"</link>.
14870 *
14871 * 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.
14872 */
14873 g_object_interface_install_property (iface,
14874 g_param_spec_int ("debug-mode", "debug_mode", "debug_mode", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
14875 /**
14876 * ControlHost:flash-side:
14877 *
14878 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-control-Host.flash_side">"flash_side"</link>.
14879 *
14880 * 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.
14881 */
14882 g_object_interface_install_property (iface,
14883 g_param_spec_string ("flash-side", "flash_side", "flash_side", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
14884}
14885
14886/**
14887 * control_host_get_debug_mode: (skip)
14888 * @object: A #ControlHost.
14889 *
14890 * Gets the value of the <link linkend="gdbus-property-org-openbmc-control-Host.debug_mode">"debug_mode"</link> D-Bus property.
14891 *
14892 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
14893 *
14894 * Returns: The property value.
14895 */
14896gint
14897control_host_get_debug_mode (ControlHost *object)
14898{
14899 return CONTROL_HOST_GET_IFACE (object)->get_debug_mode (object);
14900}
14901
14902/**
14903 * control_host_set_debug_mode: (skip)
14904 * @object: A #ControlHost.
14905 * @value: The value to set.
14906 *
14907 * Sets the <link linkend="gdbus-property-org-openbmc-control-Host.debug_mode">"debug_mode"</link> D-Bus property to @value.
14908 *
14909 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
14910 */
14911void
14912control_host_set_debug_mode (ControlHost *object, gint value)
14913{
14914 g_object_set (G_OBJECT (object), "debug-mode", value, NULL);
14915}
14916
14917/**
14918 * control_host_get_flash_side: (skip)
14919 * @object: A #ControlHost.
14920 *
14921 * Gets the value of the <link linkend="gdbus-property-org-openbmc-control-Host.flash_side">"flash_side"</link> D-Bus property.
14922 *
14923 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
14924 *
14925 * <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>
14926 *
14927 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
14928 */
14929const gchar *
14930control_host_get_flash_side (ControlHost *object)
14931{
14932 return CONTROL_HOST_GET_IFACE (object)->get_flash_side (object);
14933}
14934
14935/**
14936 * control_host_dup_flash_side: (skip)
14937 * @object: A #ControlHost.
14938 *
14939 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-control-Host.flash_side">"flash_side"</link> D-Bus property.
14940 *
14941 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
14942 *
14943 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
14944 */
14945gchar *
14946control_host_dup_flash_side (ControlHost *object)
14947{
14948 gchar *value;
14949 g_object_get (G_OBJECT (object), "flash-side", &value, NULL);
14950 return value;
14951}
14952
14953/**
14954 * control_host_set_flash_side: (skip)
14955 * @object: A #ControlHost.
14956 * @value: The value to set.
14957 *
14958 * Sets the <link linkend="gdbus-property-org-openbmc-control-Host.flash_side">"flash_side"</link> D-Bus property to @value.
14959 *
14960 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
14961 */
14962void
14963control_host_set_flash_side (ControlHost *object, const gchar *value)
14964{
14965 g_object_set (G_OBJECT (object), "flash-side", value, NULL);
Norman James362a80f2015-09-14 14:04:39 -050014966}
14967
14968/**
14969 * control_host_emit_booted:
14970 * @object: A #ControlHost.
14971 *
14972 * Emits the <link linkend="gdbus-signal-org-openbmc-control-Host.Booted">"Booted"</link> D-Bus signal.
14973 */
14974void
14975control_host_emit_booted (
14976 ControlHost *object)
14977{
14978 g_signal_emit_by_name (object, "booted");
14979}
14980
14981/**
14982 * control_host_call_boot:
14983 * @proxy: A #ControlHostProxy.
14984 * @cancellable: (allow-none): A #GCancellable or %NULL.
14985 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
14986 * @user_data: User data to pass to @callback.
14987 *
14988 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Host.boot">boot()</link> D-Bus method on @proxy.
14989 * 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.
14990 * You can then call control_host_call_boot_finish() to get the result of the operation.
14991 *
14992 * See control_host_call_boot_sync() for the synchronous, blocking version of this method.
14993 */
14994void
14995control_host_call_boot (
14996 ControlHost *proxy,
14997 GCancellable *cancellable,
14998 GAsyncReadyCallback callback,
14999 gpointer user_data)
15000{
15001 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
15002 "boot",
15003 g_variant_new ("()"),
15004 G_DBUS_CALL_FLAGS_NONE,
15005 -1,
15006 cancellable,
15007 callback,
15008 user_data);
15009}
15010
15011/**
15012 * control_host_call_boot_finish:
15013 * @proxy: A #ControlHostProxy.
15014 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_call_boot().
15015 * @error: Return location for error or %NULL.
15016 *
15017 * Finishes an operation started with control_host_call_boot().
15018 *
15019 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
15020 */
15021gboolean
15022control_host_call_boot_finish (
15023 ControlHost *proxy,
15024 GAsyncResult *res,
15025 GError **error)
15026{
15027 GVariant *_ret;
15028 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
15029 if (_ret == NULL)
15030 goto _out;
15031 g_variant_get (_ret,
15032 "()");
15033 g_variant_unref (_ret);
15034_out:
15035 return _ret != NULL;
15036}
15037
15038/**
15039 * control_host_call_boot_sync:
15040 * @proxy: A #ControlHostProxy.
15041 * @cancellable: (allow-none): A #GCancellable or %NULL.
15042 * @error: Return location for error or %NULL.
15043 *
15044 * 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.
15045 *
15046 * See control_host_call_boot() for the asynchronous version of this method.
15047 *
15048 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
15049 */
15050gboolean
15051control_host_call_boot_sync (
15052 ControlHost *proxy,
15053 GCancellable *cancellable,
15054 GError **error)
15055{
15056 GVariant *_ret;
15057 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
15058 "boot",
15059 g_variant_new ("()"),
15060 G_DBUS_CALL_FLAGS_NONE,
15061 -1,
15062 cancellable,
15063 error);
15064 if (_ret == NULL)
15065 goto _out;
15066 g_variant_get (_ret,
15067 "()");
15068 g_variant_unref (_ret);
15069_out:
15070 return _ret != NULL;
15071}
15072
15073/**
15074 * control_host_call_shutdown:
15075 * @proxy: A #ControlHostProxy.
15076 * @cancellable: (allow-none): A #GCancellable or %NULL.
15077 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
15078 * @user_data: User data to pass to @callback.
15079 *
15080 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Host.shutdown">shutdown()</link> D-Bus method on @proxy.
15081 * 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.
15082 * You can then call control_host_call_shutdown_finish() to get the result of the operation.
15083 *
15084 * See control_host_call_shutdown_sync() for the synchronous, blocking version of this method.
15085 */
15086void
15087control_host_call_shutdown (
15088 ControlHost *proxy,
15089 GCancellable *cancellable,
15090 GAsyncReadyCallback callback,
15091 gpointer user_data)
15092{
15093 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
15094 "shutdown",
15095 g_variant_new ("()"),
15096 G_DBUS_CALL_FLAGS_NONE,
15097 -1,
15098 cancellable,
15099 callback,
15100 user_data);
15101}
15102
15103/**
15104 * control_host_call_shutdown_finish:
15105 * @proxy: A #ControlHostProxy.
15106 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_call_shutdown().
15107 * @error: Return location for error or %NULL.
15108 *
15109 * Finishes an operation started with control_host_call_shutdown().
15110 *
15111 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
15112 */
15113gboolean
15114control_host_call_shutdown_finish (
15115 ControlHost *proxy,
15116 GAsyncResult *res,
15117 GError **error)
15118{
15119 GVariant *_ret;
15120 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
15121 if (_ret == NULL)
15122 goto _out;
15123 g_variant_get (_ret,
15124 "()");
15125 g_variant_unref (_ret);
15126_out:
15127 return _ret != NULL;
15128}
15129
15130/**
15131 * control_host_call_shutdown_sync:
15132 * @proxy: A #ControlHostProxy.
15133 * @cancellable: (allow-none): A #GCancellable or %NULL.
15134 * @error: Return location for error or %NULL.
15135 *
15136 * 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.
15137 *
15138 * See control_host_call_shutdown() for the asynchronous version of this method.
15139 *
15140 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
15141 */
15142gboolean
15143control_host_call_shutdown_sync (
15144 ControlHost *proxy,
15145 GCancellable *cancellable,
15146 GError **error)
15147{
15148 GVariant *_ret;
15149 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
15150 "shutdown",
15151 g_variant_new ("()"),
15152 G_DBUS_CALL_FLAGS_NONE,
15153 -1,
15154 cancellable,
15155 error);
15156 if (_ret == NULL)
15157 goto _out;
15158 g_variant_get (_ret,
15159 "()");
15160 g_variant_unref (_ret);
15161_out:
15162 return _ret != NULL;
15163}
15164
15165/**
15166 * control_host_call_reboot:
15167 * @proxy: A #ControlHostProxy.
15168 * @cancellable: (allow-none): A #GCancellable or %NULL.
15169 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
15170 * @user_data: User data to pass to @callback.
15171 *
15172 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Host.reboot">reboot()</link> D-Bus method on @proxy.
15173 * 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.
15174 * You can then call control_host_call_reboot_finish() to get the result of the operation.
15175 *
15176 * See control_host_call_reboot_sync() for the synchronous, blocking version of this method.
15177 */
15178void
15179control_host_call_reboot (
15180 ControlHost *proxy,
15181 GCancellable *cancellable,
15182 GAsyncReadyCallback callback,
15183 gpointer user_data)
15184{
15185 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
15186 "reboot",
15187 g_variant_new ("()"),
15188 G_DBUS_CALL_FLAGS_NONE,
15189 -1,
15190 cancellable,
15191 callback,
15192 user_data);
15193}
15194
15195/**
15196 * control_host_call_reboot_finish:
15197 * @proxy: A #ControlHostProxy.
15198 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_call_reboot().
15199 * @error: Return location for error or %NULL.
15200 *
15201 * Finishes an operation started with control_host_call_reboot().
15202 *
15203 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
15204 */
15205gboolean
15206control_host_call_reboot_finish (
15207 ControlHost *proxy,
15208 GAsyncResult *res,
15209 GError **error)
15210{
15211 GVariant *_ret;
15212 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
15213 if (_ret == NULL)
15214 goto _out;
15215 g_variant_get (_ret,
15216 "()");
15217 g_variant_unref (_ret);
15218_out:
15219 return _ret != NULL;
15220}
15221
15222/**
15223 * control_host_call_reboot_sync:
15224 * @proxy: A #ControlHostProxy.
15225 * @cancellable: (allow-none): A #GCancellable or %NULL.
15226 * @error: Return location for error or %NULL.
15227 *
15228 * 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.
15229 *
15230 * See control_host_call_reboot() for the asynchronous version of this method.
15231 *
15232 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
15233 */
15234gboolean
15235control_host_call_reboot_sync (
15236 ControlHost *proxy,
15237 GCancellable *cancellable,
15238 GError **error)
15239{
15240 GVariant *_ret;
15241 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
15242 "reboot",
15243 g_variant_new ("()"),
15244 G_DBUS_CALL_FLAGS_NONE,
15245 -1,
15246 cancellable,
15247 error);
15248 if (_ret == NULL)
15249 goto _out;
15250 g_variant_get (_ret,
15251 "()");
15252 g_variant_unref (_ret);
15253_out:
15254 return _ret != NULL;
15255}
15256
15257/**
15258 * control_host_complete_boot:
15259 * @object: A #ControlHost.
15260 * @invocation: (transfer full): A #GDBusMethodInvocation.
15261 *
15262 * 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.
15263 *
15264 * This method will free @invocation, you cannot use it afterwards.
15265 */
15266void
15267control_host_complete_boot (
15268 ControlHost *object,
15269 GDBusMethodInvocation *invocation)
15270{
15271 g_dbus_method_invocation_return_value (invocation,
15272 g_variant_new ("()"));
15273}
15274
15275/**
15276 * control_host_complete_shutdown:
15277 * @object: A #ControlHost.
15278 * @invocation: (transfer full): A #GDBusMethodInvocation.
15279 *
15280 * 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.
15281 *
15282 * This method will free @invocation, you cannot use it afterwards.
15283 */
15284void
15285control_host_complete_shutdown (
15286 ControlHost *object,
15287 GDBusMethodInvocation *invocation)
15288{
15289 g_dbus_method_invocation_return_value (invocation,
15290 g_variant_new ("()"));
15291}
15292
15293/**
15294 * control_host_complete_reboot:
15295 * @object: A #ControlHost.
15296 * @invocation: (transfer full): A #GDBusMethodInvocation.
15297 *
15298 * 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.
15299 *
15300 * This method will free @invocation, you cannot use it afterwards.
15301 */
15302void
15303control_host_complete_reboot (
15304 ControlHost *object,
15305 GDBusMethodInvocation *invocation)
15306{
15307 g_dbus_method_invocation_return_value (invocation,
15308 g_variant_new ("()"));
15309}
15310
15311/* ------------------------------------------------------------------------ */
15312
15313/**
15314 * ControlHostProxy:
15315 *
15316 * The #ControlHostProxy structure contains only private data and should only be accessed using the provided API.
15317 */
15318
15319/**
15320 * ControlHostProxyClass:
15321 * @parent_class: The parent class.
15322 *
15323 * Class structure for #ControlHostProxy.
15324 */
15325
15326struct _ControlHostProxyPrivate
15327{
15328 GData *qdata;
15329};
15330
15331static void control_host_proxy_iface_init (ControlHostIface *iface);
15332
15333#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
15334G_DEFINE_TYPE_WITH_CODE (ControlHostProxy, control_host_proxy, G_TYPE_DBUS_PROXY,
15335 G_ADD_PRIVATE (ControlHostProxy)
15336 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_proxy_iface_init));
15337
15338#else
15339G_DEFINE_TYPE_WITH_CODE (ControlHostProxy, control_host_proxy, G_TYPE_DBUS_PROXY,
15340 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_proxy_iface_init));
15341
15342#endif
15343static void
15344control_host_proxy_finalize (GObject *object)
15345{
15346 ControlHostProxy *proxy = CONTROL_HOST_PROXY (object);
15347 g_datalist_clear (&proxy->priv->qdata);
15348 G_OBJECT_CLASS (control_host_proxy_parent_class)->finalize (object);
15349}
15350
15351static void
15352control_host_proxy_get_property (GObject *object,
15353 guint prop_id,
15354 GValue *value,
15355 GParamSpec *pspec G_GNUC_UNUSED)
15356{
Norman James493996c2015-10-31 17:27:13 -050015357 const _ExtendedGDBusPropertyInfo *info;
15358 GVariant *variant;
15359 g_assert (prop_id != 0 && prop_id - 1 < 2);
15360 info = _control_host_property_info_pointers[prop_id - 1];
15361 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
15362 if (info->use_gvariant)
15363 {
15364 g_value_set_variant (value, variant);
15365 }
15366 else
15367 {
15368 if (variant != NULL)
15369 g_dbus_gvariant_to_gvalue (variant, value);
15370 }
15371 if (variant != NULL)
15372 g_variant_unref (variant);
15373}
15374
15375static void
15376control_host_proxy_set_property_cb (GDBusProxy *proxy,
15377 GAsyncResult *res,
15378 gpointer user_data)
15379{
15380 const _ExtendedGDBusPropertyInfo *info = user_data;
15381 GError *error;
15382 GVariant *_ret;
15383 error = NULL;
15384 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
15385 if (!_ret)
15386 {
15387 g_warning ("Error setting property '%s' on interface org.openbmc.control.Host: %s (%s, %d)",
15388 info->parent_struct.name,
15389 error->message, g_quark_to_string (error->domain), error->code);
15390 g_error_free (error);
15391 }
15392 else
15393 {
15394 g_variant_unref (_ret);
15395 }
Norman James362a80f2015-09-14 14:04:39 -050015396}
15397
15398static void
15399control_host_proxy_set_property (GObject *object,
15400 guint prop_id,
15401 const GValue *value,
15402 GParamSpec *pspec G_GNUC_UNUSED)
15403{
Norman James493996c2015-10-31 17:27:13 -050015404 const _ExtendedGDBusPropertyInfo *info;
15405 GVariant *variant;
15406 g_assert (prop_id != 0 && prop_id - 1 < 2);
15407 info = _control_host_property_info_pointers[prop_id - 1];
15408 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
15409 g_dbus_proxy_call (G_DBUS_PROXY (object),
15410 "org.freedesktop.DBus.Properties.Set",
15411 g_variant_new ("(ssv)", "org.openbmc.control.Host", info->parent_struct.name, variant),
15412 G_DBUS_CALL_FLAGS_NONE,
15413 -1,
15414 NULL, (GAsyncReadyCallback) control_host_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
15415 g_variant_unref (variant);
Norman James362a80f2015-09-14 14:04:39 -050015416}
15417
15418static void
15419control_host_proxy_g_signal (GDBusProxy *proxy,
15420 const gchar *sender_name G_GNUC_UNUSED,
15421 const gchar *signal_name,
15422 GVariant *parameters)
15423{
15424 _ExtendedGDBusSignalInfo *info;
15425 GVariantIter iter;
15426 GVariant *child;
15427 GValue *paramv;
15428 guint num_params;
15429 guint n;
15430 guint signal_id;
15431 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, signal_name);
15432 if (info == NULL)
15433 return;
15434 num_params = g_variant_n_children (parameters);
15435 paramv = g_new0 (GValue, num_params + 1);
15436 g_value_init (&paramv[0], TYPE_CONTROL_HOST);
15437 g_value_set_object (&paramv[0], proxy);
15438 g_variant_iter_init (&iter, parameters);
15439 n = 1;
15440 while ((child = g_variant_iter_next_value (&iter)) != NULL)
15441 {
15442 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
15443 if (arg_info->use_gvariant)
15444 {
15445 g_value_init (&paramv[n], G_TYPE_VARIANT);
15446 g_value_set_variant (&paramv[n], child);
15447 n++;
15448 }
15449 else
15450 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
15451 g_variant_unref (child);
15452 }
15453 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_HOST);
15454 g_signal_emitv (paramv, signal_id, 0, NULL);
15455 for (n = 0; n < num_params + 1; n++)
15456 g_value_unset (&paramv[n]);
15457 g_free (paramv);
15458}
15459
15460static void
15461control_host_proxy_g_properties_changed (GDBusProxy *_proxy,
15462 GVariant *changed_properties,
15463 const gchar *const *invalidated_properties)
15464{
15465 ControlHostProxy *proxy = CONTROL_HOST_PROXY (_proxy);
15466 guint n;
15467 const gchar *key;
15468 GVariantIter *iter;
15469 _ExtendedGDBusPropertyInfo *info;
15470 g_variant_get (changed_properties, "a{sv}", &iter);
15471 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
15472 {
15473 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, key);
15474 g_datalist_remove_data (&proxy->priv->qdata, key);
15475 if (info != NULL)
15476 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
15477 }
15478 g_variant_iter_free (iter);
15479 for (n = 0; invalidated_properties[n] != NULL; n++)
15480 {
15481 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, invalidated_properties[n]);
15482 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
15483 if (info != NULL)
15484 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
15485 }
15486}
15487
Norman James493996c2015-10-31 17:27:13 -050015488static gint
15489control_host_proxy_get_debug_mode (ControlHost *object)
15490{
15491 ControlHostProxy *proxy = CONTROL_HOST_PROXY (object);
15492 GVariant *variant;
15493 gint value = 0;
15494 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "debug_mode");
15495 if (variant != NULL)
15496 {
15497 value = g_variant_get_int32 (variant);
15498 g_variant_unref (variant);
15499 }
15500 return value;
15501}
15502
15503static const gchar *
15504control_host_proxy_get_flash_side (ControlHost *object)
15505{
15506 ControlHostProxy *proxy = CONTROL_HOST_PROXY (object);
15507 GVariant *variant;
15508 const gchar *value = NULL;
15509 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "flash_side");
15510 if (variant != NULL)
15511 {
15512 value = g_variant_get_string (variant, NULL);
15513 g_variant_unref (variant);
15514 }
15515 return value;
15516}
15517
Norman James362a80f2015-09-14 14:04:39 -050015518static void
15519control_host_proxy_init (ControlHostProxy *proxy)
15520{
15521#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
15522 proxy->priv = control_host_proxy_get_instance_private (proxy);
15523#else
15524 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_HOST_PROXY, ControlHostProxyPrivate);
15525#endif
15526
15527 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_host_interface_info ());
15528}
15529
15530static void
15531control_host_proxy_class_init (ControlHostProxyClass *klass)
15532{
15533 GObjectClass *gobject_class;
15534 GDBusProxyClass *proxy_class;
15535
15536 gobject_class = G_OBJECT_CLASS (klass);
15537 gobject_class->finalize = control_host_proxy_finalize;
15538 gobject_class->get_property = control_host_proxy_get_property;
15539 gobject_class->set_property = control_host_proxy_set_property;
15540
15541 proxy_class = G_DBUS_PROXY_CLASS (klass);
15542 proxy_class->g_signal = control_host_proxy_g_signal;
15543 proxy_class->g_properties_changed = control_host_proxy_g_properties_changed;
15544
Norman James493996c2015-10-31 17:27:13 -050015545 control_host_override_properties (gobject_class, 1);
15546
Norman James362a80f2015-09-14 14:04:39 -050015547#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
15548 g_type_class_add_private (klass, sizeof (ControlHostProxyPrivate));
15549#endif
15550}
15551
15552static void
15553control_host_proxy_iface_init (ControlHostIface *iface)
15554{
Norman James493996c2015-10-31 17:27:13 -050015555 iface->get_debug_mode = control_host_proxy_get_debug_mode;
15556 iface->get_flash_side = control_host_proxy_get_flash_side;
Norman James362a80f2015-09-14 14:04:39 -050015557}
15558
15559/**
15560 * control_host_proxy_new:
15561 * @connection: A #GDBusConnection.
15562 * @flags: Flags from the #GDBusProxyFlags enumeration.
15563 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
15564 * @object_path: An object path.
15565 * @cancellable: (allow-none): A #GCancellable or %NULL.
15566 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
15567 * @user_data: User data to pass to @callback.
15568 *
15569 * 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.
15570 *
15571 * 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.
15572 * You can then call control_host_proxy_new_finish() to get the result of the operation.
15573 *
15574 * See control_host_proxy_new_sync() for the synchronous, blocking version of this constructor.
15575 */
15576void
15577control_host_proxy_new (
15578 GDBusConnection *connection,
15579 GDBusProxyFlags flags,
15580 const gchar *name,
15581 const gchar *object_path,
15582 GCancellable *cancellable,
15583 GAsyncReadyCallback callback,
15584 gpointer user_data)
15585{
15586 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);
15587}
15588
15589/**
15590 * control_host_proxy_new_finish:
15591 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_proxy_new().
15592 * @error: Return location for error or %NULL
15593 *
15594 * Finishes an operation started with control_host_proxy_new().
15595 *
15596 * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set.
15597 */
15598ControlHost *
15599control_host_proxy_new_finish (
15600 GAsyncResult *res,
15601 GError **error)
15602{
15603 GObject *ret;
15604 GObject *source_object;
15605 source_object = g_async_result_get_source_object (res);
15606 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
15607 g_object_unref (source_object);
15608 if (ret != NULL)
15609 return CONTROL_HOST (ret);
15610 else
15611 return NULL;
15612}
15613
15614/**
15615 * control_host_proxy_new_sync:
15616 * @connection: A #GDBusConnection.
15617 * @flags: Flags from the #GDBusProxyFlags enumeration.
15618 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
15619 * @object_path: An object path.
15620 * @cancellable: (allow-none): A #GCancellable or %NULL.
15621 * @error: Return location for error or %NULL
15622 *
15623 * 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.
15624 *
15625 * The calling thread is blocked until a reply is received.
15626 *
15627 * See control_host_proxy_new() for the asynchronous version of this constructor.
15628 *
15629 * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set.
15630 */
15631ControlHost *
15632control_host_proxy_new_sync (
15633 GDBusConnection *connection,
15634 GDBusProxyFlags flags,
15635 const gchar *name,
15636 const gchar *object_path,
15637 GCancellable *cancellable,
15638 GError **error)
15639{
15640 GInitable *ret;
15641 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);
15642 if (ret != NULL)
15643 return CONTROL_HOST (ret);
15644 else
15645 return NULL;
15646}
15647
15648
15649/**
15650 * control_host_proxy_new_for_bus:
15651 * @bus_type: A #GBusType.
15652 * @flags: Flags from the #GDBusProxyFlags enumeration.
15653 * @name: A bus name (well-known or unique).
15654 * @object_path: An object path.
15655 * @cancellable: (allow-none): A #GCancellable or %NULL.
15656 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
15657 * @user_data: User data to pass to @callback.
15658 *
15659 * Like control_host_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
15660 *
15661 * 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.
15662 * You can then call control_host_proxy_new_for_bus_finish() to get the result of the operation.
15663 *
15664 * See control_host_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
15665 */
15666void
15667control_host_proxy_new_for_bus (
15668 GBusType bus_type,
15669 GDBusProxyFlags flags,
15670 const gchar *name,
15671 const gchar *object_path,
15672 GCancellable *cancellable,
15673 GAsyncReadyCallback callback,
15674 gpointer user_data)
15675{
15676 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);
15677}
15678
15679/**
15680 * control_host_proxy_new_for_bus_finish:
15681 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_proxy_new_for_bus().
15682 * @error: Return location for error or %NULL
15683 *
15684 * Finishes an operation started with control_host_proxy_new_for_bus().
15685 *
15686 * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set.
15687 */
15688ControlHost *
15689control_host_proxy_new_for_bus_finish (
15690 GAsyncResult *res,
15691 GError **error)
15692{
15693 GObject *ret;
15694 GObject *source_object;
15695 source_object = g_async_result_get_source_object (res);
15696 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
15697 g_object_unref (source_object);
15698 if (ret != NULL)
15699 return CONTROL_HOST (ret);
15700 else
15701 return NULL;
15702}
15703
15704/**
15705 * control_host_proxy_new_for_bus_sync:
15706 * @bus_type: A #GBusType.
15707 * @flags: Flags from the #GDBusProxyFlags enumeration.
15708 * @name: A bus name (well-known or unique).
15709 * @object_path: An object path.
15710 * @cancellable: (allow-none): A #GCancellable or %NULL.
15711 * @error: Return location for error or %NULL
15712 *
15713 * Like control_host_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
15714 *
15715 * The calling thread is blocked until a reply is received.
15716 *
15717 * See control_host_proxy_new_for_bus() for the asynchronous version of this constructor.
15718 *
15719 * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set.
15720 */
15721ControlHost *
15722control_host_proxy_new_for_bus_sync (
15723 GBusType bus_type,
15724 GDBusProxyFlags flags,
15725 const gchar *name,
15726 const gchar *object_path,
15727 GCancellable *cancellable,
15728 GError **error)
15729{
15730 GInitable *ret;
15731 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);
15732 if (ret != NULL)
15733 return CONTROL_HOST (ret);
15734 else
15735 return NULL;
15736}
15737
15738
15739/* ------------------------------------------------------------------------ */
15740
15741/**
15742 * ControlHostSkeleton:
15743 *
15744 * The #ControlHostSkeleton structure contains only private data and should only be accessed using the provided API.
15745 */
15746
15747/**
15748 * ControlHostSkeletonClass:
15749 * @parent_class: The parent class.
15750 *
15751 * Class structure for #ControlHostSkeleton.
15752 */
15753
15754struct _ControlHostSkeletonPrivate
15755{
15756 GValue *properties;
15757 GList *changed_properties;
15758 GSource *changed_properties_idle_source;
15759 GMainContext *context;
15760 GMutex lock;
15761};
15762
15763static void
15764_control_host_skeleton_handle_method_call (
15765 GDBusConnection *connection G_GNUC_UNUSED,
15766 const gchar *sender G_GNUC_UNUSED,
15767 const gchar *object_path G_GNUC_UNUSED,
15768 const gchar *interface_name,
15769 const gchar *method_name,
15770 GVariant *parameters,
15771 GDBusMethodInvocation *invocation,
15772 gpointer user_data)
15773{
15774 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (user_data);
15775 _ExtendedGDBusMethodInfo *info;
15776 GVariantIter iter;
15777 GVariant *child;
15778 GValue *paramv;
15779 guint num_params;
15780 guint num_extra;
15781 guint n;
15782 guint signal_id;
15783 GValue return_value = G_VALUE_INIT;
15784 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
15785 g_assert (info != NULL);
15786 num_params = g_variant_n_children (parameters);
15787 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
15788 n = 0;
15789 g_value_init (&paramv[n], TYPE_CONTROL_HOST);
15790 g_value_set_object (&paramv[n++], skeleton);
15791 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
15792 g_value_set_object (&paramv[n++], invocation);
15793 if (info->pass_fdlist)
15794 {
15795#ifdef G_OS_UNIX
15796 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
15797 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
15798#else
15799 g_assert_not_reached ();
15800#endif
15801 }
15802 g_variant_iter_init (&iter, parameters);
15803 while ((child = g_variant_iter_next_value (&iter)) != NULL)
15804 {
15805 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
15806 if (arg_info->use_gvariant)
15807 {
15808 g_value_init (&paramv[n], G_TYPE_VARIANT);
15809 g_value_set_variant (&paramv[n], child);
15810 n++;
15811 }
15812 else
15813 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
15814 g_variant_unref (child);
15815 }
15816 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_HOST);
15817 g_value_init (&return_value, G_TYPE_BOOLEAN);
15818 g_signal_emitv (paramv, signal_id, 0, &return_value);
15819 if (!g_value_get_boolean (&return_value))
15820 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);
15821 g_value_unset (&return_value);
15822 for (n = 0; n < num_params + num_extra; n++)
15823 g_value_unset (&paramv[n]);
15824 g_free (paramv);
15825}
15826
15827static GVariant *
15828_control_host_skeleton_handle_get_property (
15829 GDBusConnection *connection G_GNUC_UNUSED,
15830 const gchar *sender G_GNUC_UNUSED,
15831 const gchar *object_path G_GNUC_UNUSED,
15832 const gchar *interface_name G_GNUC_UNUSED,
15833 const gchar *property_name,
15834 GError **error,
15835 gpointer user_data)
15836{
15837 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (user_data);
15838 GValue value = G_VALUE_INIT;
15839 GParamSpec *pspec;
15840 _ExtendedGDBusPropertyInfo *info;
15841 GVariant *ret;
15842 ret = NULL;
15843 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, property_name);
15844 g_assert (info != NULL);
15845 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
15846 if (pspec == NULL)
15847 {
15848 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
15849 }
15850 else
15851 {
15852 g_value_init (&value, pspec->value_type);
15853 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
15854 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
15855 g_value_unset (&value);
15856 }
15857 return ret;
15858}
15859
15860static gboolean
15861_control_host_skeleton_handle_set_property (
15862 GDBusConnection *connection G_GNUC_UNUSED,
15863 const gchar *sender G_GNUC_UNUSED,
15864 const gchar *object_path G_GNUC_UNUSED,
15865 const gchar *interface_name G_GNUC_UNUSED,
15866 const gchar *property_name,
15867 GVariant *variant,
15868 GError **error,
15869 gpointer user_data)
15870{
15871 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (user_data);
15872 GValue value = G_VALUE_INIT;
15873 GParamSpec *pspec;
15874 _ExtendedGDBusPropertyInfo *info;
15875 gboolean ret;
15876 ret = FALSE;
15877 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, property_name);
15878 g_assert (info != NULL);
15879 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
15880 if (pspec == NULL)
15881 {
15882 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
15883 }
15884 else
15885 {
15886 if (info->use_gvariant)
15887 g_value_set_variant (&value, variant);
15888 else
15889 g_dbus_gvariant_to_gvalue (variant, &value);
15890 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
15891 g_value_unset (&value);
15892 ret = TRUE;
15893 }
15894 return ret;
15895}
15896
15897static const GDBusInterfaceVTable _control_host_skeleton_vtable =
15898{
15899 _control_host_skeleton_handle_method_call,
15900 _control_host_skeleton_handle_get_property,
15901 _control_host_skeleton_handle_set_property,
15902 {NULL}
15903};
15904
15905static GDBusInterfaceInfo *
15906control_host_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
15907{
15908 return control_host_interface_info ();
15909}
15910
15911static GDBusInterfaceVTable *
15912control_host_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
15913{
15914 return (GDBusInterfaceVTable *) &_control_host_skeleton_vtable;
15915}
15916
15917static GVariant *
15918control_host_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
15919{
15920 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (_skeleton);
15921
15922 GVariantBuilder builder;
15923 guint n;
15924 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
15925 if (_control_host_interface_info.parent_struct.properties == NULL)
15926 goto out;
15927 for (n = 0; _control_host_interface_info.parent_struct.properties[n] != NULL; n++)
15928 {
15929 GDBusPropertyInfo *info = _control_host_interface_info.parent_struct.properties[n];
15930 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
15931 {
15932 GVariant *value;
15933 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);
15934 if (value != NULL)
15935 {
15936 g_variant_take_ref (value);
15937 g_variant_builder_add (&builder, "{sv}", info->name, value);
15938 g_variant_unref (value);
15939 }
15940 }
15941 }
15942out:
15943 return g_variant_builder_end (&builder);
15944}
15945
Norman James493996c2015-10-31 17:27:13 -050015946static gboolean _control_host_emit_changed (gpointer user_data);
15947
Norman James362a80f2015-09-14 14:04:39 -050015948static void
15949control_host_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
15950{
Norman James493996c2015-10-31 17:27:13 -050015951 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (_skeleton);
15952 gboolean emit_changed = FALSE;
15953
15954 g_mutex_lock (&skeleton->priv->lock);
15955 if (skeleton->priv->changed_properties_idle_source != NULL)
15956 {
15957 g_source_destroy (skeleton->priv->changed_properties_idle_source);
15958 skeleton->priv->changed_properties_idle_source = NULL;
15959 emit_changed = TRUE;
15960 }
15961 g_mutex_unlock (&skeleton->priv->lock);
15962
15963 if (emit_changed)
15964 _control_host_emit_changed (skeleton);
Norman James362a80f2015-09-14 14:04:39 -050015965}
15966
15967static void
15968_control_host_on_signal_booted (
15969 ControlHost *object)
15970{
15971 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object);
15972
15973 GList *connections, *l;
15974 GVariant *signal_variant;
15975 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
15976
15977 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
15978 for (l = connections; l != NULL; l = l->next)
15979 {
15980 GDBusConnection *connection = l->data;
15981 g_dbus_connection_emit_signal (connection,
15982 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.control.Host", "Booted",
15983 signal_variant, NULL);
15984 }
15985 g_variant_unref (signal_variant);
15986 g_list_free_full (connections, g_object_unref);
15987}
15988
15989static void control_host_skeleton_iface_init (ControlHostIface *iface);
15990#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
15991G_DEFINE_TYPE_WITH_CODE (ControlHostSkeleton, control_host_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
15992 G_ADD_PRIVATE (ControlHostSkeleton)
15993 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_skeleton_iface_init));
15994
15995#else
15996G_DEFINE_TYPE_WITH_CODE (ControlHostSkeleton, control_host_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
15997 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_skeleton_iface_init));
15998
15999#endif
16000static void
16001control_host_skeleton_finalize (GObject *object)
16002{
16003 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object);
Norman James493996c2015-10-31 17:27:13 -050016004 guint n;
16005 for (n = 0; n < 2; n++)
16006 g_value_unset (&skeleton->priv->properties[n]);
16007 g_free (skeleton->priv->properties);
Norman James362a80f2015-09-14 14:04:39 -050016008 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
16009 if (skeleton->priv->changed_properties_idle_source != NULL)
16010 g_source_destroy (skeleton->priv->changed_properties_idle_source);
16011 g_main_context_unref (skeleton->priv->context);
16012 g_mutex_clear (&skeleton->priv->lock);
16013 G_OBJECT_CLASS (control_host_skeleton_parent_class)->finalize (object);
16014}
16015
16016static void
Norman James493996c2015-10-31 17:27:13 -050016017control_host_skeleton_get_property (GObject *object,
16018 guint prop_id,
16019 GValue *value,
16020 GParamSpec *pspec G_GNUC_UNUSED)
16021{
16022 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object);
16023 g_assert (prop_id != 0 && prop_id - 1 < 2);
16024 g_mutex_lock (&skeleton->priv->lock);
16025 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
16026 g_mutex_unlock (&skeleton->priv->lock);
16027}
16028
16029static gboolean
16030_control_host_emit_changed (gpointer user_data)
16031{
16032 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (user_data);
16033 GList *l;
16034 GVariantBuilder builder;
16035 GVariantBuilder invalidated_builder;
16036 guint num_changes;
16037
16038 g_mutex_lock (&skeleton->priv->lock);
16039 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
16040 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
16041 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
16042 {
16043 ChangedProperty *cp = l->data;
16044 GVariant *variant;
16045 const GValue *cur_value;
16046
16047 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
16048 if (!_g_value_equal (cur_value, &cp->orig_value))
16049 {
16050 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
16051 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
16052 g_variant_unref (variant);
16053 num_changes++;
16054 }
16055 }
16056 if (num_changes > 0)
16057 {
16058 GList *connections, *ll;
16059 GVariant *signal_variant;
16060 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.control.Host",
16061 &builder, &invalidated_builder));
16062 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
16063 for (ll = connections; ll != NULL; ll = ll->next)
16064 {
16065 GDBusConnection *connection = ll->data;
16066
16067 g_dbus_connection_emit_signal (connection,
16068 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
16069 "org.freedesktop.DBus.Properties",
16070 "PropertiesChanged",
16071 signal_variant,
16072 NULL);
16073 }
16074 g_variant_unref (signal_variant);
16075 g_list_free_full (connections, g_object_unref);
16076 }
16077 else
16078 {
16079 g_variant_builder_clear (&builder);
16080 g_variant_builder_clear (&invalidated_builder);
16081 }
16082 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
16083 skeleton->priv->changed_properties = NULL;
16084 skeleton->priv->changed_properties_idle_source = NULL;
16085 g_mutex_unlock (&skeleton->priv->lock);
16086 return FALSE;
16087}
16088
16089static void
16090_control_host_schedule_emit_changed (ControlHostSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
16091{
16092 ChangedProperty *cp;
16093 GList *l;
16094 cp = NULL;
16095 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
16096 {
16097 ChangedProperty *i_cp = l->data;
16098 if (i_cp->info == info)
16099 {
16100 cp = i_cp;
16101 break;
16102 }
16103 }
16104 if (cp == NULL)
16105 {
16106 cp = g_new0 (ChangedProperty, 1);
16107 cp->prop_id = prop_id;
16108 cp->info = info;
16109 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
16110 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
16111 g_value_copy (orig_value, &cp->orig_value);
16112 }
16113}
16114
16115static void
16116control_host_skeleton_notify (GObject *object,
16117 GParamSpec *pspec G_GNUC_UNUSED)
16118{
16119 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object);
16120 g_mutex_lock (&skeleton->priv->lock);
16121 if (skeleton->priv->changed_properties != NULL &&
16122 skeleton->priv->changed_properties_idle_source == NULL)
16123 {
16124 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
16125 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
16126 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _control_host_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
16127 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
16128 g_source_unref (skeleton->priv->changed_properties_idle_source);
16129 }
16130 g_mutex_unlock (&skeleton->priv->lock);
16131}
16132
16133static void
16134control_host_skeleton_set_property (GObject *object,
16135 guint prop_id,
16136 const GValue *value,
16137 GParamSpec *pspec)
16138{
16139 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object);
16140 g_assert (prop_id != 0 && prop_id - 1 < 2);
16141 g_mutex_lock (&skeleton->priv->lock);
16142 g_object_freeze_notify (object);
16143 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
16144 {
16145 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
16146 _control_host_schedule_emit_changed (skeleton, _control_host_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
16147 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
16148 g_object_notify_by_pspec (object, pspec);
16149 }
16150 g_mutex_unlock (&skeleton->priv->lock);
16151 g_object_thaw_notify (object);
16152}
16153
16154static void
Norman James362a80f2015-09-14 14:04:39 -050016155control_host_skeleton_init (ControlHostSkeleton *skeleton)
16156{
16157#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
16158 skeleton->priv = control_host_skeleton_get_instance_private (skeleton);
16159#else
16160 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_HOST_SKELETON, ControlHostSkeletonPrivate);
16161#endif
16162
16163 g_mutex_init (&skeleton->priv->lock);
16164 skeleton->priv->context = g_main_context_ref_thread_default ();
Norman James493996c2015-10-31 17:27:13 -050016165 skeleton->priv->properties = g_new0 (GValue, 2);
16166 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
16167 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
16168}
16169
16170static gint
16171control_host_skeleton_get_debug_mode (ControlHost *object)
16172{
16173 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object);
16174 gint value;
16175 g_mutex_lock (&skeleton->priv->lock);
16176 value = g_value_get_int (&(skeleton->priv->properties[0]));
16177 g_mutex_unlock (&skeleton->priv->lock);
16178 return value;
16179}
16180
16181static const gchar *
16182control_host_skeleton_get_flash_side (ControlHost *object)
16183{
16184 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object);
16185 const gchar *value;
16186 g_mutex_lock (&skeleton->priv->lock);
16187 value = g_value_get_string (&(skeleton->priv->properties[1]));
16188 g_mutex_unlock (&skeleton->priv->lock);
16189 return value;
Norman James362a80f2015-09-14 14:04:39 -050016190}
16191
16192static void
16193control_host_skeleton_class_init (ControlHostSkeletonClass *klass)
16194{
16195 GObjectClass *gobject_class;
16196 GDBusInterfaceSkeletonClass *skeleton_class;
16197
16198 gobject_class = G_OBJECT_CLASS (klass);
16199 gobject_class->finalize = control_host_skeleton_finalize;
Norman James493996c2015-10-31 17:27:13 -050016200 gobject_class->get_property = control_host_skeleton_get_property;
16201 gobject_class->set_property = control_host_skeleton_set_property;
16202 gobject_class->notify = control_host_skeleton_notify;
16203
16204
16205 control_host_override_properties (gobject_class, 1);
Norman James362a80f2015-09-14 14:04:39 -050016206
16207 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
16208 skeleton_class->get_info = control_host_skeleton_dbus_interface_get_info;
16209 skeleton_class->get_properties = control_host_skeleton_dbus_interface_get_properties;
16210 skeleton_class->flush = control_host_skeleton_dbus_interface_flush;
16211 skeleton_class->get_vtable = control_host_skeleton_dbus_interface_get_vtable;
16212
16213#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
16214 g_type_class_add_private (klass, sizeof (ControlHostSkeletonPrivate));
16215#endif
16216}
16217
16218static void
16219control_host_skeleton_iface_init (ControlHostIface *iface)
16220{
16221 iface->booted = _control_host_on_signal_booted;
Norman James493996c2015-10-31 17:27:13 -050016222 iface->get_debug_mode = control_host_skeleton_get_debug_mode;
16223 iface->get_flash_side = control_host_skeleton_get_flash_side;
Norman James362a80f2015-09-14 14:04:39 -050016224}
16225
16226/**
16227 * control_host_skeleton_new:
16228 *
16229 * 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>.
16230 *
16231 * Returns: (transfer full) (type ControlHostSkeleton): The skeleton object.
16232 */
16233ControlHost *
16234control_host_skeleton_new (void)
16235{
16236 return CONTROL_HOST (g_object_new (TYPE_CONTROL_HOST_SKELETON, NULL));
16237}
16238
16239/* ------------------------------------------------------------------------
16240 * Code for interface org.openbmc.control.Power
16241 * ------------------------------------------------------------------------
16242 */
16243
16244/**
16245 * SECTION:ControlPower
16246 * @title: ControlPower
16247 * @short_description: Generated C code for the org.openbmc.control.Power D-Bus interface
16248 *
16249 * 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.
16250 */
16251
16252/* ---- Introspection data for org.openbmc.control.Power ---- */
16253
16254static const _ExtendedGDBusArgInfo _control_power_method_info_set_power_state_IN_ARG_state =
16255{
16256 {
16257 -1,
16258 (gchar *) "state",
16259 (gchar *) "i",
16260 NULL
16261 },
16262 FALSE
16263};
16264
16265static const _ExtendedGDBusArgInfo * const _control_power_method_info_set_power_state_IN_ARG_pointers[] =
16266{
16267 &_control_power_method_info_set_power_state_IN_ARG_state,
16268 NULL
16269};
16270
16271static const _ExtendedGDBusMethodInfo _control_power_method_info_set_power_state =
16272{
16273 {
16274 -1,
16275 (gchar *) "setPowerState",
16276 (GDBusArgInfo **) &_control_power_method_info_set_power_state_IN_ARG_pointers,
16277 NULL,
16278 NULL
16279 },
16280 "handle-set-power-state",
16281 FALSE
16282};
16283
16284static const _ExtendedGDBusArgInfo _control_power_method_info_get_power_state_OUT_ARG_state =
16285{
16286 {
16287 -1,
16288 (gchar *) "state",
16289 (gchar *) "i",
16290 NULL
16291 },
16292 FALSE
16293};
16294
16295static const _ExtendedGDBusArgInfo * const _control_power_method_info_get_power_state_OUT_ARG_pointers[] =
16296{
16297 &_control_power_method_info_get_power_state_OUT_ARG_state,
16298 NULL
16299};
16300
16301static const _ExtendedGDBusMethodInfo _control_power_method_info_get_power_state =
16302{
16303 {
16304 -1,
16305 (gchar *) "getPowerState",
16306 NULL,
16307 (GDBusArgInfo **) &_control_power_method_info_get_power_state_OUT_ARG_pointers,
16308 NULL
16309 },
16310 "handle-get-power-state",
16311 FALSE
16312};
16313
16314static const _ExtendedGDBusMethodInfo * const _control_power_method_info_pointers[] =
16315{
16316 &_control_power_method_info_set_power_state,
16317 &_control_power_method_info_get_power_state,
16318 NULL
16319};
16320
16321static const _ExtendedGDBusSignalInfo _control_power_signal_info_power_good =
16322{
16323 {
16324 -1,
16325 (gchar *) "PowerGood",
16326 NULL,
16327 NULL
16328 },
16329 "power-good"
16330};
16331
16332static const _ExtendedGDBusSignalInfo _control_power_signal_info_power_lost =
16333{
16334 {
16335 -1,
16336 (gchar *) "PowerLost",
16337 NULL,
16338 NULL
16339 },
16340 "power-lost"
16341};
16342
16343static const _ExtendedGDBusSignalInfo * const _control_power_signal_info_pointers[] =
16344{
16345 &_control_power_signal_info_power_good,
16346 &_control_power_signal_info_power_lost,
16347 NULL
16348};
16349
16350static const _ExtendedGDBusPropertyInfo _control_power_property_info_pgood =
16351{
16352 {
16353 -1,
16354 (gchar *) "pgood",
16355 (gchar *) "i",
16356 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
16357 NULL
16358 },
16359 "pgood",
16360 FALSE
16361};
16362
16363static const _ExtendedGDBusPropertyInfo _control_power_property_info_state =
16364{
16365 {
16366 -1,
16367 (gchar *) "state",
16368 (gchar *) "i",
16369 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
16370 NULL
16371 },
16372 "state",
16373 FALSE
16374};
16375
Norman James32e74e22015-09-15 21:28:06 -050016376static const _ExtendedGDBusPropertyInfo _control_power_property_info_pgood_timeout =
16377{
16378 {
16379 -1,
16380 (gchar *) "pgood_timeout",
16381 (gchar *) "i",
16382 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
16383 NULL
16384 },
16385 "pgood-timeout",
16386 FALSE
16387};
16388
Norman James362a80f2015-09-14 14:04:39 -050016389static const _ExtendedGDBusPropertyInfo * const _control_power_property_info_pointers[] =
16390{
16391 &_control_power_property_info_pgood,
16392 &_control_power_property_info_state,
Norman James32e74e22015-09-15 21:28:06 -050016393 &_control_power_property_info_pgood_timeout,
Norman James362a80f2015-09-14 14:04:39 -050016394 NULL
16395};
16396
16397static const _ExtendedGDBusInterfaceInfo _control_power_interface_info =
16398{
16399 {
16400 -1,
16401 (gchar *) "org.openbmc.control.Power",
16402 (GDBusMethodInfo **) &_control_power_method_info_pointers,
16403 (GDBusSignalInfo **) &_control_power_signal_info_pointers,
16404 (GDBusPropertyInfo **) &_control_power_property_info_pointers,
16405 NULL
16406 },
16407 "control-power",
16408};
16409
16410
16411/**
16412 * control_power_interface_info:
16413 *
16414 * 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.
16415 *
16416 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
16417 */
16418GDBusInterfaceInfo *
16419control_power_interface_info (void)
16420{
16421 return (GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct;
16422}
16423
16424/**
16425 * control_power_override_properties:
16426 * @klass: The class structure for a #GObject<!-- -->-derived class.
16427 * @property_id_begin: The property id to assign to the first overridden property.
16428 *
16429 * Overrides all #GObject properties in the #ControlPower interface for a concrete class.
16430 * The properties are overridden in the order they are defined.
16431 *
16432 * Returns: The last property id.
16433 */
16434guint
16435control_power_override_properties (GObjectClass *klass, guint property_id_begin)
16436{
16437 g_object_class_override_property (klass, property_id_begin++, "pgood");
16438 g_object_class_override_property (klass, property_id_begin++, "state");
Norman James32e74e22015-09-15 21:28:06 -050016439 g_object_class_override_property (klass, property_id_begin++, "pgood-timeout");
Norman James362a80f2015-09-14 14:04:39 -050016440 return property_id_begin - 1;
16441}
16442
16443
16444
16445/**
16446 * ControlPower:
16447 *
16448 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Power.top_of_page">org.openbmc.control.Power</link>.
16449 */
16450
16451/**
16452 * ControlPowerIface:
16453 * @parent_iface: The parent interface.
16454 * @handle_get_power_state: Handler for the #ControlPower::handle-get-power-state signal.
16455 * @handle_set_power_state: Handler for the #ControlPower::handle-set-power-state signal.
16456 * @get_pgood: Getter for the #ControlPower:pgood property.
Norman James32e74e22015-09-15 21:28:06 -050016457 * @get_pgood_timeout: Getter for the #ControlPower:pgood-timeout property.
Norman James362a80f2015-09-14 14:04:39 -050016458 * @get_state: Getter for the #ControlPower:state property.
16459 * @power_good: Handler for the #ControlPower::power-good signal.
16460 * @power_lost: Handler for the #ControlPower::power-lost signal.
16461 *
16462 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Power.top_of_page">org.openbmc.control.Power</link>.
16463 */
16464
16465typedef ControlPowerIface ControlPowerInterface;
16466G_DEFINE_INTERFACE (ControlPower, control_power, G_TYPE_OBJECT);
16467
16468static void
16469control_power_default_init (ControlPowerIface *iface)
16470{
16471 /* GObject signals for incoming D-Bus method calls: */
16472 /**
16473 * ControlPower::handle-set-power-state:
16474 * @object: A #ControlPower.
16475 * @invocation: A #GDBusMethodInvocation.
16476 * @arg_state: Argument passed by remote caller.
16477 *
16478 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Power.setPowerState">setPowerState()</link> D-Bus method.
16479 *
16480 * 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.
16481 *
16482 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
16483 */
16484 g_signal_new ("handle-set-power-state",
16485 G_TYPE_FROM_INTERFACE (iface),
16486 G_SIGNAL_RUN_LAST,
16487 G_STRUCT_OFFSET (ControlPowerIface, handle_set_power_state),
16488 g_signal_accumulator_true_handled,
16489 NULL,
16490 g_cclosure_marshal_generic,
16491 G_TYPE_BOOLEAN,
16492 2,
16493 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT);
16494
16495 /**
16496 * ControlPower::handle-get-power-state:
16497 * @object: A #ControlPower.
16498 * @invocation: A #GDBusMethodInvocation.
16499 *
16500 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Power.getPowerState">getPowerState()</link> D-Bus method.
16501 *
16502 * 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.
16503 *
16504 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
16505 */
16506 g_signal_new ("handle-get-power-state",
16507 G_TYPE_FROM_INTERFACE (iface),
16508 G_SIGNAL_RUN_LAST,
16509 G_STRUCT_OFFSET (ControlPowerIface, handle_get_power_state),
16510 g_signal_accumulator_true_handled,
16511 NULL,
16512 g_cclosure_marshal_generic,
16513 G_TYPE_BOOLEAN,
16514 1,
16515 G_TYPE_DBUS_METHOD_INVOCATION);
16516
16517 /* GObject signals for received D-Bus signals: */
16518 /**
16519 * ControlPower::power-good:
16520 * @object: A #ControlPower.
16521 *
16522 * 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.
16523 *
16524 * 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.
16525 */
16526 g_signal_new ("power-good",
16527 G_TYPE_FROM_INTERFACE (iface),
16528 G_SIGNAL_RUN_LAST,
16529 G_STRUCT_OFFSET (ControlPowerIface, power_good),
16530 NULL,
16531 NULL,
16532 g_cclosure_marshal_generic,
16533 G_TYPE_NONE,
16534 0);
16535
16536 /**
16537 * ControlPower::power-lost:
16538 * @object: A #ControlPower.
16539 *
16540 * 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.
16541 *
16542 * 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.
16543 */
16544 g_signal_new ("power-lost",
16545 G_TYPE_FROM_INTERFACE (iface),
16546 G_SIGNAL_RUN_LAST,
16547 G_STRUCT_OFFSET (ControlPowerIface, power_lost),
16548 NULL,
16549 NULL,
16550 g_cclosure_marshal_generic,
16551 G_TYPE_NONE,
16552 0);
16553
16554 /* GObject properties for D-Bus properties: */
16555 /**
16556 * ControlPower:pgood:
16557 *
16558 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-control-Power.pgood">"pgood"</link>.
16559 *
16560 * 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.
16561 */
16562 g_object_interface_install_property (iface,
16563 g_param_spec_int ("pgood", "pgood", "pgood", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
16564 /**
16565 * ControlPower:state:
16566 *
16567 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-control-Power.state">"state"</link>.
16568 *
16569 * 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.
16570 */
16571 g_object_interface_install_property (iface,
16572 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 -050016573 /**
16574 * ControlPower:pgood-timeout:
16575 *
16576 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-control-Power.pgood_timeout">"pgood_timeout"</link>.
16577 *
16578 * 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.
16579 */
16580 g_object_interface_install_property (iface,
16581 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 -050016582}
16583
16584/**
16585 * control_power_get_pgood: (skip)
16586 * @object: A #ControlPower.
16587 *
16588 * Gets the value of the <link linkend="gdbus-property-org-openbmc-control-Power.pgood">"pgood"</link> D-Bus property.
16589 *
16590 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
16591 *
16592 * Returns: The property value.
16593 */
16594gint
16595control_power_get_pgood (ControlPower *object)
16596{
16597 return CONTROL_POWER_GET_IFACE (object)->get_pgood (object);
16598}
16599
16600/**
16601 * control_power_set_pgood: (skip)
16602 * @object: A #ControlPower.
16603 * @value: The value to set.
16604 *
16605 * Sets the <link linkend="gdbus-property-org-openbmc-control-Power.pgood">"pgood"</link> D-Bus property to @value.
16606 *
16607 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
16608 */
16609void
16610control_power_set_pgood (ControlPower *object, gint value)
16611{
16612 g_object_set (G_OBJECT (object), "pgood", value, NULL);
16613}
16614
16615/**
16616 * control_power_get_state: (skip)
16617 * @object: A #ControlPower.
16618 *
16619 * Gets the value of the <link linkend="gdbus-property-org-openbmc-control-Power.state">"state"</link> D-Bus property.
16620 *
16621 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
16622 *
16623 * Returns: The property value.
16624 */
16625gint
16626control_power_get_state (ControlPower *object)
16627{
16628 return CONTROL_POWER_GET_IFACE (object)->get_state (object);
16629}
16630
16631/**
16632 * control_power_set_state: (skip)
16633 * @object: A #ControlPower.
16634 * @value: The value to set.
16635 *
16636 * Sets the <link linkend="gdbus-property-org-openbmc-control-Power.state">"state"</link> D-Bus property to @value.
16637 *
16638 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
16639 */
16640void
16641control_power_set_state (ControlPower *object, gint value)
16642{
16643 g_object_set (G_OBJECT (object), "state", value, NULL);
16644}
16645
16646/**
Norman James32e74e22015-09-15 21:28:06 -050016647 * control_power_get_pgood_timeout: (skip)
16648 * @object: A #ControlPower.
16649 *
16650 * Gets the value of the <link linkend="gdbus-property-org-openbmc-control-Power.pgood_timeout">"pgood_timeout"</link> D-Bus property.
16651 *
16652 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
16653 *
16654 * Returns: The property value.
16655 */
16656gint
16657control_power_get_pgood_timeout (ControlPower *object)
16658{
16659 return CONTROL_POWER_GET_IFACE (object)->get_pgood_timeout (object);
16660}
16661
16662/**
16663 * control_power_set_pgood_timeout: (skip)
16664 * @object: A #ControlPower.
16665 * @value: The value to set.
16666 *
16667 * Sets the <link linkend="gdbus-property-org-openbmc-control-Power.pgood_timeout">"pgood_timeout"</link> D-Bus property to @value.
16668 *
16669 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
16670 */
16671void
16672control_power_set_pgood_timeout (ControlPower *object, gint value)
16673{
16674 g_object_set (G_OBJECT (object), "pgood-timeout", value, NULL);
16675}
16676
16677/**
Norman James362a80f2015-09-14 14:04:39 -050016678 * control_power_emit_power_good:
16679 * @object: A #ControlPower.
16680 *
16681 * Emits the <link linkend="gdbus-signal-org-openbmc-control-Power.PowerGood">"PowerGood"</link> D-Bus signal.
16682 */
16683void
16684control_power_emit_power_good (
16685 ControlPower *object)
16686{
16687 g_signal_emit_by_name (object, "power-good");
16688}
16689
16690/**
16691 * control_power_emit_power_lost:
16692 * @object: A #ControlPower.
16693 *
16694 * Emits the <link linkend="gdbus-signal-org-openbmc-control-Power.PowerLost">"PowerLost"</link> D-Bus signal.
16695 */
16696void
16697control_power_emit_power_lost (
16698 ControlPower *object)
16699{
16700 g_signal_emit_by_name (object, "power-lost");
16701}
16702
16703/**
16704 * control_power_call_set_power_state:
16705 * @proxy: A #ControlPowerProxy.
16706 * @arg_state: Argument to pass with the method invocation.
16707 * @cancellable: (allow-none): A #GCancellable or %NULL.
16708 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
16709 * @user_data: User data to pass to @callback.
16710 *
16711 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Power.setPowerState">setPowerState()</link> D-Bus method on @proxy.
16712 * 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.
16713 * You can then call control_power_call_set_power_state_finish() to get the result of the operation.
16714 *
16715 * See control_power_call_set_power_state_sync() for the synchronous, blocking version of this method.
16716 */
16717void
16718control_power_call_set_power_state (
16719 ControlPower *proxy,
16720 gint arg_state,
16721 GCancellable *cancellable,
16722 GAsyncReadyCallback callback,
16723 gpointer user_data)
16724{
16725 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
16726 "setPowerState",
16727 g_variant_new ("(i)",
16728 arg_state),
16729 G_DBUS_CALL_FLAGS_NONE,
16730 -1,
16731 cancellable,
16732 callback,
16733 user_data);
16734}
16735
16736/**
16737 * control_power_call_set_power_state_finish:
16738 * @proxy: A #ControlPowerProxy.
16739 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_call_set_power_state().
16740 * @error: Return location for error or %NULL.
16741 *
16742 * Finishes an operation started with control_power_call_set_power_state().
16743 *
16744 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
16745 */
16746gboolean
16747control_power_call_set_power_state_finish (
16748 ControlPower *proxy,
16749 GAsyncResult *res,
16750 GError **error)
16751{
16752 GVariant *_ret;
16753 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
16754 if (_ret == NULL)
16755 goto _out;
16756 g_variant_get (_ret,
16757 "()");
16758 g_variant_unref (_ret);
16759_out:
16760 return _ret != NULL;
16761}
16762
16763/**
16764 * control_power_call_set_power_state_sync:
16765 * @proxy: A #ControlPowerProxy.
16766 * @arg_state: Argument to pass with the method invocation.
16767 * @cancellable: (allow-none): A #GCancellable or %NULL.
16768 * @error: Return location for error or %NULL.
16769 *
16770 * 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.
16771 *
16772 * See control_power_call_set_power_state() for the asynchronous version of this method.
16773 *
16774 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
16775 */
16776gboolean
16777control_power_call_set_power_state_sync (
16778 ControlPower *proxy,
16779 gint arg_state,
16780 GCancellable *cancellable,
16781 GError **error)
16782{
16783 GVariant *_ret;
16784 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
16785 "setPowerState",
16786 g_variant_new ("(i)",
16787 arg_state),
16788 G_DBUS_CALL_FLAGS_NONE,
16789 -1,
16790 cancellable,
16791 error);
16792 if (_ret == NULL)
16793 goto _out;
16794 g_variant_get (_ret,
16795 "()");
16796 g_variant_unref (_ret);
16797_out:
16798 return _ret != NULL;
16799}
16800
16801/**
16802 * control_power_call_get_power_state:
16803 * @proxy: A #ControlPowerProxy.
16804 * @cancellable: (allow-none): A #GCancellable or %NULL.
16805 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
16806 * @user_data: User data to pass to @callback.
16807 *
16808 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Power.getPowerState">getPowerState()</link> D-Bus method on @proxy.
16809 * 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.
16810 * You can then call control_power_call_get_power_state_finish() to get the result of the operation.
16811 *
16812 * See control_power_call_get_power_state_sync() for the synchronous, blocking version of this method.
16813 */
16814void
16815control_power_call_get_power_state (
16816 ControlPower *proxy,
16817 GCancellable *cancellable,
16818 GAsyncReadyCallback callback,
16819 gpointer user_data)
16820{
16821 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
16822 "getPowerState",
16823 g_variant_new ("()"),
16824 G_DBUS_CALL_FLAGS_NONE,
16825 -1,
16826 cancellable,
16827 callback,
16828 user_data);
16829}
16830
16831/**
16832 * control_power_call_get_power_state_finish:
16833 * @proxy: A #ControlPowerProxy.
16834 * @out_state: (out): Return location for return parameter or %NULL to ignore.
16835 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_call_get_power_state().
16836 * @error: Return location for error or %NULL.
16837 *
16838 * Finishes an operation started with control_power_call_get_power_state().
16839 *
16840 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
16841 */
16842gboolean
16843control_power_call_get_power_state_finish (
16844 ControlPower *proxy,
16845 gint *out_state,
16846 GAsyncResult *res,
16847 GError **error)
16848{
16849 GVariant *_ret;
16850 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
16851 if (_ret == NULL)
16852 goto _out;
16853 g_variant_get (_ret,
16854 "(i)",
16855 out_state);
16856 g_variant_unref (_ret);
16857_out:
16858 return _ret != NULL;
16859}
16860
16861/**
16862 * control_power_call_get_power_state_sync:
16863 * @proxy: A #ControlPowerProxy.
16864 * @out_state: (out): Return location for return parameter or %NULL to ignore.
16865 * @cancellable: (allow-none): A #GCancellable or %NULL.
16866 * @error: Return location for error or %NULL.
16867 *
16868 * 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.
16869 *
16870 * See control_power_call_get_power_state() for the asynchronous version of this method.
16871 *
16872 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
16873 */
16874gboolean
16875control_power_call_get_power_state_sync (
16876 ControlPower *proxy,
16877 gint *out_state,
16878 GCancellable *cancellable,
16879 GError **error)
16880{
16881 GVariant *_ret;
16882 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
16883 "getPowerState",
16884 g_variant_new ("()"),
16885 G_DBUS_CALL_FLAGS_NONE,
16886 -1,
16887 cancellable,
16888 error);
16889 if (_ret == NULL)
16890 goto _out;
16891 g_variant_get (_ret,
16892 "(i)",
16893 out_state);
16894 g_variant_unref (_ret);
16895_out:
16896 return _ret != NULL;
16897}
16898
16899/**
16900 * control_power_complete_set_power_state:
16901 * @object: A #ControlPower.
16902 * @invocation: (transfer full): A #GDBusMethodInvocation.
16903 *
16904 * 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.
16905 *
16906 * This method will free @invocation, you cannot use it afterwards.
16907 */
16908void
16909control_power_complete_set_power_state (
16910 ControlPower *object,
16911 GDBusMethodInvocation *invocation)
16912{
16913 g_dbus_method_invocation_return_value (invocation,
16914 g_variant_new ("()"));
16915}
16916
16917/**
16918 * control_power_complete_get_power_state:
16919 * @object: A #ControlPower.
16920 * @invocation: (transfer full): A #GDBusMethodInvocation.
16921 * @state: Parameter to return.
16922 *
16923 * 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.
16924 *
16925 * This method will free @invocation, you cannot use it afterwards.
16926 */
16927void
16928control_power_complete_get_power_state (
16929 ControlPower *object,
16930 GDBusMethodInvocation *invocation,
16931 gint state)
16932{
16933 g_dbus_method_invocation_return_value (invocation,
16934 g_variant_new ("(i)",
16935 state));
16936}
16937
16938/* ------------------------------------------------------------------------ */
16939
16940/**
16941 * ControlPowerProxy:
16942 *
16943 * The #ControlPowerProxy structure contains only private data and should only be accessed using the provided API.
16944 */
16945
16946/**
16947 * ControlPowerProxyClass:
16948 * @parent_class: The parent class.
16949 *
16950 * Class structure for #ControlPowerProxy.
16951 */
16952
16953struct _ControlPowerProxyPrivate
16954{
16955 GData *qdata;
16956};
16957
16958static void control_power_proxy_iface_init (ControlPowerIface *iface);
16959
16960#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
16961G_DEFINE_TYPE_WITH_CODE (ControlPowerProxy, control_power_proxy, G_TYPE_DBUS_PROXY,
16962 G_ADD_PRIVATE (ControlPowerProxy)
16963 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_proxy_iface_init));
16964
16965#else
16966G_DEFINE_TYPE_WITH_CODE (ControlPowerProxy, control_power_proxy, G_TYPE_DBUS_PROXY,
16967 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_proxy_iface_init));
16968
16969#endif
16970static void
16971control_power_proxy_finalize (GObject *object)
16972{
16973 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (object);
16974 g_datalist_clear (&proxy->priv->qdata);
16975 G_OBJECT_CLASS (control_power_proxy_parent_class)->finalize (object);
16976}
16977
16978static void
16979control_power_proxy_get_property (GObject *object,
16980 guint prop_id,
16981 GValue *value,
16982 GParamSpec *pspec G_GNUC_UNUSED)
16983{
16984 const _ExtendedGDBusPropertyInfo *info;
16985 GVariant *variant;
Norman James32e74e22015-09-15 21:28:06 -050016986 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -050016987 info = _control_power_property_info_pointers[prop_id - 1];
16988 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
16989 if (info->use_gvariant)
16990 {
16991 g_value_set_variant (value, variant);
16992 }
16993 else
16994 {
16995 if (variant != NULL)
16996 g_dbus_gvariant_to_gvalue (variant, value);
16997 }
16998 if (variant != NULL)
16999 g_variant_unref (variant);
17000}
17001
17002static void
17003control_power_proxy_set_property_cb (GDBusProxy *proxy,
17004 GAsyncResult *res,
17005 gpointer user_data)
17006{
17007 const _ExtendedGDBusPropertyInfo *info = user_data;
17008 GError *error;
17009 GVariant *_ret;
17010 error = NULL;
17011 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
17012 if (!_ret)
17013 {
17014 g_warning ("Error setting property '%s' on interface org.openbmc.control.Power: %s (%s, %d)",
17015 info->parent_struct.name,
17016 error->message, g_quark_to_string (error->domain), error->code);
17017 g_error_free (error);
17018 }
17019 else
17020 {
17021 g_variant_unref (_ret);
17022 }
17023}
17024
17025static void
17026control_power_proxy_set_property (GObject *object,
17027 guint prop_id,
17028 const GValue *value,
17029 GParamSpec *pspec G_GNUC_UNUSED)
17030{
17031 const _ExtendedGDBusPropertyInfo *info;
17032 GVariant *variant;
Norman James32e74e22015-09-15 21:28:06 -050017033 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -050017034 info = _control_power_property_info_pointers[prop_id - 1];
17035 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
17036 g_dbus_proxy_call (G_DBUS_PROXY (object),
17037 "org.freedesktop.DBus.Properties.Set",
17038 g_variant_new ("(ssv)", "org.openbmc.control.Power", info->parent_struct.name, variant),
17039 G_DBUS_CALL_FLAGS_NONE,
17040 -1,
17041 NULL, (GAsyncReadyCallback) control_power_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
17042 g_variant_unref (variant);
17043}
17044
17045static void
17046control_power_proxy_g_signal (GDBusProxy *proxy,
17047 const gchar *sender_name G_GNUC_UNUSED,
17048 const gchar *signal_name,
17049 GVariant *parameters)
17050{
17051 _ExtendedGDBusSignalInfo *info;
17052 GVariantIter iter;
17053 GVariant *child;
17054 GValue *paramv;
17055 guint num_params;
17056 guint n;
17057 guint signal_id;
17058 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, signal_name);
17059 if (info == NULL)
17060 return;
17061 num_params = g_variant_n_children (parameters);
17062 paramv = g_new0 (GValue, num_params + 1);
17063 g_value_init (&paramv[0], TYPE_CONTROL_POWER);
17064 g_value_set_object (&paramv[0], proxy);
17065 g_variant_iter_init (&iter, parameters);
17066 n = 1;
17067 while ((child = g_variant_iter_next_value (&iter)) != NULL)
17068 {
17069 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
17070 if (arg_info->use_gvariant)
17071 {
17072 g_value_init (&paramv[n], G_TYPE_VARIANT);
17073 g_value_set_variant (&paramv[n], child);
17074 n++;
17075 }
17076 else
17077 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
17078 g_variant_unref (child);
17079 }
17080 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_POWER);
17081 g_signal_emitv (paramv, signal_id, 0, NULL);
17082 for (n = 0; n < num_params + 1; n++)
17083 g_value_unset (&paramv[n]);
17084 g_free (paramv);
17085}
17086
17087static void
17088control_power_proxy_g_properties_changed (GDBusProxy *_proxy,
17089 GVariant *changed_properties,
17090 const gchar *const *invalidated_properties)
17091{
17092 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (_proxy);
17093 guint n;
17094 const gchar *key;
17095 GVariantIter *iter;
17096 _ExtendedGDBusPropertyInfo *info;
17097 g_variant_get (changed_properties, "a{sv}", &iter);
17098 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
17099 {
17100 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, key);
17101 g_datalist_remove_data (&proxy->priv->qdata, key);
17102 if (info != NULL)
17103 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
17104 }
17105 g_variant_iter_free (iter);
17106 for (n = 0; invalidated_properties[n] != NULL; n++)
17107 {
17108 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, invalidated_properties[n]);
17109 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
17110 if (info != NULL)
17111 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
17112 }
17113}
17114
17115static gint
17116control_power_proxy_get_pgood (ControlPower *object)
17117{
17118 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (object);
17119 GVariant *variant;
17120 gint value = 0;
17121 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "pgood");
17122 if (variant != NULL)
17123 {
17124 value = g_variant_get_int32 (variant);
17125 g_variant_unref (variant);
17126 }
17127 return value;
17128}
17129
17130static gint
17131control_power_proxy_get_state (ControlPower *object)
17132{
17133 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (object);
17134 GVariant *variant;
17135 gint value = 0;
17136 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state");
17137 if (variant != NULL)
17138 {
17139 value = g_variant_get_int32 (variant);
17140 g_variant_unref (variant);
17141 }
17142 return value;
17143}
17144
Norman James32e74e22015-09-15 21:28:06 -050017145static gint
17146control_power_proxy_get_pgood_timeout (ControlPower *object)
17147{
17148 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (object);
17149 GVariant *variant;
17150 gint value = 0;
17151 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "pgood_timeout");
17152 if (variant != NULL)
17153 {
17154 value = g_variant_get_int32 (variant);
17155 g_variant_unref (variant);
17156 }
17157 return value;
17158}
17159
Norman James362a80f2015-09-14 14:04:39 -050017160static void
17161control_power_proxy_init (ControlPowerProxy *proxy)
17162{
17163#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
17164 proxy->priv = control_power_proxy_get_instance_private (proxy);
17165#else
17166 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_POWER_PROXY, ControlPowerProxyPrivate);
17167#endif
17168
17169 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_power_interface_info ());
17170}
17171
17172static void
17173control_power_proxy_class_init (ControlPowerProxyClass *klass)
17174{
17175 GObjectClass *gobject_class;
17176 GDBusProxyClass *proxy_class;
17177
17178 gobject_class = G_OBJECT_CLASS (klass);
17179 gobject_class->finalize = control_power_proxy_finalize;
17180 gobject_class->get_property = control_power_proxy_get_property;
17181 gobject_class->set_property = control_power_proxy_set_property;
17182
17183 proxy_class = G_DBUS_PROXY_CLASS (klass);
17184 proxy_class->g_signal = control_power_proxy_g_signal;
17185 proxy_class->g_properties_changed = control_power_proxy_g_properties_changed;
17186
17187 control_power_override_properties (gobject_class, 1);
17188
17189#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
17190 g_type_class_add_private (klass, sizeof (ControlPowerProxyPrivate));
17191#endif
17192}
17193
17194static void
17195control_power_proxy_iface_init (ControlPowerIface *iface)
17196{
17197 iface->get_pgood = control_power_proxy_get_pgood;
17198 iface->get_state = control_power_proxy_get_state;
Norman James32e74e22015-09-15 21:28:06 -050017199 iface->get_pgood_timeout = control_power_proxy_get_pgood_timeout;
Norman James362a80f2015-09-14 14:04:39 -050017200}
17201
17202/**
17203 * control_power_proxy_new:
17204 * @connection: A #GDBusConnection.
17205 * @flags: Flags from the #GDBusProxyFlags enumeration.
17206 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
17207 * @object_path: An object path.
17208 * @cancellable: (allow-none): A #GCancellable or %NULL.
17209 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
17210 * @user_data: User data to pass to @callback.
17211 *
17212 * 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.
17213 *
17214 * 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.
17215 * You can then call control_power_proxy_new_finish() to get the result of the operation.
17216 *
17217 * See control_power_proxy_new_sync() for the synchronous, blocking version of this constructor.
17218 */
17219void
17220control_power_proxy_new (
17221 GDBusConnection *connection,
17222 GDBusProxyFlags flags,
17223 const gchar *name,
17224 const gchar *object_path,
17225 GCancellable *cancellable,
17226 GAsyncReadyCallback callback,
17227 gpointer user_data)
17228{
17229 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);
17230}
17231
17232/**
17233 * control_power_proxy_new_finish:
17234 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_proxy_new().
17235 * @error: Return location for error or %NULL
17236 *
17237 * Finishes an operation started with control_power_proxy_new().
17238 *
17239 * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set.
17240 */
17241ControlPower *
17242control_power_proxy_new_finish (
17243 GAsyncResult *res,
17244 GError **error)
17245{
17246 GObject *ret;
17247 GObject *source_object;
17248 source_object = g_async_result_get_source_object (res);
17249 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
17250 g_object_unref (source_object);
17251 if (ret != NULL)
17252 return CONTROL_POWER (ret);
17253 else
17254 return NULL;
17255}
17256
17257/**
17258 * control_power_proxy_new_sync:
17259 * @connection: A #GDBusConnection.
17260 * @flags: Flags from the #GDBusProxyFlags enumeration.
17261 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
17262 * @object_path: An object path.
17263 * @cancellable: (allow-none): A #GCancellable or %NULL.
17264 * @error: Return location for error or %NULL
17265 *
17266 * 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.
17267 *
17268 * The calling thread is blocked until a reply is received.
17269 *
17270 * See control_power_proxy_new() for the asynchronous version of this constructor.
17271 *
17272 * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set.
17273 */
17274ControlPower *
17275control_power_proxy_new_sync (
17276 GDBusConnection *connection,
17277 GDBusProxyFlags flags,
17278 const gchar *name,
17279 const gchar *object_path,
17280 GCancellable *cancellable,
17281 GError **error)
17282{
17283 GInitable *ret;
17284 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);
17285 if (ret != NULL)
17286 return CONTROL_POWER (ret);
17287 else
17288 return NULL;
17289}
17290
17291
17292/**
17293 * control_power_proxy_new_for_bus:
17294 * @bus_type: A #GBusType.
17295 * @flags: Flags from the #GDBusProxyFlags enumeration.
17296 * @name: A bus name (well-known or unique).
17297 * @object_path: An object path.
17298 * @cancellable: (allow-none): A #GCancellable or %NULL.
17299 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
17300 * @user_data: User data to pass to @callback.
17301 *
17302 * Like control_power_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
17303 *
17304 * 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.
17305 * You can then call control_power_proxy_new_for_bus_finish() to get the result of the operation.
17306 *
17307 * See control_power_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
17308 */
17309void
17310control_power_proxy_new_for_bus (
17311 GBusType bus_type,
17312 GDBusProxyFlags flags,
17313 const gchar *name,
17314 const gchar *object_path,
17315 GCancellable *cancellable,
17316 GAsyncReadyCallback callback,
17317 gpointer user_data)
17318{
17319 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);
17320}
17321
17322/**
17323 * control_power_proxy_new_for_bus_finish:
17324 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_proxy_new_for_bus().
17325 * @error: Return location for error or %NULL
17326 *
17327 * Finishes an operation started with control_power_proxy_new_for_bus().
17328 *
17329 * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set.
17330 */
17331ControlPower *
17332control_power_proxy_new_for_bus_finish (
17333 GAsyncResult *res,
17334 GError **error)
17335{
17336 GObject *ret;
17337 GObject *source_object;
17338 source_object = g_async_result_get_source_object (res);
17339 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
17340 g_object_unref (source_object);
17341 if (ret != NULL)
17342 return CONTROL_POWER (ret);
17343 else
17344 return NULL;
17345}
17346
17347/**
17348 * control_power_proxy_new_for_bus_sync:
17349 * @bus_type: A #GBusType.
17350 * @flags: Flags from the #GDBusProxyFlags enumeration.
17351 * @name: A bus name (well-known or unique).
17352 * @object_path: An object path.
17353 * @cancellable: (allow-none): A #GCancellable or %NULL.
17354 * @error: Return location for error or %NULL
17355 *
17356 * Like control_power_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
17357 *
17358 * The calling thread is blocked until a reply is received.
17359 *
17360 * See control_power_proxy_new_for_bus() for the asynchronous version of this constructor.
17361 *
17362 * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set.
17363 */
17364ControlPower *
17365control_power_proxy_new_for_bus_sync (
17366 GBusType bus_type,
17367 GDBusProxyFlags flags,
17368 const gchar *name,
17369 const gchar *object_path,
17370 GCancellable *cancellable,
17371 GError **error)
17372{
17373 GInitable *ret;
17374 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);
17375 if (ret != NULL)
17376 return CONTROL_POWER (ret);
17377 else
17378 return NULL;
17379}
17380
17381
17382/* ------------------------------------------------------------------------ */
17383
17384/**
17385 * ControlPowerSkeleton:
17386 *
17387 * The #ControlPowerSkeleton structure contains only private data and should only be accessed using the provided API.
17388 */
17389
17390/**
17391 * ControlPowerSkeletonClass:
17392 * @parent_class: The parent class.
17393 *
17394 * Class structure for #ControlPowerSkeleton.
17395 */
17396
17397struct _ControlPowerSkeletonPrivate
17398{
17399 GValue *properties;
17400 GList *changed_properties;
17401 GSource *changed_properties_idle_source;
17402 GMainContext *context;
17403 GMutex lock;
17404};
17405
17406static void
17407_control_power_skeleton_handle_method_call (
17408 GDBusConnection *connection G_GNUC_UNUSED,
17409 const gchar *sender G_GNUC_UNUSED,
17410 const gchar *object_path G_GNUC_UNUSED,
17411 const gchar *interface_name,
17412 const gchar *method_name,
17413 GVariant *parameters,
17414 GDBusMethodInvocation *invocation,
17415 gpointer user_data)
17416{
17417 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data);
17418 _ExtendedGDBusMethodInfo *info;
17419 GVariantIter iter;
17420 GVariant *child;
17421 GValue *paramv;
17422 guint num_params;
17423 guint num_extra;
17424 guint n;
17425 guint signal_id;
17426 GValue return_value = G_VALUE_INIT;
17427 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
17428 g_assert (info != NULL);
17429 num_params = g_variant_n_children (parameters);
17430 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
17431 n = 0;
17432 g_value_init (&paramv[n], TYPE_CONTROL_POWER);
17433 g_value_set_object (&paramv[n++], skeleton);
17434 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
17435 g_value_set_object (&paramv[n++], invocation);
17436 if (info->pass_fdlist)
17437 {
17438#ifdef G_OS_UNIX
17439 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
17440 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
17441#else
17442 g_assert_not_reached ();
17443#endif
17444 }
17445 g_variant_iter_init (&iter, parameters);
17446 while ((child = g_variant_iter_next_value (&iter)) != NULL)
17447 {
17448 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
17449 if (arg_info->use_gvariant)
17450 {
17451 g_value_init (&paramv[n], G_TYPE_VARIANT);
17452 g_value_set_variant (&paramv[n], child);
17453 n++;
17454 }
17455 else
17456 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
17457 g_variant_unref (child);
17458 }
17459 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_POWER);
17460 g_value_init (&return_value, G_TYPE_BOOLEAN);
17461 g_signal_emitv (paramv, signal_id, 0, &return_value);
17462 if (!g_value_get_boolean (&return_value))
17463 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);
17464 g_value_unset (&return_value);
17465 for (n = 0; n < num_params + num_extra; n++)
17466 g_value_unset (&paramv[n]);
17467 g_free (paramv);
17468}
17469
17470static GVariant *
17471_control_power_skeleton_handle_get_property (
17472 GDBusConnection *connection G_GNUC_UNUSED,
17473 const gchar *sender G_GNUC_UNUSED,
17474 const gchar *object_path G_GNUC_UNUSED,
17475 const gchar *interface_name G_GNUC_UNUSED,
17476 const gchar *property_name,
17477 GError **error,
17478 gpointer user_data)
17479{
17480 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data);
17481 GValue value = G_VALUE_INIT;
17482 GParamSpec *pspec;
17483 _ExtendedGDBusPropertyInfo *info;
17484 GVariant *ret;
17485 ret = NULL;
17486 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, property_name);
17487 g_assert (info != NULL);
17488 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
17489 if (pspec == NULL)
17490 {
17491 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
17492 }
17493 else
17494 {
17495 g_value_init (&value, pspec->value_type);
17496 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
17497 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
17498 g_value_unset (&value);
17499 }
17500 return ret;
17501}
17502
17503static gboolean
17504_control_power_skeleton_handle_set_property (
17505 GDBusConnection *connection G_GNUC_UNUSED,
17506 const gchar *sender G_GNUC_UNUSED,
17507 const gchar *object_path G_GNUC_UNUSED,
17508 const gchar *interface_name G_GNUC_UNUSED,
17509 const gchar *property_name,
17510 GVariant *variant,
17511 GError **error,
17512 gpointer user_data)
17513{
17514 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data);
17515 GValue value = G_VALUE_INIT;
17516 GParamSpec *pspec;
17517 _ExtendedGDBusPropertyInfo *info;
17518 gboolean ret;
17519 ret = FALSE;
17520 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, property_name);
17521 g_assert (info != NULL);
17522 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
17523 if (pspec == NULL)
17524 {
17525 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
17526 }
17527 else
17528 {
17529 if (info->use_gvariant)
17530 g_value_set_variant (&value, variant);
17531 else
17532 g_dbus_gvariant_to_gvalue (variant, &value);
17533 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
17534 g_value_unset (&value);
17535 ret = TRUE;
17536 }
17537 return ret;
17538}
17539
17540static const GDBusInterfaceVTable _control_power_skeleton_vtable =
17541{
17542 _control_power_skeleton_handle_method_call,
17543 _control_power_skeleton_handle_get_property,
17544 _control_power_skeleton_handle_set_property,
17545 {NULL}
17546};
17547
17548static GDBusInterfaceInfo *
17549control_power_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
17550{
17551 return control_power_interface_info ();
17552}
17553
17554static GDBusInterfaceVTable *
17555control_power_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
17556{
17557 return (GDBusInterfaceVTable *) &_control_power_skeleton_vtable;
17558}
17559
17560static GVariant *
17561control_power_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
17562{
17563 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (_skeleton);
17564
17565 GVariantBuilder builder;
17566 guint n;
17567 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
17568 if (_control_power_interface_info.parent_struct.properties == NULL)
17569 goto out;
17570 for (n = 0; _control_power_interface_info.parent_struct.properties[n] != NULL; n++)
17571 {
17572 GDBusPropertyInfo *info = _control_power_interface_info.parent_struct.properties[n];
17573 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
17574 {
17575 GVariant *value;
17576 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);
17577 if (value != NULL)
17578 {
17579 g_variant_take_ref (value);
17580 g_variant_builder_add (&builder, "{sv}", info->name, value);
17581 g_variant_unref (value);
17582 }
17583 }
17584 }
17585out:
17586 return g_variant_builder_end (&builder);
17587}
17588
17589static gboolean _control_power_emit_changed (gpointer user_data);
17590
17591static void
17592control_power_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
17593{
17594 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (_skeleton);
17595 gboolean emit_changed = FALSE;
17596
17597 g_mutex_lock (&skeleton->priv->lock);
17598 if (skeleton->priv->changed_properties_idle_source != NULL)
17599 {
17600 g_source_destroy (skeleton->priv->changed_properties_idle_source);
17601 skeleton->priv->changed_properties_idle_source = NULL;
17602 emit_changed = TRUE;
17603 }
17604 g_mutex_unlock (&skeleton->priv->lock);
17605
17606 if (emit_changed)
17607 _control_power_emit_changed (skeleton);
17608}
17609
17610static void
17611_control_power_on_signal_power_good (
17612 ControlPower *object)
17613{
17614 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
17615
17616 GList *connections, *l;
17617 GVariant *signal_variant;
17618 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
17619
17620 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
17621 for (l = connections; l != NULL; l = l->next)
17622 {
17623 GDBusConnection *connection = l->data;
17624 g_dbus_connection_emit_signal (connection,
17625 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.control.Power", "PowerGood",
17626 signal_variant, NULL);
17627 }
17628 g_variant_unref (signal_variant);
17629 g_list_free_full (connections, g_object_unref);
17630}
17631
17632static void
17633_control_power_on_signal_power_lost (
17634 ControlPower *object)
17635{
17636 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
17637
17638 GList *connections, *l;
17639 GVariant *signal_variant;
17640 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
17641
17642 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
17643 for (l = connections; l != NULL; l = l->next)
17644 {
17645 GDBusConnection *connection = l->data;
17646 g_dbus_connection_emit_signal (connection,
17647 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.control.Power", "PowerLost",
17648 signal_variant, NULL);
17649 }
17650 g_variant_unref (signal_variant);
17651 g_list_free_full (connections, g_object_unref);
17652}
17653
17654static void control_power_skeleton_iface_init (ControlPowerIface *iface);
17655#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
17656G_DEFINE_TYPE_WITH_CODE (ControlPowerSkeleton, control_power_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
17657 G_ADD_PRIVATE (ControlPowerSkeleton)
17658 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_skeleton_iface_init));
17659
17660#else
17661G_DEFINE_TYPE_WITH_CODE (ControlPowerSkeleton, control_power_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
17662 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_skeleton_iface_init));
17663
17664#endif
17665static void
17666control_power_skeleton_finalize (GObject *object)
17667{
17668 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
17669 guint n;
Norman James32e74e22015-09-15 21:28:06 -050017670 for (n = 0; n < 3; n++)
Norman James362a80f2015-09-14 14:04:39 -050017671 g_value_unset (&skeleton->priv->properties[n]);
17672 g_free (skeleton->priv->properties);
17673 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
17674 if (skeleton->priv->changed_properties_idle_source != NULL)
17675 g_source_destroy (skeleton->priv->changed_properties_idle_source);
17676 g_main_context_unref (skeleton->priv->context);
17677 g_mutex_clear (&skeleton->priv->lock);
17678 G_OBJECT_CLASS (control_power_skeleton_parent_class)->finalize (object);
17679}
17680
17681static void
17682control_power_skeleton_get_property (GObject *object,
17683 guint prop_id,
17684 GValue *value,
17685 GParamSpec *pspec G_GNUC_UNUSED)
17686{
17687 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
Norman James32e74e22015-09-15 21:28:06 -050017688 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -050017689 g_mutex_lock (&skeleton->priv->lock);
17690 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
17691 g_mutex_unlock (&skeleton->priv->lock);
17692}
17693
17694static gboolean
17695_control_power_emit_changed (gpointer user_data)
17696{
17697 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data);
17698 GList *l;
17699 GVariantBuilder builder;
17700 GVariantBuilder invalidated_builder;
17701 guint num_changes;
17702
17703 g_mutex_lock (&skeleton->priv->lock);
17704 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
17705 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
17706 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
17707 {
17708 ChangedProperty *cp = l->data;
17709 GVariant *variant;
17710 const GValue *cur_value;
17711
17712 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
17713 if (!_g_value_equal (cur_value, &cp->orig_value))
17714 {
17715 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
17716 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
17717 g_variant_unref (variant);
17718 num_changes++;
17719 }
17720 }
17721 if (num_changes > 0)
17722 {
17723 GList *connections, *ll;
17724 GVariant *signal_variant;
17725 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.control.Power",
17726 &builder, &invalidated_builder));
17727 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
17728 for (ll = connections; ll != NULL; ll = ll->next)
17729 {
17730 GDBusConnection *connection = ll->data;
17731
17732 g_dbus_connection_emit_signal (connection,
17733 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
17734 "org.freedesktop.DBus.Properties",
17735 "PropertiesChanged",
17736 signal_variant,
17737 NULL);
17738 }
17739 g_variant_unref (signal_variant);
17740 g_list_free_full (connections, g_object_unref);
17741 }
17742 else
17743 {
17744 g_variant_builder_clear (&builder);
17745 g_variant_builder_clear (&invalidated_builder);
17746 }
17747 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
17748 skeleton->priv->changed_properties = NULL;
17749 skeleton->priv->changed_properties_idle_source = NULL;
17750 g_mutex_unlock (&skeleton->priv->lock);
17751 return FALSE;
17752}
17753
17754static void
17755_control_power_schedule_emit_changed (ControlPowerSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
17756{
17757 ChangedProperty *cp;
17758 GList *l;
17759 cp = NULL;
17760 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
17761 {
17762 ChangedProperty *i_cp = l->data;
17763 if (i_cp->info == info)
17764 {
17765 cp = i_cp;
17766 break;
17767 }
17768 }
17769 if (cp == NULL)
17770 {
17771 cp = g_new0 (ChangedProperty, 1);
17772 cp->prop_id = prop_id;
17773 cp->info = info;
17774 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
17775 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
17776 g_value_copy (orig_value, &cp->orig_value);
17777 }
17778}
17779
17780static void
17781control_power_skeleton_notify (GObject *object,
17782 GParamSpec *pspec G_GNUC_UNUSED)
17783{
17784 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
17785 g_mutex_lock (&skeleton->priv->lock);
17786 if (skeleton->priv->changed_properties != NULL &&
17787 skeleton->priv->changed_properties_idle_source == NULL)
17788 {
17789 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
17790 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
17791 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _control_power_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
17792 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
17793 g_source_unref (skeleton->priv->changed_properties_idle_source);
17794 }
17795 g_mutex_unlock (&skeleton->priv->lock);
17796}
17797
17798static void
17799control_power_skeleton_set_property (GObject *object,
17800 guint prop_id,
17801 const GValue *value,
17802 GParamSpec *pspec)
17803{
17804 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
Norman James32e74e22015-09-15 21:28:06 -050017805 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -050017806 g_mutex_lock (&skeleton->priv->lock);
17807 g_object_freeze_notify (object);
17808 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
17809 {
17810 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
17811 _control_power_schedule_emit_changed (skeleton, _control_power_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
17812 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
17813 g_object_notify_by_pspec (object, pspec);
17814 }
17815 g_mutex_unlock (&skeleton->priv->lock);
17816 g_object_thaw_notify (object);
17817}
17818
17819static void
17820control_power_skeleton_init (ControlPowerSkeleton *skeleton)
17821{
17822#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
17823 skeleton->priv = control_power_skeleton_get_instance_private (skeleton);
17824#else
17825 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_POWER_SKELETON, ControlPowerSkeletonPrivate);
17826#endif
17827
17828 g_mutex_init (&skeleton->priv->lock);
17829 skeleton->priv->context = g_main_context_ref_thread_default ();
Norman James32e74e22015-09-15 21:28:06 -050017830 skeleton->priv->properties = g_new0 (GValue, 3);
Norman James362a80f2015-09-14 14:04:39 -050017831 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
17832 g_value_init (&skeleton->priv->properties[1], G_TYPE_INT);
Norman James32e74e22015-09-15 21:28:06 -050017833 g_value_init (&skeleton->priv->properties[2], G_TYPE_INT);
Norman James362a80f2015-09-14 14:04:39 -050017834}
17835
17836static gint
17837control_power_skeleton_get_pgood (ControlPower *object)
17838{
17839 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
17840 gint value;
17841 g_mutex_lock (&skeleton->priv->lock);
17842 value = g_value_get_int (&(skeleton->priv->properties[0]));
17843 g_mutex_unlock (&skeleton->priv->lock);
17844 return value;
17845}
17846
17847static gint
17848control_power_skeleton_get_state (ControlPower *object)
17849{
17850 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
17851 gint value;
17852 g_mutex_lock (&skeleton->priv->lock);
17853 value = g_value_get_int (&(skeleton->priv->properties[1]));
17854 g_mutex_unlock (&skeleton->priv->lock);
17855 return value;
17856}
17857
Norman James32e74e22015-09-15 21:28:06 -050017858static gint
17859control_power_skeleton_get_pgood_timeout (ControlPower *object)
17860{
17861 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
17862 gint value;
17863 g_mutex_lock (&skeleton->priv->lock);
17864 value = g_value_get_int (&(skeleton->priv->properties[2]));
17865 g_mutex_unlock (&skeleton->priv->lock);
17866 return value;
17867}
17868
Norman James362a80f2015-09-14 14:04:39 -050017869static void
17870control_power_skeleton_class_init (ControlPowerSkeletonClass *klass)
17871{
17872 GObjectClass *gobject_class;
17873 GDBusInterfaceSkeletonClass *skeleton_class;
17874
17875 gobject_class = G_OBJECT_CLASS (klass);
17876 gobject_class->finalize = control_power_skeleton_finalize;
17877 gobject_class->get_property = control_power_skeleton_get_property;
17878 gobject_class->set_property = control_power_skeleton_set_property;
17879 gobject_class->notify = control_power_skeleton_notify;
17880
17881
17882 control_power_override_properties (gobject_class, 1);
17883
17884 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
17885 skeleton_class->get_info = control_power_skeleton_dbus_interface_get_info;
17886 skeleton_class->get_properties = control_power_skeleton_dbus_interface_get_properties;
17887 skeleton_class->flush = control_power_skeleton_dbus_interface_flush;
17888 skeleton_class->get_vtable = control_power_skeleton_dbus_interface_get_vtable;
17889
17890#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
17891 g_type_class_add_private (klass, sizeof (ControlPowerSkeletonPrivate));
17892#endif
17893}
17894
17895static void
17896control_power_skeleton_iface_init (ControlPowerIface *iface)
17897{
17898 iface->power_good = _control_power_on_signal_power_good;
17899 iface->power_lost = _control_power_on_signal_power_lost;
17900 iface->get_pgood = control_power_skeleton_get_pgood;
17901 iface->get_state = control_power_skeleton_get_state;
Norman James32e74e22015-09-15 21:28:06 -050017902 iface->get_pgood_timeout = control_power_skeleton_get_pgood_timeout;
Norman James362a80f2015-09-14 14:04:39 -050017903}
17904
17905/**
17906 * control_power_skeleton_new:
17907 *
17908 * 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>.
17909 *
17910 * Returns: (transfer full) (type ControlPowerSkeleton): The skeleton object.
17911 */
17912ControlPower *
17913control_power_skeleton_new (void)
17914{
17915 return CONTROL_POWER (g_object_new (TYPE_CONTROL_POWER_SKELETON, NULL));
17916}
17917
17918/* ------------------------------------------------------------------------
Adriana Kobylakfd778822016-06-16 09:08:37 -050017919 * Code for interface org.openbmc.control.Checkstop
17920 * ------------------------------------------------------------------------
17921 */
17922
17923/**
17924 * SECTION:ControlCheckstop
17925 * @title: ControlCheckstop
17926 * @short_description: Generated C code for the org.openbmc.control.Checkstop D-Bus interface
17927 *
17928 * 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.
17929 */
17930
17931/* ---- Introspection data for org.openbmc.control.Checkstop ---- */
17932
17933static const _ExtendedGDBusInterfaceInfo _control_checkstop_interface_info =
17934{
17935 {
17936 -1,
17937 (gchar *) "org.openbmc.control.Checkstop",
17938 NULL,
17939 NULL,
17940 NULL,
17941 NULL
17942 },
17943 "control-checkstop",
17944};
17945
17946
17947/**
17948 * control_checkstop_interface_info:
17949 *
17950 * 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.
17951 *
17952 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
17953 */
17954GDBusInterfaceInfo *
17955control_checkstop_interface_info (void)
17956{
17957 return (GDBusInterfaceInfo *) &_control_checkstop_interface_info.parent_struct;
17958}
17959
17960/**
17961 * control_checkstop_override_properties:
17962 * @klass: The class structure for a #GObject<!-- -->-derived class.
17963 * @property_id_begin: The property id to assign to the first overridden property.
17964 *
17965 * Overrides all #GObject properties in the #ControlCheckstop interface for a concrete class.
17966 * The properties are overridden in the order they are defined.
17967 *
17968 * Returns: The last property id.
17969 */
17970guint
17971control_checkstop_override_properties (GObjectClass *klass, guint property_id_begin)
17972{
17973 return property_id_begin - 1;
17974}
17975
17976
17977
17978/**
17979 * ControlCheckstop:
17980 *
17981 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Checkstop.top_of_page">org.openbmc.control.Checkstop</link>.
17982 */
17983
17984/**
17985 * ControlCheckstopIface:
17986 * @parent_iface: The parent interface.
17987 *
17988 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Checkstop.top_of_page">org.openbmc.control.Checkstop</link>.
17989 */
17990
17991typedef ControlCheckstopIface ControlCheckstopInterface;
17992G_DEFINE_INTERFACE (ControlCheckstop, control_checkstop, G_TYPE_OBJECT);
17993
17994static void
17995control_checkstop_default_init (ControlCheckstopIface *iface)
17996{
17997}
17998
17999/* ------------------------------------------------------------------------ */
18000
18001/**
18002 * ControlCheckstopProxy:
18003 *
18004 * The #ControlCheckstopProxy structure contains only private data and should only be accessed using the provided API.
18005 */
18006
18007/**
18008 * ControlCheckstopProxyClass:
18009 * @parent_class: The parent class.
18010 *
18011 * Class structure for #ControlCheckstopProxy.
18012 */
18013
18014struct _ControlCheckstopProxyPrivate
18015{
18016 GData *qdata;
18017};
18018
18019static void control_checkstop_proxy_iface_init (ControlCheckstopIface *iface);
18020
18021#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
18022G_DEFINE_TYPE_WITH_CODE (ControlCheckstopProxy, control_checkstop_proxy, G_TYPE_DBUS_PROXY,
18023 G_ADD_PRIVATE (ControlCheckstopProxy)
18024 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_CHECKSTOP, control_checkstop_proxy_iface_init));
18025
18026#else
18027G_DEFINE_TYPE_WITH_CODE (ControlCheckstopProxy, control_checkstop_proxy, G_TYPE_DBUS_PROXY,
18028 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_CHECKSTOP, control_checkstop_proxy_iface_init));
18029
18030#endif
18031static void
18032control_checkstop_proxy_finalize (GObject *object)
18033{
18034 ControlCheckstopProxy *proxy = CONTROL_CHECKSTOP_PROXY (object);
18035 g_datalist_clear (&proxy->priv->qdata);
18036 G_OBJECT_CLASS (control_checkstop_proxy_parent_class)->finalize (object);
18037}
18038
18039static void
18040control_checkstop_proxy_get_property (GObject *object,
18041 guint prop_id,
18042 GValue *value,
18043 GParamSpec *pspec G_GNUC_UNUSED)
18044{
18045}
18046
18047static void
18048control_checkstop_proxy_set_property (GObject *object,
18049 guint prop_id,
18050 const GValue *value,
18051 GParamSpec *pspec G_GNUC_UNUSED)
18052{
18053}
18054
18055static void
18056control_checkstop_proxy_g_signal (GDBusProxy *proxy,
18057 const gchar *sender_name G_GNUC_UNUSED,
18058 const gchar *signal_name,
18059 GVariant *parameters)
18060{
18061 _ExtendedGDBusSignalInfo *info;
18062 GVariantIter iter;
18063 GVariant *child;
18064 GValue *paramv;
18065 guint num_params;
18066 guint n;
18067 guint signal_id;
18068 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_checkstop_interface_info.parent_struct, signal_name);
18069 if (info == NULL)
18070 return;
18071 num_params = g_variant_n_children (parameters);
18072 paramv = g_new0 (GValue, num_params + 1);
18073 g_value_init (&paramv[0], TYPE_CONTROL_CHECKSTOP);
18074 g_value_set_object (&paramv[0], proxy);
18075 g_variant_iter_init (&iter, parameters);
18076 n = 1;
18077 while ((child = g_variant_iter_next_value (&iter)) != NULL)
18078 {
18079 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
18080 if (arg_info->use_gvariant)
18081 {
18082 g_value_init (&paramv[n], G_TYPE_VARIANT);
18083 g_value_set_variant (&paramv[n], child);
18084 n++;
18085 }
18086 else
18087 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
18088 g_variant_unref (child);
18089 }
18090 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_CHECKSTOP);
18091 g_signal_emitv (paramv, signal_id, 0, NULL);
18092 for (n = 0; n < num_params + 1; n++)
18093 g_value_unset (&paramv[n]);
18094 g_free (paramv);
18095}
18096
18097static void
18098control_checkstop_proxy_g_properties_changed (GDBusProxy *_proxy,
18099 GVariant *changed_properties,
18100 const gchar *const *invalidated_properties)
18101{
18102 ControlCheckstopProxy *proxy = CONTROL_CHECKSTOP_PROXY (_proxy);
18103 guint n;
18104 const gchar *key;
18105 GVariantIter *iter;
18106 _ExtendedGDBusPropertyInfo *info;
18107 g_variant_get (changed_properties, "a{sv}", &iter);
18108 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
18109 {
18110 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_checkstop_interface_info.parent_struct, key);
18111 g_datalist_remove_data (&proxy->priv->qdata, key);
18112 if (info != NULL)
18113 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
18114 }
18115 g_variant_iter_free (iter);
18116 for (n = 0; invalidated_properties[n] != NULL; n++)
18117 {
18118 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_checkstop_interface_info.parent_struct, invalidated_properties[n]);
18119 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
18120 if (info != NULL)
18121 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
18122 }
18123}
18124
18125static void
18126control_checkstop_proxy_init (ControlCheckstopProxy *proxy)
18127{
18128#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
18129 proxy->priv = control_checkstop_proxy_get_instance_private (proxy);
18130#else
18131 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_CHECKSTOP_PROXY, ControlCheckstopProxyPrivate);
18132#endif
18133
18134 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_checkstop_interface_info ());
18135}
18136
18137static void
18138control_checkstop_proxy_class_init (ControlCheckstopProxyClass *klass)
18139{
18140 GObjectClass *gobject_class;
18141 GDBusProxyClass *proxy_class;
18142
18143 gobject_class = G_OBJECT_CLASS (klass);
18144 gobject_class->finalize = control_checkstop_proxy_finalize;
18145 gobject_class->get_property = control_checkstop_proxy_get_property;
18146 gobject_class->set_property = control_checkstop_proxy_set_property;
18147
18148 proxy_class = G_DBUS_PROXY_CLASS (klass);
18149 proxy_class->g_signal = control_checkstop_proxy_g_signal;
18150 proxy_class->g_properties_changed = control_checkstop_proxy_g_properties_changed;
18151
18152#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
18153 g_type_class_add_private (klass, sizeof (ControlCheckstopProxyPrivate));
18154#endif
18155}
18156
18157static void
18158control_checkstop_proxy_iface_init (ControlCheckstopIface *iface)
18159{
18160}
18161
18162/**
18163 * control_checkstop_proxy_new:
18164 * @connection: A #GDBusConnection.
18165 * @flags: Flags from the #GDBusProxyFlags enumeration.
18166 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
18167 * @object_path: An object path.
18168 * @cancellable: (allow-none): A #GCancellable or %NULL.
18169 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
18170 * @user_data: User data to pass to @callback.
18171 *
18172 * 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.
18173 *
18174 * 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.
18175 * You can then call control_checkstop_proxy_new_finish() to get the result of the operation.
18176 *
18177 * See control_checkstop_proxy_new_sync() for the synchronous, blocking version of this constructor.
18178 */
18179void
18180control_checkstop_proxy_new (
18181 GDBusConnection *connection,
18182 GDBusProxyFlags flags,
18183 const gchar *name,
18184 const gchar *object_path,
18185 GCancellable *cancellable,
18186 GAsyncReadyCallback callback,
18187 gpointer user_data)
18188{
18189 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);
18190}
18191
18192/**
18193 * control_checkstop_proxy_new_finish:
18194 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_checkstop_proxy_new().
18195 * @error: Return location for error or %NULL
18196 *
18197 * Finishes an operation started with control_checkstop_proxy_new().
18198 *
18199 * Returns: (transfer full) (type ControlCheckstopProxy): The constructed proxy object or %NULL if @error is set.
18200 */
18201ControlCheckstop *
18202control_checkstop_proxy_new_finish (
18203 GAsyncResult *res,
18204 GError **error)
18205{
18206 GObject *ret;
18207 GObject *source_object;
18208 source_object = g_async_result_get_source_object (res);
18209 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
18210 g_object_unref (source_object);
18211 if (ret != NULL)
18212 return CONTROL_CHECKSTOP (ret);
18213 else
18214 return NULL;
18215}
18216
18217/**
18218 * control_checkstop_proxy_new_sync:
18219 * @connection: A #GDBusConnection.
18220 * @flags: Flags from the #GDBusProxyFlags enumeration.
18221 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
18222 * @object_path: An object path.
18223 * @cancellable: (allow-none): A #GCancellable or %NULL.
18224 * @error: Return location for error or %NULL
18225 *
18226 * 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.
18227 *
18228 * The calling thread is blocked until a reply is received.
18229 *
18230 * See control_checkstop_proxy_new() for the asynchronous version of this constructor.
18231 *
18232 * Returns: (transfer full) (type ControlCheckstopProxy): The constructed proxy object or %NULL if @error is set.
18233 */
18234ControlCheckstop *
18235control_checkstop_proxy_new_sync (
18236 GDBusConnection *connection,
18237 GDBusProxyFlags flags,
18238 const gchar *name,
18239 const gchar *object_path,
18240 GCancellable *cancellable,
18241 GError **error)
18242{
18243 GInitable *ret;
18244 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);
18245 if (ret != NULL)
18246 return CONTROL_CHECKSTOP (ret);
18247 else
18248 return NULL;
18249}
18250
18251
18252/**
18253 * control_checkstop_proxy_new_for_bus:
18254 * @bus_type: A #GBusType.
18255 * @flags: Flags from the #GDBusProxyFlags enumeration.
18256 * @name: A bus name (well-known or unique).
18257 * @object_path: An object path.
18258 * @cancellable: (allow-none): A #GCancellable or %NULL.
18259 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
18260 * @user_data: User data to pass to @callback.
18261 *
18262 * Like control_checkstop_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
18263 *
18264 * 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.
18265 * You can then call control_checkstop_proxy_new_for_bus_finish() to get the result of the operation.
18266 *
18267 * See control_checkstop_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
18268 */
18269void
18270control_checkstop_proxy_new_for_bus (
18271 GBusType bus_type,
18272 GDBusProxyFlags flags,
18273 const gchar *name,
18274 const gchar *object_path,
18275 GCancellable *cancellable,
18276 GAsyncReadyCallback callback,
18277 gpointer user_data)
18278{
18279 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);
18280}
18281
18282/**
18283 * control_checkstop_proxy_new_for_bus_finish:
18284 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_checkstop_proxy_new_for_bus().
18285 * @error: Return location for error or %NULL
18286 *
18287 * Finishes an operation started with control_checkstop_proxy_new_for_bus().
18288 *
18289 * Returns: (transfer full) (type ControlCheckstopProxy): The constructed proxy object or %NULL if @error is set.
18290 */
18291ControlCheckstop *
18292control_checkstop_proxy_new_for_bus_finish (
18293 GAsyncResult *res,
18294 GError **error)
18295{
18296 GObject *ret;
18297 GObject *source_object;
18298 source_object = g_async_result_get_source_object (res);
18299 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
18300 g_object_unref (source_object);
18301 if (ret != NULL)
18302 return CONTROL_CHECKSTOP (ret);
18303 else
18304 return NULL;
18305}
18306
18307/**
18308 * control_checkstop_proxy_new_for_bus_sync:
18309 * @bus_type: A #GBusType.
18310 * @flags: Flags from the #GDBusProxyFlags enumeration.
18311 * @name: A bus name (well-known or unique).
18312 * @object_path: An object path.
18313 * @cancellable: (allow-none): A #GCancellable or %NULL.
18314 * @error: Return location for error or %NULL
18315 *
18316 * Like control_checkstop_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
18317 *
18318 * The calling thread is blocked until a reply is received.
18319 *
18320 * See control_checkstop_proxy_new_for_bus() for the asynchronous version of this constructor.
18321 *
18322 * Returns: (transfer full) (type ControlCheckstopProxy): The constructed proxy object or %NULL if @error is set.
18323 */
18324ControlCheckstop *
18325control_checkstop_proxy_new_for_bus_sync (
18326 GBusType bus_type,
18327 GDBusProxyFlags flags,
18328 const gchar *name,
18329 const gchar *object_path,
18330 GCancellable *cancellable,
18331 GError **error)
18332{
18333 GInitable *ret;
18334 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);
18335 if (ret != NULL)
18336 return CONTROL_CHECKSTOP (ret);
18337 else
18338 return NULL;
18339}
18340
18341
18342/* ------------------------------------------------------------------------ */
18343
18344/**
18345 * ControlCheckstopSkeleton:
18346 *
18347 * The #ControlCheckstopSkeleton structure contains only private data and should only be accessed using the provided API.
18348 */
18349
18350/**
18351 * ControlCheckstopSkeletonClass:
18352 * @parent_class: The parent class.
18353 *
18354 * Class structure for #ControlCheckstopSkeleton.
18355 */
18356
18357struct _ControlCheckstopSkeletonPrivate
18358{
18359 GValue *properties;
18360 GList *changed_properties;
18361 GSource *changed_properties_idle_source;
18362 GMainContext *context;
18363 GMutex lock;
18364};
18365
18366static void
18367_control_checkstop_skeleton_handle_method_call (
18368 GDBusConnection *connection G_GNUC_UNUSED,
18369 const gchar *sender G_GNUC_UNUSED,
18370 const gchar *object_path G_GNUC_UNUSED,
18371 const gchar *interface_name,
18372 const gchar *method_name,
18373 GVariant *parameters,
18374 GDBusMethodInvocation *invocation,
18375 gpointer user_data)
18376{
18377 ControlCheckstopSkeleton *skeleton = CONTROL_CHECKSTOP_SKELETON (user_data);
18378 _ExtendedGDBusMethodInfo *info;
18379 GVariantIter iter;
18380 GVariant *child;
18381 GValue *paramv;
18382 guint num_params;
18383 guint num_extra;
18384 guint n;
18385 guint signal_id;
18386 GValue return_value = G_VALUE_INIT;
18387 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
18388 g_assert (info != NULL);
18389 num_params = g_variant_n_children (parameters);
18390 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
18391 n = 0;
18392 g_value_init (&paramv[n], TYPE_CONTROL_CHECKSTOP);
18393 g_value_set_object (&paramv[n++], skeleton);
18394 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
18395 g_value_set_object (&paramv[n++], invocation);
18396 if (info->pass_fdlist)
18397 {
18398#ifdef G_OS_UNIX
18399 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
18400 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
18401#else
18402 g_assert_not_reached ();
18403#endif
18404 }
18405 g_variant_iter_init (&iter, parameters);
18406 while ((child = g_variant_iter_next_value (&iter)) != NULL)
18407 {
18408 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
18409 if (arg_info->use_gvariant)
18410 {
18411 g_value_init (&paramv[n], G_TYPE_VARIANT);
18412 g_value_set_variant (&paramv[n], child);
18413 n++;
18414 }
18415 else
18416 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
18417 g_variant_unref (child);
18418 }
18419 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_CHECKSTOP);
18420 g_value_init (&return_value, G_TYPE_BOOLEAN);
18421 g_signal_emitv (paramv, signal_id, 0, &return_value);
18422 if (!g_value_get_boolean (&return_value))
18423 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);
18424 g_value_unset (&return_value);
18425 for (n = 0; n < num_params + num_extra; n++)
18426 g_value_unset (&paramv[n]);
18427 g_free (paramv);
18428}
18429
18430static GVariant *
18431_control_checkstop_skeleton_handle_get_property (
18432 GDBusConnection *connection G_GNUC_UNUSED,
18433 const gchar *sender G_GNUC_UNUSED,
18434 const gchar *object_path G_GNUC_UNUSED,
18435 const gchar *interface_name G_GNUC_UNUSED,
18436 const gchar *property_name,
18437 GError **error,
18438 gpointer user_data)
18439{
18440 ControlCheckstopSkeleton *skeleton = CONTROL_CHECKSTOP_SKELETON (user_data);
18441 GValue value = G_VALUE_INIT;
18442 GParamSpec *pspec;
18443 _ExtendedGDBusPropertyInfo *info;
18444 GVariant *ret;
18445 ret = NULL;
18446 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_checkstop_interface_info.parent_struct, property_name);
18447 g_assert (info != NULL);
18448 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
18449 if (pspec == NULL)
18450 {
18451 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
18452 }
18453 else
18454 {
18455 g_value_init (&value, pspec->value_type);
18456 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
18457 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
18458 g_value_unset (&value);
18459 }
18460 return ret;
18461}
18462
18463static gboolean
18464_control_checkstop_skeleton_handle_set_property (
18465 GDBusConnection *connection G_GNUC_UNUSED,
18466 const gchar *sender G_GNUC_UNUSED,
18467 const gchar *object_path G_GNUC_UNUSED,
18468 const gchar *interface_name G_GNUC_UNUSED,
18469 const gchar *property_name,
18470 GVariant *variant,
18471 GError **error,
18472 gpointer user_data)
18473{
18474 ControlCheckstopSkeleton *skeleton = CONTROL_CHECKSTOP_SKELETON (user_data);
18475 GValue value = G_VALUE_INIT;
18476 GParamSpec *pspec;
18477 _ExtendedGDBusPropertyInfo *info;
18478 gboolean ret;
18479 ret = FALSE;
18480 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_checkstop_interface_info.parent_struct, property_name);
18481 g_assert (info != NULL);
18482 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
18483 if (pspec == NULL)
18484 {
18485 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
18486 }
18487 else
18488 {
18489 if (info->use_gvariant)
18490 g_value_set_variant (&value, variant);
18491 else
18492 g_dbus_gvariant_to_gvalue (variant, &value);
18493 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
18494 g_value_unset (&value);
18495 ret = TRUE;
18496 }
18497 return ret;
18498}
18499
18500static const GDBusInterfaceVTable _control_checkstop_skeleton_vtable =
18501{
18502 _control_checkstop_skeleton_handle_method_call,
18503 _control_checkstop_skeleton_handle_get_property,
18504 _control_checkstop_skeleton_handle_set_property,
18505 {NULL}
18506};
18507
18508static GDBusInterfaceInfo *
18509control_checkstop_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
18510{
18511 return control_checkstop_interface_info ();
18512}
18513
18514static GDBusInterfaceVTable *
18515control_checkstop_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
18516{
18517 return (GDBusInterfaceVTable *) &_control_checkstop_skeleton_vtable;
18518}
18519
18520static GVariant *
18521control_checkstop_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
18522{
18523 ControlCheckstopSkeleton *skeleton = CONTROL_CHECKSTOP_SKELETON (_skeleton);
18524
18525 GVariantBuilder builder;
18526 guint n;
18527 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
18528 if (_control_checkstop_interface_info.parent_struct.properties == NULL)
18529 goto out;
18530 for (n = 0; _control_checkstop_interface_info.parent_struct.properties[n] != NULL; n++)
18531 {
18532 GDBusPropertyInfo *info = _control_checkstop_interface_info.parent_struct.properties[n];
18533 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
18534 {
18535 GVariant *value;
18536 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);
18537 if (value != NULL)
18538 {
18539 g_variant_take_ref (value);
18540 g_variant_builder_add (&builder, "{sv}", info->name, value);
18541 g_variant_unref (value);
18542 }
18543 }
18544 }
18545out:
18546 return g_variant_builder_end (&builder);
18547}
18548
18549static void
18550control_checkstop_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
18551{
18552}
18553
18554static void control_checkstop_skeleton_iface_init (ControlCheckstopIface *iface);
18555#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
18556G_DEFINE_TYPE_WITH_CODE (ControlCheckstopSkeleton, control_checkstop_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
18557 G_ADD_PRIVATE (ControlCheckstopSkeleton)
18558 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_CHECKSTOP, control_checkstop_skeleton_iface_init));
18559
18560#else
18561G_DEFINE_TYPE_WITH_CODE (ControlCheckstopSkeleton, control_checkstop_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
18562 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_CHECKSTOP, control_checkstop_skeleton_iface_init));
18563
18564#endif
18565static void
18566control_checkstop_skeleton_finalize (GObject *object)
18567{
18568 ControlCheckstopSkeleton *skeleton = CONTROL_CHECKSTOP_SKELETON (object);
18569 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
18570 if (skeleton->priv->changed_properties_idle_source != NULL)
18571 g_source_destroy (skeleton->priv->changed_properties_idle_source);
18572 g_main_context_unref (skeleton->priv->context);
18573 g_mutex_clear (&skeleton->priv->lock);
18574 G_OBJECT_CLASS (control_checkstop_skeleton_parent_class)->finalize (object);
18575}
18576
18577static void
18578control_checkstop_skeleton_init (ControlCheckstopSkeleton *skeleton)
18579{
18580#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
18581 skeleton->priv = control_checkstop_skeleton_get_instance_private (skeleton);
18582#else
18583 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_CHECKSTOP_SKELETON, ControlCheckstopSkeletonPrivate);
18584#endif
18585
18586 g_mutex_init (&skeleton->priv->lock);
18587 skeleton->priv->context = g_main_context_ref_thread_default ();
18588}
18589
18590static void
18591control_checkstop_skeleton_class_init (ControlCheckstopSkeletonClass *klass)
18592{
18593 GObjectClass *gobject_class;
18594 GDBusInterfaceSkeletonClass *skeleton_class;
18595
18596 gobject_class = G_OBJECT_CLASS (klass);
18597 gobject_class->finalize = control_checkstop_skeleton_finalize;
18598
18599 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
18600 skeleton_class->get_info = control_checkstop_skeleton_dbus_interface_get_info;
18601 skeleton_class->get_properties = control_checkstop_skeleton_dbus_interface_get_properties;
18602 skeleton_class->flush = control_checkstop_skeleton_dbus_interface_flush;
18603 skeleton_class->get_vtable = control_checkstop_skeleton_dbus_interface_get_vtable;
18604
18605#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
18606 g_type_class_add_private (klass, sizeof (ControlCheckstopSkeletonPrivate));
18607#endif
18608}
18609
18610static void
18611control_checkstop_skeleton_iface_init (ControlCheckstopIface *iface)
18612{
18613}
18614
18615/**
18616 * control_checkstop_skeleton_new:
18617 *
18618 * 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>.
18619 *
18620 * Returns: (transfer full) (type ControlCheckstopSkeleton): The skeleton object.
18621 */
18622ControlCheckstop *
18623control_checkstop_skeleton_new (void)
18624{
18625 return CONTROL_CHECKSTOP (g_object_new (TYPE_CONTROL_CHECKSTOP_SKELETON, NULL));
18626}
18627
18628/* ------------------------------------------------------------------------
Norman James362a80f2015-09-14 14:04:39 -050018629 * Code for interface org.openbmc.Watchdog
18630 * ------------------------------------------------------------------------
18631 */
18632
18633/**
18634 * SECTION:Watchdog
18635 * @title: Watchdog
18636 * @short_description: Generated C code for the org.openbmc.Watchdog D-Bus interface
18637 *
18638 * 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.
18639 */
18640
18641/* ---- Introspection data for org.openbmc.Watchdog ---- */
18642
18643static const _ExtendedGDBusMethodInfo _watchdog_method_info_start =
18644{
18645 {
18646 -1,
18647 (gchar *) "start",
18648 NULL,
18649 NULL,
18650 NULL
18651 },
18652 "handle-start",
18653 FALSE
18654};
18655
18656static const _ExtendedGDBusMethodInfo _watchdog_method_info_poke =
18657{
18658 {
18659 -1,
18660 (gchar *) "poke",
18661 NULL,
18662 NULL,
18663 NULL
18664 },
18665 "handle-poke",
18666 FALSE
18667};
18668
18669static const _ExtendedGDBusMethodInfo _watchdog_method_info_stop =
18670{
18671 {
18672 -1,
18673 (gchar *) "stop",
18674 NULL,
18675 NULL,
18676 NULL
18677 },
18678 "handle-stop",
18679 FALSE
18680};
18681
Adriana Kobylak2cb27752015-10-19 16:23:14 -050018682static const _ExtendedGDBusArgInfo _watchdog_method_info_set_IN_ARG_interval =
18683{
18684 {
18685 -1,
18686 (gchar *) "interval",
18687 (gchar *) "i",
18688 NULL
18689 },
18690 FALSE
18691};
18692
18693static const _ExtendedGDBusArgInfo * const _watchdog_method_info_set_IN_ARG_pointers[] =
18694{
18695 &_watchdog_method_info_set_IN_ARG_interval,
18696 NULL
18697};
18698
18699static const _ExtendedGDBusMethodInfo _watchdog_method_info_set =
18700{
18701 {
18702 -1,
18703 (gchar *) "set",
18704 (GDBusArgInfo **) &_watchdog_method_info_set_IN_ARG_pointers,
18705 NULL,
18706 NULL
18707 },
18708 "handle-set",
18709 FALSE
18710};
18711
Norman James362a80f2015-09-14 14:04:39 -050018712static const _ExtendedGDBusMethodInfo * const _watchdog_method_info_pointers[] =
18713{
18714 &_watchdog_method_info_start,
18715 &_watchdog_method_info_poke,
18716 &_watchdog_method_info_stop,
Adriana Kobylak2cb27752015-10-19 16:23:14 -050018717 &_watchdog_method_info_set,
Norman James362a80f2015-09-14 14:04:39 -050018718 NULL
18719};
18720
18721static const _ExtendedGDBusSignalInfo _watchdog_signal_info_watchdog_error =
18722{
18723 {
18724 -1,
18725 (gchar *) "WatchdogError",
18726 NULL,
18727 NULL
18728 },
18729 "watchdog-error"
18730};
18731
18732static const _ExtendedGDBusSignalInfo * const _watchdog_signal_info_pointers[] =
18733{
18734 &_watchdog_signal_info_watchdog_error,
18735 NULL
18736};
18737
18738static const _ExtendedGDBusPropertyInfo _watchdog_property_info_watchdog =
18739{
18740 {
18741 -1,
18742 (gchar *) "watchdog",
18743 (gchar *) "i",
18744 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
18745 NULL
18746 },
18747 "watchdog",
18748 FALSE
18749};
18750
18751static const _ExtendedGDBusPropertyInfo _watchdog_property_info_poll_interval =
18752{
18753 {
18754 -1,
18755 (gchar *) "poll_interval",
18756 (gchar *) "i",
18757 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
18758 NULL
18759 },
18760 "poll-interval",
18761 FALSE
18762};
18763
18764static const _ExtendedGDBusPropertyInfo * const _watchdog_property_info_pointers[] =
18765{
18766 &_watchdog_property_info_watchdog,
18767 &_watchdog_property_info_poll_interval,
18768 NULL
18769};
18770
18771static const _ExtendedGDBusInterfaceInfo _watchdog_interface_info =
18772{
18773 {
18774 -1,
18775 (gchar *) "org.openbmc.Watchdog",
18776 (GDBusMethodInfo **) &_watchdog_method_info_pointers,
18777 (GDBusSignalInfo **) &_watchdog_signal_info_pointers,
18778 (GDBusPropertyInfo **) &_watchdog_property_info_pointers,
18779 NULL
18780 },
18781 "watchdog",
18782};
18783
18784
18785/**
18786 * watchdog_interface_info:
18787 *
18788 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link> D-Bus interface.
18789 *
18790 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
18791 */
18792GDBusInterfaceInfo *
18793watchdog_interface_info (void)
18794{
18795 return (GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct;
18796}
18797
18798/**
18799 * watchdog_override_properties:
18800 * @klass: The class structure for a #GObject<!-- -->-derived class.
18801 * @property_id_begin: The property id to assign to the first overridden property.
18802 *
18803 * Overrides all #GObject properties in the #Watchdog interface for a concrete class.
18804 * The properties are overridden in the order they are defined.
18805 *
18806 * Returns: The last property id.
18807 */
18808guint
18809watchdog_override_properties (GObjectClass *klass, guint property_id_begin)
18810{
18811 g_object_class_override_property (klass, property_id_begin++, "watchdog");
18812 g_object_class_override_property (klass, property_id_begin++, "poll-interval");
18813 return property_id_begin - 1;
18814}
18815
18816
18817
18818/**
18819 * Watchdog:
18820 *
18821 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link>.
18822 */
18823
18824/**
18825 * WatchdogIface:
18826 * @parent_iface: The parent interface.
18827 * @handle_poke: Handler for the #Watchdog::handle-poke signal.
Adriana Kobylak2cb27752015-10-19 16:23:14 -050018828 * @handle_set: Handler for the #Watchdog::handle-set signal.
Norman James362a80f2015-09-14 14:04:39 -050018829 * @handle_start: Handler for the #Watchdog::handle-start signal.
18830 * @handle_stop: Handler for the #Watchdog::handle-stop signal.
18831 * @get_poll_interval: Getter for the #Watchdog:poll-interval property.
18832 * @get_watchdog: Getter for the #Watchdog:watchdog property.
18833 * @watchdog_error: Handler for the #Watchdog::watchdog-error signal.
18834 *
18835 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link>.
18836 */
18837
18838typedef WatchdogIface WatchdogInterface;
18839G_DEFINE_INTERFACE (Watchdog, watchdog, G_TYPE_OBJECT);
18840
18841static void
18842watchdog_default_init (WatchdogIface *iface)
18843{
18844 /* GObject signals for incoming D-Bus method calls: */
18845 /**
18846 * Watchdog::handle-start:
18847 * @object: A #Watchdog.
18848 * @invocation: A #GDBusMethodInvocation.
18849 *
18850 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Watchdog.start">start()</link> D-Bus method.
18851 *
18852 * 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.
18853 *
18854 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
18855 */
18856 g_signal_new ("handle-start",
18857 G_TYPE_FROM_INTERFACE (iface),
18858 G_SIGNAL_RUN_LAST,
18859 G_STRUCT_OFFSET (WatchdogIface, handle_start),
18860 g_signal_accumulator_true_handled,
18861 NULL,
18862 g_cclosure_marshal_generic,
18863 G_TYPE_BOOLEAN,
18864 1,
18865 G_TYPE_DBUS_METHOD_INVOCATION);
18866
18867 /**
18868 * Watchdog::handle-poke:
18869 * @object: A #Watchdog.
18870 * @invocation: A #GDBusMethodInvocation.
18871 *
18872 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Watchdog.poke">poke()</link> D-Bus method.
18873 *
18874 * 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.
18875 *
18876 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
18877 */
18878 g_signal_new ("handle-poke",
18879 G_TYPE_FROM_INTERFACE (iface),
18880 G_SIGNAL_RUN_LAST,
18881 G_STRUCT_OFFSET (WatchdogIface, handle_poke),
18882 g_signal_accumulator_true_handled,
18883 NULL,
18884 g_cclosure_marshal_generic,
18885 G_TYPE_BOOLEAN,
18886 1,
18887 G_TYPE_DBUS_METHOD_INVOCATION);
18888
18889 /**
18890 * Watchdog::handle-stop:
18891 * @object: A #Watchdog.
18892 * @invocation: A #GDBusMethodInvocation.
18893 *
18894 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Watchdog.stop">stop()</link> D-Bus method.
18895 *
18896 * 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.
18897 *
18898 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
18899 */
18900 g_signal_new ("handle-stop",
18901 G_TYPE_FROM_INTERFACE (iface),
18902 G_SIGNAL_RUN_LAST,
18903 G_STRUCT_OFFSET (WatchdogIface, handle_stop),
18904 g_signal_accumulator_true_handled,
18905 NULL,
18906 g_cclosure_marshal_generic,
18907 G_TYPE_BOOLEAN,
18908 1,
18909 G_TYPE_DBUS_METHOD_INVOCATION);
18910
Adriana Kobylak2cb27752015-10-19 16:23:14 -050018911 /**
18912 * Watchdog::handle-set:
18913 * @object: A #Watchdog.
18914 * @invocation: A #GDBusMethodInvocation.
18915 * @arg_interval: Argument passed by remote caller.
18916 *
18917 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Watchdog.set">set()</link> D-Bus method.
18918 *
18919 * 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.
18920 *
18921 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
18922 */
18923 g_signal_new ("handle-set",
18924 G_TYPE_FROM_INTERFACE (iface),
18925 G_SIGNAL_RUN_LAST,
18926 G_STRUCT_OFFSET (WatchdogIface, handle_set),
18927 g_signal_accumulator_true_handled,
18928 NULL,
18929 g_cclosure_marshal_generic,
18930 G_TYPE_BOOLEAN,
18931 2,
18932 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT);
18933
Norman James362a80f2015-09-14 14:04:39 -050018934 /* GObject signals for received D-Bus signals: */
18935 /**
18936 * Watchdog::watchdog-error:
18937 * @object: A #Watchdog.
18938 *
18939 * 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.
18940 *
18941 * 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.
18942 */
18943 g_signal_new ("watchdog-error",
18944 G_TYPE_FROM_INTERFACE (iface),
18945 G_SIGNAL_RUN_LAST,
18946 G_STRUCT_OFFSET (WatchdogIface, watchdog_error),
18947 NULL,
18948 NULL,
18949 g_cclosure_marshal_generic,
18950 G_TYPE_NONE,
18951 0);
18952
18953 /* GObject properties for D-Bus properties: */
18954 /**
18955 * Watchdog:watchdog:
18956 *
18957 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Watchdog.watchdog">"watchdog"</link>.
18958 *
18959 * 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.
18960 */
18961 g_object_interface_install_property (iface,
18962 g_param_spec_int ("watchdog", "watchdog", "watchdog", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
18963 /**
18964 * Watchdog:poll-interval:
18965 *
18966 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Watchdog.poll_interval">"poll_interval"</link>.
18967 *
18968 * 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.
18969 */
18970 g_object_interface_install_property (iface,
18971 g_param_spec_int ("poll-interval", "poll_interval", "poll_interval", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
18972}
18973
18974/**
18975 * watchdog_get_watchdog: (skip)
18976 * @object: A #Watchdog.
18977 *
18978 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Watchdog.watchdog">"watchdog"</link> D-Bus property.
18979 *
18980 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
18981 *
18982 * Returns: The property value.
18983 */
18984gint
18985watchdog_get_watchdog (Watchdog *object)
18986{
18987 return WATCHDOG_GET_IFACE (object)->get_watchdog (object);
18988}
18989
18990/**
18991 * watchdog_set_watchdog: (skip)
18992 * @object: A #Watchdog.
18993 * @value: The value to set.
18994 *
18995 * Sets the <link linkend="gdbus-property-org-openbmc-Watchdog.watchdog">"watchdog"</link> D-Bus property to @value.
18996 *
18997 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
18998 */
18999void
19000watchdog_set_watchdog (Watchdog *object, gint value)
19001{
19002 g_object_set (G_OBJECT (object), "watchdog", value, NULL);
19003}
19004
19005/**
19006 * watchdog_get_poll_interval: (skip)
19007 * @object: A #Watchdog.
19008 *
19009 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Watchdog.poll_interval">"poll_interval"</link> D-Bus property.
19010 *
19011 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
19012 *
19013 * Returns: The property value.
19014 */
19015gint
19016watchdog_get_poll_interval (Watchdog *object)
19017{
19018 return WATCHDOG_GET_IFACE (object)->get_poll_interval (object);
19019}
19020
19021/**
19022 * watchdog_set_poll_interval: (skip)
19023 * @object: A #Watchdog.
19024 * @value: The value to set.
19025 *
19026 * Sets the <link linkend="gdbus-property-org-openbmc-Watchdog.poll_interval">"poll_interval"</link> D-Bus property to @value.
19027 *
19028 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
19029 */
19030void
19031watchdog_set_poll_interval (Watchdog *object, gint value)
19032{
19033 g_object_set (G_OBJECT (object), "poll-interval", value, NULL);
19034}
19035
19036/**
19037 * watchdog_emit_watchdog_error:
19038 * @object: A #Watchdog.
19039 *
19040 * Emits the <link linkend="gdbus-signal-org-openbmc-Watchdog.WatchdogError">"WatchdogError"</link> D-Bus signal.
19041 */
19042void
19043watchdog_emit_watchdog_error (
19044 Watchdog *object)
19045{
19046 g_signal_emit_by_name (object, "watchdog-error");
19047}
19048
19049/**
19050 * watchdog_call_start:
19051 * @proxy: A #WatchdogProxy.
19052 * @cancellable: (allow-none): A #GCancellable or %NULL.
19053 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
19054 * @user_data: User data to pass to @callback.
19055 *
19056 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.start">start()</link> D-Bus method on @proxy.
19057 * 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.
19058 * You can then call watchdog_call_start_finish() to get the result of the operation.
19059 *
19060 * See watchdog_call_start_sync() for the synchronous, blocking version of this method.
19061 */
19062void
19063watchdog_call_start (
19064 Watchdog *proxy,
19065 GCancellable *cancellable,
19066 GAsyncReadyCallback callback,
19067 gpointer user_data)
19068{
19069 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
19070 "start",
19071 g_variant_new ("()"),
19072 G_DBUS_CALL_FLAGS_NONE,
19073 -1,
19074 cancellable,
19075 callback,
19076 user_data);
19077}
19078
19079/**
19080 * watchdog_call_start_finish:
19081 * @proxy: A #WatchdogProxy.
19082 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_call_start().
19083 * @error: Return location for error or %NULL.
19084 *
19085 * Finishes an operation started with watchdog_call_start().
19086 *
19087 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19088 */
19089gboolean
19090watchdog_call_start_finish (
19091 Watchdog *proxy,
19092 GAsyncResult *res,
19093 GError **error)
19094{
19095 GVariant *_ret;
19096 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
19097 if (_ret == NULL)
19098 goto _out;
19099 g_variant_get (_ret,
19100 "()");
19101 g_variant_unref (_ret);
19102_out:
19103 return _ret != NULL;
19104}
19105
19106/**
19107 * watchdog_call_start_sync:
19108 * @proxy: A #WatchdogProxy.
19109 * @cancellable: (allow-none): A #GCancellable or %NULL.
19110 * @error: Return location for error or %NULL.
19111 *
19112 * 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.
19113 *
19114 * See watchdog_call_start() for the asynchronous version of this method.
19115 *
19116 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19117 */
19118gboolean
19119watchdog_call_start_sync (
19120 Watchdog *proxy,
19121 GCancellable *cancellable,
19122 GError **error)
19123{
19124 GVariant *_ret;
19125 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
19126 "start",
19127 g_variant_new ("()"),
19128 G_DBUS_CALL_FLAGS_NONE,
19129 -1,
19130 cancellable,
19131 error);
19132 if (_ret == NULL)
19133 goto _out;
19134 g_variant_get (_ret,
19135 "()");
19136 g_variant_unref (_ret);
19137_out:
19138 return _ret != NULL;
19139}
19140
19141/**
19142 * watchdog_call_poke:
19143 * @proxy: A #WatchdogProxy.
19144 * @cancellable: (allow-none): A #GCancellable or %NULL.
19145 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
19146 * @user_data: User data to pass to @callback.
19147 *
19148 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.poke">poke()</link> D-Bus method on @proxy.
19149 * 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.
19150 * You can then call watchdog_call_poke_finish() to get the result of the operation.
19151 *
19152 * See watchdog_call_poke_sync() for the synchronous, blocking version of this method.
19153 */
19154void
19155watchdog_call_poke (
19156 Watchdog *proxy,
19157 GCancellable *cancellable,
19158 GAsyncReadyCallback callback,
19159 gpointer user_data)
19160{
19161 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
19162 "poke",
19163 g_variant_new ("()"),
19164 G_DBUS_CALL_FLAGS_NONE,
19165 -1,
19166 cancellable,
19167 callback,
19168 user_data);
19169}
19170
19171/**
19172 * watchdog_call_poke_finish:
19173 * @proxy: A #WatchdogProxy.
19174 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_call_poke().
19175 * @error: Return location for error or %NULL.
19176 *
19177 * Finishes an operation started with watchdog_call_poke().
19178 *
19179 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19180 */
19181gboolean
19182watchdog_call_poke_finish (
19183 Watchdog *proxy,
19184 GAsyncResult *res,
19185 GError **error)
19186{
19187 GVariant *_ret;
19188 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
19189 if (_ret == NULL)
19190 goto _out;
19191 g_variant_get (_ret,
19192 "()");
19193 g_variant_unref (_ret);
19194_out:
19195 return _ret != NULL;
19196}
19197
19198/**
19199 * watchdog_call_poke_sync:
19200 * @proxy: A #WatchdogProxy.
19201 * @cancellable: (allow-none): A #GCancellable or %NULL.
19202 * @error: Return location for error or %NULL.
19203 *
19204 * 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.
19205 *
19206 * See watchdog_call_poke() for the asynchronous version of this method.
19207 *
19208 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19209 */
19210gboolean
19211watchdog_call_poke_sync (
19212 Watchdog *proxy,
19213 GCancellable *cancellable,
19214 GError **error)
19215{
19216 GVariant *_ret;
19217 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
19218 "poke",
19219 g_variant_new ("()"),
19220 G_DBUS_CALL_FLAGS_NONE,
19221 -1,
19222 cancellable,
19223 error);
19224 if (_ret == NULL)
19225 goto _out;
19226 g_variant_get (_ret,
19227 "()");
19228 g_variant_unref (_ret);
19229_out:
19230 return _ret != NULL;
19231}
19232
19233/**
19234 * watchdog_call_stop:
19235 * @proxy: A #WatchdogProxy.
19236 * @cancellable: (allow-none): A #GCancellable or %NULL.
19237 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
19238 * @user_data: User data to pass to @callback.
19239 *
19240 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.stop">stop()</link> D-Bus method on @proxy.
19241 * 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.
19242 * You can then call watchdog_call_stop_finish() to get the result of the operation.
19243 *
19244 * See watchdog_call_stop_sync() for the synchronous, blocking version of this method.
19245 */
19246void
19247watchdog_call_stop (
19248 Watchdog *proxy,
19249 GCancellable *cancellable,
19250 GAsyncReadyCallback callback,
19251 gpointer user_data)
19252{
19253 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
19254 "stop",
19255 g_variant_new ("()"),
19256 G_DBUS_CALL_FLAGS_NONE,
19257 -1,
19258 cancellable,
19259 callback,
19260 user_data);
19261}
19262
19263/**
19264 * watchdog_call_stop_finish:
19265 * @proxy: A #WatchdogProxy.
19266 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_call_stop().
19267 * @error: Return location for error or %NULL.
19268 *
19269 * Finishes an operation started with watchdog_call_stop().
19270 *
19271 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19272 */
19273gboolean
19274watchdog_call_stop_finish (
19275 Watchdog *proxy,
19276 GAsyncResult *res,
19277 GError **error)
19278{
19279 GVariant *_ret;
19280 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
19281 if (_ret == NULL)
19282 goto _out;
19283 g_variant_get (_ret,
19284 "()");
19285 g_variant_unref (_ret);
19286_out:
19287 return _ret != NULL;
19288}
19289
19290/**
19291 * watchdog_call_stop_sync:
19292 * @proxy: A #WatchdogProxy.
19293 * @cancellable: (allow-none): A #GCancellable or %NULL.
19294 * @error: Return location for error or %NULL.
19295 *
19296 * 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.
19297 *
19298 * See watchdog_call_stop() for the asynchronous version of this method.
19299 *
19300 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19301 */
19302gboolean
19303watchdog_call_stop_sync (
19304 Watchdog *proxy,
19305 GCancellable *cancellable,
19306 GError **error)
19307{
19308 GVariant *_ret;
19309 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
19310 "stop",
19311 g_variant_new ("()"),
19312 G_DBUS_CALL_FLAGS_NONE,
19313 -1,
19314 cancellable,
19315 error);
19316 if (_ret == NULL)
19317 goto _out;
19318 g_variant_get (_ret,
19319 "()");
19320 g_variant_unref (_ret);
19321_out:
19322 return _ret != NULL;
19323}
19324
19325/**
Adriana Kobylak2cb27752015-10-19 16:23:14 -050019326 * watchdog_call_set:
19327 * @proxy: A #WatchdogProxy.
19328 * @arg_interval: Argument to pass with the method invocation.
19329 * @cancellable: (allow-none): A #GCancellable or %NULL.
19330 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
19331 * @user_data: User data to pass to @callback.
19332 *
19333 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.set">set()</link> D-Bus method on @proxy.
19334 * 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.
19335 * You can then call watchdog_call_set_finish() to get the result of the operation.
19336 *
19337 * See watchdog_call_set_sync() for the synchronous, blocking version of this method.
19338 */
19339void
19340watchdog_call_set (
19341 Watchdog *proxy,
19342 gint arg_interval,
19343 GCancellable *cancellable,
19344 GAsyncReadyCallback callback,
19345 gpointer user_data)
19346{
19347 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
19348 "set",
19349 g_variant_new ("(i)",
19350 arg_interval),
19351 G_DBUS_CALL_FLAGS_NONE,
19352 -1,
19353 cancellable,
19354 callback,
19355 user_data);
19356}
19357
19358/**
19359 * watchdog_call_set_finish:
19360 * @proxy: A #WatchdogProxy.
19361 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_call_set().
19362 * @error: Return location for error or %NULL.
19363 *
19364 * Finishes an operation started with watchdog_call_set().
19365 *
19366 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19367 */
19368gboolean
19369watchdog_call_set_finish (
19370 Watchdog *proxy,
19371 GAsyncResult *res,
19372 GError **error)
19373{
19374 GVariant *_ret;
19375 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
19376 if (_ret == NULL)
19377 goto _out;
19378 g_variant_get (_ret,
19379 "()");
19380 g_variant_unref (_ret);
19381_out:
19382 return _ret != NULL;
19383}
19384
19385/**
19386 * watchdog_call_set_sync:
19387 * @proxy: A #WatchdogProxy.
19388 * @arg_interval: Argument to pass with the method invocation.
19389 * @cancellable: (allow-none): A #GCancellable or %NULL.
19390 * @error: Return location for error or %NULL.
19391 *
19392 * 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.
19393 *
19394 * See watchdog_call_set() for the asynchronous version of this method.
19395 *
19396 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19397 */
19398gboolean
19399watchdog_call_set_sync (
19400 Watchdog *proxy,
19401 gint arg_interval,
19402 GCancellable *cancellable,
19403 GError **error)
19404{
19405 GVariant *_ret;
19406 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
19407 "set",
19408 g_variant_new ("(i)",
19409 arg_interval),
19410 G_DBUS_CALL_FLAGS_NONE,
19411 -1,
19412 cancellable,
19413 error);
19414 if (_ret == NULL)
19415 goto _out;
19416 g_variant_get (_ret,
19417 "()");
19418 g_variant_unref (_ret);
19419_out:
19420 return _ret != NULL;
19421}
19422
19423/**
Norman James362a80f2015-09-14 14:04:39 -050019424 * watchdog_complete_start:
19425 * @object: A #Watchdog.
19426 * @invocation: (transfer full): A #GDBusMethodInvocation.
19427 *
19428 * 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.
19429 *
19430 * This method will free @invocation, you cannot use it afterwards.
19431 */
19432void
19433watchdog_complete_start (
19434 Watchdog *object,
19435 GDBusMethodInvocation *invocation)
19436{
19437 g_dbus_method_invocation_return_value (invocation,
19438 g_variant_new ("()"));
19439}
19440
19441/**
19442 * watchdog_complete_poke:
19443 * @object: A #Watchdog.
19444 * @invocation: (transfer full): A #GDBusMethodInvocation.
19445 *
19446 * 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.
19447 *
19448 * This method will free @invocation, you cannot use it afterwards.
19449 */
19450void
19451watchdog_complete_poke (
19452 Watchdog *object,
19453 GDBusMethodInvocation *invocation)
19454{
19455 g_dbus_method_invocation_return_value (invocation,
19456 g_variant_new ("()"));
19457}
19458
19459/**
19460 * watchdog_complete_stop:
19461 * @object: A #Watchdog.
19462 * @invocation: (transfer full): A #GDBusMethodInvocation.
19463 *
19464 * 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.
19465 *
19466 * This method will free @invocation, you cannot use it afterwards.
19467 */
19468void
19469watchdog_complete_stop (
19470 Watchdog *object,
19471 GDBusMethodInvocation *invocation)
19472{
19473 g_dbus_method_invocation_return_value (invocation,
19474 g_variant_new ("()"));
19475}
19476
Adriana Kobylak2cb27752015-10-19 16:23:14 -050019477/**
19478 * watchdog_complete_set:
19479 * @object: A #Watchdog.
19480 * @invocation: (transfer full): A #GDBusMethodInvocation.
19481 *
19482 * 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.
19483 *
19484 * This method will free @invocation, you cannot use it afterwards.
19485 */
19486void
19487watchdog_complete_set (
19488 Watchdog *object,
19489 GDBusMethodInvocation *invocation)
19490{
19491 g_dbus_method_invocation_return_value (invocation,
19492 g_variant_new ("()"));
19493}
19494
Norman James362a80f2015-09-14 14:04:39 -050019495/* ------------------------------------------------------------------------ */
19496
19497/**
19498 * WatchdogProxy:
19499 *
19500 * The #WatchdogProxy structure contains only private data and should only be accessed using the provided API.
19501 */
19502
19503/**
19504 * WatchdogProxyClass:
19505 * @parent_class: The parent class.
19506 *
19507 * Class structure for #WatchdogProxy.
19508 */
19509
19510struct _WatchdogProxyPrivate
19511{
19512 GData *qdata;
19513};
19514
19515static void watchdog_proxy_iface_init (WatchdogIface *iface);
19516
19517#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
19518G_DEFINE_TYPE_WITH_CODE (WatchdogProxy, watchdog_proxy, G_TYPE_DBUS_PROXY,
19519 G_ADD_PRIVATE (WatchdogProxy)
19520 G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_proxy_iface_init));
19521
19522#else
19523G_DEFINE_TYPE_WITH_CODE (WatchdogProxy, watchdog_proxy, G_TYPE_DBUS_PROXY,
19524 G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_proxy_iface_init));
19525
19526#endif
19527static void
19528watchdog_proxy_finalize (GObject *object)
19529{
19530 WatchdogProxy *proxy = WATCHDOG_PROXY (object);
19531 g_datalist_clear (&proxy->priv->qdata);
19532 G_OBJECT_CLASS (watchdog_proxy_parent_class)->finalize (object);
19533}
19534
19535static void
19536watchdog_proxy_get_property (GObject *object,
19537 guint prop_id,
19538 GValue *value,
19539 GParamSpec *pspec G_GNUC_UNUSED)
19540{
19541 const _ExtendedGDBusPropertyInfo *info;
19542 GVariant *variant;
19543 g_assert (prop_id != 0 && prop_id - 1 < 2);
19544 info = _watchdog_property_info_pointers[prop_id - 1];
19545 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
19546 if (info->use_gvariant)
19547 {
19548 g_value_set_variant (value, variant);
19549 }
19550 else
19551 {
19552 if (variant != NULL)
19553 g_dbus_gvariant_to_gvalue (variant, value);
19554 }
19555 if (variant != NULL)
19556 g_variant_unref (variant);
19557}
19558
19559static void
19560watchdog_proxy_set_property_cb (GDBusProxy *proxy,
19561 GAsyncResult *res,
19562 gpointer user_data)
19563{
19564 const _ExtendedGDBusPropertyInfo *info = user_data;
19565 GError *error;
19566 GVariant *_ret;
19567 error = NULL;
19568 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
19569 if (!_ret)
19570 {
19571 g_warning ("Error setting property '%s' on interface org.openbmc.Watchdog: %s (%s, %d)",
19572 info->parent_struct.name,
19573 error->message, g_quark_to_string (error->domain), error->code);
19574 g_error_free (error);
19575 }
19576 else
19577 {
19578 g_variant_unref (_ret);
19579 }
19580}
19581
19582static void
19583watchdog_proxy_set_property (GObject *object,
19584 guint prop_id,
19585 const GValue *value,
19586 GParamSpec *pspec G_GNUC_UNUSED)
19587{
19588 const _ExtendedGDBusPropertyInfo *info;
19589 GVariant *variant;
19590 g_assert (prop_id != 0 && prop_id - 1 < 2);
19591 info = _watchdog_property_info_pointers[prop_id - 1];
19592 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
19593 g_dbus_proxy_call (G_DBUS_PROXY (object),
19594 "org.freedesktop.DBus.Properties.Set",
19595 g_variant_new ("(ssv)", "org.openbmc.Watchdog", info->parent_struct.name, variant),
19596 G_DBUS_CALL_FLAGS_NONE,
19597 -1,
19598 NULL, (GAsyncReadyCallback) watchdog_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
19599 g_variant_unref (variant);
19600}
19601
19602static void
19603watchdog_proxy_g_signal (GDBusProxy *proxy,
19604 const gchar *sender_name G_GNUC_UNUSED,
19605 const gchar *signal_name,
19606 GVariant *parameters)
19607{
19608 _ExtendedGDBusSignalInfo *info;
19609 GVariantIter iter;
19610 GVariant *child;
19611 GValue *paramv;
19612 guint num_params;
19613 guint n;
19614 guint signal_id;
19615 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, signal_name);
19616 if (info == NULL)
19617 return;
19618 num_params = g_variant_n_children (parameters);
19619 paramv = g_new0 (GValue, num_params + 1);
19620 g_value_init (&paramv[0], TYPE_WATCHDOG);
19621 g_value_set_object (&paramv[0], proxy);
19622 g_variant_iter_init (&iter, parameters);
19623 n = 1;
19624 while ((child = g_variant_iter_next_value (&iter)) != NULL)
19625 {
19626 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
19627 if (arg_info->use_gvariant)
19628 {
19629 g_value_init (&paramv[n], G_TYPE_VARIANT);
19630 g_value_set_variant (&paramv[n], child);
19631 n++;
19632 }
19633 else
19634 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
19635 g_variant_unref (child);
19636 }
19637 signal_id = g_signal_lookup (info->signal_name, TYPE_WATCHDOG);
19638 g_signal_emitv (paramv, signal_id, 0, NULL);
19639 for (n = 0; n < num_params + 1; n++)
19640 g_value_unset (&paramv[n]);
19641 g_free (paramv);
19642}
19643
19644static void
19645watchdog_proxy_g_properties_changed (GDBusProxy *_proxy,
19646 GVariant *changed_properties,
19647 const gchar *const *invalidated_properties)
19648{
19649 WatchdogProxy *proxy = WATCHDOG_PROXY (_proxy);
19650 guint n;
19651 const gchar *key;
19652 GVariantIter *iter;
19653 _ExtendedGDBusPropertyInfo *info;
19654 g_variant_get (changed_properties, "a{sv}", &iter);
19655 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
19656 {
19657 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, key);
19658 g_datalist_remove_data (&proxy->priv->qdata, key);
19659 if (info != NULL)
19660 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
19661 }
19662 g_variant_iter_free (iter);
19663 for (n = 0; invalidated_properties[n] != NULL; n++)
19664 {
19665 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, invalidated_properties[n]);
19666 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
19667 if (info != NULL)
19668 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
19669 }
19670}
19671
19672static gint
19673watchdog_proxy_get_watchdog (Watchdog *object)
19674{
19675 WatchdogProxy *proxy = WATCHDOG_PROXY (object);
19676 GVariant *variant;
19677 gint value = 0;
19678 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "watchdog");
19679 if (variant != NULL)
19680 {
19681 value = g_variant_get_int32 (variant);
19682 g_variant_unref (variant);
19683 }
19684 return value;
19685}
19686
19687static gint
19688watchdog_proxy_get_poll_interval (Watchdog *object)
19689{
19690 WatchdogProxy *proxy = WATCHDOG_PROXY (object);
19691 GVariant *variant;
19692 gint value = 0;
19693 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "poll_interval");
19694 if (variant != NULL)
19695 {
19696 value = g_variant_get_int32 (variant);
19697 g_variant_unref (variant);
19698 }
19699 return value;
19700}
19701
19702static void
19703watchdog_proxy_init (WatchdogProxy *proxy)
19704{
19705#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
19706 proxy->priv = watchdog_proxy_get_instance_private (proxy);
19707#else
19708 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_WATCHDOG_PROXY, WatchdogProxyPrivate);
19709#endif
19710
19711 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), watchdog_interface_info ());
19712}
19713
19714static void
19715watchdog_proxy_class_init (WatchdogProxyClass *klass)
19716{
19717 GObjectClass *gobject_class;
19718 GDBusProxyClass *proxy_class;
19719
19720 gobject_class = G_OBJECT_CLASS (klass);
19721 gobject_class->finalize = watchdog_proxy_finalize;
19722 gobject_class->get_property = watchdog_proxy_get_property;
19723 gobject_class->set_property = watchdog_proxy_set_property;
19724
19725 proxy_class = G_DBUS_PROXY_CLASS (klass);
19726 proxy_class->g_signal = watchdog_proxy_g_signal;
19727 proxy_class->g_properties_changed = watchdog_proxy_g_properties_changed;
19728
19729 watchdog_override_properties (gobject_class, 1);
19730
19731#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
19732 g_type_class_add_private (klass, sizeof (WatchdogProxyPrivate));
19733#endif
19734}
19735
19736static void
19737watchdog_proxy_iface_init (WatchdogIface *iface)
19738{
19739 iface->get_watchdog = watchdog_proxy_get_watchdog;
19740 iface->get_poll_interval = watchdog_proxy_get_poll_interval;
19741}
19742
19743/**
19744 * watchdog_proxy_new:
19745 * @connection: A #GDBusConnection.
19746 * @flags: Flags from the #GDBusProxyFlags enumeration.
19747 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
19748 * @object_path: An object path.
19749 * @cancellable: (allow-none): A #GCancellable or %NULL.
19750 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
19751 * @user_data: User data to pass to @callback.
19752 *
19753 * 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.
19754 *
19755 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
19756 * You can then call watchdog_proxy_new_finish() to get the result of the operation.
19757 *
19758 * See watchdog_proxy_new_sync() for the synchronous, blocking version of this constructor.
19759 */
19760void
19761watchdog_proxy_new (
19762 GDBusConnection *connection,
19763 GDBusProxyFlags flags,
19764 const gchar *name,
19765 const gchar *object_path,
19766 GCancellable *cancellable,
19767 GAsyncReadyCallback callback,
19768 gpointer user_data)
19769{
19770 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);
19771}
19772
19773/**
19774 * watchdog_proxy_new_finish:
19775 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_proxy_new().
19776 * @error: Return location for error or %NULL
19777 *
19778 * Finishes an operation started with watchdog_proxy_new().
19779 *
19780 * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set.
19781 */
19782Watchdog *
19783watchdog_proxy_new_finish (
19784 GAsyncResult *res,
19785 GError **error)
19786{
19787 GObject *ret;
19788 GObject *source_object;
19789 source_object = g_async_result_get_source_object (res);
19790 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
19791 g_object_unref (source_object);
19792 if (ret != NULL)
19793 return WATCHDOG (ret);
19794 else
19795 return NULL;
19796}
19797
19798/**
19799 * watchdog_proxy_new_sync:
19800 * @connection: A #GDBusConnection.
19801 * @flags: Flags from the #GDBusProxyFlags enumeration.
19802 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
19803 * @object_path: An object path.
19804 * @cancellable: (allow-none): A #GCancellable or %NULL.
19805 * @error: Return location for error or %NULL
19806 *
19807 * 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.
19808 *
19809 * The calling thread is blocked until a reply is received.
19810 *
19811 * See watchdog_proxy_new() for the asynchronous version of this constructor.
19812 *
19813 * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set.
19814 */
19815Watchdog *
19816watchdog_proxy_new_sync (
19817 GDBusConnection *connection,
19818 GDBusProxyFlags flags,
19819 const gchar *name,
19820 const gchar *object_path,
19821 GCancellable *cancellable,
19822 GError **error)
19823{
19824 GInitable *ret;
19825 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);
19826 if (ret != NULL)
19827 return WATCHDOG (ret);
19828 else
19829 return NULL;
19830}
19831
19832
19833/**
19834 * watchdog_proxy_new_for_bus:
19835 * @bus_type: A #GBusType.
19836 * @flags: Flags from the #GDBusProxyFlags enumeration.
19837 * @name: A bus name (well-known or unique).
19838 * @object_path: An object path.
19839 * @cancellable: (allow-none): A #GCancellable or %NULL.
19840 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
19841 * @user_data: User data to pass to @callback.
19842 *
19843 * Like watchdog_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
19844 *
19845 * 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.
19846 * You can then call watchdog_proxy_new_for_bus_finish() to get the result of the operation.
19847 *
19848 * See watchdog_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
19849 */
19850void
19851watchdog_proxy_new_for_bus (
19852 GBusType bus_type,
19853 GDBusProxyFlags flags,
19854 const gchar *name,
19855 const gchar *object_path,
19856 GCancellable *cancellable,
19857 GAsyncReadyCallback callback,
19858 gpointer user_data)
19859{
19860 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);
19861}
19862
19863/**
19864 * watchdog_proxy_new_for_bus_finish:
19865 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_proxy_new_for_bus().
19866 * @error: Return location for error or %NULL
19867 *
19868 * Finishes an operation started with watchdog_proxy_new_for_bus().
19869 *
19870 * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set.
19871 */
19872Watchdog *
19873watchdog_proxy_new_for_bus_finish (
19874 GAsyncResult *res,
19875 GError **error)
19876{
19877 GObject *ret;
19878 GObject *source_object;
19879 source_object = g_async_result_get_source_object (res);
19880 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
19881 g_object_unref (source_object);
19882 if (ret != NULL)
19883 return WATCHDOG (ret);
19884 else
19885 return NULL;
19886}
19887
19888/**
19889 * watchdog_proxy_new_for_bus_sync:
19890 * @bus_type: A #GBusType.
19891 * @flags: Flags from the #GDBusProxyFlags enumeration.
19892 * @name: A bus name (well-known or unique).
19893 * @object_path: An object path.
19894 * @cancellable: (allow-none): A #GCancellable or %NULL.
19895 * @error: Return location for error or %NULL
19896 *
19897 * Like watchdog_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
19898 *
19899 * The calling thread is blocked until a reply is received.
19900 *
19901 * See watchdog_proxy_new_for_bus() for the asynchronous version of this constructor.
19902 *
19903 * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set.
19904 */
19905Watchdog *
19906watchdog_proxy_new_for_bus_sync (
19907 GBusType bus_type,
19908 GDBusProxyFlags flags,
19909 const gchar *name,
19910 const gchar *object_path,
19911 GCancellable *cancellable,
19912 GError **error)
19913{
19914 GInitable *ret;
19915 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);
19916 if (ret != NULL)
19917 return WATCHDOG (ret);
19918 else
19919 return NULL;
19920}
19921
19922
19923/* ------------------------------------------------------------------------ */
19924
19925/**
19926 * WatchdogSkeleton:
19927 *
19928 * The #WatchdogSkeleton structure contains only private data and should only be accessed using the provided API.
19929 */
19930
19931/**
19932 * WatchdogSkeletonClass:
19933 * @parent_class: The parent class.
19934 *
19935 * Class structure for #WatchdogSkeleton.
19936 */
19937
19938struct _WatchdogSkeletonPrivate
19939{
19940 GValue *properties;
19941 GList *changed_properties;
19942 GSource *changed_properties_idle_source;
19943 GMainContext *context;
19944 GMutex lock;
19945};
19946
19947static void
19948_watchdog_skeleton_handle_method_call (
19949 GDBusConnection *connection G_GNUC_UNUSED,
19950 const gchar *sender G_GNUC_UNUSED,
19951 const gchar *object_path G_GNUC_UNUSED,
19952 const gchar *interface_name,
19953 const gchar *method_name,
19954 GVariant *parameters,
19955 GDBusMethodInvocation *invocation,
19956 gpointer user_data)
19957{
19958 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data);
19959 _ExtendedGDBusMethodInfo *info;
19960 GVariantIter iter;
19961 GVariant *child;
19962 GValue *paramv;
19963 guint num_params;
19964 guint num_extra;
19965 guint n;
19966 guint signal_id;
19967 GValue return_value = G_VALUE_INIT;
19968 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
19969 g_assert (info != NULL);
19970 num_params = g_variant_n_children (parameters);
19971 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
19972 n = 0;
19973 g_value_init (&paramv[n], TYPE_WATCHDOG);
19974 g_value_set_object (&paramv[n++], skeleton);
19975 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
19976 g_value_set_object (&paramv[n++], invocation);
19977 if (info->pass_fdlist)
19978 {
19979#ifdef G_OS_UNIX
19980 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
19981 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
19982#else
19983 g_assert_not_reached ();
19984#endif
19985 }
19986 g_variant_iter_init (&iter, parameters);
19987 while ((child = g_variant_iter_next_value (&iter)) != NULL)
19988 {
19989 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
19990 if (arg_info->use_gvariant)
19991 {
19992 g_value_init (&paramv[n], G_TYPE_VARIANT);
19993 g_value_set_variant (&paramv[n], child);
19994 n++;
19995 }
19996 else
19997 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
19998 g_variant_unref (child);
19999 }
20000 signal_id = g_signal_lookup (info->signal_name, TYPE_WATCHDOG);
20001 g_value_init (&return_value, G_TYPE_BOOLEAN);
20002 g_signal_emitv (paramv, signal_id, 0, &return_value);
20003 if (!g_value_get_boolean (&return_value))
20004 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);
20005 g_value_unset (&return_value);
20006 for (n = 0; n < num_params + num_extra; n++)
20007 g_value_unset (&paramv[n]);
20008 g_free (paramv);
20009}
20010
20011static GVariant *
20012_watchdog_skeleton_handle_get_property (
20013 GDBusConnection *connection G_GNUC_UNUSED,
20014 const gchar *sender G_GNUC_UNUSED,
20015 const gchar *object_path G_GNUC_UNUSED,
20016 const gchar *interface_name G_GNUC_UNUSED,
20017 const gchar *property_name,
20018 GError **error,
20019 gpointer user_data)
20020{
20021 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data);
20022 GValue value = G_VALUE_INIT;
20023 GParamSpec *pspec;
20024 _ExtendedGDBusPropertyInfo *info;
20025 GVariant *ret;
20026 ret = NULL;
20027 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, property_name);
20028 g_assert (info != NULL);
20029 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
20030 if (pspec == NULL)
20031 {
20032 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
20033 }
20034 else
20035 {
20036 g_value_init (&value, pspec->value_type);
20037 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
20038 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
20039 g_value_unset (&value);
20040 }
20041 return ret;
20042}
20043
20044static gboolean
20045_watchdog_skeleton_handle_set_property (
20046 GDBusConnection *connection G_GNUC_UNUSED,
20047 const gchar *sender G_GNUC_UNUSED,
20048 const gchar *object_path G_GNUC_UNUSED,
20049 const gchar *interface_name G_GNUC_UNUSED,
20050 const gchar *property_name,
20051 GVariant *variant,
20052 GError **error,
20053 gpointer user_data)
20054{
20055 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data);
20056 GValue value = G_VALUE_INIT;
20057 GParamSpec *pspec;
20058 _ExtendedGDBusPropertyInfo *info;
20059 gboolean ret;
20060 ret = FALSE;
20061 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, property_name);
20062 g_assert (info != NULL);
20063 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
20064 if (pspec == NULL)
20065 {
20066 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
20067 }
20068 else
20069 {
20070 if (info->use_gvariant)
20071 g_value_set_variant (&value, variant);
20072 else
20073 g_dbus_gvariant_to_gvalue (variant, &value);
20074 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
20075 g_value_unset (&value);
20076 ret = TRUE;
20077 }
20078 return ret;
20079}
20080
20081static const GDBusInterfaceVTable _watchdog_skeleton_vtable =
20082{
20083 _watchdog_skeleton_handle_method_call,
20084 _watchdog_skeleton_handle_get_property,
20085 _watchdog_skeleton_handle_set_property,
20086 {NULL}
20087};
20088
20089static GDBusInterfaceInfo *
20090watchdog_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
20091{
20092 return watchdog_interface_info ();
20093}
20094
20095static GDBusInterfaceVTable *
20096watchdog_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
20097{
20098 return (GDBusInterfaceVTable *) &_watchdog_skeleton_vtable;
20099}
20100
20101static GVariant *
20102watchdog_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
20103{
20104 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (_skeleton);
20105
20106 GVariantBuilder builder;
20107 guint n;
20108 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
20109 if (_watchdog_interface_info.parent_struct.properties == NULL)
20110 goto out;
20111 for (n = 0; _watchdog_interface_info.parent_struct.properties[n] != NULL; n++)
20112 {
20113 GDBusPropertyInfo *info = _watchdog_interface_info.parent_struct.properties[n];
20114 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
20115 {
20116 GVariant *value;
20117 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);
20118 if (value != NULL)
20119 {
20120 g_variant_take_ref (value);
20121 g_variant_builder_add (&builder, "{sv}", info->name, value);
20122 g_variant_unref (value);
20123 }
20124 }
20125 }
20126out:
20127 return g_variant_builder_end (&builder);
20128}
20129
20130static gboolean _watchdog_emit_changed (gpointer user_data);
20131
20132static void
20133watchdog_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
20134{
20135 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (_skeleton);
20136 gboolean emit_changed = FALSE;
20137
20138 g_mutex_lock (&skeleton->priv->lock);
20139 if (skeleton->priv->changed_properties_idle_source != NULL)
20140 {
20141 g_source_destroy (skeleton->priv->changed_properties_idle_source);
20142 skeleton->priv->changed_properties_idle_source = NULL;
20143 emit_changed = TRUE;
20144 }
20145 g_mutex_unlock (&skeleton->priv->lock);
20146
20147 if (emit_changed)
20148 _watchdog_emit_changed (skeleton);
20149}
20150
20151static void
20152_watchdog_on_signal_watchdog_error (
20153 Watchdog *object)
20154{
20155 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
20156
20157 GList *connections, *l;
20158 GVariant *signal_variant;
20159 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
20160
20161 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
20162 for (l = connections; l != NULL; l = l->next)
20163 {
20164 GDBusConnection *connection = l->data;
20165 g_dbus_connection_emit_signal (connection,
20166 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Watchdog", "WatchdogError",
20167 signal_variant, NULL);
20168 }
20169 g_variant_unref (signal_variant);
20170 g_list_free_full (connections, g_object_unref);
20171}
20172
20173static void watchdog_skeleton_iface_init (WatchdogIface *iface);
20174#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
20175G_DEFINE_TYPE_WITH_CODE (WatchdogSkeleton, watchdog_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
20176 G_ADD_PRIVATE (WatchdogSkeleton)
20177 G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_skeleton_iface_init));
20178
20179#else
20180G_DEFINE_TYPE_WITH_CODE (WatchdogSkeleton, watchdog_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
20181 G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_skeleton_iface_init));
20182
20183#endif
20184static void
20185watchdog_skeleton_finalize (GObject *object)
20186{
20187 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
20188 guint n;
20189 for (n = 0; n < 2; n++)
20190 g_value_unset (&skeleton->priv->properties[n]);
20191 g_free (skeleton->priv->properties);
20192 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
20193 if (skeleton->priv->changed_properties_idle_source != NULL)
20194 g_source_destroy (skeleton->priv->changed_properties_idle_source);
20195 g_main_context_unref (skeleton->priv->context);
20196 g_mutex_clear (&skeleton->priv->lock);
20197 G_OBJECT_CLASS (watchdog_skeleton_parent_class)->finalize (object);
20198}
20199
20200static void
20201watchdog_skeleton_get_property (GObject *object,
20202 guint prop_id,
20203 GValue *value,
20204 GParamSpec *pspec G_GNUC_UNUSED)
20205{
20206 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
20207 g_assert (prop_id != 0 && prop_id - 1 < 2);
20208 g_mutex_lock (&skeleton->priv->lock);
20209 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
20210 g_mutex_unlock (&skeleton->priv->lock);
20211}
20212
20213static gboolean
20214_watchdog_emit_changed (gpointer user_data)
20215{
20216 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data);
20217 GList *l;
20218 GVariantBuilder builder;
20219 GVariantBuilder invalidated_builder;
20220 guint num_changes;
20221
20222 g_mutex_lock (&skeleton->priv->lock);
20223 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
20224 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
20225 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
20226 {
20227 ChangedProperty *cp = l->data;
20228 GVariant *variant;
20229 const GValue *cur_value;
20230
20231 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
20232 if (!_g_value_equal (cur_value, &cp->orig_value))
20233 {
20234 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
20235 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
20236 g_variant_unref (variant);
20237 num_changes++;
20238 }
20239 }
20240 if (num_changes > 0)
20241 {
20242 GList *connections, *ll;
20243 GVariant *signal_variant;
20244 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Watchdog",
20245 &builder, &invalidated_builder));
20246 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
20247 for (ll = connections; ll != NULL; ll = ll->next)
20248 {
20249 GDBusConnection *connection = ll->data;
20250
20251 g_dbus_connection_emit_signal (connection,
20252 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
20253 "org.freedesktop.DBus.Properties",
20254 "PropertiesChanged",
20255 signal_variant,
20256 NULL);
20257 }
20258 g_variant_unref (signal_variant);
20259 g_list_free_full (connections, g_object_unref);
20260 }
20261 else
20262 {
20263 g_variant_builder_clear (&builder);
20264 g_variant_builder_clear (&invalidated_builder);
20265 }
20266 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
20267 skeleton->priv->changed_properties = NULL;
20268 skeleton->priv->changed_properties_idle_source = NULL;
20269 g_mutex_unlock (&skeleton->priv->lock);
20270 return FALSE;
20271}
20272
20273static void
20274_watchdog_schedule_emit_changed (WatchdogSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
20275{
20276 ChangedProperty *cp;
20277 GList *l;
20278 cp = NULL;
20279 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
20280 {
20281 ChangedProperty *i_cp = l->data;
20282 if (i_cp->info == info)
20283 {
20284 cp = i_cp;
20285 break;
20286 }
20287 }
20288 if (cp == NULL)
20289 {
20290 cp = g_new0 (ChangedProperty, 1);
20291 cp->prop_id = prop_id;
20292 cp->info = info;
20293 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
20294 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
20295 g_value_copy (orig_value, &cp->orig_value);
20296 }
20297}
20298
20299static void
20300watchdog_skeleton_notify (GObject *object,
20301 GParamSpec *pspec G_GNUC_UNUSED)
20302{
20303 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
20304 g_mutex_lock (&skeleton->priv->lock);
20305 if (skeleton->priv->changed_properties != NULL &&
20306 skeleton->priv->changed_properties_idle_source == NULL)
20307 {
20308 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
20309 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
20310 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _watchdog_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
20311 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
20312 g_source_unref (skeleton->priv->changed_properties_idle_source);
20313 }
20314 g_mutex_unlock (&skeleton->priv->lock);
20315}
20316
20317static void
20318watchdog_skeleton_set_property (GObject *object,
20319 guint prop_id,
20320 const GValue *value,
20321 GParamSpec *pspec)
20322{
20323 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
20324 g_assert (prop_id != 0 && prop_id - 1 < 2);
20325 g_mutex_lock (&skeleton->priv->lock);
20326 g_object_freeze_notify (object);
20327 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
20328 {
20329 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
20330 _watchdog_schedule_emit_changed (skeleton, _watchdog_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
20331 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
20332 g_object_notify_by_pspec (object, pspec);
20333 }
20334 g_mutex_unlock (&skeleton->priv->lock);
20335 g_object_thaw_notify (object);
20336}
20337
20338static void
20339watchdog_skeleton_init (WatchdogSkeleton *skeleton)
20340{
20341#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
20342 skeleton->priv = watchdog_skeleton_get_instance_private (skeleton);
20343#else
20344 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_WATCHDOG_SKELETON, WatchdogSkeletonPrivate);
20345#endif
20346
20347 g_mutex_init (&skeleton->priv->lock);
20348 skeleton->priv->context = g_main_context_ref_thread_default ();
20349 skeleton->priv->properties = g_new0 (GValue, 2);
20350 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
20351 g_value_init (&skeleton->priv->properties[1], G_TYPE_INT);
20352}
20353
20354static gint
20355watchdog_skeleton_get_watchdog (Watchdog *object)
20356{
20357 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
20358 gint value;
20359 g_mutex_lock (&skeleton->priv->lock);
20360 value = g_value_get_int (&(skeleton->priv->properties[0]));
20361 g_mutex_unlock (&skeleton->priv->lock);
20362 return value;
20363}
20364
20365static gint
20366watchdog_skeleton_get_poll_interval (Watchdog *object)
20367{
20368 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
20369 gint value;
20370 g_mutex_lock (&skeleton->priv->lock);
20371 value = g_value_get_int (&(skeleton->priv->properties[1]));
20372 g_mutex_unlock (&skeleton->priv->lock);
20373 return value;
20374}
20375
20376static void
20377watchdog_skeleton_class_init (WatchdogSkeletonClass *klass)
20378{
20379 GObjectClass *gobject_class;
20380 GDBusInterfaceSkeletonClass *skeleton_class;
20381
20382 gobject_class = G_OBJECT_CLASS (klass);
20383 gobject_class->finalize = watchdog_skeleton_finalize;
20384 gobject_class->get_property = watchdog_skeleton_get_property;
20385 gobject_class->set_property = watchdog_skeleton_set_property;
20386 gobject_class->notify = watchdog_skeleton_notify;
20387
20388
20389 watchdog_override_properties (gobject_class, 1);
20390
20391 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
20392 skeleton_class->get_info = watchdog_skeleton_dbus_interface_get_info;
20393 skeleton_class->get_properties = watchdog_skeleton_dbus_interface_get_properties;
20394 skeleton_class->flush = watchdog_skeleton_dbus_interface_flush;
20395 skeleton_class->get_vtable = watchdog_skeleton_dbus_interface_get_vtable;
20396
20397#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
20398 g_type_class_add_private (klass, sizeof (WatchdogSkeletonPrivate));
20399#endif
20400}
20401
20402static void
20403watchdog_skeleton_iface_init (WatchdogIface *iface)
20404{
20405 iface->watchdog_error = _watchdog_on_signal_watchdog_error;
20406 iface->get_watchdog = watchdog_skeleton_get_watchdog;
20407 iface->get_poll_interval = watchdog_skeleton_get_poll_interval;
20408}
20409
20410/**
20411 * watchdog_skeleton_new:
20412 *
20413 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link>.
20414 *
20415 * Returns: (transfer full) (type WatchdogSkeleton): The skeleton object.
20416 */
20417Watchdog *
20418watchdog_skeleton_new (void)
20419{
20420 return WATCHDOG (g_object_new (TYPE_WATCHDOG_SKELETON, NULL));
20421}
20422
20423/* ------------------------------------------------------------------------
20424 * Code for interface org.openbmc.EventLog
20425 * ------------------------------------------------------------------------
20426 */
20427
20428/**
20429 * SECTION:EventLog
20430 * @title: EventLog
20431 * @short_description: Generated C code for the org.openbmc.EventLog D-Bus interface
20432 *
20433 * 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.
20434 */
20435
20436/* ---- Introspection data for org.openbmc.EventLog ---- */
20437
Norman James2d1ee892015-09-16 23:13:45 -050020438static const _ExtendedGDBusArgInfo _event_log_method_info_get_event_log_OUT_ARG_log =
20439{
20440 {
20441 -1,
20442 (gchar *) "log",
20443 (gchar *) "a(s)",
20444 NULL
20445 },
20446 FALSE
20447};
20448
20449static const _ExtendedGDBusArgInfo * const _event_log_method_info_get_event_log_OUT_ARG_pointers[] =
20450{
20451 &_event_log_method_info_get_event_log_OUT_ARG_log,
20452 NULL
20453};
20454
20455static const _ExtendedGDBusMethodInfo _event_log_method_info_get_event_log =
20456{
20457 {
20458 -1,
20459 (gchar *) "getEventLog",
20460 NULL,
20461 (GDBusArgInfo **) &_event_log_method_info_get_event_log_OUT_ARG_pointers,
20462 NULL
20463 },
20464 "handle-get-event-log",
20465 FALSE
20466};
20467
20468static const _ExtendedGDBusMethodInfo * const _event_log_method_info_pointers[] =
20469{
20470 &_event_log_method_info_get_event_log,
20471 NULL
20472};
20473
Norman James8abb50c2015-09-16 10:58:16 -050020474static const _ExtendedGDBusArgInfo _event_log_signal_info_event_log_ARG_priority =
Norman James362a80f2015-09-14 14:04:39 -050020475{
20476 {
20477 -1,
Norman James8abb50c2015-09-16 10:58:16 -050020478 (gchar *) "priority",
20479 (gchar *) "i",
Norman James362a80f2015-09-14 14:04:39 -050020480 NULL
20481 },
20482 FALSE
20483};
20484
Norman James362a80f2015-09-14 14:04:39 -050020485static const _ExtendedGDBusArgInfo _event_log_signal_info_event_log_ARG_message =
20486{
20487 {
20488 -1,
20489 (gchar *) "message",
Norman James32e74e22015-09-15 21:28:06 -050020490 (gchar *) "s",
Norman James362a80f2015-09-14 14:04:39 -050020491 NULL
20492 },
20493 FALSE
20494};
20495
Norman James88872672015-09-21 16:51:35 -050020496static const _ExtendedGDBusArgInfo _event_log_signal_info_event_log_ARG_rc =
20497{
20498 {
20499 -1,
20500 (gchar *) "rc",
20501 (gchar *) "i",
20502 NULL
20503 },
20504 FALSE
20505};
20506
Norman James362a80f2015-09-14 14:04:39 -050020507static const _ExtendedGDBusArgInfo * const _event_log_signal_info_event_log_ARG_pointers[] =
20508{
Norman James8abb50c2015-09-16 10:58:16 -050020509 &_event_log_signal_info_event_log_ARG_priority,
Norman James362a80f2015-09-14 14:04:39 -050020510 &_event_log_signal_info_event_log_ARG_message,
Norman James88872672015-09-21 16:51:35 -050020511 &_event_log_signal_info_event_log_ARG_rc,
Norman James362a80f2015-09-14 14:04:39 -050020512 NULL
20513};
20514
20515static const _ExtendedGDBusSignalInfo _event_log_signal_info_event_log =
20516{
20517 {
20518 -1,
20519 (gchar *) "EventLog",
20520 (GDBusArgInfo **) &_event_log_signal_info_event_log_ARG_pointers,
20521 NULL
20522 },
20523 "event-log"
20524};
20525
20526static const _ExtendedGDBusSignalInfo * const _event_log_signal_info_pointers[] =
20527{
20528 &_event_log_signal_info_event_log,
20529 NULL
20530};
20531
Norman James362a80f2015-09-14 14:04:39 -050020532static const _ExtendedGDBusInterfaceInfo _event_log_interface_info =
20533{
20534 {
20535 -1,
20536 (gchar *) "org.openbmc.EventLog",
Norman James2d1ee892015-09-16 23:13:45 -050020537 (GDBusMethodInfo **) &_event_log_method_info_pointers,
Norman James362a80f2015-09-14 14:04:39 -050020538 (GDBusSignalInfo **) &_event_log_signal_info_pointers,
Norman James32e74e22015-09-15 21:28:06 -050020539 NULL,
Norman James362a80f2015-09-14 14:04:39 -050020540 NULL
20541 },
20542 "event-log",
20543};
20544
20545
20546/**
20547 * event_log_interface_info:
20548 *
20549 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link> D-Bus interface.
20550 *
20551 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
20552 */
20553GDBusInterfaceInfo *
20554event_log_interface_info (void)
20555{
20556 return (GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct;
20557}
20558
20559/**
20560 * event_log_override_properties:
20561 * @klass: The class structure for a #GObject<!-- -->-derived class.
20562 * @property_id_begin: The property id to assign to the first overridden property.
20563 *
20564 * Overrides all #GObject properties in the #EventLog interface for a concrete class.
20565 * The properties are overridden in the order they are defined.
20566 *
20567 * Returns: The last property id.
20568 */
20569guint
20570event_log_override_properties (GObjectClass *klass, guint property_id_begin)
20571{
Norman James362a80f2015-09-14 14:04:39 -050020572 return property_id_begin - 1;
20573}
20574
20575
20576
20577/**
20578 * EventLog:
20579 *
20580 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>.
20581 */
20582
20583/**
20584 * EventLogIface:
20585 * @parent_iface: The parent interface.
Norman James2d1ee892015-09-16 23:13:45 -050020586 * @handle_get_event_log: Handler for the #EventLog::handle-get-event-log signal.
Norman James362a80f2015-09-14 14:04:39 -050020587 * @event_log: Handler for the #EventLog::event-log signal.
20588 *
20589 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>.
20590 */
20591
20592typedef EventLogIface EventLogInterface;
20593G_DEFINE_INTERFACE (EventLog, event_log, G_TYPE_OBJECT);
20594
20595static void
20596event_log_default_init (EventLogIface *iface)
20597{
Norman James2d1ee892015-09-16 23:13:45 -050020598 /* GObject signals for incoming D-Bus method calls: */
20599 /**
20600 * EventLog::handle-get-event-log:
20601 * @object: A #EventLog.
20602 * @invocation: A #GDBusMethodInvocation.
20603 *
20604 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-EventLog.getEventLog">getEventLog()</link> D-Bus method.
20605 *
20606 * 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.
20607 *
20608 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
20609 */
20610 g_signal_new ("handle-get-event-log",
20611 G_TYPE_FROM_INTERFACE (iface),
20612 G_SIGNAL_RUN_LAST,
20613 G_STRUCT_OFFSET (EventLogIface, handle_get_event_log),
20614 g_signal_accumulator_true_handled,
20615 NULL,
20616 g_cclosure_marshal_generic,
20617 G_TYPE_BOOLEAN,
20618 1,
20619 G_TYPE_DBUS_METHOD_INVOCATION);
20620
Norman James362a80f2015-09-14 14:04:39 -050020621 /* GObject signals for received D-Bus signals: */
20622 /**
20623 * EventLog::event-log:
20624 * @object: A #EventLog.
Norman James8abb50c2015-09-16 10:58:16 -050020625 * @arg_priority: Argument.
Norman James362a80f2015-09-14 14:04:39 -050020626 * @arg_message: Argument.
Norman James88872672015-09-21 16:51:35 -050020627 * @arg_rc: Argument.
Norman James362a80f2015-09-14 14:04:39 -050020628 *
20629 * 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.
20630 *
20631 * 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.
20632 */
20633 g_signal_new ("event-log",
20634 G_TYPE_FROM_INTERFACE (iface),
20635 G_SIGNAL_RUN_LAST,
20636 G_STRUCT_OFFSET (EventLogIface, event_log),
20637 NULL,
20638 NULL,
20639 g_cclosure_marshal_generic,
20640 G_TYPE_NONE,
Norman James88872672015-09-21 16:51:35 -050020641 3, G_TYPE_INT, G_TYPE_STRING, G_TYPE_INT);
Norman James362a80f2015-09-14 14:04:39 -050020642
Norman James362a80f2015-09-14 14:04:39 -050020643}
20644
20645/**
20646 * event_log_emit_event_log:
20647 * @object: A #EventLog.
Norman James8abb50c2015-09-16 10:58:16 -050020648 * @arg_priority: Argument to pass with the signal.
Norman James362a80f2015-09-14 14:04:39 -050020649 * @arg_message: Argument to pass with the signal.
Norman James88872672015-09-21 16:51:35 -050020650 * @arg_rc: Argument to pass with the signal.
Norman James362a80f2015-09-14 14:04:39 -050020651 *
20652 * Emits the <link linkend="gdbus-signal-org-openbmc-EventLog.EventLog">"EventLog"</link> D-Bus signal.
20653 */
20654void
20655event_log_emit_event_log (
20656 EventLog *object,
Norman James8abb50c2015-09-16 10:58:16 -050020657 gint arg_priority,
Norman James88872672015-09-21 16:51:35 -050020658 const gchar *arg_message,
20659 gint arg_rc)
Norman James362a80f2015-09-14 14:04:39 -050020660{
Norman James88872672015-09-21 16:51:35 -050020661 g_signal_emit_by_name (object, "event-log", arg_priority, arg_message, arg_rc);
Norman James362a80f2015-09-14 14:04:39 -050020662}
20663
Norman James2d1ee892015-09-16 23:13:45 -050020664/**
20665 * event_log_call_get_event_log:
20666 * @proxy: A #EventLogProxy.
20667 * @cancellable: (allow-none): A #GCancellable or %NULL.
20668 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
20669 * @user_data: User data to pass to @callback.
20670 *
20671 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-EventLog.getEventLog">getEventLog()</link> D-Bus method on @proxy.
20672 * 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.
20673 * You can then call event_log_call_get_event_log_finish() to get the result of the operation.
20674 *
20675 * See event_log_call_get_event_log_sync() for the synchronous, blocking version of this method.
20676 */
20677void
20678event_log_call_get_event_log (
20679 EventLog *proxy,
20680 GCancellable *cancellable,
20681 GAsyncReadyCallback callback,
20682 gpointer user_data)
20683{
20684 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
20685 "getEventLog",
20686 g_variant_new ("()"),
20687 G_DBUS_CALL_FLAGS_NONE,
20688 -1,
20689 cancellable,
20690 callback,
20691 user_data);
20692}
20693
20694/**
20695 * event_log_call_get_event_log_finish:
20696 * @proxy: A #EventLogProxy.
20697 * @out_log: (out): Return location for return parameter or %NULL to ignore.
20698 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to event_log_call_get_event_log().
20699 * @error: Return location for error or %NULL.
20700 *
20701 * Finishes an operation started with event_log_call_get_event_log().
20702 *
20703 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
20704 */
20705gboolean
20706event_log_call_get_event_log_finish (
20707 EventLog *proxy,
20708 GVariant **out_log,
20709 GAsyncResult *res,
20710 GError **error)
20711{
20712 GVariant *_ret;
20713 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
20714 if (_ret == NULL)
20715 goto _out;
20716 g_variant_get (_ret,
20717 "(@a(s))",
20718 out_log);
20719 g_variant_unref (_ret);
20720_out:
20721 return _ret != NULL;
20722}
20723
20724/**
20725 * event_log_call_get_event_log_sync:
20726 * @proxy: A #EventLogProxy.
20727 * @out_log: (out): Return location for return parameter or %NULL to ignore.
20728 * @cancellable: (allow-none): A #GCancellable or %NULL.
20729 * @error: Return location for error or %NULL.
20730 *
20731 * 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.
20732 *
20733 * See event_log_call_get_event_log() for the asynchronous version of this method.
20734 *
20735 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
20736 */
20737gboolean
20738event_log_call_get_event_log_sync (
20739 EventLog *proxy,
20740 GVariant **out_log,
20741 GCancellable *cancellable,
20742 GError **error)
20743{
20744 GVariant *_ret;
20745 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
20746 "getEventLog",
20747 g_variant_new ("()"),
20748 G_DBUS_CALL_FLAGS_NONE,
20749 -1,
20750 cancellable,
20751 error);
20752 if (_ret == NULL)
20753 goto _out;
20754 g_variant_get (_ret,
20755 "(@a(s))",
20756 out_log);
20757 g_variant_unref (_ret);
20758_out:
20759 return _ret != NULL;
20760}
20761
20762/**
20763 * event_log_complete_get_event_log:
20764 * @object: A #EventLog.
20765 * @invocation: (transfer full): A #GDBusMethodInvocation.
20766 * @log: Parameter to return.
20767 *
20768 * 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.
20769 *
20770 * This method will free @invocation, you cannot use it afterwards.
20771 */
20772void
20773event_log_complete_get_event_log (
20774 EventLog *object,
20775 GDBusMethodInvocation *invocation,
20776 GVariant *log)
20777{
20778 g_dbus_method_invocation_return_value (invocation,
20779 g_variant_new ("(@a(s))",
20780 log));
20781}
20782
Norman James362a80f2015-09-14 14:04:39 -050020783/* ------------------------------------------------------------------------ */
20784
20785/**
20786 * EventLogProxy:
20787 *
20788 * The #EventLogProxy structure contains only private data and should only be accessed using the provided API.
20789 */
20790
20791/**
20792 * EventLogProxyClass:
20793 * @parent_class: The parent class.
20794 *
20795 * Class structure for #EventLogProxy.
20796 */
20797
20798struct _EventLogProxyPrivate
20799{
20800 GData *qdata;
20801};
20802
20803static void event_log_proxy_iface_init (EventLogIface *iface);
20804
20805#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
20806G_DEFINE_TYPE_WITH_CODE (EventLogProxy, event_log_proxy, G_TYPE_DBUS_PROXY,
20807 G_ADD_PRIVATE (EventLogProxy)
20808 G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_proxy_iface_init));
20809
20810#else
20811G_DEFINE_TYPE_WITH_CODE (EventLogProxy, event_log_proxy, G_TYPE_DBUS_PROXY,
20812 G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_proxy_iface_init));
20813
20814#endif
20815static void
20816event_log_proxy_finalize (GObject *object)
20817{
20818 EventLogProxy *proxy = EVENT_LOG_PROXY (object);
20819 g_datalist_clear (&proxy->priv->qdata);
20820 G_OBJECT_CLASS (event_log_proxy_parent_class)->finalize (object);
20821}
20822
20823static void
20824event_log_proxy_get_property (GObject *object,
20825 guint prop_id,
20826 GValue *value,
20827 GParamSpec *pspec G_GNUC_UNUSED)
20828{
Norman James362a80f2015-09-14 14:04:39 -050020829}
20830
20831static void
20832event_log_proxy_set_property (GObject *object,
20833 guint prop_id,
20834 const GValue *value,
20835 GParamSpec *pspec G_GNUC_UNUSED)
20836{
Norman James362a80f2015-09-14 14:04:39 -050020837}
20838
20839static void
20840event_log_proxy_g_signal (GDBusProxy *proxy,
20841 const gchar *sender_name G_GNUC_UNUSED,
20842 const gchar *signal_name,
20843 GVariant *parameters)
20844{
20845 _ExtendedGDBusSignalInfo *info;
20846 GVariantIter iter;
20847 GVariant *child;
20848 GValue *paramv;
20849 guint num_params;
20850 guint n;
20851 guint signal_id;
20852 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, signal_name);
20853 if (info == NULL)
20854 return;
20855 num_params = g_variant_n_children (parameters);
20856 paramv = g_new0 (GValue, num_params + 1);
20857 g_value_init (&paramv[0], TYPE_EVENT_LOG);
20858 g_value_set_object (&paramv[0], proxy);
20859 g_variant_iter_init (&iter, parameters);
20860 n = 1;
20861 while ((child = g_variant_iter_next_value (&iter)) != NULL)
20862 {
20863 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
20864 if (arg_info->use_gvariant)
20865 {
20866 g_value_init (&paramv[n], G_TYPE_VARIANT);
20867 g_value_set_variant (&paramv[n], child);
20868 n++;
20869 }
20870 else
20871 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
20872 g_variant_unref (child);
20873 }
20874 signal_id = g_signal_lookup (info->signal_name, TYPE_EVENT_LOG);
20875 g_signal_emitv (paramv, signal_id, 0, NULL);
20876 for (n = 0; n < num_params + 1; n++)
20877 g_value_unset (&paramv[n]);
20878 g_free (paramv);
20879}
20880
20881static void
20882event_log_proxy_g_properties_changed (GDBusProxy *_proxy,
20883 GVariant *changed_properties,
20884 const gchar *const *invalidated_properties)
20885{
20886 EventLogProxy *proxy = EVENT_LOG_PROXY (_proxy);
20887 guint n;
20888 const gchar *key;
20889 GVariantIter *iter;
20890 _ExtendedGDBusPropertyInfo *info;
20891 g_variant_get (changed_properties, "a{sv}", &iter);
20892 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
20893 {
20894 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, key);
20895 g_datalist_remove_data (&proxy->priv->qdata, key);
20896 if (info != NULL)
20897 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
20898 }
20899 g_variant_iter_free (iter);
20900 for (n = 0; invalidated_properties[n] != NULL; n++)
20901 {
20902 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, invalidated_properties[n]);
20903 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
20904 if (info != NULL)
20905 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
20906 }
20907}
20908
Norman James362a80f2015-09-14 14:04:39 -050020909static void
20910event_log_proxy_init (EventLogProxy *proxy)
20911{
20912#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
20913 proxy->priv = event_log_proxy_get_instance_private (proxy);
20914#else
20915 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_EVENT_LOG_PROXY, EventLogProxyPrivate);
20916#endif
20917
20918 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), event_log_interface_info ());
20919}
20920
20921static void
20922event_log_proxy_class_init (EventLogProxyClass *klass)
20923{
20924 GObjectClass *gobject_class;
20925 GDBusProxyClass *proxy_class;
20926
20927 gobject_class = G_OBJECT_CLASS (klass);
20928 gobject_class->finalize = event_log_proxy_finalize;
20929 gobject_class->get_property = event_log_proxy_get_property;
20930 gobject_class->set_property = event_log_proxy_set_property;
20931
20932 proxy_class = G_DBUS_PROXY_CLASS (klass);
20933 proxy_class->g_signal = event_log_proxy_g_signal;
20934 proxy_class->g_properties_changed = event_log_proxy_g_properties_changed;
20935
Norman James362a80f2015-09-14 14:04:39 -050020936#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
20937 g_type_class_add_private (klass, sizeof (EventLogProxyPrivate));
20938#endif
20939}
20940
20941static void
20942event_log_proxy_iface_init (EventLogIface *iface)
20943{
Norman James362a80f2015-09-14 14:04:39 -050020944}
20945
20946/**
20947 * event_log_proxy_new:
20948 * @connection: A #GDBusConnection.
20949 * @flags: Flags from the #GDBusProxyFlags enumeration.
20950 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
20951 * @object_path: An object path.
20952 * @cancellable: (allow-none): A #GCancellable or %NULL.
20953 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
20954 * @user_data: User data to pass to @callback.
20955 *
20956 * 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.
20957 *
20958 * 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.
20959 * You can then call event_log_proxy_new_finish() to get the result of the operation.
20960 *
20961 * See event_log_proxy_new_sync() for the synchronous, blocking version of this constructor.
20962 */
20963void
20964event_log_proxy_new (
20965 GDBusConnection *connection,
20966 GDBusProxyFlags flags,
20967 const gchar *name,
20968 const gchar *object_path,
20969 GCancellable *cancellable,
20970 GAsyncReadyCallback callback,
20971 gpointer user_data)
20972{
20973 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);
20974}
20975
20976/**
20977 * event_log_proxy_new_finish:
20978 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to event_log_proxy_new().
20979 * @error: Return location for error or %NULL
20980 *
20981 * Finishes an operation started with event_log_proxy_new().
20982 *
20983 * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set.
20984 */
20985EventLog *
20986event_log_proxy_new_finish (
20987 GAsyncResult *res,
20988 GError **error)
20989{
20990 GObject *ret;
20991 GObject *source_object;
20992 source_object = g_async_result_get_source_object (res);
20993 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
20994 g_object_unref (source_object);
20995 if (ret != NULL)
20996 return EVENT_LOG (ret);
20997 else
20998 return NULL;
20999}
21000
21001/**
21002 * event_log_proxy_new_sync:
21003 * @connection: A #GDBusConnection.
21004 * @flags: Flags from the #GDBusProxyFlags enumeration.
21005 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
21006 * @object_path: An object path.
21007 * @cancellable: (allow-none): A #GCancellable or %NULL.
21008 * @error: Return location for error or %NULL
21009 *
21010 * 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.
21011 *
21012 * The calling thread is blocked until a reply is received.
21013 *
21014 * See event_log_proxy_new() for the asynchronous version of this constructor.
21015 *
21016 * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set.
21017 */
21018EventLog *
21019event_log_proxy_new_sync (
21020 GDBusConnection *connection,
21021 GDBusProxyFlags flags,
21022 const gchar *name,
21023 const gchar *object_path,
21024 GCancellable *cancellable,
21025 GError **error)
21026{
21027 GInitable *ret;
21028 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);
21029 if (ret != NULL)
21030 return EVENT_LOG (ret);
21031 else
21032 return NULL;
21033}
21034
21035
21036/**
21037 * event_log_proxy_new_for_bus:
21038 * @bus_type: A #GBusType.
21039 * @flags: Flags from the #GDBusProxyFlags enumeration.
21040 * @name: A bus name (well-known or unique).
21041 * @object_path: An object path.
21042 * @cancellable: (allow-none): A #GCancellable or %NULL.
21043 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
21044 * @user_data: User data to pass to @callback.
21045 *
21046 * Like event_log_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
21047 *
21048 * 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.
21049 * You can then call event_log_proxy_new_for_bus_finish() to get the result of the operation.
21050 *
21051 * See event_log_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
21052 */
21053void
21054event_log_proxy_new_for_bus (
21055 GBusType bus_type,
21056 GDBusProxyFlags flags,
21057 const gchar *name,
21058 const gchar *object_path,
21059 GCancellable *cancellable,
21060 GAsyncReadyCallback callback,
21061 gpointer user_data)
21062{
21063 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);
21064}
21065
21066/**
21067 * event_log_proxy_new_for_bus_finish:
21068 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to event_log_proxy_new_for_bus().
21069 * @error: Return location for error or %NULL
21070 *
21071 * Finishes an operation started with event_log_proxy_new_for_bus().
21072 *
21073 * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set.
21074 */
21075EventLog *
21076event_log_proxy_new_for_bus_finish (
21077 GAsyncResult *res,
21078 GError **error)
21079{
21080 GObject *ret;
21081 GObject *source_object;
21082 source_object = g_async_result_get_source_object (res);
21083 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
21084 g_object_unref (source_object);
21085 if (ret != NULL)
21086 return EVENT_LOG (ret);
21087 else
21088 return NULL;
21089}
21090
21091/**
21092 * event_log_proxy_new_for_bus_sync:
21093 * @bus_type: A #GBusType.
21094 * @flags: Flags from the #GDBusProxyFlags enumeration.
21095 * @name: A bus name (well-known or unique).
21096 * @object_path: An object path.
21097 * @cancellable: (allow-none): A #GCancellable or %NULL.
21098 * @error: Return location for error or %NULL
21099 *
21100 * Like event_log_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
21101 *
21102 * The calling thread is blocked until a reply is received.
21103 *
21104 * See event_log_proxy_new_for_bus() for the asynchronous version of this constructor.
21105 *
21106 * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set.
21107 */
21108EventLog *
21109event_log_proxy_new_for_bus_sync (
21110 GBusType bus_type,
21111 GDBusProxyFlags flags,
21112 const gchar *name,
21113 const gchar *object_path,
21114 GCancellable *cancellable,
21115 GError **error)
21116{
21117 GInitable *ret;
21118 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);
21119 if (ret != NULL)
21120 return EVENT_LOG (ret);
21121 else
21122 return NULL;
21123}
21124
21125
21126/* ------------------------------------------------------------------------ */
21127
21128/**
21129 * EventLogSkeleton:
21130 *
21131 * The #EventLogSkeleton structure contains only private data and should only be accessed using the provided API.
21132 */
21133
21134/**
21135 * EventLogSkeletonClass:
21136 * @parent_class: The parent class.
21137 *
21138 * Class structure for #EventLogSkeleton.
21139 */
21140
21141struct _EventLogSkeletonPrivate
21142{
21143 GValue *properties;
21144 GList *changed_properties;
21145 GSource *changed_properties_idle_source;
21146 GMainContext *context;
21147 GMutex lock;
21148};
21149
21150static void
21151_event_log_skeleton_handle_method_call (
21152 GDBusConnection *connection G_GNUC_UNUSED,
21153 const gchar *sender G_GNUC_UNUSED,
21154 const gchar *object_path G_GNUC_UNUSED,
21155 const gchar *interface_name,
21156 const gchar *method_name,
21157 GVariant *parameters,
21158 GDBusMethodInvocation *invocation,
21159 gpointer user_data)
21160{
21161 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (user_data);
21162 _ExtendedGDBusMethodInfo *info;
21163 GVariantIter iter;
21164 GVariant *child;
21165 GValue *paramv;
21166 guint num_params;
21167 guint num_extra;
21168 guint n;
21169 guint signal_id;
21170 GValue return_value = G_VALUE_INIT;
21171 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
21172 g_assert (info != NULL);
21173 num_params = g_variant_n_children (parameters);
21174 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
21175 n = 0;
21176 g_value_init (&paramv[n], TYPE_EVENT_LOG);
21177 g_value_set_object (&paramv[n++], skeleton);
21178 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
21179 g_value_set_object (&paramv[n++], invocation);
21180 if (info->pass_fdlist)
21181 {
21182#ifdef G_OS_UNIX
21183 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
21184 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
21185#else
21186 g_assert_not_reached ();
21187#endif
21188 }
21189 g_variant_iter_init (&iter, parameters);
21190 while ((child = g_variant_iter_next_value (&iter)) != NULL)
21191 {
21192 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
21193 if (arg_info->use_gvariant)
21194 {
21195 g_value_init (&paramv[n], G_TYPE_VARIANT);
21196 g_value_set_variant (&paramv[n], child);
21197 n++;
21198 }
21199 else
21200 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
21201 g_variant_unref (child);
21202 }
21203 signal_id = g_signal_lookup (info->signal_name, TYPE_EVENT_LOG);
21204 g_value_init (&return_value, G_TYPE_BOOLEAN);
21205 g_signal_emitv (paramv, signal_id, 0, &return_value);
21206 if (!g_value_get_boolean (&return_value))
21207 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);
21208 g_value_unset (&return_value);
21209 for (n = 0; n < num_params + num_extra; n++)
21210 g_value_unset (&paramv[n]);
21211 g_free (paramv);
21212}
21213
21214static GVariant *
21215_event_log_skeleton_handle_get_property (
21216 GDBusConnection *connection G_GNUC_UNUSED,
21217 const gchar *sender G_GNUC_UNUSED,
21218 const gchar *object_path G_GNUC_UNUSED,
21219 const gchar *interface_name G_GNUC_UNUSED,
21220 const gchar *property_name,
21221 GError **error,
21222 gpointer user_data)
21223{
21224 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (user_data);
21225 GValue value = G_VALUE_INIT;
21226 GParamSpec *pspec;
21227 _ExtendedGDBusPropertyInfo *info;
21228 GVariant *ret;
21229 ret = NULL;
21230 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, property_name);
21231 g_assert (info != NULL);
21232 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
21233 if (pspec == NULL)
21234 {
21235 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
21236 }
21237 else
21238 {
21239 g_value_init (&value, pspec->value_type);
21240 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
21241 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
21242 g_value_unset (&value);
21243 }
21244 return ret;
21245}
21246
21247static gboolean
21248_event_log_skeleton_handle_set_property (
21249 GDBusConnection *connection G_GNUC_UNUSED,
21250 const gchar *sender G_GNUC_UNUSED,
21251 const gchar *object_path G_GNUC_UNUSED,
21252 const gchar *interface_name G_GNUC_UNUSED,
21253 const gchar *property_name,
21254 GVariant *variant,
21255 GError **error,
21256 gpointer user_data)
21257{
21258 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (user_data);
21259 GValue value = G_VALUE_INIT;
21260 GParamSpec *pspec;
21261 _ExtendedGDBusPropertyInfo *info;
21262 gboolean ret;
21263 ret = FALSE;
21264 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, property_name);
21265 g_assert (info != NULL);
21266 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
21267 if (pspec == NULL)
21268 {
21269 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
21270 }
21271 else
21272 {
21273 if (info->use_gvariant)
21274 g_value_set_variant (&value, variant);
21275 else
21276 g_dbus_gvariant_to_gvalue (variant, &value);
21277 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
21278 g_value_unset (&value);
21279 ret = TRUE;
21280 }
21281 return ret;
21282}
21283
21284static const GDBusInterfaceVTable _event_log_skeleton_vtable =
21285{
21286 _event_log_skeleton_handle_method_call,
21287 _event_log_skeleton_handle_get_property,
21288 _event_log_skeleton_handle_set_property,
21289 {NULL}
21290};
21291
21292static GDBusInterfaceInfo *
21293event_log_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
21294{
21295 return event_log_interface_info ();
21296}
21297
21298static GDBusInterfaceVTable *
21299event_log_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
21300{
21301 return (GDBusInterfaceVTable *) &_event_log_skeleton_vtable;
21302}
21303
21304static GVariant *
21305event_log_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
21306{
21307 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (_skeleton);
21308
21309 GVariantBuilder builder;
21310 guint n;
21311 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
21312 if (_event_log_interface_info.parent_struct.properties == NULL)
21313 goto out;
21314 for (n = 0; _event_log_interface_info.parent_struct.properties[n] != NULL; n++)
21315 {
21316 GDBusPropertyInfo *info = _event_log_interface_info.parent_struct.properties[n];
21317 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
21318 {
21319 GVariant *value;
21320 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);
21321 if (value != NULL)
21322 {
21323 g_variant_take_ref (value);
21324 g_variant_builder_add (&builder, "{sv}", info->name, value);
21325 g_variant_unref (value);
21326 }
21327 }
21328 }
21329out:
21330 return g_variant_builder_end (&builder);
21331}
21332
Norman James362a80f2015-09-14 14:04:39 -050021333static void
21334event_log_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
21335{
Norman James362a80f2015-09-14 14:04:39 -050021336}
21337
21338static void
21339_event_log_on_signal_event_log (
21340 EventLog *object,
Norman James8abb50c2015-09-16 10:58:16 -050021341 gint arg_priority,
Norman James88872672015-09-21 16:51:35 -050021342 const gchar *arg_message,
21343 gint arg_rc)
Norman James362a80f2015-09-14 14:04:39 -050021344{
21345 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (object);
21346
21347 GList *connections, *l;
21348 GVariant *signal_variant;
21349 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
21350
Norman James88872672015-09-21 16:51:35 -050021351 signal_variant = g_variant_ref_sink (g_variant_new ("(isi)",
Norman James8abb50c2015-09-16 10:58:16 -050021352 arg_priority,
Norman James88872672015-09-21 16:51:35 -050021353 arg_message,
21354 arg_rc));
Norman James362a80f2015-09-14 14:04:39 -050021355 for (l = connections; l != NULL; l = l->next)
21356 {
21357 GDBusConnection *connection = l->data;
21358 g_dbus_connection_emit_signal (connection,
21359 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.EventLog", "EventLog",
21360 signal_variant, NULL);
21361 }
21362 g_variant_unref (signal_variant);
21363 g_list_free_full (connections, g_object_unref);
21364}
21365
21366static void event_log_skeleton_iface_init (EventLogIface *iface);
21367#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
21368G_DEFINE_TYPE_WITH_CODE (EventLogSkeleton, event_log_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
21369 G_ADD_PRIVATE (EventLogSkeleton)
21370 G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_skeleton_iface_init));
21371
21372#else
21373G_DEFINE_TYPE_WITH_CODE (EventLogSkeleton, event_log_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
21374 G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_skeleton_iface_init));
21375
21376#endif
21377static void
21378event_log_skeleton_finalize (GObject *object)
21379{
21380 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (object);
Norman James362a80f2015-09-14 14:04:39 -050021381 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
21382 if (skeleton->priv->changed_properties_idle_source != NULL)
21383 g_source_destroy (skeleton->priv->changed_properties_idle_source);
21384 g_main_context_unref (skeleton->priv->context);
21385 g_mutex_clear (&skeleton->priv->lock);
21386 G_OBJECT_CLASS (event_log_skeleton_parent_class)->finalize (object);
21387}
21388
21389static void
Norman James362a80f2015-09-14 14:04:39 -050021390event_log_skeleton_init (EventLogSkeleton *skeleton)
21391{
21392#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
21393 skeleton->priv = event_log_skeleton_get_instance_private (skeleton);
21394#else
21395 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_EVENT_LOG_SKELETON, EventLogSkeletonPrivate);
21396#endif
21397
21398 g_mutex_init (&skeleton->priv->lock);
21399 skeleton->priv->context = g_main_context_ref_thread_default ();
Norman James362a80f2015-09-14 14:04:39 -050021400}
21401
21402static void
21403event_log_skeleton_class_init (EventLogSkeletonClass *klass)
21404{
21405 GObjectClass *gobject_class;
21406 GDBusInterfaceSkeletonClass *skeleton_class;
21407
21408 gobject_class = G_OBJECT_CLASS (klass);
21409 gobject_class->finalize = event_log_skeleton_finalize;
Norman James362a80f2015-09-14 14:04:39 -050021410
21411 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
21412 skeleton_class->get_info = event_log_skeleton_dbus_interface_get_info;
21413 skeleton_class->get_properties = event_log_skeleton_dbus_interface_get_properties;
21414 skeleton_class->flush = event_log_skeleton_dbus_interface_flush;
21415 skeleton_class->get_vtable = event_log_skeleton_dbus_interface_get_vtable;
21416
21417#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
21418 g_type_class_add_private (klass, sizeof (EventLogSkeletonPrivate));
21419#endif
21420}
21421
21422static void
21423event_log_skeleton_iface_init (EventLogIface *iface)
21424{
21425 iface->event_log = _event_log_on_signal_event_log;
Norman James362a80f2015-09-14 14:04:39 -050021426}
21427
21428/**
21429 * event_log_skeleton_new:
21430 *
21431 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>.
21432 *
21433 * Returns: (transfer full) (type EventLogSkeleton): The skeleton object.
21434 */
21435EventLog *
21436event_log_skeleton_new (void)
21437{
21438 return EVENT_LOG (g_object_new (TYPE_EVENT_LOG_SKELETON, NULL));
21439}
21440
21441/* ------------------------------------------------------------------------
21442 * Code for interface org.openbmc.Flash
21443 * ------------------------------------------------------------------------
21444 */
21445
21446/**
21447 * SECTION:Flash
21448 * @title: Flash
21449 * @short_description: Generated C code for the org.openbmc.Flash D-Bus interface
21450 *
21451 * 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.
21452 */
21453
21454/* ---- Introspection data for org.openbmc.Flash ---- */
21455
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021456static const _ExtendedGDBusArgInfo _flash_method_info_update_IN_ARG_filename =
Norman James362a80f2015-09-14 14:04:39 -050021457{
21458 {
21459 -1,
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021460 (gchar *) "filename",
Norman James362a80f2015-09-14 14:04:39 -050021461 (gchar *) "s",
21462 NULL
21463 },
21464 FALSE
21465};
21466
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021467static const _ExtendedGDBusArgInfo * const _flash_method_info_update_IN_ARG_pointers[] =
Norman James362a80f2015-09-14 14:04:39 -050021468{
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021469 &_flash_method_info_update_IN_ARG_filename,
Norman James362a80f2015-09-14 14:04:39 -050021470 NULL
21471};
21472
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021473static const _ExtendedGDBusMethodInfo _flash_method_info_update =
Norman James362a80f2015-09-14 14:04:39 -050021474{
21475 {
21476 -1,
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021477 (gchar *) "update",
21478 (GDBusArgInfo **) &_flash_method_info_update_IN_ARG_pointers,
Norman James362a80f2015-09-14 14:04:39 -050021479 NULL,
21480 NULL
21481 },
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021482 "handle-update",
Norman James362a80f2015-09-14 14:04:39 -050021483 FALSE
21484};
21485
Norman James166acf42015-10-22 07:11:51 -050021486static const _ExtendedGDBusArgInfo _flash_method_info_error_IN_ARG_message =
21487{
21488 {
21489 -1,
21490 (gchar *) "message",
21491 (gchar *) "s",
21492 NULL
21493 },
21494 FALSE
21495};
21496
21497static const _ExtendedGDBusArgInfo * const _flash_method_info_error_IN_ARG_pointers[] =
21498{
21499 &_flash_method_info_error_IN_ARG_message,
21500 NULL
21501};
21502
21503static const _ExtendedGDBusMethodInfo _flash_method_info_error =
21504{
21505 {
21506 -1,
21507 (gchar *) "error",
21508 (GDBusArgInfo **) &_flash_method_info_error_IN_ARG_pointers,
21509 NULL,
21510 NULL
21511 },
21512 "handle-error",
21513 FALSE
21514};
21515
21516static const _ExtendedGDBusMethodInfo _flash_method_info_done =
21517{
21518 {
21519 -1,
21520 (gchar *) "done",
21521 NULL,
21522 NULL,
21523 NULL
21524 },
21525 "handle-done",
21526 FALSE
21527};
21528
Norman Jamesf066e872015-10-07 15:29:51 -050021529static const _ExtendedGDBusArgInfo _flash_method_info_update_via_tftp_IN_ARG_url =
21530{
21531 {
21532 -1,
21533 (gchar *) "url",
21534 (gchar *) "s",
21535 NULL
21536 },
21537 FALSE
21538};
21539
21540static const _ExtendedGDBusArgInfo _flash_method_info_update_via_tftp_IN_ARG_filename =
21541{
21542 {
21543 -1,
21544 (gchar *) "filename",
21545 (gchar *) "s",
21546 NULL
21547 },
21548 FALSE
21549};
21550
21551static const _ExtendedGDBusArgInfo * const _flash_method_info_update_via_tftp_IN_ARG_pointers[] =
21552{
21553 &_flash_method_info_update_via_tftp_IN_ARG_url,
21554 &_flash_method_info_update_via_tftp_IN_ARG_filename,
21555 NULL
21556};
21557
21558static const _ExtendedGDBusMethodInfo _flash_method_info_update_via_tftp =
21559{
21560 {
21561 -1,
21562 (gchar *) "updateViaTftp",
21563 (GDBusArgInfo **) &_flash_method_info_update_via_tftp_IN_ARG_pointers,
21564 NULL,
21565 NULL
21566 },
21567 "handle-update-via-tftp",
21568 FALSE
21569};
21570
Norman James362a80f2015-09-14 14:04:39 -050021571static const _ExtendedGDBusMethodInfo _flash_method_info_init =
21572{
21573 {
21574 -1,
21575 (gchar *) "init",
21576 NULL,
21577 NULL,
21578 NULL
21579 },
21580 "handle-init",
21581 FALSE
21582};
21583
21584static const _ExtendedGDBusMethodInfo * const _flash_method_info_pointers[] =
21585{
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021586 &_flash_method_info_update,
Norman James166acf42015-10-22 07:11:51 -050021587 &_flash_method_info_error,
21588 &_flash_method_info_done,
Norman Jamesf066e872015-10-07 15:29:51 -050021589 &_flash_method_info_update_via_tftp,
Norman James362a80f2015-09-14 14:04:39 -050021590 &_flash_method_info_init,
21591 NULL
21592};
21593
21594static const _ExtendedGDBusSignalInfo _flash_signal_info_updated =
21595{
21596 {
21597 -1,
21598 (gchar *) "Updated",
21599 NULL,
21600 NULL
21601 },
21602 "updated"
21603};
21604
Norman Jamesf066e872015-10-07 15:29:51 -050021605static const _ExtendedGDBusArgInfo _flash_signal_info_download_ARG_url =
21606{
21607 {
21608 -1,
21609 (gchar *) "url",
21610 (gchar *) "s",
21611 NULL
21612 },
21613 FALSE
21614};
21615
21616static const _ExtendedGDBusArgInfo _flash_signal_info_download_ARG_filename =
21617{
21618 {
21619 -1,
21620 (gchar *) "filename",
21621 (gchar *) "s",
21622 NULL
21623 },
21624 FALSE
21625};
21626
21627static const _ExtendedGDBusArgInfo * const _flash_signal_info_download_ARG_pointers[] =
21628{
21629 &_flash_signal_info_download_ARG_url,
21630 &_flash_signal_info_download_ARG_filename,
21631 NULL
21632};
21633
21634static const _ExtendedGDBusSignalInfo _flash_signal_info_download =
21635{
21636 {
21637 -1,
21638 (gchar *) "Download",
21639 (GDBusArgInfo **) &_flash_signal_info_download_ARG_pointers,
21640 NULL
21641 },
21642 "download"
21643};
21644
Norman James362a80f2015-09-14 14:04:39 -050021645static const _ExtendedGDBusSignalInfo * const _flash_signal_info_pointers[] =
21646{
21647 &_flash_signal_info_updated,
Norman Jamesf066e872015-10-07 15:29:51 -050021648 &_flash_signal_info_download,
Norman James362a80f2015-09-14 14:04:39 -050021649 NULL
21650};
21651
Norman James18998182015-10-11 21:54:53 -050021652static const _ExtendedGDBusPropertyInfo _flash_property_info_filename =
21653{
21654 {
21655 -1,
21656 (gchar *) "filename",
21657 (gchar *) "s",
21658 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
21659 NULL
21660 },
21661 "filename",
21662 FALSE
21663};
21664
21665static const _ExtendedGDBusPropertyInfo _flash_property_info_flasher_path =
21666{
21667 {
21668 -1,
21669 (gchar *) "flasher_path",
21670 (gchar *) "s",
21671 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
21672 NULL
21673 },
21674 "flasher-path",
21675 FALSE
21676};
21677
21678static const _ExtendedGDBusPropertyInfo _flash_property_info_flasher_name =
21679{
21680 {
21681 -1,
21682 (gchar *) "flasher_name",
21683 (gchar *) "s",
21684 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
21685 NULL
21686 },
21687 "flasher-name",
21688 FALSE
21689};
21690
21691static const _ExtendedGDBusPropertyInfo _flash_property_info_flasher_instance =
21692{
21693 {
21694 -1,
21695 (gchar *) "flasher_instance",
21696 (gchar *) "s",
21697 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
21698 NULL
21699 },
21700 "flasher-instance",
21701 FALSE
21702};
21703
Norman James166acf42015-10-22 07:11:51 -050021704static const _ExtendedGDBusPropertyInfo _flash_property_info_status =
21705{
21706 {
21707 -1,
21708 (gchar *) "status",
21709 (gchar *) "s",
21710 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
21711 NULL
21712 },
21713 "status",
21714 FALSE
21715};
21716
Norman James18998182015-10-11 21:54:53 -050021717static const _ExtendedGDBusPropertyInfo * const _flash_property_info_pointers[] =
21718{
21719 &_flash_property_info_filename,
21720 &_flash_property_info_flasher_path,
21721 &_flash_property_info_flasher_name,
21722 &_flash_property_info_flasher_instance,
Norman James166acf42015-10-22 07:11:51 -050021723 &_flash_property_info_status,
Norman James18998182015-10-11 21:54:53 -050021724 NULL
21725};
21726
Norman James362a80f2015-09-14 14:04:39 -050021727static const _ExtendedGDBusInterfaceInfo _flash_interface_info =
21728{
21729 {
21730 -1,
21731 (gchar *) "org.openbmc.Flash",
21732 (GDBusMethodInfo **) &_flash_method_info_pointers,
21733 (GDBusSignalInfo **) &_flash_signal_info_pointers,
Norman James18998182015-10-11 21:54:53 -050021734 (GDBusPropertyInfo **) &_flash_property_info_pointers,
Norman James362a80f2015-09-14 14:04:39 -050021735 NULL
21736 },
21737 "flash",
21738};
21739
21740
21741/**
21742 * flash_interface_info:
21743 *
21744 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link> D-Bus interface.
21745 *
21746 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
21747 */
21748GDBusInterfaceInfo *
21749flash_interface_info (void)
21750{
21751 return (GDBusInterfaceInfo *) &_flash_interface_info.parent_struct;
21752}
21753
21754/**
21755 * flash_override_properties:
21756 * @klass: The class structure for a #GObject<!-- -->-derived class.
21757 * @property_id_begin: The property id to assign to the first overridden property.
21758 *
21759 * Overrides all #GObject properties in the #Flash interface for a concrete class.
21760 * The properties are overridden in the order they are defined.
21761 *
21762 * Returns: The last property id.
21763 */
21764guint
21765flash_override_properties (GObjectClass *klass, guint property_id_begin)
21766{
Norman James18998182015-10-11 21:54:53 -050021767 g_object_class_override_property (klass, property_id_begin++, "filename");
21768 g_object_class_override_property (klass, property_id_begin++, "flasher-path");
21769 g_object_class_override_property (klass, property_id_begin++, "flasher-name");
21770 g_object_class_override_property (klass, property_id_begin++, "flasher-instance");
Norman James166acf42015-10-22 07:11:51 -050021771 g_object_class_override_property (klass, property_id_begin++, "status");
Norman James362a80f2015-09-14 14:04:39 -050021772 return property_id_begin - 1;
21773}
21774
21775
21776
21777/**
21778 * Flash:
21779 *
21780 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>.
21781 */
21782
21783/**
21784 * FlashIface:
21785 * @parent_iface: The parent interface.
Norman James166acf42015-10-22 07:11:51 -050021786 * @handle_done: Handler for the #Flash::handle-done signal.
21787 * @handle_error: Handler for the #Flash::handle-error signal.
Norman James362a80f2015-09-14 14:04:39 -050021788 * @handle_init: Handler for the #Flash::handle-init signal.
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021789 * @handle_update: Handler for the #Flash::handle-update signal.
Norman Jamesf066e872015-10-07 15:29:51 -050021790 * @handle_update_via_tftp: Handler for the #Flash::handle-update-via-tftp signal.
Norman James18998182015-10-11 21:54:53 -050021791 * @get_filename: Getter for the #Flash:filename property.
21792 * @get_flasher_instance: Getter for the #Flash:flasher-instance property.
21793 * @get_flasher_name: Getter for the #Flash:flasher-name property.
21794 * @get_flasher_path: Getter for the #Flash:flasher-path property.
Norman James166acf42015-10-22 07:11:51 -050021795 * @get_status: Getter for the #Flash:status property.
Norman Jamesf066e872015-10-07 15:29:51 -050021796 * @download: Handler for the #Flash::download signal.
Norman James362a80f2015-09-14 14:04:39 -050021797 * @updated: Handler for the #Flash::updated signal.
21798 *
21799 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>.
21800 */
21801
21802typedef FlashIface FlashInterface;
21803G_DEFINE_INTERFACE (Flash, flash, G_TYPE_OBJECT);
21804
21805static void
21806flash_default_init (FlashIface *iface)
21807{
21808 /* GObject signals for incoming D-Bus method calls: */
21809 /**
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021810 * Flash::handle-update:
Norman James362a80f2015-09-14 14:04:39 -050021811 * @object: A #Flash.
21812 * @invocation: A #GDBusMethodInvocation.
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021813 * @arg_filename: Argument passed by remote caller.
Norman James362a80f2015-09-14 14:04:39 -050021814 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021815 * 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 -050021816 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021817 * 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 -050021818 *
21819 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
21820 */
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021821 g_signal_new ("handle-update",
Norman James362a80f2015-09-14 14:04:39 -050021822 G_TYPE_FROM_INTERFACE (iface),
21823 G_SIGNAL_RUN_LAST,
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021824 G_STRUCT_OFFSET (FlashIface, handle_update),
Norman James362a80f2015-09-14 14:04:39 -050021825 g_signal_accumulator_true_handled,
21826 NULL,
21827 g_cclosure_marshal_generic,
21828 G_TYPE_BOOLEAN,
21829 2,
21830 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING);
21831
21832 /**
Norman James166acf42015-10-22 07:11:51 -050021833 * Flash::handle-error:
21834 * @object: A #Flash.
21835 * @invocation: A #GDBusMethodInvocation.
21836 * @arg_message: Argument passed by remote caller.
21837 *
21838 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.error">error()</link> D-Bus method.
21839 *
21840 * 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.
21841 *
21842 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
21843 */
21844 g_signal_new ("handle-error",
21845 G_TYPE_FROM_INTERFACE (iface),
21846 G_SIGNAL_RUN_LAST,
21847 G_STRUCT_OFFSET (FlashIface, handle_error),
21848 g_signal_accumulator_true_handled,
21849 NULL,
21850 g_cclosure_marshal_generic,
21851 G_TYPE_BOOLEAN,
21852 2,
21853 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING);
21854
21855 /**
21856 * Flash::handle-done:
21857 * @object: A #Flash.
21858 * @invocation: A #GDBusMethodInvocation.
21859 *
21860 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.done">done()</link> D-Bus method.
21861 *
21862 * 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.
21863 *
21864 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
21865 */
21866 g_signal_new ("handle-done",
21867 G_TYPE_FROM_INTERFACE (iface),
21868 G_SIGNAL_RUN_LAST,
21869 G_STRUCT_OFFSET (FlashIface, handle_done),
21870 g_signal_accumulator_true_handled,
21871 NULL,
21872 g_cclosure_marshal_generic,
21873 G_TYPE_BOOLEAN,
21874 1,
21875 G_TYPE_DBUS_METHOD_INVOCATION);
21876
21877 /**
Norman Jamesf066e872015-10-07 15:29:51 -050021878 * Flash::handle-update-via-tftp:
21879 * @object: A #Flash.
21880 * @invocation: A #GDBusMethodInvocation.
21881 * @arg_url: Argument passed by remote caller.
21882 * @arg_filename: Argument passed by remote caller.
21883 *
21884 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.updateViaTftp">updateViaTftp()</link> D-Bus method.
21885 *
21886 * 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.
21887 *
21888 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
21889 */
21890 g_signal_new ("handle-update-via-tftp",
21891 G_TYPE_FROM_INTERFACE (iface),
21892 G_SIGNAL_RUN_LAST,
21893 G_STRUCT_OFFSET (FlashIface, handle_update_via_tftp),
21894 g_signal_accumulator_true_handled,
21895 NULL,
21896 g_cclosure_marshal_generic,
21897 G_TYPE_BOOLEAN,
21898 3,
21899 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_STRING);
21900
21901 /**
Norman James362a80f2015-09-14 14:04:39 -050021902 * Flash::handle-init:
21903 * @object: A #Flash.
21904 * @invocation: A #GDBusMethodInvocation.
21905 *
21906 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.init">init()</link> D-Bus method.
21907 *
21908 * 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.
21909 *
21910 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
21911 */
21912 g_signal_new ("handle-init",
21913 G_TYPE_FROM_INTERFACE (iface),
21914 G_SIGNAL_RUN_LAST,
21915 G_STRUCT_OFFSET (FlashIface, handle_init),
21916 g_signal_accumulator_true_handled,
21917 NULL,
21918 g_cclosure_marshal_generic,
21919 G_TYPE_BOOLEAN,
21920 1,
21921 G_TYPE_DBUS_METHOD_INVOCATION);
21922
21923 /* GObject signals for received D-Bus signals: */
21924 /**
21925 * Flash::updated:
21926 * @object: A #Flash.
21927 *
21928 * 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.
21929 *
21930 * 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.
21931 */
21932 g_signal_new ("updated",
21933 G_TYPE_FROM_INTERFACE (iface),
21934 G_SIGNAL_RUN_LAST,
21935 G_STRUCT_OFFSET (FlashIface, updated),
21936 NULL,
21937 NULL,
21938 g_cclosure_marshal_generic,
21939 G_TYPE_NONE,
21940 0);
21941
Norman Jamesf066e872015-10-07 15:29:51 -050021942 /**
21943 * Flash::download:
21944 * @object: A #Flash.
21945 * @arg_url: Argument.
21946 * @arg_filename: Argument.
21947 *
21948 * 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.
21949 *
21950 * 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.
21951 */
21952 g_signal_new ("download",
21953 G_TYPE_FROM_INTERFACE (iface),
21954 G_SIGNAL_RUN_LAST,
21955 G_STRUCT_OFFSET (FlashIface, download),
21956 NULL,
21957 NULL,
21958 g_cclosure_marshal_generic,
21959 G_TYPE_NONE,
21960 2, G_TYPE_STRING, G_TYPE_STRING);
21961
Norman James18998182015-10-11 21:54:53 -050021962 /* GObject properties for D-Bus properties: */
21963 /**
21964 * Flash:filename:
21965 *
21966 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Flash.filename">"filename"</link>.
21967 *
21968 * 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.
21969 */
21970 g_object_interface_install_property (iface,
21971 g_param_spec_string ("filename", "filename", "filename", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
21972 /**
21973 * Flash:flasher-path:
21974 *
21975 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Flash.flasher_path">"flasher_path"</link>.
21976 *
21977 * 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.
21978 */
21979 g_object_interface_install_property (iface,
21980 g_param_spec_string ("flasher-path", "flasher_path", "flasher_path", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
21981 /**
21982 * Flash:flasher-name:
21983 *
21984 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Flash.flasher_name">"flasher_name"</link>.
21985 *
21986 * 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.
21987 */
21988 g_object_interface_install_property (iface,
21989 g_param_spec_string ("flasher-name", "flasher_name", "flasher_name", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
21990 /**
21991 * Flash:flasher-instance:
21992 *
21993 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Flash.flasher_instance">"flasher_instance"</link>.
21994 *
21995 * 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.
21996 */
21997 g_object_interface_install_property (iface,
21998 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 -050021999 /**
22000 * Flash:status:
22001 *
22002 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Flash.status">"status"</link>.
22003 *
22004 * 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.
22005 */
22006 g_object_interface_install_property (iface,
22007 g_param_spec_string ("status", "status", "status", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Norman James18998182015-10-11 21:54:53 -050022008}
22009
22010/**
22011 * flash_get_filename: (skip)
22012 * @object: A #Flash.
22013 *
22014 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Flash.filename">"filename"</link> D-Bus property.
22015 *
22016 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
22017 *
22018 * <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>
22019 *
22020 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
22021 */
22022const gchar *
22023flash_get_filename (Flash *object)
22024{
22025 return FLASH_GET_IFACE (object)->get_filename (object);
22026}
22027
22028/**
22029 * flash_dup_filename: (skip)
22030 * @object: A #Flash.
22031 *
22032 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Flash.filename">"filename"</link> D-Bus property.
22033 *
22034 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
22035 *
22036 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
22037 */
22038gchar *
22039flash_dup_filename (Flash *object)
22040{
22041 gchar *value;
22042 g_object_get (G_OBJECT (object), "filename", &value, NULL);
22043 return value;
22044}
22045
22046/**
22047 * flash_set_filename: (skip)
22048 * @object: A #Flash.
22049 * @value: The value to set.
22050 *
22051 * Sets the <link linkend="gdbus-property-org-openbmc-Flash.filename">"filename"</link> D-Bus property to @value.
22052 *
22053 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
22054 */
22055void
22056flash_set_filename (Flash *object, const gchar *value)
22057{
22058 g_object_set (G_OBJECT (object), "filename", value, NULL);
22059}
22060
22061/**
22062 * flash_get_flasher_path: (skip)
22063 * @object: A #Flash.
22064 *
22065 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_path">"flasher_path"</link> D-Bus property.
22066 *
22067 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
22068 *
22069 * <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>
22070 *
22071 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
22072 */
22073const gchar *
22074flash_get_flasher_path (Flash *object)
22075{
22076 return FLASH_GET_IFACE (object)->get_flasher_path (object);
22077}
22078
22079/**
22080 * flash_dup_flasher_path: (skip)
22081 * @object: A #Flash.
22082 *
22083 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_path">"flasher_path"</link> D-Bus property.
22084 *
22085 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
22086 *
22087 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
22088 */
22089gchar *
22090flash_dup_flasher_path (Flash *object)
22091{
22092 gchar *value;
22093 g_object_get (G_OBJECT (object), "flasher-path", &value, NULL);
22094 return value;
22095}
22096
22097/**
22098 * flash_set_flasher_path: (skip)
22099 * @object: A #Flash.
22100 * @value: The value to set.
22101 *
22102 * Sets the <link linkend="gdbus-property-org-openbmc-Flash.flasher_path">"flasher_path"</link> D-Bus property to @value.
22103 *
22104 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
22105 */
22106void
22107flash_set_flasher_path (Flash *object, const gchar *value)
22108{
22109 g_object_set (G_OBJECT (object), "flasher-path", value, NULL);
22110}
22111
22112/**
22113 * flash_get_flasher_name: (skip)
22114 * @object: A #Flash.
22115 *
22116 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_name">"flasher_name"</link> D-Bus property.
22117 *
22118 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
22119 *
22120 * <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>
22121 *
22122 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
22123 */
22124const gchar *
22125flash_get_flasher_name (Flash *object)
22126{
22127 return FLASH_GET_IFACE (object)->get_flasher_name (object);
22128}
22129
22130/**
22131 * flash_dup_flasher_name: (skip)
22132 * @object: A #Flash.
22133 *
22134 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_name">"flasher_name"</link> D-Bus property.
22135 *
22136 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
22137 *
22138 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
22139 */
22140gchar *
22141flash_dup_flasher_name (Flash *object)
22142{
22143 gchar *value;
22144 g_object_get (G_OBJECT (object), "flasher-name", &value, NULL);
22145 return value;
22146}
22147
22148/**
22149 * flash_set_flasher_name: (skip)
22150 * @object: A #Flash.
22151 * @value: The value to set.
22152 *
22153 * Sets the <link linkend="gdbus-property-org-openbmc-Flash.flasher_name">"flasher_name"</link> D-Bus property to @value.
22154 *
22155 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
22156 */
22157void
22158flash_set_flasher_name (Flash *object, const gchar *value)
22159{
22160 g_object_set (G_OBJECT (object), "flasher-name", value, NULL);
22161}
22162
22163/**
22164 * flash_get_flasher_instance: (skip)
22165 * @object: A #Flash.
22166 *
22167 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_instance">"flasher_instance"</link> D-Bus property.
22168 *
22169 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
22170 *
22171 * <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>
22172 *
22173 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
22174 */
22175const gchar *
22176flash_get_flasher_instance (Flash *object)
22177{
22178 return FLASH_GET_IFACE (object)->get_flasher_instance (object);
22179}
22180
22181/**
22182 * flash_dup_flasher_instance: (skip)
22183 * @object: A #Flash.
22184 *
22185 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_instance">"flasher_instance"</link> D-Bus property.
22186 *
22187 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
22188 *
22189 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
22190 */
22191gchar *
22192flash_dup_flasher_instance (Flash *object)
22193{
22194 gchar *value;
22195 g_object_get (G_OBJECT (object), "flasher-instance", &value, NULL);
22196 return value;
22197}
22198
22199/**
22200 * flash_set_flasher_instance: (skip)
22201 * @object: A #Flash.
22202 * @value: The value to set.
22203 *
22204 * Sets the <link linkend="gdbus-property-org-openbmc-Flash.flasher_instance">"flasher_instance"</link> D-Bus property to @value.
22205 *
22206 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
22207 */
22208void
22209flash_set_flasher_instance (Flash *object, const gchar *value)
22210{
22211 g_object_set (G_OBJECT (object), "flasher-instance", value, NULL);
Norman James362a80f2015-09-14 14:04:39 -050022212}
22213
22214/**
Norman James166acf42015-10-22 07:11:51 -050022215 * flash_get_status: (skip)
22216 * @object: A #Flash.
22217 *
22218 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Flash.status">"status"</link> D-Bus property.
22219 *
22220 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
22221 *
22222 * <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>
22223 *
22224 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
22225 */
22226const gchar *
22227flash_get_status (Flash *object)
22228{
22229 return FLASH_GET_IFACE (object)->get_status (object);
22230}
22231
22232/**
22233 * flash_dup_status: (skip)
22234 * @object: A #Flash.
22235 *
22236 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Flash.status">"status"</link> D-Bus property.
22237 *
22238 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
22239 *
22240 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
22241 */
22242gchar *
22243flash_dup_status (Flash *object)
22244{
22245 gchar *value;
22246 g_object_get (G_OBJECT (object), "status", &value, NULL);
22247 return value;
22248}
22249
22250/**
22251 * flash_set_status: (skip)
22252 * @object: A #Flash.
22253 * @value: The value to set.
22254 *
22255 * Sets the <link linkend="gdbus-property-org-openbmc-Flash.status">"status"</link> D-Bus property to @value.
22256 *
22257 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
22258 */
22259void
22260flash_set_status (Flash *object, const gchar *value)
22261{
22262 g_object_set (G_OBJECT (object), "status", value, NULL);
22263}
22264
22265/**
Norman James362a80f2015-09-14 14:04:39 -050022266 * flash_emit_updated:
22267 * @object: A #Flash.
22268 *
22269 * Emits the <link linkend="gdbus-signal-org-openbmc-Flash.Updated">"Updated"</link> D-Bus signal.
22270 */
22271void
22272flash_emit_updated (
22273 Flash *object)
22274{
22275 g_signal_emit_by_name (object, "updated");
22276}
22277
22278/**
Norman Jamesf066e872015-10-07 15:29:51 -050022279 * flash_emit_download:
22280 * @object: A #Flash.
22281 * @arg_url: Argument to pass with the signal.
22282 * @arg_filename: Argument to pass with the signal.
22283 *
22284 * Emits the <link linkend="gdbus-signal-org-openbmc-Flash.Download">"Download"</link> D-Bus signal.
22285 */
22286void
22287flash_emit_download (
22288 Flash *object,
22289 const gchar *arg_url,
22290 const gchar *arg_filename)
22291{
22292 g_signal_emit_by_name (object, "download", arg_url, arg_filename);
22293}
22294
22295/**
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022296 * flash_call_update:
Norman James362a80f2015-09-14 14:04:39 -050022297 * @proxy: A #FlashProxy.
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022298 * @arg_filename: Argument to pass with the method invocation.
Norman James362a80f2015-09-14 14:04:39 -050022299 * @cancellable: (allow-none): A #GCancellable or %NULL.
22300 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
22301 * @user_data: User data to pass to @callback.
22302 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022303 * 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 -050022304 * 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 -050022305 * You can then call flash_call_update_finish() to get the result of the operation.
Norman James362a80f2015-09-14 14:04:39 -050022306 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022307 * See flash_call_update_sync() for the synchronous, blocking version of this method.
Norman James362a80f2015-09-14 14:04:39 -050022308 */
22309void
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022310flash_call_update (
Norman James362a80f2015-09-14 14:04:39 -050022311 Flash *proxy,
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022312 const gchar *arg_filename,
Norman James362a80f2015-09-14 14:04:39 -050022313 GCancellable *cancellable,
22314 GAsyncReadyCallback callback,
22315 gpointer user_data)
22316{
22317 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022318 "update",
Norman James362a80f2015-09-14 14:04:39 -050022319 g_variant_new ("(s)",
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022320 arg_filename),
Norman James362a80f2015-09-14 14:04:39 -050022321 G_DBUS_CALL_FLAGS_NONE,
22322 -1,
22323 cancellable,
22324 callback,
22325 user_data);
22326}
22327
22328/**
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022329 * flash_call_update_finish:
Norman James362a80f2015-09-14 14:04:39 -050022330 * @proxy: A #FlashProxy.
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022331 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_update().
Norman James362a80f2015-09-14 14:04:39 -050022332 * @error: Return location for error or %NULL.
22333 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022334 * Finishes an operation started with flash_call_update().
Norman James362a80f2015-09-14 14:04:39 -050022335 *
22336 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
22337 */
22338gboolean
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022339flash_call_update_finish (
Norman James362a80f2015-09-14 14:04:39 -050022340 Flash *proxy,
22341 GAsyncResult *res,
22342 GError **error)
22343{
22344 GVariant *_ret;
22345 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, 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/**
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022356 * flash_call_update_sync:
Norman James362a80f2015-09-14 14:04:39 -050022357 * @proxy: A #FlashProxy.
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022358 * @arg_filename: Argument to pass with the method invocation.
Norman James362a80f2015-09-14 14:04:39 -050022359 * @cancellable: (allow-none): A #GCancellable or %NULL.
22360 * @error: Return location for error or %NULL.
22361 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022362 * 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 -050022363 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022364 * See flash_call_update() for the asynchronous version of this method.
Norman James362a80f2015-09-14 14:04:39 -050022365 *
22366 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
22367 */
22368gboolean
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022369flash_call_update_sync (
Norman James362a80f2015-09-14 14:04:39 -050022370 Flash *proxy,
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022371 const gchar *arg_filename,
Norman James362a80f2015-09-14 14:04:39 -050022372 GCancellable *cancellable,
22373 GError **error)
22374{
22375 GVariant *_ret;
22376 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022377 "update",
Norman James362a80f2015-09-14 14:04:39 -050022378 g_variant_new ("(s)",
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022379 arg_filename),
Norman James362a80f2015-09-14 14:04:39 -050022380 G_DBUS_CALL_FLAGS_NONE,
22381 -1,
22382 cancellable,
22383 error);
22384 if (_ret == NULL)
22385 goto _out;
22386 g_variant_get (_ret,
22387 "()");
22388 g_variant_unref (_ret);
22389_out:
22390 return _ret != NULL;
22391}
22392
22393/**
Norman James166acf42015-10-22 07:11:51 -050022394 * flash_call_error:
22395 * @proxy: A #FlashProxy.
22396 * @arg_message: Argument to pass with the method invocation.
22397 * @cancellable: (allow-none): A #GCancellable or %NULL.
22398 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
22399 * @user_data: User data to pass to @callback.
22400 *
22401 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.error">error()</link> D-Bus method on @proxy.
22402 * 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.
22403 * You can then call flash_call_error_finish() to get the result of the operation.
22404 *
22405 * See flash_call_error_sync() for the synchronous, blocking version of this method.
22406 */
22407void
22408flash_call_error (
22409 Flash *proxy,
22410 const gchar *arg_message,
22411 GCancellable *cancellable,
22412 GAsyncReadyCallback callback,
22413 gpointer user_data)
22414{
22415 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
22416 "error",
22417 g_variant_new ("(s)",
22418 arg_message),
22419 G_DBUS_CALL_FLAGS_NONE,
22420 -1,
22421 cancellable,
22422 callback,
22423 user_data);
22424}
22425
22426/**
22427 * flash_call_error_finish:
22428 * @proxy: A #FlashProxy.
22429 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_error().
22430 * @error: Return location for error or %NULL.
22431 *
22432 * Finishes an operation started with flash_call_error().
22433 *
22434 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
22435 */
22436gboolean
22437flash_call_error_finish (
22438 Flash *proxy,
22439 GAsyncResult *res,
22440 GError **error)
22441{
22442 GVariant *_ret;
22443 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
22444 if (_ret == NULL)
22445 goto _out;
22446 g_variant_get (_ret,
22447 "()");
22448 g_variant_unref (_ret);
22449_out:
22450 return _ret != NULL;
22451}
22452
22453/**
22454 * flash_call_error_sync:
22455 * @proxy: A #FlashProxy.
22456 * @arg_message: Argument to pass with the method invocation.
22457 * @cancellable: (allow-none): A #GCancellable or %NULL.
22458 * @error: Return location for error or %NULL.
22459 *
22460 * 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.
22461 *
22462 * See flash_call_error() for the asynchronous version of this method.
22463 *
22464 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
22465 */
22466gboolean
22467flash_call_error_sync (
22468 Flash *proxy,
22469 const gchar *arg_message,
22470 GCancellable *cancellable,
22471 GError **error)
22472{
22473 GVariant *_ret;
22474 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
22475 "error",
22476 g_variant_new ("(s)",
22477 arg_message),
22478 G_DBUS_CALL_FLAGS_NONE,
22479 -1,
22480 cancellable,
22481 error);
22482 if (_ret == NULL)
22483 goto _out;
22484 g_variant_get (_ret,
22485 "()");
22486 g_variant_unref (_ret);
22487_out:
22488 return _ret != NULL;
22489}
22490
22491/**
22492 * flash_call_done:
22493 * @proxy: A #FlashProxy.
22494 * @cancellable: (allow-none): A #GCancellable or %NULL.
22495 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
22496 * @user_data: User data to pass to @callback.
22497 *
22498 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.done">done()</link> D-Bus method on @proxy.
22499 * 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.
22500 * You can then call flash_call_done_finish() to get the result of the operation.
22501 *
22502 * See flash_call_done_sync() for the synchronous, blocking version of this method.
22503 */
22504void
22505flash_call_done (
22506 Flash *proxy,
22507 GCancellable *cancellable,
22508 GAsyncReadyCallback callback,
22509 gpointer user_data)
22510{
22511 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
22512 "done",
22513 g_variant_new ("()"),
22514 G_DBUS_CALL_FLAGS_NONE,
22515 -1,
22516 cancellable,
22517 callback,
22518 user_data);
22519}
22520
22521/**
22522 * flash_call_done_finish:
22523 * @proxy: A #FlashProxy.
22524 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_done().
22525 * @error: Return location for error or %NULL.
22526 *
22527 * Finishes an operation started with flash_call_done().
22528 *
22529 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
22530 */
22531gboolean
22532flash_call_done_finish (
22533 Flash *proxy,
22534 GAsyncResult *res,
22535 GError **error)
22536{
22537 GVariant *_ret;
22538 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
22539 if (_ret == NULL)
22540 goto _out;
22541 g_variant_get (_ret,
22542 "()");
22543 g_variant_unref (_ret);
22544_out:
22545 return _ret != NULL;
22546}
22547
22548/**
22549 * flash_call_done_sync:
22550 * @proxy: A #FlashProxy.
22551 * @cancellable: (allow-none): A #GCancellable or %NULL.
22552 * @error: Return location for error or %NULL.
22553 *
22554 * 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.
22555 *
22556 * See flash_call_done() for the asynchronous version of this method.
22557 *
22558 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
22559 */
22560gboolean
22561flash_call_done_sync (
22562 Flash *proxy,
22563 GCancellable *cancellable,
22564 GError **error)
22565{
22566 GVariant *_ret;
22567 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
22568 "done",
22569 g_variant_new ("()"),
22570 G_DBUS_CALL_FLAGS_NONE,
22571 -1,
22572 cancellable,
22573 error);
22574 if (_ret == NULL)
22575 goto _out;
22576 g_variant_get (_ret,
22577 "()");
22578 g_variant_unref (_ret);
22579_out:
22580 return _ret != NULL;
22581}
22582
22583/**
Norman Jamesf066e872015-10-07 15:29:51 -050022584 * flash_call_update_via_tftp:
22585 * @proxy: A #FlashProxy.
22586 * @arg_url: Argument to pass with the method invocation.
22587 * @arg_filename: Argument to pass with the method invocation.
22588 * @cancellable: (allow-none): A #GCancellable or %NULL.
22589 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
22590 * @user_data: User data to pass to @callback.
22591 *
22592 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.updateViaTftp">updateViaTftp()</link> D-Bus method on @proxy.
22593 * 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.
22594 * You can then call flash_call_update_via_tftp_finish() to get the result of the operation.
22595 *
22596 * See flash_call_update_via_tftp_sync() for the synchronous, blocking version of this method.
22597 */
22598void
22599flash_call_update_via_tftp (
22600 Flash *proxy,
22601 const gchar *arg_url,
22602 const gchar *arg_filename,
22603 GCancellable *cancellable,
22604 GAsyncReadyCallback callback,
22605 gpointer user_data)
22606{
22607 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
22608 "updateViaTftp",
22609 g_variant_new ("(ss)",
22610 arg_url,
22611 arg_filename),
22612 G_DBUS_CALL_FLAGS_NONE,
22613 -1,
22614 cancellable,
22615 callback,
22616 user_data);
22617}
22618
22619/**
22620 * flash_call_update_via_tftp_finish:
22621 * @proxy: A #FlashProxy.
22622 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_update_via_tftp().
22623 * @error: Return location for error or %NULL.
22624 *
22625 * Finishes an operation started with flash_call_update_via_tftp().
22626 *
22627 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
22628 */
22629gboolean
22630flash_call_update_via_tftp_finish (
22631 Flash *proxy,
22632 GAsyncResult *res,
22633 GError **error)
22634{
22635 GVariant *_ret;
22636 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
22637 if (_ret == NULL)
22638 goto _out;
22639 g_variant_get (_ret,
22640 "()");
22641 g_variant_unref (_ret);
22642_out:
22643 return _ret != NULL;
22644}
22645
22646/**
22647 * flash_call_update_via_tftp_sync:
22648 * @proxy: A #FlashProxy.
22649 * @arg_url: Argument to pass with the method invocation.
22650 * @arg_filename: Argument to pass with the method invocation.
22651 * @cancellable: (allow-none): A #GCancellable or %NULL.
22652 * @error: Return location for error or %NULL.
22653 *
22654 * 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.
22655 *
22656 * See flash_call_update_via_tftp() for the asynchronous version of this method.
22657 *
22658 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
22659 */
22660gboolean
22661flash_call_update_via_tftp_sync (
22662 Flash *proxy,
22663 const gchar *arg_url,
22664 const gchar *arg_filename,
22665 GCancellable *cancellable,
22666 GError **error)
22667{
22668 GVariant *_ret;
22669 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
22670 "updateViaTftp",
22671 g_variant_new ("(ss)",
22672 arg_url,
22673 arg_filename),
22674 G_DBUS_CALL_FLAGS_NONE,
22675 -1,
22676 cancellable,
22677 error);
22678 if (_ret == NULL)
22679 goto _out;
22680 g_variant_get (_ret,
22681 "()");
22682 g_variant_unref (_ret);
22683_out:
22684 return _ret != NULL;
22685}
22686
22687/**
Norman James362a80f2015-09-14 14:04:39 -050022688 * flash_call_init:
22689 * @proxy: A #FlashProxy.
22690 * @cancellable: (allow-none): A #GCancellable or %NULL.
22691 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
22692 * @user_data: User data to pass to @callback.
22693 *
22694 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.init">init()</link> D-Bus method on @proxy.
22695 * 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.
22696 * You can then call flash_call_init_finish() to get the result of the operation.
22697 *
22698 * See flash_call_init_sync() for the synchronous, blocking version of this method.
22699 */
22700void
22701flash_call_init (
22702 Flash *proxy,
22703 GCancellable *cancellable,
22704 GAsyncReadyCallback callback,
22705 gpointer user_data)
22706{
22707 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
22708 "init",
22709 g_variant_new ("()"),
22710 G_DBUS_CALL_FLAGS_NONE,
22711 -1,
22712 cancellable,
22713 callback,
22714 user_data);
22715}
22716
22717/**
22718 * flash_call_init_finish:
22719 * @proxy: A #FlashProxy.
22720 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_init().
22721 * @error: Return location for error or %NULL.
22722 *
22723 * Finishes an operation started with flash_call_init().
22724 *
22725 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
22726 */
22727gboolean
22728flash_call_init_finish (
22729 Flash *proxy,
22730 GAsyncResult *res,
22731 GError **error)
22732{
22733 GVariant *_ret;
22734 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
22735 if (_ret == NULL)
22736 goto _out;
22737 g_variant_get (_ret,
22738 "()");
22739 g_variant_unref (_ret);
22740_out:
22741 return _ret != NULL;
22742}
22743
22744/**
22745 * flash_call_init_sync:
22746 * @proxy: A #FlashProxy.
22747 * @cancellable: (allow-none): A #GCancellable or %NULL.
22748 * @error: Return location for error or %NULL.
22749 *
22750 * 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.
22751 *
22752 * See flash_call_init() for the asynchronous version of this method.
22753 *
22754 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
22755 */
22756gboolean
22757flash_call_init_sync (
22758 Flash *proxy,
22759 GCancellable *cancellable,
22760 GError **error)
22761{
22762 GVariant *_ret;
22763 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
22764 "init",
22765 g_variant_new ("()"),
22766 G_DBUS_CALL_FLAGS_NONE,
22767 -1,
22768 cancellable,
22769 error);
22770 if (_ret == NULL)
22771 goto _out;
22772 g_variant_get (_ret,
22773 "()");
22774 g_variant_unref (_ret);
22775_out:
22776 return _ret != NULL;
22777}
22778
22779/**
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022780 * flash_complete_update:
Norman James362a80f2015-09-14 14:04:39 -050022781 * @object: A #Flash.
22782 * @invocation: (transfer full): A #GDBusMethodInvocation.
22783 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022784 * 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 -050022785 *
22786 * This method will free @invocation, you cannot use it afterwards.
22787 */
22788void
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022789flash_complete_update (
Norman James362a80f2015-09-14 14:04:39 -050022790 Flash *object,
22791 GDBusMethodInvocation *invocation)
22792{
22793 g_dbus_method_invocation_return_value (invocation,
22794 g_variant_new ("()"));
22795}
22796
22797/**
Norman James166acf42015-10-22 07:11:51 -050022798 * flash_complete_error:
22799 * @object: A #Flash.
22800 * @invocation: (transfer full): A #GDBusMethodInvocation.
22801 *
22802 * 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.
22803 *
22804 * This method will free @invocation, you cannot use it afterwards.
22805 */
22806void
22807flash_complete_error (
22808 Flash *object,
22809 GDBusMethodInvocation *invocation)
22810{
22811 g_dbus_method_invocation_return_value (invocation,
22812 g_variant_new ("()"));
22813}
22814
22815/**
22816 * flash_complete_done:
22817 * @object: A #Flash.
22818 * @invocation: (transfer full): A #GDBusMethodInvocation.
22819 *
22820 * 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.
22821 *
22822 * This method will free @invocation, you cannot use it afterwards.
22823 */
22824void
22825flash_complete_done (
22826 Flash *object,
22827 GDBusMethodInvocation *invocation)
22828{
22829 g_dbus_method_invocation_return_value (invocation,
22830 g_variant_new ("()"));
22831}
22832
22833/**
Norman Jamesf066e872015-10-07 15:29:51 -050022834 * flash_complete_update_via_tftp:
22835 * @object: A #Flash.
22836 * @invocation: (transfer full): A #GDBusMethodInvocation.
22837 *
22838 * 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.
22839 *
22840 * This method will free @invocation, you cannot use it afterwards.
22841 */
22842void
22843flash_complete_update_via_tftp (
22844 Flash *object,
22845 GDBusMethodInvocation *invocation)
22846{
22847 g_dbus_method_invocation_return_value (invocation,
22848 g_variant_new ("()"));
22849}
22850
22851/**
Norman James362a80f2015-09-14 14:04:39 -050022852 * flash_complete_init:
22853 * @object: A #Flash.
22854 * @invocation: (transfer full): A #GDBusMethodInvocation.
22855 *
22856 * 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.
22857 *
22858 * This method will free @invocation, you cannot use it afterwards.
22859 */
22860void
22861flash_complete_init (
22862 Flash *object,
22863 GDBusMethodInvocation *invocation)
22864{
22865 g_dbus_method_invocation_return_value (invocation,
22866 g_variant_new ("()"));
22867}
22868
22869/* ------------------------------------------------------------------------ */
22870
22871/**
22872 * FlashProxy:
22873 *
22874 * The #FlashProxy structure contains only private data and should only be accessed using the provided API.
22875 */
22876
22877/**
22878 * FlashProxyClass:
22879 * @parent_class: The parent class.
22880 *
22881 * Class structure for #FlashProxy.
22882 */
22883
22884struct _FlashProxyPrivate
22885{
22886 GData *qdata;
22887};
22888
22889static void flash_proxy_iface_init (FlashIface *iface);
22890
22891#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
22892G_DEFINE_TYPE_WITH_CODE (FlashProxy, flash_proxy, G_TYPE_DBUS_PROXY,
22893 G_ADD_PRIVATE (FlashProxy)
22894 G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_proxy_iface_init));
22895
22896#else
22897G_DEFINE_TYPE_WITH_CODE (FlashProxy, flash_proxy, G_TYPE_DBUS_PROXY,
22898 G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_proxy_iface_init));
22899
22900#endif
22901static void
22902flash_proxy_finalize (GObject *object)
22903{
22904 FlashProxy *proxy = FLASH_PROXY (object);
22905 g_datalist_clear (&proxy->priv->qdata);
22906 G_OBJECT_CLASS (flash_proxy_parent_class)->finalize (object);
22907}
22908
22909static void
22910flash_proxy_get_property (GObject *object,
22911 guint prop_id,
22912 GValue *value,
22913 GParamSpec *pspec G_GNUC_UNUSED)
22914{
Norman James18998182015-10-11 21:54:53 -050022915 const _ExtendedGDBusPropertyInfo *info;
22916 GVariant *variant;
Norman James166acf42015-10-22 07:11:51 -050022917 g_assert (prop_id != 0 && prop_id - 1 < 5);
Norman James18998182015-10-11 21:54:53 -050022918 info = _flash_property_info_pointers[prop_id - 1];
22919 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
22920 if (info->use_gvariant)
22921 {
22922 g_value_set_variant (value, variant);
22923 }
22924 else
22925 {
22926 if (variant != NULL)
22927 g_dbus_gvariant_to_gvalue (variant, value);
22928 }
22929 if (variant != NULL)
22930 g_variant_unref (variant);
22931}
22932
22933static void
22934flash_proxy_set_property_cb (GDBusProxy *proxy,
22935 GAsyncResult *res,
22936 gpointer user_data)
22937{
22938 const _ExtendedGDBusPropertyInfo *info = user_data;
22939 GError *error;
22940 GVariant *_ret;
22941 error = NULL;
22942 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
22943 if (!_ret)
22944 {
22945 g_warning ("Error setting property '%s' on interface org.openbmc.Flash: %s (%s, %d)",
22946 info->parent_struct.name,
22947 error->message, g_quark_to_string (error->domain), error->code);
22948 g_error_free (error);
22949 }
22950 else
22951 {
22952 g_variant_unref (_ret);
22953 }
Norman James362a80f2015-09-14 14:04:39 -050022954}
22955
22956static void
22957flash_proxy_set_property (GObject *object,
22958 guint prop_id,
22959 const GValue *value,
22960 GParamSpec *pspec G_GNUC_UNUSED)
22961{
Norman James18998182015-10-11 21:54:53 -050022962 const _ExtendedGDBusPropertyInfo *info;
22963 GVariant *variant;
Norman James166acf42015-10-22 07:11:51 -050022964 g_assert (prop_id != 0 && prop_id - 1 < 5);
Norman James18998182015-10-11 21:54:53 -050022965 info = _flash_property_info_pointers[prop_id - 1];
22966 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
22967 g_dbus_proxy_call (G_DBUS_PROXY (object),
22968 "org.freedesktop.DBus.Properties.Set",
22969 g_variant_new ("(ssv)", "org.openbmc.Flash", info->parent_struct.name, variant),
22970 G_DBUS_CALL_FLAGS_NONE,
22971 -1,
22972 NULL, (GAsyncReadyCallback) flash_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
22973 g_variant_unref (variant);
Norman James362a80f2015-09-14 14:04:39 -050022974}
22975
22976static void
22977flash_proxy_g_signal (GDBusProxy *proxy,
22978 const gchar *sender_name G_GNUC_UNUSED,
22979 const gchar *signal_name,
22980 GVariant *parameters)
22981{
22982 _ExtendedGDBusSignalInfo *info;
22983 GVariantIter iter;
22984 GVariant *child;
22985 GValue *paramv;
22986 guint num_params;
22987 guint n;
22988 guint signal_id;
22989 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, signal_name);
22990 if (info == NULL)
22991 return;
22992 num_params = g_variant_n_children (parameters);
22993 paramv = g_new0 (GValue, num_params + 1);
22994 g_value_init (&paramv[0], TYPE_FLASH);
22995 g_value_set_object (&paramv[0], proxy);
22996 g_variant_iter_init (&iter, parameters);
22997 n = 1;
22998 while ((child = g_variant_iter_next_value (&iter)) != NULL)
22999 {
23000 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
23001 if (arg_info->use_gvariant)
23002 {
23003 g_value_init (&paramv[n], G_TYPE_VARIANT);
23004 g_value_set_variant (&paramv[n], child);
23005 n++;
23006 }
23007 else
23008 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
23009 g_variant_unref (child);
23010 }
23011 signal_id = g_signal_lookup (info->signal_name, TYPE_FLASH);
23012 g_signal_emitv (paramv, signal_id, 0, NULL);
23013 for (n = 0; n < num_params + 1; n++)
23014 g_value_unset (&paramv[n]);
23015 g_free (paramv);
23016}
23017
23018static void
23019flash_proxy_g_properties_changed (GDBusProxy *_proxy,
23020 GVariant *changed_properties,
23021 const gchar *const *invalidated_properties)
23022{
23023 FlashProxy *proxy = FLASH_PROXY (_proxy);
23024 guint n;
23025 const gchar *key;
23026 GVariantIter *iter;
23027 _ExtendedGDBusPropertyInfo *info;
23028 g_variant_get (changed_properties, "a{sv}", &iter);
23029 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
23030 {
23031 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, key);
23032 g_datalist_remove_data (&proxy->priv->qdata, key);
23033 if (info != NULL)
23034 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
23035 }
23036 g_variant_iter_free (iter);
23037 for (n = 0; invalidated_properties[n] != NULL; n++)
23038 {
23039 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, invalidated_properties[n]);
23040 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
23041 if (info != NULL)
23042 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
23043 }
23044}
23045
Norman James18998182015-10-11 21:54:53 -050023046static const gchar *
23047flash_proxy_get_filename (Flash *object)
23048{
23049 FlashProxy *proxy = FLASH_PROXY (object);
23050 GVariant *variant;
23051 const gchar *value = NULL;
23052 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "filename");
23053 if (variant != NULL)
23054 {
23055 value = g_variant_get_string (variant, NULL);
23056 g_variant_unref (variant);
23057 }
23058 return value;
23059}
23060
23061static const gchar *
23062flash_proxy_get_flasher_path (Flash *object)
23063{
23064 FlashProxy *proxy = FLASH_PROXY (object);
23065 GVariant *variant;
23066 const gchar *value = NULL;
23067 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "flasher_path");
23068 if (variant != NULL)
23069 {
23070 value = g_variant_get_string (variant, NULL);
23071 g_variant_unref (variant);
23072 }
23073 return value;
23074}
23075
23076static const gchar *
23077flash_proxy_get_flasher_name (Flash *object)
23078{
23079 FlashProxy *proxy = FLASH_PROXY (object);
23080 GVariant *variant;
23081 const gchar *value = NULL;
23082 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "flasher_name");
23083 if (variant != NULL)
23084 {
23085 value = g_variant_get_string (variant, NULL);
23086 g_variant_unref (variant);
23087 }
23088 return value;
23089}
23090
23091static const gchar *
23092flash_proxy_get_flasher_instance (Flash *object)
23093{
23094 FlashProxy *proxy = FLASH_PROXY (object);
23095 GVariant *variant;
23096 const gchar *value = NULL;
23097 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "flasher_instance");
23098 if (variant != NULL)
23099 {
23100 value = g_variant_get_string (variant, NULL);
23101 g_variant_unref (variant);
23102 }
23103 return value;
23104}
23105
Norman James166acf42015-10-22 07:11:51 -050023106static const gchar *
23107flash_proxy_get_status (Flash *object)
23108{
23109 FlashProxy *proxy = FLASH_PROXY (object);
23110 GVariant *variant;
23111 const gchar *value = NULL;
23112 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "status");
23113 if (variant != NULL)
23114 {
23115 value = g_variant_get_string (variant, NULL);
23116 g_variant_unref (variant);
23117 }
23118 return value;
23119}
23120
Norman James362a80f2015-09-14 14:04:39 -050023121static void
23122flash_proxy_init (FlashProxy *proxy)
23123{
23124#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
23125 proxy->priv = flash_proxy_get_instance_private (proxy);
23126#else
23127 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_FLASH_PROXY, FlashProxyPrivate);
23128#endif
23129
23130 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), flash_interface_info ());
23131}
23132
23133static void
23134flash_proxy_class_init (FlashProxyClass *klass)
23135{
23136 GObjectClass *gobject_class;
23137 GDBusProxyClass *proxy_class;
23138
23139 gobject_class = G_OBJECT_CLASS (klass);
23140 gobject_class->finalize = flash_proxy_finalize;
23141 gobject_class->get_property = flash_proxy_get_property;
23142 gobject_class->set_property = flash_proxy_set_property;
23143
23144 proxy_class = G_DBUS_PROXY_CLASS (klass);
23145 proxy_class->g_signal = flash_proxy_g_signal;
23146 proxy_class->g_properties_changed = flash_proxy_g_properties_changed;
23147
Norman James18998182015-10-11 21:54:53 -050023148 flash_override_properties (gobject_class, 1);
23149
Norman James362a80f2015-09-14 14:04:39 -050023150#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
23151 g_type_class_add_private (klass, sizeof (FlashProxyPrivate));
23152#endif
23153}
23154
23155static void
23156flash_proxy_iface_init (FlashIface *iface)
23157{
Norman James18998182015-10-11 21:54:53 -050023158 iface->get_filename = flash_proxy_get_filename;
23159 iface->get_flasher_path = flash_proxy_get_flasher_path;
23160 iface->get_flasher_name = flash_proxy_get_flasher_name;
23161 iface->get_flasher_instance = flash_proxy_get_flasher_instance;
Norman James166acf42015-10-22 07:11:51 -050023162 iface->get_status = flash_proxy_get_status;
Norman James362a80f2015-09-14 14:04:39 -050023163}
23164
23165/**
23166 * flash_proxy_new:
23167 * @connection: A #GDBusConnection.
23168 * @flags: Flags from the #GDBusProxyFlags enumeration.
23169 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
23170 * @object_path: An object path.
23171 * @cancellable: (allow-none): A #GCancellable or %NULL.
23172 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
23173 * @user_data: User data to pass to @callback.
23174 *
23175 * 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.
23176 *
23177 * 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.
23178 * You can then call flash_proxy_new_finish() to get the result of the operation.
23179 *
23180 * See flash_proxy_new_sync() for the synchronous, blocking version of this constructor.
23181 */
23182void
23183flash_proxy_new (
23184 GDBusConnection *connection,
23185 GDBusProxyFlags flags,
23186 const gchar *name,
23187 const gchar *object_path,
23188 GCancellable *cancellable,
23189 GAsyncReadyCallback callback,
23190 gpointer user_data)
23191{
23192 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);
23193}
23194
23195/**
23196 * flash_proxy_new_finish:
23197 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_proxy_new().
23198 * @error: Return location for error or %NULL
23199 *
23200 * Finishes an operation started with flash_proxy_new().
23201 *
23202 * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set.
23203 */
23204Flash *
23205flash_proxy_new_finish (
23206 GAsyncResult *res,
23207 GError **error)
23208{
23209 GObject *ret;
23210 GObject *source_object;
23211 source_object = g_async_result_get_source_object (res);
23212 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
23213 g_object_unref (source_object);
23214 if (ret != NULL)
23215 return FLASH (ret);
23216 else
23217 return NULL;
23218}
23219
23220/**
23221 * flash_proxy_new_sync:
23222 * @connection: A #GDBusConnection.
23223 * @flags: Flags from the #GDBusProxyFlags enumeration.
23224 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
23225 * @object_path: An object path.
23226 * @cancellable: (allow-none): A #GCancellable or %NULL.
23227 * @error: Return location for error or %NULL
23228 *
23229 * 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.
23230 *
23231 * The calling thread is blocked until a reply is received.
23232 *
23233 * See flash_proxy_new() for the asynchronous version of this constructor.
23234 *
23235 * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set.
23236 */
23237Flash *
23238flash_proxy_new_sync (
23239 GDBusConnection *connection,
23240 GDBusProxyFlags flags,
23241 const gchar *name,
23242 const gchar *object_path,
23243 GCancellable *cancellable,
23244 GError **error)
23245{
23246 GInitable *ret;
23247 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);
23248 if (ret != NULL)
23249 return FLASH (ret);
23250 else
23251 return NULL;
23252}
23253
23254
23255/**
23256 * flash_proxy_new_for_bus:
23257 * @bus_type: A #GBusType.
23258 * @flags: Flags from the #GDBusProxyFlags enumeration.
23259 * @name: A bus name (well-known or unique).
23260 * @object_path: An object path.
23261 * @cancellable: (allow-none): A #GCancellable or %NULL.
23262 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
23263 * @user_data: User data to pass to @callback.
23264 *
23265 * Like flash_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
23266 *
23267 * 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.
23268 * You can then call flash_proxy_new_for_bus_finish() to get the result of the operation.
23269 *
23270 * See flash_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
23271 */
23272void
23273flash_proxy_new_for_bus (
23274 GBusType bus_type,
23275 GDBusProxyFlags flags,
23276 const gchar *name,
23277 const gchar *object_path,
23278 GCancellable *cancellable,
23279 GAsyncReadyCallback callback,
23280 gpointer user_data)
23281{
23282 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);
23283}
23284
23285/**
23286 * flash_proxy_new_for_bus_finish:
23287 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_proxy_new_for_bus().
23288 * @error: Return location for error or %NULL
23289 *
23290 * Finishes an operation started with flash_proxy_new_for_bus().
23291 *
23292 * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set.
23293 */
23294Flash *
23295flash_proxy_new_for_bus_finish (
23296 GAsyncResult *res,
23297 GError **error)
23298{
23299 GObject *ret;
23300 GObject *source_object;
23301 source_object = g_async_result_get_source_object (res);
23302 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
23303 g_object_unref (source_object);
23304 if (ret != NULL)
23305 return FLASH (ret);
23306 else
23307 return NULL;
23308}
23309
23310/**
23311 * flash_proxy_new_for_bus_sync:
23312 * @bus_type: A #GBusType.
23313 * @flags: Flags from the #GDBusProxyFlags enumeration.
23314 * @name: A bus name (well-known or unique).
23315 * @object_path: An object path.
23316 * @cancellable: (allow-none): A #GCancellable or %NULL.
23317 * @error: Return location for error or %NULL
23318 *
23319 * Like flash_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
23320 *
23321 * The calling thread is blocked until a reply is received.
23322 *
23323 * See flash_proxy_new_for_bus() for the asynchronous version of this constructor.
23324 *
23325 * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set.
23326 */
23327Flash *
23328flash_proxy_new_for_bus_sync (
23329 GBusType bus_type,
23330 GDBusProxyFlags flags,
23331 const gchar *name,
23332 const gchar *object_path,
23333 GCancellable *cancellable,
23334 GError **error)
23335{
23336 GInitable *ret;
23337 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);
23338 if (ret != NULL)
23339 return FLASH (ret);
23340 else
23341 return NULL;
23342}
23343
23344
23345/* ------------------------------------------------------------------------ */
23346
23347/**
23348 * FlashSkeleton:
23349 *
23350 * The #FlashSkeleton structure contains only private data and should only be accessed using the provided API.
23351 */
23352
23353/**
23354 * FlashSkeletonClass:
23355 * @parent_class: The parent class.
23356 *
23357 * Class structure for #FlashSkeleton.
23358 */
23359
23360struct _FlashSkeletonPrivate
23361{
23362 GValue *properties;
23363 GList *changed_properties;
23364 GSource *changed_properties_idle_source;
23365 GMainContext *context;
23366 GMutex lock;
23367};
23368
23369static void
23370_flash_skeleton_handle_method_call (
23371 GDBusConnection *connection G_GNUC_UNUSED,
23372 const gchar *sender G_GNUC_UNUSED,
23373 const gchar *object_path G_GNUC_UNUSED,
23374 const gchar *interface_name,
23375 const gchar *method_name,
23376 GVariant *parameters,
23377 GDBusMethodInvocation *invocation,
23378 gpointer user_data)
23379{
23380 FlashSkeleton *skeleton = FLASH_SKELETON (user_data);
23381 _ExtendedGDBusMethodInfo *info;
23382 GVariantIter iter;
23383 GVariant *child;
23384 GValue *paramv;
23385 guint num_params;
23386 guint num_extra;
23387 guint n;
23388 guint signal_id;
23389 GValue return_value = G_VALUE_INIT;
23390 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
23391 g_assert (info != NULL);
23392 num_params = g_variant_n_children (parameters);
23393 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
23394 n = 0;
23395 g_value_init (&paramv[n], TYPE_FLASH);
23396 g_value_set_object (&paramv[n++], skeleton);
23397 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
23398 g_value_set_object (&paramv[n++], invocation);
23399 if (info->pass_fdlist)
23400 {
23401#ifdef G_OS_UNIX
23402 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
23403 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
23404#else
23405 g_assert_not_reached ();
23406#endif
23407 }
23408 g_variant_iter_init (&iter, parameters);
23409 while ((child = g_variant_iter_next_value (&iter)) != NULL)
23410 {
23411 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
23412 if (arg_info->use_gvariant)
23413 {
23414 g_value_init (&paramv[n], G_TYPE_VARIANT);
23415 g_value_set_variant (&paramv[n], child);
23416 n++;
23417 }
23418 else
23419 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
23420 g_variant_unref (child);
23421 }
23422 signal_id = g_signal_lookup (info->signal_name, TYPE_FLASH);
23423 g_value_init (&return_value, G_TYPE_BOOLEAN);
23424 g_signal_emitv (paramv, signal_id, 0, &return_value);
23425 if (!g_value_get_boolean (&return_value))
23426 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);
23427 g_value_unset (&return_value);
23428 for (n = 0; n < num_params + num_extra; n++)
23429 g_value_unset (&paramv[n]);
23430 g_free (paramv);
23431}
23432
23433static GVariant *
23434_flash_skeleton_handle_get_property (
23435 GDBusConnection *connection G_GNUC_UNUSED,
23436 const gchar *sender G_GNUC_UNUSED,
23437 const gchar *object_path G_GNUC_UNUSED,
23438 const gchar *interface_name G_GNUC_UNUSED,
23439 const gchar *property_name,
23440 GError **error,
23441 gpointer user_data)
23442{
23443 FlashSkeleton *skeleton = FLASH_SKELETON (user_data);
23444 GValue value = G_VALUE_INIT;
23445 GParamSpec *pspec;
23446 _ExtendedGDBusPropertyInfo *info;
23447 GVariant *ret;
23448 ret = NULL;
23449 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, property_name);
23450 g_assert (info != NULL);
23451 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
23452 if (pspec == NULL)
23453 {
23454 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
23455 }
23456 else
23457 {
23458 g_value_init (&value, pspec->value_type);
23459 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
23460 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
23461 g_value_unset (&value);
23462 }
23463 return ret;
23464}
23465
23466static gboolean
23467_flash_skeleton_handle_set_property (
23468 GDBusConnection *connection G_GNUC_UNUSED,
23469 const gchar *sender G_GNUC_UNUSED,
23470 const gchar *object_path G_GNUC_UNUSED,
23471 const gchar *interface_name G_GNUC_UNUSED,
23472 const gchar *property_name,
23473 GVariant *variant,
23474 GError **error,
23475 gpointer user_data)
23476{
23477 FlashSkeleton *skeleton = FLASH_SKELETON (user_data);
23478 GValue value = G_VALUE_INIT;
23479 GParamSpec *pspec;
23480 _ExtendedGDBusPropertyInfo *info;
23481 gboolean ret;
23482 ret = FALSE;
23483 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, property_name);
23484 g_assert (info != NULL);
23485 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
23486 if (pspec == NULL)
23487 {
23488 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
23489 }
23490 else
23491 {
23492 if (info->use_gvariant)
23493 g_value_set_variant (&value, variant);
23494 else
23495 g_dbus_gvariant_to_gvalue (variant, &value);
23496 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
23497 g_value_unset (&value);
23498 ret = TRUE;
23499 }
23500 return ret;
23501}
23502
23503static const GDBusInterfaceVTable _flash_skeleton_vtable =
23504{
23505 _flash_skeleton_handle_method_call,
23506 _flash_skeleton_handle_get_property,
23507 _flash_skeleton_handle_set_property,
23508 {NULL}
23509};
23510
23511static GDBusInterfaceInfo *
23512flash_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
23513{
23514 return flash_interface_info ();
23515}
23516
23517static GDBusInterfaceVTable *
23518flash_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
23519{
23520 return (GDBusInterfaceVTable *) &_flash_skeleton_vtable;
23521}
23522
23523static GVariant *
23524flash_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
23525{
23526 FlashSkeleton *skeleton = FLASH_SKELETON (_skeleton);
23527
23528 GVariantBuilder builder;
23529 guint n;
23530 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
23531 if (_flash_interface_info.parent_struct.properties == NULL)
23532 goto out;
23533 for (n = 0; _flash_interface_info.parent_struct.properties[n] != NULL; n++)
23534 {
23535 GDBusPropertyInfo *info = _flash_interface_info.parent_struct.properties[n];
23536 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
23537 {
23538 GVariant *value;
23539 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);
23540 if (value != NULL)
23541 {
23542 g_variant_take_ref (value);
23543 g_variant_builder_add (&builder, "{sv}", info->name, value);
23544 g_variant_unref (value);
23545 }
23546 }
23547 }
23548out:
23549 return g_variant_builder_end (&builder);
23550}
23551
Norman James18998182015-10-11 21:54:53 -050023552static gboolean _flash_emit_changed (gpointer user_data);
23553
Norman James362a80f2015-09-14 14:04:39 -050023554static void
23555flash_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
23556{
Norman James18998182015-10-11 21:54:53 -050023557 FlashSkeleton *skeleton = FLASH_SKELETON (_skeleton);
23558 gboolean emit_changed = FALSE;
23559
23560 g_mutex_lock (&skeleton->priv->lock);
23561 if (skeleton->priv->changed_properties_idle_source != NULL)
23562 {
23563 g_source_destroy (skeleton->priv->changed_properties_idle_source);
23564 skeleton->priv->changed_properties_idle_source = NULL;
23565 emit_changed = TRUE;
23566 }
23567 g_mutex_unlock (&skeleton->priv->lock);
23568
23569 if (emit_changed)
23570 _flash_emit_changed (skeleton);
Norman James362a80f2015-09-14 14:04:39 -050023571}
23572
23573static void
23574_flash_on_signal_updated (
23575 Flash *object)
23576{
23577 FlashSkeleton *skeleton = FLASH_SKELETON (object);
23578
23579 GList *connections, *l;
23580 GVariant *signal_variant;
23581 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
23582
23583 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
23584 for (l = connections; l != NULL; l = l->next)
23585 {
23586 GDBusConnection *connection = l->data;
23587 g_dbus_connection_emit_signal (connection,
23588 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Flash", "Updated",
23589 signal_variant, NULL);
23590 }
23591 g_variant_unref (signal_variant);
23592 g_list_free_full (connections, g_object_unref);
23593}
23594
Norman Jamesf066e872015-10-07 15:29:51 -050023595static void
23596_flash_on_signal_download (
23597 Flash *object,
23598 const gchar *arg_url,
23599 const gchar *arg_filename)
23600{
23601 FlashSkeleton *skeleton = FLASH_SKELETON (object);
23602
23603 GList *connections, *l;
23604 GVariant *signal_variant;
23605 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
23606
23607 signal_variant = g_variant_ref_sink (g_variant_new ("(ss)",
23608 arg_url,
23609 arg_filename));
23610 for (l = connections; l != NULL; l = l->next)
23611 {
23612 GDBusConnection *connection = l->data;
23613 g_dbus_connection_emit_signal (connection,
23614 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Flash", "Download",
23615 signal_variant, NULL);
23616 }
23617 g_variant_unref (signal_variant);
23618 g_list_free_full (connections, g_object_unref);
23619}
23620
Norman James362a80f2015-09-14 14:04:39 -050023621static void flash_skeleton_iface_init (FlashIface *iface);
23622#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
23623G_DEFINE_TYPE_WITH_CODE (FlashSkeleton, flash_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
23624 G_ADD_PRIVATE (FlashSkeleton)
23625 G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_skeleton_iface_init));
23626
23627#else
23628G_DEFINE_TYPE_WITH_CODE (FlashSkeleton, flash_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
23629 G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_skeleton_iface_init));
23630
23631#endif
23632static void
23633flash_skeleton_finalize (GObject *object)
23634{
23635 FlashSkeleton *skeleton = FLASH_SKELETON (object);
Norman James18998182015-10-11 21:54:53 -050023636 guint n;
Norman James166acf42015-10-22 07:11:51 -050023637 for (n = 0; n < 5; n++)
Norman James18998182015-10-11 21:54:53 -050023638 g_value_unset (&skeleton->priv->properties[n]);
23639 g_free (skeleton->priv->properties);
Norman James362a80f2015-09-14 14:04:39 -050023640 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
23641 if (skeleton->priv->changed_properties_idle_source != NULL)
23642 g_source_destroy (skeleton->priv->changed_properties_idle_source);
23643 g_main_context_unref (skeleton->priv->context);
23644 g_mutex_clear (&skeleton->priv->lock);
23645 G_OBJECT_CLASS (flash_skeleton_parent_class)->finalize (object);
23646}
23647
23648static void
Norman James18998182015-10-11 21:54:53 -050023649flash_skeleton_get_property (GObject *object,
23650 guint prop_id,
23651 GValue *value,
23652 GParamSpec *pspec G_GNUC_UNUSED)
23653{
23654 FlashSkeleton *skeleton = FLASH_SKELETON (object);
Norman James166acf42015-10-22 07:11:51 -050023655 g_assert (prop_id != 0 && prop_id - 1 < 5);
Norman James18998182015-10-11 21:54:53 -050023656 g_mutex_lock (&skeleton->priv->lock);
23657 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
23658 g_mutex_unlock (&skeleton->priv->lock);
23659}
23660
23661static gboolean
23662_flash_emit_changed (gpointer user_data)
23663{
23664 FlashSkeleton *skeleton = FLASH_SKELETON (user_data);
23665 GList *l;
23666 GVariantBuilder builder;
23667 GVariantBuilder invalidated_builder;
23668 guint num_changes;
23669
23670 g_mutex_lock (&skeleton->priv->lock);
23671 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
23672 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
23673 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
23674 {
23675 ChangedProperty *cp = l->data;
23676 GVariant *variant;
23677 const GValue *cur_value;
23678
23679 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
23680 if (!_g_value_equal (cur_value, &cp->orig_value))
23681 {
23682 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
23683 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
23684 g_variant_unref (variant);
23685 num_changes++;
23686 }
23687 }
23688 if (num_changes > 0)
23689 {
23690 GList *connections, *ll;
23691 GVariant *signal_variant;
23692 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Flash",
23693 &builder, &invalidated_builder));
23694 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
23695 for (ll = connections; ll != NULL; ll = ll->next)
23696 {
23697 GDBusConnection *connection = ll->data;
23698
23699 g_dbus_connection_emit_signal (connection,
23700 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
23701 "org.freedesktop.DBus.Properties",
23702 "PropertiesChanged",
23703 signal_variant,
23704 NULL);
23705 }
23706 g_variant_unref (signal_variant);
23707 g_list_free_full (connections, g_object_unref);
23708 }
23709 else
23710 {
23711 g_variant_builder_clear (&builder);
23712 g_variant_builder_clear (&invalidated_builder);
23713 }
23714 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
23715 skeleton->priv->changed_properties = NULL;
23716 skeleton->priv->changed_properties_idle_source = NULL;
23717 g_mutex_unlock (&skeleton->priv->lock);
23718 return FALSE;
23719}
23720
23721static void
23722_flash_schedule_emit_changed (FlashSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
23723{
23724 ChangedProperty *cp;
23725 GList *l;
23726 cp = NULL;
23727 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
23728 {
23729 ChangedProperty *i_cp = l->data;
23730 if (i_cp->info == info)
23731 {
23732 cp = i_cp;
23733 break;
23734 }
23735 }
23736 if (cp == NULL)
23737 {
23738 cp = g_new0 (ChangedProperty, 1);
23739 cp->prop_id = prop_id;
23740 cp->info = info;
23741 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
23742 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
23743 g_value_copy (orig_value, &cp->orig_value);
23744 }
23745}
23746
23747static void
23748flash_skeleton_notify (GObject *object,
23749 GParamSpec *pspec G_GNUC_UNUSED)
23750{
23751 FlashSkeleton *skeleton = FLASH_SKELETON (object);
23752 g_mutex_lock (&skeleton->priv->lock);
23753 if (skeleton->priv->changed_properties != NULL &&
23754 skeleton->priv->changed_properties_idle_source == NULL)
23755 {
23756 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
23757 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
23758 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _flash_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
23759 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
23760 g_source_unref (skeleton->priv->changed_properties_idle_source);
23761 }
23762 g_mutex_unlock (&skeleton->priv->lock);
23763}
23764
23765static void
23766flash_skeleton_set_property (GObject *object,
23767 guint prop_id,
23768 const GValue *value,
23769 GParamSpec *pspec)
23770{
23771 FlashSkeleton *skeleton = FLASH_SKELETON (object);
Norman James166acf42015-10-22 07:11:51 -050023772 g_assert (prop_id != 0 && prop_id - 1 < 5);
Norman James18998182015-10-11 21:54:53 -050023773 g_mutex_lock (&skeleton->priv->lock);
23774 g_object_freeze_notify (object);
23775 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
23776 {
23777 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
23778 _flash_schedule_emit_changed (skeleton, _flash_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
23779 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
23780 g_object_notify_by_pspec (object, pspec);
23781 }
23782 g_mutex_unlock (&skeleton->priv->lock);
23783 g_object_thaw_notify (object);
23784}
23785
23786static void
Norman James362a80f2015-09-14 14:04:39 -050023787flash_skeleton_init (FlashSkeleton *skeleton)
23788{
23789#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
23790 skeleton->priv = flash_skeleton_get_instance_private (skeleton);
23791#else
23792 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_FLASH_SKELETON, FlashSkeletonPrivate);
23793#endif
23794
23795 g_mutex_init (&skeleton->priv->lock);
23796 skeleton->priv->context = g_main_context_ref_thread_default ();
Norman James166acf42015-10-22 07:11:51 -050023797 skeleton->priv->properties = g_new0 (GValue, 5);
Norman James18998182015-10-11 21:54:53 -050023798 g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING);
23799 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
23800 g_value_init (&skeleton->priv->properties[2], G_TYPE_STRING);
23801 g_value_init (&skeleton->priv->properties[3], G_TYPE_STRING);
Norman James166acf42015-10-22 07:11:51 -050023802 g_value_init (&skeleton->priv->properties[4], G_TYPE_STRING);
Norman James18998182015-10-11 21:54:53 -050023803}
23804
23805static const gchar *
23806flash_skeleton_get_filename (Flash *object)
23807{
23808 FlashSkeleton *skeleton = FLASH_SKELETON (object);
23809 const gchar *value;
23810 g_mutex_lock (&skeleton->priv->lock);
23811 value = g_value_get_string (&(skeleton->priv->properties[0]));
23812 g_mutex_unlock (&skeleton->priv->lock);
23813 return value;
23814}
23815
23816static const gchar *
23817flash_skeleton_get_flasher_path (Flash *object)
23818{
23819 FlashSkeleton *skeleton = FLASH_SKELETON (object);
23820 const gchar *value;
23821 g_mutex_lock (&skeleton->priv->lock);
23822 value = g_value_get_string (&(skeleton->priv->properties[1]));
23823 g_mutex_unlock (&skeleton->priv->lock);
23824 return value;
23825}
23826
23827static const gchar *
23828flash_skeleton_get_flasher_name (Flash *object)
23829{
23830 FlashSkeleton *skeleton = FLASH_SKELETON (object);
23831 const gchar *value;
23832 g_mutex_lock (&skeleton->priv->lock);
23833 value = g_value_get_string (&(skeleton->priv->properties[2]));
23834 g_mutex_unlock (&skeleton->priv->lock);
23835 return value;
23836}
23837
23838static const gchar *
23839flash_skeleton_get_flasher_instance (Flash *object)
23840{
23841 FlashSkeleton *skeleton = FLASH_SKELETON (object);
23842 const gchar *value;
23843 g_mutex_lock (&skeleton->priv->lock);
23844 value = g_value_get_string (&(skeleton->priv->properties[3]));
23845 g_mutex_unlock (&skeleton->priv->lock);
23846 return value;
Norman James362a80f2015-09-14 14:04:39 -050023847}
23848
Norman James166acf42015-10-22 07:11:51 -050023849static const gchar *
23850flash_skeleton_get_status (Flash *object)
23851{
23852 FlashSkeleton *skeleton = FLASH_SKELETON (object);
23853 const gchar *value;
23854 g_mutex_lock (&skeleton->priv->lock);
23855 value = g_value_get_string (&(skeleton->priv->properties[4]));
23856 g_mutex_unlock (&skeleton->priv->lock);
23857 return value;
23858}
23859
Norman James362a80f2015-09-14 14:04:39 -050023860static void
23861flash_skeleton_class_init (FlashSkeletonClass *klass)
23862{
23863 GObjectClass *gobject_class;
23864 GDBusInterfaceSkeletonClass *skeleton_class;
23865
23866 gobject_class = G_OBJECT_CLASS (klass);
23867 gobject_class->finalize = flash_skeleton_finalize;
Norman James18998182015-10-11 21:54:53 -050023868 gobject_class->get_property = flash_skeleton_get_property;
23869 gobject_class->set_property = flash_skeleton_set_property;
23870 gobject_class->notify = flash_skeleton_notify;
23871
23872
23873 flash_override_properties (gobject_class, 1);
Norman James362a80f2015-09-14 14:04:39 -050023874
23875 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
23876 skeleton_class->get_info = flash_skeleton_dbus_interface_get_info;
23877 skeleton_class->get_properties = flash_skeleton_dbus_interface_get_properties;
23878 skeleton_class->flush = flash_skeleton_dbus_interface_flush;
23879 skeleton_class->get_vtable = flash_skeleton_dbus_interface_get_vtable;
23880
23881#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
23882 g_type_class_add_private (klass, sizeof (FlashSkeletonPrivate));
23883#endif
23884}
23885
23886static void
23887flash_skeleton_iface_init (FlashIface *iface)
23888{
23889 iface->updated = _flash_on_signal_updated;
Norman Jamesf066e872015-10-07 15:29:51 -050023890 iface->download = _flash_on_signal_download;
Norman James18998182015-10-11 21:54:53 -050023891 iface->get_filename = flash_skeleton_get_filename;
23892 iface->get_flasher_path = flash_skeleton_get_flasher_path;
23893 iface->get_flasher_name = flash_skeleton_get_flasher_name;
23894 iface->get_flasher_instance = flash_skeleton_get_flasher_instance;
Norman James166acf42015-10-22 07:11:51 -050023895 iface->get_status = flash_skeleton_get_status;
Norman James362a80f2015-09-14 14:04:39 -050023896}
23897
23898/**
23899 * flash_skeleton_new:
23900 *
23901 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>.
23902 *
23903 * Returns: (transfer full) (type FlashSkeleton): The skeleton object.
23904 */
23905Flash *
23906flash_skeleton_new (void)
23907{
23908 return FLASH (g_object_new (TYPE_FLASH_SKELETON, NULL));
23909}
23910
23911/* ------------------------------------------------------------------------
Norman James18998182015-10-11 21:54:53 -050023912 * Code for interface org.openbmc.FlashControl
23913 * ------------------------------------------------------------------------
23914 */
23915
23916/**
23917 * SECTION:FlashControl
23918 * @title: FlashControl
23919 * @short_description: Generated C code for the org.openbmc.FlashControl D-Bus interface
23920 *
23921 * 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.
23922 */
23923
23924/* ---- Introspection data for org.openbmc.FlashControl ---- */
23925
23926static const _ExtendedGDBusArgInfo _flash_control_method_info_flash_IN_ARG_type =
23927{
23928 {
23929 -1,
23930 (gchar *) "type",
23931 (gchar *) "s",
23932 NULL
23933 },
23934 FALSE
23935};
23936
23937static const _ExtendedGDBusArgInfo _flash_control_method_info_flash_IN_ARG_filename =
23938{
23939 {
23940 -1,
23941 (gchar *) "filename",
23942 (gchar *) "s",
23943 NULL
23944 },
23945 FALSE
23946};
23947
23948static const _ExtendedGDBusArgInfo * const _flash_control_method_info_flash_IN_ARG_pointers[] =
23949{
23950 &_flash_control_method_info_flash_IN_ARG_type,
23951 &_flash_control_method_info_flash_IN_ARG_filename,
23952 NULL
23953};
23954
23955static const _ExtendedGDBusMethodInfo _flash_control_method_info_flash =
23956{
23957 {
23958 -1,
23959 (gchar *) "flash",
23960 (GDBusArgInfo **) &_flash_control_method_info_flash_IN_ARG_pointers,
23961 NULL,
23962 NULL
23963 },
23964 "handle-flash",
23965 FALSE
23966};
23967
23968static const _ExtendedGDBusMethodInfo * const _flash_control_method_info_pointers[] =
23969{
23970 &_flash_control_method_info_flash,
23971 NULL
23972};
23973
23974static const _ExtendedGDBusArgInfo _flash_control_signal_info_done_ARG_filename =
23975{
23976 {
23977 -1,
23978 (gchar *) "filename",
23979 (gchar *) "s",
23980 NULL
23981 },
23982 FALSE
23983};
23984
23985static const _ExtendedGDBusArgInfo * const _flash_control_signal_info_done_ARG_pointers[] =
23986{
23987 &_flash_control_signal_info_done_ARG_filename,
23988 NULL
23989};
23990
23991static const _ExtendedGDBusSignalInfo _flash_control_signal_info_done =
23992{
23993 {
23994 -1,
23995 (gchar *) "Done",
23996 (GDBusArgInfo **) &_flash_control_signal_info_done_ARG_pointers,
23997 NULL
23998 },
23999 "done"
24000};
24001
24002static const _ExtendedGDBusArgInfo _flash_control_signal_info_error_ARG_filename =
24003{
24004 {
24005 -1,
24006 (gchar *) "filename",
24007 (gchar *) "s",
24008 NULL
24009 },
24010 FALSE
24011};
24012
24013static const _ExtendedGDBusArgInfo * const _flash_control_signal_info_error_ARG_pointers[] =
24014{
24015 &_flash_control_signal_info_error_ARG_filename,
24016 NULL
24017};
24018
24019static const _ExtendedGDBusSignalInfo _flash_control_signal_info_error =
24020{
24021 {
24022 -1,
24023 (gchar *) "Error",
24024 (GDBusArgInfo **) &_flash_control_signal_info_error_ARG_pointers,
24025 NULL
24026 },
24027 "error"
24028};
24029
24030static const _ExtendedGDBusArgInfo _flash_control_signal_info_progress_ARG_filename =
24031{
24032 {
24033 -1,
24034 (gchar *) "filename",
24035 (gchar *) "s",
24036 NULL
24037 },
24038 FALSE
24039};
24040
24041static const _ExtendedGDBusArgInfo _flash_control_signal_info_progress_ARG_progress =
24042{
24043 {
24044 -1,
24045 (gchar *) "progress",
24046 (gchar *) "y",
24047 NULL
24048 },
24049 FALSE
24050};
24051
24052static const _ExtendedGDBusArgInfo * const _flash_control_signal_info_progress_ARG_pointers[] =
24053{
24054 &_flash_control_signal_info_progress_ARG_filename,
24055 &_flash_control_signal_info_progress_ARG_progress,
24056 NULL
24057};
24058
24059static const _ExtendedGDBusSignalInfo _flash_control_signal_info_progress =
24060{
24061 {
24062 -1,
24063 (gchar *) "Progress",
24064 (GDBusArgInfo **) &_flash_control_signal_info_progress_ARG_pointers,
24065 NULL
24066 },
24067 "progress"
24068};
24069
24070static const _ExtendedGDBusSignalInfo * const _flash_control_signal_info_pointers[] =
24071{
24072 &_flash_control_signal_info_done,
24073 &_flash_control_signal_info_error,
24074 &_flash_control_signal_info_progress,
24075 NULL
24076};
24077
24078static const _ExtendedGDBusPropertyInfo _flash_control_property_info_filename =
24079{
24080 {
24081 -1,
24082 (gchar *) "filename",
24083 (gchar *) "s",
24084 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
24085 NULL
24086 },
24087 "filename",
24088 FALSE
24089};
24090
24091static const _ExtendedGDBusPropertyInfo _flash_control_property_info_type_ =
24092{
24093 {
24094 -1,
24095 (gchar *) "type",
24096 (gchar *) "s",
24097 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
24098 NULL
24099 },
24100 "type",
24101 FALSE
24102};
24103
24104static const _ExtendedGDBusPropertyInfo * const _flash_control_property_info_pointers[] =
24105{
24106 &_flash_control_property_info_filename,
24107 &_flash_control_property_info_type_,
24108 NULL
24109};
24110
24111static const _ExtendedGDBusInterfaceInfo _flash_control_interface_info =
24112{
24113 {
24114 -1,
24115 (gchar *) "org.openbmc.FlashControl",
24116 (GDBusMethodInfo **) &_flash_control_method_info_pointers,
24117 (GDBusSignalInfo **) &_flash_control_signal_info_pointers,
24118 (GDBusPropertyInfo **) &_flash_control_property_info_pointers,
24119 NULL
24120 },
24121 "flash-control",
24122};
24123
24124
24125/**
24126 * flash_control_interface_info:
24127 *
24128 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link> D-Bus interface.
24129 *
24130 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
24131 */
24132GDBusInterfaceInfo *
24133flash_control_interface_info (void)
24134{
24135 return (GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct;
24136}
24137
24138/**
24139 * flash_control_override_properties:
24140 * @klass: The class structure for a #GObject<!-- -->-derived class.
24141 * @property_id_begin: The property id to assign to the first overridden property.
24142 *
24143 * Overrides all #GObject properties in the #FlashControl interface for a concrete class.
24144 * The properties are overridden in the order they are defined.
24145 *
24146 * Returns: The last property id.
24147 */
24148guint
24149flash_control_override_properties (GObjectClass *klass, guint property_id_begin)
24150{
24151 g_object_class_override_property (klass, property_id_begin++, "filename");
24152 g_object_class_override_property (klass, property_id_begin++, "type");
24153 return property_id_begin - 1;
24154}
24155
24156
24157
24158/**
24159 * FlashControl:
24160 *
24161 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link>.
24162 */
24163
24164/**
24165 * FlashControlIface:
24166 * @parent_iface: The parent interface.
24167 * @handle_flash: Handler for the #FlashControl::handle-flash signal.
24168 * @get_filename: Getter for the #FlashControl:filename property.
24169 * @get_type_: Getter for the #FlashControl:type property.
24170 * @done: Handler for the #FlashControl::done signal.
24171 * @error: Handler for the #FlashControl::error signal.
24172 * @progress: Handler for the #FlashControl::progress signal.
24173 *
24174 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link>.
24175 */
24176
24177typedef FlashControlIface FlashControlInterface;
24178G_DEFINE_INTERFACE (FlashControl, flash_control, G_TYPE_OBJECT);
24179
24180static void
24181flash_control_default_init (FlashControlIface *iface)
24182{
24183 /* GObject signals for incoming D-Bus method calls: */
24184 /**
24185 * FlashControl::handle-flash:
24186 * @object: A #FlashControl.
24187 * @invocation: A #GDBusMethodInvocation.
24188 * @arg_type: Argument passed by remote caller.
24189 * @arg_filename: Argument passed by remote caller.
24190 *
24191 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-FlashControl.flash">flash()</link> D-Bus method.
24192 *
24193 * 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.
24194 *
24195 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
24196 */
24197 g_signal_new ("handle-flash",
24198 G_TYPE_FROM_INTERFACE (iface),
24199 G_SIGNAL_RUN_LAST,
24200 G_STRUCT_OFFSET (FlashControlIface, handle_flash),
24201 g_signal_accumulator_true_handled,
24202 NULL,
24203 g_cclosure_marshal_generic,
24204 G_TYPE_BOOLEAN,
24205 3,
24206 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_STRING);
24207
24208 /* GObject signals for received D-Bus signals: */
24209 /**
24210 * FlashControl::done:
24211 * @object: A #FlashControl.
24212 * @arg_filename: Argument.
24213 *
24214 * 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.
24215 *
24216 * 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.
24217 */
24218 g_signal_new ("done",
24219 G_TYPE_FROM_INTERFACE (iface),
24220 G_SIGNAL_RUN_LAST,
24221 G_STRUCT_OFFSET (FlashControlIface, done),
24222 NULL,
24223 NULL,
24224 g_cclosure_marshal_generic,
24225 G_TYPE_NONE,
24226 1, G_TYPE_STRING);
24227
24228 /**
24229 * FlashControl::error:
24230 * @object: A #FlashControl.
24231 * @arg_filename: Argument.
24232 *
24233 * 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.
24234 *
24235 * 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.
24236 */
24237 g_signal_new ("error",
24238 G_TYPE_FROM_INTERFACE (iface),
24239 G_SIGNAL_RUN_LAST,
24240 G_STRUCT_OFFSET (FlashControlIface, error),
24241 NULL,
24242 NULL,
24243 g_cclosure_marshal_generic,
24244 G_TYPE_NONE,
24245 1, G_TYPE_STRING);
24246
24247 /**
24248 * FlashControl::progress:
24249 * @object: A #FlashControl.
24250 * @arg_filename: Argument.
24251 * @arg_progress: Argument.
24252 *
24253 * 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.
24254 *
24255 * 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.
24256 */
24257 g_signal_new ("progress",
24258 G_TYPE_FROM_INTERFACE (iface),
24259 G_SIGNAL_RUN_LAST,
24260 G_STRUCT_OFFSET (FlashControlIface, progress),
24261 NULL,
24262 NULL,
24263 g_cclosure_marshal_generic,
24264 G_TYPE_NONE,
24265 2, G_TYPE_STRING, G_TYPE_UCHAR);
24266
24267 /* GObject properties for D-Bus properties: */
24268 /**
24269 * FlashControl:filename:
24270 *
24271 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-FlashControl.filename">"filename"</link>.
24272 *
24273 * 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.
24274 */
24275 g_object_interface_install_property (iface,
24276 g_param_spec_string ("filename", "filename", "filename", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
24277 /**
24278 * FlashControl:type:
24279 *
24280 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-FlashControl.type">"type"</link>.
24281 *
24282 * 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.
24283 */
24284 g_object_interface_install_property (iface,
24285 g_param_spec_string ("type", "type", "type", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
24286}
24287
24288/**
24289 * flash_control_get_filename: (skip)
24290 * @object: A #FlashControl.
24291 *
24292 * Gets the value of the <link linkend="gdbus-property-org-openbmc-FlashControl.filename">"filename"</link> D-Bus property.
24293 *
24294 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
24295 *
24296 * <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>
24297 *
24298 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
24299 */
24300const gchar *
24301flash_control_get_filename (FlashControl *object)
24302{
24303 return FLASH_CONTROL_GET_IFACE (object)->get_filename (object);
24304}
24305
24306/**
24307 * flash_control_dup_filename: (skip)
24308 * @object: A #FlashControl.
24309 *
24310 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-FlashControl.filename">"filename"</link> D-Bus property.
24311 *
24312 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
24313 *
24314 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
24315 */
24316gchar *
24317flash_control_dup_filename (FlashControl *object)
24318{
24319 gchar *value;
24320 g_object_get (G_OBJECT (object), "filename", &value, NULL);
24321 return value;
24322}
24323
24324/**
24325 * flash_control_set_filename: (skip)
24326 * @object: A #FlashControl.
24327 * @value: The value to set.
24328 *
24329 * Sets the <link linkend="gdbus-property-org-openbmc-FlashControl.filename">"filename"</link> D-Bus property to @value.
24330 *
24331 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
24332 */
24333void
24334flash_control_set_filename (FlashControl *object, const gchar *value)
24335{
24336 g_object_set (G_OBJECT (object), "filename", value, NULL);
24337}
24338
24339/**
24340 * flash_control_get_type_: (skip)
24341 * @object: A #FlashControl.
24342 *
24343 * Gets the value of the <link linkend="gdbus-property-org-openbmc-FlashControl.type">"type"</link> D-Bus property.
24344 *
24345 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
24346 *
24347 * <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>
24348 *
24349 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
24350 */
24351const gchar *
24352flash_control_get_type_ (FlashControl *object)
24353{
24354 return FLASH_CONTROL_GET_IFACE (object)->get_type_ (object);
24355}
24356
24357/**
24358 * flash_control_dup_type_: (skip)
24359 * @object: A #FlashControl.
24360 *
24361 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-FlashControl.type">"type"</link> D-Bus property.
24362 *
24363 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
24364 *
24365 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
24366 */
24367gchar *
24368flash_control_dup_type_ (FlashControl *object)
24369{
24370 gchar *value;
24371 g_object_get (G_OBJECT (object), "type", &value, NULL);
24372 return value;
24373}
24374
24375/**
24376 * flash_control_set_type_: (skip)
24377 * @object: A #FlashControl.
24378 * @value: The value to set.
24379 *
24380 * Sets the <link linkend="gdbus-property-org-openbmc-FlashControl.type">"type"</link> D-Bus property to @value.
24381 *
24382 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
24383 */
24384void
24385flash_control_set_type_ (FlashControl *object, const gchar *value)
24386{
24387 g_object_set (G_OBJECT (object), "type", value, NULL);
24388}
24389
24390/**
24391 * flash_control_emit_done:
24392 * @object: A #FlashControl.
24393 * @arg_filename: Argument to pass with the signal.
24394 *
24395 * Emits the <link linkend="gdbus-signal-org-openbmc-FlashControl.Done">"Done"</link> D-Bus signal.
24396 */
24397void
24398flash_control_emit_done (
24399 FlashControl *object,
24400 const gchar *arg_filename)
24401{
24402 g_signal_emit_by_name (object, "done", arg_filename);
24403}
24404
24405/**
24406 * flash_control_emit_error:
24407 * @object: A #FlashControl.
24408 * @arg_filename: Argument to pass with the signal.
24409 *
24410 * Emits the <link linkend="gdbus-signal-org-openbmc-FlashControl.Error">"Error"</link> D-Bus signal.
24411 */
24412void
24413flash_control_emit_error (
24414 FlashControl *object,
24415 const gchar *arg_filename)
24416{
24417 g_signal_emit_by_name (object, "error", arg_filename);
24418}
24419
24420/**
24421 * flash_control_emit_progress:
24422 * @object: A #FlashControl.
24423 * @arg_filename: Argument to pass with the signal.
24424 * @arg_progress: Argument to pass with the signal.
24425 *
24426 * Emits the <link linkend="gdbus-signal-org-openbmc-FlashControl.Progress">"Progress"</link> D-Bus signal.
24427 */
24428void
24429flash_control_emit_progress (
24430 FlashControl *object,
24431 const gchar *arg_filename,
24432 guchar arg_progress)
24433{
24434 g_signal_emit_by_name (object, "progress", arg_filename, arg_progress);
24435}
24436
24437/**
24438 * flash_control_call_flash:
24439 * @proxy: A #FlashControlProxy.
24440 * @arg_type: Argument to pass with the method invocation.
24441 * @arg_filename: Argument to pass with the method invocation.
24442 * @cancellable: (allow-none): A #GCancellable or %NULL.
24443 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
24444 * @user_data: User data to pass to @callback.
24445 *
24446 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-FlashControl.flash">flash()</link> D-Bus method on @proxy.
24447 * 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.
24448 * You can then call flash_control_call_flash_finish() to get the result of the operation.
24449 *
24450 * See flash_control_call_flash_sync() for the synchronous, blocking version of this method.
24451 */
24452void
24453flash_control_call_flash (
24454 FlashControl *proxy,
24455 const gchar *arg_type,
24456 const gchar *arg_filename,
24457 GCancellable *cancellable,
24458 GAsyncReadyCallback callback,
24459 gpointer user_data)
24460{
24461 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
24462 "flash",
24463 g_variant_new ("(ss)",
24464 arg_type,
24465 arg_filename),
24466 G_DBUS_CALL_FLAGS_NONE,
24467 -1,
24468 cancellable,
24469 callback,
24470 user_data);
24471}
24472
24473/**
24474 * flash_control_call_flash_finish:
24475 * @proxy: A #FlashControlProxy.
24476 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_control_call_flash().
24477 * @error: Return location for error or %NULL.
24478 *
24479 * Finishes an operation started with flash_control_call_flash().
24480 *
24481 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
24482 */
24483gboolean
24484flash_control_call_flash_finish (
24485 FlashControl *proxy,
24486 GAsyncResult *res,
24487 GError **error)
24488{
24489 GVariant *_ret;
24490 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
24491 if (_ret == NULL)
24492 goto _out;
24493 g_variant_get (_ret,
24494 "()");
24495 g_variant_unref (_ret);
24496_out:
24497 return _ret != NULL;
24498}
24499
24500/**
24501 * flash_control_call_flash_sync:
24502 * @proxy: A #FlashControlProxy.
24503 * @arg_type: Argument to pass with the method invocation.
24504 * @arg_filename: Argument to pass with the method invocation.
24505 * @cancellable: (allow-none): A #GCancellable or %NULL.
24506 * @error: Return location for error or %NULL.
24507 *
24508 * 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.
24509 *
24510 * See flash_control_call_flash() for the asynchronous version of this method.
24511 *
24512 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
24513 */
24514gboolean
24515flash_control_call_flash_sync (
24516 FlashControl *proxy,
24517 const gchar *arg_type,
24518 const gchar *arg_filename,
24519 GCancellable *cancellable,
24520 GError **error)
24521{
24522 GVariant *_ret;
24523 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
24524 "flash",
24525 g_variant_new ("(ss)",
24526 arg_type,
24527 arg_filename),
24528 G_DBUS_CALL_FLAGS_NONE,
24529 -1,
24530 cancellable,
24531 error);
24532 if (_ret == NULL)
24533 goto _out;
24534 g_variant_get (_ret,
24535 "()");
24536 g_variant_unref (_ret);
24537_out:
24538 return _ret != NULL;
24539}
24540
24541/**
24542 * flash_control_complete_flash:
24543 * @object: A #FlashControl.
24544 * @invocation: (transfer full): A #GDBusMethodInvocation.
24545 *
24546 * 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.
24547 *
24548 * This method will free @invocation, you cannot use it afterwards.
24549 */
24550void
24551flash_control_complete_flash (
24552 FlashControl *object,
24553 GDBusMethodInvocation *invocation)
24554{
24555 g_dbus_method_invocation_return_value (invocation,
24556 g_variant_new ("()"));
24557}
24558
24559/* ------------------------------------------------------------------------ */
24560
24561/**
24562 * FlashControlProxy:
24563 *
24564 * The #FlashControlProxy structure contains only private data and should only be accessed using the provided API.
24565 */
24566
24567/**
24568 * FlashControlProxyClass:
24569 * @parent_class: The parent class.
24570 *
24571 * Class structure for #FlashControlProxy.
24572 */
24573
24574struct _FlashControlProxyPrivate
24575{
24576 GData *qdata;
24577};
24578
24579static void flash_control_proxy_iface_init (FlashControlIface *iface);
24580
24581#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
24582G_DEFINE_TYPE_WITH_CODE (FlashControlProxy, flash_control_proxy, G_TYPE_DBUS_PROXY,
24583 G_ADD_PRIVATE (FlashControlProxy)
24584 G_IMPLEMENT_INTERFACE (TYPE_FLASH_CONTROL, flash_control_proxy_iface_init));
24585
24586#else
24587G_DEFINE_TYPE_WITH_CODE (FlashControlProxy, flash_control_proxy, G_TYPE_DBUS_PROXY,
24588 G_IMPLEMENT_INTERFACE (TYPE_FLASH_CONTROL, flash_control_proxy_iface_init));
24589
24590#endif
24591static void
24592flash_control_proxy_finalize (GObject *object)
24593{
24594 FlashControlProxy *proxy = FLASH_CONTROL_PROXY (object);
24595 g_datalist_clear (&proxy->priv->qdata);
24596 G_OBJECT_CLASS (flash_control_proxy_parent_class)->finalize (object);
24597}
24598
24599static void
24600flash_control_proxy_get_property (GObject *object,
24601 guint prop_id,
24602 GValue *value,
24603 GParamSpec *pspec G_GNUC_UNUSED)
24604{
24605 const _ExtendedGDBusPropertyInfo *info;
24606 GVariant *variant;
24607 g_assert (prop_id != 0 && prop_id - 1 < 2);
24608 info = _flash_control_property_info_pointers[prop_id - 1];
24609 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
24610 if (info->use_gvariant)
24611 {
24612 g_value_set_variant (value, variant);
24613 }
24614 else
24615 {
24616 if (variant != NULL)
24617 g_dbus_gvariant_to_gvalue (variant, value);
24618 }
24619 if (variant != NULL)
24620 g_variant_unref (variant);
24621}
24622
24623static void
24624flash_control_proxy_set_property_cb (GDBusProxy *proxy,
24625 GAsyncResult *res,
24626 gpointer user_data)
24627{
24628 const _ExtendedGDBusPropertyInfo *info = user_data;
24629 GError *error;
24630 GVariant *_ret;
24631 error = NULL;
24632 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
24633 if (!_ret)
24634 {
24635 g_warning ("Error setting property '%s' on interface org.openbmc.FlashControl: %s (%s, %d)",
24636 info->parent_struct.name,
24637 error->message, g_quark_to_string (error->domain), error->code);
24638 g_error_free (error);
24639 }
24640 else
24641 {
24642 g_variant_unref (_ret);
24643 }
24644}
24645
24646static void
24647flash_control_proxy_set_property (GObject *object,
24648 guint prop_id,
24649 const GValue *value,
24650 GParamSpec *pspec G_GNUC_UNUSED)
24651{
24652 const _ExtendedGDBusPropertyInfo *info;
24653 GVariant *variant;
24654 g_assert (prop_id != 0 && prop_id - 1 < 2);
24655 info = _flash_control_property_info_pointers[prop_id - 1];
24656 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
24657 g_dbus_proxy_call (G_DBUS_PROXY (object),
24658 "org.freedesktop.DBus.Properties.Set",
24659 g_variant_new ("(ssv)", "org.openbmc.FlashControl", info->parent_struct.name, variant),
24660 G_DBUS_CALL_FLAGS_NONE,
24661 -1,
24662 NULL, (GAsyncReadyCallback) flash_control_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
24663 g_variant_unref (variant);
24664}
24665
24666static void
24667flash_control_proxy_g_signal (GDBusProxy *proxy,
24668 const gchar *sender_name G_GNUC_UNUSED,
24669 const gchar *signal_name,
24670 GVariant *parameters)
24671{
24672 _ExtendedGDBusSignalInfo *info;
24673 GVariantIter iter;
24674 GVariant *child;
24675 GValue *paramv;
24676 guint num_params;
24677 guint n;
24678 guint signal_id;
24679 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct, signal_name);
24680 if (info == NULL)
24681 return;
24682 num_params = g_variant_n_children (parameters);
24683 paramv = g_new0 (GValue, num_params + 1);
24684 g_value_init (&paramv[0], TYPE_FLASH_CONTROL);
24685 g_value_set_object (&paramv[0], proxy);
24686 g_variant_iter_init (&iter, parameters);
24687 n = 1;
24688 while ((child = g_variant_iter_next_value (&iter)) != NULL)
24689 {
24690 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
24691 if (arg_info->use_gvariant)
24692 {
24693 g_value_init (&paramv[n], G_TYPE_VARIANT);
24694 g_value_set_variant (&paramv[n], child);
24695 n++;
24696 }
24697 else
24698 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
24699 g_variant_unref (child);
24700 }
24701 signal_id = g_signal_lookup (info->signal_name, TYPE_FLASH_CONTROL);
24702 g_signal_emitv (paramv, signal_id, 0, NULL);
24703 for (n = 0; n < num_params + 1; n++)
24704 g_value_unset (&paramv[n]);
24705 g_free (paramv);
24706}
24707
24708static void
24709flash_control_proxy_g_properties_changed (GDBusProxy *_proxy,
24710 GVariant *changed_properties,
24711 const gchar *const *invalidated_properties)
24712{
24713 FlashControlProxy *proxy = FLASH_CONTROL_PROXY (_proxy);
24714 guint n;
24715 const gchar *key;
24716 GVariantIter *iter;
24717 _ExtendedGDBusPropertyInfo *info;
24718 g_variant_get (changed_properties, "a{sv}", &iter);
24719 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
24720 {
24721 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct, key);
24722 g_datalist_remove_data (&proxy->priv->qdata, key);
24723 if (info != NULL)
24724 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
24725 }
24726 g_variant_iter_free (iter);
24727 for (n = 0; invalidated_properties[n] != NULL; n++)
24728 {
24729 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct, invalidated_properties[n]);
24730 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
24731 if (info != NULL)
24732 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
24733 }
24734}
24735
24736static const gchar *
24737flash_control_proxy_get_filename (FlashControl *object)
24738{
24739 FlashControlProxy *proxy = FLASH_CONTROL_PROXY (object);
24740 GVariant *variant;
24741 const gchar *value = NULL;
24742 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "filename");
24743 if (variant != NULL)
24744 {
24745 value = g_variant_get_string (variant, NULL);
24746 g_variant_unref (variant);
24747 }
24748 return value;
24749}
24750
24751static const gchar *
24752flash_control_proxy_get_type_ (FlashControl *object)
24753{
24754 FlashControlProxy *proxy = FLASH_CONTROL_PROXY (object);
24755 GVariant *variant;
24756 const gchar *value = NULL;
24757 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "type");
24758 if (variant != NULL)
24759 {
24760 value = g_variant_get_string (variant, NULL);
24761 g_variant_unref (variant);
24762 }
24763 return value;
24764}
24765
24766static void
24767flash_control_proxy_init (FlashControlProxy *proxy)
24768{
24769#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
24770 proxy->priv = flash_control_proxy_get_instance_private (proxy);
24771#else
24772 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_FLASH_CONTROL_PROXY, FlashControlProxyPrivate);
24773#endif
24774
24775 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), flash_control_interface_info ());
24776}
24777
24778static void
24779flash_control_proxy_class_init (FlashControlProxyClass *klass)
24780{
24781 GObjectClass *gobject_class;
24782 GDBusProxyClass *proxy_class;
24783
24784 gobject_class = G_OBJECT_CLASS (klass);
24785 gobject_class->finalize = flash_control_proxy_finalize;
24786 gobject_class->get_property = flash_control_proxy_get_property;
24787 gobject_class->set_property = flash_control_proxy_set_property;
24788
24789 proxy_class = G_DBUS_PROXY_CLASS (klass);
24790 proxy_class->g_signal = flash_control_proxy_g_signal;
24791 proxy_class->g_properties_changed = flash_control_proxy_g_properties_changed;
24792
24793 flash_control_override_properties (gobject_class, 1);
24794
24795#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
24796 g_type_class_add_private (klass, sizeof (FlashControlProxyPrivate));
24797#endif
24798}
24799
24800static void
24801flash_control_proxy_iface_init (FlashControlIface *iface)
24802{
24803 iface->get_filename = flash_control_proxy_get_filename;
24804 iface->get_type_ = flash_control_proxy_get_type_;
24805}
24806
24807/**
24808 * flash_control_proxy_new:
24809 * @connection: A #GDBusConnection.
24810 * @flags: Flags from the #GDBusProxyFlags enumeration.
24811 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
24812 * @object_path: An object path.
24813 * @cancellable: (allow-none): A #GCancellable or %NULL.
24814 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
24815 * @user_data: User data to pass to @callback.
24816 *
24817 * 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.
24818 *
24819 * 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.
24820 * You can then call flash_control_proxy_new_finish() to get the result of the operation.
24821 *
24822 * See flash_control_proxy_new_sync() for the synchronous, blocking version of this constructor.
24823 */
24824void
24825flash_control_proxy_new (
24826 GDBusConnection *connection,
24827 GDBusProxyFlags flags,
24828 const gchar *name,
24829 const gchar *object_path,
24830 GCancellable *cancellable,
24831 GAsyncReadyCallback callback,
24832 gpointer user_data)
24833{
24834 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);
24835}
24836
24837/**
24838 * flash_control_proxy_new_finish:
24839 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_control_proxy_new().
24840 * @error: Return location for error or %NULL
24841 *
24842 * Finishes an operation started with flash_control_proxy_new().
24843 *
24844 * Returns: (transfer full) (type FlashControlProxy): The constructed proxy object or %NULL if @error is set.
24845 */
24846FlashControl *
24847flash_control_proxy_new_finish (
24848 GAsyncResult *res,
24849 GError **error)
24850{
24851 GObject *ret;
24852 GObject *source_object;
24853 source_object = g_async_result_get_source_object (res);
24854 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
24855 g_object_unref (source_object);
24856 if (ret != NULL)
24857 return FLASH_CONTROL (ret);
24858 else
24859 return NULL;
24860}
24861
24862/**
24863 * flash_control_proxy_new_sync:
24864 * @connection: A #GDBusConnection.
24865 * @flags: Flags from the #GDBusProxyFlags enumeration.
24866 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
24867 * @object_path: An object path.
24868 * @cancellable: (allow-none): A #GCancellable or %NULL.
24869 * @error: Return location for error or %NULL
24870 *
24871 * 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.
24872 *
24873 * The calling thread is blocked until a reply is received.
24874 *
24875 * See flash_control_proxy_new() for the asynchronous version of this constructor.
24876 *
24877 * Returns: (transfer full) (type FlashControlProxy): The constructed proxy object or %NULL if @error is set.
24878 */
24879FlashControl *
24880flash_control_proxy_new_sync (
24881 GDBusConnection *connection,
24882 GDBusProxyFlags flags,
24883 const gchar *name,
24884 const gchar *object_path,
24885 GCancellable *cancellable,
24886 GError **error)
24887{
24888 GInitable *ret;
24889 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);
24890 if (ret != NULL)
24891 return FLASH_CONTROL (ret);
24892 else
24893 return NULL;
24894}
24895
24896
24897/**
24898 * flash_control_proxy_new_for_bus:
24899 * @bus_type: A #GBusType.
24900 * @flags: Flags from the #GDBusProxyFlags enumeration.
24901 * @name: A bus name (well-known or unique).
24902 * @object_path: An object path.
24903 * @cancellable: (allow-none): A #GCancellable or %NULL.
24904 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
24905 * @user_data: User data to pass to @callback.
24906 *
24907 * Like flash_control_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
24908 *
24909 * 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.
24910 * You can then call flash_control_proxy_new_for_bus_finish() to get the result of the operation.
24911 *
24912 * See flash_control_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
24913 */
24914void
24915flash_control_proxy_new_for_bus (
24916 GBusType bus_type,
24917 GDBusProxyFlags flags,
24918 const gchar *name,
24919 const gchar *object_path,
24920 GCancellable *cancellable,
24921 GAsyncReadyCallback callback,
24922 gpointer user_data)
24923{
24924 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);
24925}
24926
24927/**
24928 * flash_control_proxy_new_for_bus_finish:
24929 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_control_proxy_new_for_bus().
24930 * @error: Return location for error or %NULL
24931 *
24932 * Finishes an operation started with flash_control_proxy_new_for_bus().
24933 *
24934 * Returns: (transfer full) (type FlashControlProxy): The constructed proxy object or %NULL if @error is set.
24935 */
24936FlashControl *
24937flash_control_proxy_new_for_bus_finish (
24938 GAsyncResult *res,
24939 GError **error)
24940{
24941 GObject *ret;
24942 GObject *source_object;
24943 source_object = g_async_result_get_source_object (res);
24944 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
24945 g_object_unref (source_object);
24946 if (ret != NULL)
24947 return FLASH_CONTROL (ret);
24948 else
24949 return NULL;
24950}
24951
24952/**
24953 * flash_control_proxy_new_for_bus_sync:
24954 * @bus_type: A #GBusType.
24955 * @flags: Flags from the #GDBusProxyFlags enumeration.
24956 * @name: A bus name (well-known or unique).
24957 * @object_path: An object path.
24958 * @cancellable: (allow-none): A #GCancellable or %NULL.
24959 * @error: Return location for error or %NULL
24960 *
24961 * Like flash_control_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
24962 *
24963 * The calling thread is blocked until a reply is received.
24964 *
24965 * See flash_control_proxy_new_for_bus() for the asynchronous version of this constructor.
24966 *
24967 * Returns: (transfer full) (type FlashControlProxy): The constructed proxy object or %NULL if @error is set.
24968 */
24969FlashControl *
24970flash_control_proxy_new_for_bus_sync (
24971 GBusType bus_type,
24972 GDBusProxyFlags flags,
24973 const gchar *name,
24974 const gchar *object_path,
24975 GCancellable *cancellable,
24976 GError **error)
24977{
24978 GInitable *ret;
24979 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);
24980 if (ret != NULL)
24981 return FLASH_CONTROL (ret);
24982 else
24983 return NULL;
24984}
24985
24986
24987/* ------------------------------------------------------------------------ */
24988
24989/**
24990 * FlashControlSkeleton:
24991 *
24992 * The #FlashControlSkeleton structure contains only private data and should only be accessed using the provided API.
24993 */
24994
24995/**
24996 * FlashControlSkeletonClass:
24997 * @parent_class: The parent class.
24998 *
24999 * Class structure for #FlashControlSkeleton.
25000 */
25001
25002struct _FlashControlSkeletonPrivate
25003{
25004 GValue *properties;
25005 GList *changed_properties;
25006 GSource *changed_properties_idle_source;
25007 GMainContext *context;
25008 GMutex lock;
25009};
25010
25011static void
25012_flash_control_skeleton_handle_method_call (
25013 GDBusConnection *connection G_GNUC_UNUSED,
25014 const gchar *sender G_GNUC_UNUSED,
25015 const gchar *object_path G_GNUC_UNUSED,
25016 const gchar *interface_name,
25017 const gchar *method_name,
25018 GVariant *parameters,
25019 GDBusMethodInvocation *invocation,
25020 gpointer user_data)
25021{
25022 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (user_data);
25023 _ExtendedGDBusMethodInfo *info;
25024 GVariantIter iter;
25025 GVariant *child;
25026 GValue *paramv;
25027 guint num_params;
25028 guint num_extra;
25029 guint n;
25030 guint signal_id;
25031 GValue return_value = G_VALUE_INIT;
25032 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
25033 g_assert (info != NULL);
25034 num_params = g_variant_n_children (parameters);
25035 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
25036 n = 0;
25037 g_value_init (&paramv[n], TYPE_FLASH_CONTROL);
25038 g_value_set_object (&paramv[n++], skeleton);
25039 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
25040 g_value_set_object (&paramv[n++], invocation);
25041 if (info->pass_fdlist)
25042 {
25043#ifdef G_OS_UNIX
25044 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
25045 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
25046#else
25047 g_assert_not_reached ();
25048#endif
25049 }
25050 g_variant_iter_init (&iter, parameters);
25051 while ((child = g_variant_iter_next_value (&iter)) != NULL)
25052 {
25053 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
25054 if (arg_info->use_gvariant)
25055 {
25056 g_value_init (&paramv[n], G_TYPE_VARIANT);
25057 g_value_set_variant (&paramv[n], child);
25058 n++;
25059 }
25060 else
25061 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
25062 g_variant_unref (child);
25063 }
25064 signal_id = g_signal_lookup (info->signal_name, TYPE_FLASH_CONTROL);
25065 g_value_init (&return_value, G_TYPE_BOOLEAN);
25066 g_signal_emitv (paramv, signal_id, 0, &return_value);
25067 if (!g_value_get_boolean (&return_value))
25068 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);
25069 g_value_unset (&return_value);
25070 for (n = 0; n < num_params + num_extra; n++)
25071 g_value_unset (&paramv[n]);
25072 g_free (paramv);
25073}
25074
25075static GVariant *
25076_flash_control_skeleton_handle_get_property (
25077 GDBusConnection *connection G_GNUC_UNUSED,
25078 const gchar *sender G_GNUC_UNUSED,
25079 const gchar *object_path G_GNUC_UNUSED,
25080 const gchar *interface_name G_GNUC_UNUSED,
25081 const gchar *property_name,
25082 GError **error,
25083 gpointer user_data)
25084{
25085 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (user_data);
25086 GValue value = G_VALUE_INIT;
25087 GParamSpec *pspec;
25088 _ExtendedGDBusPropertyInfo *info;
25089 GVariant *ret;
25090 ret = NULL;
25091 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct, property_name);
25092 g_assert (info != NULL);
25093 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
25094 if (pspec == NULL)
25095 {
25096 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
25097 }
25098 else
25099 {
25100 g_value_init (&value, pspec->value_type);
25101 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
25102 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
25103 g_value_unset (&value);
25104 }
25105 return ret;
25106}
25107
25108static gboolean
25109_flash_control_skeleton_handle_set_property (
25110 GDBusConnection *connection G_GNUC_UNUSED,
25111 const gchar *sender G_GNUC_UNUSED,
25112 const gchar *object_path G_GNUC_UNUSED,
25113 const gchar *interface_name G_GNUC_UNUSED,
25114 const gchar *property_name,
25115 GVariant *variant,
25116 GError **error,
25117 gpointer user_data)
25118{
25119 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (user_data);
25120 GValue value = G_VALUE_INIT;
25121 GParamSpec *pspec;
25122 _ExtendedGDBusPropertyInfo *info;
25123 gboolean ret;
25124 ret = FALSE;
25125 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct, property_name);
25126 g_assert (info != NULL);
25127 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
25128 if (pspec == NULL)
25129 {
25130 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
25131 }
25132 else
25133 {
25134 if (info->use_gvariant)
25135 g_value_set_variant (&value, variant);
25136 else
25137 g_dbus_gvariant_to_gvalue (variant, &value);
25138 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
25139 g_value_unset (&value);
25140 ret = TRUE;
25141 }
25142 return ret;
25143}
25144
25145static const GDBusInterfaceVTable _flash_control_skeleton_vtable =
25146{
25147 _flash_control_skeleton_handle_method_call,
25148 _flash_control_skeleton_handle_get_property,
25149 _flash_control_skeleton_handle_set_property,
25150 {NULL}
25151};
25152
25153static GDBusInterfaceInfo *
25154flash_control_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
25155{
25156 return flash_control_interface_info ();
25157}
25158
25159static GDBusInterfaceVTable *
25160flash_control_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
25161{
25162 return (GDBusInterfaceVTable *) &_flash_control_skeleton_vtable;
25163}
25164
25165static GVariant *
25166flash_control_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
25167{
25168 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (_skeleton);
25169
25170 GVariantBuilder builder;
25171 guint n;
25172 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
25173 if (_flash_control_interface_info.parent_struct.properties == NULL)
25174 goto out;
25175 for (n = 0; _flash_control_interface_info.parent_struct.properties[n] != NULL; n++)
25176 {
25177 GDBusPropertyInfo *info = _flash_control_interface_info.parent_struct.properties[n];
25178 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
25179 {
25180 GVariant *value;
25181 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);
25182 if (value != NULL)
25183 {
25184 g_variant_take_ref (value);
25185 g_variant_builder_add (&builder, "{sv}", info->name, value);
25186 g_variant_unref (value);
25187 }
25188 }
25189 }
25190out:
25191 return g_variant_builder_end (&builder);
25192}
25193
25194static gboolean _flash_control_emit_changed (gpointer user_data);
25195
25196static void
25197flash_control_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
25198{
25199 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (_skeleton);
25200 gboolean emit_changed = FALSE;
25201
25202 g_mutex_lock (&skeleton->priv->lock);
25203 if (skeleton->priv->changed_properties_idle_source != NULL)
25204 {
25205 g_source_destroy (skeleton->priv->changed_properties_idle_source);
25206 skeleton->priv->changed_properties_idle_source = NULL;
25207 emit_changed = TRUE;
25208 }
25209 g_mutex_unlock (&skeleton->priv->lock);
25210
25211 if (emit_changed)
25212 _flash_control_emit_changed (skeleton);
25213}
25214
25215static void
25216_flash_control_on_signal_done (
25217 FlashControl *object,
25218 const gchar *arg_filename)
25219{
25220 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
25221
25222 GList *connections, *l;
25223 GVariant *signal_variant;
25224 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
25225
25226 signal_variant = g_variant_ref_sink (g_variant_new ("(s)",
25227 arg_filename));
25228 for (l = connections; l != NULL; l = l->next)
25229 {
25230 GDBusConnection *connection = l->data;
25231 g_dbus_connection_emit_signal (connection,
25232 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.FlashControl", "Done",
25233 signal_variant, NULL);
25234 }
25235 g_variant_unref (signal_variant);
25236 g_list_free_full (connections, g_object_unref);
25237}
25238
25239static void
25240_flash_control_on_signal_error (
25241 FlashControl *object,
25242 const gchar *arg_filename)
25243{
25244 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
25245
25246 GList *connections, *l;
25247 GVariant *signal_variant;
25248 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
25249
25250 signal_variant = g_variant_ref_sink (g_variant_new ("(s)",
25251 arg_filename));
25252 for (l = connections; l != NULL; l = l->next)
25253 {
25254 GDBusConnection *connection = l->data;
25255 g_dbus_connection_emit_signal (connection,
25256 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.FlashControl", "Error",
25257 signal_variant, NULL);
25258 }
25259 g_variant_unref (signal_variant);
25260 g_list_free_full (connections, g_object_unref);
25261}
25262
25263static void
25264_flash_control_on_signal_progress (
25265 FlashControl *object,
25266 const gchar *arg_filename,
25267 guchar arg_progress)
25268{
25269 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
25270
25271 GList *connections, *l;
25272 GVariant *signal_variant;
25273 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
25274
25275 signal_variant = g_variant_ref_sink (g_variant_new ("(sy)",
25276 arg_filename,
25277 arg_progress));
25278 for (l = connections; l != NULL; l = l->next)
25279 {
25280 GDBusConnection *connection = l->data;
25281 g_dbus_connection_emit_signal (connection,
25282 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.FlashControl", "Progress",
25283 signal_variant, NULL);
25284 }
25285 g_variant_unref (signal_variant);
25286 g_list_free_full (connections, g_object_unref);
25287}
25288
25289static void flash_control_skeleton_iface_init (FlashControlIface *iface);
25290#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
25291G_DEFINE_TYPE_WITH_CODE (FlashControlSkeleton, flash_control_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
25292 G_ADD_PRIVATE (FlashControlSkeleton)
25293 G_IMPLEMENT_INTERFACE (TYPE_FLASH_CONTROL, flash_control_skeleton_iface_init));
25294
25295#else
25296G_DEFINE_TYPE_WITH_CODE (FlashControlSkeleton, flash_control_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
25297 G_IMPLEMENT_INTERFACE (TYPE_FLASH_CONTROL, flash_control_skeleton_iface_init));
25298
25299#endif
25300static void
25301flash_control_skeleton_finalize (GObject *object)
25302{
25303 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
25304 guint n;
25305 for (n = 0; n < 2; n++)
25306 g_value_unset (&skeleton->priv->properties[n]);
25307 g_free (skeleton->priv->properties);
25308 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
25309 if (skeleton->priv->changed_properties_idle_source != NULL)
25310 g_source_destroy (skeleton->priv->changed_properties_idle_source);
25311 g_main_context_unref (skeleton->priv->context);
25312 g_mutex_clear (&skeleton->priv->lock);
25313 G_OBJECT_CLASS (flash_control_skeleton_parent_class)->finalize (object);
25314}
25315
25316static void
25317flash_control_skeleton_get_property (GObject *object,
25318 guint prop_id,
25319 GValue *value,
25320 GParamSpec *pspec G_GNUC_UNUSED)
25321{
25322 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
25323 g_assert (prop_id != 0 && prop_id - 1 < 2);
25324 g_mutex_lock (&skeleton->priv->lock);
25325 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
25326 g_mutex_unlock (&skeleton->priv->lock);
25327}
25328
25329static gboolean
25330_flash_control_emit_changed (gpointer user_data)
25331{
25332 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (user_data);
25333 GList *l;
25334 GVariantBuilder builder;
25335 GVariantBuilder invalidated_builder;
25336 guint num_changes;
25337
25338 g_mutex_lock (&skeleton->priv->lock);
25339 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
25340 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
25341 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
25342 {
25343 ChangedProperty *cp = l->data;
25344 GVariant *variant;
25345 const GValue *cur_value;
25346
25347 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
25348 if (!_g_value_equal (cur_value, &cp->orig_value))
25349 {
25350 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
25351 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
25352 g_variant_unref (variant);
25353 num_changes++;
25354 }
25355 }
25356 if (num_changes > 0)
25357 {
25358 GList *connections, *ll;
25359 GVariant *signal_variant;
25360 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.FlashControl",
25361 &builder, &invalidated_builder));
25362 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
25363 for (ll = connections; ll != NULL; ll = ll->next)
25364 {
25365 GDBusConnection *connection = ll->data;
25366
25367 g_dbus_connection_emit_signal (connection,
25368 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
25369 "org.freedesktop.DBus.Properties",
25370 "PropertiesChanged",
25371 signal_variant,
25372 NULL);
25373 }
25374 g_variant_unref (signal_variant);
25375 g_list_free_full (connections, g_object_unref);
25376 }
25377 else
25378 {
25379 g_variant_builder_clear (&builder);
25380 g_variant_builder_clear (&invalidated_builder);
25381 }
25382 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
25383 skeleton->priv->changed_properties = NULL;
25384 skeleton->priv->changed_properties_idle_source = NULL;
25385 g_mutex_unlock (&skeleton->priv->lock);
25386 return FALSE;
25387}
25388
25389static void
25390_flash_control_schedule_emit_changed (FlashControlSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
25391{
25392 ChangedProperty *cp;
25393 GList *l;
25394 cp = NULL;
25395 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
25396 {
25397 ChangedProperty *i_cp = l->data;
25398 if (i_cp->info == info)
25399 {
25400 cp = i_cp;
25401 break;
25402 }
25403 }
25404 if (cp == NULL)
25405 {
25406 cp = g_new0 (ChangedProperty, 1);
25407 cp->prop_id = prop_id;
25408 cp->info = info;
25409 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
25410 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
25411 g_value_copy (orig_value, &cp->orig_value);
25412 }
25413}
25414
25415static void
25416flash_control_skeleton_notify (GObject *object,
25417 GParamSpec *pspec G_GNUC_UNUSED)
25418{
25419 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
25420 g_mutex_lock (&skeleton->priv->lock);
25421 if (skeleton->priv->changed_properties != NULL &&
25422 skeleton->priv->changed_properties_idle_source == NULL)
25423 {
25424 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
25425 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
25426 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _flash_control_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
25427 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
25428 g_source_unref (skeleton->priv->changed_properties_idle_source);
25429 }
25430 g_mutex_unlock (&skeleton->priv->lock);
25431}
25432
25433static void
25434flash_control_skeleton_set_property (GObject *object,
25435 guint prop_id,
25436 const GValue *value,
25437 GParamSpec *pspec)
25438{
25439 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
25440 g_assert (prop_id != 0 && prop_id - 1 < 2);
25441 g_mutex_lock (&skeleton->priv->lock);
25442 g_object_freeze_notify (object);
25443 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
25444 {
25445 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
25446 _flash_control_schedule_emit_changed (skeleton, _flash_control_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
25447 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
25448 g_object_notify_by_pspec (object, pspec);
25449 }
25450 g_mutex_unlock (&skeleton->priv->lock);
25451 g_object_thaw_notify (object);
25452}
25453
25454static void
25455flash_control_skeleton_init (FlashControlSkeleton *skeleton)
25456{
25457#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
25458 skeleton->priv = flash_control_skeleton_get_instance_private (skeleton);
25459#else
25460 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_FLASH_CONTROL_SKELETON, FlashControlSkeletonPrivate);
25461#endif
25462
25463 g_mutex_init (&skeleton->priv->lock);
25464 skeleton->priv->context = g_main_context_ref_thread_default ();
25465 skeleton->priv->properties = g_new0 (GValue, 2);
25466 g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING);
25467 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
25468}
25469
25470static const gchar *
25471flash_control_skeleton_get_filename (FlashControl *object)
25472{
25473 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
25474 const gchar *value;
25475 g_mutex_lock (&skeleton->priv->lock);
25476 value = g_value_get_string (&(skeleton->priv->properties[0]));
25477 g_mutex_unlock (&skeleton->priv->lock);
25478 return value;
25479}
25480
25481static const gchar *
25482flash_control_skeleton_get_type_ (FlashControl *object)
25483{
25484 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
25485 const gchar *value;
25486 g_mutex_lock (&skeleton->priv->lock);
25487 value = g_value_get_string (&(skeleton->priv->properties[1]));
25488 g_mutex_unlock (&skeleton->priv->lock);
25489 return value;
25490}
25491
25492static void
25493flash_control_skeleton_class_init (FlashControlSkeletonClass *klass)
25494{
25495 GObjectClass *gobject_class;
25496 GDBusInterfaceSkeletonClass *skeleton_class;
25497
25498 gobject_class = G_OBJECT_CLASS (klass);
25499 gobject_class->finalize = flash_control_skeleton_finalize;
25500 gobject_class->get_property = flash_control_skeleton_get_property;
25501 gobject_class->set_property = flash_control_skeleton_set_property;
25502 gobject_class->notify = flash_control_skeleton_notify;
25503
25504
25505 flash_control_override_properties (gobject_class, 1);
25506
25507 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
25508 skeleton_class->get_info = flash_control_skeleton_dbus_interface_get_info;
25509 skeleton_class->get_properties = flash_control_skeleton_dbus_interface_get_properties;
25510 skeleton_class->flush = flash_control_skeleton_dbus_interface_flush;
25511 skeleton_class->get_vtable = flash_control_skeleton_dbus_interface_get_vtable;
25512
25513#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
25514 g_type_class_add_private (klass, sizeof (FlashControlSkeletonPrivate));
25515#endif
25516}
25517
25518static void
25519flash_control_skeleton_iface_init (FlashControlIface *iface)
25520{
25521 iface->done = _flash_control_on_signal_done;
25522 iface->error = _flash_control_on_signal_error;
25523 iface->progress = _flash_control_on_signal_progress;
25524 iface->get_filename = flash_control_skeleton_get_filename;
25525 iface->get_type_ = flash_control_skeleton_get_type_;
25526}
25527
25528/**
25529 * flash_control_skeleton_new:
25530 *
25531 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link>.
25532 *
25533 * Returns: (transfer full) (type FlashControlSkeleton): The skeleton object.
25534 */
25535FlashControl *
25536flash_control_skeleton_new (void)
25537{
25538 return FLASH_CONTROL (g_object_new (TYPE_FLASH_CONTROL_SKELETON, NULL));
25539}
25540
25541/* ------------------------------------------------------------------------
Norman James362a80f2015-09-14 14:04:39 -050025542 * Code for interface org.openbmc.Button
25543 * ------------------------------------------------------------------------
25544 */
25545
25546/**
25547 * SECTION:Button
25548 * @title: Button
25549 * @short_description: Generated C code for the org.openbmc.Button D-Bus interface
25550 *
25551 * 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.
25552 */
25553
25554/* ---- Introspection data for org.openbmc.Button ---- */
25555
25556static const _ExtendedGDBusArgInfo _button_method_info_is_on_OUT_ARG_state =
25557{
25558 {
25559 -1,
25560 (gchar *) "state",
25561 (gchar *) "b",
25562 NULL
25563 },
25564 FALSE
25565};
25566
25567static const _ExtendedGDBusArgInfo * const _button_method_info_is_on_OUT_ARG_pointers[] =
25568{
25569 &_button_method_info_is_on_OUT_ARG_state,
25570 NULL
25571};
25572
25573static const _ExtendedGDBusMethodInfo _button_method_info_is_on =
25574{
25575 {
25576 -1,
25577 (gchar *) "isOn",
25578 NULL,
25579 (GDBusArgInfo **) &_button_method_info_is_on_OUT_ARG_pointers,
25580 NULL
25581 },
25582 "handle-is-on",
25583 FALSE
25584};
25585
Norman James493996c2015-10-31 17:27:13 -050025586static const _ExtendedGDBusMethodInfo _button_method_info_sim_press =
Norman James362a80f2015-09-14 14:04:39 -050025587{
25588 {
25589 -1,
Norman James493996c2015-10-31 17:27:13 -050025590 (gchar *) "simPress",
Norman James362a80f2015-09-14 14:04:39 -050025591 NULL,
25592 NULL,
25593 NULL
25594 },
Norman James493996c2015-10-31 17:27:13 -050025595 "handle-sim-press",
Norman James362a80f2015-09-14 14:04:39 -050025596 FALSE
25597};
25598
Norman James493996c2015-10-31 17:27:13 -050025599static const _ExtendedGDBusMethodInfo _button_method_info_sim_long_press =
Norman James362a80f2015-09-14 14:04:39 -050025600{
25601 {
25602 -1,
Norman James493996c2015-10-31 17:27:13 -050025603 (gchar *) "simLongPress",
Norman James362a80f2015-09-14 14:04:39 -050025604 NULL,
25605 NULL,
25606 NULL
25607 },
Norman James493996c2015-10-31 17:27:13 -050025608 "handle-sim-long-press",
Norman James362a80f2015-09-14 14:04:39 -050025609 FALSE
25610};
25611
25612static const _ExtendedGDBusMethodInfo * const _button_method_info_pointers[] =
25613{
25614 &_button_method_info_is_on,
Norman James493996c2015-10-31 17:27:13 -050025615 &_button_method_info_sim_press,
25616 &_button_method_info_sim_long_press,
Norman James362a80f2015-09-14 14:04:39 -050025617 NULL
25618};
25619
Norman James493996c2015-10-31 17:27:13 -050025620static const _ExtendedGDBusSignalInfo _button_signal_info_released =
Norman James362a80f2015-09-14 14:04:39 -050025621{
25622 {
25623 -1,
Norman James493996c2015-10-31 17:27:13 -050025624 (gchar *) "Released",
Norman James362a80f2015-09-14 14:04:39 -050025625 NULL,
25626 NULL
25627 },
Norman James493996c2015-10-31 17:27:13 -050025628 "released"
Norman James362a80f2015-09-14 14:04:39 -050025629};
25630
Norman James493996c2015-10-31 17:27:13 -050025631static const _ExtendedGDBusSignalInfo _button_signal_info_pressed =
Norman James362a80f2015-09-14 14:04:39 -050025632{
25633 {
25634 -1,
Norman James493996c2015-10-31 17:27:13 -050025635 (gchar *) "Pressed",
Norman James362a80f2015-09-14 14:04:39 -050025636 NULL,
25637 NULL
25638 },
Norman James493996c2015-10-31 17:27:13 -050025639 "pressed"
Norman James362a80f2015-09-14 14:04:39 -050025640};
25641
Norman James493996c2015-10-31 17:27:13 -050025642static const _ExtendedGDBusSignalInfo _button_signal_info_pressed_long =
Norman James362a80f2015-09-14 14:04:39 -050025643{
25644 {
25645 -1,
Norman James493996c2015-10-31 17:27:13 -050025646 (gchar *) "PressedLong",
Norman James362a80f2015-09-14 14:04:39 -050025647 NULL,
25648 NULL
25649 },
Norman James493996c2015-10-31 17:27:13 -050025650 "pressed-long"
Norman James362a80f2015-09-14 14:04:39 -050025651};
25652
25653static const _ExtendedGDBusSignalInfo * const _button_signal_info_pointers[] =
25654{
Norman James493996c2015-10-31 17:27:13 -050025655 &_button_signal_info_released,
25656 &_button_signal_info_pressed,
25657 &_button_signal_info_pressed_long,
Norman James362a80f2015-09-14 14:04:39 -050025658 NULL
25659};
25660
25661static const _ExtendedGDBusPropertyInfo _button_property_info_state =
25662{
25663 {
25664 -1,
25665 (gchar *) "state",
25666 (gchar *) "b",
25667 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
25668 NULL
25669 },
25670 "state",
25671 FALSE
25672};
25673
Norman James493996c2015-10-31 17:27:13 -050025674static const _ExtendedGDBusPropertyInfo _button_property_info_timer =
25675{
25676 {
25677 -1,
25678 (gchar *) "timer",
25679 (gchar *) "t",
25680 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
25681 NULL
25682 },
25683 "timer",
25684 FALSE
25685};
25686
Norman James362a80f2015-09-14 14:04:39 -050025687static const _ExtendedGDBusPropertyInfo * const _button_property_info_pointers[] =
25688{
25689 &_button_property_info_state,
Norman James493996c2015-10-31 17:27:13 -050025690 &_button_property_info_timer,
Norman James362a80f2015-09-14 14:04:39 -050025691 NULL
25692};
25693
25694static const _ExtendedGDBusInterfaceInfo _button_interface_info =
25695{
25696 {
25697 -1,
25698 (gchar *) "org.openbmc.Button",
25699 (GDBusMethodInfo **) &_button_method_info_pointers,
25700 (GDBusSignalInfo **) &_button_signal_info_pointers,
25701 (GDBusPropertyInfo **) &_button_property_info_pointers,
25702 NULL
25703 },
25704 "button",
25705};
25706
25707
25708/**
25709 * button_interface_info:
25710 *
25711 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link> D-Bus interface.
25712 *
25713 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
25714 */
25715GDBusInterfaceInfo *
25716button_interface_info (void)
25717{
25718 return (GDBusInterfaceInfo *) &_button_interface_info.parent_struct;
25719}
25720
25721/**
25722 * button_override_properties:
25723 * @klass: The class structure for a #GObject<!-- -->-derived class.
25724 * @property_id_begin: The property id to assign to the first overridden property.
25725 *
25726 * Overrides all #GObject properties in the #Button interface for a concrete class.
25727 * The properties are overridden in the order they are defined.
25728 *
25729 * Returns: The last property id.
25730 */
25731guint
25732button_override_properties (GObjectClass *klass, guint property_id_begin)
25733{
25734 g_object_class_override_property (klass, property_id_begin++, "state");
Norman James493996c2015-10-31 17:27:13 -050025735 g_object_class_override_property (klass, property_id_begin++, "timer");
Norman James362a80f2015-09-14 14:04:39 -050025736 return property_id_begin - 1;
25737}
25738
25739
25740
25741/**
25742 * Button:
25743 *
25744 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link>.
25745 */
25746
25747/**
25748 * ButtonIface:
25749 * @parent_iface: The parent interface.
25750 * @handle_is_on: Handler for the #Button::handle-is-on signal.
Norman James493996c2015-10-31 17:27:13 -050025751 * @handle_sim_long_press: Handler for the #Button::handle-sim-long-press signal.
25752 * @handle_sim_press: Handler for the #Button::handle-sim-press signal.
Norman James362a80f2015-09-14 14:04:39 -050025753 * @get_state: Getter for the #Button:state property.
Norman James493996c2015-10-31 17:27:13 -050025754 * @get_timer: Getter for the #Button:timer property.
25755 * @pressed: Handler for the #Button::pressed signal.
25756 * @pressed_long: Handler for the #Button::pressed-long signal.
25757 * @released: Handler for the #Button::released signal.
Norman James362a80f2015-09-14 14:04:39 -050025758 *
25759 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link>.
25760 */
25761
25762typedef ButtonIface ButtonInterface;
25763G_DEFINE_INTERFACE (Button, button, G_TYPE_OBJECT);
25764
25765static void
25766button_default_init (ButtonIface *iface)
25767{
25768 /* GObject signals for incoming D-Bus method calls: */
25769 /**
25770 * Button::handle-is-on:
25771 * @object: A #Button.
25772 * @invocation: A #GDBusMethodInvocation.
25773 *
25774 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Button.isOn">isOn()</link> D-Bus method.
25775 *
25776 * 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.
25777 *
25778 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
25779 */
25780 g_signal_new ("handle-is-on",
25781 G_TYPE_FROM_INTERFACE (iface),
25782 G_SIGNAL_RUN_LAST,
25783 G_STRUCT_OFFSET (ButtonIface, handle_is_on),
25784 g_signal_accumulator_true_handled,
25785 NULL,
25786 g_cclosure_marshal_generic,
25787 G_TYPE_BOOLEAN,
25788 1,
25789 G_TYPE_DBUS_METHOD_INVOCATION);
25790
25791 /**
Norman James493996c2015-10-31 17:27:13 -050025792 * Button::handle-sim-press:
Norman James362a80f2015-09-14 14:04:39 -050025793 * @object: A #Button.
25794 * @invocation: A #GDBusMethodInvocation.
25795 *
Norman James493996c2015-10-31 17:27:13 -050025796 * 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 -050025797 *
Norman James493996c2015-10-31 17:27:13 -050025798 * 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 -050025799 *
25800 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
25801 */
Norman James493996c2015-10-31 17:27:13 -050025802 g_signal_new ("handle-sim-press",
Norman James362a80f2015-09-14 14:04:39 -050025803 G_TYPE_FROM_INTERFACE (iface),
25804 G_SIGNAL_RUN_LAST,
Norman James493996c2015-10-31 17:27:13 -050025805 G_STRUCT_OFFSET (ButtonIface, handle_sim_press),
Norman James362a80f2015-09-14 14:04:39 -050025806 g_signal_accumulator_true_handled,
25807 NULL,
25808 g_cclosure_marshal_generic,
25809 G_TYPE_BOOLEAN,
25810 1,
25811 G_TYPE_DBUS_METHOD_INVOCATION);
25812
25813 /**
Norman James493996c2015-10-31 17:27:13 -050025814 * Button::handle-sim-long-press:
Norman James362a80f2015-09-14 14:04:39 -050025815 * @object: A #Button.
25816 * @invocation: A #GDBusMethodInvocation.
25817 *
Norman James493996c2015-10-31 17:27:13 -050025818 * 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 -050025819 *
Norman James493996c2015-10-31 17:27:13 -050025820 * 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 -050025821 *
25822 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
25823 */
Norman James493996c2015-10-31 17:27:13 -050025824 g_signal_new ("handle-sim-long-press",
Norman James362a80f2015-09-14 14:04:39 -050025825 G_TYPE_FROM_INTERFACE (iface),
25826 G_SIGNAL_RUN_LAST,
Norman James493996c2015-10-31 17:27:13 -050025827 G_STRUCT_OFFSET (ButtonIface, handle_sim_long_press),
Norman James362a80f2015-09-14 14:04:39 -050025828 g_signal_accumulator_true_handled,
25829 NULL,
25830 g_cclosure_marshal_generic,
25831 G_TYPE_BOOLEAN,
25832 1,
25833 G_TYPE_DBUS_METHOD_INVOCATION);
25834
25835 /* GObject signals for received D-Bus signals: */
25836 /**
Norman James493996c2015-10-31 17:27:13 -050025837 * Button::released:
Norman James362a80f2015-09-14 14:04:39 -050025838 * @object: A #Button.
25839 *
Norman James493996c2015-10-31 17:27:13 -050025840 * 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 -050025841 *
25842 * 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.
25843 */
Norman James493996c2015-10-31 17:27:13 -050025844 g_signal_new ("released",
Norman James362a80f2015-09-14 14:04:39 -050025845 G_TYPE_FROM_INTERFACE (iface),
25846 G_SIGNAL_RUN_LAST,
Norman James493996c2015-10-31 17:27:13 -050025847 G_STRUCT_OFFSET (ButtonIface, released),
Norman James362a80f2015-09-14 14:04:39 -050025848 NULL,
25849 NULL,
25850 g_cclosure_marshal_generic,
25851 G_TYPE_NONE,
25852 0);
25853
25854 /**
Norman James493996c2015-10-31 17:27:13 -050025855 * Button::pressed:
Norman James362a80f2015-09-14 14:04:39 -050025856 * @object: A #Button.
25857 *
Norman James493996c2015-10-31 17:27:13 -050025858 * 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 -050025859 *
25860 * 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.
25861 */
Norman James493996c2015-10-31 17:27:13 -050025862 g_signal_new ("pressed",
Norman James362a80f2015-09-14 14:04:39 -050025863 G_TYPE_FROM_INTERFACE (iface),
25864 G_SIGNAL_RUN_LAST,
Norman James493996c2015-10-31 17:27:13 -050025865 G_STRUCT_OFFSET (ButtonIface, pressed),
Norman James362a80f2015-09-14 14:04:39 -050025866 NULL,
25867 NULL,
25868 g_cclosure_marshal_generic,
25869 G_TYPE_NONE,
25870 0);
25871
25872 /**
Norman James493996c2015-10-31 17:27:13 -050025873 * Button::pressed-long:
Norman James362a80f2015-09-14 14:04:39 -050025874 * @object: A #Button.
25875 *
Norman James493996c2015-10-31 17:27:13 -050025876 * 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 -050025877 *
25878 * 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.
25879 */
Norman James493996c2015-10-31 17:27:13 -050025880 g_signal_new ("pressed-long",
Norman James362a80f2015-09-14 14:04:39 -050025881 G_TYPE_FROM_INTERFACE (iface),
25882 G_SIGNAL_RUN_LAST,
Norman James493996c2015-10-31 17:27:13 -050025883 G_STRUCT_OFFSET (ButtonIface, pressed_long),
Norman James362a80f2015-09-14 14:04:39 -050025884 NULL,
25885 NULL,
25886 g_cclosure_marshal_generic,
25887 G_TYPE_NONE,
25888 0);
25889
25890 /* GObject properties for D-Bus properties: */
25891 /**
25892 * Button:state:
25893 *
25894 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Button.state">"state"</link>.
25895 *
25896 * 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.
25897 */
25898 g_object_interface_install_property (iface,
25899 g_param_spec_boolean ("state", "state", "state", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Norman James493996c2015-10-31 17:27:13 -050025900 /**
25901 * Button:timer:
25902 *
25903 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Button.timer">"timer"</link>.
25904 *
25905 * 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.
25906 */
25907 g_object_interface_install_property (iface,
25908 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 -050025909}
25910
25911/**
25912 * button_get_state: (skip)
25913 * @object: A #Button.
25914 *
25915 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Button.state">"state"</link> D-Bus property.
25916 *
25917 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
25918 *
25919 * Returns: The property value.
25920 */
25921gboolean
25922button_get_state (Button *object)
25923{
25924 return BUTTON_GET_IFACE (object)->get_state (object);
25925}
25926
25927/**
25928 * button_set_state: (skip)
25929 * @object: A #Button.
25930 * @value: The value to set.
25931 *
25932 * Sets the <link linkend="gdbus-property-org-openbmc-Button.state">"state"</link> D-Bus property to @value.
25933 *
25934 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
25935 */
25936void
25937button_set_state (Button *object, gboolean value)
25938{
25939 g_object_set (G_OBJECT (object), "state", value, NULL);
25940}
25941
25942/**
Norman James493996c2015-10-31 17:27:13 -050025943 * button_get_timer: (skip)
Norman James362a80f2015-09-14 14:04:39 -050025944 * @object: A #Button.
25945 *
Norman James493996c2015-10-31 17:27:13 -050025946 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Button.timer">"timer"</link> D-Bus property.
25947 *
25948 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
25949 *
25950 * Returns: The property value.
Norman James362a80f2015-09-14 14:04:39 -050025951 */
Norman James493996c2015-10-31 17:27:13 -050025952guint64
25953button_get_timer (Button *object)
Norman James362a80f2015-09-14 14:04:39 -050025954{
Norman James493996c2015-10-31 17:27:13 -050025955 return BUTTON_GET_IFACE (object)->get_timer (object);
Norman James362a80f2015-09-14 14:04:39 -050025956}
25957
25958/**
Norman James493996c2015-10-31 17:27:13 -050025959 * button_set_timer: (skip)
Norman James362a80f2015-09-14 14:04:39 -050025960 * @object: A #Button.
Norman James493996c2015-10-31 17:27:13 -050025961 * @value: The value to set.
Norman James362a80f2015-09-14 14:04:39 -050025962 *
Norman James493996c2015-10-31 17:27:13 -050025963 * Sets the <link linkend="gdbus-property-org-openbmc-Button.timer">"timer"</link> D-Bus property to @value.
25964 *
25965 * 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 -050025966 */
25967void
Norman James493996c2015-10-31 17:27:13 -050025968button_set_timer (Button *object, guint64 value)
Norman James362a80f2015-09-14 14:04:39 -050025969{
Norman James493996c2015-10-31 17:27:13 -050025970 g_object_set (G_OBJECT (object), "timer", value, NULL);
Norman James362a80f2015-09-14 14:04:39 -050025971}
25972
25973/**
Norman James493996c2015-10-31 17:27:13 -050025974 * button_emit_released:
Norman James362a80f2015-09-14 14:04:39 -050025975 * @object: A #Button.
25976 *
Norman James493996c2015-10-31 17:27:13 -050025977 * Emits the <link linkend="gdbus-signal-org-openbmc-Button.Released">"Released"</link> D-Bus signal.
Norman James362a80f2015-09-14 14:04:39 -050025978 */
25979void
Norman James493996c2015-10-31 17:27:13 -050025980button_emit_released (
Norman James362a80f2015-09-14 14:04:39 -050025981 Button *object)
25982{
Norman James493996c2015-10-31 17:27:13 -050025983 g_signal_emit_by_name (object, "released");
25984}
25985
25986/**
25987 * button_emit_pressed:
25988 * @object: A #Button.
25989 *
25990 * Emits the <link linkend="gdbus-signal-org-openbmc-Button.Pressed">"Pressed"</link> D-Bus signal.
25991 */
25992void
25993button_emit_pressed (
25994 Button *object)
25995{
25996 g_signal_emit_by_name (object, "pressed");
25997}
25998
25999/**
26000 * button_emit_pressed_long:
26001 * @object: A #Button.
26002 *
26003 * Emits the <link linkend="gdbus-signal-org-openbmc-Button.PressedLong">"PressedLong"</link> D-Bus signal.
26004 */
26005void
26006button_emit_pressed_long (
26007 Button *object)
26008{
26009 g_signal_emit_by_name (object, "pressed-long");
Norman James362a80f2015-09-14 14:04:39 -050026010}
26011
26012/**
26013 * button_call_is_on:
26014 * @proxy: A #ButtonProxy.
26015 * @cancellable: (allow-none): A #GCancellable or %NULL.
26016 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
26017 * @user_data: User data to pass to @callback.
26018 *
26019 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.isOn">isOn()</link> D-Bus method on @proxy.
26020 * 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.
26021 * You can then call button_call_is_on_finish() to get the result of the operation.
26022 *
26023 * See button_call_is_on_sync() for the synchronous, blocking version of this method.
26024 */
26025void
26026button_call_is_on (
26027 Button *proxy,
26028 GCancellable *cancellable,
26029 GAsyncReadyCallback callback,
26030 gpointer user_data)
26031{
26032 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
26033 "isOn",
26034 g_variant_new ("()"),
26035 G_DBUS_CALL_FLAGS_NONE,
26036 -1,
26037 cancellable,
26038 callback,
26039 user_data);
26040}
26041
26042/**
26043 * button_call_is_on_finish:
26044 * @proxy: A #ButtonProxy.
26045 * @out_state: (out): Return location for return parameter or %NULL to ignore.
26046 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_call_is_on().
26047 * @error: Return location for error or %NULL.
26048 *
26049 * Finishes an operation started with button_call_is_on().
26050 *
26051 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
26052 */
26053gboolean
26054button_call_is_on_finish (
26055 Button *proxy,
26056 gboolean *out_state,
26057 GAsyncResult *res,
26058 GError **error)
26059{
26060 GVariant *_ret;
26061 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
26062 if (_ret == NULL)
26063 goto _out;
26064 g_variant_get (_ret,
26065 "(b)",
26066 out_state);
26067 g_variant_unref (_ret);
26068_out:
26069 return _ret != NULL;
26070}
26071
26072/**
26073 * button_call_is_on_sync:
26074 * @proxy: A #ButtonProxy.
26075 * @out_state: (out): Return location for return parameter or %NULL to ignore.
26076 * @cancellable: (allow-none): A #GCancellable or %NULL.
26077 * @error: Return location for error or %NULL.
26078 *
26079 * 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.
26080 *
26081 * See button_call_is_on() for the asynchronous version of this method.
26082 *
26083 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
26084 */
26085gboolean
26086button_call_is_on_sync (
26087 Button *proxy,
26088 gboolean *out_state,
26089 GCancellable *cancellable,
26090 GError **error)
26091{
26092 GVariant *_ret;
26093 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
26094 "isOn",
26095 g_variant_new ("()"),
26096 G_DBUS_CALL_FLAGS_NONE,
26097 -1,
26098 cancellable,
26099 error);
26100 if (_ret == NULL)
26101 goto _out;
26102 g_variant_get (_ret,
26103 "(b)",
26104 out_state);
26105 g_variant_unref (_ret);
26106_out:
26107 return _ret != NULL;
26108}
26109
26110/**
Norman James493996c2015-10-31 17:27:13 -050026111 * button_call_sim_press:
Norman James362a80f2015-09-14 14:04:39 -050026112 * @proxy: A #ButtonProxy.
26113 * @cancellable: (allow-none): A #GCancellable or %NULL.
26114 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
26115 * @user_data: User data to pass to @callback.
26116 *
Norman James493996c2015-10-31 17:27:13 -050026117 * 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 -050026118 * 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 -050026119 * You can then call button_call_sim_press_finish() to get the result of the operation.
Norman James362a80f2015-09-14 14:04:39 -050026120 *
Norman James493996c2015-10-31 17:27:13 -050026121 * See button_call_sim_press_sync() for the synchronous, blocking version of this method.
Norman James362a80f2015-09-14 14:04:39 -050026122 */
26123void
Norman James493996c2015-10-31 17:27:13 -050026124button_call_sim_press (
Norman James362a80f2015-09-14 14:04:39 -050026125 Button *proxy,
26126 GCancellable *cancellable,
26127 GAsyncReadyCallback callback,
26128 gpointer user_data)
26129{
26130 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
Norman James493996c2015-10-31 17:27:13 -050026131 "simPress",
Norman James362a80f2015-09-14 14:04:39 -050026132 g_variant_new ("()"),
26133 G_DBUS_CALL_FLAGS_NONE,
26134 -1,
26135 cancellable,
26136 callback,
26137 user_data);
26138}
26139
26140/**
Norman James493996c2015-10-31 17:27:13 -050026141 * button_call_sim_press_finish:
Norman James362a80f2015-09-14 14:04:39 -050026142 * @proxy: A #ButtonProxy.
Norman James493996c2015-10-31 17:27:13 -050026143 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_call_sim_press().
Norman James362a80f2015-09-14 14:04:39 -050026144 * @error: Return location for error or %NULL.
26145 *
Norman James493996c2015-10-31 17:27:13 -050026146 * Finishes an operation started with button_call_sim_press().
Norman James362a80f2015-09-14 14:04:39 -050026147 *
26148 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
26149 */
26150gboolean
Norman James493996c2015-10-31 17:27:13 -050026151button_call_sim_press_finish (
Norman James362a80f2015-09-14 14:04:39 -050026152 Button *proxy,
26153 GAsyncResult *res,
26154 GError **error)
26155{
26156 GVariant *_ret;
26157 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
26158 if (_ret == NULL)
26159 goto _out;
26160 g_variant_get (_ret,
26161 "()");
26162 g_variant_unref (_ret);
26163_out:
26164 return _ret != NULL;
26165}
26166
26167/**
Norman James493996c2015-10-31 17:27:13 -050026168 * button_call_sim_press_sync:
Norman James362a80f2015-09-14 14:04:39 -050026169 * @proxy: A #ButtonProxy.
26170 * @cancellable: (allow-none): A #GCancellable or %NULL.
26171 * @error: Return location for error or %NULL.
26172 *
Norman James493996c2015-10-31 17:27:13 -050026173 * 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 -050026174 *
Norman James493996c2015-10-31 17:27:13 -050026175 * See button_call_sim_press() for the asynchronous version of this method.
Norman James362a80f2015-09-14 14:04:39 -050026176 *
26177 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
26178 */
26179gboolean
Norman James493996c2015-10-31 17:27:13 -050026180button_call_sim_press_sync (
Norman James362a80f2015-09-14 14:04:39 -050026181 Button *proxy,
26182 GCancellable *cancellable,
26183 GError **error)
26184{
26185 GVariant *_ret;
26186 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
Norman James493996c2015-10-31 17:27:13 -050026187 "simPress",
Norman James362a80f2015-09-14 14:04:39 -050026188 g_variant_new ("()"),
26189 G_DBUS_CALL_FLAGS_NONE,
26190 -1,
26191 cancellable,
26192 error);
26193 if (_ret == NULL)
26194 goto _out;
26195 g_variant_get (_ret,
26196 "()");
26197 g_variant_unref (_ret);
26198_out:
26199 return _ret != NULL;
26200}
26201
26202/**
Norman James493996c2015-10-31 17:27:13 -050026203 * button_call_sim_long_press:
Norman James362a80f2015-09-14 14:04:39 -050026204 * @proxy: A #ButtonProxy.
26205 * @cancellable: (allow-none): A #GCancellable or %NULL.
26206 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
26207 * @user_data: User data to pass to @callback.
26208 *
Norman James493996c2015-10-31 17:27:13 -050026209 * 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 -050026210 * 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 -050026211 * You can then call button_call_sim_long_press_finish() to get the result of the operation.
Norman James362a80f2015-09-14 14:04:39 -050026212 *
Norman James493996c2015-10-31 17:27:13 -050026213 * See button_call_sim_long_press_sync() for the synchronous, blocking version of this method.
Norman James362a80f2015-09-14 14:04:39 -050026214 */
26215void
Norman James493996c2015-10-31 17:27:13 -050026216button_call_sim_long_press (
Norman James362a80f2015-09-14 14:04:39 -050026217 Button *proxy,
26218 GCancellable *cancellable,
26219 GAsyncReadyCallback callback,
26220 gpointer user_data)
26221{
26222 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
Norman James493996c2015-10-31 17:27:13 -050026223 "simLongPress",
Norman James362a80f2015-09-14 14:04:39 -050026224 g_variant_new ("()"),
26225 G_DBUS_CALL_FLAGS_NONE,
26226 -1,
26227 cancellable,
26228 callback,
26229 user_data);
26230}
26231
26232/**
Norman James493996c2015-10-31 17:27:13 -050026233 * button_call_sim_long_press_finish:
Norman James362a80f2015-09-14 14:04:39 -050026234 * @proxy: A #ButtonProxy.
Norman James493996c2015-10-31 17:27:13 -050026235 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_call_sim_long_press().
Norman James362a80f2015-09-14 14:04:39 -050026236 * @error: Return location for error or %NULL.
26237 *
Norman James493996c2015-10-31 17:27:13 -050026238 * Finishes an operation started with button_call_sim_long_press().
Norman James362a80f2015-09-14 14:04:39 -050026239 *
26240 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
26241 */
26242gboolean
Norman James493996c2015-10-31 17:27:13 -050026243button_call_sim_long_press_finish (
Norman James362a80f2015-09-14 14:04:39 -050026244 Button *proxy,
26245 GAsyncResult *res,
26246 GError **error)
26247{
26248 GVariant *_ret;
26249 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
26250 if (_ret == NULL)
26251 goto _out;
26252 g_variant_get (_ret,
26253 "()");
26254 g_variant_unref (_ret);
26255_out:
26256 return _ret != NULL;
26257}
26258
26259/**
Norman James493996c2015-10-31 17:27:13 -050026260 * button_call_sim_long_press_sync:
Norman James362a80f2015-09-14 14:04:39 -050026261 * @proxy: A #ButtonProxy.
26262 * @cancellable: (allow-none): A #GCancellable or %NULL.
26263 * @error: Return location for error or %NULL.
26264 *
Norman James493996c2015-10-31 17:27:13 -050026265 * 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 -050026266 *
Norman James493996c2015-10-31 17:27:13 -050026267 * See button_call_sim_long_press() for the asynchronous version of this method.
Norman James362a80f2015-09-14 14:04:39 -050026268 *
26269 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
26270 */
26271gboolean
Norman James493996c2015-10-31 17:27:13 -050026272button_call_sim_long_press_sync (
Norman James362a80f2015-09-14 14:04:39 -050026273 Button *proxy,
26274 GCancellable *cancellable,
26275 GError **error)
26276{
26277 GVariant *_ret;
26278 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
Norman James493996c2015-10-31 17:27:13 -050026279 "simLongPress",
Norman James362a80f2015-09-14 14:04:39 -050026280 g_variant_new ("()"),
26281 G_DBUS_CALL_FLAGS_NONE,
26282 -1,
26283 cancellable,
26284 error);
26285 if (_ret == NULL)
26286 goto _out;
26287 g_variant_get (_ret,
26288 "()");
26289 g_variant_unref (_ret);
26290_out:
26291 return _ret != NULL;
26292}
26293
26294/**
26295 * button_complete_is_on:
26296 * @object: A #Button.
26297 * @invocation: (transfer full): A #GDBusMethodInvocation.
26298 * @state: Parameter to return.
26299 *
26300 * 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.
26301 *
26302 * This method will free @invocation, you cannot use it afterwards.
26303 */
26304void
26305button_complete_is_on (
26306 Button *object,
26307 GDBusMethodInvocation *invocation,
26308 gboolean state)
26309{
26310 g_dbus_method_invocation_return_value (invocation,
26311 g_variant_new ("(b)",
26312 state));
26313}
26314
26315/**
Norman James493996c2015-10-31 17:27:13 -050026316 * button_complete_sim_press:
Norman James362a80f2015-09-14 14:04:39 -050026317 * @object: A #Button.
26318 * @invocation: (transfer full): A #GDBusMethodInvocation.
26319 *
Norman James493996c2015-10-31 17:27:13 -050026320 * 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 -050026321 *
26322 * This method will free @invocation, you cannot use it afterwards.
26323 */
26324void
Norman James493996c2015-10-31 17:27:13 -050026325button_complete_sim_press (
Norman James362a80f2015-09-14 14:04:39 -050026326 Button *object,
26327 GDBusMethodInvocation *invocation)
26328{
26329 g_dbus_method_invocation_return_value (invocation,
26330 g_variant_new ("()"));
26331}
26332
26333/**
Norman James493996c2015-10-31 17:27:13 -050026334 * button_complete_sim_long_press:
Norman James362a80f2015-09-14 14:04:39 -050026335 * @object: A #Button.
26336 * @invocation: (transfer full): A #GDBusMethodInvocation.
26337 *
Norman James493996c2015-10-31 17:27:13 -050026338 * 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 -050026339 *
26340 * This method will free @invocation, you cannot use it afterwards.
26341 */
26342void
Norman James493996c2015-10-31 17:27:13 -050026343button_complete_sim_long_press (
Norman James362a80f2015-09-14 14:04:39 -050026344 Button *object,
26345 GDBusMethodInvocation *invocation)
26346{
26347 g_dbus_method_invocation_return_value (invocation,
26348 g_variant_new ("()"));
26349}
26350
26351/* ------------------------------------------------------------------------ */
26352
26353/**
26354 * ButtonProxy:
26355 *
26356 * The #ButtonProxy structure contains only private data and should only be accessed using the provided API.
26357 */
26358
26359/**
26360 * ButtonProxyClass:
26361 * @parent_class: The parent class.
26362 *
26363 * Class structure for #ButtonProxy.
26364 */
26365
26366struct _ButtonProxyPrivate
26367{
26368 GData *qdata;
26369};
26370
26371static void button_proxy_iface_init (ButtonIface *iface);
26372
26373#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
26374G_DEFINE_TYPE_WITH_CODE (ButtonProxy, button_proxy, G_TYPE_DBUS_PROXY,
26375 G_ADD_PRIVATE (ButtonProxy)
26376 G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_proxy_iface_init));
26377
26378#else
26379G_DEFINE_TYPE_WITH_CODE (ButtonProxy, button_proxy, G_TYPE_DBUS_PROXY,
26380 G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_proxy_iface_init));
26381
26382#endif
26383static void
26384button_proxy_finalize (GObject *object)
26385{
26386 ButtonProxy *proxy = BUTTON_PROXY (object);
26387 g_datalist_clear (&proxy->priv->qdata);
26388 G_OBJECT_CLASS (button_proxy_parent_class)->finalize (object);
26389}
26390
26391static void
26392button_proxy_get_property (GObject *object,
26393 guint prop_id,
26394 GValue *value,
26395 GParamSpec *pspec G_GNUC_UNUSED)
26396{
26397 const _ExtendedGDBusPropertyInfo *info;
26398 GVariant *variant;
Norman James493996c2015-10-31 17:27:13 -050026399 g_assert (prop_id != 0 && prop_id - 1 < 2);
Norman James362a80f2015-09-14 14:04:39 -050026400 info = _button_property_info_pointers[prop_id - 1];
26401 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
26402 if (info->use_gvariant)
26403 {
26404 g_value_set_variant (value, variant);
26405 }
26406 else
26407 {
26408 if (variant != NULL)
26409 g_dbus_gvariant_to_gvalue (variant, value);
26410 }
26411 if (variant != NULL)
26412 g_variant_unref (variant);
26413}
26414
26415static void
26416button_proxy_set_property_cb (GDBusProxy *proxy,
26417 GAsyncResult *res,
26418 gpointer user_data)
26419{
26420 const _ExtendedGDBusPropertyInfo *info = user_data;
26421 GError *error;
26422 GVariant *_ret;
26423 error = NULL;
26424 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
26425 if (!_ret)
26426 {
26427 g_warning ("Error setting property '%s' on interface org.openbmc.Button: %s (%s, %d)",
26428 info->parent_struct.name,
26429 error->message, g_quark_to_string (error->domain), error->code);
26430 g_error_free (error);
26431 }
26432 else
26433 {
26434 g_variant_unref (_ret);
26435 }
26436}
26437
26438static void
26439button_proxy_set_property (GObject *object,
26440 guint prop_id,
26441 const GValue *value,
26442 GParamSpec *pspec G_GNUC_UNUSED)
26443{
26444 const _ExtendedGDBusPropertyInfo *info;
26445 GVariant *variant;
Norman James493996c2015-10-31 17:27:13 -050026446 g_assert (prop_id != 0 && prop_id - 1 < 2);
Norman James362a80f2015-09-14 14:04:39 -050026447 info = _button_property_info_pointers[prop_id - 1];
26448 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
26449 g_dbus_proxy_call (G_DBUS_PROXY (object),
26450 "org.freedesktop.DBus.Properties.Set",
26451 g_variant_new ("(ssv)", "org.openbmc.Button", info->parent_struct.name, variant),
26452 G_DBUS_CALL_FLAGS_NONE,
26453 -1,
26454 NULL, (GAsyncReadyCallback) button_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
26455 g_variant_unref (variant);
26456}
26457
26458static void
26459button_proxy_g_signal (GDBusProxy *proxy,
26460 const gchar *sender_name G_GNUC_UNUSED,
26461 const gchar *signal_name,
26462 GVariant *parameters)
26463{
26464 _ExtendedGDBusSignalInfo *info;
26465 GVariantIter iter;
26466 GVariant *child;
26467 GValue *paramv;
26468 guint num_params;
26469 guint n;
26470 guint signal_id;
26471 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, signal_name);
26472 if (info == NULL)
26473 return;
26474 num_params = g_variant_n_children (parameters);
26475 paramv = g_new0 (GValue, num_params + 1);
26476 g_value_init (&paramv[0], TYPE_BUTTON);
26477 g_value_set_object (&paramv[0], proxy);
26478 g_variant_iter_init (&iter, parameters);
26479 n = 1;
26480 while ((child = g_variant_iter_next_value (&iter)) != NULL)
26481 {
26482 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
26483 if (arg_info->use_gvariant)
26484 {
26485 g_value_init (&paramv[n], G_TYPE_VARIANT);
26486 g_value_set_variant (&paramv[n], child);
26487 n++;
26488 }
26489 else
26490 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
26491 g_variant_unref (child);
26492 }
26493 signal_id = g_signal_lookup (info->signal_name, TYPE_BUTTON);
26494 g_signal_emitv (paramv, signal_id, 0, NULL);
26495 for (n = 0; n < num_params + 1; n++)
26496 g_value_unset (&paramv[n]);
26497 g_free (paramv);
26498}
26499
26500static void
26501button_proxy_g_properties_changed (GDBusProxy *_proxy,
26502 GVariant *changed_properties,
26503 const gchar *const *invalidated_properties)
26504{
26505 ButtonProxy *proxy = BUTTON_PROXY (_proxy);
26506 guint n;
26507 const gchar *key;
26508 GVariantIter *iter;
26509 _ExtendedGDBusPropertyInfo *info;
26510 g_variant_get (changed_properties, "a{sv}", &iter);
26511 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
26512 {
26513 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, key);
26514 g_datalist_remove_data (&proxy->priv->qdata, key);
26515 if (info != NULL)
26516 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
26517 }
26518 g_variant_iter_free (iter);
26519 for (n = 0; invalidated_properties[n] != NULL; n++)
26520 {
26521 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, invalidated_properties[n]);
26522 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
26523 if (info != NULL)
26524 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
26525 }
26526}
26527
26528static gboolean
26529button_proxy_get_state (Button *object)
26530{
26531 ButtonProxy *proxy = BUTTON_PROXY (object);
26532 GVariant *variant;
26533 gboolean value = 0;
26534 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state");
26535 if (variant != NULL)
26536 {
26537 value = g_variant_get_boolean (variant);
26538 g_variant_unref (variant);
26539 }
26540 return value;
26541}
26542
Norman James493996c2015-10-31 17:27:13 -050026543static guint64
26544button_proxy_get_timer (Button *object)
26545{
26546 ButtonProxy *proxy = BUTTON_PROXY (object);
26547 GVariant *variant;
26548 guint64 value = 0;
26549 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "timer");
26550 if (variant != NULL)
26551 {
26552 value = g_variant_get_uint64 (variant);
26553 g_variant_unref (variant);
26554 }
26555 return value;
26556}
26557
Norman James362a80f2015-09-14 14:04:39 -050026558static void
26559button_proxy_init (ButtonProxy *proxy)
26560{
26561#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
26562 proxy->priv = button_proxy_get_instance_private (proxy);
26563#else
26564 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_BUTTON_PROXY, ButtonProxyPrivate);
26565#endif
26566
26567 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), button_interface_info ());
26568}
26569
26570static void
26571button_proxy_class_init (ButtonProxyClass *klass)
26572{
26573 GObjectClass *gobject_class;
26574 GDBusProxyClass *proxy_class;
26575
26576 gobject_class = G_OBJECT_CLASS (klass);
26577 gobject_class->finalize = button_proxy_finalize;
26578 gobject_class->get_property = button_proxy_get_property;
26579 gobject_class->set_property = button_proxy_set_property;
26580
26581 proxy_class = G_DBUS_PROXY_CLASS (klass);
26582 proxy_class->g_signal = button_proxy_g_signal;
26583 proxy_class->g_properties_changed = button_proxy_g_properties_changed;
26584
26585 button_override_properties (gobject_class, 1);
26586
26587#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
26588 g_type_class_add_private (klass, sizeof (ButtonProxyPrivate));
26589#endif
26590}
26591
26592static void
26593button_proxy_iface_init (ButtonIface *iface)
26594{
26595 iface->get_state = button_proxy_get_state;
Norman James493996c2015-10-31 17:27:13 -050026596 iface->get_timer = button_proxy_get_timer;
Norman James362a80f2015-09-14 14:04:39 -050026597}
26598
26599/**
26600 * button_proxy_new:
26601 * @connection: A #GDBusConnection.
26602 * @flags: Flags from the #GDBusProxyFlags enumeration.
26603 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
26604 * @object_path: An object path.
26605 * @cancellable: (allow-none): A #GCancellable or %NULL.
26606 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
26607 * @user_data: User data to pass to @callback.
26608 *
26609 * 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.
26610 *
26611 * 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.
26612 * You can then call button_proxy_new_finish() to get the result of the operation.
26613 *
26614 * See button_proxy_new_sync() for the synchronous, blocking version of this constructor.
26615 */
26616void
26617button_proxy_new (
26618 GDBusConnection *connection,
26619 GDBusProxyFlags flags,
26620 const gchar *name,
26621 const gchar *object_path,
26622 GCancellable *cancellable,
26623 GAsyncReadyCallback callback,
26624 gpointer user_data)
26625{
26626 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);
26627}
26628
26629/**
26630 * button_proxy_new_finish:
26631 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_proxy_new().
26632 * @error: Return location for error or %NULL
26633 *
26634 * Finishes an operation started with button_proxy_new().
26635 *
26636 * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set.
26637 */
26638Button *
26639button_proxy_new_finish (
26640 GAsyncResult *res,
26641 GError **error)
26642{
26643 GObject *ret;
26644 GObject *source_object;
26645 source_object = g_async_result_get_source_object (res);
26646 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
26647 g_object_unref (source_object);
26648 if (ret != NULL)
26649 return BUTTON (ret);
26650 else
26651 return NULL;
26652}
26653
26654/**
26655 * button_proxy_new_sync:
26656 * @connection: A #GDBusConnection.
26657 * @flags: Flags from the #GDBusProxyFlags enumeration.
26658 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
26659 * @object_path: An object path.
26660 * @cancellable: (allow-none): A #GCancellable or %NULL.
26661 * @error: Return location for error or %NULL
26662 *
26663 * 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.
26664 *
26665 * The calling thread is blocked until a reply is received.
26666 *
26667 * See button_proxy_new() for the asynchronous version of this constructor.
26668 *
26669 * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set.
26670 */
26671Button *
26672button_proxy_new_sync (
26673 GDBusConnection *connection,
26674 GDBusProxyFlags flags,
26675 const gchar *name,
26676 const gchar *object_path,
26677 GCancellable *cancellable,
26678 GError **error)
26679{
26680 GInitable *ret;
26681 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);
26682 if (ret != NULL)
26683 return BUTTON (ret);
26684 else
26685 return NULL;
26686}
26687
26688
26689/**
26690 * button_proxy_new_for_bus:
26691 * @bus_type: A #GBusType.
26692 * @flags: Flags from the #GDBusProxyFlags enumeration.
26693 * @name: A bus name (well-known or unique).
26694 * @object_path: An object path.
26695 * @cancellable: (allow-none): A #GCancellable or %NULL.
26696 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
26697 * @user_data: User data to pass to @callback.
26698 *
26699 * Like button_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
26700 *
26701 * 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.
26702 * You can then call button_proxy_new_for_bus_finish() to get the result of the operation.
26703 *
26704 * See button_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
26705 */
26706void
26707button_proxy_new_for_bus (
26708 GBusType bus_type,
26709 GDBusProxyFlags flags,
26710 const gchar *name,
26711 const gchar *object_path,
26712 GCancellable *cancellable,
26713 GAsyncReadyCallback callback,
26714 gpointer user_data)
26715{
26716 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);
26717}
26718
26719/**
26720 * button_proxy_new_for_bus_finish:
26721 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_proxy_new_for_bus().
26722 * @error: Return location for error or %NULL
26723 *
26724 * Finishes an operation started with button_proxy_new_for_bus().
26725 *
26726 * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set.
26727 */
26728Button *
26729button_proxy_new_for_bus_finish (
26730 GAsyncResult *res,
26731 GError **error)
26732{
26733 GObject *ret;
26734 GObject *source_object;
26735 source_object = g_async_result_get_source_object (res);
26736 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
26737 g_object_unref (source_object);
26738 if (ret != NULL)
26739 return BUTTON (ret);
26740 else
26741 return NULL;
26742}
26743
26744/**
26745 * button_proxy_new_for_bus_sync:
26746 * @bus_type: A #GBusType.
26747 * @flags: Flags from the #GDBusProxyFlags enumeration.
26748 * @name: A bus name (well-known or unique).
26749 * @object_path: An object path.
26750 * @cancellable: (allow-none): A #GCancellable or %NULL.
26751 * @error: Return location for error or %NULL
26752 *
26753 * Like button_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
26754 *
26755 * The calling thread is blocked until a reply is received.
26756 *
26757 * See button_proxy_new_for_bus() for the asynchronous version of this constructor.
26758 *
26759 * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set.
26760 */
26761Button *
26762button_proxy_new_for_bus_sync (
26763 GBusType bus_type,
26764 GDBusProxyFlags flags,
26765 const gchar *name,
26766 const gchar *object_path,
26767 GCancellable *cancellable,
26768 GError **error)
26769{
26770 GInitable *ret;
26771 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);
26772 if (ret != NULL)
26773 return BUTTON (ret);
26774 else
26775 return NULL;
26776}
26777
26778
26779/* ------------------------------------------------------------------------ */
26780
26781/**
26782 * ButtonSkeleton:
26783 *
26784 * The #ButtonSkeleton structure contains only private data and should only be accessed using the provided API.
26785 */
26786
26787/**
26788 * ButtonSkeletonClass:
26789 * @parent_class: The parent class.
26790 *
26791 * Class structure for #ButtonSkeleton.
26792 */
26793
26794struct _ButtonSkeletonPrivate
26795{
26796 GValue *properties;
26797 GList *changed_properties;
26798 GSource *changed_properties_idle_source;
26799 GMainContext *context;
26800 GMutex lock;
26801};
26802
26803static void
26804_button_skeleton_handle_method_call (
26805 GDBusConnection *connection G_GNUC_UNUSED,
26806 const gchar *sender G_GNUC_UNUSED,
26807 const gchar *object_path G_GNUC_UNUSED,
26808 const gchar *interface_name,
26809 const gchar *method_name,
26810 GVariant *parameters,
26811 GDBusMethodInvocation *invocation,
26812 gpointer user_data)
26813{
26814 ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data);
26815 _ExtendedGDBusMethodInfo *info;
26816 GVariantIter iter;
26817 GVariant *child;
26818 GValue *paramv;
26819 guint num_params;
26820 guint num_extra;
26821 guint n;
26822 guint signal_id;
26823 GValue return_value = G_VALUE_INIT;
26824 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
26825 g_assert (info != NULL);
26826 num_params = g_variant_n_children (parameters);
26827 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
26828 n = 0;
26829 g_value_init (&paramv[n], TYPE_BUTTON);
26830 g_value_set_object (&paramv[n++], skeleton);
26831 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
26832 g_value_set_object (&paramv[n++], invocation);
26833 if (info->pass_fdlist)
26834 {
26835#ifdef G_OS_UNIX
26836 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
26837 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
26838#else
26839 g_assert_not_reached ();
26840#endif
26841 }
26842 g_variant_iter_init (&iter, parameters);
26843 while ((child = g_variant_iter_next_value (&iter)) != NULL)
26844 {
26845 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
26846 if (arg_info->use_gvariant)
26847 {
26848 g_value_init (&paramv[n], G_TYPE_VARIANT);
26849 g_value_set_variant (&paramv[n], child);
26850 n++;
26851 }
26852 else
26853 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
26854 g_variant_unref (child);
26855 }
26856 signal_id = g_signal_lookup (info->signal_name, TYPE_BUTTON);
26857 g_value_init (&return_value, G_TYPE_BOOLEAN);
26858 g_signal_emitv (paramv, signal_id, 0, &return_value);
26859 if (!g_value_get_boolean (&return_value))
26860 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);
26861 g_value_unset (&return_value);
26862 for (n = 0; n < num_params + num_extra; n++)
26863 g_value_unset (&paramv[n]);
26864 g_free (paramv);
26865}
26866
26867static GVariant *
26868_button_skeleton_handle_get_property (
26869 GDBusConnection *connection G_GNUC_UNUSED,
26870 const gchar *sender G_GNUC_UNUSED,
26871 const gchar *object_path G_GNUC_UNUSED,
26872 const gchar *interface_name G_GNUC_UNUSED,
26873 const gchar *property_name,
26874 GError **error,
26875 gpointer user_data)
26876{
26877 ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data);
26878 GValue value = G_VALUE_INIT;
26879 GParamSpec *pspec;
26880 _ExtendedGDBusPropertyInfo *info;
26881 GVariant *ret;
26882 ret = NULL;
26883 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, property_name);
26884 g_assert (info != NULL);
26885 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
26886 if (pspec == NULL)
26887 {
26888 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
26889 }
26890 else
26891 {
26892 g_value_init (&value, pspec->value_type);
26893 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
26894 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
26895 g_value_unset (&value);
26896 }
26897 return ret;
26898}
26899
26900static gboolean
26901_button_skeleton_handle_set_property (
26902 GDBusConnection *connection G_GNUC_UNUSED,
26903 const gchar *sender G_GNUC_UNUSED,
26904 const gchar *object_path G_GNUC_UNUSED,
26905 const gchar *interface_name G_GNUC_UNUSED,
26906 const gchar *property_name,
26907 GVariant *variant,
26908 GError **error,
26909 gpointer user_data)
26910{
26911 ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data);
26912 GValue value = G_VALUE_INIT;
26913 GParamSpec *pspec;
26914 _ExtendedGDBusPropertyInfo *info;
26915 gboolean ret;
26916 ret = FALSE;
26917 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, property_name);
26918 g_assert (info != NULL);
26919 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
26920 if (pspec == NULL)
26921 {
26922 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
26923 }
26924 else
26925 {
26926 if (info->use_gvariant)
26927 g_value_set_variant (&value, variant);
26928 else
26929 g_dbus_gvariant_to_gvalue (variant, &value);
26930 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
26931 g_value_unset (&value);
26932 ret = TRUE;
26933 }
26934 return ret;
26935}
26936
26937static const GDBusInterfaceVTable _button_skeleton_vtable =
26938{
26939 _button_skeleton_handle_method_call,
26940 _button_skeleton_handle_get_property,
26941 _button_skeleton_handle_set_property,
26942 {NULL}
26943};
26944
26945static GDBusInterfaceInfo *
26946button_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
26947{
26948 return button_interface_info ();
26949}
26950
26951static GDBusInterfaceVTable *
26952button_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
26953{
26954 return (GDBusInterfaceVTable *) &_button_skeleton_vtable;
26955}
26956
26957static GVariant *
26958button_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
26959{
26960 ButtonSkeleton *skeleton = BUTTON_SKELETON (_skeleton);
26961
26962 GVariantBuilder builder;
26963 guint n;
26964 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
26965 if (_button_interface_info.parent_struct.properties == NULL)
26966 goto out;
26967 for (n = 0; _button_interface_info.parent_struct.properties[n] != NULL; n++)
26968 {
26969 GDBusPropertyInfo *info = _button_interface_info.parent_struct.properties[n];
26970 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
26971 {
26972 GVariant *value;
26973 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);
26974 if (value != NULL)
26975 {
26976 g_variant_take_ref (value);
26977 g_variant_builder_add (&builder, "{sv}", info->name, value);
26978 g_variant_unref (value);
26979 }
26980 }
26981 }
26982out:
26983 return g_variant_builder_end (&builder);
26984}
26985
26986static gboolean _button_emit_changed (gpointer user_data);
26987
26988static void
26989button_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
26990{
26991 ButtonSkeleton *skeleton = BUTTON_SKELETON (_skeleton);
26992 gboolean emit_changed = FALSE;
26993
26994 g_mutex_lock (&skeleton->priv->lock);
26995 if (skeleton->priv->changed_properties_idle_source != NULL)
26996 {
26997 g_source_destroy (skeleton->priv->changed_properties_idle_source);
26998 skeleton->priv->changed_properties_idle_source = NULL;
26999 emit_changed = TRUE;
27000 }
27001 g_mutex_unlock (&skeleton->priv->lock);
27002
27003 if (emit_changed)
27004 _button_emit_changed (skeleton);
27005}
27006
27007static void
Norman James493996c2015-10-31 17:27:13 -050027008_button_on_signal_released (
Norman James362a80f2015-09-14 14:04:39 -050027009 Button *object)
27010{
27011 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
27012
27013 GList *connections, *l;
27014 GVariant *signal_variant;
27015 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
27016
27017 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
27018 for (l = connections; l != NULL; l = l->next)
27019 {
27020 GDBusConnection *connection = l->data;
27021 g_dbus_connection_emit_signal (connection,
Norman James493996c2015-10-31 17:27:13 -050027022 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Button", "Released",
Norman James362a80f2015-09-14 14:04:39 -050027023 signal_variant, NULL);
27024 }
27025 g_variant_unref (signal_variant);
27026 g_list_free_full (connections, g_object_unref);
27027}
27028
27029static void
Norman James493996c2015-10-31 17:27:13 -050027030_button_on_signal_pressed (
Norman James362a80f2015-09-14 14:04:39 -050027031 Button *object)
27032{
27033 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
27034
27035 GList *connections, *l;
27036 GVariant *signal_variant;
27037 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
27038
27039 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
27040 for (l = connections; l != NULL; l = l->next)
27041 {
27042 GDBusConnection *connection = l->data;
27043 g_dbus_connection_emit_signal (connection,
Norman James493996c2015-10-31 17:27:13 -050027044 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Button", "Pressed",
Norman James362a80f2015-09-14 14:04:39 -050027045 signal_variant, NULL);
27046 }
27047 g_variant_unref (signal_variant);
27048 g_list_free_full (connections, g_object_unref);
27049}
27050
27051static void
Norman James493996c2015-10-31 17:27:13 -050027052_button_on_signal_pressed_long (
Norman James362a80f2015-09-14 14:04:39 -050027053 Button *object)
27054{
27055 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
27056
27057 GList *connections, *l;
27058 GVariant *signal_variant;
27059 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
27060
27061 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
27062 for (l = connections; l != NULL; l = l->next)
27063 {
27064 GDBusConnection *connection = l->data;
27065 g_dbus_connection_emit_signal (connection,
Norman James493996c2015-10-31 17:27:13 -050027066 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Button", "PressedLong",
Norman James362a80f2015-09-14 14:04:39 -050027067 signal_variant, NULL);
27068 }
27069 g_variant_unref (signal_variant);
27070 g_list_free_full (connections, g_object_unref);
27071}
27072
27073static void button_skeleton_iface_init (ButtonIface *iface);
27074#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
27075G_DEFINE_TYPE_WITH_CODE (ButtonSkeleton, button_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
27076 G_ADD_PRIVATE (ButtonSkeleton)
27077 G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_skeleton_iface_init));
27078
27079#else
27080G_DEFINE_TYPE_WITH_CODE (ButtonSkeleton, button_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
27081 G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_skeleton_iface_init));
27082
27083#endif
27084static void
27085button_skeleton_finalize (GObject *object)
27086{
27087 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
27088 guint n;
Norman James493996c2015-10-31 17:27:13 -050027089 for (n = 0; n < 2; n++)
Norman James362a80f2015-09-14 14:04:39 -050027090 g_value_unset (&skeleton->priv->properties[n]);
27091 g_free (skeleton->priv->properties);
27092 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
27093 if (skeleton->priv->changed_properties_idle_source != NULL)
27094 g_source_destroy (skeleton->priv->changed_properties_idle_source);
27095 g_main_context_unref (skeleton->priv->context);
27096 g_mutex_clear (&skeleton->priv->lock);
27097 G_OBJECT_CLASS (button_skeleton_parent_class)->finalize (object);
27098}
27099
27100static void
27101button_skeleton_get_property (GObject *object,
27102 guint prop_id,
27103 GValue *value,
27104 GParamSpec *pspec G_GNUC_UNUSED)
27105{
27106 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
Norman James493996c2015-10-31 17:27:13 -050027107 g_assert (prop_id != 0 && prop_id - 1 < 2);
Norman James362a80f2015-09-14 14:04:39 -050027108 g_mutex_lock (&skeleton->priv->lock);
27109 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
27110 g_mutex_unlock (&skeleton->priv->lock);
27111}
27112
27113static gboolean
27114_button_emit_changed (gpointer user_data)
27115{
27116 ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data);
27117 GList *l;
27118 GVariantBuilder builder;
27119 GVariantBuilder invalidated_builder;
27120 guint num_changes;
27121
27122 g_mutex_lock (&skeleton->priv->lock);
27123 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
27124 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
27125 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
27126 {
27127 ChangedProperty *cp = l->data;
27128 GVariant *variant;
27129 const GValue *cur_value;
27130
27131 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
27132 if (!_g_value_equal (cur_value, &cp->orig_value))
27133 {
27134 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
27135 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
27136 g_variant_unref (variant);
27137 num_changes++;
27138 }
27139 }
27140 if (num_changes > 0)
27141 {
27142 GList *connections, *ll;
27143 GVariant *signal_variant;
27144 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Button",
27145 &builder, &invalidated_builder));
27146 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
27147 for (ll = connections; ll != NULL; ll = ll->next)
27148 {
27149 GDBusConnection *connection = ll->data;
27150
27151 g_dbus_connection_emit_signal (connection,
27152 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
27153 "org.freedesktop.DBus.Properties",
27154 "PropertiesChanged",
27155 signal_variant,
27156 NULL);
27157 }
27158 g_variant_unref (signal_variant);
27159 g_list_free_full (connections, g_object_unref);
27160 }
27161 else
27162 {
27163 g_variant_builder_clear (&builder);
27164 g_variant_builder_clear (&invalidated_builder);
27165 }
27166 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
27167 skeleton->priv->changed_properties = NULL;
27168 skeleton->priv->changed_properties_idle_source = NULL;
27169 g_mutex_unlock (&skeleton->priv->lock);
27170 return FALSE;
27171}
27172
27173static void
27174_button_schedule_emit_changed (ButtonSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
27175{
27176 ChangedProperty *cp;
27177 GList *l;
27178 cp = NULL;
27179 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
27180 {
27181 ChangedProperty *i_cp = l->data;
27182 if (i_cp->info == info)
27183 {
27184 cp = i_cp;
27185 break;
27186 }
27187 }
27188 if (cp == NULL)
27189 {
27190 cp = g_new0 (ChangedProperty, 1);
27191 cp->prop_id = prop_id;
27192 cp->info = info;
27193 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
27194 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
27195 g_value_copy (orig_value, &cp->orig_value);
27196 }
27197}
27198
27199static void
27200button_skeleton_notify (GObject *object,
27201 GParamSpec *pspec G_GNUC_UNUSED)
27202{
27203 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
27204 g_mutex_lock (&skeleton->priv->lock);
27205 if (skeleton->priv->changed_properties != NULL &&
27206 skeleton->priv->changed_properties_idle_source == NULL)
27207 {
27208 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
27209 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
27210 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _button_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
27211 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
27212 g_source_unref (skeleton->priv->changed_properties_idle_source);
27213 }
27214 g_mutex_unlock (&skeleton->priv->lock);
27215}
27216
27217static void
27218button_skeleton_set_property (GObject *object,
27219 guint prop_id,
27220 const GValue *value,
27221 GParamSpec *pspec)
27222{
27223 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
Norman James493996c2015-10-31 17:27:13 -050027224 g_assert (prop_id != 0 && prop_id - 1 < 2);
Norman James362a80f2015-09-14 14:04:39 -050027225 g_mutex_lock (&skeleton->priv->lock);
27226 g_object_freeze_notify (object);
27227 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
27228 {
27229 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
27230 _button_schedule_emit_changed (skeleton, _button_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
27231 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
27232 g_object_notify_by_pspec (object, pspec);
27233 }
27234 g_mutex_unlock (&skeleton->priv->lock);
27235 g_object_thaw_notify (object);
27236}
27237
27238static void
27239button_skeleton_init (ButtonSkeleton *skeleton)
27240{
27241#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
27242 skeleton->priv = button_skeleton_get_instance_private (skeleton);
27243#else
27244 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_BUTTON_SKELETON, ButtonSkeletonPrivate);
27245#endif
27246
27247 g_mutex_init (&skeleton->priv->lock);
27248 skeleton->priv->context = g_main_context_ref_thread_default ();
Norman James493996c2015-10-31 17:27:13 -050027249 skeleton->priv->properties = g_new0 (GValue, 2);
Norman James362a80f2015-09-14 14:04:39 -050027250 g_value_init (&skeleton->priv->properties[0], G_TYPE_BOOLEAN);
Norman James493996c2015-10-31 17:27:13 -050027251 g_value_init (&skeleton->priv->properties[1], G_TYPE_UINT64);
Norman James362a80f2015-09-14 14:04:39 -050027252}
27253
27254static gboolean
27255button_skeleton_get_state (Button *object)
27256{
27257 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
27258 gboolean value;
27259 g_mutex_lock (&skeleton->priv->lock);
27260 value = g_value_get_boolean (&(skeleton->priv->properties[0]));
27261 g_mutex_unlock (&skeleton->priv->lock);
27262 return value;
27263}
27264
Norman James493996c2015-10-31 17:27:13 -050027265static guint64
27266button_skeleton_get_timer (Button *object)
27267{
27268 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
27269 guint64 value;
27270 g_mutex_lock (&skeleton->priv->lock);
27271 value = g_value_get_uint64 (&(skeleton->priv->properties[1]));
27272 g_mutex_unlock (&skeleton->priv->lock);
27273 return value;
27274}
27275
Norman James362a80f2015-09-14 14:04:39 -050027276static void
27277button_skeleton_class_init (ButtonSkeletonClass *klass)
27278{
27279 GObjectClass *gobject_class;
27280 GDBusInterfaceSkeletonClass *skeleton_class;
27281
27282 gobject_class = G_OBJECT_CLASS (klass);
27283 gobject_class->finalize = button_skeleton_finalize;
27284 gobject_class->get_property = button_skeleton_get_property;
27285 gobject_class->set_property = button_skeleton_set_property;
27286 gobject_class->notify = button_skeleton_notify;
27287
27288
27289 button_override_properties (gobject_class, 1);
27290
27291 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
27292 skeleton_class->get_info = button_skeleton_dbus_interface_get_info;
27293 skeleton_class->get_properties = button_skeleton_dbus_interface_get_properties;
27294 skeleton_class->flush = button_skeleton_dbus_interface_flush;
27295 skeleton_class->get_vtable = button_skeleton_dbus_interface_get_vtable;
27296
27297#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
27298 g_type_class_add_private (klass, sizeof (ButtonSkeletonPrivate));
27299#endif
27300}
27301
27302static void
27303button_skeleton_iface_init (ButtonIface *iface)
27304{
Norman James493996c2015-10-31 17:27:13 -050027305 iface->released = _button_on_signal_released;
27306 iface->pressed = _button_on_signal_pressed;
27307 iface->pressed_long = _button_on_signal_pressed_long;
Norman James362a80f2015-09-14 14:04:39 -050027308 iface->get_state = button_skeleton_get_state;
Norman James493996c2015-10-31 17:27:13 -050027309 iface->get_timer = button_skeleton_get_timer;
Norman James362a80f2015-09-14 14:04:39 -050027310}
27311
27312/**
27313 * button_skeleton_new:
27314 *
27315 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link>.
27316 *
27317 * Returns: (transfer full) (type ButtonSkeleton): The skeleton object.
27318 */
27319Button *
27320button_skeleton_new (void)
27321{
27322 return BUTTON (g_object_new (TYPE_BUTTON_SKELETON, NULL));
27323}
27324
27325/* ------------------------------------------------------------------------
27326 * Code for interface org.openbmc.Led
27327 * ------------------------------------------------------------------------
27328 */
27329
27330/**
27331 * SECTION:Led
27332 * @title: Led
27333 * @short_description: Generated C code for the org.openbmc.Led D-Bus interface
27334 *
27335 * 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.
27336 */
27337
27338/* ---- Introspection data for org.openbmc.Led ---- */
27339
27340static const _ExtendedGDBusMethodInfo _led_method_info_set_on =
27341{
27342 {
27343 -1,
27344 (gchar *) "setOn",
27345 NULL,
27346 NULL,
27347 NULL
27348 },
27349 "handle-set-on",
27350 FALSE
27351};
27352
27353static const _ExtendedGDBusMethodInfo _led_method_info_set_off =
27354{
27355 {
27356 -1,
27357 (gchar *) "setOff",
27358 NULL,
27359 NULL,
27360 NULL
27361 },
27362 "handle-set-off",
27363 FALSE
27364};
27365
27366static const _ExtendedGDBusMethodInfo _led_method_info_set_blink_slow =
27367{
27368 {
27369 -1,
27370 (gchar *) "setBlinkSlow",
27371 NULL,
27372 NULL,
27373 NULL
27374 },
27375 "handle-set-blink-slow",
27376 FALSE
27377};
27378
27379static const _ExtendedGDBusMethodInfo _led_method_info_set_blink_fast =
27380{
27381 {
27382 -1,
27383 (gchar *) "setBlinkFast",
27384 NULL,
27385 NULL,
27386 NULL
27387 },
27388 "handle-set-blink-fast",
27389 FALSE
27390};
27391
27392static const _ExtendedGDBusMethodInfo * const _led_method_info_pointers[] =
27393{
27394 &_led_method_info_set_on,
27395 &_led_method_info_set_off,
27396 &_led_method_info_set_blink_slow,
27397 &_led_method_info_set_blink_fast,
27398 NULL
27399};
27400
27401static const _ExtendedGDBusPropertyInfo _led_property_info_color =
27402{
27403 {
27404 -1,
27405 (gchar *) "color",
27406 (gchar *) "i",
27407 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
27408 NULL
27409 },
27410 "color",
27411 FALSE
27412};
27413
27414static const _ExtendedGDBusPropertyInfo _led_property_info_function =
27415{
27416 {
27417 -1,
27418 (gchar *) "function",
27419 (gchar *) "s",
27420 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
27421 NULL
27422 },
27423 "function",
27424 FALSE
27425};
27426
Norman James493996c2015-10-31 17:27:13 -050027427static const _ExtendedGDBusPropertyInfo _led_property_info_state =
27428{
27429 {
27430 -1,
27431 (gchar *) "state",
27432 (gchar *) "s",
27433 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
27434 NULL
27435 },
27436 "state",
27437 FALSE
27438};
27439
Norman James362a80f2015-09-14 14:04:39 -050027440static const _ExtendedGDBusPropertyInfo * const _led_property_info_pointers[] =
27441{
27442 &_led_property_info_color,
27443 &_led_property_info_function,
Norman James493996c2015-10-31 17:27:13 -050027444 &_led_property_info_state,
Norman James362a80f2015-09-14 14:04:39 -050027445 NULL
27446};
27447
27448static const _ExtendedGDBusInterfaceInfo _led_interface_info =
27449{
27450 {
27451 -1,
27452 (gchar *) "org.openbmc.Led",
27453 (GDBusMethodInfo **) &_led_method_info_pointers,
27454 NULL,
27455 (GDBusPropertyInfo **) &_led_property_info_pointers,
27456 NULL
27457 },
27458 "led",
27459};
27460
27461
27462/**
27463 * led_interface_info:
27464 *
27465 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link> D-Bus interface.
27466 *
27467 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
27468 */
27469GDBusInterfaceInfo *
27470led_interface_info (void)
27471{
27472 return (GDBusInterfaceInfo *) &_led_interface_info.parent_struct;
27473}
27474
27475/**
27476 * led_override_properties:
27477 * @klass: The class structure for a #GObject<!-- -->-derived class.
27478 * @property_id_begin: The property id to assign to the first overridden property.
27479 *
27480 * Overrides all #GObject properties in the #Led interface for a concrete class.
27481 * The properties are overridden in the order they are defined.
27482 *
27483 * Returns: The last property id.
27484 */
27485guint
27486led_override_properties (GObjectClass *klass, guint property_id_begin)
27487{
27488 g_object_class_override_property (klass, property_id_begin++, "color");
27489 g_object_class_override_property (klass, property_id_begin++, "function");
Norman James493996c2015-10-31 17:27:13 -050027490 g_object_class_override_property (klass, property_id_begin++, "state");
Norman James362a80f2015-09-14 14:04:39 -050027491 return property_id_begin - 1;
27492}
27493
27494
27495
27496/**
27497 * Led:
27498 *
27499 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>.
27500 */
27501
27502/**
27503 * LedIface:
27504 * @parent_iface: The parent interface.
27505 * @handle_set_blink_fast: Handler for the #Led::handle-set-blink-fast signal.
27506 * @handle_set_blink_slow: Handler for the #Led::handle-set-blink-slow signal.
27507 * @handle_set_off: Handler for the #Led::handle-set-off signal.
27508 * @handle_set_on: Handler for the #Led::handle-set-on signal.
27509 * @get_color: Getter for the #Led:color property.
27510 * @get_function: Getter for the #Led:function property.
Norman James493996c2015-10-31 17:27:13 -050027511 * @get_state: Getter for the #Led:state property.
Norman James362a80f2015-09-14 14:04:39 -050027512 *
27513 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>.
27514 */
27515
27516typedef LedIface LedInterface;
27517G_DEFINE_INTERFACE (Led, led, G_TYPE_OBJECT);
27518
27519static void
27520led_default_init (LedIface *iface)
27521{
27522 /* GObject signals for incoming D-Bus method calls: */
27523 /**
27524 * Led::handle-set-on:
27525 * @object: A #Led.
27526 * @invocation: A #GDBusMethodInvocation.
27527 *
27528 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setOn">setOn()</link> D-Bus method.
27529 *
27530 * 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.
27531 *
27532 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
27533 */
27534 g_signal_new ("handle-set-on",
27535 G_TYPE_FROM_INTERFACE (iface),
27536 G_SIGNAL_RUN_LAST,
27537 G_STRUCT_OFFSET (LedIface, handle_set_on),
27538 g_signal_accumulator_true_handled,
27539 NULL,
27540 g_cclosure_marshal_generic,
27541 G_TYPE_BOOLEAN,
27542 1,
27543 G_TYPE_DBUS_METHOD_INVOCATION);
27544
27545 /**
27546 * Led::handle-set-off:
27547 * @object: A #Led.
27548 * @invocation: A #GDBusMethodInvocation.
27549 *
27550 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setOff">setOff()</link> D-Bus method.
27551 *
27552 * 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.
27553 *
27554 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
27555 */
27556 g_signal_new ("handle-set-off",
27557 G_TYPE_FROM_INTERFACE (iface),
27558 G_SIGNAL_RUN_LAST,
27559 G_STRUCT_OFFSET (LedIface, handle_set_off),
27560 g_signal_accumulator_true_handled,
27561 NULL,
27562 g_cclosure_marshal_generic,
27563 G_TYPE_BOOLEAN,
27564 1,
27565 G_TYPE_DBUS_METHOD_INVOCATION);
27566
27567 /**
27568 * Led::handle-set-blink-slow:
27569 * @object: A #Led.
27570 * @invocation: A #GDBusMethodInvocation.
27571 *
27572 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setBlinkSlow">setBlinkSlow()</link> D-Bus method.
27573 *
27574 * 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.
27575 *
27576 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
27577 */
27578 g_signal_new ("handle-set-blink-slow",
27579 G_TYPE_FROM_INTERFACE (iface),
27580 G_SIGNAL_RUN_LAST,
27581 G_STRUCT_OFFSET (LedIface, handle_set_blink_slow),
27582 g_signal_accumulator_true_handled,
27583 NULL,
27584 g_cclosure_marshal_generic,
27585 G_TYPE_BOOLEAN,
27586 1,
27587 G_TYPE_DBUS_METHOD_INVOCATION);
27588
27589 /**
27590 * Led::handle-set-blink-fast:
27591 * @object: A #Led.
27592 * @invocation: A #GDBusMethodInvocation.
27593 *
27594 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setBlinkFast">setBlinkFast()</link> D-Bus method.
27595 *
27596 * 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.
27597 *
27598 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
27599 */
27600 g_signal_new ("handle-set-blink-fast",
27601 G_TYPE_FROM_INTERFACE (iface),
27602 G_SIGNAL_RUN_LAST,
27603 G_STRUCT_OFFSET (LedIface, handle_set_blink_fast),
27604 g_signal_accumulator_true_handled,
27605 NULL,
27606 g_cclosure_marshal_generic,
27607 G_TYPE_BOOLEAN,
27608 1,
27609 G_TYPE_DBUS_METHOD_INVOCATION);
27610
27611 /* GObject properties for D-Bus properties: */
27612 /**
27613 * Led:color:
27614 *
27615 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Led.color">"color"</link>.
27616 *
27617 * 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.
27618 */
27619 g_object_interface_install_property (iface,
27620 g_param_spec_int ("color", "color", "color", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
27621 /**
27622 * Led:function:
27623 *
27624 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link>.
27625 *
27626 * 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.
27627 */
27628 g_object_interface_install_property (iface,
27629 g_param_spec_string ("function", "function", "function", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Norman James493996c2015-10-31 17:27:13 -050027630 /**
27631 * Led:state:
27632 *
27633 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Led.state">"state"</link>.
27634 *
27635 * 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.
27636 */
27637 g_object_interface_install_property (iface,
27638 g_param_spec_string ("state", "state", "state", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Norman James362a80f2015-09-14 14:04:39 -050027639}
27640
27641/**
27642 * led_get_color: (skip)
27643 * @object: A #Led.
27644 *
27645 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Led.color">"color"</link> D-Bus property.
27646 *
27647 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
27648 *
27649 * Returns: The property value.
27650 */
27651gint
27652led_get_color (Led *object)
27653{
27654 return LED_GET_IFACE (object)->get_color (object);
27655}
27656
27657/**
27658 * led_set_color: (skip)
27659 * @object: A #Led.
27660 * @value: The value to set.
27661 *
27662 * Sets the <link linkend="gdbus-property-org-openbmc-Led.color">"color"</link> D-Bus property to @value.
27663 *
27664 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
27665 */
27666void
27667led_set_color (Led *object, gint value)
27668{
27669 g_object_set (G_OBJECT (object), "color", value, NULL);
27670}
27671
27672/**
27673 * led_get_function: (skip)
27674 * @object: A #Led.
27675 *
27676 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link> D-Bus property.
27677 *
27678 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
27679 *
27680 * <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>
27681 *
27682 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
27683 */
27684const gchar *
27685led_get_function (Led *object)
27686{
27687 return LED_GET_IFACE (object)->get_function (object);
27688}
27689
27690/**
27691 * led_dup_function: (skip)
27692 * @object: A #Led.
27693 *
27694 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link> D-Bus property.
27695 *
27696 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
27697 *
27698 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
27699 */
27700gchar *
27701led_dup_function (Led *object)
27702{
27703 gchar *value;
27704 g_object_get (G_OBJECT (object), "function", &value, NULL);
27705 return value;
27706}
27707
27708/**
27709 * led_set_function: (skip)
27710 * @object: A #Led.
27711 * @value: The value to set.
27712 *
27713 * Sets the <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link> D-Bus property to @value.
27714 *
27715 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
27716 */
27717void
27718led_set_function (Led *object, const gchar *value)
27719{
27720 g_object_set (G_OBJECT (object), "function", value, NULL);
27721}
27722
27723/**
Norman James493996c2015-10-31 17:27:13 -050027724 * led_get_state: (skip)
27725 * @object: A #Led.
27726 *
27727 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Led.state">"state"</link> D-Bus property.
27728 *
27729 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
27730 *
27731 * <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>
27732 *
27733 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
27734 */
27735const gchar *
27736led_get_state (Led *object)
27737{
27738 return LED_GET_IFACE (object)->get_state (object);
27739}
27740
27741/**
27742 * led_dup_state: (skip)
27743 * @object: A #Led.
27744 *
27745 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Led.state">"state"</link> D-Bus property.
27746 *
27747 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
27748 *
27749 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
27750 */
27751gchar *
27752led_dup_state (Led *object)
27753{
27754 gchar *value;
27755 g_object_get (G_OBJECT (object), "state", &value, NULL);
27756 return value;
27757}
27758
27759/**
27760 * led_set_state: (skip)
27761 * @object: A #Led.
27762 * @value: The value to set.
27763 *
27764 * Sets the <link linkend="gdbus-property-org-openbmc-Led.state">"state"</link> D-Bus property to @value.
27765 *
27766 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
27767 */
27768void
27769led_set_state (Led *object, const gchar *value)
27770{
27771 g_object_set (G_OBJECT (object), "state", value, NULL);
27772}
27773
27774/**
Norman James362a80f2015-09-14 14:04:39 -050027775 * led_call_set_on:
27776 * @proxy: A #LedProxy.
27777 * @cancellable: (allow-none): A #GCancellable or %NULL.
27778 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
27779 * @user_data: User data to pass to @callback.
27780 *
27781 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setOn">setOn()</link> D-Bus method on @proxy.
27782 * 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.
27783 * You can then call led_call_set_on_finish() to get the result of the operation.
27784 *
27785 * See led_call_set_on_sync() for the synchronous, blocking version of this method.
27786 */
27787void
27788led_call_set_on (
27789 Led *proxy,
27790 GCancellable *cancellable,
27791 GAsyncReadyCallback callback,
27792 gpointer user_data)
27793{
27794 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
27795 "setOn",
27796 g_variant_new ("()"),
27797 G_DBUS_CALL_FLAGS_NONE,
27798 -1,
27799 cancellable,
27800 callback,
27801 user_data);
27802}
27803
27804/**
27805 * led_call_set_on_finish:
27806 * @proxy: A #LedProxy.
27807 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_on().
27808 * @error: Return location for error or %NULL.
27809 *
27810 * Finishes an operation started with led_call_set_on().
27811 *
27812 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
27813 */
27814gboolean
27815led_call_set_on_finish (
27816 Led *proxy,
27817 GAsyncResult *res,
27818 GError **error)
27819{
27820 GVariant *_ret;
27821 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
27822 if (_ret == NULL)
27823 goto _out;
27824 g_variant_get (_ret,
27825 "()");
27826 g_variant_unref (_ret);
27827_out:
27828 return _ret != NULL;
27829}
27830
27831/**
27832 * led_call_set_on_sync:
27833 * @proxy: A #LedProxy.
27834 * @cancellable: (allow-none): A #GCancellable or %NULL.
27835 * @error: Return location for error or %NULL.
27836 *
27837 * 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.
27838 *
27839 * See led_call_set_on() for the asynchronous version of this method.
27840 *
27841 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
27842 */
27843gboolean
27844led_call_set_on_sync (
27845 Led *proxy,
27846 GCancellable *cancellable,
27847 GError **error)
27848{
27849 GVariant *_ret;
27850 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
27851 "setOn",
27852 g_variant_new ("()"),
27853 G_DBUS_CALL_FLAGS_NONE,
27854 -1,
27855 cancellable,
27856 error);
27857 if (_ret == NULL)
27858 goto _out;
27859 g_variant_get (_ret,
27860 "()");
27861 g_variant_unref (_ret);
27862_out:
27863 return _ret != NULL;
27864}
27865
27866/**
27867 * led_call_set_off:
27868 * @proxy: A #LedProxy.
27869 * @cancellable: (allow-none): A #GCancellable or %NULL.
27870 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
27871 * @user_data: User data to pass to @callback.
27872 *
27873 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setOff">setOff()</link> D-Bus method on @proxy.
27874 * 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.
27875 * You can then call led_call_set_off_finish() to get the result of the operation.
27876 *
27877 * See led_call_set_off_sync() for the synchronous, blocking version of this method.
27878 */
27879void
27880led_call_set_off (
27881 Led *proxy,
27882 GCancellable *cancellable,
27883 GAsyncReadyCallback callback,
27884 gpointer user_data)
27885{
27886 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
27887 "setOff",
27888 g_variant_new ("()"),
27889 G_DBUS_CALL_FLAGS_NONE,
27890 -1,
27891 cancellable,
27892 callback,
27893 user_data);
27894}
27895
27896/**
27897 * led_call_set_off_finish:
27898 * @proxy: A #LedProxy.
27899 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_off().
27900 * @error: Return location for error or %NULL.
27901 *
27902 * Finishes an operation started with led_call_set_off().
27903 *
27904 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
27905 */
27906gboolean
27907led_call_set_off_finish (
27908 Led *proxy,
27909 GAsyncResult *res,
27910 GError **error)
27911{
27912 GVariant *_ret;
27913 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
27914 if (_ret == NULL)
27915 goto _out;
27916 g_variant_get (_ret,
27917 "()");
27918 g_variant_unref (_ret);
27919_out:
27920 return _ret != NULL;
27921}
27922
27923/**
27924 * led_call_set_off_sync:
27925 * @proxy: A #LedProxy.
27926 * @cancellable: (allow-none): A #GCancellable or %NULL.
27927 * @error: Return location for error or %NULL.
27928 *
27929 * 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.
27930 *
27931 * See led_call_set_off() for the asynchronous version of this method.
27932 *
27933 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
27934 */
27935gboolean
27936led_call_set_off_sync (
27937 Led *proxy,
27938 GCancellable *cancellable,
27939 GError **error)
27940{
27941 GVariant *_ret;
27942 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
27943 "setOff",
27944 g_variant_new ("()"),
27945 G_DBUS_CALL_FLAGS_NONE,
27946 -1,
27947 cancellable,
27948 error);
27949 if (_ret == NULL)
27950 goto _out;
27951 g_variant_get (_ret,
27952 "()");
27953 g_variant_unref (_ret);
27954_out:
27955 return _ret != NULL;
27956}
27957
27958/**
27959 * led_call_set_blink_slow:
27960 * @proxy: A #LedProxy.
27961 * @cancellable: (allow-none): A #GCancellable or %NULL.
27962 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
27963 * @user_data: User data to pass to @callback.
27964 *
27965 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setBlinkSlow">setBlinkSlow()</link> D-Bus method on @proxy.
27966 * 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.
27967 * You can then call led_call_set_blink_slow_finish() to get the result of the operation.
27968 *
27969 * See led_call_set_blink_slow_sync() for the synchronous, blocking version of this method.
27970 */
27971void
27972led_call_set_blink_slow (
27973 Led *proxy,
27974 GCancellable *cancellable,
27975 GAsyncReadyCallback callback,
27976 gpointer user_data)
27977{
27978 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
27979 "setBlinkSlow",
27980 g_variant_new ("()"),
27981 G_DBUS_CALL_FLAGS_NONE,
27982 -1,
27983 cancellable,
27984 callback,
27985 user_data);
27986}
27987
27988/**
27989 * led_call_set_blink_slow_finish:
27990 * @proxy: A #LedProxy.
27991 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_blink_slow().
27992 * @error: Return location for error or %NULL.
27993 *
27994 * Finishes an operation started with led_call_set_blink_slow().
27995 *
27996 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
27997 */
27998gboolean
27999led_call_set_blink_slow_finish (
28000 Led *proxy,
28001 GAsyncResult *res,
28002 GError **error)
28003{
28004 GVariant *_ret;
28005 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
28006 if (_ret == NULL)
28007 goto _out;
28008 g_variant_get (_ret,
28009 "()");
28010 g_variant_unref (_ret);
28011_out:
28012 return _ret != NULL;
28013}
28014
28015/**
28016 * led_call_set_blink_slow_sync:
28017 * @proxy: A #LedProxy.
28018 * @cancellable: (allow-none): A #GCancellable or %NULL.
28019 * @error: Return location for error or %NULL.
28020 *
28021 * 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.
28022 *
28023 * See led_call_set_blink_slow() for the asynchronous version of this method.
28024 *
28025 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
28026 */
28027gboolean
28028led_call_set_blink_slow_sync (
28029 Led *proxy,
28030 GCancellable *cancellable,
28031 GError **error)
28032{
28033 GVariant *_ret;
28034 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
28035 "setBlinkSlow",
28036 g_variant_new ("()"),
28037 G_DBUS_CALL_FLAGS_NONE,
28038 -1,
28039 cancellable,
28040 error);
28041 if (_ret == NULL)
28042 goto _out;
28043 g_variant_get (_ret,
28044 "()");
28045 g_variant_unref (_ret);
28046_out:
28047 return _ret != NULL;
28048}
28049
28050/**
28051 * led_call_set_blink_fast:
28052 * @proxy: A #LedProxy.
28053 * @cancellable: (allow-none): A #GCancellable or %NULL.
28054 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
28055 * @user_data: User data to pass to @callback.
28056 *
28057 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setBlinkFast">setBlinkFast()</link> D-Bus method on @proxy.
28058 * 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.
28059 * You can then call led_call_set_blink_fast_finish() to get the result of the operation.
28060 *
28061 * See led_call_set_blink_fast_sync() for the synchronous, blocking version of this method.
28062 */
28063void
28064led_call_set_blink_fast (
28065 Led *proxy,
28066 GCancellable *cancellable,
28067 GAsyncReadyCallback callback,
28068 gpointer user_data)
28069{
28070 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
28071 "setBlinkFast",
28072 g_variant_new ("()"),
28073 G_DBUS_CALL_FLAGS_NONE,
28074 -1,
28075 cancellable,
28076 callback,
28077 user_data);
28078}
28079
28080/**
28081 * led_call_set_blink_fast_finish:
28082 * @proxy: A #LedProxy.
28083 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_blink_fast().
28084 * @error: Return location for error or %NULL.
28085 *
28086 * Finishes an operation started with led_call_set_blink_fast().
28087 *
28088 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
28089 */
28090gboolean
28091led_call_set_blink_fast_finish (
28092 Led *proxy,
28093 GAsyncResult *res,
28094 GError **error)
28095{
28096 GVariant *_ret;
28097 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
28098 if (_ret == NULL)
28099 goto _out;
28100 g_variant_get (_ret,
28101 "()");
28102 g_variant_unref (_ret);
28103_out:
28104 return _ret != NULL;
28105}
28106
28107/**
28108 * led_call_set_blink_fast_sync:
28109 * @proxy: A #LedProxy.
28110 * @cancellable: (allow-none): A #GCancellable or %NULL.
28111 * @error: Return location for error or %NULL.
28112 *
28113 * 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.
28114 *
28115 * See led_call_set_blink_fast() for the asynchronous version of this method.
28116 *
28117 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
28118 */
28119gboolean
28120led_call_set_blink_fast_sync (
28121 Led *proxy,
28122 GCancellable *cancellable,
28123 GError **error)
28124{
28125 GVariant *_ret;
28126 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
28127 "setBlinkFast",
28128 g_variant_new ("()"),
28129 G_DBUS_CALL_FLAGS_NONE,
28130 -1,
28131 cancellable,
28132 error);
28133 if (_ret == NULL)
28134 goto _out;
28135 g_variant_get (_ret,
28136 "()");
28137 g_variant_unref (_ret);
28138_out:
28139 return _ret != NULL;
28140}
28141
28142/**
28143 * led_complete_set_on:
28144 * @object: A #Led.
28145 * @invocation: (transfer full): A #GDBusMethodInvocation.
28146 *
28147 * 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.
28148 *
28149 * This method will free @invocation, you cannot use it afterwards.
28150 */
28151void
28152led_complete_set_on (
28153 Led *object,
28154 GDBusMethodInvocation *invocation)
28155{
28156 g_dbus_method_invocation_return_value (invocation,
28157 g_variant_new ("()"));
28158}
28159
28160/**
28161 * led_complete_set_off:
28162 * @object: A #Led.
28163 * @invocation: (transfer full): A #GDBusMethodInvocation.
28164 *
28165 * 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.
28166 *
28167 * This method will free @invocation, you cannot use it afterwards.
28168 */
28169void
28170led_complete_set_off (
28171 Led *object,
28172 GDBusMethodInvocation *invocation)
28173{
28174 g_dbus_method_invocation_return_value (invocation,
28175 g_variant_new ("()"));
28176}
28177
28178/**
28179 * led_complete_set_blink_slow:
28180 * @object: A #Led.
28181 * @invocation: (transfer full): A #GDBusMethodInvocation.
28182 *
28183 * 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.
28184 *
28185 * This method will free @invocation, you cannot use it afterwards.
28186 */
28187void
28188led_complete_set_blink_slow (
28189 Led *object,
28190 GDBusMethodInvocation *invocation)
28191{
28192 g_dbus_method_invocation_return_value (invocation,
28193 g_variant_new ("()"));
28194}
28195
28196/**
28197 * led_complete_set_blink_fast:
28198 * @object: A #Led.
28199 * @invocation: (transfer full): A #GDBusMethodInvocation.
28200 *
28201 * 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.
28202 *
28203 * This method will free @invocation, you cannot use it afterwards.
28204 */
28205void
28206led_complete_set_blink_fast (
28207 Led *object,
28208 GDBusMethodInvocation *invocation)
28209{
28210 g_dbus_method_invocation_return_value (invocation,
28211 g_variant_new ("()"));
28212}
28213
28214/* ------------------------------------------------------------------------ */
28215
28216/**
28217 * LedProxy:
28218 *
28219 * The #LedProxy structure contains only private data and should only be accessed using the provided API.
28220 */
28221
28222/**
28223 * LedProxyClass:
28224 * @parent_class: The parent class.
28225 *
28226 * Class structure for #LedProxy.
28227 */
28228
28229struct _LedProxyPrivate
28230{
28231 GData *qdata;
28232};
28233
28234static void led_proxy_iface_init (LedIface *iface);
28235
28236#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
28237G_DEFINE_TYPE_WITH_CODE (LedProxy, led_proxy, G_TYPE_DBUS_PROXY,
28238 G_ADD_PRIVATE (LedProxy)
28239 G_IMPLEMENT_INTERFACE (TYPE_LED, led_proxy_iface_init));
28240
28241#else
28242G_DEFINE_TYPE_WITH_CODE (LedProxy, led_proxy, G_TYPE_DBUS_PROXY,
28243 G_IMPLEMENT_INTERFACE (TYPE_LED, led_proxy_iface_init));
28244
28245#endif
28246static void
28247led_proxy_finalize (GObject *object)
28248{
28249 LedProxy *proxy = LED_PROXY (object);
28250 g_datalist_clear (&proxy->priv->qdata);
28251 G_OBJECT_CLASS (led_proxy_parent_class)->finalize (object);
28252}
28253
28254static void
28255led_proxy_get_property (GObject *object,
28256 guint prop_id,
28257 GValue *value,
28258 GParamSpec *pspec G_GNUC_UNUSED)
28259{
28260 const _ExtendedGDBusPropertyInfo *info;
28261 GVariant *variant;
Norman James493996c2015-10-31 17:27:13 -050028262 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -050028263 info = _led_property_info_pointers[prop_id - 1];
28264 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
28265 if (info->use_gvariant)
28266 {
28267 g_value_set_variant (value, variant);
28268 }
28269 else
28270 {
28271 if (variant != NULL)
28272 g_dbus_gvariant_to_gvalue (variant, value);
28273 }
28274 if (variant != NULL)
28275 g_variant_unref (variant);
28276}
28277
28278static void
28279led_proxy_set_property_cb (GDBusProxy *proxy,
28280 GAsyncResult *res,
28281 gpointer user_data)
28282{
28283 const _ExtendedGDBusPropertyInfo *info = user_data;
28284 GError *error;
28285 GVariant *_ret;
28286 error = NULL;
28287 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
28288 if (!_ret)
28289 {
28290 g_warning ("Error setting property '%s' on interface org.openbmc.Led: %s (%s, %d)",
28291 info->parent_struct.name,
28292 error->message, g_quark_to_string (error->domain), error->code);
28293 g_error_free (error);
28294 }
28295 else
28296 {
28297 g_variant_unref (_ret);
28298 }
28299}
28300
28301static void
28302led_proxy_set_property (GObject *object,
28303 guint prop_id,
28304 const GValue *value,
28305 GParamSpec *pspec G_GNUC_UNUSED)
28306{
28307 const _ExtendedGDBusPropertyInfo *info;
28308 GVariant *variant;
Norman James493996c2015-10-31 17:27:13 -050028309 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -050028310 info = _led_property_info_pointers[prop_id - 1];
28311 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
28312 g_dbus_proxy_call (G_DBUS_PROXY (object),
28313 "org.freedesktop.DBus.Properties.Set",
28314 g_variant_new ("(ssv)", "org.openbmc.Led", info->parent_struct.name, variant),
28315 G_DBUS_CALL_FLAGS_NONE,
28316 -1,
28317 NULL, (GAsyncReadyCallback) led_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
28318 g_variant_unref (variant);
28319}
28320
28321static void
28322led_proxy_g_signal (GDBusProxy *proxy,
28323 const gchar *sender_name G_GNUC_UNUSED,
28324 const gchar *signal_name,
28325 GVariant *parameters)
28326{
28327 _ExtendedGDBusSignalInfo *info;
28328 GVariantIter iter;
28329 GVariant *child;
28330 GValue *paramv;
28331 guint num_params;
28332 guint n;
28333 guint signal_id;
28334 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, signal_name);
28335 if (info == NULL)
28336 return;
28337 num_params = g_variant_n_children (parameters);
28338 paramv = g_new0 (GValue, num_params + 1);
28339 g_value_init (&paramv[0], TYPE_LED);
28340 g_value_set_object (&paramv[0], proxy);
28341 g_variant_iter_init (&iter, parameters);
28342 n = 1;
28343 while ((child = g_variant_iter_next_value (&iter)) != NULL)
28344 {
28345 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
28346 if (arg_info->use_gvariant)
28347 {
28348 g_value_init (&paramv[n], G_TYPE_VARIANT);
28349 g_value_set_variant (&paramv[n], child);
28350 n++;
28351 }
28352 else
28353 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
28354 g_variant_unref (child);
28355 }
28356 signal_id = g_signal_lookup (info->signal_name, TYPE_LED);
28357 g_signal_emitv (paramv, signal_id, 0, NULL);
28358 for (n = 0; n < num_params + 1; n++)
28359 g_value_unset (&paramv[n]);
28360 g_free (paramv);
28361}
28362
28363static void
28364led_proxy_g_properties_changed (GDBusProxy *_proxy,
28365 GVariant *changed_properties,
28366 const gchar *const *invalidated_properties)
28367{
28368 LedProxy *proxy = LED_PROXY (_proxy);
28369 guint n;
28370 const gchar *key;
28371 GVariantIter *iter;
28372 _ExtendedGDBusPropertyInfo *info;
28373 g_variant_get (changed_properties, "a{sv}", &iter);
28374 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
28375 {
28376 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, key);
28377 g_datalist_remove_data (&proxy->priv->qdata, key);
28378 if (info != NULL)
28379 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
28380 }
28381 g_variant_iter_free (iter);
28382 for (n = 0; invalidated_properties[n] != NULL; n++)
28383 {
28384 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, invalidated_properties[n]);
28385 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
28386 if (info != NULL)
28387 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
28388 }
28389}
28390
28391static gint
28392led_proxy_get_color (Led *object)
28393{
28394 LedProxy *proxy = LED_PROXY (object);
28395 GVariant *variant;
28396 gint value = 0;
28397 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "color");
28398 if (variant != NULL)
28399 {
28400 value = g_variant_get_int32 (variant);
28401 g_variant_unref (variant);
28402 }
28403 return value;
28404}
28405
28406static const gchar *
28407led_proxy_get_function (Led *object)
28408{
28409 LedProxy *proxy = LED_PROXY (object);
28410 GVariant *variant;
28411 const gchar *value = NULL;
28412 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "function");
28413 if (variant != NULL)
28414 {
28415 value = g_variant_get_string (variant, NULL);
28416 g_variant_unref (variant);
28417 }
28418 return value;
28419}
28420
Norman James493996c2015-10-31 17:27:13 -050028421static const gchar *
28422led_proxy_get_state (Led *object)
28423{
28424 LedProxy *proxy = LED_PROXY (object);
28425 GVariant *variant;
28426 const gchar *value = NULL;
28427 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state");
28428 if (variant != NULL)
28429 {
28430 value = g_variant_get_string (variant, NULL);
28431 g_variant_unref (variant);
28432 }
28433 return value;
28434}
28435
Norman James362a80f2015-09-14 14:04:39 -050028436static void
28437led_proxy_init (LedProxy *proxy)
28438{
28439#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
28440 proxy->priv = led_proxy_get_instance_private (proxy);
28441#else
28442 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_LED_PROXY, LedProxyPrivate);
28443#endif
28444
28445 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), led_interface_info ());
28446}
28447
28448static void
28449led_proxy_class_init (LedProxyClass *klass)
28450{
28451 GObjectClass *gobject_class;
28452 GDBusProxyClass *proxy_class;
28453
28454 gobject_class = G_OBJECT_CLASS (klass);
28455 gobject_class->finalize = led_proxy_finalize;
28456 gobject_class->get_property = led_proxy_get_property;
28457 gobject_class->set_property = led_proxy_set_property;
28458
28459 proxy_class = G_DBUS_PROXY_CLASS (klass);
28460 proxy_class->g_signal = led_proxy_g_signal;
28461 proxy_class->g_properties_changed = led_proxy_g_properties_changed;
28462
28463 led_override_properties (gobject_class, 1);
28464
28465#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
28466 g_type_class_add_private (klass, sizeof (LedProxyPrivate));
28467#endif
28468}
28469
28470static void
28471led_proxy_iface_init (LedIface *iface)
28472{
28473 iface->get_color = led_proxy_get_color;
28474 iface->get_function = led_proxy_get_function;
Norman James493996c2015-10-31 17:27:13 -050028475 iface->get_state = led_proxy_get_state;
Norman James362a80f2015-09-14 14:04:39 -050028476}
28477
28478/**
28479 * led_proxy_new:
28480 * @connection: A #GDBusConnection.
28481 * @flags: Flags from the #GDBusProxyFlags enumeration.
28482 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
28483 * @object_path: An object path.
28484 * @cancellable: (allow-none): A #GCancellable or %NULL.
28485 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
28486 * @user_data: User data to pass to @callback.
28487 *
28488 * 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.
28489 *
28490 * 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.
28491 * You can then call led_proxy_new_finish() to get the result of the operation.
28492 *
28493 * See led_proxy_new_sync() for the synchronous, blocking version of this constructor.
28494 */
28495void
28496led_proxy_new (
28497 GDBusConnection *connection,
28498 GDBusProxyFlags flags,
28499 const gchar *name,
28500 const gchar *object_path,
28501 GCancellable *cancellable,
28502 GAsyncReadyCallback callback,
28503 gpointer user_data)
28504{
28505 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);
28506}
28507
28508/**
28509 * led_proxy_new_finish:
28510 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_proxy_new().
28511 * @error: Return location for error or %NULL
28512 *
28513 * Finishes an operation started with led_proxy_new().
28514 *
28515 * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set.
28516 */
28517Led *
28518led_proxy_new_finish (
28519 GAsyncResult *res,
28520 GError **error)
28521{
28522 GObject *ret;
28523 GObject *source_object;
28524 source_object = g_async_result_get_source_object (res);
28525 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
28526 g_object_unref (source_object);
28527 if (ret != NULL)
28528 return LED (ret);
28529 else
28530 return NULL;
28531}
28532
28533/**
28534 * led_proxy_new_sync:
28535 * @connection: A #GDBusConnection.
28536 * @flags: Flags from the #GDBusProxyFlags enumeration.
28537 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
28538 * @object_path: An object path.
28539 * @cancellable: (allow-none): A #GCancellable or %NULL.
28540 * @error: Return location for error or %NULL
28541 *
28542 * 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.
28543 *
28544 * The calling thread is blocked until a reply is received.
28545 *
28546 * See led_proxy_new() for the asynchronous version of this constructor.
28547 *
28548 * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set.
28549 */
28550Led *
28551led_proxy_new_sync (
28552 GDBusConnection *connection,
28553 GDBusProxyFlags flags,
28554 const gchar *name,
28555 const gchar *object_path,
28556 GCancellable *cancellable,
28557 GError **error)
28558{
28559 GInitable *ret;
28560 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);
28561 if (ret != NULL)
28562 return LED (ret);
28563 else
28564 return NULL;
28565}
28566
28567
28568/**
28569 * led_proxy_new_for_bus:
28570 * @bus_type: A #GBusType.
28571 * @flags: Flags from the #GDBusProxyFlags enumeration.
28572 * @name: A bus name (well-known or unique).
28573 * @object_path: An object path.
28574 * @cancellable: (allow-none): A #GCancellable or %NULL.
28575 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
28576 * @user_data: User data to pass to @callback.
28577 *
28578 * Like led_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
28579 *
28580 * 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.
28581 * You can then call led_proxy_new_for_bus_finish() to get the result of the operation.
28582 *
28583 * See led_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
28584 */
28585void
28586led_proxy_new_for_bus (
28587 GBusType bus_type,
28588 GDBusProxyFlags flags,
28589 const gchar *name,
28590 const gchar *object_path,
28591 GCancellable *cancellable,
28592 GAsyncReadyCallback callback,
28593 gpointer user_data)
28594{
28595 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);
28596}
28597
28598/**
28599 * led_proxy_new_for_bus_finish:
28600 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_proxy_new_for_bus().
28601 * @error: Return location for error or %NULL
28602 *
28603 * Finishes an operation started with led_proxy_new_for_bus().
28604 *
28605 * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set.
28606 */
28607Led *
28608led_proxy_new_for_bus_finish (
28609 GAsyncResult *res,
28610 GError **error)
28611{
28612 GObject *ret;
28613 GObject *source_object;
28614 source_object = g_async_result_get_source_object (res);
28615 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
28616 g_object_unref (source_object);
28617 if (ret != NULL)
28618 return LED (ret);
28619 else
28620 return NULL;
28621}
28622
28623/**
28624 * led_proxy_new_for_bus_sync:
28625 * @bus_type: A #GBusType.
28626 * @flags: Flags from the #GDBusProxyFlags enumeration.
28627 * @name: A bus name (well-known or unique).
28628 * @object_path: An object path.
28629 * @cancellable: (allow-none): A #GCancellable or %NULL.
28630 * @error: Return location for error or %NULL
28631 *
28632 * Like led_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
28633 *
28634 * The calling thread is blocked until a reply is received.
28635 *
28636 * See led_proxy_new_for_bus() for the asynchronous version of this constructor.
28637 *
28638 * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set.
28639 */
28640Led *
28641led_proxy_new_for_bus_sync (
28642 GBusType bus_type,
28643 GDBusProxyFlags flags,
28644 const gchar *name,
28645 const gchar *object_path,
28646 GCancellable *cancellable,
28647 GError **error)
28648{
28649 GInitable *ret;
28650 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);
28651 if (ret != NULL)
28652 return LED (ret);
28653 else
28654 return NULL;
28655}
28656
28657
28658/* ------------------------------------------------------------------------ */
28659
28660/**
28661 * LedSkeleton:
28662 *
28663 * The #LedSkeleton structure contains only private data and should only be accessed using the provided API.
28664 */
28665
28666/**
28667 * LedSkeletonClass:
28668 * @parent_class: The parent class.
28669 *
28670 * Class structure for #LedSkeleton.
28671 */
28672
28673struct _LedSkeletonPrivate
28674{
28675 GValue *properties;
28676 GList *changed_properties;
28677 GSource *changed_properties_idle_source;
28678 GMainContext *context;
28679 GMutex lock;
28680};
28681
28682static void
28683_led_skeleton_handle_method_call (
28684 GDBusConnection *connection G_GNUC_UNUSED,
28685 const gchar *sender G_GNUC_UNUSED,
28686 const gchar *object_path G_GNUC_UNUSED,
28687 const gchar *interface_name,
28688 const gchar *method_name,
28689 GVariant *parameters,
28690 GDBusMethodInvocation *invocation,
28691 gpointer user_data)
28692{
28693 LedSkeleton *skeleton = LED_SKELETON (user_data);
28694 _ExtendedGDBusMethodInfo *info;
28695 GVariantIter iter;
28696 GVariant *child;
28697 GValue *paramv;
28698 guint num_params;
28699 guint num_extra;
28700 guint n;
28701 guint signal_id;
28702 GValue return_value = G_VALUE_INIT;
28703 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
28704 g_assert (info != NULL);
28705 num_params = g_variant_n_children (parameters);
28706 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
28707 n = 0;
28708 g_value_init (&paramv[n], TYPE_LED);
28709 g_value_set_object (&paramv[n++], skeleton);
28710 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
28711 g_value_set_object (&paramv[n++], invocation);
28712 if (info->pass_fdlist)
28713 {
28714#ifdef G_OS_UNIX
28715 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
28716 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
28717#else
28718 g_assert_not_reached ();
28719#endif
28720 }
28721 g_variant_iter_init (&iter, parameters);
28722 while ((child = g_variant_iter_next_value (&iter)) != NULL)
28723 {
28724 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
28725 if (arg_info->use_gvariant)
28726 {
28727 g_value_init (&paramv[n], G_TYPE_VARIANT);
28728 g_value_set_variant (&paramv[n], child);
28729 n++;
28730 }
28731 else
28732 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
28733 g_variant_unref (child);
28734 }
28735 signal_id = g_signal_lookup (info->signal_name, TYPE_LED);
28736 g_value_init (&return_value, G_TYPE_BOOLEAN);
28737 g_signal_emitv (paramv, signal_id, 0, &return_value);
28738 if (!g_value_get_boolean (&return_value))
28739 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);
28740 g_value_unset (&return_value);
28741 for (n = 0; n < num_params + num_extra; n++)
28742 g_value_unset (&paramv[n]);
28743 g_free (paramv);
28744}
28745
28746static GVariant *
28747_led_skeleton_handle_get_property (
28748 GDBusConnection *connection G_GNUC_UNUSED,
28749 const gchar *sender G_GNUC_UNUSED,
28750 const gchar *object_path G_GNUC_UNUSED,
28751 const gchar *interface_name G_GNUC_UNUSED,
28752 const gchar *property_name,
28753 GError **error,
28754 gpointer user_data)
28755{
28756 LedSkeleton *skeleton = LED_SKELETON (user_data);
28757 GValue value = G_VALUE_INIT;
28758 GParamSpec *pspec;
28759 _ExtendedGDBusPropertyInfo *info;
28760 GVariant *ret;
28761 ret = NULL;
28762 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, property_name);
28763 g_assert (info != NULL);
28764 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
28765 if (pspec == NULL)
28766 {
28767 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
28768 }
28769 else
28770 {
28771 g_value_init (&value, pspec->value_type);
28772 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
28773 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
28774 g_value_unset (&value);
28775 }
28776 return ret;
28777}
28778
28779static gboolean
28780_led_skeleton_handle_set_property (
28781 GDBusConnection *connection G_GNUC_UNUSED,
28782 const gchar *sender G_GNUC_UNUSED,
28783 const gchar *object_path G_GNUC_UNUSED,
28784 const gchar *interface_name G_GNUC_UNUSED,
28785 const gchar *property_name,
28786 GVariant *variant,
28787 GError **error,
28788 gpointer user_data)
28789{
28790 LedSkeleton *skeleton = LED_SKELETON (user_data);
28791 GValue value = G_VALUE_INIT;
28792 GParamSpec *pspec;
28793 _ExtendedGDBusPropertyInfo *info;
28794 gboolean ret;
28795 ret = FALSE;
28796 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, property_name);
28797 g_assert (info != NULL);
28798 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
28799 if (pspec == NULL)
28800 {
28801 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
28802 }
28803 else
28804 {
28805 if (info->use_gvariant)
28806 g_value_set_variant (&value, variant);
28807 else
28808 g_dbus_gvariant_to_gvalue (variant, &value);
28809 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
28810 g_value_unset (&value);
28811 ret = TRUE;
28812 }
28813 return ret;
28814}
28815
28816static const GDBusInterfaceVTable _led_skeleton_vtable =
28817{
28818 _led_skeleton_handle_method_call,
28819 _led_skeleton_handle_get_property,
28820 _led_skeleton_handle_set_property,
28821 {NULL}
28822};
28823
28824static GDBusInterfaceInfo *
28825led_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
28826{
28827 return led_interface_info ();
28828}
28829
28830static GDBusInterfaceVTable *
28831led_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
28832{
28833 return (GDBusInterfaceVTable *) &_led_skeleton_vtable;
28834}
28835
28836static GVariant *
28837led_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
28838{
28839 LedSkeleton *skeleton = LED_SKELETON (_skeleton);
28840
28841 GVariantBuilder builder;
28842 guint n;
28843 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
28844 if (_led_interface_info.parent_struct.properties == NULL)
28845 goto out;
28846 for (n = 0; _led_interface_info.parent_struct.properties[n] != NULL; n++)
28847 {
28848 GDBusPropertyInfo *info = _led_interface_info.parent_struct.properties[n];
28849 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
28850 {
28851 GVariant *value;
28852 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);
28853 if (value != NULL)
28854 {
28855 g_variant_take_ref (value);
28856 g_variant_builder_add (&builder, "{sv}", info->name, value);
28857 g_variant_unref (value);
28858 }
28859 }
28860 }
28861out:
28862 return g_variant_builder_end (&builder);
28863}
28864
28865static gboolean _led_emit_changed (gpointer user_data);
28866
28867static void
28868led_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
28869{
28870 LedSkeleton *skeleton = LED_SKELETON (_skeleton);
28871 gboolean emit_changed = FALSE;
28872
28873 g_mutex_lock (&skeleton->priv->lock);
28874 if (skeleton->priv->changed_properties_idle_source != NULL)
28875 {
28876 g_source_destroy (skeleton->priv->changed_properties_idle_source);
28877 skeleton->priv->changed_properties_idle_source = NULL;
28878 emit_changed = TRUE;
28879 }
28880 g_mutex_unlock (&skeleton->priv->lock);
28881
28882 if (emit_changed)
28883 _led_emit_changed (skeleton);
28884}
28885
28886static void led_skeleton_iface_init (LedIface *iface);
28887#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
28888G_DEFINE_TYPE_WITH_CODE (LedSkeleton, led_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
28889 G_ADD_PRIVATE (LedSkeleton)
28890 G_IMPLEMENT_INTERFACE (TYPE_LED, led_skeleton_iface_init));
28891
28892#else
28893G_DEFINE_TYPE_WITH_CODE (LedSkeleton, led_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
28894 G_IMPLEMENT_INTERFACE (TYPE_LED, led_skeleton_iface_init));
28895
28896#endif
28897static void
28898led_skeleton_finalize (GObject *object)
28899{
28900 LedSkeleton *skeleton = LED_SKELETON (object);
28901 guint n;
Norman James493996c2015-10-31 17:27:13 -050028902 for (n = 0; n < 3; n++)
Norman James362a80f2015-09-14 14:04:39 -050028903 g_value_unset (&skeleton->priv->properties[n]);
28904 g_free (skeleton->priv->properties);
28905 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
28906 if (skeleton->priv->changed_properties_idle_source != NULL)
28907 g_source_destroy (skeleton->priv->changed_properties_idle_source);
28908 g_main_context_unref (skeleton->priv->context);
28909 g_mutex_clear (&skeleton->priv->lock);
28910 G_OBJECT_CLASS (led_skeleton_parent_class)->finalize (object);
28911}
28912
28913static void
28914led_skeleton_get_property (GObject *object,
28915 guint prop_id,
28916 GValue *value,
28917 GParamSpec *pspec G_GNUC_UNUSED)
28918{
28919 LedSkeleton *skeleton = LED_SKELETON (object);
Norman James493996c2015-10-31 17:27:13 -050028920 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -050028921 g_mutex_lock (&skeleton->priv->lock);
28922 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
28923 g_mutex_unlock (&skeleton->priv->lock);
28924}
28925
28926static gboolean
28927_led_emit_changed (gpointer user_data)
28928{
28929 LedSkeleton *skeleton = LED_SKELETON (user_data);
28930 GList *l;
28931 GVariantBuilder builder;
28932 GVariantBuilder invalidated_builder;
28933 guint num_changes;
28934
28935 g_mutex_lock (&skeleton->priv->lock);
28936 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
28937 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
28938 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
28939 {
28940 ChangedProperty *cp = l->data;
28941 GVariant *variant;
28942 const GValue *cur_value;
28943
28944 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
28945 if (!_g_value_equal (cur_value, &cp->orig_value))
28946 {
28947 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
28948 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
28949 g_variant_unref (variant);
28950 num_changes++;
28951 }
28952 }
28953 if (num_changes > 0)
28954 {
28955 GList *connections, *ll;
28956 GVariant *signal_variant;
28957 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Led",
28958 &builder, &invalidated_builder));
28959 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
28960 for (ll = connections; ll != NULL; ll = ll->next)
28961 {
28962 GDBusConnection *connection = ll->data;
28963
28964 g_dbus_connection_emit_signal (connection,
28965 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
28966 "org.freedesktop.DBus.Properties",
28967 "PropertiesChanged",
28968 signal_variant,
28969 NULL);
28970 }
28971 g_variant_unref (signal_variant);
28972 g_list_free_full (connections, g_object_unref);
28973 }
28974 else
28975 {
28976 g_variant_builder_clear (&builder);
28977 g_variant_builder_clear (&invalidated_builder);
28978 }
28979 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
28980 skeleton->priv->changed_properties = NULL;
28981 skeleton->priv->changed_properties_idle_source = NULL;
28982 g_mutex_unlock (&skeleton->priv->lock);
28983 return FALSE;
28984}
28985
28986static void
28987_led_schedule_emit_changed (LedSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
28988{
28989 ChangedProperty *cp;
28990 GList *l;
28991 cp = NULL;
28992 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
28993 {
28994 ChangedProperty *i_cp = l->data;
28995 if (i_cp->info == info)
28996 {
28997 cp = i_cp;
28998 break;
28999 }
29000 }
29001 if (cp == NULL)
29002 {
29003 cp = g_new0 (ChangedProperty, 1);
29004 cp->prop_id = prop_id;
29005 cp->info = info;
29006 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
29007 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
29008 g_value_copy (orig_value, &cp->orig_value);
29009 }
29010}
29011
29012static void
29013led_skeleton_notify (GObject *object,
29014 GParamSpec *pspec G_GNUC_UNUSED)
29015{
29016 LedSkeleton *skeleton = LED_SKELETON (object);
29017 g_mutex_lock (&skeleton->priv->lock);
29018 if (skeleton->priv->changed_properties != NULL &&
29019 skeleton->priv->changed_properties_idle_source == NULL)
29020 {
29021 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
29022 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
29023 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _led_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
29024 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
29025 g_source_unref (skeleton->priv->changed_properties_idle_source);
29026 }
29027 g_mutex_unlock (&skeleton->priv->lock);
29028}
29029
29030static void
29031led_skeleton_set_property (GObject *object,
29032 guint prop_id,
29033 const GValue *value,
29034 GParamSpec *pspec)
29035{
29036 LedSkeleton *skeleton = LED_SKELETON (object);
Norman James493996c2015-10-31 17:27:13 -050029037 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -050029038 g_mutex_lock (&skeleton->priv->lock);
29039 g_object_freeze_notify (object);
29040 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
29041 {
29042 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
29043 _led_schedule_emit_changed (skeleton, _led_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
29044 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
29045 g_object_notify_by_pspec (object, pspec);
29046 }
29047 g_mutex_unlock (&skeleton->priv->lock);
29048 g_object_thaw_notify (object);
29049}
29050
29051static void
29052led_skeleton_init (LedSkeleton *skeleton)
29053{
29054#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
29055 skeleton->priv = led_skeleton_get_instance_private (skeleton);
29056#else
29057 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_LED_SKELETON, LedSkeletonPrivate);
29058#endif
29059
29060 g_mutex_init (&skeleton->priv->lock);
29061 skeleton->priv->context = g_main_context_ref_thread_default ();
Norman James493996c2015-10-31 17:27:13 -050029062 skeleton->priv->properties = g_new0 (GValue, 3);
Norman James362a80f2015-09-14 14:04:39 -050029063 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
29064 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
Norman James493996c2015-10-31 17:27:13 -050029065 g_value_init (&skeleton->priv->properties[2], G_TYPE_STRING);
Norman James362a80f2015-09-14 14:04:39 -050029066}
29067
29068static gint
29069led_skeleton_get_color (Led *object)
29070{
29071 LedSkeleton *skeleton = LED_SKELETON (object);
29072 gint value;
29073 g_mutex_lock (&skeleton->priv->lock);
29074 value = g_value_get_int (&(skeleton->priv->properties[0]));
29075 g_mutex_unlock (&skeleton->priv->lock);
29076 return value;
29077}
29078
29079static const gchar *
29080led_skeleton_get_function (Led *object)
29081{
29082 LedSkeleton *skeleton = LED_SKELETON (object);
29083 const gchar *value;
29084 g_mutex_lock (&skeleton->priv->lock);
29085 value = g_value_get_string (&(skeleton->priv->properties[1]));
29086 g_mutex_unlock (&skeleton->priv->lock);
29087 return value;
29088}
29089
Norman James493996c2015-10-31 17:27:13 -050029090static const gchar *
29091led_skeleton_get_state (Led *object)
29092{
29093 LedSkeleton *skeleton = LED_SKELETON (object);
29094 const gchar *value;
29095 g_mutex_lock (&skeleton->priv->lock);
29096 value = g_value_get_string (&(skeleton->priv->properties[2]));
29097 g_mutex_unlock (&skeleton->priv->lock);
29098 return value;
29099}
29100
Norman James362a80f2015-09-14 14:04:39 -050029101static void
29102led_skeleton_class_init (LedSkeletonClass *klass)
29103{
29104 GObjectClass *gobject_class;
29105 GDBusInterfaceSkeletonClass *skeleton_class;
29106
29107 gobject_class = G_OBJECT_CLASS (klass);
29108 gobject_class->finalize = led_skeleton_finalize;
29109 gobject_class->get_property = led_skeleton_get_property;
29110 gobject_class->set_property = led_skeleton_set_property;
29111 gobject_class->notify = led_skeleton_notify;
29112
29113
29114 led_override_properties (gobject_class, 1);
29115
29116 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
29117 skeleton_class->get_info = led_skeleton_dbus_interface_get_info;
29118 skeleton_class->get_properties = led_skeleton_dbus_interface_get_properties;
29119 skeleton_class->flush = led_skeleton_dbus_interface_flush;
29120 skeleton_class->get_vtable = led_skeleton_dbus_interface_get_vtable;
29121
29122#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
29123 g_type_class_add_private (klass, sizeof (LedSkeletonPrivate));
29124#endif
29125}
29126
29127static void
29128led_skeleton_iface_init (LedIface *iface)
29129{
29130 iface->get_color = led_skeleton_get_color;
29131 iface->get_function = led_skeleton_get_function;
Norman James493996c2015-10-31 17:27:13 -050029132 iface->get_state = led_skeleton_get_state;
Norman James362a80f2015-09-14 14:04:39 -050029133}
29134
29135/**
29136 * led_skeleton_new:
29137 *
29138 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>.
29139 *
29140 * Returns: (transfer full) (type LedSkeleton): The skeleton object.
29141 */
29142Led *
29143led_skeleton_new (void)
29144{
29145 return LED (g_object_new (TYPE_LED_SKELETON, NULL));
29146}
29147
29148/* ------------------------------------------------------------------------
Norman Jamesdbcffbd2015-10-06 16:53:06 -050029149 * Code for interface org.openbmc.HostIpmi
29150 * ------------------------------------------------------------------------
29151 */
29152
29153/**
29154 * SECTION:HostIpmi
29155 * @title: HostIpmi
29156 * @short_description: Generated C code for the org.openbmc.HostIpmi D-Bus interface
29157 *
29158 * 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.
29159 */
29160
29161/* ---- Introspection data for org.openbmc.HostIpmi ---- */
29162
29163static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_IN_ARG_seq =
29164{
29165 {
29166 -1,
29167 (gchar *) "seq",
29168 (gchar *) "y",
29169 NULL
29170 },
29171 FALSE
29172};
29173
29174static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_IN_ARG_netfn =
29175{
29176 {
29177 -1,
29178 (gchar *) "netfn",
29179 (gchar *) "y",
29180 NULL
29181 },
29182 FALSE
29183};
29184
29185static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_IN_ARG_cmd =
29186{
29187 {
29188 -1,
29189 (gchar *) "cmd",
29190 (gchar *) "y",
29191 NULL
29192 },
29193 FALSE
29194};
29195
29196static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_IN_ARG_data =
29197{
29198 {
29199 -1,
29200 (gchar *) "data",
29201 (gchar *) "ay",
29202 NULL
29203 },
29204 FALSE
29205};
29206
29207static const _ExtendedGDBusArgInfo * const _host_ipmi_method_info_send_message_IN_ARG_pointers[] =
29208{
29209 &_host_ipmi_method_info_send_message_IN_ARG_seq,
29210 &_host_ipmi_method_info_send_message_IN_ARG_netfn,
29211 &_host_ipmi_method_info_send_message_IN_ARG_cmd,
29212 &_host_ipmi_method_info_send_message_IN_ARG_data,
29213 NULL
29214};
29215
29216static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_OUT_ARG_unnamed_arg4 =
29217{
29218 {
29219 -1,
29220 (gchar *) "unnamed_arg4",
29221 (gchar *) "x",
29222 NULL
29223 },
29224 FALSE
29225};
29226
29227static const _ExtendedGDBusArgInfo * const _host_ipmi_method_info_send_message_OUT_ARG_pointers[] =
29228{
29229 &_host_ipmi_method_info_send_message_OUT_ARG_unnamed_arg4,
29230 NULL
29231};
29232
29233static const _ExtendedGDBusMethodInfo _host_ipmi_method_info_send_message =
29234{
29235 {
29236 -1,
29237 (gchar *) "sendMessage",
29238 (GDBusArgInfo **) &_host_ipmi_method_info_send_message_IN_ARG_pointers,
29239 (GDBusArgInfo **) &_host_ipmi_method_info_send_message_OUT_ARG_pointers,
29240 NULL
29241 },
29242 "handle-send-message",
29243 FALSE
29244};
29245
29246static const _ExtendedGDBusMethodInfo * const _host_ipmi_method_info_pointers[] =
29247{
29248 &_host_ipmi_method_info_send_message,
29249 NULL
29250};
29251
29252static const _ExtendedGDBusArgInfo _host_ipmi_signal_info_received_message_ARG_seq =
29253{
29254 {
29255 -1,
29256 (gchar *) "seq",
29257 (gchar *) "y",
29258 NULL
29259 },
29260 FALSE
29261};
29262
29263static const _ExtendedGDBusArgInfo _host_ipmi_signal_info_received_message_ARG_netfn =
29264{
29265 {
29266 -1,
29267 (gchar *) "netfn",
29268 (gchar *) "y",
29269 NULL
29270 },
29271 FALSE
29272};
29273
29274static const _ExtendedGDBusArgInfo _host_ipmi_signal_info_received_message_ARG_cmd =
29275{
29276 {
29277 -1,
29278 (gchar *) "cmd",
29279 (gchar *) "y",
29280 NULL
29281 },
29282 FALSE
29283};
29284
29285static const _ExtendedGDBusArgInfo _host_ipmi_signal_info_received_message_ARG_data =
29286{
29287 {
29288 -1,
29289 (gchar *) "data",
29290 (gchar *) "ay",
29291 NULL
29292 },
29293 FALSE
29294};
29295
29296static const _ExtendedGDBusArgInfo * const _host_ipmi_signal_info_received_message_ARG_pointers[] =
29297{
29298 &_host_ipmi_signal_info_received_message_ARG_seq,
29299 &_host_ipmi_signal_info_received_message_ARG_netfn,
29300 &_host_ipmi_signal_info_received_message_ARG_cmd,
29301 &_host_ipmi_signal_info_received_message_ARG_data,
29302 NULL
29303};
29304
29305static const _ExtendedGDBusSignalInfo _host_ipmi_signal_info_received_message =
29306{
29307 {
29308 -1,
29309 (gchar *) "ReceivedMessage",
29310 (GDBusArgInfo **) &_host_ipmi_signal_info_received_message_ARG_pointers,
29311 NULL
29312 },
29313 "received-message"
29314};
29315
29316static const _ExtendedGDBusSignalInfo * const _host_ipmi_signal_info_pointers[] =
29317{
29318 &_host_ipmi_signal_info_received_message,
29319 NULL
29320};
29321
29322static const _ExtendedGDBusInterfaceInfo _host_ipmi_interface_info =
29323{
29324 {
29325 -1,
29326 (gchar *) "org.openbmc.HostIpmi",
29327 (GDBusMethodInfo **) &_host_ipmi_method_info_pointers,
29328 (GDBusSignalInfo **) &_host_ipmi_signal_info_pointers,
29329 NULL,
29330 NULL
29331 },
29332 "host-ipmi",
29333};
29334
29335
29336/**
29337 * host_ipmi_interface_info:
29338 *
29339 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link> D-Bus interface.
29340 *
29341 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
29342 */
29343GDBusInterfaceInfo *
29344host_ipmi_interface_info (void)
29345{
29346 return (GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct;
29347}
29348
29349/**
29350 * host_ipmi_override_properties:
29351 * @klass: The class structure for a #GObject<!-- -->-derived class.
29352 * @property_id_begin: The property id to assign to the first overridden property.
29353 *
29354 * Overrides all #GObject properties in the #HostIpmi interface for a concrete class.
29355 * The properties are overridden in the order they are defined.
29356 *
29357 * Returns: The last property id.
29358 */
29359guint
29360host_ipmi_override_properties (GObjectClass *klass, guint property_id_begin)
29361{
29362 return property_id_begin - 1;
29363}
29364
29365
29366
29367/**
29368 * HostIpmi:
29369 *
29370 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link>.
29371 */
29372
29373/**
29374 * HostIpmiIface:
29375 * @parent_iface: The parent interface.
29376 * @handle_send_message: Handler for the #HostIpmi::handle-send-message signal.
29377 * @received_message: Handler for the #HostIpmi::received-message signal.
29378 *
29379 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link>.
29380 */
29381
29382typedef HostIpmiIface HostIpmiInterface;
29383G_DEFINE_INTERFACE (HostIpmi, host_ipmi, G_TYPE_OBJECT);
29384
29385static void
29386host_ipmi_default_init (HostIpmiIface *iface)
29387{
29388 /* GObject signals for incoming D-Bus method calls: */
29389 /**
29390 * HostIpmi::handle-send-message:
29391 * @object: A #HostIpmi.
29392 * @invocation: A #GDBusMethodInvocation.
29393 * @arg_seq: Argument passed by remote caller.
29394 * @arg_netfn: Argument passed by remote caller.
29395 * @arg_cmd: Argument passed by remote caller.
29396 * @arg_data: Argument passed by remote caller.
29397 *
29398 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-HostIpmi.sendMessage">sendMessage()</link> D-Bus method.
29399 *
29400 * 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.
29401 *
29402 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
29403 */
29404 g_signal_new ("handle-send-message",
29405 G_TYPE_FROM_INTERFACE (iface),
29406 G_SIGNAL_RUN_LAST,
29407 G_STRUCT_OFFSET (HostIpmiIface, handle_send_message),
29408 g_signal_accumulator_true_handled,
29409 NULL,
29410 g_cclosure_marshal_generic,
29411 G_TYPE_BOOLEAN,
29412 5,
29413 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_UCHAR, G_TYPE_UCHAR, G_TYPE_UCHAR, G_TYPE_STRING);
29414
29415 /* GObject signals for received D-Bus signals: */
29416 /**
29417 * HostIpmi::received-message:
29418 * @object: A #HostIpmi.
29419 * @arg_seq: Argument.
29420 * @arg_netfn: Argument.
29421 * @arg_cmd: Argument.
29422 * @arg_data: Argument.
29423 *
29424 * 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.
29425 *
29426 * 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.
29427 */
29428 g_signal_new ("received-message",
29429 G_TYPE_FROM_INTERFACE (iface),
29430 G_SIGNAL_RUN_LAST,
29431 G_STRUCT_OFFSET (HostIpmiIface, received_message),
29432 NULL,
29433 NULL,
29434 g_cclosure_marshal_generic,
29435 G_TYPE_NONE,
29436 4, G_TYPE_UCHAR, G_TYPE_UCHAR, G_TYPE_UCHAR, G_TYPE_STRING);
29437
29438}
29439
29440/**
29441 * host_ipmi_emit_received_message:
29442 * @object: A #HostIpmi.
29443 * @arg_seq: Argument to pass with the signal.
29444 * @arg_netfn: Argument to pass with the signal.
29445 * @arg_cmd: Argument to pass with the signal.
29446 * @arg_data: Argument to pass with the signal.
29447 *
29448 * Emits the <link linkend="gdbus-signal-org-openbmc-HostIpmi.ReceivedMessage">"ReceivedMessage"</link> D-Bus signal.
29449 */
29450void
29451host_ipmi_emit_received_message (
29452 HostIpmi *object,
29453 guchar arg_seq,
29454 guchar arg_netfn,
29455 guchar arg_cmd,
29456 const gchar *arg_data)
29457{
29458 g_signal_emit_by_name (object, "received-message", arg_seq, arg_netfn, arg_cmd, arg_data);
29459}
29460
29461/**
29462 * host_ipmi_call_send_message:
29463 * @proxy: A #HostIpmiProxy.
29464 * @arg_seq: Argument to pass with the method invocation.
29465 * @arg_netfn: Argument to pass with the method invocation.
29466 * @arg_cmd: Argument to pass with the method invocation.
29467 * @arg_data: Argument to pass with the method invocation.
29468 * @cancellable: (allow-none): A #GCancellable or %NULL.
29469 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
29470 * @user_data: User data to pass to @callback.
29471 *
29472 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-HostIpmi.sendMessage">sendMessage()</link> D-Bus method on @proxy.
29473 * 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.
29474 * You can then call host_ipmi_call_send_message_finish() to get the result of the operation.
29475 *
29476 * See host_ipmi_call_send_message_sync() for the synchronous, blocking version of this method.
29477 */
29478void
29479host_ipmi_call_send_message (
29480 HostIpmi *proxy,
29481 guchar arg_seq,
29482 guchar arg_netfn,
29483 guchar arg_cmd,
29484 const gchar *arg_data,
29485 GCancellable *cancellable,
29486 GAsyncReadyCallback callback,
29487 gpointer user_data)
29488{
29489 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
29490 "sendMessage",
29491 g_variant_new ("(yyy^ay)",
29492 arg_seq,
29493 arg_netfn,
29494 arg_cmd,
29495 arg_data),
29496 G_DBUS_CALL_FLAGS_NONE,
29497 -1,
29498 cancellable,
29499 callback,
29500 user_data);
29501}
29502
29503/**
29504 * host_ipmi_call_send_message_finish:
29505 * @proxy: A #HostIpmiProxy.
29506 * @out_unnamed_arg4: (out): Return location for return parameter or %NULL to ignore.
29507 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to host_ipmi_call_send_message().
29508 * @error: Return location for error or %NULL.
29509 *
29510 * Finishes an operation started with host_ipmi_call_send_message().
29511 *
29512 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
29513 */
29514gboolean
29515host_ipmi_call_send_message_finish (
29516 HostIpmi *proxy,
29517 gint64 *out_unnamed_arg4,
29518 GAsyncResult *res,
29519 GError **error)
29520{
29521 GVariant *_ret;
29522 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
29523 if (_ret == NULL)
29524 goto _out;
29525 g_variant_get (_ret,
29526 "(x)",
29527 out_unnamed_arg4);
29528 g_variant_unref (_ret);
29529_out:
29530 return _ret != NULL;
29531}
29532
29533/**
29534 * host_ipmi_call_send_message_sync:
29535 * @proxy: A #HostIpmiProxy.
29536 * @arg_seq: Argument to pass with the method invocation.
29537 * @arg_netfn: Argument to pass with the method invocation.
29538 * @arg_cmd: Argument to pass with the method invocation.
29539 * @arg_data: Argument to pass with the method invocation.
29540 * @out_unnamed_arg4: (out): Return location for return parameter or %NULL to ignore.
29541 * @cancellable: (allow-none): A #GCancellable or %NULL.
29542 * @error: Return location for error or %NULL.
29543 *
29544 * 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.
29545 *
29546 * See host_ipmi_call_send_message() for the asynchronous version of this method.
29547 *
29548 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
29549 */
29550gboolean
29551host_ipmi_call_send_message_sync (
29552 HostIpmi *proxy,
29553 guchar arg_seq,
29554 guchar arg_netfn,
29555 guchar arg_cmd,
29556 const gchar *arg_data,
29557 gint64 *out_unnamed_arg4,
29558 GCancellable *cancellable,
29559 GError **error)
29560{
29561 GVariant *_ret;
29562 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
29563 "sendMessage",
29564 g_variant_new ("(yyy^ay)",
29565 arg_seq,
29566 arg_netfn,
29567 arg_cmd,
29568 arg_data),
29569 G_DBUS_CALL_FLAGS_NONE,
29570 -1,
29571 cancellable,
29572 error);
29573 if (_ret == NULL)
29574 goto _out;
29575 g_variant_get (_ret,
29576 "(x)",
29577 out_unnamed_arg4);
29578 g_variant_unref (_ret);
29579_out:
29580 return _ret != NULL;
29581}
29582
29583/**
29584 * host_ipmi_complete_send_message:
29585 * @object: A #HostIpmi.
29586 * @invocation: (transfer full): A #GDBusMethodInvocation.
29587 * @unnamed_arg4: Parameter to return.
29588 *
29589 * 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.
29590 *
29591 * This method will free @invocation, you cannot use it afterwards.
29592 */
29593void
29594host_ipmi_complete_send_message (
29595 HostIpmi *object,
29596 GDBusMethodInvocation *invocation,
29597 gint64 unnamed_arg4)
29598{
29599 g_dbus_method_invocation_return_value (invocation,
29600 g_variant_new ("(x)",
29601 unnamed_arg4));
29602}
29603
29604/* ------------------------------------------------------------------------ */
29605
29606/**
29607 * HostIpmiProxy:
29608 *
29609 * The #HostIpmiProxy structure contains only private data and should only be accessed using the provided API.
29610 */
29611
29612/**
29613 * HostIpmiProxyClass:
29614 * @parent_class: The parent class.
29615 *
29616 * Class structure for #HostIpmiProxy.
29617 */
29618
29619struct _HostIpmiProxyPrivate
29620{
29621 GData *qdata;
29622};
29623
29624static void host_ipmi_proxy_iface_init (HostIpmiIface *iface);
29625
29626#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
29627G_DEFINE_TYPE_WITH_CODE (HostIpmiProxy, host_ipmi_proxy, G_TYPE_DBUS_PROXY,
29628 G_ADD_PRIVATE (HostIpmiProxy)
29629 G_IMPLEMENT_INTERFACE (TYPE_HOST_IPMI, host_ipmi_proxy_iface_init));
29630
29631#else
29632G_DEFINE_TYPE_WITH_CODE (HostIpmiProxy, host_ipmi_proxy, G_TYPE_DBUS_PROXY,
29633 G_IMPLEMENT_INTERFACE (TYPE_HOST_IPMI, host_ipmi_proxy_iface_init));
29634
29635#endif
29636static void
29637host_ipmi_proxy_finalize (GObject *object)
29638{
29639 HostIpmiProxy *proxy = HOST_IPMI_PROXY (object);
29640 g_datalist_clear (&proxy->priv->qdata);
29641 G_OBJECT_CLASS (host_ipmi_proxy_parent_class)->finalize (object);
29642}
29643
29644static void
29645host_ipmi_proxy_get_property (GObject *object,
29646 guint prop_id,
29647 GValue *value,
29648 GParamSpec *pspec G_GNUC_UNUSED)
29649{
29650}
29651
29652static void
29653host_ipmi_proxy_set_property (GObject *object,
29654 guint prop_id,
29655 const GValue *value,
29656 GParamSpec *pspec G_GNUC_UNUSED)
29657{
29658}
29659
29660static void
29661host_ipmi_proxy_g_signal (GDBusProxy *proxy,
29662 const gchar *sender_name G_GNUC_UNUSED,
29663 const gchar *signal_name,
29664 GVariant *parameters)
29665{
29666 _ExtendedGDBusSignalInfo *info;
29667 GVariantIter iter;
29668 GVariant *child;
29669 GValue *paramv;
29670 guint num_params;
29671 guint n;
29672 guint signal_id;
29673 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, signal_name);
29674 if (info == NULL)
29675 return;
29676 num_params = g_variant_n_children (parameters);
29677 paramv = g_new0 (GValue, num_params + 1);
29678 g_value_init (&paramv[0], TYPE_HOST_IPMI);
29679 g_value_set_object (&paramv[0], proxy);
29680 g_variant_iter_init (&iter, parameters);
29681 n = 1;
29682 while ((child = g_variant_iter_next_value (&iter)) != NULL)
29683 {
29684 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
29685 if (arg_info->use_gvariant)
29686 {
29687 g_value_init (&paramv[n], G_TYPE_VARIANT);
29688 g_value_set_variant (&paramv[n], child);
29689 n++;
29690 }
29691 else
29692 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
29693 g_variant_unref (child);
29694 }
29695 signal_id = g_signal_lookup (info->signal_name, TYPE_HOST_IPMI);
29696 g_signal_emitv (paramv, signal_id, 0, NULL);
29697 for (n = 0; n < num_params + 1; n++)
29698 g_value_unset (&paramv[n]);
29699 g_free (paramv);
29700}
29701
29702static void
29703host_ipmi_proxy_g_properties_changed (GDBusProxy *_proxy,
29704 GVariant *changed_properties,
29705 const gchar *const *invalidated_properties)
29706{
29707 HostIpmiProxy *proxy = HOST_IPMI_PROXY (_proxy);
29708 guint n;
29709 const gchar *key;
29710 GVariantIter *iter;
29711 _ExtendedGDBusPropertyInfo *info;
29712 g_variant_get (changed_properties, "a{sv}", &iter);
29713 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
29714 {
29715 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, key);
29716 g_datalist_remove_data (&proxy->priv->qdata, key);
29717 if (info != NULL)
29718 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
29719 }
29720 g_variant_iter_free (iter);
29721 for (n = 0; invalidated_properties[n] != NULL; n++)
29722 {
29723 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, invalidated_properties[n]);
29724 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
29725 if (info != NULL)
29726 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
29727 }
29728}
29729
29730static void
29731host_ipmi_proxy_init (HostIpmiProxy *proxy)
29732{
29733#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
29734 proxy->priv = host_ipmi_proxy_get_instance_private (proxy);
29735#else
29736 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_HOST_IPMI_PROXY, HostIpmiProxyPrivate);
29737#endif
29738
29739 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), host_ipmi_interface_info ());
29740}
29741
29742static void
29743host_ipmi_proxy_class_init (HostIpmiProxyClass *klass)
29744{
29745 GObjectClass *gobject_class;
29746 GDBusProxyClass *proxy_class;
29747
29748 gobject_class = G_OBJECT_CLASS (klass);
29749 gobject_class->finalize = host_ipmi_proxy_finalize;
29750 gobject_class->get_property = host_ipmi_proxy_get_property;
29751 gobject_class->set_property = host_ipmi_proxy_set_property;
29752
29753 proxy_class = G_DBUS_PROXY_CLASS (klass);
29754 proxy_class->g_signal = host_ipmi_proxy_g_signal;
29755 proxy_class->g_properties_changed = host_ipmi_proxy_g_properties_changed;
29756
29757#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
29758 g_type_class_add_private (klass, sizeof (HostIpmiProxyPrivate));
29759#endif
29760}
29761
29762static void
29763host_ipmi_proxy_iface_init (HostIpmiIface *iface)
29764{
29765}
29766
29767/**
29768 * host_ipmi_proxy_new:
29769 * @connection: A #GDBusConnection.
29770 * @flags: Flags from the #GDBusProxyFlags enumeration.
29771 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
29772 * @object_path: An object path.
29773 * @cancellable: (allow-none): A #GCancellable or %NULL.
29774 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
29775 * @user_data: User data to pass to @callback.
29776 *
29777 * 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.
29778 *
29779 * 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.
29780 * You can then call host_ipmi_proxy_new_finish() to get the result of the operation.
29781 *
29782 * See host_ipmi_proxy_new_sync() for the synchronous, blocking version of this constructor.
29783 */
29784void
29785host_ipmi_proxy_new (
29786 GDBusConnection *connection,
29787 GDBusProxyFlags flags,
29788 const gchar *name,
29789 const gchar *object_path,
29790 GCancellable *cancellable,
29791 GAsyncReadyCallback callback,
29792 gpointer user_data)
29793{
29794 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);
29795}
29796
29797/**
29798 * host_ipmi_proxy_new_finish:
29799 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to host_ipmi_proxy_new().
29800 * @error: Return location for error or %NULL
29801 *
29802 * Finishes an operation started with host_ipmi_proxy_new().
29803 *
29804 * Returns: (transfer full) (type HostIpmiProxy): The constructed proxy object or %NULL if @error is set.
29805 */
29806HostIpmi *
29807host_ipmi_proxy_new_finish (
29808 GAsyncResult *res,
29809 GError **error)
29810{
29811 GObject *ret;
29812 GObject *source_object;
29813 source_object = g_async_result_get_source_object (res);
29814 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
29815 g_object_unref (source_object);
29816 if (ret != NULL)
29817 return HOST_IPMI (ret);
29818 else
29819 return NULL;
29820}
29821
29822/**
29823 * host_ipmi_proxy_new_sync:
29824 * @connection: A #GDBusConnection.
29825 * @flags: Flags from the #GDBusProxyFlags enumeration.
29826 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
29827 * @object_path: An object path.
29828 * @cancellable: (allow-none): A #GCancellable or %NULL.
29829 * @error: Return location for error or %NULL
29830 *
29831 * 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.
29832 *
29833 * The calling thread is blocked until a reply is received.
29834 *
29835 * See host_ipmi_proxy_new() for the asynchronous version of this constructor.
29836 *
29837 * Returns: (transfer full) (type HostIpmiProxy): The constructed proxy object or %NULL if @error is set.
29838 */
29839HostIpmi *
29840host_ipmi_proxy_new_sync (
29841 GDBusConnection *connection,
29842 GDBusProxyFlags flags,
29843 const gchar *name,
29844 const gchar *object_path,
29845 GCancellable *cancellable,
29846 GError **error)
29847{
29848 GInitable *ret;
29849 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);
29850 if (ret != NULL)
29851 return HOST_IPMI (ret);
29852 else
29853 return NULL;
29854}
29855
29856
29857/**
29858 * host_ipmi_proxy_new_for_bus:
29859 * @bus_type: A #GBusType.
29860 * @flags: Flags from the #GDBusProxyFlags enumeration.
29861 * @name: A bus name (well-known or unique).
29862 * @object_path: An object path.
29863 * @cancellable: (allow-none): A #GCancellable or %NULL.
29864 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
29865 * @user_data: User data to pass to @callback.
29866 *
29867 * Like host_ipmi_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
29868 *
29869 * 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.
29870 * You can then call host_ipmi_proxy_new_for_bus_finish() to get the result of the operation.
29871 *
29872 * See host_ipmi_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
29873 */
29874void
29875host_ipmi_proxy_new_for_bus (
29876 GBusType bus_type,
29877 GDBusProxyFlags flags,
29878 const gchar *name,
29879 const gchar *object_path,
29880 GCancellable *cancellable,
29881 GAsyncReadyCallback callback,
29882 gpointer user_data)
29883{
29884 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);
29885}
29886
29887/**
29888 * host_ipmi_proxy_new_for_bus_finish:
29889 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to host_ipmi_proxy_new_for_bus().
29890 * @error: Return location for error or %NULL
29891 *
29892 * Finishes an operation started with host_ipmi_proxy_new_for_bus().
29893 *
29894 * Returns: (transfer full) (type HostIpmiProxy): The constructed proxy object or %NULL if @error is set.
29895 */
29896HostIpmi *
29897host_ipmi_proxy_new_for_bus_finish (
29898 GAsyncResult *res,
29899 GError **error)
29900{
29901 GObject *ret;
29902 GObject *source_object;
29903 source_object = g_async_result_get_source_object (res);
29904 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
29905 g_object_unref (source_object);
29906 if (ret != NULL)
29907 return HOST_IPMI (ret);
29908 else
29909 return NULL;
29910}
29911
29912/**
29913 * host_ipmi_proxy_new_for_bus_sync:
29914 * @bus_type: A #GBusType.
29915 * @flags: Flags from the #GDBusProxyFlags enumeration.
29916 * @name: A bus name (well-known or unique).
29917 * @object_path: An object path.
29918 * @cancellable: (allow-none): A #GCancellable or %NULL.
29919 * @error: Return location for error or %NULL
29920 *
29921 * Like host_ipmi_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
29922 *
29923 * The calling thread is blocked until a reply is received.
29924 *
29925 * See host_ipmi_proxy_new_for_bus() for the asynchronous version of this constructor.
29926 *
29927 * Returns: (transfer full) (type HostIpmiProxy): The constructed proxy object or %NULL if @error is set.
29928 */
29929HostIpmi *
29930host_ipmi_proxy_new_for_bus_sync (
29931 GBusType bus_type,
29932 GDBusProxyFlags flags,
29933 const gchar *name,
29934 const gchar *object_path,
29935 GCancellable *cancellable,
29936 GError **error)
29937{
29938 GInitable *ret;
29939 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);
29940 if (ret != NULL)
29941 return HOST_IPMI (ret);
29942 else
29943 return NULL;
29944}
29945
29946
29947/* ------------------------------------------------------------------------ */
29948
29949/**
29950 * HostIpmiSkeleton:
29951 *
29952 * The #HostIpmiSkeleton structure contains only private data and should only be accessed using the provided API.
29953 */
29954
29955/**
29956 * HostIpmiSkeletonClass:
29957 * @parent_class: The parent class.
29958 *
29959 * Class structure for #HostIpmiSkeleton.
29960 */
29961
29962struct _HostIpmiSkeletonPrivate
29963{
29964 GValue *properties;
29965 GList *changed_properties;
29966 GSource *changed_properties_idle_source;
29967 GMainContext *context;
29968 GMutex lock;
29969};
29970
29971static void
29972_host_ipmi_skeleton_handle_method_call (
29973 GDBusConnection *connection G_GNUC_UNUSED,
29974 const gchar *sender G_GNUC_UNUSED,
29975 const gchar *object_path G_GNUC_UNUSED,
29976 const gchar *interface_name,
29977 const gchar *method_name,
29978 GVariant *parameters,
29979 GDBusMethodInvocation *invocation,
29980 gpointer user_data)
29981{
29982 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (user_data);
29983 _ExtendedGDBusMethodInfo *info;
29984 GVariantIter iter;
29985 GVariant *child;
29986 GValue *paramv;
29987 guint num_params;
29988 guint num_extra;
29989 guint n;
29990 guint signal_id;
29991 GValue return_value = G_VALUE_INIT;
29992 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
29993 g_assert (info != NULL);
29994 num_params = g_variant_n_children (parameters);
29995 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
29996 n = 0;
29997 g_value_init (&paramv[n], TYPE_HOST_IPMI);
29998 g_value_set_object (&paramv[n++], skeleton);
29999 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
30000 g_value_set_object (&paramv[n++], invocation);
30001 if (info->pass_fdlist)
30002 {
30003#ifdef G_OS_UNIX
30004 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
30005 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
30006#else
30007 g_assert_not_reached ();
30008#endif
30009 }
30010 g_variant_iter_init (&iter, parameters);
30011 while ((child = g_variant_iter_next_value (&iter)) != NULL)
30012 {
30013 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
30014 if (arg_info->use_gvariant)
30015 {
30016 g_value_init (&paramv[n], G_TYPE_VARIANT);
30017 g_value_set_variant (&paramv[n], child);
30018 n++;
30019 }
30020 else
30021 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
30022 g_variant_unref (child);
30023 }
30024 signal_id = g_signal_lookup (info->signal_name, TYPE_HOST_IPMI);
30025 g_value_init (&return_value, G_TYPE_BOOLEAN);
30026 g_signal_emitv (paramv, signal_id, 0, &return_value);
30027 if (!g_value_get_boolean (&return_value))
30028 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);
30029 g_value_unset (&return_value);
30030 for (n = 0; n < num_params + num_extra; n++)
30031 g_value_unset (&paramv[n]);
30032 g_free (paramv);
30033}
30034
30035static GVariant *
30036_host_ipmi_skeleton_handle_get_property (
30037 GDBusConnection *connection G_GNUC_UNUSED,
30038 const gchar *sender G_GNUC_UNUSED,
30039 const gchar *object_path G_GNUC_UNUSED,
30040 const gchar *interface_name G_GNUC_UNUSED,
30041 const gchar *property_name,
30042 GError **error,
30043 gpointer user_data)
30044{
30045 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (user_data);
30046 GValue value = G_VALUE_INIT;
30047 GParamSpec *pspec;
30048 _ExtendedGDBusPropertyInfo *info;
30049 GVariant *ret;
30050 ret = NULL;
30051 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, property_name);
30052 g_assert (info != NULL);
30053 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
30054 if (pspec == NULL)
30055 {
30056 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
30057 }
30058 else
30059 {
30060 g_value_init (&value, pspec->value_type);
30061 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
30062 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
30063 g_value_unset (&value);
30064 }
30065 return ret;
30066}
30067
30068static gboolean
30069_host_ipmi_skeleton_handle_set_property (
30070 GDBusConnection *connection G_GNUC_UNUSED,
30071 const gchar *sender G_GNUC_UNUSED,
30072 const gchar *object_path G_GNUC_UNUSED,
30073 const gchar *interface_name G_GNUC_UNUSED,
30074 const gchar *property_name,
30075 GVariant *variant,
30076 GError **error,
30077 gpointer user_data)
30078{
30079 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (user_data);
30080 GValue value = G_VALUE_INIT;
30081 GParamSpec *pspec;
30082 _ExtendedGDBusPropertyInfo *info;
30083 gboolean ret;
30084 ret = FALSE;
30085 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, property_name);
30086 g_assert (info != NULL);
30087 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
30088 if (pspec == NULL)
30089 {
30090 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
30091 }
30092 else
30093 {
30094 if (info->use_gvariant)
30095 g_value_set_variant (&value, variant);
30096 else
30097 g_dbus_gvariant_to_gvalue (variant, &value);
30098 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
30099 g_value_unset (&value);
30100 ret = TRUE;
30101 }
30102 return ret;
30103}
30104
30105static const GDBusInterfaceVTable _host_ipmi_skeleton_vtable =
30106{
30107 _host_ipmi_skeleton_handle_method_call,
30108 _host_ipmi_skeleton_handle_get_property,
30109 _host_ipmi_skeleton_handle_set_property,
30110 {NULL}
30111};
30112
30113static GDBusInterfaceInfo *
30114host_ipmi_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
30115{
30116 return host_ipmi_interface_info ();
30117}
30118
30119static GDBusInterfaceVTable *
30120host_ipmi_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
30121{
30122 return (GDBusInterfaceVTable *) &_host_ipmi_skeleton_vtable;
30123}
30124
30125static GVariant *
30126host_ipmi_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
30127{
30128 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (_skeleton);
30129
30130 GVariantBuilder builder;
30131 guint n;
30132 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
30133 if (_host_ipmi_interface_info.parent_struct.properties == NULL)
30134 goto out;
30135 for (n = 0; _host_ipmi_interface_info.parent_struct.properties[n] != NULL; n++)
30136 {
30137 GDBusPropertyInfo *info = _host_ipmi_interface_info.parent_struct.properties[n];
30138 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
30139 {
30140 GVariant *value;
30141 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);
30142 if (value != NULL)
30143 {
30144 g_variant_take_ref (value);
30145 g_variant_builder_add (&builder, "{sv}", info->name, value);
30146 g_variant_unref (value);
30147 }
30148 }
30149 }
30150out:
30151 return g_variant_builder_end (&builder);
30152}
30153
30154static void
30155host_ipmi_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
30156{
30157}
30158
30159static void
30160_host_ipmi_on_signal_received_message (
30161 HostIpmi *object,
30162 guchar arg_seq,
30163 guchar arg_netfn,
30164 guchar arg_cmd,
30165 const gchar *arg_data)
30166{
30167 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (object);
30168
30169 GList *connections, *l;
30170 GVariant *signal_variant;
30171 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
30172
30173 signal_variant = g_variant_ref_sink (g_variant_new ("(yyy^ay)",
30174 arg_seq,
30175 arg_netfn,
30176 arg_cmd,
30177 arg_data));
30178 for (l = connections; l != NULL; l = l->next)
30179 {
30180 GDBusConnection *connection = l->data;
30181 g_dbus_connection_emit_signal (connection,
30182 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.HostIpmi", "ReceivedMessage",
30183 signal_variant, NULL);
30184 }
30185 g_variant_unref (signal_variant);
30186 g_list_free_full (connections, g_object_unref);
30187}
30188
30189static void host_ipmi_skeleton_iface_init (HostIpmiIface *iface);
30190#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
30191G_DEFINE_TYPE_WITH_CODE (HostIpmiSkeleton, host_ipmi_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
30192 G_ADD_PRIVATE (HostIpmiSkeleton)
30193 G_IMPLEMENT_INTERFACE (TYPE_HOST_IPMI, host_ipmi_skeleton_iface_init));
30194
30195#else
30196G_DEFINE_TYPE_WITH_CODE (HostIpmiSkeleton, host_ipmi_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
30197 G_IMPLEMENT_INTERFACE (TYPE_HOST_IPMI, host_ipmi_skeleton_iface_init));
30198
30199#endif
30200static void
30201host_ipmi_skeleton_finalize (GObject *object)
30202{
30203 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (object);
30204 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
30205 if (skeleton->priv->changed_properties_idle_source != NULL)
30206 g_source_destroy (skeleton->priv->changed_properties_idle_source);
30207 g_main_context_unref (skeleton->priv->context);
30208 g_mutex_clear (&skeleton->priv->lock);
30209 G_OBJECT_CLASS (host_ipmi_skeleton_parent_class)->finalize (object);
30210}
30211
30212static void
30213host_ipmi_skeleton_init (HostIpmiSkeleton *skeleton)
30214{
30215#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
30216 skeleton->priv = host_ipmi_skeleton_get_instance_private (skeleton);
30217#else
30218 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_HOST_IPMI_SKELETON, HostIpmiSkeletonPrivate);
30219#endif
30220
30221 g_mutex_init (&skeleton->priv->lock);
30222 skeleton->priv->context = g_main_context_ref_thread_default ();
30223}
30224
30225static void
30226host_ipmi_skeleton_class_init (HostIpmiSkeletonClass *klass)
30227{
30228 GObjectClass *gobject_class;
30229 GDBusInterfaceSkeletonClass *skeleton_class;
30230
30231 gobject_class = G_OBJECT_CLASS (klass);
30232 gobject_class->finalize = host_ipmi_skeleton_finalize;
30233
30234 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
30235 skeleton_class->get_info = host_ipmi_skeleton_dbus_interface_get_info;
30236 skeleton_class->get_properties = host_ipmi_skeleton_dbus_interface_get_properties;
30237 skeleton_class->flush = host_ipmi_skeleton_dbus_interface_flush;
30238 skeleton_class->get_vtable = host_ipmi_skeleton_dbus_interface_get_vtable;
30239
30240#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
30241 g_type_class_add_private (klass, sizeof (HostIpmiSkeletonPrivate));
30242#endif
30243}
30244
30245static void
30246host_ipmi_skeleton_iface_init (HostIpmiIface *iface)
30247{
30248 iface->received_message = _host_ipmi_on_signal_received_message;
30249}
30250
30251/**
30252 * host_ipmi_skeleton_new:
30253 *
30254 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link>.
30255 *
30256 * Returns: (transfer full) (type HostIpmiSkeleton): The skeleton object.
30257 */
30258HostIpmi *
30259host_ipmi_skeleton_new (void)
30260{
30261 return HOST_IPMI (g_object_new (TYPE_HOST_IPMI_SKELETON, NULL));
30262}
30263
30264/* ------------------------------------------------------------------------
Norman James362a80f2015-09-14 14:04:39 -050030265 * Code for Object, ObjectProxy and ObjectSkeleton
30266 * ------------------------------------------------------------------------
30267 */
30268
30269/**
30270 * SECTION:Object
30271 * @title: Object
30272 * @short_description: Specialized GDBusObject types
30273 *
30274 * This section contains the #Object, #ObjectProxy, and #ObjectSkeleton types which make it easier to work with objects implementing generated types for D-Bus interfaces.
30275 */
30276
30277/**
30278 * Object:
30279 *
30280 * The #Object type is a specialized container of interfaces.
30281 */
30282
30283/**
30284 * ObjectIface:
30285 * @parent_iface: The parent interface.
30286 *
30287 * Virtual table for the #Object interface.
30288 */
30289
30290typedef ObjectIface ObjectInterface;
30291G_DEFINE_INTERFACE_WITH_CODE (Object, object, G_TYPE_OBJECT, g_type_interface_add_prerequisite (g_define_type_id, G_TYPE_DBUS_OBJECT));
30292
30293static void
30294object_default_init (ObjectIface *iface)
30295{
30296 /**
Norman James5236a8f2015-11-05 20:39:31 -060030297 * Object:hwmon:
30298 *
30299 * 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.
30300 *
30301 * Connect to the #GObject::notify signal to get informed of property changes.
30302 */
30303 g_object_interface_install_property (iface, g_param_spec_object ("hwmon", "hwmon", "hwmon", TYPE_HWMON, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
30304
30305 /**
Norman James362a80f2015-09-14 14:04:39 -050030306 * Object:fan:
30307 *
30308 * 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.
30309 *
30310 * Connect to the #GObject::notify signal to get informed of property changes.
30311 */
30312 g_object_interface_install_property (iface, g_param_spec_object ("fan", "fan", "fan", TYPE_FAN, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
30313
30314 /**
30315 * Object:sensor-value:
30316 *
30317 * 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.
30318 *
30319 * Connect to the #GObject::notify signal to get informed of property changes.
30320 */
30321 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));
30322
30323 /**
30324 * Object:sensor-threshold:
30325 *
30326 * 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.
30327 *
30328 * Connect to the #GObject::notify signal to get informed of property changes.
30329 */
30330 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));
30331
30332 /**
30333 * Object:sensor-i2c:
30334 *
30335 * 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.
30336 *
30337 * Connect to the #GObject::notify signal to get informed of property changes.
30338 */
30339 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));
30340
30341 /**
30342 * Object:sensor-match:
30343 *
30344 * 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.
30345 *
30346 * Connect to the #GObject::notify signal to get informed of property changes.
30347 */
30348 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));
30349
30350 /**
30351 * Object:process:
30352 *
30353 * 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.
30354 *
30355 * Connect to the #GObject::notify signal to get informed of property changes.
30356 */
30357 g_object_interface_install_property (iface, g_param_spec_object ("process", "process", "process", TYPE_PROCESS, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
30358
30359 /**
Norman James18998182015-10-11 21:54:53 -050030360 * Object:shared-resource:
30361 *
30362 * 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.
30363 *
30364 * Connect to the #GObject::notify signal to get informed of property changes.
30365 */
30366 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));
30367
30368 /**
Norman James362a80f2015-09-14 14:04:39 -050030369 * Object:control:
30370 *
30371 * 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.
30372 *
30373 * Connect to the #GObject::notify signal to get informed of property changes.
30374 */
30375 g_object_interface_install_property (iface, g_param_spec_object ("control", "control", "control", TYPE_CONTROL, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
30376
30377 /**
30378 * Object:control-bmc:
30379 *
30380 * 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.
30381 *
30382 * Connect to the #GObject::notify signal to get informed of property changes.
30383 */
30384 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));
30385
30386 /**
30387 * Object:control-host:
30388 *
30389 * 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.
30390 *
30391 * Connect to the #GObject::notify signal to get informed of property changes.
30392 */
30393 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));
30394
30395 /**
30396 * Object:control-power:
30397 *
30398 * 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.
30399 *
30400 * Connect to the #GObject::notify signal to get informed of property changes.
30401 */
30402 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));
30403
30404 /**
Adriana Kobylakfd778822016-06-16 09:08:37 -050030405 * Object:control-checkstop:
30406 *
30407 * 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.
30408 *
30409 * Connect to the #GObject::notify signal to get informed of property changes.
30410 */
30411 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));
30412
30413 /**
Norman James362a80f2015-09-14 14:04:39 -050030414 * Object:watchdog:
30415 *
30416 * 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.
30417 *
30418 * Connect to the #GObject::notify signal to get informed of property changes.
30419 */
30420 g_object_interface_install_property (iface, g_param_spec_object ("watchdog", "watchdog", "watchdog", TYPE_WATCHDOG, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
30421
30422 /**
30423 * Object:event-log:
30424 *
30425 * 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.
30426 *
30427 * Connect to the #GObject::notify signal to get informed of property changes.
30428 */
30429 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));
30430
30431 /**
30432 * Object:flash:
30433 *
30434 * 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.
30435 *
30436 * Connect to the #GObject::notify signal to get informed of property changes.
30437 */
30438 g_object_interface_install_property (iface, g_param_spec_object ("flash", "flash", "flash", TYPE_FLASH, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
30439
30440 /**
Norman James18998182015-10-11 21:54:53 -050030441 * Object:flash-control:
30442 *
30443 * 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.
30444 *
30445 * Connect to the #GObject::notify signal to get informed of property changes.
30446 */
30447 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));
30448
30449 /**
Norman James362a80f2015-09-14 14:04:39 -050030450 * Object:button:
30451 *
30452 * 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.
30453 *
30454 * Connect to the #GObject::notify signal to get informed of property changes.
30455 */
30456 g_object_interface_install_property (iface, g_param_spec_object ("button", "button", "button", TYPE_BUTTON, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
30457
30458 /**
30459 * Object:led:
30460 *
30461 * 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.
30462 *
30463 * Connect to the #GObject::notify signal to get informed of property changes.
30464 */
30465 g_object_interface_install_property (iface, g_param_spec_object ("led", "led", "led", TYPE_LED, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
30466
Norman Jamesdbcffbd2015-10-06 16:53:06 -050030467 /**
30468 * Object:host-ipmi:
30469 *
30470 * 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.
30471 *
30472 * Connect to the #GObject::notify signal to get informed of property changes.
30473 */
30474 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));
30475
Norman James362a80f2015-09-14 14:04:39 -050030476}
30477
30478/**
Norman James5236a8f2015-11-05 20:39:31 -060030479 * object_get_hwmon:
30480 * @object: A #Object.
30481 *
30482 * 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.
30483 *
30484 * Returns: (transfer full): A #Hwmon that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
30485 */
30486Hwmon *object_get_hwmon (Object *object)
30487{
30488 GDBusInterface *ret;
30489 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Hwmon");
30490 if (ret == NULL)
30491 return NULL;
30492 return HWMON (ret);
30493}
30494
30495/**
Norman James362a80f2015-09-14 14:04:39 -050030496 * object_get_fan:
30497 * @object: A #Object.
30498 *
30499 * 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.
30500 *
30501 * Returns: (transfer full): A #Fan that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
30502 */
30503Fan *object_get_fan (Object *object)
30504{
30505 GDBusInterface *ret;
30506 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan");
30507 if (ret == NULL)
30508 return NULL;
30509 return FAN (ret);
30510}
30511
30512/**
30513 * object_get_sensor_value:
30514 * @object: A #Object.
30515 *
30516 * 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.
30517 *
30518 * Returns: (transfer full): A #SensorValue that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
30519 */
30520SensorValue *object_get_sensor_value (Object *object)
30521{
30522 GDBusInterface *ret;
30523 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue");
30524 if (ret == NULL)
30525 return NULL;
30526 return SENSOR_VALUE (ret);
30527}
30528
30529/**
30530 * object_get_sensor_threshold:
30531 * @object: A #Object.
30532 *
30533 * 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.
30534 *
30535 * Returns: (transfer full): A #SensorThreshold that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
30536 */
30537SensorThreshold *object_get_sensor_threshold (Object *object)
30538{
30539 GDBusInterface *ret;
30540 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold");
30541 if (ret == NULL)
30542 return NULL;
30543 return SENSOR_THRESHOLD (ret);
30544}
30545
30546/**
30547 * object_get_sensor_i2c:
30548 * @object: A #Object.
30549 *
30550 * 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.
30551 *
30552 * Returns: (transfer full): A #SensorI2c that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
30553 */
30554SensorI2c *object_get_sensor_i2c (Object *object)
30555{
30556 GDBusInterface *ret;
30557 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
30558 if (ret == NULL)
30559 return NULL;
30560 return SENSOR_I2C (ret);
30561}
30562
30563/**
30564 * object_get_sensor_match:
30565 * @object: A #Object.
30566 *
30567 * 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.
30568 *
30569 * Returns: (transfer full): A #SensorMatch that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
30570 */
30571SensorMatch *object_get_sensor_match (Object *object)
30572{
30573 GDBusInterface *ret;
30574 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch");
30575 if (ret == NULL)
30576 return NULL;
30577 return SENSOR_MATCH (ret);
30578}
30579
30580/**
30581 * object_get_process:
30582 * @object: A #Object.
30583 *
30584 * 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.
30585 *
30586 * Returns: (transfer full): A #Process that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
30587 */
30588Process *object_get_process (Object *object)
30589{
30590 GDBusInterface *ret;
30591 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process");
30592 if (ret == NULL)
30593 return NULL;
30594 return PROCESS (ret);
30595}
30596
30597/**
Norman James18998182015-10-11 21:54:53 -050030598 * object_get_shared_resource:
30599 * @object: A #Object.
30600 *
30601 * 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.
30602 *
30603 * Returns: (transfer full): A #SharedResource that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
30604 */
30605SharedResource *object_get_shared_resource (Object *object)
30606{
30607 GDBusInterface *ret;
30608 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SharedResource");
30609 if (ret == NULL)
30610 return NULL;
30611 return SHARED_RESOURCE (ret);
30612}
30613
30614/**
Norman James362a80f2015-09-14 14:04:39 -050030615 * object_get_control:
30616 * @object: A #Object.
30617 *
30618 * 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.
30619 *
30620 * Returns: (transfer full): A #Control that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
30621 */
30622Control *object_get_control (Object *object)
30623{
30624 GDBusInterface *ret;
30625 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control");
30626 if (ret == NULL)
30627 return NULL;
30628 return CONTROL (ret);
30629}
30630
30631/**
30632 * object_get_control_bmc:
30633 * @object: A #Object.
30634 *
30635 * 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.
30636 *
30637 * Returns: (transfer full): A #ControlBmc that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
30638 */
30639ControlBmc *object_get_control_bmc (Object *object)
30640{
30641 GDBusInterface *ret;
30642 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc");
30643 if (ret == NULL)
30644 return NULL;
30645 return CONTROL_BMC (ret);
30646}
30647
30648/**
30649 * object_get_control_host:
30650 * @object: A #Object.
30651 *
30652 * 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.
30653 *
30654 * Returns: (transfer full): A #ControlHost that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
30655 */
30656ControlHost *object_get_control_host (Object *object)
30657{
30658 GDBusInterface *ret;
30659 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
30660 if (ret == NULL)
30661 return NULL;
30662 return CONTROL_HOST (ret);
30663}
30664
30665/**
30666 * object_get_control_power:
30667 * @object: A #Object.
30668 *
30669 * 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.
30670 *
30671 * Returns: (transfer full): A #ControlPower that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
30672 */
30673ControlPower *object_get_control_power (Object *object)
30674{
30675 GDBusInterface *ret;
30676 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power");
30677 if (ret == NULL)
30678 return NULL;
30679 return CONTROL_POWER (ret);
30680}
30681
30682/**
Adriana Kobylakfd778822016-06-16 09:08:37 -050030683 * object_get_control_checkstop:
30684 * @object: A #Object.
30685 *
30686 * 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.
30687 *
30688 * Returns: (transfer full): A #ControlCheckstop that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
30689 */
30690ControlCheckstop *object_get_control_checkstop (Object *object)
30691{
30692 GDBusInterface *ret;
30693 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Checkstop");
30694 if (ret == NULL)
30695 return NULL;
30696 return CONTROL_CHECKSTOP (ret);
30697}
30698
30699/**
Norman James362a80f2015-09-14 14:04:39 -050030700 * object_get_watchdog:
30701 * @object: A #Object.
30702 *
30703 * 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.
30704 *
30705 * Returns: (transfer full): A #Watchdog that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
30706 */
30707Watchdog *object_get_watchdog (Object *object)
30708{
30709 GDBusInterface *ret;
30710 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog");
30711 if (ret == NULL)
30712 return NULL;
30713 return WATCHDOG (ret);
30714}
30715
30716/**
30717 * object_get_event_log:
30718 * @object: A #Object.
30719 *
30720 * 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.
30721 *
30722 * Returns: (transfer full): A #EventLog that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
30723 */
30724EventLog *object_get_event_log (Object *object)
30725{
30726 GDBusInterface *ret;
30727 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
30728 if (ret == NULL)
30729 return NULL;
30730 return EVENT_LOG (ret);
30731}
30732
30733/**
30734 * object_get_flash:
30735 * @object: A #Object.
30736 *
30737 * 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.
30738 *
30739 * Returns: (transfer full): A #Flash that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
30740 */
30741Flash *object_get_flash (Object *object)
30742{
30743 GDBusInterface *ret;
30744 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash");
30745 if (ret == NULL)
30746 return NULL;
30747 return FLASH (ret);
30748}
30749
30750/**
Norman James18998182015-10-11 21:54:53 -050030751 * object_get_flash_control:
30752 * @object: A #Object.
30753 *
30754 * 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.
30755 *
30756 * Returns: (transfer full): A #FlashControl that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
30757 */
30758FlashControl *object_get_flash_control (Object *object)
30759{
30760 GDBusInterface *ret;
30761 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.FlashControl");
30762 if (ret == NULL)
30763 return NULL;
30764 return FLASH_CONTROL (ret);
30765}
30766
30767/**
Norman James362a80f2015-09-14 14:04:39 -050030768 * object_get_button:
30769 * @object: A #Object.
30770 *
30771 * 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.
30772 *
30773 * Returns: (transfer full): A #Button that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
30774 */
30775Button *object_get_button (Object *object)
30776{
30777 GDBusInterface *ret;
30778 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button");
30779 if (ret == NULL)
30780 return NULL;
30781 return BUTTON (ret);
30782}
30783
30784/**
30785 * object_get_led:
30786 * @object: A #Object.
30787 *
30788 * 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.
30789 *
30790 * Returns: (transfer full): A #Led that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
30791 */
30792Led *object_get_led (Object *object)
30793{
30794 GDBusInterface *ret;
30795 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led");
30796 if (ret == NULL)
30797 return NULL;
30798 return LED (ret);
30799}
30800
Norman Jamesdbcffbd2015-10-06 16:53:06 -050030801/**
30802 * object_get_host_ipmi:
30803 * @object: A #Object.
30804 *
30805 * 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.
30806 *
30807 * Returns: (transfer full): A #HostIpmi that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
30808 */
30809HostIpmi *object_get_host_ipmi (Object *object)
30810{
30811 GDBusInterface *ret;
30812 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.HostIpmi");
30813 if (ret == NULL)
30814 return NULL;
30815 return HOST_IPMI (ret);
30816}
30817
Norman James362a80f2015-09-14 14:04:39 -050030818
30819/**
Norman James5236a8f2015-11-05 20:39:31 -060030820 * object_peek_hwmon: (skip)
30821 * @object: A #Object.
30822 *
30823 * Like object_get_hwmon() but doesn't increase the reference count on the returned object.
30824 *
30825 * <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>
30826 *
30827 * 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.
30828 */
30829Hwmon *object_peek_hwmon (Object *object)
30830{
30831 GDBusInterface *ret;
30832 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Hwmon");
30833 if (ret == NULL)
30834 return NULL;
30835 g_object_unref (ret);
30836 return HWMON (ret);
30837}
30838
30839/**
Norman James362a80f2015-09-14 14:04:39 -050030840 * object_peek_fan: (skip)
30841 * @object: A #Object.
30842 *
30843 * Like object_get_fan() but doesn't increase the reference count on the returned object.
30844 *
30845 * <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>
30846 *
30847 * 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.
30848 */
30849Fan *object_peek_fan (Object *object)
30850{
30851 GDBusInterface *ret;
30852 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan");
30853 if (ret == NULL)
30854 return NULL;
30855 g_object_unref (ret);
30856 return FAN (ret);
30857}
30858
30859/**
30860 * object_peek_sensor_value: (skip)
30861 * @object: A #Object.
30862 *
30863 * Like object_get_sensor_value() but doesn't increase the reference count on the returned object.
30864 *
30865 * <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>
30866 *
30867 * 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.
30868 */
30869SensorValue *object_peek_sensor_value (Object *object)
30870{
30871 GDBusInterface *ret;
30872 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue");
30873 if (ret == NULL)
30874 return NULL;
30875 g_object_unref (ret);
30876 return SENSOR_VALUE (ret);
30877}
30878
30879/**
30880 * object_peek_sensor_threshold: (skip)
30881 * @object: A #Object.
30882 *
30883 * Like object_get_sensor_threshold() but doesn't increase the reference count on the returned object.
30884 *
30885 * <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>
30886 *
30887 * 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.
30888 */
30889SensorThreshold *object_peek_sensor_threshold (Object *object)
30890{
30891 GDBusInterface *ret;
30892 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold");
30893 if (ret == NULL)
30894 return NULL;
30895 g_object_unref (ret);
30896 return SENSOR_THRESHOLD (ret);
30897}
30898
30899/**
30900 * object_peek_sensor_i2c: (skip)
30901 * @object: A #Object.
30902 *
30903 * Like object_get_sensor_i2c() but doesn't increase the reference count on the returned object.
30904 *
30905 * <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>
30906 *
30907 * 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.
30908 */
30909SensorI2c *object_peek_sensor_i2c (Object *object)
30910{
30911 GDBusInterface *ret;
30912 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
30913 if (ret == NULL)
30914 return NULL;
30915 g_object_unref (ret);
30916 return SENSOR_I2C (ret);
30917}
30918
30919/**
30920 * object_peek_sensor_match: (skip)
30921 * @object: A #Object.
30922 *
30923 * Like object_get_sensor_match() but doesn't increase the reference count on the returned object.
30924 *
30925 * <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>
30926 *
30927 * 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.
30928 */
30929SensorMatch *object_peek_sensor_match (Object *object)
30930{
30931 GDBusInterface *ret;
30932 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch");
30933 if (ret == NULL)
30934 return NULL;
30935 g_object_unref (ret);
30936 return SENSOR_MATCH (ret);
30937}
30938
30939/**
30940 * object_peek_process: (skip)
30941 * @object: A #Object.
30942 *
30943 * Like object_get_process() but doesn't increase the reference count on the returned object.
30944 *
30945 * <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>
30946 *
30947 * 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.
30948 */
30949Process *object_peek_process (Object *object)
30950{
30951 GDBusInterface *ret;
30952 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process");
30953 if (ret == NULL)
30954 return NULL;
30955 g_object_unref (ret);
30956 return PROCESS (ret);
30957}
30958
30959/**
Norman James18998182015-10-11 21:54:53 -050030960 * object_peek_shared_resource: (skip)
30961 * @object: A #Object.
30962 *
30963 * Like object_get_shared_resource() but doesn't increase the reference count on the returned object.
30964 *
30965 * <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>
30966 *
30967 * 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.
30968 */
30969SharedResource *object_peek_shared_resource (Object *object)
30970{
30971 GDBusInterface *ret;
30972 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SharedResource");
30973 if (ret == NULL)
30974 return NULL;
30975 g_object_unref (ret);
30976 return SHARED_RESOURCE (ret);
30977}
30978
30979/**
Norman James362a80f2015-09-14 14:04:39 -050030980 * object_peek_control: (skip)
30981 * @object: A #Object.
30982 *
30983 * Like object_get_control() but doesn't increase the reference count on the returned object.
30984 *
30985 * <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>
30986 *
30987 * 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.
30988 */
30989Control *object_peek_control (Object *object)
30990{
30991 GDBusInterface *ret;
30992 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control");
30993 if (ret == NULL)
30994 return NULL;
30995 g_object_unref (ret);
30996 return CONTROL (ret);
30997}
30998
30999/**
31000 * object_peek_control_bmc: (skip)
31001 * @object: A #Object.
31002 *
31003 * Like object_get_control_bmc() but doesn't increase the reference count on the returned object.
31004 *
31005 * <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>
31006 *
31007 * 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.
31008 */
31009ControlBmc *object_peek_control_bmc (Object *object)
31010{
31011 GDBusInterface *ret;
31012 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc");
31013 if (ret == NULL)
31014 return NULL;
31015 g_object_unref (ret);
31016 return CONTROL_BMC (ret);
31017}
31018
31019/**
31020 * object_peek_control_host: (skip)
31021 * @object: A #Object.
31022 *
31023 * Like object_get_control_host() but doesn't increase the reference count on the returned object.
31024 *
31025 * <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>
31026 *
31027 * 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.
31028 */
31029ControlHost *object_peek_control_host (Object *object)
31030{
31031 GDBusInterface *ret;
31032 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
31033 if (ret == NULL)
31034 return NULL;
31035 g_object_unref (ret);
31036 return CONTROL_HOST (ret);
31037}
31038
31039/**
31040 * object_peek_control_power: (skip)
31041 * @object: A #Object.
31042 *
31043 * Like object_get_control_power() but doesn't increase the reference count on the returned object.
31044 *
31045 * <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>
31046 *
31047 * 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.
31048 */
31049ControlPower *object_peek_control_power (Object *object)
31050{
31051 GDBusInterface *ret;
31052 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power");
31053 if (ret == NULL)
31054 return NULL;
31055 g_object_unref (ret);
31056 return CONTROL_POWER (ret);
31057}
31058
31059/**
Adriana Kobylakfd778822016-06-16 09:08:37 -050031060 * object_peek_control_checkstop: (skip)
31061 * @object: A #Object.
31062 *
31063 * Like object_get_control_checkstop() but doesn't increase the reference count on the returned object.
31064 *
31065 * <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>
31066 *
31067 * 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.
31068 */
31069ControlCheckstop *object_peek_control_checkstop (Object *object)
31070{
31071 GDBusInterface *ret;
31072 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Checkstop");
31073 if (ret == NULL)
31074 return NULL;
31075 g_object_unref (ret);
31076 return CONTROL_CHECKSTOP (ret);
31077}
31078
31079/**
Norman James362a80f2015-09-14 14:04:39 -050031080 * object_peek_watchdog: (skip)
31081 * @object: A #Object.
31082 *
31083 * Like object_get_watchdog() but doesn't increase the reference count on the returned object.
31084 *
31085 * <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>
31086 *
31087 * 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.
31088 */
31089Watchdog *object_peek_watchdog (Object *object)
31090{
31091 GDBusInterface *ret;
31092 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog");
31093 if (ret == NULL)
31094 return NULL;
31095 g_object_unref (ret);
31096 return WATCHDOG (ret);
31097}
31098
31099/**
31100 * object_peek_event_log: (skip)
31101 * @object: A #Object.
31102 *
31103 * Like object_get_event_log() but doesn't increase the reference count on the returned object.
31104 *
31105 * <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>
31106 *
31107 * 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.
31108 */
31109EventLog *object_peek_event_log (Object *object)
31110{
31111 GDBusInterface *ret;
31112 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
31113 if (ret == NULL)
31114 return NULL;
31115 g_object_unref (ret);
31116 return EVENT_LOG (ret);
31117}
31118
31119/**
31120 * object_peek_flash: (skip)
31121 * @object: A #Object.
31122 *
31123 * Like object_get_flash() but doesn't increase the reference count on the returned object.
31124 *
31125 * <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>
31126 *
31127 * 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.
31128 */
31129Flash *object_peek_flash (Object *object)
31130{
31131 GDBusInterface *ret;
31132 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash");
31133 if (ret == NULL)
31134 return NULL;
31135 g_object_unref (ret);
31136 return FLASH (ret);
31137}
31138
31139/**
Norman James18998182015-10-11 21:54:53 -050031140 * object_peek_flash_control: (skip)
31141 * @object: A #Object.
31142 *
31143 * Like object_get_flash_control() but doesn't increase the reference count on the returned object.
31144 *
31145 * <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>
31146 *
31147 * 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.
31148 */
31149FlashControl *object_peek_flash_control (Object *object)
31150{
31151 GDBusInterface *ret;
31152 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.FlashControl");
31153 if (ret == NULL)
31154 return NULL;
31155 g_object_unref (ret);
31156 return FLASH_CONTROL (ret);
31157}
31158
31159/**
Norman James362a80f2015-09-14 14:04:39 -050031160 * object_peek_button: (skip)
31161 * @object: A #Object.
31162 *
31163 * Like object_get_button() but doesn't increase the reference count on the returned object.
31164 *
31165 * <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>
31166 *
31167 * 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.
31168 */
31169Button *object_peek_button (Object *object)
31170{
31171 GDBusInterface *ret;
31172 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button");
31173 if (ret == NULL)
31174 return NULL;
31175 g_object_unref (ret);
31176 return BUTTON (ret);
31177}
31178
31179/**
31180 * object_peek_led: (skip)
31181 * @object: A #Object.
31182 *
31183 * Like object_get_led() but doesn't increase the reference count on the returned object.
31184 *
31185 * <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>
31186 *
31187 * 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.
31188 */
31189Led *object_peek_led (Object *object)
31190{
31191 GDBusInterface *ret;
31192 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led");
31193 if (ret == NULL)
31194 return NULL;
31195 g_object_unref (ret);
31196 return LED (ret);
31197}
31198
Norman Jamesdbcffbd2015-10-06 16:53:06 -050031199/**
31200 * object_peek_host_ipmi: (skip)
31201 * @object: A #Object.
31202 *
31203 * Like object_get_host_ipmi() but doesn't increase the reference count on the returned object.
31204 *
31205 * <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>
31206 *
31207 * 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.
31208 */
31209HostIpmi *object_peek_host_ipmi (Object *object)
31210{
31211 GDBusInterface *ret;
31212 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.HostIpmi");
31213 if (ret == NULL)
31214 return NULL;
31215 g_object_unref (ret);
31216 return HOST_IPMI (ret);
31217}
31218
Norman James362a80f2015-09-14 14:04:39 -050031219
31220static void
31221object_notify (GDBusObject *object, GDBusInterface *interface)
31222{
31223 _ExtendedGDBusInterfaceInfo *info = (_ExtendedGDBusInterfaceInfo *) g_dbus_interface_get_info (interface);
31224 /* info can be NULL if the other end is using a D-Bus interface we don't know
31225 * anything about, for example old generated code in this process talking to
31226 * newer generated code in the other process. */
31227 if (info != NULL)
31228 g_object_notify (G_OBJECT (object), info->hyphen_name);
31229}
31230
31231/**
31232 * ObjectProxy:
31233 *
31234 * The #ObjectProxy structure contains only private data and should only be accessed using the provided API.
31235 */
31236
31237/**
31238 * ObjectProxyClass:
31239 * @parent_class: The parent class.
31240 *
31241 * Class structure for #ObjectProxy.
31242 */
31243
31244static void
31245object_proxy__object_iface_init (ObjectIface *iface G_GNUC_UNUSED)
31246{
31247}
31248
31249static void
31250object_proxy__g_dbus_object_iface_init (GDBusObjectIface *iface)
31251{
31252 iface->interface_added = object_notify;
31253 iface->interface_removed = object_notify;
31254}
31255
31256
31257G_DEFINE_TYPE_WITH_CODE (ObjectProxy, object_proxy, G_TYPE_DBUS_OBJECT_PROXY,
31258 G_IMPLEMENT_INTERFACE (TYPE_OBJECT, object_proxy__object_iface_init)
31259 G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, object_proxy__g_dbus_object_iface_init));
31260
31261static void
31262object_proxy_init (ObjectProxy *object G_GNUC_UNUSED)
31263{
31264}
31265
31266static void
31267object_proxy_set_property (GObject *gobject,
31268 guint prop_id,
31269 const GValue *value G_GNUC_UNUSED,
31270 GParamSpec *pspec)
31271{
31272 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
31273}
31274
31275static void
31276object_proxy_get_property (GObject *gobject,
31277 guint prop_id,
31278 GValue *value,
31279 GParamSpec *pspec)
31280{
31281 ObjectProxy *object = OBJECT_PROXY (gobject);
31282 GDBusInterface *interface;
31283
31284 switch (prop_id)
31285 {
31286 case 1:
Norman James5236a8f2015-11-05 20:39:31 -060031287 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Hwmon");
Norman James362a80f2015-09-14 14:04:39 -050031288 g_value_take_object (value, interface);
31289 break;
31290
Brad Bishop6bbf6462016-06-21 15:12:19 -040031291 case 2:
Norman James5236a8f2015-11-05 20:39:31 -060031292 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan");
Norman James362a80f2015-09-14 14:04:39 -050031293 g_value_take_object (value, interface);
31294 break;
31295
Brad Bishop6bbf6462016-06-21 15:12:19 -040031296 case 3:
Norman James5236a8f2015-11-05 20:39:31 -060031297 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue");
Norman James362a80f2015-09-14 14:04:39 -050031298 g_value_take_object (value, interface);
31299 break;
31300
Brad Bishop6bbf6462016-06-21 15:12:19 -040031301 case 4:
Norman James5236a8f2015-11-05 20:39:31 -060031302 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold");
Norman James362a80f2015-09-14 14:04:39 -050031303 g_value_take_object (value, interface);
31304 break;
31305
Brad Bishop6bbf6462016-06-21 15:12:19 -040031306 case 5:
Norman James5236a8f2015-11-05 20:39:31 -060031307 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
Norman James362a80f2015-09-14 14:04:39 -050031308 g_value_take_object (value, interface);
31309 break;
31310
Brad Bishop6bbf6462016-06-21 15:12:19 -040031311 case 6:
Norman James5236a8f2015-11-05 20:39:31 -060031312 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch");
Norman James362a80f2015-09-14 14:04:39 -050031313 g_value_take_object (value, interface);
31314 break;
31315
Brad Bishop6bbf6462016-06-21 15:12:19 -040031316 case 7:
Norman James5236a8f2015-11-05 20:39:31 -060031317 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process");
Norman James362a80f2015-09-14 14:04:39 -050031318 g_value_take_object (value, interface);
31319 break;
31320
Brad Bishop6bbf6462016-06-21 15:12:19 -040031321 case 8:
Norman James5236a8f2015-11-05 20:39:31 -060031322 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SharedResource");
Norman James362a80f2015-09-14 14:04:39 -050031323 g_value_take_object (value, interface);
31324 break;
31325
Brad Bishop6bbf6462016-06-21 15:12:19 -040031326 case 9:
Norman James5236a8f2015-11-05 20:39:31 -060031327 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control");
Norman James362a80f2015-09-14 14:04:39 -050031328 g_value_take_object (value, interface);
31329 break;
31330
Brad Bishop6bbf6462016-06-21 15:12:19 -040031331 case 10:
Norman James5236a8f2015-11-05 20:39:31 -060031332 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc");
Norman James362a80f2015-09-14 14:04:39 -050031333 g_value_take_object (value, interface);
31334 break;
31335
Brad Bishop6bbf6462016-06-21 15:12:19 -040031336 case 11:
Norman James5236a8f2015-11-05 20:39:31 -060031337 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
Norman James362a80f2015-09-14 14:04:39 -050031338 g_value_take_object (value, interface);
31339 break;
31340
Brad Bishop6bbf6462016-06-21 15:12:19 -040031341 case 12:
Norman James5236a8f2015-11-05 20:39:31 -060031342 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power");
Norman James362a80f2015-09-14 14:04:39 -050031343 g_value_take_object (value, interface);
31344 break;
31345
Brad Bishop6bbf6462016-06-21 15:12:19 -040031346 case 13:
Adriana Kobylakfd778822016-06-16 09:08:37 -050031347 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Checkstop");
Norman Jamesdfdaca92015-09-27 22:11:15 -050031348 g_value_take_object (value, interface);
31349 break;
31350
Brad Bishop6bbf6462016-06-21 15:12:19 -040031351 case 14:
Adriana Kobylakfd778822016-06-16 09:08:37 -050031352 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog");
Norman James362a80f2015-09-14 14:04:39 -050031353 g_value_take_object (value, interface);
31354 break;
31355
Brad Bishop6bbf6462016-06-21 15:12:19 -040031356 case 15:
Adriana Kobylakfd778822016-06-16 09:08:37 -050031357 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
Norman James18998182015-10-11 21:54:53 -050031358 g_value_take_object (value, interface);
31359 break;
31360
Brad Bishop6bbf6462016-06-21 15:12:19 -040031361 case 16:
Adriana Kobylakfd778822016-06-16 09:08:37 -050031362 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash");
Norman James18998182015-10-11 21:54:53 -050031363 g_value_take_object (value, interface);
31364 break;
31365
Brad Bishop6bbf6462016-06-21 15:12:19 -040031366 case 17:
Adriana Kobylakfd778822016-06-16 09:08:37 -050031367 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.FlashControl");
Norman James493996c2015-10-31 17:27:13 -050031368 g_value_take_object (value, interface);
31369 break;
31370
Brad Bishop6bbf6462016-06-21 15:12:19 -040031371 case 18:
Adriana Kobylakfd778822016-06-16 09:08:37 -050031372 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button");
Norman James5236a8f2015-11-05 20:39:31 -060031373 g_value_take_object (value, interface);
31374 break;
31375
Brad Bishop6bbf6462016-06-21 15:12:19 -040031376 case 19:
Adriana Kobylakfd778822016-06-16 09:08:37 -050031377 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led");
31378 g_value_take_object (value, interface);
31379 break;
31380
Brad Bishop6bbf6462016-06-21 15:12:19 -040031381 case 20:
Norman Jamesdbcffbd2015-10-06 16:53:06 -050031382 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.HostIpmi");
31383 g_value_take_object (value, interface);
31384 break;
31385
Norman James362a80f2015-09-14 14:04:39 -050031386 default:
31387 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
31388 break;
31389 }
31390}
31391
31392static void
31393object_proxy_class_init (ObjectProxyClass *klass)
31394{
31395 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
31396
31397 gobject_class->set_property = object_proxy_set_property;
31398 gobject_class->get_property = object_proxy_get_property;
31399
Brad Bishop6bbf6462016-06-21 15:12:19 -040031400 g_object_class_override_property (gobject_class, 1, "hwmon");
31401 g_object_class_override_property (gobject_class, 2, "fan");
31402 g_object_class_override_property (gobject_class, 3, "sensor-value");
31403 g_object_class_override_property (gobject_class, 4, "sensor-threshold");
31404 g_object_class_override_property (gobject_class, 5, "sensor-i2c");
31405 g_object_class_override_property (gobject_class, 6, "sensor-match");
31406 g_object_class_override_property (gobject_class, 7, "process");
31407 g_object_class_override_property (gobject_class, 8, "shared-resource");
31408 g_object_class_override_property (gobject_class, 9, "control");
31409 g_object_class_override_property (gobject_class, 10, "control-bmc");
31410 g_object_class_override_property (gobject_class, 11, "control-host");
31411 g_object_class_override_property (gobject_class, 12, "control-power");
31412 g_object_class_override_property (gobject_class, 13, "control-checkstop");
31413 g_object_class_override_property (gobject_class, 14, "watchdog");
31414 g_object_class_override_property (gobject_class, 15, "event-log");
31415 g_object_class_override_property (gobject_class, 16, "flash");
31416 g_object_class_override_property (gobject_class, 17, "flash-control");
31417 g_object_class_override_property (gobject_class, 18, "button");
31418 g_object_class_override_property (gobject_class, 19, "led");
31419 g_object_class_override_property (gobject_class, 20, "host-ipmi");
Norman James362a80f2015-09-14 14:04:39 -050031420}
31421
31422/**
31423 * object_proxy_new:
31424 * @connection: A #GDBusConnection.
31425 * @object_path: An object path.
31426 *
31427 * Creates a new proxy object.
31428 *
31429 * Returns: (transfer full): The proxy object.
31430 */
31431ObjectProxy *
31432object_proxy_new (GDBusConnection *connection,
31433 const gchar *object_path)
31434{
31435 g_return_val_if_fail (G_IS_DBUS_CONNECTION (connection), NULL);
31436 g_return_val_if_fail (g_variant_is_object_path (object_path), NULL);
31437 return OBJECT_PROXY (g_object_new (TYPE_OBJECT_PROXY, "g-connection", connection, "g-object-path", object_path, NULL));
31438}
31439
31440/**
31441 * ObjectSkeleton:
31442 *
31443 * The #ObjectSkeleton structure contains only private data and should only be accessed using the provided API.
31444 */
31445
31446/**
31447 * ObjectSkeletonClass:
31448 * @parent_class: The parent class.
31449 *
31450 * Class structure for #ObjectSkeleton.
31451 */
31452
31453static void
31454object_skeleton__object_iface_init (ObjectIface *iface G_GNUC_UNUSED)
31455{
31456}
31457
31458
31459static void
31460object_skeleton__g_dbus_object_iface_init (GDBusObjectIface *iface)
31461{
31462 iface->interface_added = object_notify;
31463 iface->interface_removed = object_notify;
31464}
31465
31466G_DEFINE_TYPE_WITH_CODE (ObjectSkeleton, object_skeleton, G_TYPE_DBUS_OBJECT_SKELETON,
31467 G_IMPLEMENT_INTERFACE (TYPE_OBJECT, object_skeleton__object_iface_init)
31468 G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, object_skeleton__g_dbus_object_iface_init));
31469
31470static void
31471object_skeleton_init (ObjectSkeleton *object G_GNUC_UNUSED)
31472{
31473}
31474
31475static void
31476object_skeleton_set_property (GObject *gobject,
31477 guint prop_id,
31478 const GValue *value,
31479 GParamSpec *pspec)
31480{
31481 ObjectSkeleton *object = OBJECT_SKELETON (gobject);
31482 GDBusInterfaceSkeleton *interface;
31483
31484 switch (prop_id)
31485 {
31486 case 1:
31487 interface = g_value_get_object (value);
31488 if (interface != NULL)
31489 {
Norman James5236a8f2015-11-05 20:39:31 -060031490 g_warn_if_fail (IS_HWMON (interface));
31491 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
31492 }
31493 else
31494 {
31495 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Hwmon");
31496 }
31497 break;
31498
Brad Bishop6bbf6462016-06-21 15:12:19 -040031499 case 2:
Norman James5236a8f2015-11-05 20:39:31 -060031500 interface = g_value_get_object (value);
31501 if (interface != NULL)
31502 {
Norman James362a80f2015-09-14 14:04:39 -050031503 g_warn_if_fail (IS_FAN (interface));
31504 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
31505 }
31506 else
31507 {
31508 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Fan");
31509 }
31510 break;
31511
Brad Bishop6bbf6462016-06-21 15:12:19 -040031512 case 3:
Norman James362a80f2015-09-14 14:04:39 -050031513 interface = g_value_get_object (value);
31514 if (interface != NULL)
31515 {
31516 g_warn_if_fail (IS_SENSOR_VALUE (interface));
31517 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
31518 }
31519 else
31520 {
31521 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorValue");
31522 }
31523 break;
31524
Brad Bishop6bbf6462016-06-21 15:12:19 -040031525 case 4:
Norman James362a80f2015-09-14 14:04:39 -050031526 interface = g_value_get_object (value);
31527 if (interface != NULL)
31528 {
31529 g_warn_if_fail (IS_SENSOR_THRESHOLD (interface));
31530 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
31531 }
31532 else
31533 {
31534 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorThreshold");
31535 }
31536 break;
31537
Brad Bishop6bbf6462016-06-21 15:12:19 -040031538 case 5:
Norman James362a80f2015-09-14 14:04:39 -050031539 interface = g_value_get_object (value);
31540 if (interface != NULL)
31541 {
31542 g_warn_if_fail (IS_SENSOR_I2C (interface));
31543 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
31544 }
31545 else
31546 {
31547 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorI2c");
31548 }
31549 break;
31550
Brad Bishop6bbf6462016-06-21 15:12:19 -040031551 case 6:
Norman James362a80f2015-09-14 14:04:39 -050031552 interface = g_value_get_object (value);
31553 if (interface != NULL)
31554 {
31555 g_warn_if_fail (IS_SENSOR_MATCH (interface));
31556 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
31557 }
31558 else
31559 {
31560 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorMatch");
31561 }
31562 break;
31563
Brad Bishop6bbf6462016-06-21 15:12:19 -040031564 case 7:
Norman James362a80f2015-09-14 14:04:39 -050031565 interface = g_value_get_object (value);
31566 if (interface != NULL)
31567 {
31568 g_warn_if_fail (IS_PROCESS (interface));
31569 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
31570 }
31571 else
31572 {
31573 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Process");
31574 }
31575 break;
31576
Brad Bishop6bbf6462016-06-21 15:12:19 -040031577 case 8:
Norman James362a80f2015-09-14 14:04:39 -050031578 interface = g_value_get_object (value);
31579 if (interface != NULL)
31580 {
Norman James18998182015-10-11 21:54:53 -050031581 g_warn_if_fail (IS_SHARED_RESOURCE (interface));
31582 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
31583 }
31584 else
31585 {
31586 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SharedResource");
31587 }
31588 break;
31589
Brad Bishop6bbf6462016-06-21 15:12:19 -040031590 case 9:
Norman James18998182015-10-11 21:54:53 -050031591 interface = g_value_get_object (value);
31592 if (interface != NULL)
31593 {
Norman James362a80f2015-09-14 14:04:39 -050031594 g_warn_if_fail (IS_CONTROL (interface));
31595 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
31596 }
31597 else
31598 {
31599 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Control");
31600 }
31601 break;
31602
Brad Bishop6bbf6462016-06-21 15:12:19 -040031603 case 10:
Norman James362a80f2015-09-14 14:04:39 -050031604 interface = g_value_get_object (value);
31605 if (interface != NULL)
31606 {
31607 g_warn_if_fail (IS_CONTROL_BMC (interface));
31608 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
31609 }
31610 else
31611 {
31612 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.control.Bmc");
31613 }
31614 break;
31615
Brad Bishop6bbf6462016-06-21 15:12:19 -040031616 case 11:
Norman James362a80f2015-09-14 14:04:39 -050031617 interface = g_value_get_object (value);
31618 if (interface != NULL)
31619 {
31620 g_warn_if_fail (IS_CONTROL_HOST (interface));
31621 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
31622 }
31623 else
31624 {
31625 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.control.Host");
31626 }
31627 break;
31628
Brad Bishop6bbf6462016-06-21 15:12:19 -040031629 case 12:
Norman James362a80f2015-09-14 14:04:39 -050031630 interface = g_value_get_object (value);
31631 if (interface != NULL)
31632 {
31633 g_warn_if_fail (IS_CONTROL_POWER (interface));
31634 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
31635 }
31636 else
31637 {
31638 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.control.Power");
31639 }
31640 break;
31641
Brad Bishop6bbf6462016-06-21 15:12:19 -040031642 case 13:
Norman James362a80f2015-09-14 14:04:39 -050031643 interface = g_value_get_object (value);
31644 if (interface != NULL)
31645 {
Adriana Kobylakfd778822016-06-16 09:08:37 -050031646 g_warn_if_fail (IS_CONTROL_CHECKSTOP (interface));
31647 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
31648 }
31649 else
31650 {
31651 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.control.Checkstop");
31652 }
31653 break;
31654
Brad Bishop6bbf6462016-06-21 15:12:19 -040031655 case 14:
Adriana Kobylakfd778822016-06-16 09:08:37 -050031656 interface = g_value_get_object (value);
31657 if (interface != NULL)
31658 {
Norman James362a80f2015-09-14 14:04:39 -050031659 g_warn_if_fail (IS_WATCHDOG (interface));
31660 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
31661 }
31662 else
31663 {
31664 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Watchdog");
31665 }
31666 break;
31667
Brad Bishop6bbf6462016-06-21 15:12:19 -040031668 case 15:
Norman James362a80f2015-09-14 14:04:39 -050031669 interface = g_value_get_object (value);
31670 if (interface != NULL)
31671 {
31672 g_warn_if_fail (IS_EVENT_LOG (interface));
31673 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
31674 }
31675 else
31676 {
31677 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.EventLog");
31678 }
31679 break;
31680
Brad Bishop6bbf6462016-06-21 15:12:19 -040031681 case 16:
Norman James362a80f2015-09-14 14:04:39 -050031682 interface = g_value_get_object (value);
31683 if (interface != NULL)
31684 {
31685 g_warn_if_fail (IS_FLASH (interface));
31686 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
31687 }
31688 else
31689 {
31690 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Flash");
31691 }
31692 break;
31693
Brad Bishop6bbf6462016-06-21 15:12:19 -040031694 case 17:
Norman James18998182015-10-11 21:54:53 -050031695 interface = g_value_get_object (value);
31696 if (interface != NULL)
31697 {
31698 g_warn_if_fail (IS_FLASH_CONTROL (interface));
31699 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
31700 }
31701 else
31702 {
31703 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.FlashControl");
31704 }
31705 break;
31706
Brad Bishop6bbf6462016-06-21 15:12:19 -040031707 case 18:
Norman James362a80f2015-09-14 14:04:39 -050031708 interface = g_value_get_object (value);
31709 if (interface != NULL)
31710 {
31711 g_warn_if_fail (IS_BUTTON (interface));
31712 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
31713 }
31714 else
31715 {
31716 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Button");
31717 }
31718 break;
31719
Brad Bishop6bbf6462016-06-21 15:12:19 -040031720 case 19:
Norman James362a80f2015-09-14 14:04:39 -050031721 interface = g_value_get_object (value);
31722 if (interface != NULL)
31723 {
31724 g_warn_if_fail (IS_LED (interface));
31725 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
31726 }
31727 else
31728 {
31729 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Led");
31730 }
31731 break;
31732
Brad Bishop6bbf6462016-06-21 15:12:19 -040031733 case 20:
Norman Jamesdbcffbd2015-10-06 16:53:06 -050031734 interface = g_value_get_object (value);
31735 if (interface != NULL)
31736 {
31737 g_warn_if_fail (IS_HOST_IPMI (interface));
31738 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
31739 }
31740 else
31741 {
31742 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.HostIpmi");
31743 }
31744 break;
31745
Norman James362a80f2015-09-14 14:04:39 -050031746 default:
31747 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
31748 break;
31749 }
31750}
31751
31752static void
31753object_skeleton_get_property (GObject *gobject,
31754 guint prop_id,
31755 GValue *value,
31756 GParamSpec *pspec)
31757{
31758 ObjectSkeleton *object = OBJECT_SKELETON (gobject);
31759 GDBusInterface *interface;
31760
31761 switch (prop_id)
31762 {
31763 case 1:
Norman James5236a8f2015-11-05 20:39:31 -060031764 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Hwmon");
Norman James362a80f2015-09-14 14:04:39 -050031765 g_value_take_object (value, interface);
31766 break;
31767
Brad Bishop6bbf6462016-06-21 15:12:19 -040031768 case 2:
Norman James5236a8f2015-11-05 20:39:31 -060031769 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan");
Norman James362a80f2015-09-14 14:04:39 -050031770 g_value_take_object (value, interface);
31771 break;
31772
Brad Bishop6bbf6462016-06-21 15:12:19 -040031773 case 3:
Norman James5236a8f2015-11-05 20:39:31 -060031774 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue");
Norman James362a80f2015-09-14 14:04:39 -050031775 g_value_take_object (value, interface);
31776 break;
31777
Brad Bishop6bbf6462016-06-21 15:12:19 -040031778 case 4:
Norman James5236a8f2015-11-05 20:39:31 -060031779 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold");
Norman James362a80f2015-09-14 14:04:39 -050031780 g_value_take_object (value, interface);
31781 break;
31782
Brad Bishop6bbf6462016-06-21 15:12:19 -040031783 case 5:
Norman James5236a8f2015-11-05 20:39:31 -060031784 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
Norman James362a80f2015-09-14 14:04:39 -050031785 g_value_take_object (value, interface);
31786 break;
31787
Brad Bishop6bbf6462016-06-21 15:12:19 -040031788 case 6:
Norman James5236a8f2015-11-05 20:39:31 -060031789 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch");
Norman James362a80f2015-09-14 14:04:39 -050031790 g_value_take_object (value, interface);
31791 break;
31792
Brad Bishop6bbf6462016-06-21 15:12:19 -040031793 case 7:
Norman James5236a8f2015-11-05 20:39:31 -060031794 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process");
Norman James362a80f2015-09-14 14:04:39 -050031795 g_value_take_object (value, interface);
31796 break;
31797
Brad Bishop6bbf6462016-06-21 15:12:19 -040031798 case 8:
Norman James5236a8f2015-11-05 20:39:31 -060031799 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SharedResource");
Norman James362a80f2015-09-14 14:04:39 -050031800 g_value_take_object (value, interface);
31801 break;
31802
Brad Bishop6bbf6462016-06-21 15:12:19 -040031803 case 9:
Norman James5236a8f2015-11-05 20:39:31 -060031804 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control");
Norman James362a80f2015-09-14 14:04:39 -050031805 g_value_take_object (value, interface);
31806 break;
31807
Brad Bishop6bbf6462016-06-21 15:12:19 -040031808 case 10:
Norman James5236a8f2015-11-05 20:39:31 -060031809 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc");
Norman James362a80f2015-09-14 14:04:39 -050031810 g_value_take_object (value, interface);
31811 break;
31812
Brad Bishop6bbf6462016-06-21 15:12:19 -040031813 case 11:
Norman James5236a8f2015-11-05 20:39:31 -060031814 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
Norman James362a80f2015-09-14 14:04:39 -050031815 g_value_take_object (value, interface);
31816 break;
31817
Brad Bishop6bbf6462016-06-21 15:12:19 -040031818 case 12:
Norman James5236a8f2015-11-05 20:39:31 -060031819 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power");
Norman James362a80f2015-09-14 14:04:39 -050031820 g_value_take_object (value, interface);
31821 break;
31822
Brad Bishop6bbf6462016-06-21 15:12:19 -040031823 case 13:
Adriana Kobylakfd778822016-06-16 09:08:37 -050031824 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Checkstop");
Norman Jamesdfdaca92015-09-27 22:11:15 -050031825 g_value_take_object (value, interface);
31826 break;
31827
Brad Bishop6bbf6462016-06-21 15:12:19 -040031828 case 14:
Adriana Kobylakfd778822016-06-16 09:08:37 -050031829 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog");
Norman James362a80f2015-09-14 14:04:39 -050031830 g_value_take_object (value, interface);
31831 break;
31832
Brad Bishop6bbf6462016-06-21 15:12:19 -040031833 case 15:
Adriana Kobylakfd778822016-06-16 09:08:37 -050031834 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
Norman James18998182015-10-11 21:54:53 -050031835 g_value_take_object (value, interface);
31836 break;
31837
Brad Bishop6bbf6462016-06-21 15:12:19 -040031838 case 16:
Adriana Kobylakfd778822016-06-16 09:08:37 -050031839 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash");
Norman James18998182015-10-11 21:54:53 -050031840 g_value_take_object (value, interface);
31841 break;
31842
Brad Bishop6bbf6462016-06-21 15:12:19 -040031843 case 17:
Adriana Kobylakfd778822016-06-16 09:08:37 -050031844 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.FlashControl");
Norman James493996c2015-10-31 17:27:13 -050031845 g_value_take_object (value, interface);
31846 break;
31847
Brad Bishop6bbf6462016-06-21 15:12:19 -040031848 case 18:
Adriana Kobylakfd778822016-06-16 09:08:37 -050031849 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button");
Norman James5236a8f2015-11-05 20:39:31 -060031850 g_value_take_object (value, interface);
31851 break;
31852
Brad Bishop6bbf6462016-06-21 15:12:19 -040031853 case 19:
Adriana Kobylakfd778822016-06-16 09:08:37 -050031854 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led");
31855 g_value_take_object (value, interface);
31856 break;
31857
Brad Bishop6bbf6462016-06-21 15:12:19 -040031858 case 20:
Norman Jamesdbcffbd2015-10-06 16:53:06 -050031859 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.HostIpmi");
31860 g_value_take_object (value, interface);
31861 break;
31862
Norman James362a80f2015-09-14 14:04:39 -050031863 default:
31864 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
31865 break;
31866 }
31867}
31868
31869static void
31870object_skeleton_class_init (ObjectSkeletonClass *klass)
31871{
31872 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
31873
31874 gobject_class->set_property = object_skeleton_set_property;
31875 gobject_class->get_property = object_skeleton_get_property;
31876
Brad Bishop6bbf6462016-06-21 15:12:19 -040031877 g_object_class_override_property (gobject_class, 1, "hwmon");
31878 g_object_class_override_property (gobject_class, 2, "fan");
31879 g_object_class_override_property (gobject_class, 3, "sensor-value");
31880 g_object_class_override_property (gobject_class, 4, "sensor-threshold");
31881 g_object_class_override_property (gobject_class, 5, "sensor-i2c");
31882 g_object_class_override_property (gobject_class, 6, "sensor-match");
31883 g_object_class_override_property (gobject_class, 7, "process");
31884 g_object_class_override_property (gobject_class, 8, "shared-resource");
31885 g_object_class_override_property (gobject_class, 9, "control");
31886 g_object_class_override_property (gobject_class, 10, "control-bmc");
31887 g_object_class_override_property (gobject_class, 11, "control-host");
31888 g_object_class_override_property (gobject_class, 12, "control-power");
31889 g_object_class_override_property (gobject_class, 13, "control-checkstop");
31890 g_object_class_override_property (gobject_class, 14, "watchdog");
31891 g_object_class_override_property (gobject_class, 15, "event-log");
31892 g_object_class_override_property (gobject_class, 16, "flash");
31893 g_object_class_override_property (gobject_class, 17, "flash-control");
31894 g_object_class_override_property (gobject_class, 18, "button");
31895 g_object_class_override_property (gobject_class, 19, "led");
31896 g_object_class_override_property (gobject_class, 20, "host-ipmi");
Norman James362a80f2015-09-14 14:04:39 -050031897}
31898
31899/**
31900 * object_skeleton_new:
31901 * @object_path: An object path.
31902 *
31903 * Creates a new skeleton object.
31904 *
31905 * Returns: (transfer full): The skeleton object.
31906 */
31907ObjectSkeleton *
31908object_skeleton_new (const gchar *object_path)
31909{
31910 g_return_val_if_fail (g_variant_is_object_path (object_path), NULL);
31911 return OBJECT_SKELETON (g_object_new (TYPE_OBJECT_SKELETON, "g-object-path", object_path, NULL));
31912}
31913
31914/**
Norman James5236a8f2015-11-05 20:39:31 -060031915 * object_skeleton_set_hwmon:
31916 * @object: A #ObjectSkeleton.
31917 * @interface_: (allow-none): A #Hwmon or %NULL to clear the interface.
31918 *
31919 * 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.
31920 */
31921void object_skeleton_set_hwmon (ObjectSkeleton *object, Hwmon *interface_)
31922{
31923 g_object_set (G_OBJECT (object), "hwmon", interface_, NULL);
31924}
31925
31926/**
Norman James362a80f2015-09-14 14:04:39 -050031927 * object_skeleton_set_fan:
31928 * @object: A #ObjectSkeleton.
31929 * @interface_: (allow-none): A #Fan or %NULL to clear the interface.
31930 *
31931 * 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.
31932 */
31933void object_skeleton_set_fan (ObjectSkeleton *object, Fan *interface_)
31934{
31935 g_object_set (G_OBJECT (object), "fan", interface_, NULL);
31936}
31937
31938/**
31939 * object_skeleton_set_sensor_value:
31940 * @object: A #ObjectSkeleton.
31941 * @interface_: (allow-none): A #SensorValue or %NULL to clear the interface.
31942 *
31943 * 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.
31944 */
31945void object_skeleton_set_sensor_value (ObjectSkeleton *object, SensorValue *interface_)
31946{
31947 g_object_set (G_OBJECT (object), "sensor-value", interface_, NULL);
31948}
31949
31950/**
31951 * object_skeleton_set_sensor_threshold:
31952 * @object: A #ObjectSkeleton.
31953 * @interface_: (allow-none): A #SensorThreshold or %NULL to clear the interface.
31954 *
31955 * 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.
31956 */
31957void object_skeleton_set_sensor_threshold (ObjectSkeleton *object, SensorThreshold *interface_)
31958{
31959 g_object_set (G_OBJECT (object), "sensor-threshold", interface_, NULL);
31960}
31961
31962/**
31963 * object_skeleton_set_sensor_i2c:
31964 * @object: A #ObjectSkeleton.
31965 * @interface_: (allow-none): A #SensorI2c or %NULL to clear the interface.
31966 *
31967 * 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.
31968 */
31969void object_skeleton_set_sensor_i2c (ObjectSkeleton *object, SensorI2c *interface_)
31970{
31971 g_object_set (G_OBJECT (object), "sensor-i2c", interface_, NULL);
31972}
31973
31974/**
31975 * object_skeleton_set_sensor_match:
31976 * @object: A #ObjectSkeleton.
31977 * @interface_: (allow-none): A #SensorMatch or %NULL to clear the interface.
31978 *
31979 * 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.
31980 */
31981void object_skeleton_set_sensor_match (ObjectSkeleton *object, SensorMatch *interface_)
31982{
31983 g_object_set (G_OBJECT (object), "sensor-match", interface_, NULL);
31984}
31985
31986/**
31987 * object_skeleton_set_process:
31988 * @object: A #ObjectSkeleton.
31989 * @interface_: (allow-none): A #Process or %NULL to clear the interface.
31990 *
31991 * 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.
31992 */
31993void object_skeleton_set_process (ObjectSkeleton *object, Process *interface_)
31994{
31995 g_object_set (G_OBJECT (object), "process", interface_, NULL);
31996}
31997
31998/**
Norman James18998182015-10-11 21:54:53 -050031999 * object_skeleton_set_shared_resource:
32000 * @object: A #ObjectSkeleton.
32001 * @interface_: (allow-none): A #SharedResource or %NULL to clear the interface.
32002 *
32003 * 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.
32004 */
32005void object_skeleton_set_shared_resource (ObjectSkeleton *object, SharedResource *interface_)
32006{
32007 g_object_set (G_OBJECT (object), "shared-resource", interface_, NULL);
32008}
32009
32010/**
Norman James362a80f2015-09-14 14:04:39 -050032011 * object_skeleton_set_control:
32012 * @object: A #ObjectSkeleton.
32013 * @interface_: (allow-none): A #Control or %NULL to clear the interface.
32014 *
32015 * 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.
32016 */
32017void object_skeleton_set_control (ObjectSkeleton *object, Control *interface_)
32018{
32019 g_object_set (G_OBJECT (object), "control", interface_, NULL);
32020}
32021
32022/**
32023 * object_skeleton_set_control_bmc:
32024 * @object: A #ObjectSkeleton.
32025 * @interface_: (allow-none): A #ControlBmc or %NULL to clear the interface.
32026 *
32027 * 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.
32028 */
32029void object_skeleton_set_control_bmc (ObjectSkeleton *object, ControlBmc *interface_)
32030{
32031 g_object_set (G_OBJECT (object), "control-bmc", interface_, NULL);
32032}
32033
32034/**
32035 * object_skeleton_set_control_host:
32036 * @object: A #ObjectSkeleton.
32037 * @interface_: (allow-none): A #ControlHost or %NULL to clear the interface.
32038 *
32039 * 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.
32040 */
32041void object_skeleton_set_control_host (ObjectSkeleton *object, ControlHost *interface_)
32042{
32043 g_object_set (G_OBJECT (object), "control-host", interface_, NULL);
32044}
32045
32046/**
32047 * object_skeleton_set_control_power:
32048 * @object: A #ObjectSkeleton.
32049 * @interface_: (allow-none): A #ControlPower or %NULL to clear the interface.
32050 *
32051 * 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.
32052 */
32053void object_skeleton_set_control_power (ObjectSkeleton *object, ControlPower *interface_)
32054{
32055 g_object_set (G_OBJECT (object), "control-power", interface_, NULL);
32056}
32057
32058/**
Adriana Kobylakfd778822016-06-16 09:08:37 -050032059 * object_skeleton_set_control_checkstop:
32060 * @object: A #ObjectSkeleton.
32061 * @interface_: (allow-none): A #ControlCheckstop or %NULL to clear the interface.
32062 *
32063 * 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.
32064 */
32065void object_skeleton_set_control_checkstop (ObjectSkeleton *object, ControlCheckstop *interface_)
32066{
32067 g_object_set (G_OBJECT (object), "control-checkstop", interface_, NULL);
32068}
32069
32070/**
Norman James362a80f2015-09-14 14:04:39 -050032071 * object_skeleton_set_watchdog:
32072 * @object: A #ObjectSkeleton.
32073 * @interface_: (allow-none): A #Watchdog or %NULL to clear the interface.
32074 *
32075 * 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.
32076 */
32077void object_skeleton_set_watchdog (ObjectSkeleton *object, Watchdog *interface_)
32078{
32079 g_object_set (G_OBJECT (object), "watchdog", interface_, NULL);
32080}
32081
32082/**
32083 * object_skeleton_set_event_log:
32084 * @object: A #ObjectSkeleton.
32085 * @interface_: (allow-none): A #EventLog or %NULL to clear the interface.
32086 *
32087 * 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.
32088 */
32089void object_skeleton_set_event_log (ObjectSkeleton *object, EventLog *interface_)
32090{
32091 g_object_set (G_OBJECT (object), "event-log", interface_, NULL);
32092}
32093
32094/**
32095 * object_skeleton_set_flash:
32096 * @object: A #ObjectSkeleton.
32097 * @interface_: (allow-none): A #Flash or %NULL to clear the interface.
32098 *
32099 * 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.
32100 */
32101void object_skeleton_set_flash (ObjectSkeleton *object, Flash *interface_)
32102{
32103 g_object_set (G_OBJECT (object), "flash", interface_, NULL);
32104}
32105
32106/**
Norman James18998182015-10-11 21:54:53 -050032107 * object_skeleton_set_flash_control:
32108 * @object: A #ObjectSkeleton.
32109 * @interface_: (allow-none): A #FlashControl or %NULL to clear the interface.
32110 *
32111 * 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.
32112 */
32113void object_skeleton_set_flash_control (ObjectSkeleton *object, FlashControl *interface_)
32114{
32115 g_object_set (G_OBJECT (object), "flash-control", interface_, NULL);
32116}
32117
32118/**
Norman James362a80f2015-09-14 14:04:39 -050032119 * object_skeleton_set_button:
32120 * @object: A #ObjectSkeleton.
32121 * @interface_: (allow-none): A #Button or %NULL to clear the interface.
32122 *
32123 * 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.
32124 */
32125void object_skeleton_set_button (ObjectSkeleton *object, Button *interface_)
32126{
32127 g_object_set (G_OBJECT (object), "button", interface_, NULL);
32128}
32129
32130/**
32131 * object_skeleton_set_led:
32132 * @object: A #ObjectSkeleton.
32133 * @interface_: (allow-none): A #Led or %NULL to clear the interface.
32134 *
32135 * 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.
32136 */
32137void object_skeleton_set_led (ObjectSkeleton *object, Led *interface_)
32138{
32139 g_object_set (G_OBJECT (object), "led", interface_, NULL);
32140}
32141
Norman Jamesdbcffbd2015-10-06 16:53:06 -050032142/**
32143 * object_skeleton_set_host_ipmi:
32144 * @object: A #ObjectSkeleton.
32145 * @interface_: (allow-none): A #HostIpmi or %NULL to clear the interface.
32146 *
32147 * 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.
32148 */
32149void object_skeleton_set_host_ipmi (ObjectSkeleton *object, HostIpmi *interface_)
32150{
32151 g_object_set (G_OBJECT (object), "host-ipmi", interface_, NULL);
32152}
32153
Norman James362a80f2015-09-14 14:04:39 -050032154
32155/* ------------------------------------------------------------------------
32156 * Code for ObjectManager client
32157 * ------------------------------------------------------------------------
32158 */
32159
32160/**
32161 * SECTION:ObjectManagerClient
32162 * @title: ObjectManagerClient
32163 * @short_description: Generated GDBusObjectManagerClient type
32164 *
32165 * This section contains a #GDBusObjectManagerClient that uses object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc.
32166 */
32167
32168/**
32169 * ObjectManagerClient:
32170 *
32171 * The #ObjectManagerClient structure contains only private data and should only be accessed using the provided API.
32172 */
32173
32174/**
32175 * ObjectManagerClientClass:
32176 * @parent_class: The parent class.
32177 *
32178 * Class structure for #ObjectManagerClient.
32179 */
32180
32181G_DEFINE_TYPE (ObjectManagerClient, object_manager_client, G_TYPE_DBUS_OBJECT_MANAGER_CLIENT);
32182
32183static void
32184object_manager_client_init (ObjectManagerClient *manager G_GNUC_UNUSED)
32185{
32186}
32187
32188static void
32189object_manager_client_class_init (ObjectManagerClientClass *klass G_GNUC_UNUSED)
32190{
32191}
32192
32193/**
32194 * object_manager_client_get_proxy_type:
32195 * @manager: A #GDBusObjectManagerClient.
32196 * @object_path: The object path of the remote object (unused).
32197 * @interface_name: (allow-none): Interface name of the remote object or %NULL to get the object proxy #GType.
32198 * @user_data: User data (unused).
32199 *
32200 * A #GDBusProxyTypeFunc that maps @interface_name to the generated #GDBusObjectProxy<!-- -->- and #GDBusProxy<!-- -->-derived types.
32201 *
32202 * Returns: A #GDBusProxy<!-- -->-derived #GType if @interface_name is not %NULL, otherwise the #GType for #ObjectProxy.
32203 */
32204GType
32205object_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)
32206{
32207 static gsize once_init_value = 0;
32208 static GHashTable *lookup_hash;
32209 GType ret;
32210
32211 if (interface_name == NULL)
32212 return TYPE_OBJECT_PROXY;
32213 if (g_once_init_enter (&once_init_value))
32214 {
32215 lookup_hash = g_hash_table_new (g_str_hash, g_str_equal);
Norman James5236a8f2015-11-05 20:39:31 -060032216 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Hwmon", GSIZE_TO_POINTER (TYPE_HWMON_PROXY));
Norman James362a80f2015-09-14 14:04:39 -050032217 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Fan", GSIZE_TO_POINTER (TYPE_FAN_PROXY));
32218 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorValue", GSIZE_TO_POINTER (TYPE_SENSOR_VALUE_PROXY));
Norman James362a80f2015-09-14 14:04:39 -050032219 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorThreshold", GSIZE_TO_POINTER (TYPE_SENSOR_THRESHOLD_PROXY));
32220 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorI2c", GSIZE_TO_POINTER (TYPE_SENSOR_I2C_PROXY));
32221 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorMatch", GSIZE_TO_POINTER (TYPE_SENSOR_MATCH_PROXY));
32222 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Process", GSIZE_TO_POINTER (TYPE_PROCESS_PROXY));
Norman James18998182015-10-11 21:54:53 -050032223 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SharedResource", GSIZE_TO_POINTER (TYPE_SHARED_RESOURCE_PROXY));
Norman James362a80f2015-09-14 14:04:39 -050032224 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Control", GSIZE_TO_POINTER (TYPE_CONTROL_PROXY));
32225 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.control.Bmc", GSIZE_TO_POINTER (TYPE_CONTROL_BMC_PROXY));
32226 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.control.Host", GSIZE_TO_POINTER (TYPE_CONTROL_HOST_PROXY));
32227 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 -050032228 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 -050032229 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Watchdog", GSIZE_TO_POINTER (TYPE_WATCHDOG_PROXY));
32230 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.EventLog", GSIZE_TO_POINTER (TYPE_EVENT_LOG_PROXY));
32231 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Flash", GSIZE_TO_POINTER (TYPE_FLASH_PROXY));
Norman James18998182015-10-11 21:54:53 -050032232 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.FlashControl", GSIZE_TO_POINTER (TYPE_FLASH_CONTROL_PROXY));
Norman James362a80f2015-09-14 14:04:39 -050032233 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Button", GSIZE_TO_POINTER (TYPE_BUTTON_PROXY));
32234 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Led", GSIZE_TO_POINTER (TYPE_LED_PROXY));
Norman Jamesdbcffbd2015-10-06 16:53:06 -050032235 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.HostIpmi", GSIZE_TO_POINTER (TYPE_HOST_IPMI_PROXY));
Norman James362a80f2015-09-14 14:04:39 -050032236 g_once_init_leave (&once_init_value, 1);
32237 }
32238 ret = (GType) GPOINTER_TO_SIZE (g_hash_table_lookup (lookup_hash, interface_name));
32239 if (ret == (GType) 0)
32240 ret = G_TYPE_DBUS_PROXY;
32241 return ret;
32242}
32243
32244/**
32245 * object_manager_client_new:
32246 * @connection: A #GDBusConnection.
32247 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
32248 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
32249 * @object_path: An object path.
32250 * @cancellable: (allow-none): A #GCancellable or %NULL.
32251 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
32252 * @user_data: User data to pass to @callback.
32253 *
32254 * Asynchronously creates #GDBusObjectManagerClient using object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new() for more details.
32255 *
32256 * 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.
32257 * You can then call object_manager_client_new_finish() to get the result of the operation.
32258 *
32259 * See object_manager_client_new_sync() for the synchronous, blocking version of this constructor.
32260 */
32261void
32262object_manager_client_new (
32263 GDBusConnection *connection,
32264 GDBusObjectManagerClientFlags flags,
32265 const gchar *name,
32266 const gchar *object_path,
32267 GCancellable *cancellable,
32268 GAsyncReadyCallback callback,
32269 gpointer user_data)
32270{
32271 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);
32272}
32273
32274/**
32275 * object_manager_client_new_finish:
32276 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_manager_client_new().
32277 * @error: Return location for error or %NULL
32278 *
32279 * Finishes an operation started with object_manager_client_new().
32280 *
32281 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
32282 */
32283GDBusObjectManager *
32284object_manager_client_new_finish (
32285 GAsyncResult *res,
32286 GError **error)
32287{
32288 GObject *ret;
32289 GObject *source_object;
32290 source_object = g_async_result_get_source_object (res);
32291 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
32292 g_object_unref (source_object);
32293 if (ret != NULL)
32294 return G_DBUS_OBJECT_MANAGER (ret);
32295 else
32296 return NULL;
32297}
32298
32299/**
32300 * object_manager_client_new_sync:
32301 * @connection: A #GDBusConnection.
32302 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
32303 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
32304 * @object_path: An object path.
32305 * @cancellable: (allow-none): A #GCancellable or %NULL.
32306 * @error: Return location for error or %NULL
32307 *
32308 * Synchronously creates #GDBusObjectManagerClient using object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new_sync() for more details.
32309 *
32310 * The calling thread is blocked until a reply is received.
32311 *
32312 * See object_manager_client_new() for the asynchronous version of this constructor.
32313 *
32314 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
32315 */
32316GDBusObjectManager *
32317object_manager_client_new_sync (
32318 GDBusConnection *connection,
32319 GDBusObjectManagerClientFlags flags,
32320 const gchar *name,
32321 const gchar *object_path,
32322 GCancellable *cancellable,
32323 GError **error)
32324{
32325 GInitable *ret;
32326 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);
32327 if (ret != NULL)
32328 return G_DBUS_OBJECT_MANAGER (ret);
32329 else
32330 return NULL;
32331}
32332
32333
32334/**
32335 * object_manager_client_new_for_bus:
32336 * @bus_type: A #GBusType.
32337 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
32338 * @name: A bus name (well-known or unique).
32339 * @object_path: An object path.
32340 * @cancellable: (allow-none): A #GCancellable or %NULL.
32341 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
32342 * @user_data: User data to pass to @callback.
32343 *
32344 * Like object_manager_client_new() but takes a #GBusType instead of a #GDBusConnection.
32345 *
32346 * 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.
32347 * You can then call object_manager_client_new_for_bus_finish() to get the result of the operation.
32348 *
32349 * See object_manager_client_new_for_bus_sync() for the synchronous, blocking version of this constructor.
32350 */
32351void
32352object_manager_client_new_for_bus (
32353 GBusType bus_type,
32354 GDBusObjectManagerClientFlags flags,
32355 const gchar *name,
32356 const gchar *object_path,
32357 GCancellable *cancellable,
32358 GAsyncReadyCallback callback,
32359 gpointer user_data)
32360{
32361 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);
32362}
32363
32364/**
32365 * object_manager_client_new_for_bus_finish:
32366 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_manager_client_new_for_bus().
32367 * @error: Return location for error or %NULL
32368 *
32369 * Finishes an operation started with object_manager_client_new_for_bus().
32370 *
32371 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
32372 */
32373GDBusObjectManager *
32374object_manager_client_new_for_bus_finish (
32375 GAsyncResult *res,
32376 GError **error)
32377{
32378 GObject *ret;
32379 GObject *source_object;
32380 source_object = g_async_result_get_source_object (res);
32381 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
32382 g_object_unref (source_object);
32383 if (ret != NULL)
32384 return G_DBUS_OBJECT_MANAGER (ret);
32385 else
32386 return NULL;
32387}
32388
32389/**
32390 * object_manager_client_new_for_bus_sync:
32391 * @bus_type: A #GBusType.
32392 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
32393 * @name: A bus name (well-known or unique).
32394 * @object_path: An object path.
32395 * @cancellable: (allow-none): A #GCancellable or %NULL.
32396 * @error: Return location for error or %NULL
32397 *
32398 * Like object_manager_client_new_sync() but takes a #GBusType instead of a #GDBusConnection.
32399 *
32400 * The calling thread is blocked until a reply is received.
32401 *
32402 * See object_manager_client_new_for_bus() for the asynchronous version of this constructor.
32403 *
32404 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
32405 */
32406GDBusObjectManager *
32407object_manager_client_new_for_bus_sync (
32408 GBusType bus_type,
32409 GDBusObjectManagerClientFlags flags,
32410 const gchar *name,
32411 const gchar *object_path,
32412 GCancellable *cancellable,
32413 GError **error)
32414{
32415 GInitable *ret;
32416 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);
32417 if (ret != NULL)
32418 return G_DBUS_OBJECT_MANAGER (ret);
32419 else
32420 return NULL;
32421}
32422
32423