blob: 1392e22923203603892be058ae6df220d7ed0234 [file] [log] [blame]
Norman James362a80f2015-09-14 14:04:39 -05001/*
Norman James47750bc2015-10-20 09:46:10 -05002 * Generated by gdbus-codegen 2.40.2. DO NOT EDIT.
Norman James362a80f2015-09-14 14:04:39 -05003 *
4 * The license of this code is the same as for the source it was derived from.
5 */
6
7#ifdef HAVE_CONFIG_H
8# include "config.h"
9#endif
10
11#include "interfaces/openbmc_intf.h"
12
13#include <string.h>
14#ifdef G_OS_UNIX
15# include <gio/gunixfdlist.h>
16#endif
17
18typedef struct
19{
20 GDBusArgInfo parent_struct;
21 gboolean use_gvariant;
22} _ExtendedGDBusArgInfo;
23
24typedef struct
25{
26 GDBusMethodInfo parent_struct;
27 const gchar *signal_name;
28 gboolean pass_fdlist;
29} _ExtendedGDBusMethodInfo;
30
31typedef struct
32{
33 GDBusSignalInfo parent_struct;
34 const gchar *signal_name;
35} _ExtendedGDBusSignalInfo;
36
37typedef struct
38{
39 GDBusPropertyInfo parent_struct;
40 const gchar *hyphen_name;
41 gboolean use_gvariant;
42} _ExtendedGDBusPropertyInfo;
43
44typedef struct
45{
46 GDBusInterfaceInfo parent_struct;
47 const gchar *hyphen_name;
48} _ExtendedGDBusInterfaceInfo;
49
50typedef struct
51{
52 const _ExtendedGDBusPropertyInfo *info;
53 guint prop_id;
54 GValue orig_value; /* the value before the change */
55} ChangedProperty;
56
57static void
58_changed_property_free (ChangedProperty *data)
59{
60 g_value_unset (&data->orig_value);
61 g_free (data);
62}
63
64static gboolean
65_g_strv_equal0 (gchar **a, gchar **b)
66{
67 gboolean ret = FALSE;
68 guint n;
69 if (a == NULL && b == NULL)
70 {
71 ret = TRUE;
72 goto out;
73 }
74 if (a == NULL || b == NULL)
75 goto out;
76 if (g_strv_length (a) != g_strv_length (b))
77 goto out;
78 for (n = 0; a[n] != NULL; n++)
79 if (g_strcmp0 (a[n], b[n]) != 0)
80 goto out;
81 ret = TRUE;
82out:
83 return ret;
84}
85
86static gboolean
87_g_variant_equal0 (GVariant *a, GVariant *b)
88{
89 gboolean ret = FALSE;
90 if (a == NULL && b == NULL)
91 {
92 ret = TRUE;
93 goto out;
94 }
95 if (a == NULL || b == NULL)
96 goto out;
97 ret = g_variant_equal (a, b);
98out:
99 return ret;
100}
101
102G_GNUC_UNUSED static gboolean
103_g_value_equal (const GValue *a, const GValue *b)
104{
105 gboolean ret = FALSE;
106 g_assert (G_VALUE_TYPE (a) == G_VALUE_TYPE (b));
107 switch (G_VALUE_TYPE (a))
108 {
109 case G_TYPE_BOOLEAN:
110 ret = (g_value_get_boolean (a) == g_value_get_boolean (b));
111 break;
112 case G_TYPE_UCHAR:
113 ret = (g_value_get_uchar (a) == g_value_get_uchar (b));
114 break;
115 case G_TYPE_INT:
116 ret = (g_value_get_int (a) == g_value_get_int (b));
117 break;
118 case G_TYPE_UINT:
119 ret = (g_value_get_uint (a) == g_value_get_uint (b));
120 break;
121 case G_TYPE_INT64:
122 ret = (g_value_get_int64 (a) == g_value_get_int64 (b));
123 break;
124 case G_TYPE_UINT64:
125 ret = (g_value_get_uint64 (a) == g_value_get_uint64 (b));
126 break;
127 case G_TYPE_DOUBLE:
128 {
129 /* Avoid -Wfloat-equal warnings by doing a direct bit compare */
130 gdouble da = g_value_get_double (a);
131 gdouble db = g_value_get_double (b);
132 ret = memcmp (&da, &db, sizeof (gdouble)) == 0;
133 }
134 break;
135 case G_TYPE_STRING:
136 ret = (g_strcmp0 (g_value_get_string (a), g_value_get_string (b)) == 0);
137 break;
138 case G_TYPE_VARIANT:
139 ret = _g_variant_equal0 (g_value_get_variant (a), g_value_get_variant (b));
140 break;
141 default:
142 if (G_VALUE_TYPE (a) == G_TYPE_STRV)
143 ret = _g_strv_equal0 (g_value_get_boxed (a), g_value_get_boxed (b));
144 else
145 g_critical ("_g_value_equal() does not handle type %s", g_type_name (G_VALUE_TYPE (a)));
146 break;
147 }
148 return ret;
149}
150
151/* ------------------------------------------------------------------------
Norman James493996c2015-10-31 17:27:13 -0500152 * Code for interface org.openbmc.Object.Mapper
153 * ------------------------------------------------------------------------
154 */
155
156/**
157 * SECTION:ObjectMapper
158 * @title: ObjectMapper
159 * @short_description: Generated C code for the org.openbmc.Object.Mapper D-Bus interface
160 *
161 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-Object-Mapper.top_of_page">org.openbmc.Object.Mapper</link> D-Bus interface in C.
162 */
163
164/* ---- Introspection data for org.openbmc.Object.Mapper ---- */
165
166static const _ExtendedGDBusArgInfo _object_mapper_signal_info_object_added_ARG_object_path =
167{
168 {
169 -1,
170 (gchar *) "object_path",
171 (gchar *) "s",
172 NULL
173 },
174 FALSE
175};
176
177static const _ExtendedGDBusArgInfo _object_mapper_signal_info_object_added_ARG_interface_name =
178{
179 {
180 -1,
181 (gchar *) "interface_name",
182 (gchar *) "s",
183 NULL
184 },
185 FALSE
186};
187
188static const _ExtendedGDBusArgInfo * const _object_mapper_signal_info_object_added_ARG_pointers[] =
189{
190 &_object_mapper_signal_info_object_added_ARG_object_path,
191 &_object_mapper_signal_info_object_added_ARG_interface_name,
192 NULL
193};
194
195static const _ExtendedGDBusSignalInfo _object_mapper_signal_info_object_added =
196{
197 {
198 -1,
199 (gchar *) "ObjectAdded",
200 (GDBusArgInfo **) &_object_mapper_signal_info_object_added_ARG_pointers,
201 NULL
202 },
203 "object-added"
204};
205
206static const _ExtendedGDBusSignalInfo * const _object_mapper_signal_info_pointers[] =
207{
208 &_object_mapper_signal_info_object_added,
209 NULL
210};
211
212static const _ExtendedGDBusInterfaceInfo _object_mapper_interface_info =
213{
214 {
215 -1,
216 (gchar *) "org.openbmc.Object.Mapper",
217 NULL,
218 (GDBusSignalInfo **) &_object_mapper_signal_info_pointers,
219 NULL,
220 NULL
221 },
222 "object-mapper",
223};
224
225
226/**
227 * object_mapper_interface_info:
228 *
229 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Object-Mapper.top_of_page">org.openbmc.Object.Mapper</link> D-Bus interface.
230 *
231 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
232 */
233GDBusInterfaceInfo *
234object_mapper_interface_info (void)
235{
236 return (GDBusInterfaceInfo *) &_object_mapper_interface_info.parent_struct;
237}
238
239/**
240 * object_mapper_override_properties:
241 * @klass: The class structure for a #GObject<!-- -->-derived class.
242 * @property_id_begin: The property id to assign to the first overridden property.
243 *
244 * Overrides all #GObject properties in the #ObjectMapper interface for a concrete class.
245 * The properties are overridden in the order they are defined.
246 *
247 * Returns: The last property id.
248 */
249guint
250object_mapper_override_properties (GObjectClass *klass, guint property_id_begin)
251{
252 return property_id_begin - 1;
253}
254
255
256
257/**
258 * ObjectMapper:
259 *
260 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Object-Mapper.top_of_page">org.openbmc.Object.Mapper</link>.
261 */
262
263/**
264 * ObjectMapperIface:
265 * @parent_iface: The parent interface.
266 * @object_added: Handler for the #ObjectMapper::object-added signal.
267 *
268 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Object-Mapper.top_of_page">org.openbmc.Object.Mapper</link>.
269 */
270
271typedef ObjectMapperIface ObjectMapperInterface;
272G_DEFINE_INTERFACE (ObjectMapper, object_mapper, G_TYPE_OBJECT);
273
274static void
275object_mapper_default_init (ObjectMapperIface *iface)
276{
277 /* GObject signals for received D-Bus signals: */
278 /**
279 * ObjectMapper::object-added:
280 * @object: A #ObjectMapper.
281 * @arg_object_path: Argument.
282 * @arg_interface_name: Argument.
283 *
284 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Object-Mapper.ObjectAdded">"ObjectAdded"</link> is received.
285 *
286 * 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.
287 */
288 g_signal_new ("object-added",
289 G_TYPE_FROM_INTERFACE (iface),
290 G_SIGNAL_RUN_LAST,
291 G_STRUCT_OFFSET (ObjectMapperIface, object_added),
292 NULL,
293 NULL,
294 g_cclosure_marshal_generic,
295 G_TYPE_NONE,
296 2, G_TYPE_STRING, G_TYPE_STRING);
297
298}
299
300/**
301 * object_mapper_emit_object_added:
302 * @object: A #ObjectMapper.
303 * @arg_object_path: Argument to pass with the signal.
304 * @arg_interface_name: Argument to pass with the signal.
305 *
306 * Emits the <link linkend="gdbus-signal-org-openbmc-Object-Mapper.ObjectAdded">"ObjectAdded"</link> D-Bus signal.
307 */
308void
309object_mapper_emit_object_added (
310 ObjectMapper *object,
311 const gchar *arg_object_path,
312 const gchar *arg_interface_name)
313{
314 g_signal_emit_by_name (object, "object-added", arg_object_path, arg_interface_name);
315}
316
317/* ------------------------------------------------------------------------ */
318
319/**
320 * ObjectMapperProxy:
321 *
322 * The #ObjectMapperProxy structure contains only private data and should only be accessed using the provided API.
323 */
324
325/**
326 * ObjectMapperProxyClass:
327 * @parent_class: The parent class.
328 *
329 * Class structure for #ObjectMapperProxy.
330 */
331
332struct _ObjectMapperProxyPrivate
333{
334 GData *qdata;
335};
336
337static void object_mapper_proxy_iface_init (ObjectMapperIface *iface);
338
339#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
340G_DEFINE_TYPE_WITH_CODE (ObjectMapperProxy, object_mapper_proxy, G_TYPE_DBUS_PROXY,
341 G_ADD_PRIVATE (ObjectMapperProxy)
342 G_IMPLEMENT_INTERFACE (TYPE_OBJECT_MAPPER, object_mapper_proxy_iface_init));
343
344#else
345G_DEFINE_TYPE_WITH_CODE (ObjectMapperProxy, object_mapper_proxy, G_TYPE_DBUS_PROXY,
346 G_IMPLEMENT_INTERFACE (TYPE_OBJECT_MAPPER, object_mapper_proxy_iface_init));
347
348#endif
349static void
350object_mapper_proxy_finalize (GObject *object)
351{
352 ObjectMapperProxy *proxy = OBJECT_MAPPER_PROXY (object);
353 g_datalist_clear (&proxy->priv->qdata);
354 G_OBJECT_CLASS (object_mapper_proxy_parent_class)->finalize (object);
355}
356
357static void
358object_mapper_proxy_get_property (GObject *object,
359 guint prop_id,
360 GValue *value,
361 GParamSpec *pspec G_GNUC_UNUSED)
362{
363}
364
365static void
366object_mapper_proxy_set_property (GObject *object,
367 guint prop_id,
368 const GValue *value,
369 GParamSpec *pspec G_GNUC_UNUSED)
370{
371}
372
373static void
374object_mapper_proxy_g_signal (GDBusProxy *proxy,
375 const gchar *sender_name G_GNUC_UNUSED,
376 const gchar *signal_name,
377 GVariant *parameters)
378{
379 _ExtendedGDBusSignalInfo *info;
380 GVariantIter iter;
381 GVariant *child;
382 GValue *paramv;
383 guint num_params;
384 guint n;
385 guint signal_id;
386 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_object_mapper_interface_info.parent_struct, signal_name);
387 if (info == NULL)
388 return;
389 num_params = g_variant_n_children (parameters);
390 paramv = g_new0 (GValue, num_params + 1);
391 g_value_init (&paramv[0], TYPE_OBJECT_MAPPER);
392 g_value_set_object (&paramv[0], proxy);
393 g_variant_iter_init (&iter, parameters);
394 n = 1;
395 while ((child = g_variant_iter_next_value (&iter)) != NULL)
396 {
397 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
398 if (arg_info->use_gvariant)
399 {
400 g_value_init (&paramv[n], G_TYPE_VARIANT);
401 g_value_set_variant (&paramv[n], child);
402 n++;
403 }
404 else
405 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
406 g_variant_unref (child);
407 }
408 signal_id = g_signal_lookup (info->signal_name, TYPE_OBJECT_MAPPER);
409 g_signal_emitv (paramv, signal_id, 0, NULL);
410 for (n = 0; n < num_params + 1; n++)
411 g_value_unset (&paramv[n]);
412 g_free (paramv);
413}
414
415static void
416object_mapper_proxy_g_properties_changed (GDBusProxy *_proxy,
417 GVariant *changed_properties,
418 const gchar *const *invalidated_properties)
419{
420 ObjectMapperProxy *proxy = OBJECT_MAPPER_PROXY (_proxy);
421 guint n;
422 const gchar *key;
423 GVariantIter *iter;
424 _ExtendedGDBusPropertyInfo *info;
425 g_variant_get (changed_properties, "a{sv}", &iter);
426 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
427 {
428 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_object_mapper_interface_info.parent_struct, key);
429 g_datalist_remove_data (&proxy->priv->qdata, key);
430 if (info != NULL)
431 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
432 }
433 g_variant_iter_free (iter);
434 for (n = 0; invalidated_properties[n] != NULL; n++)
435 {
436 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_object_mapper_interface_info.parent_struct, invalidated_properties[n]);
437 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
438 if (info != NULL)
439 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
440 }
441}
442
443static void
444object_mapper_proxy_init (ObjectMapperProxy *proxy)
445{
446#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
447 proxy->priv = object_mapper_proxy_get_instance_private (proxy);
448#else
449 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_OBJECT_MAPPER_PROXY, ObjectMapperProxyPrivate);
450#endif
451
452 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), object_mapper_interface_info ());
453}
454
455static void
456object_mapper_proxy_class_init (ObjectMapperProxyClass *klass)
457{
458 GObjectClass *gobject_class;
459 GDBusProxyClass *proxy_class;
460
461 gobject_class = G_OBJECT_CLASS (klass);
462 gobject_class->finalize = object_mapper_proxy_finalize;
463 gobject_class->get_property = object_mapper_proxy_get_property;
464 gobject_class->set_property = object_mapper_proxy_set_property;
465
466 proxy_class = G_DBUS_PROXY_CLASS (klass);
467 proxy_class->g_signal = object_mapper_proxy_g_signal;
468 proxy_class->g_properties_changed = object_mapper_proxy_g_properties_changed;
469
470#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
471 g_type_class_add_private (klass, sizeof (ObjectMapperProxyPrivate));
472#endif
473}
474
475static void
476object_mapper_proxy_iface_init (ObjectMapperIface *iface)
477{
478}
479
480/**
481 * object_mapper_proxy_new:
482 * @connection: A #GDBusConnection.
483 * @flags: Flags from the #GDBusProxyFlags enumeration.
484 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
485 * @object_path: An object path.
486 * @cancellable: (allow-none): A #GCancellable or %NULL.
487 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
488 * @user_data: User data to pass to @callback.
489 *
490 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Object-Mapper.top_of_page">org.openbmc.Object.Mapper</link>. See g_dbus_proxy_new() for more details.
491 *
492 * 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.
493 * You can then call object_mapper_proxy_new_finish() to get the result of the operation.
494 *
495 * See object_mapper_proxy_new_sync() for the synchronous, blocking version of this constructor.
496 */
497void
498object_mapper_proxy_new (
499 GDBusConnection *connection,
500 GDBusProxyFlags flags,
501 const gchar *name,
502 const gchar *object_path,
503 GCancellable *cancellable,
504 GAsyncReadyCallback callback,
505 gpointer user_data)
506{
507 g_async_initable_new_async (TYPE_OBJECT_MAPPER_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.Object.Mapper", NULL);
508}
509
510/**
511 * object_mapper_proxy_new_finish:
512 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_mapper_proxy_new().
513 * @error: Return location for error or %NULL
514 *
515 * Finishes an operation started with object_mapper_proxy_new().
516 *
517 * Returns: (transfer full) (type ObjectMapperProxy): The constructed proxy object or %NULL if @error is set.
518 */
519ObjectMapper *
520object_mapper_proxy_new_finish (
521 GAsyncResult *res,
522 GError **error)
523{
524 GObject *ret;
525 GObject *source_object;
526 source_object = g_async_result_get_source_object (res);
527 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
528 g_object_unref (source_object);
529 if (ret != NULL)
530 return OBJECT_MAPPER (ret);
531 else
532 return NULL;
533}
534
535/**
536 * object_mapper_proxy_new_sync:
537 * @connection: A #GDBusConnection.
538 * @flags: Flags from the #GDBusProxyFlags enumeration.
539 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
540 * @object_path: An object path.
541 * @cancellable: (allow-none): A #GCancellable or %NULL.
542 * @error: Return location for error or %NULL
543 *
544 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Object-Mapper.top_of_page">org.openbmc.Object.Mapper</link>. See g_dbus_proxy_new_sync() for more details.
545 *
546 * The calling thread is blocked until a reply is received.
547 *
548 * See object_mapper_proxy_new() for the asynchronous version of this constructor.
549 *
550 * Returns: (transfer full) (type ObjectMapperProxy): The constructed proxy object or %NULL if @error is set.
551 */
552ObjectMapper *
553object_mapper_proxy_new_sync (
554 GDBusConnection *connection,
555 GDBusProxyFlags flags,
556 const gchar *name,
557 const gchar *object_path,
558 GCancellable *cancellable,
559 GError **error)
560{
561 GInitable *ret;
562 ret = g_initable_new (TYPE_OBJECT_MAPPER_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.Object.Mapper", NULL);
563 if (ret != NULL)
564 return OBJECT_MAPPER (ret);
565 else
566 return NULL;
567}
568
569
570/**
571 * object_mapper_proxy_new_for_bus:
572 * @bus_type: A #GBusType.
573 * @flags: Flags from the #GDBusProxyFlags enumeration.
574 * @name: A bus name (well-known or unique).
575 * @object_path: An object path.
576 * @cancellable: (allow-none): A #GCancellable or %NULL.
577 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
578 * @user_data: User data to pass to @callback.
579 *
580 * Like object_mapper_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
581 *
582 * 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.
583 * You can then call object_mapper_proxy_new_for_bus_finish() to get the result of the operation.
584 *
585 * See object_mapper_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
586 */
587void
588object_mapper_proxy_new_for_bus (
589 GBusType bus_type,
590 GDBusProxyFlags flags,
591 const gchar *name,
592 const gchar *object_path,
593 GCancellable *cancellable,
594 GAsyncReadyCallback callback,
595 gpointer user_data)
596{
597 g_async_initable_new_async (TYPE_OBJECT_MAPPER_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.Object.Mapper", NULL);
598}
599
600/**
601 * object_mapper_proxy_new_for_bus_finish:
602 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_mapper_proxy_new_for_bus().
603 * @error: Return location for error or %NULL
604 *
605 * Finishes an operation started with object_mapper_proxy_new_for_bus().
606 *
607 * Returns: (transfer full) (type ObjectMapperProxy): The constructed proxy object or %NULL if @error is set.
608 */
609ObjectMapper *
610object_mapper_proxy_new_for_bus_finish (
611 GAsyncResult *res,
612 GError **error)
613{
614 GObject *ret;
615 GObject *source_object;
616 source_object = g_async_result_get_source_object (res);
617 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
618 g_object_unref (source_object);
619 if (ret != NULL)
620 return OBJECT_MAPPER (ret);
621 else
622 return NULL;
623}
624
625/**
626 * object_mapper_proxy_new_for_bus_sync:
627 * @bus_type: A #GBusType.
628 * @flags: Flags from the #GDBusProxyFlags enumeration.
629 * @name: A bus name (well-known or unique).
630 * @object_path: An object path.
631 * @cancellable: (allow-none): A #GCancellable or %NULL.
632 * @error: Return location for error or %NULL
633 *
634 * Like object_mapper_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
635 *
636 * The calling thread is blocked until a reply is received.
637 *
638 * See object_mapper_proxy_new_for_bus() for the asynchronous version of this constructor.
639 *
640 * Returns: (transfer full) (type ObjectMapperProxy): The constructed proxy object or %NULL if @error is set.
641 */
642ObjectMapper *
643object_mapper_proxy_new_for_bus_sync (
644 GBusType bus_type,
645 GDBusProxyFlags flags,
646 const gchar *name,
647 const gchar *object_path,
648 GCancellable *cancellable,
649 GError **error)
650{
651 GInitable *ret;
652 ret = g_initable_new (TYPE_OBJECT_MAPPER_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.Object.Mapper", NULL);
653 if (ret != NULL)
654 return OBJECT_MAPPER (ret);
655 else
656 return NULL;
657}
658
659
660/* ------------------------------------------------------------------------ */
661
662/**
663 * ObjectMapperSkeleton:
664 *
665 * The #ObjectMapperSkeleton structure contains only private data and should only be accessed using the provided API.
666 */
667
668/**
669 * ObjectMapperSkeletonClass:
670 * @parent_class: The parent class.
671 *
672 * Class structure for #ObjectMapperSkeleton.
673 */
674
675struct _ObjectMapperSkeletonPrivate
676{
677 GValue *properties;
678 GList *changed_properties;
679 GSource *changed_properties_idle_source;
680 GMainContext *context;
681 GMutex lock;
682};
683
684static void
685_object_mapper_skeleton_handle_method_call (
686 GDBusConnection *connection G_GNUC_UNUSED,
687 const gchar *sender G_GNUC_UNUSED,
688 const gchar *object_path G_GNUC_UNUSED,
689 const gchar *interface_name,
690 const gchar *method_name,
691 GVariant *parameters,
692 GDBusMethodInvocation *invocation,
693 gpointer user_data)
694{
695 ObjectMapperSkeleton *skeleton = OBJECT_MAPPER_SKELETON (user_data);
696 _ExtendedGDBusMethodInfo *info;
697 GVariantIter iter;
698 GVariant *child;
699 GValue *paramv;
700 guint num_params;
701 guint num_extra;
702 guint n;
703 guint signal_id;
704 GValue return_value = G_VALUE_INIT;
705 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
706 g_assert (info != NULL);
707 num_params = g_variant_n_children (parameters);
708 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
709 n = 0;
710 g_value_init (&paramv[n], TYPE_OBJECT_MAPPER);
711 g_value_set_object (&paramv[n++], skeleton);
712 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
713 g_value_set_object (&paramv[n++], invocation);
714 if (info->pass_fdlist)
715 {
716#ifdef G_OS_UNIX
717 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
718 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
719#else
720 g_assert_not_reached ();
721#endif
722 }
723 g_variant_iter_init (&iter, parameters);
724 while ((child = g_variant_iter_next_value (&iter)) != NULL)
725 {
726 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
727 if (arg_info->use_gvariant)
728 {
729 g_value_init (&paramv[n], G_TYPE_VARIANT);
730 g_value_set_variant (&paramv[n], child);
731 n++;
732 }
733 else
734 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
735 g_variant_unref (child);
736 }
737 signal_id = g_signal_lookup (info->signal_name, TYPE_OBJECT_MAPPER);
738 g_value_init (&return_value, G_TYPE_BOOLEAN);
739 g_signal_emitv (paramv, signal_id, 0, &return_value);
740 if (!g_value_get_boolean (&return_value))
741 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);
742 g_value_unset (&return_value);
743 for (n = 0; n < num_params + num_extra; n++)
744 g_value_unset (&paramv[n]);
745 g_free (paramv);
746}
747
748static GVariant *
749_object_mapper_skeleton_handle_get_property (
750 GDBusConnection *connection G_GNUC_UNUSED,
751 const gchar *sender G_GNUC_UNUSED,
752 const gchar *object_path G_GNUC_UNUSED,
753 const gchar *interface_name G_GNUC_UNUSED,
754 const gchar *property_name,
755 GError **error,
756 gpointer user_data)
757{
758 ObjectMapperSkeleton *skeleton = OBJECT_MAPPER_SKELETON (user_data);
759 GValue value = G_VALUE_INIT;
760 GParamSpec *pspec;
761 _ExtendedGDBusPropertyInfo *info;
762 GVariant *ret;
763 ret = NULL;
764 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_object_mapper_interface_info.parent_struct, property_name);
765 g_assert (info != NULL);
766 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
767 if (pspec == NULL)
768 {
769 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
770 }
771 else
772 {
773 g_value_init (&value, pspec->value_type);
774 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
775 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
776 g_value_unset (&value);
777 }
778 return ret;
779}
780
781static gboolean
782_object_mapper_skeleton_handle_set_property (
783 GDBusConnection *connection G_GNUC_UNUSED,
784 const gchar *sender G_GNUC_UNUSED,
785 const gchar *object_path G_GNUC_UNUSED,
786 const gchar *interface_name G_GNUC_UNUSED,
787 const gchar *property_name,
788 GVariant *variant,
789 GError **error,
790 gpointer user_data)
791{
792 ObjectMapperSkeleton *skeleton = OBJECT_MAPPER_SKELETON (user_data);
793 GValue value = G_VALUE_INIT;
794 GParamSpec *pspec;
795 _ExtendedGDBusPropertyInfo *info;
796 gboolean ret;
797 ret = FALSE;
798 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_object_mapper_interface_info.parent_struct, property_name);
799 g_assert (info != NULL);
800 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
801 if (pspec == NULL)
802 {
803 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
804 }
805 else
806 {
807 if (info->use_gvariant)
808 g_value_set_variant (&value, variant);
809 else
810 g_dbus_gvariant_to_gvalue (variant, &value);
811 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
812 g_value_unset (&value);
813 ret = TRUE;
814 }
815 return ret;
816}
817
818static const GDBusInterfaceVTable _object_mapper_skeleton_vtable =
819{
820 _object_mapper_skeleton_handle_method_call,
821 _object_mapper_skeleton_handle_get_property,
822 _object_mapper_skeleton_handle_set_property,
823 {NULL}
824};
825
826static GDBusInterfaceInfo *
827object_mapper_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
828{
829 return object_mapper_interface_info ();
830}
831
832static GDBusInterfaceVTable *
833object_mapper_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
834{
835 return (GDBusInterfaceVTable *) &_object_mapper_skeleton_vtable;
836}
837
838static GVariant *
839object_mapper_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
840{
841 ObjectMapperSkeleton *skeleton = OBJECT_MAPPER_SKELETON (_skeleton);
842
843 GVariantBuilder builder;
844 guint n;
845 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
846 if (_object_mapper_interface_info.parent_struct.properties == NULL)
847 goto out;
848 for (n = 0; _object_mapper_interface_info.parent_struct.properties[n] != NULL; n++)
849 {
850 GDBusPropertyInfo *info = _object_mapper_interface_info.parent_struct.properties[n];
851 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
852 {
853 GVariant *value;
854 value = _object_mapper_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.Object.Mapper", info->name, NULL, skeleton);
855 if (value != NULL)
856 {
857 g_variant_take_ref (value);
858 g_variant_builder_add (&builder, "{sv}", info->name, value);
859 g_variant_unref (value);
860 }
861 }
862 }
863out:
864 return g_variant_builder_end (&builder);
865}
866
867static void
868object_mapper_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
869{
870}
871
872static void
873_object_mapper_on_signal_object_added (
874 ObjectMapper *object,
875 const gchar *arg_object_path,
876 const gchar *arg_interface_name)
877{
878 ObjectMapperSkeleton *skeleton = OBJECT_MAPPER_SKELETON (object);
879
880 GList *connections, *l;
881 GVariant *signal_variant;
882 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
883
884 signal_variant = g_variant_ref_sink (g_variant_new ("(ss)",
885 arg_object_path,
886 arg_interface_name));
887 for (l = connections; l != NULL; l = l->next)
888 {
889 GDBusConnection *connection = l->data;
890 g_dbus_connection_emit_signal (connection,
891 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Object.Mapper", "ObjectAdded",
892 signal_variant, NULL);
893 }
894 g_variant_unref (signal_variant);
895 g_list_free_full (connections, g_object_unref);
896}
897
898static void object_mapper_skeleton_iface_init (ObjectMapperIface *iface);
899#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
900G_DEFINE_TYPE_WITH_CODE (ObjectMapperSkeleton, object_mapper_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
901 G_ADD_PRIVATE (ObjectMapperSkeleton)
902 G_IMPLEMENT_INTERFACE (TYPE_OBJECT_MAPPER, object_mapper_skeleton_iface_init));
903
904#else
905G_DEFINE_TYPE_WITH_CODE (ObjectMapperSkeleton, object_mapper_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
906 G_IMPLEMENT_INTERFACE (TYPE_OBJECT_MAPPER, object_mapper_skeleton_iface_init));
907
908#endif
909static void
910object_mapper_skeleton_finalize (GObject *object)
911{
912 ObjectMapperSkeleton *skeleton = OBJECT_MAPPER_SKELETON (object);
913 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
914 if (skeleton->priv->changed_properties_idle_source != NULL)
915 g_source_destroy (skeleton->priv->changed_properties_idle_source);
916 g_main_context_unref (skeleton->priv->context);
917 g_mutex_clear (&skeleton->priv->lock);
918 G_OBJECT_CLASS (object_mapper_skeleton_parent_class)->finalize (object);
919}
920
921static void
922object_mapper_skeleton_init (ObjectMapperSkeleton *skeleton)
923{
924#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
925 skeleton->priv = object_mapper_skeleton_get_instance_private (skeleton);
926#else
927 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_OBJECT_MAPPER_SKELETON, ObjectMapperSkeletonPrivate);
928#endif
929
930 g_mutex_init (&skeleton->priv->lock);
931 skeleton->priv->context = g_main_context_ref_thread_default ();
932}
933
934static void
935object_mapper_skeleton_class_init (ObjectMapperSkeletonClass *klass)
936{
937 GObjectClass *gobject_class;
938 GDBusInterfaceSkeletonClass *skeleton_class;
939
940 gobject_class = G_OBJECT_CLASS (klass);
941 gobject_class->finalize = object_mapper_skeleton_finalize;
942
943 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
944 skeleton_class->get_info = object_mapper_skeleton_dbus_interface_get_info;
945 skeleton_class->get_properties = object_mapper_skeleton_dbus_interface_get_properties;
946 skeleton_class->flush = object_mapper_skeleton_dbus_interface_flush;
947 skeleton_class->get_vtable = object_mapper_skeleton_dbus_interface_get_vtable;
948
949#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
950 g_type_class_add_private (klass, sizeof (ObjectMapperSkeletonPrivate));
951#endif
952}
953
954static void
955object_mapper_skeleton_iface_init (ObjectMapperIface *iface)
956{
957 iface->object_added = _object_mapper_on_signal_object_added;
958}
959
960/**
961 * object_mapper_skeleton_new:
962 *
963 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Object-Mapper.top_of_page">org.openbmc.Object.Mapper</link>.
964 *
965 * Returns: (transfer full) (type ObjectMapperSkeleton): The skeleton object.
966 */
967ObjectMapper *
968object_mapper_skeleton_new (void)
969{
970 return OBJECT_MAPPER (g_object_new (TYPE_OBJECT_MAPPER_SKELETON, NULL));
971}
972
973/* ------------------------------------------------------------------------
Norman James5236a8f2015-11-05 20:39:31 -0600974 * Code for interface org.openbmc.Hwmon
975 * ------------------------------------------------------------------------
976 */
977
978/**
979 * SECTION:Hwmon
980 * @title: Hwmon
981 * @short_description: Generated C code for the org.openbmc.Hwmon D-Bus interface
982 *
983 * 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.
984 */
985
986/* ---- Introspection data for org.openbmc.Hwmon ---- */
987
988static const _ExtendedGDBusPropertyInfo _hwmon_property_info_poll_interval =
989{
990 {
991 -1,
992 (gchar *) "poll_interval",
993 (gchar *) "i",
994 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
995 NULL
996 },
997 "poll-interval",
998 FALSE
999};
1000
1001static const _ExtendedGDBusPropertyInfo _hwmon_property_info_sysfs_path =
1002{
1003 {
1004 -1,
1005 (gchar *) "sysfs_path",
1006 (gchar *) "s",
1007 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
1008 NULL
1009 },
1010 "sysfs-path",
1011 FALSE
1012};
1013
1014static const _ExtendedGDBusPropertyInfo _hwmon_property_info_value =
1015{
1016 {
1017 -1,
1018 (gchar *) "value",
1019 (gchar *) "v",
1020 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
1021 NULL
1022 },
1023 "value",
1024 FALSE
1025};
1026
1027static const _ExtendedGDBusPropertyInfo * const _hwmon_property_info_pointers[] =
1028{
1029 &_hwmon_property_info_poll_interval,
1030 &_hwmon_property_info_sysfs_path,
1031 &_hwmon_property_info_value,
1032 NULL
1033};
1034
1035static const _ExtendedGDBusInterfaceInfo _hwmon_interface_info =
1036{
1037 {
1038 -1,
1039 (gchar *) "org.openbmc.Hwmon",
1040 NULL,
1041 NULL,
1042 (GDBusPropertyInfo **) &_hwmon_property_info_pointers,
1043 NULL
1044 },
1045 "hwmon",
1046};
1047
1048
1049/**
1050 * hwmon_interface_info:
1051 *
1052 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Hwmon.top_of_page">org.openbmc.Hwmon</link> D-Bus interface.
1053 *
1054 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
1055 */
1056GDBusInterfaceInfo *
1057hwmon_interface_info (void)
1058{
1059 return (GDBusInterfaceInfo *) &_hwmon_interface_info.parent_struct;
1060}
1061
1062/**
1063 * hwmon_override_properties:
1064 * @klass: The class structure for a #GObject<!-- -->-derived class.
1065 * @property_id_begin: The property id to assign to the first overridden property.
1066 *
1067 * Overrides all #GObject properties in the #Hwmon interface for a concrete class.
1068 * The properties are overridden in the order they are defined.
1069 *
1070 * Returns: The last property id.
1071 */
1072guint
1073hwmon_override_properties (GObjectClass *klass, guint property_id_begin)
1074{
1075 g_object_class_override_property (klass, property_id_begin++, "poll-interval");
1076 g_object_class_override_property (klass, property_id_begin++, "sysfs-path");
1077 g_object_class_override_property (klass, property_id_begin++, "value");
1078 return property_id_begin - 1;
1079}
1080
1081
1082
1083/**
1084 * Hwmon:
1085 *
1086 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Hwmon.top_of_page">org.openbmc.Hwmon</link>.
1087 */
1088
1089/**
1090 * HwmonIface:
1091 * @parent_iface: The parent interface.
1092 * @get_poll_interval: Getter for the #Hwmon:poll-interval property.
1093 * @get_sysfs_path: Getter for the #Hwmon:sysfs-path property.
1094 * @get_value: Getter for the #Hwmon:value property.
1095 *
1096 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Hwmon.top_of_page">org.openbmc.Hwmon</link>.
1097 */
1098
1099typedef HwmonIface HwmonInterface;
1100G_DEFINE_INTERFACE (Hwmon, hwmon, G_TYPE_OBJECT);
1101
1102static void
1103hwmon_default_init (HwmonIface *iface)
1104{
1105 /* GObject properties for D-Bus properties: */
1106 /**
1107 * Hwmon:poll-interval:
1108 *
1109 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Hwmon.poll_interval">"poll_interval"</link>.
1110 *
1111 * 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.
1112 */
1113 g_object_interface_install_property (iface,
1114 g_param_spec_int ("poll-interval", "poll_interval", "poll_interval", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
1115 /**
1116 * Hwmon:sysfs-path:
1117 *
1118 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Hwmon.sysfs_path">"sysfs_path"</link>.
1119 *
1120 * 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.
1121 */
1122 g_object_interface_install_property (iface,
1123 g_param_spec_string ("sysfs-path", "sysfs_path", "sysfs_path", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
1124 /**
1125 * Hwmon:value:
1126 *
1127 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Hwmon.value">"value"</link>.
1128 *
1129 * 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.
1130 */
1131 g_object_interface_install_property (iface,
1132 g_param_spec_variant ("value", "value", "value", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
1133}
1134
1135/**
1136 * hwmon_get_poll_interval: (skip)
1137 * @object: A #Hwmon.
1138 *
1139 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Hwmon.poll_interval">"poll_interval"</link> D-Bus property.
1140 *
1141 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
1142 *
1143 * Returns: The property value.
1144 */
1145gint
1146hwmon_get_poll_interval (Hwmon *object)
1147{
1148 return HWMON_GET_IFACE (object)->get_poll_interval (object);
1149}
1150
1151/**
1152 * hwmon_set_poll_interval: (skip)
1153 * @object: A #Hwmon.
1154 * @value: The value to set.
1155 *
1156 * Sets the <link linkend="gdbus-property-org-openbmc-Hwmon.poll_interval">"poll_interval"</link> D-Bus property to @value.
1157 *
1158 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
1159 */
1160void
1161hwmon_set_poll_interval (Hwmon *object, gint value)
1162{
1163 g_object_set (G_OBJECT (object), "poll-interval", value, NULL);
1164}
1165
1166/**
1167 * hwmon_get_sysfs_path: (skip)
1168 * @object: A #Hwmon.
1169 *
1170 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Hwmon.sysfs_path">"sysfs_path"</link> D-Bus property.
1171 *
1172 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
1173 *
1174 * <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>
1175 *
1176 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
1177 */
1178const gchar *
1179hwmon_get_sysfs_path (Hwmon *object)
1180{
1181 return HWMON_GET_IFACE (object)->get_sysfs_path (object);
1182}
1183
1184/**
1185 * hwmon_dup_sysfs_path: (skip)
1186 * @object: A #Hwmon.
1187 *
1188 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Hwmon.sysfs_path">"sysfs_path"</link> D-Bus property.
1189 *
1190 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
1191 *
1192 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
1193 */
1194gchar *
1195hwmon_dup_sysfs_path (Hwmon *object)
1196{
1197 gchar *value;
1198 g_object_get (G_OBJECT (object), "sysfs-path", &value, NULL);
1199 return value;
1200}
1201
1202/**
1203 * hwmon_set_sysfs_path: (skip)
1204 * @object: A #Hwmon.
1205 * @value: The value to set.
1206 *
1207 * Sets the <link linkend="gdbus-property-org-openbmc-Hwmon.sysfs_path">"sysfs_path"</link> D-Bus property to @value.
1208 *
1209 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
1210 */
1211void
1212hwmon_set_sysfs_path (Hwmon *object, const gchar *value)
1213{
1214 g_object_set (G_OBJECT (object), "sysfs-path", value, NULL);
1215}
1216
1217/**
1218 * hwmon_get_value: (skip)
1219 * @object: A #Hwmon.
1220 *
1221 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Hwmon.value">"value"</link> D-Bus property.
1222 *
1223 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
1224 *
1225 * <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_value() if on another thread.</warning>
1226 *
1227 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
1228 */
1229GVariant *
1230hwmon_get_value (Hwmon *object)
1231{
1232 return HWMON_GET_IFACE (object)->get_value (object);
1233}
1234
1235/**
1236 * hwmon_dup_value: (skip)
1237 * @object: A #Hwmon.
1238 *
1239 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Hwmon.value">"value"</link> D-Bus property.
1240 *
1241 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
1242 *
1243 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
1244 */
1245GVariant *
1246hwmon_dup_value (Hwmon *object)
1247{
1248 GVariant *value;
1249 g_object_get (G_OBJECT (object), "value", &value, NULL);
1250 return value;
1251}
1252
1253/**
1254 * hwmon_set_value: (skip)
1255 * @object: A #Hwmon.
1256 * @value: The value to set.
1257 *
1258 * Sets the <link linkend="gdbus-property-org-openbmc-Hwmon.value">"value"</link> D-Bus property to @value.
1259 *
1260 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
1261 */
1262void
1263hwmon_set_value (Hwmon *object, GVariant *value)
1264{
1265 g_object_set (G_OBJECT (object), "value", value, NULL);
1266}
1267
1268/* ------------------------------------------------------------------------ */
1269
1270/**
1271 * HwmonProxy:
1272 *
1273 * The #HwmonProxy structure contains only private data and should only be accessed using the provided API.
1274 */
1275
1276/**
1277 * HwmonProxyClass:
1278 * @parent_class: The parent class.
1279 *
1280 * Class structure for #HwmonProxy.
1281 */
1282
1283struct _HwmonProxyPrivate
1284{
1285 GData *qdata;
1286};
1287
1288static void hwmon_proxy_iface_init (HwmonIface *iface);
1289
1290#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
1291G_DEFINE_TYPE_WITH_CODE (HwmonProxy, hwmon_proxy, G_TYPE_DBUS_PROXY,
1292 G_ADD_PRIVATE (HwmonProxy)
1293 G_IMPLEMENT_INTERFACE (TYPE_HWMON, hwmon_proxy_iface_init));
1294
1295#else
1296G_DEFINE_TYPE_WITH_CODE (HwmonProxy, hwmon_proxy, G_TYPE_DBUS_PROXY,
1297 G_IMPLEMENT_INTERFACE (TYPE_HWMON, hwmon_proxy_iface_init));
1298
1299#endif
1300static void
1301hwmon_proxy_finalize (GObject *object)
1302{
1303 HwmonProxy *proxy = HWMON_PROXY (object);
1304 g_datalist_clear (&proxy->priv->qdata);
1305 G_OBJECT_CLASS (hwmon_proxy_parent_class)->finalize (object);
1306}
1307
1308static void
1309hwmon_proxy_get_property (GObject *object,
1310 guint prop_id,
1311 GValue *value,
1312 GParamSpec *pspec G_GNUC_UNUSED)
1313{
1314 const _ExtendedGDBusPropertyInfo *info;
1315 GVariant *variant;
1316 g_assert (prop_id != 0 && prop_id - 1 < 3);
1317 info = _hwmon_property_info_pointers[prop_id - 1];
1318 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
1319 if (info->use_gvariant)
1320 {
1321 g_value_set_variant (value, variant);
1322 }
1323 else
1324 {
1325 if (variant != NULL)
1326 g_dbus_gvariant_to_gvalue (variant, value);
1327 }
1328 if (variant != NULL)
1329 g_variant_unref (variant);
1330}
1331
1332static void
1333hwmon_proxy_set_property_cb (GDBusProxy *proxy,
1334 GAsyncResult *res,
1335 gpointer user_data)
1336{
1337 const _ExtendedGDBusPropertyInfo *info = user_data;
1338 GError *error;
1339 GVariant *_ret;
1340 error = NULL;
1341 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
1342 if (!_ret)
1343 {
1344 g_warning ("Error setting property '%s' on interface org.openbmc.Hwmon: %s (%s, %d)",
1345 info->parent_struct.name,
1346 error->message, g_quark_to_string (error->domain), error->code);
1347 g_error_free (error);
1348 }
1349 else
1350 {
1351 g_variant_unref (_ret);
1352 }
1353}
1354
1355static void
1356hwmon_proxy_set_property (GObject *object,
1357 guint prop_id,
1358 const GValue *value,
1359 GParamSpec *pspec G_GNUC_UNUSED)
1360{
1361 const _ExtendedGDBusPropertyInfo *info;
1362 GVariant *variant;
1363 g_assert (prop_id != 0 && prop_id - 1 < 3);
1364 info = _hwmon_property_info_pointers[prop_id - 1];
1365 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
1366 g_dbus_proxy_call (G_DBUS_PROXY (object),
1367 "org.freedesktop.DBus.Properties.Set",
1368 g_variant_new ("(ssv)", "org.openbmc.Hwmon", info->parent_struct.name, variant),
1369 G_DBUS_CALL_FLAGS_NONE,
1370 -1,
1371 NULL, (GAsyncReadyCallback) hwmon_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
1372 g_variant_unref (variant);
1373}
1374
1375static void
1376hwmon_proxy_g_signal (GDBusProxy *proxy,
1377 const gchar *sender_name G_GNUC_UNUSED,
1378 const gchar *signal_name,
1379 GVariant *parameters)
1380{
1381 _ExtendedGDBusSignalInfo *info;
1382 GVariantIter iter;
1383 GVariant *child;
1384 GValue *paramv;
1385 guint num_params;
1386 guint n;
1387 guint signal_id;
1388 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_hwmon_interface_info.parent_struct, signal_name);
1389 if (info == NULL)
1390 return;
1391 num_params = g_variant_n_children (parameters);
1392 paramv = g_new0 (GValue, num_params + 1);
1393 g_value_init (&paramv[0], TYPE_HWMON);
1394 g_value_set_object (&paramv[0], proxy);
1395 g_variant_iter_init (&iter, parameters);
1396 n = 1;
1397 while ((child = g_variant_iter_next_value (&iter)) != NULL)
1398 {
1399 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
1400 if (arg_info->use_gvariant)
1401 {
1402 g_value_init (&paramv[n], G_TYPE_VARIANT);
1403 g_value_set_variant (&paramv[n], child);
1404 n++;
1405 }
1406 else
1407 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
1408 g_variant_unref (child);
1409 }
1410 signal_id = g_signal_lookup (info->signal_name, TYPE_HWMON);
1411 g_signal_emitv (paramv, signal_id, 0, NULL);
1412 for (n = 0; n < num_params + 1; n++)
1413 g_value_unset (&paramv[n]);
1414 g_free (paramv);
1415}
1416
1417static void
1418hwmon_proxy_g_properties_changed (GDBusProxy *_proxy,
1419 GVariant *changed_properties,
1420 const gchar *const *invalidated_properties)
1421{
1422 HwmonProxy *proxy = HWMON_PROXY (_proxy);
1423 guint n;
1424 const gchar *key;
1425 GVariantIter *iter;
1426 _ExtendedGDBusPropertyInfo *info;
1427 g_variant_get (changed_properties, "a{sv}", &iter);
1428 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
1429 {
1430 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_hwmon_interface_info.parent_struct, key);
1431 g_datalist_remove_data (&proxy->priv->qdata, key);
1432 if (info != NULL)
1433 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
1434 }
1435 g_variant_iter_free (iter);
1436 for (n = 0; invalidated_properties[n] != NULL; n++)
1437 {
1438 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_hwmon_interface_info.parent_struct, invalidated_properties[n]);
1439 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
1440 if (info != NULL)
1441 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
1442 }
1443}
1444
1445static gint
1446hwmon_proxy_get_poll_interval (Hwmon *object)
1447{
1448 HwmonProxy *proxy = HWMON_PROXY (object);
1449 GVariant *variant;
1450 gint value = 0;
1451 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "poll_interval");
1452 if (variant != NULL)
1453 {
1454 value = g_variant_get_int32 (variant);
1455 g_variant_unref (variant);
1456 }
1457 return value;
1458}
1459
1460static const gchar *
1461hwmon_proxy_get_sysfs_path (Hwmon *object)
1462{
1463 HwmonProxy *proxy = HWMON_PROXY (object);
1464 GVariant *variant;
1465 const gchar *value = NULL;
1466 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "sysfs_path");
1467 if (variant != NULL)
1468 {
1469 value = g_variant_get_string (variant, NULL);
1470 g_variant_unref (variant);
1471 }
1472 return value;
1473}
1474
1475static GVariant *
1476hwmon_proxy_get_value (Hwmon *object)
1477{
1478 HwmonProxy *proxy = HWMON_PROXY (object);
1479 GVariant *variant;
1480 GVariant *value = NULL;
1481 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "value");
1482 value = variant;
1483 if (variant != NULL)
1484 g_variant_unref (variant);
1485 return value;
1486}
1487
1488static void
1489hwmon_proxy_init (HwmonProxy *proxy)
1490{
1491#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
1492 proxy->priv = hwmon_proxy_get_instance_private (proxy);
1493#else
1494 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_HWMON_PROXY, HwmonProxyPrivate);
1495#endif
1496
1497 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), hwmon_interface_info ());
1498}
1499
1500static void
1501hwmon_proxy_class_init (HwmonProxyClass *klass)
1502{
1503 GObjectClass *gobject_class;
1504 GDBusProxyClass *proxy_class;
1505
1506 gobject_class = G_OBJECT_CLASS (klass);
1507 gobject_class->finalize = hwmon_proxy_finalize;
1508 gobject_class->get_property = hwmon_proxy_get_property;
1509 gobject_class->set_property = hwmon_proxy_set_property;
1510
1511 proxy_class = G_DBUS_PROXY_CLASS (klass);
1512 proxy_class->g_signal = hwmon_proxy_g_signal;
1513 proxy_class->g_properties_changed = hwmon_proxy_g_properties_changed;
1514
1515 hwmon_override_properties (gobject_class, 1);
1516
1517#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
1518 g_type_class_add_private (klass, sizeof (HwmonProxyPrivate));
1519#endif
1520}
1521
1522static void
1523hwmon_proxy_iface_init (HwmonIface *iface)
1524{
1525 iface->get_poll_interval = hwmon_proxy_get_poll_interval;
1526 iface->get_sysfs_path = hwmon_proxy_get_sysfs_path;
1527 iface->get_value = hwmon_proxy_get_value;
1528}
1529
1530/**
1531 * hwmon_proxy_new:
1532 * @connection: A #GDBusConnection.
1533 * @flags: Flags from the #GDBusProxyFlags enumeration.
1534 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
1535 * @object_path: An object path.
1536 * @cancellable: (allow-none): A #GCancellable or %NULL.
1537 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
1538 * @user_data: User data to pass to @callback.
1539 *
1540 * 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.
1541 *
1542 * 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.
1543 * You can then call hwmon_proxy_new_finish() to get the result of the operation.
1544 *
1545 * See hwmon_proxy_new_sync() for the synchronous, blocking version of this constructor.
1546 */
1547void
1548hwmon_proxy_new (
1549 GDBusConnection *connection,
1550 GDBusProxyFlags flags,
1551 const gchar *name,
1552 const gchar *object_path,
1553 GCancellable *cancellable,
1554 GAsyncReadyCallback callback,
1555 gpointer user_data)
1556{
1557 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);
1558}
1559
1560/**
1561 * hwmon_proxy_new_finish:
1562 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to hwmon_proxy_new().
1563 * @error: Return location for error or %NULL
1564 *
1565 * Finishes an operation started with hwmon_proxy_new().
1566 *
1567 * Returns: (transfer full) (type HwmonProxy): The constructed proxy object or %NULL if @error is set.
1568 */
1569Hwmon *
1570hwmon_proxy_new_finish (
1571 GAsyncResult *res,
1572 GError **error)
1573{
1574 GObject *ret;
1575 GObject *source_object;
1576 source_object = g_async_result_get_source_object (res);
1577 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
1578 g_object_unref (source_object);
1579 if (ret != NULL)
1580 return HWMON (ret);
1581 else
1582 return NULL;
1583}
1584
1585/**
1586 * hwmon_proxy_new_sync:
1587 * @connection: A #GDBusConnection.
1588 * @flags: Flags from the #GDBusProxyFlags enumeration.
1589 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
1590 * @object_path: An object path.
1591 * @cancellable: (allow-none): A #GCancellable or %NULL.
1592 * @error: Return location for error or %NULL
1593 *
1594 * 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.
1595 *
1596 * The calling thread is blocked until a reply is received.
1597 *
1598 * See hwmon_proxy_new() for the asynchronous version of this constructor.
1599 *
1600 * Returns: (transfer full) (type HwmonProxy): The constructed proxy object or %NULL if @error is set.
1601 */
1602Hwmon *
1603hwmon_proxy_new_sync (
1604 GDBusConnection *connection,
1605 GDBusProxyFlags flags,
1606 const gchar *name,
1607 const gchar *object_path,
1608 GCancellable *cancellable,
1609 GError **error)
1610{
1611 GInitable *ret;
1612 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);
1613 if (ret != NULL)
1614 return HWMON (ret);
1615 else
1616 return NULL;
1617}
1618
1619
1620/**
1621 * hwmon_proxy_new_for_bus:
1622 * @bus_type: A #GBusType.
1623 * @flags: Flags from the #GDBusProxyFlags enumeration.
1624 * @name: A bus name (well-known or unique).
1625 * @object_path: An object path.
1626 * @cancellable: (allow-none): A #GCancellable or %NULL.
1627 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
1628 * @user_data: User data to pass to @callback.
1629 *
1630 * Like hwmon_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
1631 *
1632 * 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.
1633 * You can then call hwmon_proxy_new_for_bus_finish() to get the result of the operation.
1634 *
1635 * See hwmon_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
1636 */
1637void
1638hwmon_proxy_new_for_bus (
1639 GBusType bus_type,
1640 GDBusProxyFlags flags,
1641 const gchar *name,
1642 const gchar *object_path,
1643 GCancellable *cancellable,
1644 GAsyncReadyCallback callback,
1645 gpointer user_data)
1646{
1647 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);
1648}
1649
1650/**
1651 * hwmon_proxy_new_for_bus_finish:
1652 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to hwmon_proxy_new_for_bus().
1653 * @error: Return location for error or %NULL
1654 *
1655 * Finishes an operation started with hwmon_proxy_new_for_bus().
1656 *
1657 * Returns: (transfer full) (type HwmonProxy): The constructed proxy object or %NULL if @error is set.
1658 */
1659Hwmon *
1660hwmon_proxy_new_for_bus_finish (
1661 GAsyncResult *res,
1662 GError **error)
1663{
1664 GObject *ret;
1665 GObject *source_object;
1666 source_object = g_async_result_get_source_object (res);
1667 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
1668 g_object_unref (source_object);
1669 if (ret != NULL)
1670 return HWMON (ret);
1671 else
1672 return NULL;
1673}
1674
1675/**
1676 * hwmon_proxy_new_for_bus_sync:
1677 * @bus_type: A #GBusType.
1678 * @flags: Flags from the #GDBusProxyFlags enumeration.
1679 * @name: A bus name (well-known or unique).
1680 * @object_path: An object path.
1681 * @cancellable: (allow-none): A #GCancellable or %NULL.
1682 * @error: Return location for error or %NULL
1683 *
1684 * Like hwmon_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
1685 *
1686 * The calling thread is blocked until a reply is received.
1687 *
1688 * See hwmon_proxy_new_for_bus() for the asynchronous version of this constructor.
1689 *
1690 * Returns: (transfer full) (type HwmonProxy): The constructed proxy object or %NULL if @error is set.
1691 */
1692Hwmon *
1693hwmon_proxy_new_for_bus_sync (
1694 GBusType bus_type,
1695 GDBusProxyFlags flags,
1696 const gchar *name,
1697 const gchar *object_path,
1698 GCancellable *cancellable,
1699 GError **error)
1700{
1701 GInitable *ret;
1702 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);
1703 if (ret != NULL)
1704 return HWMON (ret);
1705 else
1706 return NULL;
1707}
1708
1709
1710/* ------------------------------------------------------------------------ */
1711
1712/**
1713 * HwmonSkeleton:
1714 *
1715 * The #HwmonSkeleton structure contains only private data and should only be accessed using the provided API.
1716 */
1717
1718/**
1719 * HwmonSkeletonClass:
1720 * @parent_class: The parent class.
1721 *
1722 * Class structure for #HwmonSkeleton.
1723 */
1724
1725struct _HwmonSkeletonPrivate
1726{
1727 GValue *properties;
1728 GList *changed_properties;
1729 GSource *changed_properties_idle_source;
1730 GMainContext *context;
1731 GMutex lock;
1732};
1733
1734static void
1735_hwmon_skeleton_handle_method_call (
1736 GDBusConnection *connection G_GNUC_UNUSED,
1737 const gchar *sender G_GNUC_UNUSED,
1738 const gchar *object_path G_GNUC_UNUSED,
1739 const gchar *interface_name,
1740 const gchar *method_name,
1741 GVariant *parameters,
1742 GDBusMethodInvocation *invocation,
1743 gpointer user_data)
1744{
1745 HwmonSkeleton *skeleton = HWMON_SKELETON (user_data);
1746 _ExtendedGDBusMethodInfo *info;
1747 GVariantIter iter;
1748 GVariant *child;
1749 GValue *paramv;
1750 guint num_params;
1751 guint num_extra;
1752 guint n;
1753 guint signal_id;
1754 GValue return_value = G_VALUE_INIT;
1755 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
1756 g_assert (info != NULL);
1757 num_params = g_variant_n_children (parameters);
1758 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
1759 n = 0;
1760 g_value_init (&paramv[n], TYPE_HWMON);
1761 g_value_set_object (&paramv[n++], skeleton);
1762 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
1763 g_value_set_object (&paramv[n++], invocation);
1764 if (info->pass_fdlist)
1765 {
1766#ifdef G_OS_UNIX
1767 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
1768 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
1769#else
1770 g_assert_not_reached ();
1771#endif
1772 }
1773 g_variant_iter_init (&iter, parameters);
1774 while ((child = g_variant_iter_next_value (&iter)) != NULL)
1775 {
1776 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
1777 if (arg_info->use_gvariant)
1778 {
1779 g_value_init (&paramv[n], G_TYPE_VARIANT);
1780 g_value_set_variant (&paramv[n], child);
1781 n++;
1782 }
1783 else
1784 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
1785 g_variant_unref (child);
1786 }
1787 signal_id = g_signal_lookup (info->signal_name, TYPE_HWMON);
1788 g_value_init (&return_value, G_TYPE_BOOLEAN);
1789 g_signal_emitv (paramv, signal_id, 0, &return_value);
1790 if (!g_value_get_boolean (&return_value))
1791 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);
1792 g_value_unset (&return_value);
1793 for (n = 0; n < num_params + num_extra; n++)
1794 g_value_unset (&paramv[n]);
1795 g_free (paramv);
1796}
1797
1798static GVariant *
1799_hwmon_skeleton_handle_get_property (
1800 GDBusConnection *connection G_GNUC_UNUSED,
1801 const gchar *sender G_GNUC_UNUSED,
1802 const gchar *object_path G_GNUC_UNUSED,
1803 const gchar *interface_name G_GNUC_UNUSED,
1804 const gchar *property_name,
1805 GError **error,
1806 gpointer user_data)
1807{
1808 HwmonSkeleton *skeleton = HWMON_SKELETON (user_data);
1809 GValue value = G_VALUE_INIT;
1810 GParamSpec *pspec;
1811 _ExtendedGDBusPropertyInfo *info;
1812 GVariant *ret;
1813 ret = NULL;
1814 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_hwmon_interface_info.parent_struct, property_name);
1815 g_assert (info != NULL);
1816 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
1817 if (pspec == NULL)
1818 {
1819 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
1820 }
1821 else
1822 {
1823 g_value_init (&value, pspec->value_type);
1824 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
1825 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
1826 g_value_unset (&value);
1827 }
1828 return ret;
1829}
1830
1831static gboolean
1832_hwmon_skeleton_handle_set_property (
1833 GDBusConnection *connection G_GNUC_UNUSED,
1834 const gchar *sender G_GNUC_UNUSED,
1835 const gchar *object_path G_GNUC_UNUSED,
1836 const gchar *interface_name G_GNUC_UNUSED,
1837 const gchar *property_name,
1838 GVariant *variant,
1839 GError **error,
1840 gpointer user_data)
1841{
1842 HwmonSkeleton *skeleton = HWMON_SKELETON (user_data);
1843 GValue value = G_VALUE_INIT;
1844 GParamSpec *pspec;
1845 _ExtendedGDBusPropertyInfo *info;
1846 gboolean ret;
1847 ret = FALSE;
1848 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_hwmon_interface_info.parent_struct, property_name);
1849 g_assert (info != NULL);
1850 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
1851 if (pspec == NULL)
1852 {
1853 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
1854 }
1855 else
1856 {
1857 if (info->use_gvariant)
1858 g_value_set_variant (&value, variant);
1859 else
1860 g_dbus_gvariant_to_gvalue (variant, &value);
1861 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
1862 g_value_unset (&value);
1863 ret = TRUE;
1864 }
1865 return ret;
1866}
1867
1868static const GDBusInterfaceVTable _hwmon_skeleton_vtable =
1869{
1870 _hwmon_skeleton_handle_method_call,
1871 _hwmon_skeleton_handle_get_property,
1872 _hwmon_skeleton_handle_set_property,
1873 {NULL}
1874};
1875
1876static GDBusInterfaceInfo *
1877hwmon_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
1878{
1879 return hwmon_interface_info ();
1880}
1881
1882static GDBusInterfaceVTable *
1883hwmon_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
1884{
1885 return (GDBusInterfaceVTable *) &_hwmon_skeleton_vtable;
1886}
1887
1888static GVariant *
1889hwmon_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
1890{
1891 HwmonSkeleton *skeleton = HWMON_SKELETON (_skeleton);
1892
1893 GVariantBuilder builder;
1894 guint n;
1895 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
1896 if (_hwmon_interface_info.parent_struct.properties == NULL)
1897 goto out;
1898 for (n = 0; _hwmon_interface_info.parent_struct.properties[n] != NULL; n++)
1899 {
1900 GDBusPropertyInfo *info = _hwmon_interface_info.parent_struct.properties[n];
1901 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
1902 {
1903 GVariant *value;
1904 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);
1905 if (value != NULL)
1906 {
1907 g_variant_take_ref (value);
1908 g_variant_builder_add (&builder, "{sv}", info->name, value);
1909 g_variant_unref (value);
1910 }
1911 }
1912 }
1913out:
1914 return g_variant_builder_end (&builder);
1915}
1916
1917static gboolean _hwmon_emit_changed (gpointer user_data);
1918
1919static void
1920hwmon_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
1921{
1922 HwmonSkeleton *skeleton = HWMON_SKELETON (_skeleton);
1923 gboolean emit_changed = FALSE;
1924
1925 g_mutex_lock (&skeleton->priv->lock);
1926 if (skeleton->priv->changed_properties_idle_source != NULL)
1927 {
1928 g_source_destroy (skeleton->priv->changed_properties_idle_source);
1929 skeleton->priv->changed_properties_idle_source = NULL;
1930 emit_changed = TRUE;
1931 }
1932 g_mutex_unlock (&skeleton->priv->lock);
1933
1934 if (emit_changed)
1935 _hwmon_emit_changed (skeleton);
1936}
1937
1938static void hwmon_skeleton_iface_init (HwmonIface *iface);
1939#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
1940G_DEFINE_TYPE_WITH_CODE (HwmonSkeleton, hwmon_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
1941 G_ADD_PRIVATE (HwmonSkeleton)
1942 G_IMPLEMENT_INTERFACE (TYPE_HWMON, hwmon_skeleton_iface_init));
1943
1944#else
1945G_DEFINE_TYPE_WITH_CODE (HwmonSkeleton, hwmon_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
1946 G_IMPLEMENT_INTERFACE (TYPE_HWMON, hwmon_skeleton_iface_init));
1947
1948#endif
1949static void
1950hwmon_skeleton_finalize (GObject *object)
1951{
1952 HwmonSkeleton *skeleton = HWMON_SKELETON (object);
1953 guint n;
1954 for (n = 0; n < 3; n++)
1955 g_value_unset (&skeleton->priv->properties[n]);
1956 g_free (skeleton->priv->properties);
1957 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
1958 if (skeleton->priv->changed_properties_idle_source != NULL)
1959 g_source_destroy (skeleton->priv->changed_properties_idle_source);
1960 g_main_context_unref (skeleton->priv->context);
1961 g_mutex_clear (&skeleton->priv->lock);
1962 G_OBJECT_CLASS (hwmon_skeleton_parent_class)->finalize (object);
1963}
1964
1965static void
1966hwmon_skeleton_get_property (GObject *object,
1967 guint prop_id,
1968 GValue *value,
1969 GParamSpec *pspec G_GNUC_UNUSED)
1970{
1971 HwmonSkeleton *skeleton = HWMON_SKELETON (object);
1972 g_assert (prop_id != 0 && prop_id - 1 < 3);
1973 g_mutex_lock (&skeleton->priv->lock);
1974 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
1975 g_mutex_unlock (&skeleton->priv->lock);
1976}
1977
1978static gboolean
1979_hwmon_emit_changed (gpointer user_data)
1980{
1981 HwmonSkeleton *skeleton = HWMON_SKELETON (user_data);
1982 GList *l;
1983 GVariantBuilder builder;
1984 GVariantBuilder invalidated_builder;
1985 guint num_changes;
1986
1987 g_mutex_lock (&skeleton->priv->lock);
1988 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
1989 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
1990 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
1991 {
1992 ChangedProperty *cp = l->data;
1993 GVariant *variant;
1994 const GValue *cur_value;
1995
1996 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
1997 if (!_g_value_equal (cur_value, &cp->orig_value))
1998 {
1999 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
2000 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
2001 g_variant_unref (variant);
2002 num_changes++;
2003 }
2004 }
2005 if (num_changes > 0)
2006 {
2007 GList *connections, *ll;
2008 GVariant *signal_variant;
2009 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Hwmon",
2010 &builder, &invalidated_builder));
2011 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
2012 for (ll = connections; ll != NULL; ll = ll->next)
2013 {
2014 GDBusConnection *connection = ll->data;
2015
2016 g_dbus_connection_emit_signal (connection,
2017 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
2018 "org.freedesktop.DBus.Properties",
2019 "PropertiesChanged",
2020 signal_variant,
2021 NULL);
2022 }
2023 g_variant_unref (signal_variant);
2024 g_list_free_full (connections, g_object_unref);
2025 }
2026 else
2027 {
2028 g_variant_builder_clear (&builder);
2029 g_variant_builder_clear (&invalidated_builder);
2030 }
2031 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
2032 skeleton->priv->changed_properties = NULL;
2033 skeleton->priv->changed_properties_idle_source = NULL;
2034 g_mutex_unlock (&skeleton->priv->lock);
2035 return FALSE;
2036}
2037
2038static void
2039_hwmon_schedule_emit_changed (HwmonSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
2040{
2041 ChangedProperty *cp;
2042 GList *l;
2043 cp = NULL;
2044 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
2045 {
2046 ChangedProperty *i_cp = l->data;
2047 if (i_cp->info == info)
2048 {
2049 cp = i_cp;
2050 break;
2051 }
2052 }
2053 if (cp == NULL)
2054 {
2055 cp = g_new0 (ChangedProperty, 1);
2056 cp->prop_id = prop_id;
2057 cp->info = info;
2058 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
2059 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
2060 g_value_copy (orig_value, &cp->orig_value);
2061 }
2062}
2063
2064static void
2065hwmon_skeleton_notify (GObject *object,
2066 GParamSpec *pspec G_GNUC_UNUSED)
2067{
2068 HwmonSkeleton *skeleton = HWMON_SKELETON (object);
2069 g_mutex_lock (&skeleton->priv->lock);
2070 if (skeleton->priv->changed_properties != NULL &&
2071 skeleton->priv->changed_properties_idle_source == NULL)
2072 {
2073 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
2074 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
2075 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _hwmon_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
2076 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
2077 g_source_unref (skeleton->priv->changed_properties_idle_source);
2078 }
2079 g_mutex_unlock (&skeleton->priv->lock);
2080}
2081
2082static void
2083hwmon_skeleton_set_property (GObject *object,
2084 guint prop_id,
2085 const GValue *value,
2086 GParamSpec *pspec)
2087{
2088 HwmonSkeleton *skeleton = HWMON_SKELETON (object);
2089 g_assert (prop_id != 0 && prop_id - 1 < 3);
2090 g_mutex_lock (&skeleton->priv->lock);
2091 g_object_freeze_notify (object);
2092 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
2093 {
2094 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
2095 _hwmon_schedule_emit_changed (skeleton, _hwmon_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
2096 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
2097 g_object_notify_by_pspec (object, pspec);
2098 }
2099 g_mutex_unlock (&skeleton->priv->lock);
2100 g_object_thaw_notify (object);
2101}
2102
2103static void
2104hwmon_skeleton_init (HwmonSkeleton *skeleton)
2105{
2106#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
2107 skeleton->priv = hwmon_skeleton_get_instance_private (skeleton);
2108#else
2109 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_HWMON_SKELETON, HwmonSkeletonPrivate);
2110#endif
2111
2112 g_mutex_init (&skeleton->priv->lock);
2113 skeleton->priv->context = g_main_context_ref_thread_default ();
2114 skeleton->priv->properties = g_new0 (GValue, 3);
2115 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
2116 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
2117 g_value_init (&skeleton->priv->properties[2], G_TYPE_VARIANT);
2118}
2119
2120static gint
2121hwmon_skeleton_get_poll_interval (Hwmon *object)
2122{
2123 HwmonSkeleton *skeleton = HWMON_SKELETON (object);
2124 gint value;
2125 g_mutex_lock (&skeleton->priv->lock);
2126 value = g_value_get_int (&(skeleton->priv->properties[0]));
2127 g_mutex_unlock (&skeleton->priv->lock);
2128 return value;
2129}
2130
2131static const gchar *
2132hwmon_skeleton_get_sysfs_path (Hwmon *object)
2133{
2134 HwmonSkeleton *skeleton = HWMON_SKELETON (object);
2135 const gchar *value;
2136 g_mutex_lock (&skeleton->priv->lock);
2137 value = g_value_get_string (&(skeleton->priv->properties[1]));
2138 g_mutex_unlock (&skeleton->priv->lock);
2139 return value;
2140}
2141
2142static GVariant *
2143hwmon_skeleton_get_value (Hwmon *object)
2144{
2145 HwmonSkeleton *skeleton = HWMON_SKELETON (object);
2146 GVariant *value;
2147 g_mutex_lock (&skeleton->priv->lock);
2148 value = g_value_get_variant (&(skeleton->priv->properties[2]));
2149 g_mutex_unlock (&skeleton->priv->lock);
2150 return value;
2151}
2152
2153static void
2154hwmon_skeleton_class_init (HwmonSkeletonClass *klass)
2155{
2156 GObjectClass *gobject_class;
2157 GDBusInterfaceSkeletonClass *skeleton_class;
2158
2159 gobject_class = G_OBJECT_CLASS (klass);
2160 gobject_class->finalize = hwmon_skeleton_finalize;
2161 gobject_class->get_property = hwmon_skeleton_get_property;
2162 gobject_class->set_property = hwmon_skeleton_set_property;
2163 gobject_class->notify = hwmon_skeleton_notify;
2164
2165
2166 hwmon_override_properties (gobject_class, 1);
2167
2168 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
2169 skeleton_class->get_info = hwmon_skeleton_dbus_interface_get_info;
2170 skeleton_class->get_properties = hwmon_skeleton_dbus_interface_get_properties;
2171 skeleton_class->flush = hwmon_skeleton_dbus_interface_flush;
2172 skeleton_class->get_vtable = hwmon_skeleton_dbus_interface_get_vtable;
2173
2174#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
2175 g_type_class_add_private (klass, sizeof (HwmonSkeletonPrivate));
2176#endif
2177}
2178
2179static void
2180hwmon_skeleton_iface_init (HwmonIface *iface)
2181{
2182 iface->get_poll_interval = hwmon_skeleton_get_poll_interval;
2183 iface->get_sysfs_path = hwmon_skeleton_get_sysfs_path;
2184 iface->get_value = hwmon_skeleton_get_value;
2185}
2186
2187/**
2188 * hwmon_skeleton_new:
2189 *
2190 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Hwmon.top_of_page">org.openbmc.Hwmon</link>.
2191 *
2192 * Returns: (transfer full) (type HwmonSkeleton): The skeleton object.
2193 */
2194Hwmon *
2195hwmon_skeleton_new (void)
2196{
2197 return HWMON (g_object_new (TYPE_HWMON_SKELETON, NULL));
2198}
2199
2200/* ------------------------------------------------------------------------
Norman James362a80f2015-09-14 14:04:39 -05002201 * Code for interface org.openbmc.Fan
2202 * ------------------------------------------------------------------------
2203 */
2204
2205/**
2206 * SECTION:Fan
2207 * @title: Fan
2208 * @short_description: Generated C code for the org.openbmc.Fan D-Bus interface
2209 *
2210 * 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.
2211 */
2212
2213/* ---- Introspection data for org.openbmc.Fan ---- */
2214
2215static const _ExtendedGDBusArgInfo _fan_method_info_set_cooling_zone_IN_ARG_cooling_zone =
2216{
2217 {
2218 -1,
2219 (gchar *) "cooling_zone",
2220 (gchar *) "i",
2221 NULL
2222 },
2223 FALSE
2224};
2225
2226static const _ExtendedGDBusArgInfo * const _fan_method_info_set_cooling_zone_IN_ARG_pointers[] =
2227{
2228 &_fan_method_info_set_cooling_zone_IN_ARG_cooling_zone,
2229 NULL
2230};
2231
2232static const _ExtendedGDBusMethodInfo _fan_method_info_set_cooling_zone =
2233{
2234 {
2235 -1,
2236 (gchar *) "setCoolingZone",
2237 (GDBusArgInfo **) &_fan_method_info_set_cooling_zone_IN_ARG_pointers,
2238 NULL,
2239 NULL
2240 },
2241 "handle-set-cooling-zone",
2242 FALSE
2243};
2244
2245static const _ExtendedGDBusArgInfo _fan_method_info_get_speed_OUT_ARG_speed =
2246{
2247 {
2248 -1,
2249 (gchar *) "speed",
2250 (gchar *) "i",
2251 NULL
2252 },
2253 FALSE
2254};
2255
2256static const _ExtendedGDBusArgInfo * const _fan_method_info_get_speed_OUT_ARG_pointers[] =
2257{
2258 &_fan_method_info_get_speed_OUT_ARG_speed,
2259 NULL
2260};
2261
2262static const _ExtendedGDBusMethodInfo _fan_method_info_get_speed =
2263{
2264 {
2265 -1,
2266 (gchar *) "getSpeed",
2267 NULL,
2268 (GDBusArgInfo **) &_fan_method_info_get_speed_OUT_ARG_pointers,
2269 NULL
2270 },
2271 "handle-get-speed",
2272 FALSE
2273};
2274
2275static const _ExtendedGDBusArgInfo _fan_method_info_set_speed_IN_ARG_speed =
2276{
2277 {
2278 -1,
2279 (gchar *) "speed",
2280 (gchar *) "i",
2281 NULL
2282 },
2283 FALSE
2284};
2285
2286static const _ExtendedGDBusArgInfo * const _fan_method_info_set_speed_IN_ARG_pointers[] =
2287{
2288 &_fan_method_info_set_speed_IN_ARG_speed,
2289 NULL
2290};
2291
2292static const _ExtendedGDBusMethodInfo _fan_method_info_set_speed =
2293{
2294 {
2295 -1,
2296 (gchar *) "setSpeed",
2297 (GDBusArgInfo **) &_fan_method_info_set_speed_IN_ARG_pointers,
2298 NULL,
2299 NULL
2300 },
2301 "handle-set-speed",
2302 FALSE
2303};
2304
2305static const _ExtendedGDBusMethodInfo * const _fan_method_info_pointers[] =
2306{
2307 &_fan_method_info_set_cooling_zone,
2308 &_fan_method_info_get_speed,
2309 &_fan_method_info_set_speed,
2310 NULL
2311};
2312
2313static const _ExtendedGDBusArgInfo _fan_signal_info_speed_changed_ARG_speed =
2314{
2315 {
2316 -1,
2317 (gchar *) "speed",
2318 (gchar *) "i",
2319 NULL
2320 },
2321 FALSE
2322};
2323
2324static const _ExtendedGDBusArgInfo * const _fan_signal_info_speed_changed_ARG_pointers[] =
2325{
2326 &_fan_signal_info_speed_changed_ARG_speed,
2327 NULL
2328};
2329
2330static const _ExtendedGDBusSignalInfo _fan_signal_info_speed_changed =
2331{
2332 {
2333 -1,
2334 (gchar *) "SpeedChanged",
2335 (GDBusArgInfo **) &_fan_signal_info_speed_changed_ARG_pointers,
2336 NULL
2337 },
2338 "speed-changed"
2339};
2340
2341static const _ExtendedGDBusSignalInfo _fan_signal_info_tach_error =
2342{
2343 {
2344 -1,
2345 (gchar *) "TachError",
2346 NULL,
2347 NULL
2348 },
2349 "tach-error"
2350};
2351
2352static const _ExtendedGDBusSignalInfo * const _fan_signal_info_pointers[] =
2353{
2354 &_fan_signal_info_speed_changed,
2355 &_fan_signal_info_tach_error,
2356 NULL
2357};
2358
2359static const _ExtendedGDBusPropertyInfo _fan_property_info_speed =
2360{
2361 {
2362 -1,
2363 (gchar *) "speed",
2364 (gchar *) "i",
2365 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
2366 NULL
2367 },
2368 "speed",
2369 FALSE
2370};
2371
2372static const _ExtendedGDBusPropertyInfo _fan_property_info_cooling_zone =
2373{
2374 {
2375 -1,
2376 (gchar *) "cooling_zone",
2377 (gchar *) "i",
2378 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
2379 NULL
2380 },
2381 "cooling-zone",
2382 FALSE
2383};
2384
2385static const _ExtendedGDBusPropertyInfo _fan_property_info_pwm_num =
2386{
2387 {
2388 -1,
2389 (gchar *) "pwm_num",
2390 (gchar *) "i",
2391 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
2392 NULL
2393 },
2394 "pwm-num",
2395 FALSE
2396};
2397
2398static const _ExtendedGDBusPropertyInfo * const _fan_property_info_pointers[] =
2399{
2400 &_fan_property_info_speed,
2401 &_fan_property_info_cooling_zone,
2402 &_fan_property_info_pwm_num,
2403 NULL
2404};
2405
2406static const _ExtendedGDBusInterfaceInfo _fan_interface_info =
2407{
2408 {
2409 -1,
2410 (gchar *) "org.openbmc.Fan",
2411 (GDBusMethodInfo **) &_fan_method_info_pointers,
2412 (GDBusSignalInfo **) &_fan_signal_info_pointers,
2413 (GDBusPropertyInfo **) &_fan_property_info_pointers,
2414 NULL
2415 },
2416 "fan",
2417};
2418
2419
2420/**
2421 * fan_interface_info:
2422 *
2423 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link> D-Bus interface.
2424 *
2425 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
2426 */
2427GDBusInterfaceInfo *
2428fan_interface_info (void)
2429{
2430 return (GDBusInterfaceInfo *) &_fan_interface_info.parent_struct;
2431}
2432
2433/**
2434 * fan_override_properties:
2435 * @klass: The class structure for a #GObject<!-- -->-derived class.
2436 * @property_id_begin: The property id to assign to the first overridden property.
2437 *
2438 * Overrides all #GObject properties in the #Fan interface for a concrete class.
2439 * The properties are overridden in the order they are defined.
2440 *
2441 * Returns: The last property id.
2442 */
2443guint
2444fan_override_properties (GObjectClass *klass, guint property_id_begin)
2445{
2446 g_object_class_override_property (klass, property_id_begin++, "speed");
2447 g_object_class_override_property (klass, property_id_begin++, "cooling-zone");
2448 g_object_class_override_property (klass, property_id_begin++, "pwm-num");
2449 return property_id_begin - 1;
2450}
2451
2452
2453
2454/**
2455 * Fan:
2456 *
2457 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link>.
2458 */
2459
2460/**
2461 * FanIface:
2462 * @parent_iface: The parent interface.
2463 * @handle_get_speed: Handler for the #Fan::handle-get-speed signal.
2464 * @handle_set_cooling_zone: Handler for the #Fan::handle-set-cooling-zone signal.
2465 * @handle_set_speed: Handler for the #Fan::handle-set-speed signal.
2466 * @get_cooling_zone: Getter for the #Fan:cooling-zone property.
2467 * @get_pwm_num: Getter for the #Fan:pwm-num property.
2468 * @get_speed: Getter for the #Fan:speed property.
2469 * @speed_changed: Handler for the #Fan::speed-changed signal.
2470 * @tach_error: Handler for the #Fan::tach-error signal.
2471 *
2472 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link>.
2473 */
2474
2475typedef FanIface FanInterface;
2476G_DEFINE_INTERFACE (Fan, fan, G_TYPE_OBJECT);
2477
2478static void
2479fan_default_init (FanIface *iface)
2480{
2481 /* GObject signals for incoming D-Bus method calls: */
2482 /**
2483 * Fan::handle-set-cooling-zone:
2484 * @object: A #Fan.
2485 * @invocation: A #GDBusMethodInvocation.
2486 * @arg_cooling_zone: Argument passed by remote caller.
2487 *
2488 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Fan.setCoolingZone">setCoolingZone()</link> D-Bus method.
2489 *
2490 * 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.
2491 *
2492 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
2493 */
2494 g_signal_new ("handle-set-cooling-zone",
2495 G_TYPE_FROM_INTERFACE (iface),
2496 G_SIGNAL_RUN_LAST,
2497 G_STRUCT_OFFSET (FanIface, handle_set_cooling_zone),
2498 g_signal_accumulator_true_handled,
2499 NULL,
2500 g_cclosure_marshal_generic,
2501 G_TYPE_BOOLEAN,
2502 2,
2503 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT);
2504
2505 /**
2506 * Fan::handle-get-speed:
2507 * @object: A #Fan.
2508 * @invocation: A #GDBusMethodInvocation.
2509 *
2510 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Fan.getSpeed">getSpeed()</link> D-Bus method.
2511 *
2512 * 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.
2513 *
2514 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
2515 */
2516 g_signal_new ("handle-get-speed",
2517 G_TYPE_FROM_INTERFACE (iface),
2518 G_SIGNAL_RUN_LAST,
2519 G_STRUCT_OFFSET (FanIface, handle_get_speed),
2520 g_signal_accumulator_true_handled,
2521 NULL,
2522 g_cclosure_marshal_generic,
2523 G_TYPE_BOOLEAN,
2524 1,
2525 G_TYPE_DBUS_METHOD_INVOCATION);
2526
2527 /**
2528 * Fan::handle-set-speed:
2529 * @object: A #Fan.
2530 * @invocation: A #GDBusMethodInvocation.
2531 * @arg_speed: Argument passed by remote caller.
2532 *
2533 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Fan.setSpeed">setSpeed()</link> D-Bus method.
2534 *
2535 * 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.
2536 *
2537 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
2538 */
2539 g_signal_new ("handle-set-speed",
2540 G_TYPE_FROM_INTERFACE (iface),
2541 G_SIGNAL_RUN_LAST,
2542 G_STRUCT_OFFSET (FanIface, handle_set_speed),
2543 g_signal_accumulator_true_handled,
2544 NULL,
2545 g_cclosure_marshal_generic,
2546 G_TYPE_BOOLEAN,
2547 2,
2548 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT);
2549
2550 /* GObject signals for received D-Bus signals: */
2551 /**
2552 * Fan::speed-changed:
2553 * @object: A #Fan.
2554 * @arg_speed: Argument.
2555 *
2556 * 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.
2557 *
2558 * 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.
2559 */
2560 g_signal_new ("speed-changed",
2561 G_TYPE_FROM_INTERFACE (iface),
2562 G_SIGNAL_RUN_LAST,
2563 G_STRUCT_OFFSET (FanIface, speed_changed),
2564 NULL,
2565 NULL,
2566 g_cclosure_marshal_generic,
2567 G_TYPE_NONE,
2568 1, G_TYPE_INT);
2569
2570 /**
2571 * Fan::tach-error:
2572 * @object: A #Fan.
2573 *
2574 * 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.
2575 *
2576 * 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.
2577 */
2578 g_signal_new ("tach-error",
2579 G_TYPE_FROM_INTERFACE (iface),
2580 G_SIGNAL_RUN_LAST,
2581 G_STRUCT_OFFSET (FanIface, tach_error),
2582 NULL,
2583 NULL,
2584 g_cclosure_marshal_generic,
2585 G_TYPE_NONE,
2586 0);
2587
2588 /* GObject properties for D-Bus properties: */
2589 /**
2590 * Fan:speed:
2591 *
2592 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fan.speed">"speed"</link>.
2593 *
2594 * 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.
2595 */
2596 g_object_interface_install_property (iface,
2597 g_param_spec_int ("speed", "speed", "speed", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
2598 /**
2599 * Fan:cooling-zone:
2600 *
2601 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fan.cooling_zone">"cooling_zone"</link>.
2602 *
2603 * 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.
2604 */
2605 g_object_interface_install_property (iface,
2606 g_param_spec_int ("cooling-zone", "cooling_zone", "cooling_zone", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
2607 /**
2608 * Fan:pwm-num:
2609 *
2610 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fan.pwm_num">"pwm_num"</link>.
2611 *
2612 * 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.
2613 */
2614 g_object_interface_install_property (iface,
2615 g_param_spec_int ("pwm-num", "pwm_num", "pwm_num", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
2616}
2617
2618/**
2619 * fan_get_speed: (skip)
2620 * @object: A #Fan.
2621 *
2622 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fan.speed">"speed"</link> D-Bus property.
2623 *
2624 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
2625 *
2626 * Returns: The property value.
2627 */
2628gint
2629fan_get_speed (Fan *object)
2630{
2631 return FAN_GET_IFACE (object)->get_speed (object);
2632}
2633
2634/**
2635 * fan_set_speed: (skip)
2636 * @object: A #Fan.
2637 * @value: The value to set.
2638 *
2639 * Sets the <link linkend="gdbus-property-org-openbmc-Fan.speed">"speed"</link> D-Bus property to @value.
2640 *
2641 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
2642 */
2643void
2644fan_set_speed (Fan *object, gint value)
2645{
2646 g_object_set (G_OBJECT (object), "speed", value, NULL);
2647}
2648
2649/**
2650 * fan_get_cooling_zone: (skip)
2651 * @object: A #Fan.
2652 *
2653 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fan.cooling_zone">"cooling_zone"</link> D-Bus property.
2654 *
2655 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
2656 *
2657 * Returns: The property value.
2658 */
2659gint
2660fan_get_cooling_zone (Fan *object)
2661{
2662 return FAN_GET_IFACE (object)->get_cooling_zone (object);
2663}
2664
2665/**
2666 * fan_set_cooling_zone: (skip)
2667 * @object: A #Fan.
2668 * @value: The value to set.
2669 *
2670 * Sets the <link linkend="gdbus-property-org-openbmc-Fan.cooling_zone">"cooling_zone"</link> D-Bus property to @value.
2671 *
2672 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
2673 */
2674void
2675fan_set_cooling_zone (Fan *object, gint value)
2676{
2677 g_object_set (G_OBJECT (object), "cooling-zone", value, NULL);
2678}
2679
2680/**
2681 * fan_get_pwm_num: (skip)
2682 * @object: A #Fan.
2683 *
2684 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fan.pwm_num">"pwm_num"</link> D-Bus property.
2685 *
2686 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
2687 *
2688 * Returns: The property value.
2689 */
2690gint
2691fan_get_pwm_num (Fan *object)
2692{
2693 return FAN_GET_IFACE (object)->get_pwm_num (object);
2694}
2695
2696/**
2697 * fan_set_pwm_num: (skip)
2698 * @object: A #Fan.
2699 * @value: The value to set.
2700 *
2701 * Sets the <link linkend="gdbus-property-org-openbmc-Fan.pwm_num">"pwm_num"</link> D-Bus property to @value.
2702 *
2703 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
2704 */
2705void
2706fan_set_pwm_num (Fan *object, gint value)
2707{
2708 g_object_set (G_OBJECT (object), "pwm-num", value, NULL);
2709}
2710
2711/**
2712 * fan_emit_speed_changed:
2713 * @object: A #Fan.
2714 * @arg_speed: Argument to pass with the signal.
2715 *
2716 * Emits the <link linkend="gdbus-signal-org-openbmc-Fan.SpeedChanged">"SpeedChanged"</link> D-Bus signal.
2717 */
2718void
2719fan_emit_speed_changed (
2720 Fan *object,
2721 gint arg_speed)
2722{
2723 g_signal_emit_by_name (object, "speed-changed", arg_speed);
2724}
2725
2726/**
2727 * fan_emit_tach_error:
2728 * @object: A #Fan.
2729 *
2730 * Emits the <link linkend="gdbus-signal-org-openbmc-Fan.TachError">"TachError"</link> D-Bus signal.
2731 */
2732void
2733fan_emit_tach_error (
2734 Fan *object)
2735{
2736 g_signal_emit_by_name (object, "tach-error");
2737}
2738
2739/**
2740 * fan_call_set_cooling_zone:
2741 * @proxy: A #FanProxy.
2742 * @arg_cooling_zone: Argument to pass with the method invocation.
2743 * @cancellable: (allow-none): A #GCancellable or %NULL.
2744 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
2745 * @user_data: User data to pass to @callback.
2746 *
2747 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Fan.setCoolingZone">setCoolingZone()</link> D-Bus method on @proxy.
2748 * 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.
2749 * You can then call fan_call_set_cooling_zone_finish() to get the result of the operation.
2750 *
2751 * See fan_call_set_cooling_zone_sync() for the synchronous, blocking version of this method.
2752 */
2753void
2754fan_call_set_cooling_zone (
2755 Fan *proxy,
2756 gint arg_cooling_zone,
2757 GCancellable *cancellable,
2758 GAsyncReadyCallback callback,
2759 gpointer user_data)
2760{
2761 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
2762 "setCoolingZone",
2763 g_variant_new ("(i)",
2764 arg_cooling_zone),
2765 G_DBUS_CALL_FLAGS_NONE,
2766 -1,
2767 cancellable,
2768 callback,
2769 user_data);
2770}
2771
2772/**
2773 * fan_call_set_cooling_zone_finish:
2774 * @proxy: A #FanProxy.
2775 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_call_set_cooling_zone().
2776 * @error: Return location for error or %NULL.
2777 *
2778 * Finishes an operation started with fan_call_set_cooling_zone().
2779 *
2780 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
2781 */
2782gboolean
2783fan_call_set_cooling_zone_finish (
2784 Fan *proxy,
2785 GAsyncResult *res,
2786 GError **error)
2787{
2788 GVariant *_ret;
2789 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
2790 if (_ret == NULL)
2791 goto _out;
2792 g_variant_get (_ret,
2793 "()");
2794 g_variant_unref (_ret);
2795_out:
2796 return _ret != NULL;
2797}
2798
2799/**
2800 * fan_call_set_cooling_zone_sync:
2801 * @proxy: A #FanProxy.
2802 * @arg_cooling_zone: Argument to pass with the method invocation.
2803 * @cancellable: (allow-none): A #GCancellable or %NULL.
2804 * @error: Return location for error or %NULL.
2805 *
2806 * 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.
2807 *
2808 * See fan_call_set_cooling_zone() for the asynchronous version of this method.
2809 *
2810 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
2811 */
2812gboolean
2813fan_call_set_cooling_zone_sync (
2814 Fan *proxy,
2815 gint arg_cooling_zone,
2816 GCancellable *cancellable,
2817 GError **error)
2818{
2819 GVariant *_ret;
2820 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
2821 "setCoolingZone",
2822 g_variant_new ("(i)",
2823 arg_cooling_zone),
2824 G_DBUS_CALL_FLAGS_NONE,
2825 -1,
2826 cancellable,
2827 error);
2828 if (_ret == NULL)
2829 goto _out;
2830 g_variant_get (_ret,
2831 "()");
2832 g_variant_unref (_ret);
2833_out:
2834 return _ret != NULL;
2835}
2836
2837/**
2838 * fan_call_get_speed:
2839 * @proxy: A #FanProxy.
2840 * @cancellable: (allow-none): A #GCancellable or %NULL.
2841 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
2842 * @user_data: User data to pass to @callback.
2843 *
2844 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Fan.getSpeed">getSpeed()</link> D-Bus method on @proxy.
2845 * 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.
2846 * You can then call fan_call_get_speed_finish() to get the result of the operation.
2847 *
2848 * See fan_call_get_speed_sync() for the synchronous, blocking version of this method.
2849 */
2850void
2851fan_call_get_speed (
2852 Fan *proxy,
2853 GCancellable *cancellable,
2854 GAsyncReadyCallback callback,
2855 gpointer user_data)
2856{
2857 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
2858 "getSpeed",
2859 g_variant_new ("()"),
2860 G_DBUS_CALL_FLAGS_NONE,
2861 -1,
2862 cancellable,
2863 callback,
2864 user_data);
2865}
2866
2867/**
2868 * fan_call_get_speed_finish:
2869 * @proxy: A #FanProxy.
2870 * @out_speed: (out): Return location for return parameter or %NULL to ignore.
2871 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_call_get_speed().
2872 * @error: Return location for error or %NULL.
2873 *
2874 * Finishes an operation started with fan_call_get_speed().
2875 *
2876 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
2877 */
2878gboolean
2879fan_call_get_speed_finish (
2880 Fan *proxy,
2881 gint *out_speed,
2882 GAsyncResult *res,
2883 GError **error)
2884{
2885 GVariant *_ret;
2886 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
2887 if (_ret == NULL)
2888 goto _out;
2889 g_variant_get (_ret,
2890 "(i)",
2891 out_speed);
2892 g_variant_unref (_ret);
2893_out:
2894 return _ret != NULL;
2895}
2896
2897/**
2898 * fan_call_get_speed_sync:
2899 * @proxy: A #FanProxy.
2900 * @out_speed: (out): Return location for return parameter or %NULL to ignore.
2901 * @cancellable: (allow-none): A #GCancellable or %NULL.
2902 * @error: Return location for error or %NULL.
2903 *
2904 * 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.
2905 *
2906 * See fan_call_get_speed() for the asynchronous version of this method.
2907 *
2908 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
2909 */
2910gboolean
2911fan_call_get_speed_sync (
2912 Fan *proxy,
2913 gint *out_speed,
2914 GCancellable *cancellable,
2915 GError **error)
2916{
2917 GVariant *_ret;
2918 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
2919 "getSpeed",
2920 g_variant_new ("()"),
2921 G_DBUS_CALL_FLAGS_NONE,
2922 -1,
2923 cancellable,
2924 error);
2925 if (_ret == NULL)
2926 goto _out;
2927 g_variant_get (_ret,
2928 "(i)",
2929 out_speed);
2930 g_variant_unref (_ret);
2931_out:
2932 return _ret != NULL;
2933}
2934
2935/**
2936 * fan_call_set_speed:
2937 * @proxy: A #FanProxy.
2938 * @arg_speed: Argument to pass with the method invocation.
2939 * @cancellable: (allow-none): A #GCancellable or %NULL.
2940 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
2941 * @user_data: User data to pass to @callback.
2942 *
2943 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Fan.setSpeed">setSpeed()</link> D-Bus method on @proxy.
2944 * 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.
2945 * You can then call fan_call_set_speed_finish() to get the result of the operation.
2946 *
2947 * See fan_call_set_speed_sync() for the synchronous, blocking version of this method.
2948 */
2949void
2950fan_call_set_speed (
2951 Fan *proxy,
2952 gint arg_speed,
2953 GCancellable *cancellable,
2954 GAsyncReadyCallback callback,
2955 gpointer user_data)
2956{
2957 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
2958 "setSpeed",
2959 g_variant_new ("(i)",
2960 arg_speed),
2961 G_DBUS_CALL_FLAGS_NONE,
2962 -1,
2963 cancellable,
2964 callback,
2965 user_data);
2966}
2967
2968/**
2969 * fan_call_set_speed_finish:
2970 * @proxy: A #FanProxy.
2971 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_call_set_speed().
2972 * @error: Return location for error or %NULL.
2973 *
2974 * Finishes an operation started with fan_call_set_speed().
2975 *
2976 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
2977 */
2978gboolean
2979fan_call_set_speed_finish (
2980 Fan *proxy,
2981 GAsyncResult *res,
2982 GError **error)
2983{
2984 GVariant *_ret;
2985 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
2986 if (_ret == NULL)
2987 goto _out;
2988 g_variant_get (_ret,
2989 "()");
2990 g_variant_unref (_ret);
2991_out:
2992 return _ret != NULL;
2993}
2994
2995/**
2996 * fan_call_set_speed_sync:
2997 * @proxy: A #FanProxy.
2998 * @arg_speed: Argument to pass with the method invocation.
2999 * @cancellable: (allow-none): A #GCancellable or %NULL.
3000 * @error: Return location for error or %NULL.
3001 *
3002 * 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.
3003 *
3004 * See fan_call_set_speed() for the asynchronous version of this method.
3005 *
3006 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
3007 */
3008gboolean
3009fan_call_set_speed_sync (
3010 Fan *proxy,
3011 gint arg_speed,
3012 GCancellable *cancellable,
3013 GError **error)
3014{
3015 GVariant *_ret;
3016 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
3017 "setSpeed",
3018 g_variant_new ("(i)",
3019 arg_speed),
3020 G_DBUS_CALL_FLAGS_NONE,
3021 -1,
3022 cancellable,
3023 error);
3024 if (_ret == NULL)
3025 goto _out;
3026 g_variant_get (_ret,
3027 "()");
3028 g_variant_unref (_ret);
3029_out:
3030 return _ret != NULL;
3031}
3032
3033/**
3034 * fan_complete_set_cooling_zone:
3035 * @object: A #Fan.
3036 * @invocation: (transfer full): A #GDBusMethodInvocation.
3037 *
3038 * 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.
3039 *
3040 * This method will free @invocation, you cannot use it afterwards.
3041 */
3042void
3043fan_complete_set_cooling_zone (
3044 Fan *object,
3045 GDBusMethodInvocation *invocation)
3046{
3047 g_dbus_method_invocation_return_value (invocation,
3048 g_variant_new ("()"));
3049}
3050
3051/**
3052 * fan_complete_get_speed:
3053 * @object: A #Fan.
3054 * @invocation: (transfer full): A #GDBusMethodInvocation.
3055 * @speed: Parameter to return.
3056 *
3057 * 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.
3058 *
3059 * This method will free @invocation, you cannot use it afterwards.
3060 */
3061void
3062fan_complete_get_speed (
3063 Fan *object,
3064 GDBusMethodInvocation *invocation,
3065 gint speed)
3066{
3067 g_dbus_method_invocation_return_value (invocation,
3068 g_variant_new ("(i)",
3069 speed));
3070}
3071
3072/**
3073 * fan_complete_set_speed:
3074 * @object: A #Fan.
3075 * @invocation: (transfer full): A #GDBusMethodInvocation.
3076 *
3077 * 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.
3078 *
3079 * This method will free @invocation, you cannot use it afterwards.
3080 */
3081void
3082fan_complete_set_speed (
3083 Fan *object,
3084 GDBusMethodInvocation *invocation)
3085{
3086 g_dbus_method_invocation_return_value (invocation,
3087 g_variant_new ("()"));
3088}
3089
3090/* ------------------------------------------------------------------------ */
3091
3092/**
3093 * FanProxy:
3094 *
3095 * The #FanProxy structure contains only private data and should only be accessed using the provided API.
3096 */
3097
3098/**
3099 * FanProxyClass:
3100 * @parent_class: The parent class.
3101 *
3102 * Class structure for #FanProxy.
3103 */
3104
3105struct _FanProxyPrivate
3106{
3107 GData *qdata;
3108};
3109
3110static void fan_proxy_iface_init (FanIface *iface);
3111
3112#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
3113G_DEFINE_TYPE_WITH_CODE (FanProxy, fan_proxy, G_TYPE_DBUS_PROXY,
3114 G_ADD_PRIVATE (FanProxy)
3115 G_IMPLEMENT_INTERFACE (TYPE_FAN, fan_proxy_iface_init));
3116
3117#else
3118G_DEFINE_TYPE_WITH_CODE (FanProxy, fan_proxy, G_TYPE_DBUS_PROXY,
3119 G_IMPLEMENT_INTERFACE (TYPE_FAN, fan_proxy_iface_init));
3120
3121#endif
3122static void
3123fan_proxy_finalize (GObject *object)
3124{
3125 FanProxy *proxy = FAN_PROXY (object);
3126 g_datalist_clear (&proxy->priv->qdata);
3127 G_OBJECT_CLASS (fan_proxy_parent_class)->finalize (object);
3128}
3129
3130static void
3131fan_proxy_get_property (GObject *object,
3132 guint prop_id,
3133 GValue *value,
3134 GParamSpec *pspec G_GNUC_UNUSED)
3135{
3136 const _ExtendedGDBusPropertyInfo *info;
3137 GVariant *variant;
3138 g_assert (prop_id != 0 && prop_id - 1 < 3);
3139 info = _fan_property_info_pointers[prop_id - 1];
3140 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
3141 if (info->use_gvariant)
3142 {
3143 g_value_set_variant (value, variant);
3144 }
3145 else
3146 {
3147 if (variant != NULL)
3148 g_dbus_gvariant_to_gvalue (variant, value);
3149 }
3150 if (variant != NULL)
3151 g_variant_unref (variant);
3152}
3153
3154static void
3155fan_proxy_set_property_cb (GDBusProxy *proxy,
3156 GAsyncResult *res,
3157 gpointer user_data)
3158{
3159 const _ExtendedGDBusPropertyInfo *info = user_data;
3160 GError *error;
3161 GVariant *_ret;
3162 error = NULL;
3163 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
3164 if (!_ret)
3165 {
3166 g_warning ("Error setting property '%s' on interface org.openbmc.Fan: %s (%s, %d)",
3167 info->parent_struct.name,
3168 error->message, g_quark_to_string (error->domain), error->code);
3169 g_error_free (error);
3170 }
3171 else
3172 {
3173 g_variant_unref (_ret);
3174 }
3175}
3176
3177static void
3178fan_proxy_set_property (GObject *object,
3179 guint prop_id,
3180 const GValue *value,
3181 GParamSpec *pspec G_GNUC_UNUSED)
3182{
3183 const _ExtendedGDBusPropertyInfo *info;
3184 GVariant *variant;
3185 g_assert (prop_id != 0 && prop_id - 1 < 3);
3186 info = _fan_property_info_pointers[prop_id - 1];
3187 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
3188 g_dbus_proxy_call (G_DBUS_PROXY (object),
3189 "org.freedesktop.DBus.Properties.Set",
3190 g_variant_new ("(ssv)", "org.openbmc.Fan", info->parent_struct.name, variant),
3191 G_DBUS_CALL_FLAGS_NONE,
3192 -1,
3193 NULL, (GAsyncReadyCallback) fan_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
3194 g_variant_unref (variant);
3195}
3196
3197static void
3198fan_proxy_g_signal (GDBusProxy *proxy,
3199 const gchar *sender_name G_GNUC_UNUSED,
3200 const gchar *signal_name,
3201 GVariant *parameters)
3202{
3203 _ExtendedGDBusSignalInfo *info;
3204 GVariantIter iter;
3205 GVariant *child;
3206 GValue *paramv;
3207 guint num_params;
3208 guint n;
3209 guint signal_id;
3210 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, signal_name);
3211 if (info == NULL)
3212 return;
3213 num_params = g_variant_n_children (parameters);
3214 paramv = g_new0 (GValue, num_params + 1);
3215 g_value_init (&paramv[0], TYPE_FAN);
3216 g_value_set_object (&paramv[0], proxy);
3217 g_variant_iter_init (&iter, parameters);
3218 n = 1;
3219 while ((child = g_variant_iter_next_value (&iter)) != NULL)
3220 {
3221 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
3222 if (arg_info->use_gvariant)
3223 {
3224 g_value_init (&paramv[n], G_TYPE_VARIANT);
3225 g_value_set_variant (&paramv[n], child);
3226 n++;
3227 }
3228 else
3229 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
3230 g_variant_unref (child);
3231 }
3232 signal_id = g_signal_lookup (info->signal_name, TYPE_FAN);
3233 g_signal_emitv (paramv, signal_id, 0, NULL);
3234 for (n = 0; n < num_params + 1; n++)
3235 g_value_unset (&paramv[n]);
3236 g_free (paramv);
3237}
3238
3239static void
3240fan_proxy_g_properties_changed (GDBusProxy *_proxy,
3241 GVariant *changed_properties,
3242 const gchar *const *invalidated_properties)
3243{
3244 FanProxy *proxy = FAN_PROXY (_proxy);
3245 guint n;
3246 const gchar *key;
3247 GVariantIter *iter;
3248 _ExtendedGDBusPropertyInfo *info;
3249 g_variant_get (changed_properties, "a{sv}", &iter);
3250 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
3251 {
3252 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, key);
3253 g_datalist_remove_data (&proxy->priv->qdata, key);
3254 if (info != NULL)
3255 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
3256 }
3257 g_variant_iter_free (iter);
3258 for (n = 0; invalidated_properties[n] != NULL; n++)
3259 {
3260 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, invalidated_properties[n]);
3261 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
3262 if (info != NULL)
3263 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
3264 }
3265}
3266
3267static gint
3268fan_proxy_get_speed (Fan *object)
3269{
3270 FanProxy *proxy = FAN_PROXY (object);
3271 GVariant *variant;
3272 gint value = 0;
3273 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "speed");
3274 if (variant != NULL)
3275 {
3276 value = g_variant_get_int32 (variant);
3277 g_variant_unref (variant);
3278 }
3279 return value;
3280}
3281
3282static gint
3283fan_proxy_get_cooling_zone (Fan *object)
3284{
3285 FanProxy *proxy = FAN_PROXY (object);
3286 GVariant *variant;
3287 gint value = 0;
3288 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "cooling_zone");
3289 if (variant != NULL)
3290 {
3291 value = g_variant_get_int32 (variant);
3292 g_variant_unref (variant);
3293 }
3294 return value;
3295}
3296
3297static gint
3298fan_proxy_get_pwm_num (Fan *object)
3299{
3300 FanProxy *proxy = FAN_PROXY (object);
3301 GVariant *variant;
3302 gint value = 0;
3303 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "pwm_num");
3304 if (variant != NULL)
3305 {
3306 value = g_variant_get_int32 (variant);
3307 g_variant_unref (variant);
3308 }
3309 return value;
3310}
3311
3312static void
3313fan_proxy_init (FanProxy *proxy)
3314{
3315#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
3316 proxy->priv = fan_proxy_get_instance_private (proxy);
3317#else
3318 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_FAN_PROXY, FanProxyPrivate);
3319#endif
3320
3321 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), fan_interface_info ());
3322}
3323
3324static void
3325fan_proxy_class_init (FanProxyClass *klass)
3326{
3327 GObjectClass *gobject_class;
3328 GDBusProxyClass *proxy_class;
3329
3330 gobject_class = G_OBJECT_CLASS (klass);
3331 gobject_class->finalize = fan_proxy_finalize;
3332 gobject_class->get_property = fan_proxy_get_property;
3333 gobject_class->set_property = fan_proxy_set_property;
3334
3335 proxy_class = G_DBUS_PROXY_CLASS (klass);
3336 proxy_class->g_signal = fan_proxy_g_signal;
3337 proxy_class->g_properties_changed = fan_proxy_g_properties_changed;
3338
3339 fan_override_properties (gobject_class, 1);
3340
3341#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
3342 g_type_class_add_private (klass, sizeof (FanProxyPrivate));
3343#endif
3344}
3345
3346static void
3347fan_proxy_iface_init (FanIface *iface)
3348{
3349 iface->get_speed = fan_proxy_get_speed;
3350 iface->get_cooling_zone = fan_proxy_get_cooling_zone;
3351 iface->get_pwm_num = fan_proxy_get_pwm_num;
3352}
3353
3354/**
3355 * fan_proxy_new:
3356 * @connection: A #GDBusConnection.
3357 * @flags: Flags from the #GDBusProxyFlags enumeration.
3358 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
3359 * @object_path: An object path.
3360 * @cancellable: (allow-none): A #GCancellable or %NULL.
3361 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
3362 * @user_data: User data to pass to @callback.
3363 *
3364 * 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.
3365 *
3366 * 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.
3367 * You can then call fan_proxy_new_finish() to get the result of the operation.
3368 *
3369 * See fan_proxy_new_sync() for the synchronous, blocking version of this constructor.
3370 */
3371void
3372fan_proxy_new (
3373 GDBusConnection *connection,
3374 GDBusProxyFlags flags,
3375 const gchar *name,
3376 const gchar *object_path,
3377 GCancellable *cancellable,
3378 GAsyncReadyCallback callback,
3379 gpointer user_data)
3380{
3381 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);
3382}
3383
3384/**
3385 * fan_proxy_new_finish:
3386 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_proxy_new().
3387 * @error: Return location for error or %NULL
3388 *
3389 * Finishes an operation started with fan_proxy_new().
3390 *
3391 * Returns: (transfer full) (type FanProxy): The constructed proxy object or %NULL if @error is set.
3392 */
3393Fan *
3394fan_proxy_new_finish (
3395 GAsyncResult *res,
3396 GError **error)
3397{
3398 GObject *ret;
3399 GObject *source_object;
3400 source_object = g_async_result_get_source_object (res);
3401 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
3402 g_object_unref (source_object);
3403 if (ret != NULL)
3404 return FAN (ret);
3405 else
3406 return NULL;
3407}
3408
3409/**
3410 * fan_proxy_new_sync:
3411 * @connection: A #GDBusConnection.
3412 * @flags: Flags from the #GDBusProxyFlags enumeration.
3413 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
3414 * @object_path: An object path.
3415 * @cancellable: (allow-none): A #GCancellable or %NULL.
3416 * @error: Return location for error or %NULL
3417 *
3418 * 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.
3419 *
3420 * The calling thread is blocked until a reply is received.
3421 *
3422 * See fan_proxy_new() for the asynchronous version of this constructor.
3423 *
3424 * Returns: (transfer full) (type FanProxy): The constructed proxy object or %NULL if @error is set.
3425 */
3426Fan *
3427fan_proxy_new_sync (
3428 GDBusConnection *connection,
3429 GDBusProxyFlags flags,
3430 const gchar *name,
3431 const gchar *object_path,
3432 GCancellable *cancellable,
3433 GError **error)
3434{
3435 GInitable *ret;
3436 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);
3437 if (ret != NULL)
3438 return FAN (ret);
3439 else
3440 return NULL;
3441}
3442
3443
3444/**
3445 * fan_proxy_new_for_bus:
3446 * @bus_type: A #GBusType.
3447 * @flags: Flags from the #GDBusProxyFlags enumeration.
3448 * @name: A bus name (well-known or unique).
3449 * @object_path: An object path.
3450 * @cancellable: (allow-none): A #GCancellable or %NULL.
3451 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
3452 * @user_data: User data to pass to @callback.
3453 *
3454 * Like fan_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
3455 *
3456 * 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.
3457 * You can then call fan_proxy_new_for_bus_finish() to get the result of the operation.
3458 *
3459 * See fan_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
3460 */
3461void
3462fan_proxy_new_for_bus (
3463 GBusType bus_type,
3464 GDBusProxyFlags flags,
3465 const gchar *name,
3466 const gchar *object_path,
3467 GCancellable *cancellable,
3468 GAsyncReadyCallback callback,
3469 gpointer user_data)
3470{
3471 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);
3472}
3473
3474/**
3475 * fan_proxy_new_for_bus_finish:
3476 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_proxy_new_for_bus().
3477 * @error: Return location for error or %NULL
3478 *
3479 * Finishes an operation started with fan_proxy_new_for_bus().
3480 *
3481 * Returns: (transfer full) (type FanProxy): The constructed proxy object or %NULL if @error is set.
3482 */
3483Fan *
3484fan_proxy_new_for_bus_finish (
3485 GAsyncResult *res,
3486 GError **error)
3487{
3488 GObject *ret;
3489 GObject *source_object;
3490 source_object = g_async_result_get_source_object (res);
3491 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
3492 g_object_unref (source_object);
3493 if (ret != NULL)
3494 return FAN (ret);
3495 else
3496 return NULL;
3497}
3498
3499/**
3500 * fan_proxy_new_for_bus_sync:
3501 * @bus_type: A #GBusType.
3502 * @flags: Flags from the #GDBusProxyFlags enumeration.
3503 * @name: A bus name (well-known or unique).
3504 * @object_path: An object path.
3505 * @cancellable: (allow-none): A #GCancellable or %NULL.
3506 * @error: Return location for error or %NULL
3507 *
3508 * Like fan_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
3509 *
3510 * The calling thread is blocked until a reply is received.
3511 *
3512 * See fan_proxy_new_for_bus() for the asynchronous version of this constructor.
3513 *
3514 * Returns: (transfer full) (type FanProxy): The constructed proxy object or %NULL if @error is set.
3515 */
3516Fan *
3517fan_proxy_new_for_bus_sync (
3518 GBusType bus_type,
3519 GDBusProxyFlags flags,
3520 const gchar *name,
3521 const gchar *object_path,
3522 GCancellable *cancellable,
3523 GError **error)
3524{
3525 GInitable *ret;
3526 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);
3527 if (ret != NULL)
3528 return FAN (ret);
3529 else
3530 return NULL;
3531}
3532
3533
3534/* ------------------------------------------------------------------------ */
3535
3536/**
3537 * FanSkeleton:
3538 *
3539 * The #FanSkeleton structure contains only private data and should only be accessed using the provided API.
3540 */
3541
3542/**
3543 * FanSkeletonClass:
3544 * @parent_class: The parent class.
3545 *
3546 * Class structure for #FanSkeleton.
3547 */
3548
3549struct _FanSkeletonPrivate
3550{
3551 GValue *properties;
3552 GList *changed_properties;
3553 GSource *changed_properties_idle_source;
3554 GMainContext *context;
3555 GMutex lock;
3556};
3557
3558static void
3559_fan_skeleton_handle_method_call (
3560 GDBusConnection *connection G_GNUC_UNUSED,
3561 const gchar *sender G_GNUC_UNUSED,
3562 const gchar *object_path G_GNUC_UNUSED,
3563 const gchar *interface_name,
3564 const gchar *method_name,
3565 GVariant *parameters,
3566 GDBusMethodInvocation *invocation,
3567 gpointer user_data)
3568{
3569 FanSkeleton *skeleton = FAN_SKELETON (user_data);
3570 _ExtendedGDBusMethodInfo *info;
3571 GVariantIter iter;
3572 GVariant *child;
3573 GValue *paramv;
3574 guint num_params;
3575 guint num_extra;
3576 guint n;
3577 guint signal_id;
3578 GValue return_value = G_VALUE_INIT;
3579 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
3580 g_assert (info != NULL);
3581 num_params = g_variant_n_children (parameters);
3582 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
3583 n = 0;
3584 g_value_init (&paramv[n], TYPE_FAN);
3585 g_value_set_object (&paramv[n++], skeleton);
3586 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
3587 g_value_set_object (&paramv[n++], invocation);
3588 if (info->pass_fdlist)
3589 {
3590#ifdef G_OS_UNIX
3591 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
3592 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
3593#else
3594 g_assert_not_reached ();
3595#endif
3596 }
3597 g_variant_iter_init (&iter, parameters);
3598 while ((child = g_variant_iter_next_value (&iter)) != NULL)
3599 {
3600 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
3601 if (arg_info->use_gvariant)
3602 {
3603 g_value_init (&paramv[n], G_TYPE_VARIANT);
3604 g_value_set_variant (&paramv[n], child);
3605 n++;
3606 }
3607 else
3608 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
3609 g_variant_unref (child);
3610 }
3611 signal_id = g_signal_lookup (info->signal_name, TYPE_FAN);
3612 g_value_init (&return_value, G_TYPE_BOOLEAN);
3613 g_signal_emitv (paramv, signal_id, 0, &return_value);
3614 if (!g_value_get_boolean (&return_value))
3615 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);
3616 g_value_unset (&return_value);
3617 for (n = 0; n < num_params + num_extra; n++)
3618 g_value_unset (&paramv[n]);
3619 g_free (paramv);
3620}
3621
3622static GVariant *
3623_fan_skeleton_handle_get_property (
3624 GDBusConnection *connection G_GNUC_UNUSED,
3625 const gchar *sender G_GNUC_UNUSED,
3626 const gchar *object_path G_GNUC_UNUSED,
3627 const gchar *interface_name G_GNUC_UNUSED,
3628 const gchar *property_name,
3629 GError **error,
3630 gpointer user_data)
3631{
3632 FanSkeleton *skeleton = FAN_SKELETON (user_data);
3633 GValue value = G_VALUE_INIT;
3634 GParamSpec *pspec;
3635 _ExtendedGDBusPropertyInfo *info;
3636 GVariant *ret;
3637 ret = NULL;
3638 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, property_name);
3639 g_assert (info != NULL);
3640 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
3641 if (pspec == NULL)
3642 {
3643 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
3644 }
3645 else
3646 {
3647 g_value_init (&value, pspec->value_type);
3648 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
3649 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
3650 g_value_unset (&value);
3651 }
3652 return ret;
3653}
3654
3655static gboolean
3656_fan_skeleton_handle_set_property (
3657 GDBusConnection *connection G_GNUC_UNUSED,
3658 const gchar *sender G_GNUC_UNUSED,
3659 const gchar *object_path G_GNUC_UNUSED,
3660 const gchar *interface_name G_GNUC_UNUSED,
3661 const gchar *property_name,
3662 GVariant *variant,
3663 GError **error,
3664 gpointer user_data)
3665{
3666 FanSkeleton *skeleton = FAN_SKELETON (user_data);
3667 GValue value = G_VALUE_INIT;
3668 GParamSpec *pspec;
3669 _ExtendedGDBusPropertyInfo *info;
3670 gboolean ret;
3671 ret = FALSE;
3672 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, property_name);
3673 g_assert (info != NULL);
3674 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
3675 if (pspec == NULL)
3676 {
3677 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
3678 }
3679 else
3680 {
3681 if (info->use_gvariant)
3682 g_value_set_variant (&value, variant);
3683 else
3684 g_dbus_gvariant_to_gvalue (variant, &value);
3685 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
3686 g_value_unset (&value);
3687 ret = TRUE;
3688 }
3689 return ret;
3690}
3691
3692static const GDBusInterfaceVTable _fan_skeleton_vtable =
3693{
3694 _fan_skeleton_handle_method_call,
3695 _fan_skeleton_handle_get_property,
3696 _fan_skeleton_handle_set_property,
3697 {NULL}
3698};
3699
3700static GDBusInterfaceInfo *
3701fan_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
3702{
3703 return fan_interface_info ();
3704}
3705
3706static GDBusInterfaceVTable *
3707fan_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
3708{
3709 return (GDBusInterfaceVTable *) &_fan_skeleton_vtable;
3710}
3711
3712static GVariant *
3713fan_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
3714{
3715 FanSkeleton *skeleton = FAN_SKELETON (_skeleton);
3716
3717 GVariantBuilder builder;
3718 guint n;
3719 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
3720 if (_fan_interface_info.parent_struct.properties == NULL)
3721 goto out;
3722 for (n = 0; _fan_interface_info.parent_struct.properties[n] != NULL; n++)
3723 {
3724 GDBusPropertyInfo *info = _fan_interface_info.parent_struct.properties[n];
3725 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
3726 {
3727 GVariant *value;
3728 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);
3729 if (value != NULL)
3730 {
3731 g_variant_take_ref (value);
3732 g_variant_builder_add (&builder, "{sv}", info->name, value);
3733 g_variant_unref (value);
3734 }
3735 }
3736 }
3737out:
3738 return g_variant_builder_end (&builder);
3739}
3740
3741static gboolean _fan_emit_changed (gpointer user_data);
3742
3743static void
3744fan_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
3745{
3746 FanSkeleton *skeleton = FAN_SKELETON (_skeleton);
3747 gboolean emit_changed = FALSE;
3748
3749 g_mutex_lock (&skeleton->priv->lock);
3750 if (skeleton->priv->changed_properties_idle_source != NULL)
3751 {
3752 g_source_destroy (skeleton->priv->changed_properties_idle_source);
3753 skeleton->priv->changed_properties_idle_source = NULL;
3754 emit_changed = TRUE;
3755 }
3756 g_mutex_unlock (&skeleton->priv->lock);
3757
3758 if (emit_changed)
3759 _fan_emit_changed (skeleton);
3760}
3761
3762static void
3763_fan_on_signal_speed_changed (
3764 Fan *object,
3765 gint arg_speed)
3766{
3767 FanSkeleton *skeleton = FAN_SKELETON (object);
3768
3769 GList *connections, *l;
3770 GVariant *signal_variant;
3771 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
3772
3773 signal_variant = g_variant_ref_sink (g_variant_new ("(i)",
3774 arg_speed));
3775 for (l = connections; l != NULL; l = l->next)
3776 {
3777 GDBusConnection *connection = l->data;
3778 g_dbus_connection_emit_signal (connection,
3779 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Fan", "SpeedChanged",
3780 signal_variant, NULL);
3781 }
3782 g_variant_unref (signal_variant);
3783 g_list_free_full (connections, g_object_unref);
3784}
3785
3786static void
3787_fan_on_signal_tach_error (
3788 Fan *object)
3789{
3790 FanSkeleton *skeleton = FAN_SKELETON (object);
3791
3792 GList *connections, *l;
3793 GVariant *signal_variant;
3794 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
3795
3796 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
3797 for (l = connections; l != NULL; l = l->next)
3798 {
3799 GDBusConnection *connection = l->data;
3800 g_dbus_connection_emit_signal (connection,
3801 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Fan", "TachError",
3802 signal_variant, NULL);
3803 }
3804 g_variant_unref (signal_variant);
3805 g_list_free_full (connections, g_object_unref);
3806}
3807
3808static void fan_skeleton_iface_init (FanIface *iface);
3809#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
3810G_DEFINE_TYPE_WITH_CODE (FanSkeleton, fan_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
3811 G_ADD_PRIVATE (FanSkeleton)
3812 G_IMPLEMENT_INTERFACE (TYPE_FAN, fan_skeleton_iface_init));
3813
3814#else
3815G_DEFINE_TYPE_WITH_CODE (FanSkeleton, fan_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
3816 G_IMPLEMENT_INTERFACE (TYPE_FAN, fan_skeleton_iface_init));
3817
3818#endif
3819static void
3820fan_skeleton_finalize (GObject *object)
3821{
3822 FanSkeleton *skeleton = FAN_SKELETON (object);
3823 guint n;
3824 for (n = 0; n < 3; n++)
3825 g_value_unset (&skeleton->priv->properties[n]);
3826 g_free (skeleton->priv->properties);
3827 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
3828 if (skeleton->priv->changed_properties_idle_source != NULL)
3829 g_source_destroy (skeleton->priv->changed_properties_idle_source);
3830 g_main_context_unref (skeleton->priv->context);
3831 g_mutex_clear (&skeleton->priv->lock);
3832 G_OBJECT_CLASS (fan_skeleton_parent_class)->finalize (object);
3833}
3834
3835static void
3836fan_skeleton_get_property (GObject *object,
3837 guint prop_id,
3838 GValue *value,
3839 GParamSpec *pspec G_GNUC_UNUSED)
3840{
3841 FanSkeleton *skeleton = FAN_SKELETON (object);
3842 g_assert (prop_id != 0 && prop_id - 1 < 3);
3843 g_mutex_lock (&skeleton->priv->lock);
3844 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
3845 g_mutex_unlock (&skeleton->priv->lock);
3846}
3847
3848static gboolean
3849_fan_emit_changed (gpointer user_data)
3850{
3851 FanSkeleton *skeleton = FAN_SKELETON (user_data);
3852 GList *l;
3853 GVariantBuilder builder;
3854 GVariantBuilder invalidated_builder;
3855 guint num_changes;
3856
3857 g_mutex_lock (&skeleton->priv->lock);
3858 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
3859 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
3860 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
3861 {
3862 ChangedProperty *cp = l->data;
3863 GVariant *variant;
3864 const GValue *cur_value;
3865
3866 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
3867 if (!_g_value_equal (cur_value, &cp->orig_value))
3868 {
3869 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
3870 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
3871 g_variant_unref (variant);
3872 num_changes++;
3873 }
3874 }
3875 if (num_changes > 0)
3876 {
3877 GList *connections, *ll;
3878 GVariant *signal_variant;
3879 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Fan",
3880 &builder, &invalidated_builder));
3881 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
3882 for (ll = connections; ll != NULL; ll = ll->next)
3883 {
3884 GDBusConnection *connection = ll->data;
3885
3886 g_dbus_connection_emit_signal (connection,
3887 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
3888 "org.freedesktop.DBus.Properties",
3889 "PropertiesChanged",
3890 signal_variant,
3891 NULL);
3892 }
3893 g_variant_unref (signal_variant);
3894 g_list_free_full (connections, g_object_unref);
3895 }
3896 else
3897 {
3898 g_variant_builder_clear (&builder);
3899 g_variant_builder_clear (&invalidated_builder);
3900 }
3901 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
3902 skeleton->priv->changed_properties = NULL;
3903 skeleton->priv->changed_properties_idle_source = NULL;
3904 g_mutex_unlock (&skeleton->priv->lock);
3905 return FALSE;
3906}
3907
3908static void
3909_fan_schedule_emit_changed (FanSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
3910{
3911 ChangedProperty *cp;
3912 GList *l;
3913 cp = NULL;
3914 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
3915 {
3916 ChangedProperty *i_cp = l->data;
3917 if (i_cp->info == info)
3918 {
3919 cp = i_cp;
3920 break;
3921 }
3922 }
3923 if (cp == NULL)
3924 {
3925 cp = g_new0 (ChangedProperty, 1);
3926 cp->prop_id = prop_id;
3927 cp->info = info;
3928 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
3929 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
3930 g_value_copy (orig_value, &cp->orig_value);
3931 }
3932}
3933
3934static void
3935fan_skeleton_notify (GObject *object,
3936 GParamSpec *pspec G_GNUC_UNUSED)
3937{
3938 FanSkeleton *skeleton = FAN_SKELETON (object);
3939 g_mutex_lock (&skeleton->priv->lock);
3940 if (skeleton->priv->changed_properties != NULL &&
3941 skeleton->priv->changed_properties_idle_source == NULL)
3942 {
3943 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
3944 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
3945 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _fan_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
3946 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
3947 g_source_unref (skeleton->priv->changed_properties_idle_source);
3948 }
3949 g_mutex_unlock (&skeleton->priv->lock);
3950}
3951
3952static void
3953fan_skeleton_set_property (GObject *object,
3954 guint prop_id,
3955 const GValue *value,
3956 GParamSpec *pspec)
3957{
3958 FanSkeleton *skeleton = FAN_SKELETON (object);
3959 g_assert (prop_id != 0 && prop_id - 1 < 3);
3960 g_mutex_lock (&skeleton->priv->lock);
3961 g_object_freeze_notify (object);
3962 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
3963 {
3964 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
3965 _fan_schedule_emit_changed (skeleton, _fan_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
3966 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
3967 g_object_notify_by_pspec (object, pspec);
3968 }
3969 g_mutex_unlock (&skeleton->priv->lock);
3970 g_object_thaw_notify (object);
3971}
3972
3973static void
3974fan_skeleton_init (FanSkeleton *skeleton)
3975{
3976#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
3977 skeleton->priv = fan_skeleton_get_instance_private (skeleton);
3978#else
3979 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_FAN_SKELETON, FanSkeletonPrivate);
3980#endif
3981
3982 g_mutex_init (&skeleton->priv->lock);
3983 skeleton->priv->context = g_main_context_ref_thread_default ();
3984 skeleton->priv->properties = g_new0 (GValue, 3);
3985 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
3986 g_value_init (&skeleton->priv->properties[1], G_TYPE_INT);
3987 g_value_init (&skeleton->priv->properties[2], G_TYPE_INT);
3988}
3989
3990static gint
3991fan_skeleton_get_speed (Fan *object)
3992{
3993 FanSkeleton *skeleton = FAN_SKELETON (object);
3994 gint value;
3995 g_mutex_lock (&skeleton->priv->lock);
3996 value = g_value_get_int (&(skeleton->priv->properties[0]));
3997 g_mutex_unlock (&skeleton->priv->lock);
3998 return value;
3999}
4000
4001static gint
4002fan_skeleton_get_cooling_zone (Fan *object)
4003{
4004 FanSkeleton *skeleton = FAN_SKELETON (object);
4005 gint value;
4006 g_mutex_lock (&skeleton->priv->lock);
4007 value = g_value_get_int (&(skeleton->priv->properties[1]));
4008 g_mutex_unlock (&skeleton->priv->lock);
4009 return value;
4010}
4011
4012static gint
4013fan_skeleton_get_pwm_num (Fan *object)
4014{
4015 FanSkeleton *skeleton = FAN_SKELETON (object);
4016 gint value;
4017 g_mutex_lock (&skeleton->priv->lock);
4018 value = g_value_get_int (&(skeleton->priv->properties[2]));
4019 g_mutex_unlock (&skeleton->priv->lock);
4020 return value;
4021}
4022
4023static void
4024fan_skeleton_class_init (FanSkeletonClass *klass)
4025{
4026 GObjectClass *gobject_class;
4027 GDBusInterfaceSkeletonClass *skeleton_class;
4028
4029 gobject_class = G_OBJECT_CLASS (klass);
4030 gobject_class->finalize = fan_skeleton_finalize;
4031 gobject_class->get_property = fan_skeleton_get_property;
4032 gobject_class->set_property = fan_skeleton_set_property;
4033 gobject_class->notify = fan_skeleton_notify;
4034
4035
4036 fan_override_properties (gobject_class, 1);
4037
4038 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
4039 skeleton_class->get_info = fan_skeleton_dbus_interface_get_info;
4040 skeleton_class->get_properties = fan_skeleton_dbus_interface_get_properties;
4041 skeleton_class->flush = fan_skeleton_dbus_interface_flush;
4042 skeleton_class->get_vtable = fan_skeleton_dbus_interface_get_vtable;
4043
4044#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
4045 g_type_class_add_private (klass, sizeof (FanSkeletonPrivate));
4046#endif
4047}
4048
4049static void
4050fan_skeleton_iface_init (FanIface *iface)
4051{
4052 iface->speed_changed = _fan_on_signal_speed_changed;
4053 iface->tach_error = _fan_on_signal_tach_error;
4054 iface->get_speed = fan_skeleton_get_speed;
4055 iface->get_cooling_zone = fan_skeleton_get_cooling_zone;
4056 iface->get_pwm_num = fan_skeleton_get_pwm_num;
4057}
4058
4059/**
4060 * fan_skeleton_new:
4061 *
4062 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link>.
4063 *
4064 * Returns: (transfer full) (type FanSkeleton): The skeleton object.
4065 */
4066Fan *
4067fan_skeleton_new (void)
4068{
4069 return FAN (g_object_new (TYPE_FAN_SKELETON, NULL));
4070}
4071
4072/* ------------------------------------------------------------------------
4073 * Code for interface org.openbmc.SensorValue
4074 * ------------------------------------------------------------------------
4075 */
4076
4077/**
4078 * SECTION:SensorValue
4079 * @title: SensorValue
4080 * @short_description: Generated C code for the org.openbmc.SensorValue D-Bus interface
4081 *
4082 * 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.
4083 */
4084
4085/* ---- Introspection data for org.openbmc.SensorValue ---- */
4086
4087static const _ExtendedGDBusMethodInfo _sensor_value_method_info_init =
4088{
4089 {
4090 -1,
4091 (gchar *) "init",
4092 NULL,
4093 NULL,
4094 NULL
4095 },
4096 "handle-init",
4097 FALSE
4098};
4099
4100static const _ExtendedGDBusArgInfo _sensor_value_method_info_get_value_OUT_ARG_value =
4101{
4102 {
4103 -1,
4104 (gchar *) "value",
4105 (gchar *) "v",
4106 NULL
4107 },
4108 FALSE
4109};
4110
4111static const _ExtendedGDBusArgInfo * const _sensor_value_method_info_get_value_OUT_ARG_pointers[] =
4112{
4113 &_sensor_value_method_info_get_value_OUT_ARG_value,
4114 NULL
4115};
4116
4117static const _ExtendedGDBusMethodInfo _sensor_value_method_info_get_value =
4118{
4119 {
4120 -1,
4121 (gchar *) "getValue",
4122 NULL,
4123 (GDBusArgInfo **) &_sensor_value_method_info_get_value_OUT_ARG_pointers,
4124 NULL
4125 },
4126 "handle-get-value",
4127 FALSE
4128};
4129
Norman James19e45912015-10-04 20:19:41 -05004130static const _ExtendedGDBusArgInfo _sensor_value_method_info_set_value_IN_ARG_value =
4131{
4132 {
4133 -1,
4134 (gchar *) "value",
4135 (gchar *) "v",
4136 NULL
4137 },
4138 FALSE
4139};
4140
4141static const _ExtendedGDBusArgInfo * const _sensor_value_method_info_set_value_IN_ARG_pointers[] =
4142{
4143 &_sensor_value_method_info_set_value_IN_ARG_value,
4144 NULL
4145};
4146
4147static const _ExtendedGDBusMethodInfo _sensor_value_method_info_set_value =
4148{
4149 {
4150 -1,
4151 (gchar *) "setValue",
4152 (GDBusArgInfo **) &_sensor_value_method_info_set_value_IN_ARG_pointers,
4153 NULL,
4154 NULL
4155 },
4156 "handle-set-value",
4157 FALSE
4158};
4159
Norman James362a80f2015-09-14 14:04:39 -05004160static const _ExtendedGDBusMethodInfo * const _sensor_value_method_info_pointers[] =
4161{
4162 &_sensor_value_method_info_init,
4163 &_sensor_value_method_info_get_value,
Norman James19e45912015-10-04 20:19:41 -05004164 &_sensor_value_method_info_set_value,
Norman James362a80f2015-09-14 14:04:39 -05004165 NULL
4166};
4167
4168static const _ExtendedGDBusArgInfo _sensor_value_signal_info_changed_ARG_value =
4169{
4170 {
4171 -1,
4172 (gchar *) "value",
4173 (gchar *) "v",
4174 NULL
4175 },
4176 FALSE
4177};
4178
4179static const _ExtendedGDBusArgInfo _sensor_value_signal_info_changed_ARG_units =
4180{
4181 {
4182 -1,
4183 (gchar *) "units",
4184 (gchar *) "s",
4185 NULL
4186 },
4187 FALSE
4188};
4189
4190static const _ExtendedGDBusArgInfo * const _sensor_value_signal_info_changed_ARG_pointers[] =
4191{
4192 &_sensor_value_signal_info_changed_ARG_value,
4193 &_sensor_value_signal_info_changed_ARG_units,
4194 NULL
4195};
4196
4197static const _ExtendedGDBusSignalInfo _sensor_value_signal_info_changed =
4198{
4199 {
4200 -1,
4201 (gchar *) "Changed",
4202 (GDBusArgInfo **) &_sensor_value_signal_info_changed_ARG_pointers,
4203 NULL
4204 },
4205 "changed"
4206};
4207
Norman James32e74e22015-09-15 21:28:06 -05004208static const _ExtendedGDBusSignalInfo _sensor_value_signal_info_error =
4209{
4210 {
4211 -1,
4212 (gchar *) "Error",
4213 NULL,
4214 NULL
4215 },
4216 "error"
4217};
4218
Norman James362a80f2015-09-14 14:04:39 -05004219static const _ExtendedGDBusArgInfo _sensor_value_signal_info_heartbeat_ARG_bus_name =
4220{
4221 {
4222 -1,
4223 (gchar *) "bus_name",
4224 (gchar *) "s",
4225 NULL
4226 },
4227 FALSE
4228};
4229
4230static const _ExtendedGDBusArgInfo * const _sensor_value_signal_info_heartbeat_ARG_pointers[] =
4231{
4232 &_sensor_value_signal_info_heartbeat_ARG_bus_name,
4233 NULL
4234};
4235
4236static const _ExtendedGDBusSignalInfo _sensor_value_signal_info_heartbeat =
4237{
4238 {
4239 -1,
4240 (gchar *) "Heartbeat",
4241 (GDBusArgInfo **) &_sensor_value_signal_info_heartbeat_ARG_pointers,
4242 NULL
4243 },
4244 "heartbeat"
4245};
4246
4247static const _ExtendedGDBusSignalInfo * const _sensor_value_signal_info_pointers[] =
4248{
4249 &_sensor_value_signal_info_changed,
Norman James32e74e22015-09-15 21:28:06 -05004250 &_sensor_value_signal_info_error,
Norman James362a80f2015-09-14 14:04:39 -05004251 &_sensor_value_signal_info_heartbeat,
4252 NULL
4253};
4254
4255static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_value =
4256{
4257 {
4258 -1,
4259 (gchar *) "value",
4260 (gchar *) "v",
4261 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
4262 NULL
4263 },
4264 "value",
4265 FALSE
4266};
4267
4268static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_units =
4269{
4270 {
4271 -1,
4272 (gchar *) "units",
4273 (gchar *) "s",
4274 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
4275 NULL
4276 },
4277 "units",
4278 FALSE
4279};
4280
4281static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_poll_interval =
4282{
4283 {
4284 -1,
4285 (gchar *) "poll_interval",
4286 (gchar *) "i",
4287 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
4288 NULL
4289 },
4290 "poll-interval",
4291 FALSE
4292};
4293
4294static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_heatbeat =
4295{
4296 {
4297 -1,
4298 (gchar *) "heatbeat",
4299 (gchar *) "i",
4300 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
4301 NULL
4302 },
4303 "heatbeat",
4304 FALSE
4305};
4306
4307static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_settable =
4308{
4309 {
4310 -1,
4311 (gchar *) "settable",
4312 (gchar *) "b",
4313 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
4314 NULL
4315 },
4316 "settable",
4317 FALSE
4318};
4319
Norman James362a80f2015-09-14 14:04:39 -05004320static const _ExtendedGDBusPropertyInfo * const _sensor_value_property_info_pointers[] =
4321{
4322 &_sensor_value_property_info_value,
4323 &_sensor_value_property_info_units,
4324 &_sensor_value_property_info_poll_interval,
4325 &_sensor_value_property_info_heatbeat,
4326 &_sensor_value_property_info_settable,
Norman James362a80f2015-09-14 14:04:39 -05004327 NULL
4328};
4329
4330static const _ExtendedGDBusInterfaceInfo _sensor_value_interface_info =
4331{
4332 {
4333 -1,
4334 (gchar *) "org.openbmc.SensorValue",
4335 (GDBusMethodInfo **) &_sensor_value_method_info_pointers,
4336 (GDBusSignalInfo **) &_sensor_value_signal_info_pointers,
4337 (GDBusPropertyInfo **) &_sensor_value_property_info_pointers,
4338 NULL
4339 },
4340 "sensor-value",
4341};
4342
4343
4344/**
4345 * sensor_value_interface_info:
4346 *
4347 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link> D-Bus interface.
4348 *
4349 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
4350 */
4351GDBusInterfaceInfo *
4352sensor_value_interface_info (void)
4353{
4354 return (GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct;
4355}
4356
4357/**
4358 * sensor_value_override_properties:
4359 * @klass: The class structure for a #GObject<!-- -->-derived class.
4360 * @property_id_begin: The property id to assign to the first overridden property.
4361 *
4362 * Overrides all #GObject properties in the #SensorValue interface for a concrete class.
4363 * The properties are overridden in the order they are defined.
4364 *
4365 * Returns: The last property id.
4366 */
4367guint
4368sensor_value_override_properties (GObjectClass *klass, guint property_id_begin)
4369{
4370 g_object_class_override_property (klass, property_id_begin++, "value");
4371 g_object_class_override_property (klass, property_id_begin++, "units");
4372 g_object_class_override_property (klass, property_id_begin++, "poll-interval");
4373 g_object_class_override_property (klass, property_id_begin++, "heatbeat");
4374 g_object_class_override_property (klass, property_id_begin++, "settable");
Norman James362a80f2015-09-14 14:04:39 -05004375 return property_id_begin - 1;
4376}
4377
4378
4379
4380/**
4381 * SensorValue:
4382 *
4383 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link>.
4384 */
4385
4386/**
4387 * SensorValueIface:
4388 * @parent_iface: The parent interface.
4389 * @handle_get_value: Handler for the #SensorValue::handle-get-value signal.
4390 * @handle_init: Handler for the #SensorValue::handle-init signal.
Norman James19e45912015-10-04 20:19:41 -05004391 * @handle_set_value: Handler for the #SensorValue::handle-set-value signal.
Norman James362a80f2015-09-14 14:04:39 -05004392 * @get_heatbeat: Getter for the #SensorValue:heatbeat property.
Norman James362a80f2015-09-14 14:04:39 -05004393 * @get_poll_interval: Getter for the #SensorValue:poll-interval property.
4394 * @get_settable: Getter for the #SensorValue:settable property.
4395 * @get_units: Getter for the #SensorValue:units property.
4396 * @get_value: Getter for the #SensorValue:value property.
4397 * @changed: Handler for the #SensorValue::changed signal.
Norman James32e74e22015-09-15 21:28:06 -05004398 * @error: Handler for the #SensorValue::error signal.
Norman James362a80f2015-09-14 14:04:39 -05004399 * @heartbeat: Handler for the #SensorValue::heartbeat signal.
4400 *
4401 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link>.
4402 */
4403
4404typedef SensorValueIface SensorValueInterface;
4405G_DEFINE_INTERFACE (SensorValue, sensor_value, G_TYPE_OBJECT);
4406
4407static void
4408sensor_value_default_init (SensorValueIface *iface)
4409{
4410 /* GObject signals for incoming D-Bus method calls: */
4411 /**
4412 * SensorValue::handle-init:
4413 * @object: A #SensorValue.
4414 * @invocation: A #GDBusMethodInvocation.
4415 *
4416 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorValue.init">init()</link> D-Bus method.
4417 *
4418 * 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.
4419 *
4420 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
4421 */
4422 g_signal_new ("handle-init",
4423 G_TYPE_FROM_INTERFACE (iface),
4424 G_SIGNAL_RUN_LAST,
4425 G_STRUCT_OFFSET (SensorValueIface, handle_init),
4426 g_signal_accumulator_true_handled,
4427 NULL,
4428 g_cclosure_marshal_generic,
4429 G_TYPE_BOOLEAN,
4430 1,
4431 G_TYPE_DBUS_METHOD_INVOCATION);
4432
4433 /**
4434 * SensorValue::handle-get-value:
4435 * @object: A #SensorValue.
4436 * @invocation: A #GDBusMethodInvocation.
4437 *
4438 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorValue.getValue">getValue()</link> D-Bus method.
4439 *
4440 * 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.
4441 *
4442 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
4443 */
4444 g_signal_new ("handle-get-value",
4445 G_TYPE_FROM_INTERFACE (iface),
4446 G_SIGNAL_RUN_LAST,
4447 G_STRUCT_OFFSET (SensorValueIface, handle_get_value),
4448 g_signal_accumulator_true_handled,
4449 NULL,
4450 g_cclosure_marshal_generic,
4451 G_TYPE_BOOLEAN,
4452 1,
4453 G_TYPE_DBUS_METHOD_INVOCATION);
4454
Norman James19e45912015-10-04 20:19:41 -05004455 /**
4456 * SensorValue::handle-set-value:
4457 * @object: A #SensorValue.
4458 * @invocation: A #GDBusMethodInvocation.
4459 * @arg_value: Argument passed by remote caller.
4460 *
4461 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorValue.setValue">setValue()</link> D-Bus method.
4462 *
4463 * 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.
4464 *
4465 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
4466 */
4467 g_signal_new ("handle-set-value",
4468 G_TYPE_FROM_INTERFACE (iface),
4469 G_SIGNAL_RUN_LAST,
4470 G_STRUCT_OFFSET (SensorValueIface, handle_set_value),
4471 g_signal_accumulator_true_handled,
4472 NULL,
4473 g_cclosure_marshal_generic,
4474 G_TYPE_BOOLEAN,
4475 2,
4476 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_VARIANT);
4477
Norman James362a80f2015-09-14 14:04:39 -05004478 /* GObject signals for received D-Bus signals: */
4479 /**
4480 * SensorValue::changed:
4481 * @object: A #SensorValue.
4482 * @arg_value: Argument.
4483 * @arg_units: Argument.
4484 *
4485 * 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.
4486 *
4487 * 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.
4488 */
4489 g_signal_new ("changed",
4490 G_TYPE_FROM_INTERFACE (iface),
4491 G_SIGNAL_RUN_LAST,
4492 G_STRUCT_OFFSET (SensorValueIface, changed),
4493 NULL,
4494 NULL,
4495 g_cclosure_marshal_generic,
4496 G_TYPE_NONE,
4497 2, G_TYPE_VARIANT, G_TYPE_STRING);
4498
4499 /**
Norman James32e74e22015-09-15 21:28:06 -05004500 * SensorValue::error:
4501 * @object: A #SensorValue.
4502 *
4503 * 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.
4504 *
4505 * 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.
4506 */
4507 g_signal_new ("error",
4508 G_TYPE_FROM_INTERFACE (iface),
4509 G_SIGNAL_RUN_LAST,
4510 G_STRUCT_OFFSET (SensorValueIface, error),
4511 NULL,
4512 NULL,
4513 g_cclosure_marshal_generic,
4514 G_TYPE_NONE,
4515 0);
4516
4517 /**
Norman James362a80f2015-09-14 14:04:39 -05004518 * SensorValue::heartbeat:
4519 * @object: A #SensorValue.
4520 * @arg_bus_name: Argument.
4521 *
4522 * 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.
4523 *
4524 * 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.
4525 */
4526 g_signal_new ("heartbeat",
4527 G_TYPE_FROM_INTERFACE (iface),
4528 G_SIGNAL_RUN_LAST,
4529 G_STRUCT_OFFSET (SensorValueIface, heartbeat),
4530 NULL,
4531 NULL,
4532 g_cclosure_marshal_generic,
4533 G_TYPE_NONE,
4534 1, G_TYPE_STRING);
4535
4536 /* GObject properties for D-Bus properties: */
4537 /**
4538 * SensorValue:value:
4539 *
4540 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link>.
4541 *
4542 * 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.
4543 */
4544 g_object_interface_install_property (iface,
4545 g_param_spec_variant ("value", "value", "value", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
4546 /**
4547 * SensorValue:units:
4548 *
4549 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link>.
4550 *
4551 * 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.
4552 */
4553 g_object_interface_install_property (iface,
4554 g_param_spec_string ("units", "units", "units", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
4555 /**
4556 * SensorValue:poll-interval:
4557 *
4558 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.poll_interval">"poll_interval"</link>.
4559 *
4560 * 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.
4561 */
4562 g_object_interface_install_property (iface,
4563 g_param_spec_int ("poll-interval", "poll_interval", "poll_interval", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
4564 /**
4565 * SensorValue:heatbeat:
4566 *
4567 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.heatbeat">"heatbeat"</link>.
4568 *
4569 * 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.
4570 */
4571 g_object_interface_install_property (iface,
4572 g_param_spec_int ("heatbeat", "heatbeat", "heatbeat", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
4573 /**
4574 * SensorValue:settable:
4575 *
4576 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.settable">"settable"</link>.
4577 *
4578 * 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.
4579 */
4580 g_object_interface_install_property (iface,
4581 g_param_spec_boolean ("settable", "settable", "settable", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Norman James362a80f2015-09-14 14:04:39 -05004582}
4583
4584/**
4585 * sensor_value_get_value: (skip)
4586 * @object: A #SensorValue.
4587 *
4588 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link> D-Bus property.
4589 *
4590 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4591 *
4592 * <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>
4593 *
4594 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
4595 */
4596GVariant *
4597sensor_value_get_value (SensorValue *object)
4598{
4599 return SENSOR_VALUE_GET_IFACE (object)->get_value (object);
4600}
4601
4602/**
4603 * sensor_value_dup_value: (skip)
4604 * @object: A #SensorValue.
4605 *
4606 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link> D-Bus property.
4607 *
4608 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4609 *
4610 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
4611 */
4612GVariant *
4613sensor_value_dup_value (SensorValue *object)
4614{
4615 GVariant *value;
4616 g_object_get (G_OBJECT (object), "value", &value, NULL);
4617 return value;
4618}
4619
4620/**
4621 * sensor_value_set_value: (skip)
4622 * @object: A #SensorValue.
4623 * @value: The value to set.
4624 *
4625 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link> D-Bus property to @value.
4626 *
4627 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
4628 */
4629void
4630sensor_value_set_value (SensorValue *object, GVariant *value)
4631{
4632 g_object_set (G_OBJECT (object), "value", value, NULL);
4633}
4634
4635/**
4636 * sensor_value_get_units: (skip)
4637 * @object: A #SensorValue.
4638 *
4639 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link> D-Bus property.
4640 *
4641 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4642 *
4643 * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use sensor_value_dup_units() if on another thread.</warning>
4644 *
4645 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
4646 */
4647const gchar *
4648sensor_value_get_units (SensorValue *object)
4649{
4650 return SENSOR_VALUE_GET_IFACE (object)->get_units (object);
4651}
4652
4653/**
4654 * sensor_value_dup_units: (skip)
4655 * @object: A #SensorValue.
4656 *
4657 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link> D-Bus property.
4658 *
4659 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4660 *
4661 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
4662 */
4663gchar *
4664sensor_value_dup_units (SensorValue *object)
4665{
4666 gchar *value;
4667 g_object_get (G_OBJECT (object), "units", &value, NULL);
4668 return value;
4669}
4670
4671/**
4672 * sensor_value_set_units: (skip)
4673 * @object: A #SensorValue.
4674 * @value: The value to set.
4675 *
4676 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link> D-Bus property to @value.
4677 *
4678 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
4679 */
4680void
4681sensor_value_set_units (SensorValue *object, const gchar *value)
4682{
4683 g_object_set (G_OBJECT (object), "units", value, NULL);
4684}
4685
4686/**
4687 * sensor_value_get_poll_interval: (skip)
4688 * @object: A #SensorValue.
4689 *
4690 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.poll_interval">"poll_interval"</link> D-Bus property.
4691 *
4692 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
4693 *
4694 * Returns: The property value.
4695 */
4696gint
4697sensor_value_get_poll_interval (SensorValue *object)
4698{
4699 return SENSOR_VALUE_GET_IFACE (object)->get_poll_interval (object);
4700}
4701
4702/**
4703 * sensor_value_set_poll_interval: (skip)
4704 * @object: A #SensorValue.
4705 * @value: The value to set.
4706 *
4707 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.poll_interval">"poll_interval"</link> D-Bus property to @value.
4708 *
4709 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
4710 */
4711void
4712sensor_value_set_poll_interval (SensorValue *object, gint value)
4713{
4714 g_object_set (G_OBJECT (object), "poll-interval", value, NULL);
4715}
4716
4717/**
4718 * sensor_value_get_heatbeat: (skip)
4719 * @object: A #SensorValue.
4720 *
4721 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.heatbeat">"heatbeat"</link> D-Bus property.
4722 *
4723 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4724 *
4725 * Returns: The property value.
4726 */
4727gint
4728sensor_value_get_heatbeat (SensorValue *object)
4729{
4730 return SENSOR_VALUE_GET_IFACE (object)->get_heatbeat (object);
4731}
4732
4733/**
4734 * sensor_value_set_heatbeat: (skip)
4735 * @object: A #SensorValue.
4736 * @value: The value to set.
4737 *
4738 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.heatbeat">"heatbeat"</link> D-Bus property to @value.
4739 *
4740 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
4741 */
4742void
4743sensor_value_set_heatbeat (SensorValue *object, gint value)
4744{
4745 g_object_set (G_OBJECT (object), "heatbeat", value, NULL);
4746}
4747
4748/**
4749 * sensor_value_get_settable: (skip)
4750 * @object: A #SensorValue.
4751 *
4752 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.settable">"settable"</link> D-Bus property.
4753 *
4754 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4755 *
4756 * Returns: The property value.
4757 */
4758gboolean
4759sensor_value_get_settable (SensorValue *object)
4760{
4761 return SENSOR_VALUE_GET_IFACE (object)->get_settable (object);
4762}
4763
4764/**
4765 * sensor_value_set_settable: (skip)
4766 * @object: A #SensorValue.
4767 * @value: The value to set.
4768 *
4769 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.settable">"settable"</link> D-Bus property to @value.
4770 *
4771 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
4772 */
4773void
4774sensor_value_set_settable (SensorValue *object, gboolean value)
4775{
4776 g_object_set (G_OBJECT (object), "settable", value, NULL);
4777}
4778
4779/**
Norman James362a80f2015-09-14 14:04:39 -05004780 * sensor_value_emit_changed:
4781 * @object: A #SensorValue.
4782 * @arg_value: Argument to pass with the signal.
4783 * @arg_units: Argument to pass with the signal.
4784 *
4785 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorValue.Changed">"Changed"</link> D-Bus signal.
4786 */
4787void
4788sensor_value_emit_changed (
4789 SensorValue *object,
4790 GVariant *arg_value,
4791 const gchar *arg_units)
4792{
4793 g_signal_emit_by_name (object, "changed", arg_value, arg_units);
4794}
4795
4796/**
Norman James32e74e22015-09-15 21:28:06 -05004797 * sensor_value_emit_error:
4798 * @object: A #SensorValue.
4799 *
4800 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorValue.Error">"Error"</link> D-Bus signal.
4801 */
4802void
4803sensor_value_emit_error (
4804 SensorValue *object)
4805{
4806 g_signal_emit_by_name (object, "error");
4807}
4808
4809/**
Norman James362a80f2015-09-14 14:04:39 -05004810 * sensor_value_emit_heartbeat:
4811 * @object: A #SensorValue.
4812 * @arg_bus_name: Argument to pass with the signal.
4813 *
4814 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorValue.Heartbeat">"Heartbeat"</link> D-Bus signal.
4815 */
4816void
4817sensor_value_emit_heartbeat (
4818 SensorValue *object,
4819 const gchar *arg_bus_name)
4820{
4821 g_signal_emit_by_name (object, "heartbeat", arg_bus_name);
4822}
4823
4824/**
4825 * sensor_value_call_init:
4826 * @proxy: A #SensorValueProxy.
4827 * @cancellable: (allow-none): A #GCancellable or %NULL.
4828 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
4829 * @user_data: User data to pass to @callback.
4830 *
4831 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorValue.init">init()</link> D-Bus method on @proxy.
4832 * 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.
4833 * You can then call sensor_value_call_init_finish() to get the result of the operation.
4834 *
4835 * See sensor_value_call_init_sync() for the synchronous, blocking version of this method.
4836 */
4837void
4838sensor_value_call_init (
4839 SensorValue *proxy,
4840 GCancellable *cancellable,
4841 GAsyncReadyCallback callback,
4842 gpointer user_data)
4843{
4844 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
4845 "init",
4846 g_variant_new ("()"),
4847 G_DBUS_CALL_FLAGS_NONE,
4848 -1,
4849 cancellable,
4850 callback,
4851 user_data);
4852}
4853
4854/**
4855 * sensor_value_call_init_finish:
4856 * @proxy: A #SensorValueProxy.
4857 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_call_init().
4858 * @error: Return location for error or %NULL.
4859 *
4860 * Finishes an operation started with sensor_value_call_init().
4861 *
4862 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
4863 */
4864gboolean
4865sensor_value_call_init_finish (
4866 SensorValue *proxy,
4867 GAsyncResult *res,
4868 GError **error)
4869{
4870 GVariant *_ret;
4871 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
4872 if (_ret == NULL)
4873 goto _out;
4874 g_variant_get (_ret,
4875 "()");
4876 g_variant_unref (_ret);
4877_out:
4878 return _ret != NULL;
4879}
4880
4881/**
4882 * sensor_value_call_init_sync:
4883 * @proxy: A #SensorValueProxy.
4884 * @cancellable: (allow-none): A #GCancellable or %NULL.
4885 * @error: Return location for error or %NULL.
4886 *
4887 * 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.
4888 *
4889 * See sensor_value_call_init() for the asynchronous version of this method.
4890 *
4891 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
4892 */
4893gboolean
4894sensor_value_call_init_sync (
4895 SensorValue *proxy,
4896 GCancellable *cancellable,
4897 GError **error)
4898{
4899 GVariant *_ret;
4900 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
4901 "init",
4902 g_variant_new ("()"),
4903 G_DBUS_CALL_FLAGS_NONE,
4904 -1,
4905 cancellable,
4906 error);
4907 if (_ret == NULL)
4908 goto _out;
4909 g_variant_get (_ret,
4910 "()");
4911 g_variant_unref (_ret);
4912_out:
4913 return _ret != NULL;
4914}
4915
4916/**
4917 * sensor_value_call_get_value:
4918 * @proxy: A #SensorValueProxy.
4919 * @cancellable: (allow-none): A #GCancellable or %NULL.
4920 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
4921 * @user_data: User data to pass to @callback.
4922 *
4923 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorValue.getValue">getValue()</link> D-Bus method on @proxy.
4924 * 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.
4925 * You can then call sensor_value_call_get_value_finish() to get the result of the operation.
4926 *
4927 * See sensor_value_call_get_value_sync() for the synchronous, blocking version of this method.
4928 */
4929void
4930sensor_value_call_get_value (
4931 SensorValue *proxy,
4932 GCancellable *cancellable,
4933 GAsyncReadyCallback callback,
4934 gpointer user_data)
4935{
4936 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
4937 "getValue",
4938 g_variant_new ("()"),
4939 G_DBUS_CALL_FLAGS_NONE,
4940 -1,
4941 cancellable,
4942 callback,
4943 user_data);
4944}
4945
4946/**
4947 * sensor_value_call_get_value_finish:
4948 * @proxy: A #SensorValueProxy.
4949 * @out_value: (out): Return location for return parameter or %NULL to ignore.
4950 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_call_get_value().
4951 * @error: Return location for error or %NULL.
4952 *
4953 * Finishes an operation started with sensor_value_call_get_value().
4954 *
4955 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
4956 */
4957gboolean
4958sensor_value_call_get_value_finish (
4959 SensorValue *proxy,
4960 GVariant **out_value,
4961 GAsyncResult *res,
4962 GError **error)
4963{
4964 GVariant *_ret;
4965 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
4966 if (_ret == NULL)
4967 goto _out;
4968 g_variant_get (_ret,
4969 "(@v)",
4970 out_value);
4971 g_variant_unref (_ret);
4972_out:
4973 return _ret != NULL;
4974}
4975
4976/**
4977 * sensor_value_call_get_value_sync:
4978 * @proxy: A #SensorValueProxy.
4979 * @out_value: (out): Return location for return parameter or %NULL to ignore.
4980 * @cancellable: (allow-none): A #GCancellable or %NULL.
4981 * @error: Return location for error or %NULL.
4982 *
4983 * 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.
4984 *
4985 * See sensor_value_call_get_value() for the asynchronous version of this method.
4986 *
4987 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
4988 */
4989gboolean
4990sensor_value_call_get_value_sync (
4991 SensorValue *proxy,
4992 GVariant **out_value,
4993 GCancellable *cancellable,
4994 GError **error)
4995{
4996 GVariant *_ret;
4997 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
4998 "getValue",
4999 g_variant_new ("()"),
5000 G_DBUS_CALL_FLAGS_NONE,
5001 -1,
5002 cancellable,
5003 error);
5004 if (_ret == NULL)
5005 goto _out;
5006 g_variant_get (_ret,
5007 "(@v)",
5008 out_value);
5009 g_variant_unref (_ret);
5010_out:
5011 return _ret != NULL;
5012}
5013
5014/**
Norman James19e45912015-10-04 20:19:41 -05005015 * sensor_value_call_set_value:
5016 * @proxy: A #SensorValueProxy.
5017 * @arg_value: Argument to pass with the method invocation.
5018 * @cancellable: (allow-none): A #GCancellable or %NULL.
5019 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
5020 * @user_data: User data to pass to @callback.
5021 *
5022 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorValue.setValue">setValue()</link> D-Bus method on @proxy.
5023 * 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.
5024 * You can then call sensor_value_call_set_value_finish() to get the result of the operation.
5025 *
5026 * See sensor_value_call_set_value_sync() for the synchronous, blocking version of this method.
5027 */
5028void
5029sensor_value_call_set_value (
5030 SensorValue *proxy,
5031 GVariant *arg_value,
5032 GCancellable *cancellable,
5033 GAsyncReadyCallback callback,
5034 gpointer user_data)
5035{
5036 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
5037 "setValue",
5038 g_variant_new ("(@v)",
5039 arg_value),
5040 G_DBUS_CALL_FLAGS_NONE,
5041 -1,
5042 cancellable,
5043 callback,
5044 user_data);
5045}
5046
5047/**
5048 * sensor_value_call_set_value_finish:
5049 * @proxy: A #SensorValueProxy.
5050 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_call_set_value().
5051 * @error: Return location for error or %NULL.
5052 *
5053 * Finishes an operation started with sensor_value_call_set_value().
5054 *
5055 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
5056 */
5057gboolean
5058sensor_value_call_set_value_finish (
5059 SensorValue *proxy,
5060 GAsyncResult *res,
5061 GError **error)
5062{
5063 GVariant *_ret;
5064 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
5065 if (_ret == NULL)
5066 goto _out;
5067 g_variant_get (_ret,
5068 "()");
5069 g_variant_unref (_ret);
5070_out:
5071 return _ret != NULL;
5072}
5073
5074/**
5075 * sensor_value_call_set_value_sync:
5076 * @proxy: A #SensorValueProxy.
5077 * @arg_value: Argument to pass with the method invocation.
5078 * @cancellable: (allow-none): A #GCancellable or %NULL.
5079 * @error: Return location for error or %NULL.
5080 *
5081 * 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.
5082 *
5083 * See sensor_value_call_set_value() for the asynchronous version of this method.
5084 *
5085 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
5086 */
5087gboolean
5088sensor_value_call_set_value_sync (
5089 SensorValue *proxy,
5090 GVariant *arg_value,
5091 GCancellable *cancellable,
5092 GError **error)
5093{
5094 GVariant *_ret;
5095 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
5096 "setValue",
5097 g_variant_new ("(@v)",
5098 arg_value),
5099 G_DBUS_CALL_FLAGS_NONE,
5100 -1,
5101 cancellable,
5102 error);
5103 if (_ret == NULL)
5104 goto _out;
5105 g_variant_get (_ret,
5106 "()");
5107 g_variant_unref (_ret);
5108_out:
5109 return _ret != NULL;
5110}
5111
5112/**
Norman James362a80f2015-09-14 14:04:39 -05005113 * sensor_value_complete_init:
5114 * @object: A #SensorValue.
5115 * @invocation: (transfer full): A #GDBusMethodInvocation.
5116 *
5117 * 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.
5118 *
5119 * This method will free @invocation, you cannot use it afterwards.
5120 */
5121void
5122sensor_value_complete_init (
5123 SensorValue *object,
5124 GDBusMethodInvocation *invocation)
5125{
5126 g_dbus_method_invocation_return_value (invocation,
5127 g_variant_new ("()"));
5128}
5129
5130/**
5131 * sensor_value_complete_get_value:
5132 * @object: A #SensorValue.
5133 * @invocation: (transfer full): A #GDBusMethodInvocation.
5134 * @value: Parameter to return.
5135 *
5136 * 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.
5137 *
5138 * This method will free @invocation, you cannot use it afterwards.
5139 */
5140void
5141sensor_value_complete_get_value (
5142 SensorValue *object,
5143 GDBusMethodInvocation *invocation,
5144 GVariant *value)
5145{
5146 g_dbus_method_invocation_return_value (invocation,
5147 g_variant_new ("(@v)",
5148 value));
5149}
5150
Norman James19e45912015-10-04 20:19:41 -05005151/**
5152 * sensor_value_complete_set_value:
5153 * @object: A #SensorValue.
5154 * @invocation: (transfer full): A #GDBusMethodInvocation.
5155 *
5156 * 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.
5157 *
5158 * This method will free @invocation, you cannot use it afterwards.
5159 */
5160void
5161sensor_value_complete_set_value (
5162 SensorValue *object,
5163 GDBusMethodInvocation *invocation)
5164{
5165 g_dbus_method_invocation_return_value (invocation,
5166 g_variant_new ("()"));
5167}
5168
Norman James362a80f2015-09-14 14:04:39 -05005169/* ------------------------------------------------------------------------ */
5170
5171/**
5172 * SensorValueProxy:
5173 *
5174 * The #SensorValueProxy structure contains only private data and should only be accessed using the provided API.
5175 */
5176
5177/**
5178 * SensorValueProxyClass:
5179 * @parent_class: The parent class.
5180 *
5181 * Class structure for #SensorValueProxy.
5182 */
5183
5184struct _SensorValueProxyPrivate
5185{
5186 GData *qdata;
5187};
5188
5189static void sensor_value_proxy_iface_init (SensorValueIface *iface);
5190
5191#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
5192G_DEFINE_TYPE_WITH_CODE (SensorValueProxy, sensor_value_proxy, G_TYPE_DBUS_PROXY,
5193 G_ADD_PRIVATE (SensorValueProxy)
5194 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_proxy_iface_init));
5195
5196#else
5197G_DEFINE_TYPE_WITH_CODE (SensorValueProxy, sensor_value_proxy, G_TYPE_DBUS_PROXY,
5198 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_proxy_iface_init));
5199
5200#endif
5201static void
5202sensor_value_proxy_finalize (GObject *object)
5203{
5204 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
5205 g_datalist_clear (&proxy->priv->qdata);
5206 G_OBJECT_CLASS (sensor_value_proxy_parent_class)->finalize (object);
5207}
5208
5209static void
5210sensor_value_proxy_get_property (GObject *object,
5211 guint prop_id,
5212 GValue *value,
5213 GParamSpec *pspec G_GNUC_UNUSED)
5214{
5215 const _ExtendedGDBusPropertyInfo *info;
5216 GVariant *variant;
Norman Jamesdfdaca92015-09-27 22:11:15 -05005217 g_assert (prop_id != 0 && prop_id - 1 < 5);
Norman James362a80f2015-09-14 14:04:39 -05005218 info = _sensor_value_property_info_pointers[prop_id - 1];
5219 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
5220 if (info->use_gvariant)
5221 {
5222 g_value_set_variant (value, variant);
5223 }
5224 else
5225 {
5226 if (variant != NULL)
5227 g_dbus_gvariant_to_gvalue (variant, value);
5228 }
5229 if (variant != NULL)
5230 g_variant_unref (variant);
5231}
5232
5233static void
5234sensor_value_proxy_set_property_cb (GDBusProxy *proxy,
5235 GAsyncResult *res,
5236 gpointer user_data)
5237{
5238 const _ExtendedGDBusPropertyInfo *info = user_data;
5239 GError *error;
5240 GVariant *_ret;
5241 error = NULL;
5242 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
5243 if (!_ret)
5244 {
5245 g_warning ("Error setting property '%s' on interface org.openbmc.SensorValue: %s (%s, %d)",
5246 info->parent_struct.name,
5247 error->message, g_quark_to_string (error->domain), error->code);
5248 g_error_free (error);
5249 }
5250 else
5251 {
5252 g_variant_unref (_ret);
5253 }
5254}
5255
5256static void
5257sensor_value_proxy_set_property (GObject *object,
5258 guint prop_id,
5259 const GValue *value,
5260 GParamSpec *pspec G_GNUC_UNUSED)
5261{
5262 const _ExtendedGDBusPropertyInfo *info;
5263 GVariant *variant;
Norman Jamesdfdaca92015-09-27 22:11:15 -05005264 g_assert (prop_id != 0 && prop_id - 1 < 5);
Norman James362a80f2015-09-14 14:04:39 -05005265 info = _sensor_value_property_info_pointers[prop_id - 1];
5266 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
5267 g_dbus_proxy_call (G_DBUS_PROXY (object),
5268 "org.freedesktop.DBus.Properties.Set",
5269 g_variant_new ("(ssv)", "org.openbmc.SensorValue", info->parent_struct.name, variant),
5270 G_DBUS_CALL_FLAGS_NONE,
5271 -1,
5272 NULL, (GAsyncReadyCallback) sensor_value_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
5273 g_variant_unref (variant);
5274}
5275
5276static void
5277sensor_value_proxy_g_signal (GDBusProxy *proxy,
5278 const gchar *sender_name G_GNUC_UNUSED,
5279 const gchar *signal_name,
5280 GVariant *parameters)
5281{
5282 _ExtendedGDBusSignalInfo *info;
5283 GVariantIter iter;
5284 GVariant *child;
5285 GValue *paramv;
5286 guint num_params;
5287 guint n;
5288 guint signal_id;
5289 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, signal_name);
5290 if (info == NULL)
5291 return;
5292 num_params = g_variant_n_children (parameters);
5293 paramv = g_new0 (GValue, num_params + 1);
5294 g_value_init (&paramv[0], TYPE_SENSOR_VALUE);
5295 g_value_set_object (&paramv[0], proxy);
5296 g_variant_iter_init (&iter, parameters);
5297 n = 1;
5298 while ((child = g_variant_iter_next_value (&iter)) != NULL)
5299 {
5300 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
5301 if (arg_info->use_gvariant)
5302 {
5303 g_value_init (&paramv[n], G_TYPE_VARIANT);
5304 g_value_set_variant (&paramv[n], child);
5305 n++;
5306 }
5307 else
5308 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
5309 g_variant_unref (child);
5310 }
5311 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_VALUE);
5312 g_signal_emitv (paramv, signal_id, 0, NULL);
5313 for (n = 0; n < num_params + 1; n++)
5314 g_value_unset (&paramv[n]);
5315 g_free (paramv);
5316}
5317
5318static void
5319sensor_value_proxy_g_properties_changed (GDBusProxy *_proxy,
5320 GVariant *changed_properties,
5321 const gchar *const *invalidated_properties)
5322{
5323 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (_proxy);
5324 guint n;
5325 const gchar *key;
5326 GVariantIter *iter;
5327 _ExtendedGDBusPropertyInfo *info;
5328 g_variant_get (changed_properties, "a{sv}", &iter);
5329 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
5330 {
5331 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, key);
5332 g_datalist_remove_data (&proxy->priv->qdata, key);
5333 if (info != NULL)
5334 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
5335 }
5336 g_variant_iter_free (iter);
5337 for (n = 0; invalidated_properties[n] != NULL; n++)
5338 {
5339 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, invalidated_properties[n]);
5340 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
5341 if (info != NULL)
5342 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
5343 }
5344}
5345
5346static GVariant *
5347sensor_value_proxy_get_value (SensorValue *object)
5348{
5349 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
5350 GVariant *variant;
5351 GVariant *value = NULL;
5352 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "value");
5353 value = variant;
5354 if (variant != NULL)
5355 g_variant_unref (variant);
5356 return value;
5357}
5358
5359static const gchar *
5360sensor_value_proxy_get_units (SensorValue *object)
5361{
5362 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
5363 GVariant *variant;
5364 const gchar *value = NULL;
5365 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "units");
5366 if (variant != NULL)
5367 {
5368 value = g_variant_get_string (variant, NULL);
5369 g_variant_unref (variant);
5370 }
5371 return value;
5372}
5373
5374static gint
5375sensor_value_proxy_get_poll_interval (SensorValue *object)
5376{
5377 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
5378 GVariant *variant;
5379 gint value = 0;
5380 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "poll_interval");
5381 if (variant != NULL)
5382 {
5383 value = g_variant_get_int32 (variant);
5384 g_variant_unref (variant);
5385 }
5386 return value;
5387}
5388
5389static gint
5390sensor_value_proxy_get_heatbeat (SensorValue *object)
5391{
5392 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
5393 GVariant *variant;
5394 gint value = 0;
5395 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "heatbeat");
5396 if (variant != NULL)
5397 {
5398 value = g_variant_get_int32 (variant);
5399 g_variant_unref (variant);
5400 }
5401 return value;
5402}
5403
5404static gboolean
5405sensor_value_proxy_get_settable (SensorValue *object)
5406{
5407 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
5408 GVariant *variant;
5409 gboolean value = 0;
5410 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "settable");
5411 if (variant != NULL)
5412 {
5413 value = g_variant_get_boolean (variant);
5414 g_variant_unref (variant);
5415 }
5416 return value;
5417}
5418
Norman James362a80f2015-09-14 14:04:39 -05005419static void
5420sensor_value_proxy_init (SensorValueProxy *proxy)
5421{
5422#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
5423 proxy->priv = sensor_value_proxy_get_instance_private (proxy);
5424#else
5425 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_VALUE_PROXY, SensorValueProxyPrivate);
5426#endif
5427
5428 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_value_interface_info ());
5429}
5430
5431static void
5432sensor_value_proxy_class_init (SensorValueProxyClass *klass)
5433{
5434 GObjectClass *gobject_class;
5435 GDBusProxyClass *proxy_class;
5436
5437 gobject_class = G_OBJECT_CLASS (klass);
5438 gobject_class->finalize = sensor_value_proxy_finalize;
5439 gobject_class->get_property = sensor_value_proxy_get_property;
5440 gobject_class->set_property = sensor_value_proxy_set_property;
5441
5442 proxy_class = G_DBUS_PROXY_CLASS (klass);
5443 proxy_class->g_signal = sensor_value_proxy_g_signal;
5444 proxy_class->g_properties_changed = sensor_value_proxy_g_properties_changed;
5445
5446 sensor_value_override_properties (gobject_class, 1);
5447
5448#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
5449 g_type_class_add_private (klass, sizeof (SensorValueProxyPrivate));
5450#endif
5451}
5452
5453static void
5454sensor_value_proxy_iface_init (SensorValueIface *iface)
5455{
5456 iface->get_value = sensor_value_proxy_get_value;
5457 iface->get_units = sensor_value_proxy_get_units;
5458 iface->get_poll_interval = sensor_value_proxy_get_poll_interval;
5459 iface->get_heatbeat = sensor_value_proxy_get_heatbeat;
5460 iface->get_settable = sensor_value_proxy_get_settable;
Norman James362a80f2015-09-14 14:04:39 -05005461}
5462
5463/**
5464 * sensor_value_proxy_new:
5465 * @connection: A #GDBusConnection.
5466 * @flags: Flags from the #GDBusProxyFlags enumeration.
5467 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
5468 * @object_path: An object path.
5469 * @cancellable: (allow-none): A #GCancellable or %NULL.
5470 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
5471 * @user_data: User data to pass to @callback.
5472 *
5473 * 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.
5474 *
5475 * 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.
5476 * You can then call sensor_value_proxy_new_finish() to get the result of the operation.
5477 *
5478 * See sensor_value_proxy_new_sync() for the synchronous, blocking version of this constructor.
5479 */
5480void
5481sensor_value_proxy_new (
5482 GDBusConnection *connection,
5483 GDBusProxyFlags flags,
5484 const gchar *name,
5485 const gchar *object_path,
5486 GCancellable *cancellable,
5487 GAsyncReadyCallback callback,
5488 gpointer user_data)
5489{
5490 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);
5491}
5492
5493/**
5494 * sensor_value_proxy_new_finish:
5495 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_proxy_new().
5496 * @error: Return location for error or %NULL
5497 *
5498 * Finishes an operation started with sensor_value_proxy_new().
5499 *
5500 * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set.
5501 */
5502SensorValue *
5503sensor_value_proxy_new_finish (
5504 GAsyncResult *res,
5505 GError **error)
5506{
5507 GObject *ret;
5508 GObject *source_object;
5509 source_object = g_async_result_get_source_object (res);
5510 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
5511 g_object_unref (source_object);
5512 if (ret != NULL)
5513 return SENSOR_VALUE (ret);
5514 else
5515 return NULL;
5516}
5517
5518/**
5519 * sensor_value_proxy_new_sync:
5520 * @connection: A #GDBusConnection.
5521 * @flags: Flags from the #GDBusProxyFlags enumeration.
5522 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
5523 * @object_path: An object path.
5524 * @cancellable: (allow-none): A #GCancellable or %NULL.
5525 * @error: Return location for error or %NULL
5526 *
5527 * 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.
5528 *
5529 * The calling thread is blocked until a reply is received.
5530 *
5531 * See sensor_value_proxy_new() for the asynchronous version of this constructor.
5532 *
5533 * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set.
5534 */
5535SensorValue *
5536sensor_value_proxy_new_sync (
5537 GDBusConnection *connection,
5538 GDBusProxyFlags flags,
5539 const gchar *name,
5540 const gchar *object_path,
5541 GCancellable *cancellable,
5542 GError **error)
5543{
5544 GInitable *ret;
5545 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);
5546 if (ret != NULL)
5547 return SENSOR_VALUE (ret);
5548 else
5549 return NULL;
5550}
5551
5552
5553/**
5554 * sensor_value_proxy_new_for_bus:
5555 * @bus_type: A #GBusType.
5556 * @flags: Flags from the #GDBusProxyFlags enumeration.
5557 * @name: A bus name (well-known or unique).
5558 * @object_path: An object path.
5559 * @cancellable: (allow-none): A #GCancellable or %NULL.
5560 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
5561 * @user_data: User data to pass to @callback.
5562 *
5563 * Like sensor_value_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
5564 *
5565 * 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.
5566 * You can then call sensor_value_proxy_new_for_bus_finish() to get the result of the operation.
5567 *
5568 * See sensor_value_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
5569 */
5570void
5571sensor_value_proxy_new_for_bus (
5572 GBusType bus_type,
5573 GDBusProxyFlags flags,
5574 const gchar *name,
5575 const gchar *object_path,
5576 GCancellable *cancellable,
5577 GAsyncReadyCallback callback,
5578 gpointer user_data)
5579{
5580 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);
5581}
5582
5583/**
5584 * sensor_value_proxy_new_for_bus_finish:
5585 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_proxy_new_for_bus().
5586 * @error: Return location for error or %NULL
5587 *
5588 * Finishes an operation started with sensor_value_proxy_new_for_bus().
5589 *
5590 * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set.
5591 */
5592SensorValue *
5593sensor_value_proxy_new_for_bus_finish (
5594 GAsyncResult *res,
5595 GError **error)
5596{
5597 GObject *ret;
5598 GObject *source_object;
5599 source_object = g_async_result_get_source_object (res);
5600 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
5601 g_object_unref (source_object);
5602 if (ret != NULL)
5603 return SENSOR_VALUE (ret);
5604 else
5605 return NULL;
5606}
5607
5608/**
5609 * sensor_value_proxy_new_for_bus_sync:
5610 * @bus_type: A #GBusType.
5611 * @flags: Flags from the #GDBusProxyFlags enumeration.
5612 * @name: A bus name (well-known or unique).
5613 * @object_path: An object path.
5614 * @cancellable: (allow-none): A #GCancellable or %NULL.
5615 * @error: Return location for error or %NULL
5616 *
5617 * Like sensor_value_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
5618 *
5619 * The calling thread is blocked until a reply is received.
5620 *
5621 * See sensor_value_proxy_new_for_bus() for the asynchronous version of this constructor.
5622 *
5623 * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set.
5624 */
5625SensorValue *
5626sensor_value_proxy_new_for_bus_sync (
5627 GBusType bus_type,
5628 GDBusProxyFlags flags,
5629 const gchar *name,
5630 const gchar *object_path,
5631 GCancellable *cancellable,
5632 GError **error)
5633{
5634 GInitable *ret;
5635 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);
5636 if (ret != NULL)
5637 return SENSOR_VALUE (ret);
5638 else
5639 return NULL;
5640}
5641
5642
5643/* ------------------------------------------------------------------------ */
5644
5645/**
5646 * SensorValueSkeleton:
5647 *
5648 * The #SensorValueSkeleton structure contains only private data and should only be accessed using the provided API.
5649 */
5650
5651/**
5652 * SensorValueSkeletonClass:
5653 * @parent_class: The parent class.
5654 *
5655 * Class structure for #SensorValueSkeleton.
5656 */
5657
5658struct _SensorValueSkeletonPrivate
5659{
5660 GValue *properties;
5661 GList *changed_properties;
5662 GSource *changed_properties_idle_source;
5663 GMainContext *context;
5664 GMutex lock;
5665};
5666
5667static void
5668_sensor_value_skeleton_handle_method_call (
5669 GDBusConnection *connection G_GNUC_UNUSED,
5670 const gchar *sender G_GNUC_UNUSED,
5671 const gchar *object_path G_GNUC_UNUSED,
5672 const gchar *interface_name,
5673 const gchar *method_name,
5674 GVariant *parameters,
5675 GDBusMethodInvocation *invocation,
5676 gpointer user_data)
5677{
5678 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data);
5679 _ExtendedGDBusMethodInfo *info;
5680 GVariantIter iter;
5681 GVariant *child;
5682 GValue *paramv;
5683 guint num_params;
5684 guint num_extra;
5685 guint n;
5686 guint signal_id;
5687 GValue return_value = G_VALUE_INIT;
5688 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
5689 g_assert (info != NULL);
5690 num_params = g_variant_n_children (parameters);
5691 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
5692 n = 0;
5693 g_value_init (&paramv[n], TYPE_SENSOR_VALUE);
5694 g_value_set_object (&paramv[n++], skeleton);
5695 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
5696 g_value_set_object (&paramv[n++], invocation);
5697 if (info->pass_fdlist)
5698 {
5699#ifdef G_OS_UNIX
5700 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
5701 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
5702#else
5703 g_assert_not_reached ();
5704#endif
5705 }
5706 g_variant_iter_init (&iter, parameters);
5707 while ((child = g_variant_iter_next_value (&iter)) != NULL)
5708 {
5709 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
5710 if (arg_info->use_gvariant)
5711 {
5712 g_value_init (&paramv[n], G_TYPE_VARIANT);
5713 g_value_set_variant (&paramv[n], child);
5714 n++;
5715 }
5716 else
5717 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
5718 g_variant_unref (child);
5719 }
5720 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_VALUE);
5721 g_value_init (&return_value, G_TYPE_BOOLEAN);
5722 g_signal_emitv (paramv, signal_id, 0, &return_value);
5723 if (!g_value_get_boolean (&return_value))
5724 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);
5725 g_value_unset (&return_value);
5726 for (n = 0; n < num_params + num_extra; n++)
5727 g_value_unset (&paramv[n]);
5728 g_free (paramv);
5729}
5730
5731static GVariant *
5732_sensor_value_skeleton_handle_get_property (
5733 GDBusConnection *connection G_GNUC_UNUSED,
5734 const gchar *sender G_GNUC_UNUSED,
5735 const gchar *object_path G_GNUC_UNUSED,
5736 const gchar *interface_name G_GNUC_UNUSED,
5737 const gchar *property_name,
5738 GError **error,
5739 gpointer user_data)
5740{
5741 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data);
5742 GValue value = G_VALUE_INIT;
5743 GParamSpec *pspec;
5744 _ExtendedGDBusPropertyInfo *info;
5745 GVariant *ret;
5746 ret = NULL;
5747 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, property_name);
5748 g_assert (info != NULL);
5749 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
5750 if (pspec == NULL)
5751 {
5752 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
5753 }
5754 else
5755 {
5756 g_value_init (&value, pspec->value_type);
5757 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
5758 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
5759 g_value_unset (&value);
5760 }
5761 return ret;
5762}
5763
5764static gboolean
5765_sensor_value_skeleton_handle_set_property (
5766 GDBusConnection *connection G_GNUC_UNUSED,
5767 const gchar *sender G_GNUC_UNUSED,
5768 const gchar *object_path G_GNUC_UNUSED,
5769 const gchar *interface_name G_GNUC_UNUSED,
5770 const gchar *property_name,
5771 GVariant *variant,
5772 GError **error,
5773 gpointer user_data)
5774{
5775 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data);
5776 GValue value = G_VALUE_INIT;
5777 GParamSpec *pspec;
5778 _ExtendedGDBusPropertyInfo *info;
5779 gboolean ret;
5780 ret = FALSE;
5781 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, property_name);
5782 g_assert (info != NULL);
5783 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
5784 if (pspec == NULL)
5785 {
5786 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
5787 }
5788 else
5789 {
5790 if (info->use_gvariant)
5791 g_value_set_variant (&value, variant);
5792 else
5793 g_dbus_gvariant_to_gvalue (variant, &value);
5794 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
5795 g_value_unset (&value);
5796 ret = TRUE;
5797 }
5798 return ret;
5799}
5800
5801static const GDBusInterfaceVTable _sensor_value_skeleton_vtable =
5802{
5803 _sensor_value_skeleton_handle_method_call,
5804 _sensor_value_skeleton_handle_get_property,
5805 _sensor_value_skeleton_handle_set_property,
5806 {NULL}
5807};
5808
5809static GDBusInterfaceInfo *
5810sensor_value_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
5811{
5812 return sensor_value_interface_info ();
5813}
5814
5815static GDBusInterfaceVTable *
5816sensor_value_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
5817{
5818 return (GDBusInterfaceVTable *) &_sensor_value_skeleton_vtable;
5819}
5820
5821static GVariant *
5822sensor_value_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
5823{
5824 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (_skeleton);
5825
5826 GVariantBuilder builder;
5827 guint n;
5828 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
5829 if (_sensor_value_interface_info.parent_struct.properties == NULL)
5830 goto out;
5831 for (n = 0; _sensor_value_interface_info.parent_struct.properties[n] != NULL; n++)
5832 {
5833 GDBusPropertyInfo *info = _sensor_value_interface_info.parent_struct.properties[n];
5834 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
5835 {
5836 GVariant *value;
5837 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);
5838 if (value != NULL)
5839 {
5840 g_variant_take_ref (value);
5841 g_variant_builder_add (&builder, "{sv}", info->name, value);
5842 g_variant_unref (value);
5843 }
5844 }
5845 }
5846out:
5847 return g_variant_builder_end (&builder);
5848}
5849
5850static gboolean _sensor_value_emit_changed (gpointer user_data);
5851
5852static void
5853sensor_value_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
5854{
5855 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (_skeleton);
5856 gboolean emit_changed = FALSE;
5857
5858 g_mutex_lock (&skeleton->priv->lock);
5859 if (skeleton->priv->changed_properties_idle_source != NULL)
5860 {
5861 g_source_destroy (skeleton->priv->changed_properties_idle_source);
5862 skeleton->priv->changed_properties_idle_source = NULL;
5863 emit_changed = TRUE;
5864 }
5865 g_mutex_unlock (&skeleton->priv->lock);
5866
5867 if (emit_changed)
5868 _sensor_value_emit_changed (skeleton);
5869}
5870
5871static void
5872_sensor_value_on_signal_changed (
5873 SensorValue *object,
5874 GVariant *arg_value,
5875 const gchar *arg_units)
5876{
5877 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5878
5879 GList *connections, *l;
5880 GVariant *signal_variant;
5881 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
5882
5883 signal_variant = g_variant_ref_sink (g_variant_new ("(@vs)",
5884 arg_value,
5885 arg_units));
5886 for (l = connections; l != NULL; l = l->next)
5887 {
5888 GDBusConnection *connection = l->data;
5889 g_dbus_connection_emit_signal (connection,
5890 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorValue", "Changed",
5891 signal_variant, NULL);
5892 }
5893 g_variant_unref (signal_variant);
5894 g_list_free_full (connections, g_object_unref);
5895}
5896
5897static void
Norman James32e74e22015-09-15 21:28:06 -05005898_sensor_value_on_signal_error (
5899 SensorValue *object)
5900{
5901 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5902
5903 GList *connections, *l;
5904 GVariant *signal_variant;
5905 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
5906
5907 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
5908 for (l = connections; l != NULL; l = l->next)
5909 {
5910 GDBusConnection *connection = l->data;
5911 g_dbus_connection_emit_signal (connection,
5912 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorValue", "Error",
5913 signal_variant, NULL);
5914 }
5915 g_variant_unref (signal_variant);
5916 g_list_free_full (connections, g_object_unref);
5917}
5918
5919static void
Norman James362a80f2015-09-14 14:04:39 -05005920_sensor_value_on_signal_heartbeat (
5921 SensorValue *object,
5922 const gchar *arg_bus_name)
5923{
5924 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5925
5926 GList *connections, *l;
5927 GVariant *signal_variant;
5928 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
5929
5930 signal_variant = g_variant_ref_sink (g_variant_new ("(s)",
5931 arg_bus_name));
5932 for (l = connections; l != NULL; l = l->next)
5933 {
5934 GDBusConnection *connection = l->data;
5935 g_dbus_connection_emit_signal (connection,
5936 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorValue", "Heartbeat",
5937 signal_variant, NULL);
5938 }
5939 g_variant_unref (signal_variant);
5940 g_list_free_full (connections, g_object_unref);
5941}
5942
5943static void sensor_value_skeleton_iface_init (SensorValueIface *iface);
5944#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
5945G_DEFINE_TYPE_WITH_CODE (SensorValueSkeleton, sensor_value_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
5946 G_ADD_PRIVATE (SensorValueSkeleton)
5947 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_skeleton_iface_init));
5948
5949#else
5950G_DEFINE_TYPE_WITH_CODE (SensorValueSkeleton, sensor_value_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
5951 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_skeleton_iface_init));
5952
5953#endif
5954static void
5955sensor_value_skeleton_finalize (GObject *object)
5956{
5957 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5958 guint n;
Norman Jamesdfdaca92015-09-27 22:11:15 -05005959 for (n = 0; n < 5; n++)
Norman James362a80f2015-09-14 14:04:39 -05005960 g_value_unset (&skeleton->priv->properties[n]);
5961 g_free (skeleton->priv->properties);
5962 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
5963 if (skeleton->priv->changed_properties_idle_source != NULL)
5964 g_source_destroy (skeleton->priv->changed_properties_idle_source);
5965 g_main_context_unref (skeleton->priv->context);
5966 g_mutex_clear (&skeleton->priv->lock);
5967 G_OBJECT_CLASS (sensor_value_skeleton_parent_class)->finalize (object);
5968}
5969
5970static void
5971sensor_value_skeleton_get_property (GObject *object,
5972 guint prop_id,
5973 GValue *value,
5974 GParamSpec *pspec G_GNUC_UNUSED)
5975{
5976 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
Norman Jamesdfdaca92015-09-27 22:11:15 -05005977 g_assert (prop_id != 0 && prop_id - 1 < 5);
Norman James362a80f2015-09-14 14:04:39 -05005978 g_mutex_lock (&skeleton->priv->lock);
5979 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
5980 g_mutex_unlock (&skeleton->priv->lock);
5981}
5982
5983static gboolean
5984_sensor_value_emit_changed (gpointer user_data)
5985{
5986 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data);
5987 GList *l;
5988 GVariantBuilder builder;
5989 GVariantBuilder invalidated_builder;
5990 guint num_changes;
5991
5992 g_mutex_lock (&skeleton->priv->lock);
5993 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
5994 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
5995 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
5996 {
5997 ChangedProperty *cp = l->data;
5998 GVariant *variant;
5999 const GValue *cur_value;
6000
6001 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
6002 if (!_g_value_equal (cur_value, &cp->orig_value))
6003 {
6004 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
6005 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
6006 g_variant_unref (variant);
6007 num_changes++;
6008 }
6009 }
6010 if (num_changes > 0)
6011 {
6012 GList *connections, *ll;
6013 GVariant *signal_variant;
6014 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorValue",
6015 &builder, &invalidated_builder));
6016 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
6017 for (ll = connections; ll != NULL; ll = ll->next)
6018 {
6019 GDBusConnection *connection = ll->data;
6020
6021 g_dbus_connection_emit_signal (connection,
6022 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
6023 "org.freedesktop.DBus.Properties",
6024 "PropertiesChanged",
6025 signal_variant,
6026 NULL);
6027 }
6028 g_variant_unref (signal_variant);
6029 g_list_free_full (connections, g_object_unref);
6030 }
6031 else
6032 {
6033 g_variant_builder_clear (&builder);
6034 g_variant_builder_clear (&invalidated_builder);
6035 }
6036 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
6037 skeleton->priv->changed_properties = NULL;
6038 skeleton->priv->changed_properties_idle_source = NULL;
6039 g_mutex_unlock (&skeleton->priv->lock);
6040 return FALSE;
6041}
6042
6043static void
6044_sensor_value_schedule_emit_changed (SensorValueSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
6045{
6046 ChangedProperty *cp;
6047 GList *l;
6048 cp = NULL;
6049 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
6050 {
6051 ChangedProperty *i_cp = l->data;
6052 if (i_cp->info == info)
6053 {
6054 cp = i_cp;
6055 break;
6056 }
6057 }
6058 if (cp == NULL)
6059 {
6060 cp = g_new0 (ChangedProperty, 1);
6061 cp->prop_id = prop_id;
6062 cp->info = info;
6063 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
6064 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
6065 g_value_copy (orig_value, &cp->orig_value);
6066 }
6067}
6068
6069static void
6070sensor_value_skeleton_notify (GObject *object,
6071 GParamSpec *pspec G_GNUC_UNUSED)
6072{
6073 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
6074 g_mutex_lock (&skeleton->priv->lock);
6075 if (skeleton->priv->changed_properties != NULL &&
6076 skeleton->priv->changed_properties_idle_source == NULL)
6077 {
6078 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
6079 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
6080 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_value_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
6081 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
6082 g_source_unref (skeleton->priv->changed_properties_idle_source);
6083 }
6084 g_mutex_unlock (&skeleton->priv->lock);
6085}
6086
6087static void
6088sensor_value_skeleton_set_property (GObject *object,
6089 guint prop_id,
6090 const GValue *value,
6091 GParamSpec *pspec)
6092{
6093 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
Norman Jamesdfdaca92015-09-27 22:11:15 -05006094 g_assert (prop_id != 0 && prop_id - 1 < 5);
Norman James362a80f2015-09-14 14:04:39 -05006095 g_mutex_lock (&skeleton->priv->lock);
6096 g_object_freeze_notify (object);
6097 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
6098 {
6099 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
6100 _sensor_value_schedule_emit_changed (skeleton, _sensor_value_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
6101 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
6102 g_object_notify_by_pspec (object, pspec);
6103 }
6104 g_mutex_unlock (&skeleton->priv->lock);
6105 g_object_thaw_notify (object);
6106}
6107
6108static void
6109sensor_value_skeleton_init (SensorValueSkeleton *skeleton)
6110{
6111#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
6112 skeleton->priv = sensor_value_skeleton_get_instance_private (skeleton);
6113#else
6114 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_VALUE_SKELETON, SensorValueSkeletonPrivate);
6115#endif
6116
6117 g_mutex_init (&skeleton->priv->lock);
6118 skeleton->priv->context = g_main_context_ref_thread_default ();
Norman Jamesdfdaca92015-09-27 22:11:15 -05006119 skeleton->priv->properties = g_new0 (GValue, 5);
Norman James362a80f2015-09-14 14:04:39 -05006120 g_value_init (&skeleton->priv->properties[0], G_TYPE_VARIANT);
6121 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
6122 g_value_init (&skeleton->priv->properties[2], G_TYPE_INT);
6123 g_value_init (&skeleton->priv->properties[3], G_TYPE_INT);
6124 g_value_init (&skeleton->priv->properties[4], G_TYPE_BOOLEAN);
Norman James362a80f2015-09-14 14:04:39 -05006125}
6126
6127static GVariant *
6128sensor_value_skeleton_get_value (SensorValue *object)
6129{
6130 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
6131 GVariant *value;
6132 g_mutex_lock (&skeleton->priv->lock);
6133 value = g_value_get_variant (&(skeleton->priv->properties[0]));
6134 g_mutex_unlock (&skeleton->priv->lock);
6135 return value;
6136}
6137
6138static const gchar *
6139sensor_value_skeleton_get_units (SensorValue *object)
6140{
6141 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
6142 const gchar *value;
6143 g_mutex_lock (&skeleton->priv->lock);
6144 value = g_value_get_string (&(skeleton->priv->properties[1]));
6145 g_mutex_unlock (&skeleton->priv->lock);
6146 return value;
6147}
6148
6149static gint
6150sensor_value_skeleton_get_poll_interval (SensorValue *object)
6151{
6152 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
6153 gint value;
6154 g_mutex_lock (&skeleton->priv->lock);
6155 value = g_value_get_int (&(skeleton->priv->properties[2]));
6156 g_mutex_unlock (&skeleton->priv->lock);
6157 return value;
6158}
6159
6160static gint
6161sensor_value_skeleton_get_heatbeat (SensorValue *object)
6162{
6163 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
6164 gint value;
6165 g_mutex_lock (&skeleton->priv->lock);
6166 value = g_value_get_int (&(skeleton->priv->properties[3]));
6167 g_mutex_unlock (&skeleton->priv->lock);
6168 return value;
6169}
6170
6171static gboolean
6172sensor_value_skeleton_get_settable (SensorValue *object)
6173{
6174 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
6175 gboolean value;
6176 g_mutex_lock (&skeleton->priv->lock);
6177 value = g_value_get_boolean (&(skeleton->priv->properties[4]));
6178 g_mutex_unlock (&skeleton->priv->lock);
6179 return value;
6180}
6181
Norman James362a80f2015-09-14 14:04:39 -05006182static void
6183sensor_value_skeleton_class_init (SensorValueSkeletonClass *klass)
6184{
6185 GObjectClass *gobject_class;
6186 GDBusInterfaceSkeletonClass *skeleton_class;
6187
6188 gobject_class = G_OBJECT_CLASS (klass);
6189 gobject_class->finalize = sensor_value_skeleton_finalize;
6190 gobject_class->get_property = sensor_value_skeleton_get_property;
6191 gobject_class->set_property = sensor_value_skeleton_set_property;
6192 gobject_class->notify = sensor_value_skeleton_notify;
6193
6194
6195 sensor_value_override_properties (gobject_class, 1);
6196
6197 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
6198 skeleton_class->get_info = sensor_value_skeleton_dbus_interface_get_info;
6199 skeleton_class->get_properties = sensor_value_skeleton_dbus_interface_get_properties;
6200 skeleton_class->flush = sensor_value_skeleton_dbus_interface_flush;
6201 skeleton_class->get_vtable = sensor_value_skeleton_dbus_interface_get_vtable;
6202
6203#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
6204 g_type_class_add_private (klass, sizeof (SensorValueSkeletonPrivate));
6205#endif
6206}
6207
6208static void
6209sensor_value_skeleton_iface_init (SensorValueIface *iface)
6210{
6211 iface->changed = _sensor_value_on_signal_changed;
Norman James32e74e22015-09-15 21:28:06 -05006212 iface->error = _sensor_value_on_signal_error;
Norman James362a80f2015-09-14 14:04:39 -05006213 iface->heartbeat = _sensor_value_on_signal_heartbeat;
6214 iface->get_value = sensor_value_skeleton_get_value;
6215 iface->get_units = sensor_value_skeleton_get_units;
6216 iface->get_poll_interval = sensor_value_skeleton_get_poll_interval;
6217 iface->get_heatbeat = sensor_value_skeleton_get_heatbeat;
6218 iface->get_settable = sensor_value_skeleton_get_settable;
Norman James362a80f2015-09-14 14:04:39 -05006219}
6220
6221/**
6222 * sensor_value_skeleton_new:
6223 *
6224 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link>.
6225 *
6226 * Returns: (transfer full) (type SensorValueSkeleton): The skeleton object.
6227 */
6228SensorValue *
6229sensor_value_skeleton_new (void)
6230{
6231 return SENSOR_VALUE (g_object_new (TYPE_SENSOR_VALUE_SKELETON, NULL));
6232}
6233
6234/* ------------------------------------------------------------------------
6235 * Code for interface org.openbmc.SensorThreshold
6236 * ------------------------------------------------------------------------
6237 */
6238
6239/**
6240 * SECTION:SensorThreshold
6241 * @title: SensorThreshold
6242 * @short_description: Generated C code for the org.openbmc.SensorThreshold D-Bus interface
6243 *
6244 * 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.
6245 */
6246
6247/* ---- Introspection data for org.openbmc.SensorThreshold ---- */
6248
6249static const _ExtendedGDBusArgInfo _sensor_threshold_method_info_get_state_OUT_ARG_state =
6250{
6251 {
6252 -1,
6253 (gchar *) "state",
6254 (gchar *) "y",
6255 NULL
6256 },
6257 FALSE
6258};
6259
6260static const _ExtendedGDBusArgInfo * const _sensor_threshold_method_info_get_state_OUT_ARG_pointers[] =
6261{
6262 &_sensor_threshold_method_info_get_state_OUT_ARG_state,
6263 NULL
6264};
6265
6266static const _ExtendedGDBusMethodInfo _sensor_threshold_method_info_get_state =
6267{
6268 {
6269 -1,
6270 (gchar *) "getState",
6271 NULL,
6272 (GDBusArgInfo **) &_sensor_threshold_method_info_get_state_OUT_ARG_pointers,
6273 NULL
6274 },
6275 "handle-get-state",
6276 FALSE
6277};
6278
6279static const _ExtendedGDBusMethodInfo * const _sensor_threshold_method_info_pointers[] =
6280{
6281 &_sensor_threshold_method_info_get_state,
6282 NULL
6283};
6284
6285static const _ExtendedGDBusSignalInfo _sensor_threshold_signal_info_warning =
6286{
6287 {
6288 -1,
6289 (gchar *) "Warning",
6290 NULL,
6291 NULL
6292 },
6293 "warning"
6294};
6295
6296static const _ExtendedGDBusSignalInfo _sensor_threshold_signal_info_critical =
6297{
6298 {
6299 -1,
6300 (gchar *) "Critical",
6301 NULL,
6302 NULL
6303 },
6304 "critical"
6305};
6306
6307static const _ExtendedGDBusSignalInfo _sensor_threshold_signal_info_normal =
6308{
6309 {
6310 -1,
6311 (gchar *) "Normal",
6312 NULL,
6313 NULL
6314 },
6315 "normal"
6316};
6317
6318static const _ExtendedGDBusSignalInfo * const _sensor_threshold_signal_info_pointers[] =
6319{
6320 &_sensor_threshold_signal_info_warning,
6321 &_sensor_threshold_signal_info_critical,
6322 &_sensor_threshold_signal_info_normal,
6323 NULL
6324};
6325
6326static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_lower_critical =
6327{
6328 {
6329 -1,
6330 (gchar *) "lower_critical",
6331 (gchar *) "v",
6332 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
6333 NULL
6334 },
6335 "lower-critical",
6336 FALSE
6337};
6338
6339static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_lower_warning =
6340{
6341 {
6342 -1,
6343 (gchar *) "lower_warning",
6344 (gchar *) "v",
6345 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
6346 NULL
6347 },
6348 "lower-warning",
6349 FALSE
6350};
6351
6352static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_upper_warning =
6353{
6354 {
6355 -1,
6356 (gchar *) "upper_warning",
6357 (gchar *) "v",
6358 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
6359 NULL
6360 },
6361 "upper-warning",
6362 FALSE
6363};
6364
6365static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_upper_critical =
6366{
6367 {
6368 -1,
6369 (gchar *) "upper_critical",
6370 (gchar *) "v",
6371 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
6372 NULL
6373 },
6374 "upper-critical",
6375 FALSE
6376};
6377
6378static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_state =
6379{
6380 {
6381 -1,
6382 (gchar *) "state",
6383 (gchar *) "y",
6384 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
6385 NULL
6386 },
6387 "state",
6388 FALSE
6389};
6390
6391static const _ExtendedGDBusPropertyInfo * const _sensor_threshold_property_info_pointers[] =
6392{
6393 &_sensor_threshold_property_info_lower_critical,
6394 &_sensor_threshold_property_info_lower_warning,
6395 &_sensor_threshold_property_info_upper_warning,
6396 &_sensor_threshold_property_info_upper_critical,
6397 &_sensor_threshold_property_info_state,
6398 NULL
6399};
6400
6401static const _ExtendedGDBusInterfaceInfo _sensor_threshold_interface_info =
6402{
6403 {
6404 -1,
6405 (gchar *) "org.openbmc.SensorThreshold",
6406 (GDBusMethodInfo **) &_sensor_threshold_method_info_pointers,
6407 (GDBusSignalInfo **) &_sensor_threshold_signal_info_pointers,
6408 (GDBusPropertyInfo **) &_sensor_threshold_property_info_pointers,
6409 NULL
6410 },
6411 "sensor-threshold",
6412};
6413
6414
6415/**
6416 * sensor_threshold_interface_info:
6417 *
6418 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link> D-Bus interface.
6419 *
6420 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
6421 */
6422GDBusInterfaceInfo *
6423sensor_threshold_interface_info (void)
6424{
6425 return (GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct;
6426}
6427
6428/**
6429 * sensor_threshold_override_properties:
6430 * @klass: The class structure for a #GObject<!-- -->-derived class.
6431 * @property_id_begin: The property id to assign to the first overridden property.
6432 *
6433 * Overrides all #GObject properties in the #SensorThreshold interface for a concrete class.
6434 * The properties are overridden in the order they are defined.
6435 *
6436 * Returns: The last property id.
6437 */
6438guint
6439sensor_threshold_override_properties (GObjectClass *klass, guint property_id_begin)
6440{
6441 g_object_class_override_property (klass, property_id_begin++, "lower-critical");
6442 g_object_class_override_property (klass, property_id_begin++, "lower-warning");
6443 g_object_class_override_property (klass, property_id_begin++, "upper-warning");
6444 g_object_class_override_property (klass, property_id_begin++, "upper-critical");
6445 g_object_class_override_property (klass, property_id_begin++, "state");
6446 return property_id_begin - 1;
6447}
6448
6449
6450
6451/**
6452 * SensorThreshold:
6453 *
6454 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link>.
6455 */
6456
6457/**
6458 * SensorThresholdIface:
6459 * @parent_iface: The parent interface.
6460 * @handle_get_state: Handler for the #SensorThreshold::handle-get-state signal.
6461 * @get_lower_critical: Getter for the #SensorThreshold:lower-critical property.
6462 * @get_lower_warning: Getter for the #SensorThreshold:lower-warning property.
6463 * @get_state: Getter for the #SensorThreshold:state property.
6464 * @get_upper_critical: Getter for the #SensorThreshold:upper-critical property.
6465 * @get_upper_warning: Getter for the #SensorThreshold:upper-warning property.
6466 * @critical: Handler for the #SensorThreshold::critical signal.
6467 * @normal: Handler for the #SensorThreshold::normal signal.
6468 * @warning: Handler for the #SensorThreshold::warning signal.
6469 *
6470 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link>.
6471 */
6472
6473typedef SensorThresholdIface SensorThresholdInterface;
6474G_DEFINE_INTERFACE (SensorThreshold, sensor_threshold, G_TYPE_OBJECT);
6475
6476static void
6477sensor_threshold_default_init (SensorThresholdIface *iface)
6478{
6479 /* GObject signals for incoming D-Bus method calls: */
6480 /**
6481 * SensorThreshold::handle-get-state:
6482 * @object: A #SensorThreshold.
6483 * @invocation: A #GDBusMethodInvocation.
6484 *
6485 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorThreshold.getState">getState()</link> D-Bus method.
6486 *
6487 * 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.
6488 *
6489 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
6490 */
6491 g_signal_new ("handle-get-state",
6492 G_TYPE_FROM_INTERFACE (iface),
6493 G_SIGNAL_RUN_LAST,
6494 G_STRUCT_OFFSET (SensorThresholdIface, handle_get_state),
6495 g_signal_accumulator_true_handled,
6496 NULL,
6497 g_cclosure_marshal_generic,
6498 G_TYPE_BOOLEAN,
6499 1,
6500 G_TYPE_DBUS_METHOD_INVOCATION);
6501
6502 /* GObject signals for received D-Bus signals: */
6503 /**
6504 * SensorThreshold::warning:
6505 * @object: A #SensorThreshold.
6506 *
6507 * 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.
6508 *
6509 * 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.
6510 */
6511 g_signal_new ("warning",
6512 G_TYPE_FROM_INTERFACE (iface),
6513 G_SIGNAL_RUN_LAST,
6514 G_STRUCT_OFFSET (SensorThresholdIface, warning),
6515 NULL,
6516 NULL,
6517 g_cclosure_marshal_generic,
6518 G_TYPE_NONE,
6519 0);
6520
6521 /**
6522 * SensorThreshold::critical:
6523 * @object: A #SensorThreshold.
6524 *
6525 * 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.
6526 *
6527 * 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.
6528 */
6529 g_signal_new ("critical",
6530 G_TYPE_FROM_INTERFACE (iface),
6531 G_SIGNAL_RUN_LAST,
6532 G_STRUCT_OFFSET (SensorThresholdIface, critical),
6533 NULL,
6534 NULL,
6535 g_cclosure_marshal_generic,
6536 G_TYPE_NONE,
6537 0);
6538
6539 /**
6540 * SensorThreshold::normal:
6541 * @object: A #SensorThreshold.
6542 *
6543 * 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.
6544 *
6545 * 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.
6546 */
6547 g_signal_new ("normal",
6548 G_TYPE_FROM_INTERFACE (iface),
6549 G_SIGNAL_RUN_LAST,
6550 G_STRUCT_OFFSET (SensorThresholdIface, normal),
6551 NULL,
6552 NULL,
6553 g_cclosure_marshal_generic,
6554 G_TYPE_NONE,
6555 0);
6556
6557 /* GObject properties for D-Bus properties: */
6558 /**
6559 * SensorThreshold:lower-critical:
6560 *
6561 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link>.
6562 *
6563 * 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.
6564 */
6565 g_object_interface_install_property (iface,
6566 g_param_spec_variant ("lower-critical", "lower_critical", "lower_critical", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
6567 /**
6568 * SensorThreshold:lower-warning:
6569 *
6570 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link>.
6571 *
6572 * 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.
6573 */
6574 g_object_interface_install_property (iface,
6575 g_param_spec_variant ("lower-warning", "lower_warning", "lower_warning", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
6576 /**
6577 * SensorThreshold:upper-warning:
6578 *
6579 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link>.
6580 *
6581 * 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.
6582 */
6583 g_object_interface_install_property (iface,
6584 g_param_spec_variant ("upper-warning", "upper_warning", "upper_warning", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
6585 /**
6586 * SensorThreshold:upper-critical:
6587 *
6588 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link>.
6589 *
6590 * 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.
6591 */
6592 g_object_interface_install_property (iface,
6593 g_param_spec_variant ("upper-critical", "upper_critical", "upper_critical", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
6594 /**
6595 * SensorThreshold:state:
6596 *
6597 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.state">"state"</link>.
6598 *
6599 * 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.
6600 */
6601 g_object_interface_install_property (iface,
6602 g_param_spec_uchar ("state", "state", "state", 0, 255, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
6603}
6604
6605/**
6606 * sensor_threshold_get_lower_critical: (skip)
6607 * @object: A #SensorThreshold.
6608 *
6609 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link> D-Bus property.
6610 *
6611 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6612 *
6613 * <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>
6614 *
6615 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
6616 */
6617GVariant *
6618sensor_threshold_get_lower_critical (SensorThreshold *object)
6619{
6620 return SENSOR_THRESHOLD_GET_IFACE (object)->get_lower_critical (object);
6621}
6622
6623/**
6624 * sensor_threshold_dup_lower_critical: (skip)
6625 * @object: A #SensorThreshold.
6626 *
6627 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link> D-Bus property.
6628 *
6629 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6630 *
6631 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
6632 */
6633GVariant *
6634sensor_threshold_dup_lower_critical (SensorThreshold *object)
6635{
6636 GVariant *value;
6637 g_object_get (G_OBJECT (object), "lower-critical", &value, NULL);
6638 return value;
6639}
6640
6641/**
6642 * sensor_threshold_set_lower_critical: (skip)
6643 * @object: A #SensorThreshold.
6644 * @value: The value to set.
6645 *
6646 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link> D-Bus property to @value.
6647 *
6648 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6649 */
6650void
6651sensor_threshold_set_lower_critical (SensorThreshold *object, GVariant *value)
6652{
6653 g_object_set (G_OBJECT (object), "lower-critical", value, NULL);
6654}
6655
6656/**
6657 * sensor_threshold_get_lower_warning: (skip)
6658 * @object: A #SensorThreshold.
6659 *
6660 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link> D-Bus property.
6661 *
6662 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6663 *
6664 * <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>
6665 *
6666 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
6667 */
6668GVariant *
6669sensor_threshold_get_lower_warning (SensorThreshold *object)
6670{
6671 return SENSOR_THRESHOLD_GET_IFACE (object)->get_lower_warning (object);
6672}
6673
6674/**
6675 * sensor_threshold_dup_lower_warning: (skip)
6676 * @object: A #SensorThreshold.
6677 *
6678 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link> D-Bus property.
6679 *
6680 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6681 *
6682 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
6683 */
6684GVariant *
6685sensor_threshold_dup_lower_warning (SensorThreshold *object)
6686{
6687 GVariant *value;
6688 g_object_get (G_OBJECT (object), "lower-warning", &value, NULL);
6689 return value;
6690}
6691
6692/**
6693 * sensor_threshold_set_lower_warning: (skip)
6694 * @object: A #SensorThreshold.
6695 * @value: The value to set.
6696 *
6697 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link> D-Bus property to @value.
6698 *
6699 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6700 */
6701void
6702sensor_threshold_set_lower_warning (SensorThreshold *object, GVariant *value)
6703{
6704 g_object_set (G_OBJECT (object), "lower-warning", value, NULL);
6705}
6706
6707/**
6708 * sensor_threshold_get_upper_warning: (skip)
6709 * @object: A #SensorThreshold.
6710 *
6711 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link> D-Bus property.
6712 *
6713 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6714 *
6715 * <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>
6716 *
6717 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
6718 */
6719GVariant *
6720sensor_threshold_get_upper_warning (SensorThreshold *object)
6721{
6722 return SENSOR_THRESHOLD_GET_IFACE (object)->get_upper_warning (object);
6723}
6724
6725/**
6726 * sensor_threshold_dup_upper_warning: (skip)
6727 * @object: A #SensorThreshold.
6728 *
6729 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link> D-Bus property.
6730 *
6731 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6732 *
6733 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
6734 */
6735GVariant *
6736sensor_threshold_dup_upper_warning (SensorThreshold *object)
6737{
6738 GVariant *value;
6739 g_object_get (G_OBJECT (object), "upper-warning", &value, NULL);
6740 return value;
6741}
6742
6743/**
6744 * sensor_threshold_set_upper_warning: (skip)
6745 * @object: A #SensorThreshold.
6746 * @value: The value to set.
6747 *
6748 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link> D-Bus property to @value.
6749 *
6750 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6751 */
6752void
6753sensor_threshold_set_upper_warning (SensorThreshold *object, GVariant *value)
6754{
6755 g_object_set (G_OBJECT (object), "upper-warning", value, NULL);
6756}
6757
6758/**
6759 * sensor_threshold_get_upper_critical: (skip)
6760 * @object: A #SensorThreshold.
6761 *
6762 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link> D-Bus property.
6763 *
6764 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6765 *
6766 * <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>
6767 *
6768 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
6769 */
6770GVariant *
6771sensor_threshold_get_upper_critical (SensorThreshold *object)
6772{
6773 return SENSOR_THRESHOLD_GET_IFACE (object)->get_upper_critical (object);
6774}
6775
6776/**
6777 * sensor_threshold_dup_upper_critical: (skip)
6778 * @object: A #SensorThreshold.
6779 *
6780 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link> D-Bus property.
6781 *
6782 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6783 *
6784 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
6785 */
6786GVariant *
6787sensor_threshold_dup_upper_critical (SensorThreshold *object)
6788{
6789 GVariant *value;
6790 g_object_get (G_OBJECT (object), "upper-critical", &value, NULL);
6791 return value;
6792}
6793
6794/**
6795 * sensor_threshold_set_upper_critical: (skip)
6796 * @object: A #SensorThreshold.
6797 * @value: The value to set.
6798 *
6799 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link> D-Bus property to @value.
6800 *
6801 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6802 */
6803void
6804sensor_threshold_set_upper_critical (SensorThreshold *object, GVariant *value)
6805{
6806 g_object_set (G_OBJECT (object), "upper-critical", value, NULL);
6807}
6808
6809/**
6810 * sensor_threshold_get_state: (skip)
6811 * @object: A #SensorThreshold.
6812 *
6813 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.state">"state"</link> D-Bus property.
6814 *
6815 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
6816 *
6817 * Returns: The property value.
6818 */
6819guchar
6820sensor_threshold_get_state (SensorThreshold *object)
6821{
6822 return SENSOR_THRESHOLD_GET_IFACE (object)->get_state (object);
6823}
6824
6825/**
6826 * sensor_threshold_set_state: (skip)
6827 * @object: A #SensorThreshold.
6828 * @value: The value to set.
6829 *
6830 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.state">"state"</link> D-Bus property to @value.
6831 *
6832 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
6833 */
6834void
6835sensor_threshold_set_state (SensorThreshold *object, guchar value)
6836{
6837 g_object_set (G_OBJECT (object), "state", value, NULL);
6838}
6839
6840/**
6841 * sensor_threshold_emit_warning:
6842 * @object: A #SensorThreshold.
6843 *
6844 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorThreshold.Warning">"Warning"</link> D-Bus signal.
6845 */
6846void
6847sensor_threshold_emit_warning (
6848 SensorThreshold *object)
6849{
6850 g_signal_emit_by_name (object, "warning");
6851}
6852
6853/**
6854 * sensor_threshold_emit_critical:
6855 * @object: A #SensorThreshold.
6856 *
6857 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorThreshold.Critical">"Critical"</link> D-Bus signal.
6858 */
6859void
6860sensor_threshold_emit_critical (
6861 SensorThreshold *object)
6862{
6863 g_signal_emit_by_name (object, "critical");
6864}
6865
6866/**
6867 * sensor_threshold_emit_normal:
6868 * @object: A #SensorThreshold.
6869 *
6870 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorThreshold.Normal">"Normal"</link> D-Bus signal.
6871 */
6872void
6873sensor_threshold_emit_normal (
6874 SensorThreshold *object)
6875{
6876 g_signal_emit_by_name (object, "normal");
6877}
6878
6879/**
6880 * sensor_threshold_call_get_state:
6881 * @proxy: A #SensorThresholdProxy.
6882 * @cancellable: (allow-none): A #GCancellable or %NULL.
6883 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
6884 * @user_data: User data to pass to @callback.
6885 *
6886 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorThreshold.getState">getState()</link> D-Bus method on @proxy.
6887 * 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.
6888 * You can then call sensor_threshold_call_get_state_finish() to get the result of the operation.
6889 *
6890 * See sensor_threshold_call_get_state_sync() for the synchronous, blocking version of this method.
6891 */
6892void
6893sensor_threshold_call_get_state (
6894 SensorThreshold *proxy,
6895 GCancellable *cancellable,
6896 GAsyncReadyCallback callback,
6897 gpointer user_data)
6898{
6899 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
6900 "getState",
6901 g_variant_new ("()"),
6902 G_DBUS_CALL_FLAGS_NONE,
6903 -1,
6904 cancellable,
6905 callback,
6906 user_data);
6907}
6908
6909/**
6910 * sensor_threshold_call_get_state_finish:
6911 * @proxy: A #SensorThresholdProxy.
6912 * @out_state: (out): Return location for return parameter or %NULL to ignore.
6913 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_threshold_call_get_state().
6914 * @error: Return location for error or %NULL.
6915 *
6916 * Finishes an operation started with sensor_threshold_call_get_state().
6917 *
6918 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
6919 */
6920gboolean
6921sensor_threshold_call_get_state_finish (
6922 SensorThreshold *proxy,
6923 guchar *out_state,
6924 GAsyncResult *res,
6925 GError **error)
6926{
6927 GVariant *_ret;
6928 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
6929 if (_ret == NULL)
6930 goto _out;
6931 g_variant_get (_ret,
6932 "(y)",
6933 out_state);
6934 g_variant_unref (_ret);
6935_out:
6936 return _ret != NULL;
6937}
6938
6939/**
6940 * sensor_threshold_call_get_state_sync:
6941 * @proxy: A #SensorThresholdProxy.
6942 * @out_state: (out): Return location for return parameter or %NULL to ignore.
6943 * @cancellable: (allow-none): A #GCancellable or %NULL.
6944 * @error: Return location for error or %NULL.
6945 *
6946 * 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.
6947 *
6948 * See sensor_threshold_call_get_state() for the asynchronous version of this method.
6949 *
6950 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
6951 */
6952gboolean
6953sensor_threshold_call_get_state_sync (
6954 SensorThreshold *proxy,
6955 guchar *out_state,
6956 GCancellable *cancellable,
6957 GError **error)
6958{
6959 GVariant *_ret;
6960 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
6961 "getState",
6962 g_variant_new ("()"),
6963 G_DBUS_CALL_FLAGS_NONE,
6964 -1,
6965 cancellable,
6966 error);
6967 if (_ret == NULL)
6968 goto _out;
6969 g_variant_get (_ret,
6970 "(y)",
6971 out_state);
6972 g_variant_unref (_ret);
6973_out:
6974 return _ret != NULL;
6975}
6976
6977/**
6978 * sensor_threshold_complete_get_state:
6979 * @object: A #SensorThreshold.
6980 * @invocation: (transfer full): A #GDBusMethodInvocation.
6981 * @state: Parameter to return.
6982 *
6983 * 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.
6984 *
6985 * This method will free @invocation, you cannot use it afterwards.
6986 */
6987void
6988sensor_threshold_complete_get_state (
6989 SensorThreshold *object,
6990 GDBusMethodInvocation *invocation,
6991 guchar state)
6992{
6993 g_dbus_method_invocation_return_value (invocation,
6994 g_variant_new ("(y)",
6995 state));
6996}
6997
6998/* ------------------------------------------------------------------------ */
6999
7000/**
7001 * SensorThresholdProxy:
7002 *
7003 * The #SensorThresholdProxy structure contains only private data and should only be accessed using the provided API.
7004 */
7005
7006/**
7007 * SensorThresholdProxyClass:
7008 * @parent_class: The parent class.
7009 *
7010 * Class structure for #SensorThresholdProxy.
7011 */
7012
7013struct _SensorThresholdProxyPrivate
7014{
7015 GData *qdata;
7016};
7017
7018static void sensor_threshold_proxy_iface_init (SensorThresholdIface *iface);
7019
7020#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
7021G_DEFINE_TYPE_WITH_CODE (SensorThresholdProxy, sensor_threshold_proxy, G_TYPE_DBUS_PROXY,
7022 G_ADD_PRIVATE (SensorThresholdProxy)
7023 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_proxy_iface_init));
7024
7025#else
7026G_DEFINE_TYPE_WITH_CODE (SensorThresholdProxy, sensor_threshold_proxy, G_TYPE_DBUS_PROXY,
7027 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_proxy_iface_init));
7028
7029#endif
7030static void
7031sensor_threshold_proxy_finalize (GObject *object)
7032{
7033 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
7034 g_datalist_clear (&proxy->priv->qdata);
7035 G_OBJECT_CLASS (sensor_threshold_proxy_parent_class)->finalize (object);
7036}
7037
7038static void
7039sensor_threshold_proxy_get_property (GObject *object,
7040 guint prop_id,
7041 GValue *value,
7042 GParamSpec *pspec G_GNUC_UNUSED)
7043{
7044 const _ExtendedGDBusPropertyInfo *info;
7045 GVariant *variant;
7046 g_assert (prop_id != 0 && prop_id - 1 < 5);
7047 info = _sensor_threshold_property_info_pointers[prop_id - 1];
7048 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
7049 if (info->use_gvariant)
7050 {
7051 g_value_set_variant (value, variant);
7052 }
7053 else
7054 {
7055 if (variant != NULL)
7056 g_dbus_gvariant_to_gvalue (variant, value);
7057 }
7058 if (variant != NULL)
7059 g_variant_unref (variant);
7060}
7061
7062static void
7063sensor_threshold_proxy_set_property_cb (GDBusProxy *proxy,
7064 GAsyncResult *res,
7065 gpointer user_data)
7066{
7067 const _ExtendedGDBusPropertyInfo *info = user_data;
7068 GError *error;
7069 GVariant *_ret;
7070 error = NULL;
7071 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
7072 if (!_ret)
7073 {
7074 g_warning ("Error setting property '%s' on interface org.openbmc.SensorThreshold: %s (%s, %d)",
7075 info->parent_struct.name,
7076 error->message, g_quark_to_string (error->domain), error->code);
7077 g_error_free (error);
7078 }
7079 else
7080 {
7081 g_variant_unref (_ret);
7082 }
7083}
7084
7085static void
7086sensor_threshold_proxy_set_property (GObject *object,
7087 guint prop_id,
7088 const GValue *value,
7089 GParamSpec *pspec G_GNUC_UNUSED)
7090{
7091 const _ExtendedGDBusPropertyInfo *info;
7092 GVariant *variant;
7093 g_assert (prop_id != 0 && prop_id - 1 < 5);
7094 info = _sensor_threshold_property_info_pointers[prop_id - 1];
7095 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
7096 g_dbus_proxy_call (G_DBUS_PROXY (object),
7097 "org.freedesktop.DBus.Properties.Set",
7098 g_variant_new ("(ssv)", "org.openbmc.SensorThreshold", info->parent_struct.name, variant),
7099 G_DBUS_CALL_FLAGS_NONE,
7100 -1,
7101 NULL, (GAsyncReadyCallback) sensor_threshold_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
7102 g_variant_unref (variant);
7103}
7104
7105static void
7106sensor_threshold_proxy_g_signal (GDBusProxy *proxy,
7107 const gchar *sender_name G_GNUC_UNUSED,
7108 const gchar *signal_name,
7109 GVariant *parameters)
7110{
7111 _ExtendedGDBusSignalInfo *info;
7112 GVariantIter iter;
7113 GVariant *child;
7114 GValue *paramv;
7115 guint num_params;
7116 guint n;
7117 guint signal_id;
7118 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, signal_name);
7119 if (info == NULL)
7120 return;
7121 num_params = g_variant_n_children (parameters);
7122 paramv = g_new0 (GValue, num_params + 1);
7123 g_value_init (&paramv[0], TYPE_SENSOR_THRESHOLD);
7124 g_value_set_object (&paramv[0], proxy);
7125 g_variant_iter_init (&iter, parameters);
7126 n = 1;
7127 while ((child = g_variant_iter_next_value (&iter)) != NULL)
7128 {
7129 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
7130 if (arg_info->use_gvariant)
7131 {
7132 g_value_init (&paramv[n], G_TYPE_VARIANT);
7133 g_value_set_variant (&paramv[n], child);
7134 n++;
7135 }
7136 else
7137 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
7138 g_variant_unref (child);
7139 }
7140 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_THRESHOLD);
7141 g_signal_emitv (paramv, signal_id, 0, NULL);
7142 for (n = 0; n < num_params + 1; n++)
7143 g_value_unset (&paramv[n]);
7144 g_free (paramv);
7145}
7146
7147static void
7148sensor_threshold_proxy_g_properties_changed (GDBusProxy *_proxy,
7149 GVariant *changed_properties,
7150 const gchar *const *invalidated_properties)
7151{
7152 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (_proxy);
7153 guint n;
7154 const gchar *key;
7155 GVariantIter *iter;
7156 _ExtendedGDBusPropertyInfo *info;
7157 g_variant_get (changed_properties, "a{sv}", &iter);
7158 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
7159 {
7160 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, key);
7161 g_datalist_remove_data (&proxy->priv->qdata, key);
7162 if (info != NULL)
7163 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
7164 }
7165 g_variant_iter_free (iter);
7166 for (n = 0; invalidated_properties[n] != NULL; n++)
7167 {
7168 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, invalidated_properties[n]);
7169 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
7170 if (info != NULL)
7171 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
7172 }
7173}
7174
7175static GVariant *
7176sensor_threshold_proxy_get_lower_critical (SensorThreshold *object)
7177{
7178 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
7179 GVariant *variant;
7180 GVariant *value = NULL;
7181 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "lower_critical");
7182 value = variant;
7183 if (variant != NULL)
7184 g_variant_unref (variant);
7185 return value;
7186}
7187
7188static GVariant *
7189sensor_threshold_proxy_get_lower_warning (SensorThreshold *object)
7190{
7191 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
7192 GVariant *variant;
7193 GVariant *value = NULL;
7194 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "lower_warning");
7195 value = variant;
7196 if (variant != NULL)
7197 g_variant_unref (variant);
7198 return value;
7199}
7200
7201static GVariant *
7202sensor_threshold_proxy_get_upper_warning (SensorThreshold *object)
7203{
7204 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
7205 GVariant *variant;
7206 GVariant *value = NULL;
7207 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "upper_warning");
7208 value = variant;
7209 if (variant != NULL)
7210 g_variant_unref (variant);
7211 return value;
7212}
7213
7214static GVariant *
7215sensor_threshold_proxy_get_upper_critical (SensorThreshold *object)
7216{
7217 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
7218 GVariant *variant;
7219 GVariant *value = NULL;
7220 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "upper_critical");
7221 value = variant;
7222 if (variant != NULL)
7223 g_variant_unref (variant);
7224 return value;
7225}
7226
7227static guchar
7228sensor_threshold_proxy_get_state (SensorThreshold *object)
7229{
7230 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
7231 GVariant *variant;
7232 guchar value = 0;
7233 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state");
7234 if (variant != NULL)
7235 {
7236 value = g_variant_get_byte (variant);
7237 g_variant_unref (variant);
7238 }
7239 return value;
7240}
7241
7242static void
7243sensor_threshold_proxy_init (SensorThresholdProxy *proxy)
7244{
7245#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
7246 proxy->priv = sensor_threshold_proxy_get_instance_private (proxy);
7247#else
7248 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_THRESHOLD_PROXY, SensorThresholdProxyPrivate);
7249#endif
7250
7251 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_threshold_interface_info ());
7252}
7253
7254static void
7255sensor_threshold_proxy_class_init (SensorThresholdProxyClass *klass)
7256{
7257 GObjectClass *gobject_class;
7258 GDBusProxyClass *proxy_class;
7259
7260 gobject_class = G_OBJECT_CLASS (klass);
7261 gobject_class->finalize = sensor_threshold_proxy_finalize;
7262 gobject_class->get_property = sensor_threshold_proxy_get_property;
7263 gobject_class->set_property = sensor_threshold_proxy_set_property;
7264
7265 proxy_class = G_DBUS_PROXY_CLASS (klass);
7266 proxy_class->g_signal = sensor_threshold_proxy_g_signal;
7267 proxy_class->g_properties_changed = sensor_threshold_proxy_g_properties_changed;
7268
7269 sensor_threshold_override_properties (gobject_class, 1);
7270
7271#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
7272 g_type_class_add_private (klass, sizeof (SensorThresholdProxyPrivate));
7273#endif
7274}
7275
7276static void
7277sensor_threshold_proxy_iface_init (SensorThresholdIface *iface)
7278{
7279 iface->get_lower_critical = sensor_threshold_proxy_get_lower_critical;
7280 iface->get_lower_warning = sensor_threshold_proxy_get_lower_warning;
7281 iface->get_upper_warning = sensor_threshold_proxy_get_upper_warning;
7282 iface->get_upper_critical = sensor_threshold_proxy_get_upper_critical;
7283 iface->get_state = sensor_threshold_proxy_get_state;
7284}
7285
7286/**
7287 * sensor_threshold_proxy_new:
7288 * @connection: A #GDBusConnection.
7289 * @flags: Flags from the #GDBusProxyFlags enumeration.
7290 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
7291 * @object_path: An object path.
7292 * @cancellable: (allow-none): A #GCancellable or %NULL.
7293 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
7294 * @user_data: User data to pass to @callback.
7295 *
7296 * 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.
7297 *
7298 * 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.
7299 * You can then call sensor_threshold_proxy_new_finish() to get the result of the operation.
7300 *
7301 * See sensor_threshold_proxy_new_sync() for the synchronous, blocking version of this constructor.
7302 */
7303void
7304sensor_threshold_proxy_new (
7305 GDBusConnection *connection,
7306 GDBusProxyFlags flags,
7307 const gchar *name,
7308 const gchar *object_path,
7309 GCancellable *cancellable,
7310 GAsyncReadyCallback callback,
7311 gpointer user_data)
7312{
7313 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);
7314}
7315
7316/**
7317 * sensor_threshold_proxy_new_finish:
7318 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_threshold_proxy_new().
7319 * @error: Return location for error or %NULL
7320 *
7321 * Finishes an operation started with sensor_threshold_proxy_new().
7322 *
7323 * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set.
7324 */
7325SensorThreshold *
7326sensor_threshold_proxy_new_finish (
7327 GAsyncResult *res,
7328 GError **error)
7329{
7330 GObject *ret;
7331 GObject *source_object;
7332 source_object = g_async_result_get_source_object (res);
7333 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
7334 g_object_unref (source_object);
7335 if (ret != NULL)
7336 return SENSOR_THRESHOLD (ret);
7337 else
7338 return NULL;
7339}
7340
7341/**
7342 * sensor_threshold_proxy_new_sync:
7343 * @connection: A #GDBusConnection.
7344 * @flags: Flags from the #GDBusProxyFlags enumeration.
7345 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
7346 * @object_path: An object path.
7347 * @cancellable: (allow-none): A #GCancellable or %NULL.
7348 * @error: Return location for error or %NULL
7349 *
7350 * 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.
7351 *
7352 * The calling thread is blocked until a reply is received.
7353 *
7354 * See sensor_threshold_proxy_new() for the asynchronous version of this constructor.
7355 *
7356 * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set.
7357 */
7358SensorThreshold *
7359sensor_threshold_proxy_new_sync (
7360 GDBusConnection *connection,
7361 GDBusProxyFlags flags,
7362 const gchar *name,
7363 const gchar *object_path,
7364 GCancellable *cancellable,
7365 GError **error)
7366{
7367 GInitable *ret;
7368 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);
7369 if (ret != NULL)
7370 return SENSOR_THRESHOLD (ret);
7371 else
7372 return NULL;
7373}
7374
7375
7376/**
7377 * sensor_threshold_proxy_new_for_bus:
7378 * @bus_type: A #GBusType.
7379 * @flags: Flags from the #GDBusProxyFlags enumeration.
7380 * @name: A bus name (well-known or unique).
7381 * @object_path: An object path.
7382 * @cancellable: (allow-none): A #GCancellable or %NULL.
7383 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
7384 * @user_data: User data to pass to @callback.
7385 *
7386 * Like sensor_threshold_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
7387 *
7388 * 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.
7389 * You can then call sensor_threshold_proxy_new_for_bus_finish() to get the result of the operation.
7390 *
7391 * See sensor_threshold_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
7392 */
7393void
7394sensor_threshold_proxy_new_for_bus (
7395 GBusType bus_type,
7396 GDBusProxyFlags flags,
7397 const gchar *name,
7398 const gchar *object_path,
7399 GCancellable *cancellable,
7400 GAsyncReadyCallback callback,
7401 gpointer user_data)
7402{
7403 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);
7404}
7405
7406/**
7407 * sensor_threshold_proxy_new_for_bus_finish:
7408 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_threshold_proxy_new_for_bus().
7409 * @error: Return location for error or %NULL
7410 *
7411 * Finishes an operation started with sensor_threshold_proxy_new_for_bus().
7412 *
7413 * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set.
7414 */
7415SensorThreshold *
7416sensor_threshold_proxy_new_for_bus_finish (
7417 GAsyncResult *res,
7418 GError **error)
7419{
7420 GObject *ret;
7421 GObject *source_object;
7422 source_object = g_async_result_get_source_object (res);
7423 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
7424 g_object_unref (source_object);
7425 if (ret != NULL)
7426 return SENSOR_THRESHOLD (ret);
7427 else
7428 return NULL;
7429}
7430
7431/**
7432 * sensor_threshold_proxy_new_for_bus_sync:
7433 * @bus_type: A #GBusType.
7434 * @flags: Flags from the #GDBusProxyFlags enumeration.
7435 * @name: A bus name (well-known or unique).
7436 * @object_path: An object path.
7437 * @cancellable: (allow-none): A #GCancellable or %NULL.
7438 * @error: Return location for error or %NULL
7439 *
7440 * Like sensor_threshold_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
7441 *
7442 * The calling thread is blocked until a reply is received.
7443 *
7444 * See sensor_threshold_proxy_new_for_bus() for the asynchronous version of this constructor.
7445 *
7446 * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set.
7447 */
7448SensorThreshold *
7449sensor_threshold_proxy_new_for_bus_sync (
7450 GBusType bus_type,
7451 GDBusProxyFlags flags,
7452 const gchar *name,
7453 const gchar *object_path,
7454 GCancellable *cancellable,
7455 GError **error)
7456{
7457 GInitable *ret;
7458 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);
7459 if (ret != NULL)
7460 return SENSOR_THRESHOLD (ret);
7461 else
7462 return NULL;
7463}
7464
7465
7466/* ------------------------------------------------------------------------ */
7467
7468/**
7469 * SensorThresholdSkeleton:
7470 *
7471 * The #SensorThresholdSkeleton structure contains only private data and should only be accessed using the provided API.
7472 */
7473
7474/**
7475 * SensorThresholdSkeletonClass:
7476 * @parent_class: The parent class.
7477 *
7478 * Class structure for #SensorThresholdSkeleton.
7479 */
7480
7481struct _SensorThresholdSkeletonPrivate
7482{
7483 GValue *properties;
7484 GList *changed_properties;
7485 GSource *changed_properties_idle_source;
7486 GMainContext *context;
7487 GMutex lock;
7488};
7489
7490static void
7491_sensor_threshold_skeleton_handle_method_call (
7492 GDBusConnection *connection G_GNUC_UNUSED,
7493 const gchar *sender G_GNUC_UNUSED,
7494 const gchar *object_path G_GNUC_UNUSED,
7495 const gchar *interface_name,
7496 const gchar *method_name,
7497 GVariant *parameters,
7498 GDBusMethodInvocation *invocation,
7499 gpointer user_data)
7500{
7501 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data);
7502 _ExtendedGDBusMethodInfo *info;
7503 GVariantIter iter;
7504 GVariant *child;
7505 GValue *paramv;
7506 guint num_params;
7507 guint num_extra;
7508 guint n;
7509 guint signal_id;
7510 GValue return_value = G_VALUE_INIT;
7511 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
7512 g_assert (info != NULL);
7513 num_params = g_variant_n_children (parameters);
7514 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
7515 n = 0;
7516 g_value_init (&paramv[n], TYPE_SENSOR_THRESHOLD);
7517 g_value_set_object (&paramv[n++], skeleton);
7518 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
7519 g_value_set_object (&paramv[n++], invocation);
7520 if (info->pass_fdlist)
7521 {
7522#ifdef G_OS_UNIX
7523 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
7524 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
7525#else
7526 g_assert_not_reached ();
7527#endif
7528 }
7529 g_variant_iter_init (&iter, parameters);
7530 while ((child = g_variant_iter_next_value (&iter)) != NULL)
7531 {
7532 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
7533 if (arg_info->use_gvariant)
7534 {
7535 g_value_init (&paramv[n], G_TYPE_VARIANT);
7536 g_value_set_variant (&paramv[n], child);
7537 n++;
7538 }
7539 else
7540 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
7541 g_variant_unref (child);
7542 }
7543 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_THRESHOLD);
7544 g_value_init (&return_value, G_TYPE_BOOLEAN);
7545 g_signal_emitv (paramv, signal_id, 0, &return_value);
7546 if (!g_value_get_boolean (&return_value))
7547 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);
7548 g_value_unset (&return_value);
7549 for (n = 0; n < num_params + num_extra; n++)
7550 g_value_unset (&paramv[n]);
7551 g_free (paramv);
7552}
7553
7554static GVariant *
7555_sensor_threshold_skeleton_handle_get_property (
7556 GDBusConnection *connection G_GNUC_UNUSED,
7557 const gchar *sender G_GNUC_UNUSED,
7558 const gchar *object_path G_GNUC_UNUSED,
7559 const gchar *interface_name G_GNUC_UNUSED,
7560 const gchar *property_name,
7561 GError **error,
7562 gpointer user_data)
7563{
7564 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data);
7565 GValue value = G_VALUE_INIT;
7566 GParamSpec *pspec;
7567 _ExtendedGDBusPropertyInfo *info;
7568 GVariant *ret;
7569 ret = NULL;
7570 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, property_name);
7571 g_assert (info != NULL);
7572 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
7573 if (pspec == NULL)
7574 {
7575 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
7576 }
7577 else
7578 {
7579 g_value_init (&value, pspec->value_type);
7580 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
7581 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
7582 g_value_unset (&value);
7583 }
7584 return ret;
7585}
7586
7587static gboolean
7588_sensor_threshold_skeleton_handle_set_property (
7589 GDBusConnection *connection G_GNUC_UNUSED,
7590 const gchar *sender G_GNUC_UNUSED,
7591 const gchar *object_path G_GNUC_UNUSED,
7592 const gchar *interface_name G_GNUC_UNUSED,
7593 const gchar *property_name,
7594 GVariant *variant,
7595 GError **error,
7596 gpointer user_data)
7597{
7598 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data);
7599 GValue value = G_VALUE_INIT;
7600 GParamSpec *pspec;
7601 _ExtendedGDBusPropertyInfo *info;
7602 gboolean ret;
7603 ret = FALSE;
7604 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, property_name);
7605 g_assert (info != NULL);
7606 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
7607 if (pspec == NULL)
7608 {
7609 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
7610 }
7611 else
7612 {
7613 if (info->use_gvariant)
7614 g_value_set_variant (&value, variant);
7615 else
7616 g_dbus_gvariant_to_gvalue (variant, &value);
7617 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
7618 g_value_unset (&value);
7619 ret = TRUE;
7620 }
7621 return ret;
7622}
7623
7624static const GDBusInterfaceVTable _sensor_threshold_skeleton_vtable =
7625{
7626 _sensor_threshold_skeleton_handle_method_call,
7627 _sensor_threshold_skeleton_handle_get_property,
7628 _sensor_threshold_skeleton_handle_set_property,
7629 {NULL}
7630};
7631
7632static GDBusInterfaceInfo *
7633sensor_threshold_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
7634{
7635 return sensor_threshold_interface_info ();
7636}
7637
7638static GDBusInterfaceVTable *
7639sensor_threshold_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
7640{
7641 return (GDBusInterfaceVTable *) &_sensor_threshold_skeleton_vtable;
7642}
7643
7644static GVariant *
7645sensor_threshold_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
7646{
7647 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (_skeleton);
7648
7649 GVariantBuilder builder;
7650 guint n;
7651 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
7652 if (_sensor_threshold_interface_info.parent_struct.properties == NULL)
7653 goto out;
7654 for (n = 0; _sensor_threshold_interface_info.parent_struct.properties[n] != NULL; n++)
7655 {
7656 GDBusPropertyInfo *info = _sensor_threshold_interface_info.parent_struct.properties[n];
7657 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
7658 {
7659 GVariant *value;
7660 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);
7661 if (value != NULL)
7662 {
7663 g_variant_take_ref (value);
7664 g_variant_builder_add (&builder, "{sv}", info->name, value);
7665 g_variant_unref (value);
7666 }
7667 }
7668 }
7669out:
7670 return g_variant_builder_end (&builder);
7671}
7672
7673static gboolean _sensor_threshold_emit_changed (gpointer user_data);
7674
7675static void
7676sensor_threshold_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
7677{
7678 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (_skeleton);
7679 gboolean emit_changed = FALSE;
7680
7681 g_mutex_lock (&skeleton->priv->lock);
7682 if (skeleton->priv->changed_properties_idle_source != NULL)
7683 {
7684 g_source_destroy (skeleton->priv->changed_properties_idle_source);
7685 skeleton->priv->changed_properties_idle_source = NULL;
7686 emit_changed = TRUE;
7687 }
7688 g_mutex_unlock (&skeleton->priv->lock);
7689
7690 if (emit_changed)
7691 _sensor_threshold_emit_changed (skeleton);
7692}
7693
7694static void
7695_sensor_threshold_on_signal_warning (
7696 SensorThreshold *object)
7697{
7698 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7699
7700 GList *connections, *l;
7701 GVariant *signal_variant;
7702 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
7703
7704 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
7705 for (l = connections; l != NULL; l = l->next)
7706 {
7707 GDBusConnection *connection = l->data;
7708 g_dbus_connection_emit_signal (connection,
7709 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorThreshold", "Warning",
7710 signal_variant, NULL);
7711 }
7712 g_variant_unref (signal_variant);
7713 g_list_free_full (connections, g_object_unref);
7714}
7715
7716static void
7717_sensor_threshold_on_signal_critical (
7718 SensorThreshold *object)
7719{
7720 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7721
7722 GList *connections, *l;
7723 GVariant *signal_variant;
7724 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
7725
7726 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
7727 for (l = connections; l != NULL; l = l->next)
7728 {
7729 GDBusConnection *connection = l->data;
7730 g_dbus_connection_emit_signal (connection,
7731 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorThreshold", "Critical",
7732 signal_variant, NULL);
7733 }
7734 g_variant_unref (signal_variant);
7735 g_list_free_full (connections, g_object_unref);
7736}
7737
7738static void
7739_sensor_threshold_on_signal_normal (
7740 SensorThreshold *object)
7741{
7742 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7743
7744 GList *connections, *l;
7745 GVariant *signal_variant;
7746 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
7747
7748 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
7749 for (l = connections; l != NULL; l = l->next)
7750 {
7751 GDBusConnection *connection = l->data;
7752 g_dbus_connection_emit_signal (connection,
7753 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorThreshold", "Normal",
7754 signal_variant, NULL);
7755 }
7756 g_variant_unref (signal_variant);
7757 g_list_free_full (connections, g_object_unref);
7758}
7759
7760static void sensor_threshold_skeleton_iface_init (SensorThresholdIface *iface);
7761#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
7762G_DEFINE_TYPE_WITH_CODE (SensorThresholdSkeleton, sensor_threshold_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
7763 G_ADD_PRIVATE (SensorThresholdSkeleton)
7764 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_skeleton_iface_init));
7765
7766#else
7767G_DEFINE_TYPE_WITH_CODE (SensorThresholdSkeleton, sensor_threshold_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
7768 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_skeleton_iface_init));
7769
7770#endif
7771static void
7772sensor_threshold_skeleton_finalize (GObject *object)
7773{
7774 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7775 guint n;
7776 for (n = 0; n < 5; n++)
7777 g_value_unset (&skeleton->priv->properties[n]);
7778 g_free (skeleton->priv->properties);
7779 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
7780 if (skeleton->priv->changed_properties_idle_source != NULL)
7781 g_source_destroy (skeleton->priv->changed_properties_idle_source);
7782 g_main_context_unref (skeleton->priv->context);
7783 g_mutex_clear (&skeleton->priv->lock);
7784 G_OBJECT_CLASS (sensor_threshold_skeleton_parent_class)->finalize (object);
7785}
7786
7787static void
7788sensor_threshold_skeleton_get_property (GObject *object,
7789 guint prop_id,
7790 GValue *value,
7791 GParamSpec *pspec G_GNUC_UNUSED)
7792{
7793 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7794 g_assert (prop_id != 0 && prop_id - 1 < 5);
7795 g_mutex_lock (&skeleton->priv->lock);
7796 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
7797 g_mutex_unlock (&skeleton->priv->lock);
7798}
7799
7800static gboolean
7801_sensor_threshold_emit_changed (gpointer user_data)
7802{
7803 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data);
7804 GList *l;
7805 GVariantBuilder builder;
7806 GVariantBuilder invalidated_builder;
7807 guint num_changes;
7808
7809 g_mutex_lock (&skeleton->priv->lock);
7810 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
7811 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
7812 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
7813 {
7814 ChangedProperty *cp = l->data;
7815 GVariant *variant;
7816 const GValue *cur_value;
7817
7818 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
7819 if (!_g_value_equal (cur_value, &cp->orig_value))
7820 {
7821 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
7822 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
7823 g_variant_unref (variant);
7824 num_changes++;
7825 }
7826 }
7827 if (num_changes > 0)
7828 {
7829 GList *connections, *ll;
7830 GVariant *signal_variant;
7831 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorThreshold",
7832 &builder, &invalidated_builder));
7833 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
7834 for (ll = connections; ll != NULL; ll = ll->next)
7835 {
7836 GDBusConnection *connection = ll->data;
7837
7838 g_dbus_connection_emit_signal (connection,
7839 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
7840 "org.freedesktop.DBus.Properties",
7841 "PropertiesChanged",
7842 signal_variant,
7843 NULL);
7844 }
7845 g_variant_unref (signal_variant);
7846 g_list_free_full (connections, g_object_unref);
7847 }
7848 else
7849 {
7850 g_variant_builder_clear (&builder);
7851 g_variant_builder_clear (&invalidated_builder);
7852 }
7853 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
7854 skeleton->priv->changed_properties = NULL;
7855 skeleton->priv->changed_properties_idle_source = NULL;
7856 g_mutex_unlock (&skeleton->priv->lock);
7857 return FALSE;
7858}
7859
7860static void
7861_sensor_threshold_schedule_emit_changed (SensorThresholdSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
7862{
7863 ChangedProperty *cp;
7864 GList *l;
7865 cp = NULL;
7866 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
7867 {
7868 ChangedProperty *i_cp = l->data;
7869 if (i_cp->info == info)
7870 {
7871 cp = i_cp;
7872 break;
7873 }
7874 }
7875 if (cp == NULL)
7876 {
7877 cp = g_new0 (ChangedProperty, 1);
7878 cp->prop_id = prop_id;
7879 cp->info = info;
7880 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
7881 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
7882 g_value_copy (orig_value, &cp->orig_value);
7883 }
7884}
7885
7886static void
7887sensor_threshold_skeleton_notify (GObject *object,
7888 GParamSpec *pspec G_GNUC_UNUSED)
7889{
7890 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7891 g_mutex_lock (&skeleton->priv->lock);
7892 if (skeleton->priv->changed_properties != NULL &&
7893 skeleton->priv->changed_properties_idle_source == NULL)
7894 {
7895 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
7896 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
7897 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_threshold_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
7898 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
7899 g_source_unref (skeleton->priv->changed_properties_idle_source);
7900 }
7901 g_mutex_unlock (&skeleton->priv->lock);
7902}
7903
7904static void
7905sensor_threshold_skeleton_set_property (GObject *object,
7906 guint prop_id,
7907 const GValue *value,
7908 GParamSpec *pspec)
7909{
7910 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7911 g_assert (prop_id != 0 && prop_id - 1 < 5);
7912 g_mutex_lock (&skeleton->priv->lock);
7913 g_object_freeze_notify (object);
7914 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
7915 {
7916 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
7917 _sensor_threshold_schedule_emit_changed (skeleton, _sensor_threshold_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
7918 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
7919 g_object_notify_by_pspec (object, pspec);
7920 }
7921 g_mutex_unlock (&skeleton->priv->lock);
7922 g_object_thaw_notify (object);
7923}
7924
7925static void
7926sensor_threshold_skeleton_init (SensorThresholdSkeleton *skeleton)
7927{
7928#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
7929 skeleton->priv = sensor_threshold_skeleton_get_instance_private (skeleton);
7930#else
7931 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_THRESHOLD_SKELETON, SensorThresholdSkeletonPrivate);
7932#endif
7933
7934 g_mutex_init (&skeleton->priv->lock);
7935 skeleton->priv->context = g_main_context_ref_thread_default ();
7936 skeleton->priv->properties = g_new0 (GValue, 5);
7937 g_value_init (&skeleton->priv->properties[0], G_TYPE_VARIANT);
7938 g_value_init (&skeleton->priv->properties[1], G_TYPE_VARIANT);
7939 g_value_init (&skeleton->priv->properties[2], G_TYPE_VARIANT);
7940 g_value_init (&skeleton->priv->properties[3], G_TYPE_VARIANT);
7941 g_value_init (&skeleton->priv->properties[4], G_TYPE_UCHAR);
7942}
7943
7944static GVariant *
7945sensor_threshold_skeleton_get_lower_critical (SensorThreshold *object)
7946{
7947 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7948 GVariant *value;
7949 g_mutex_lock (&skeleton->priv->lock);
7950 value = g_value_get_variant (&(skeleton->priv->properties[0]));
7951 g_mutex_unlock (&skeleton->priv->lock);
7952 return value;
7953}
7954
7955static GVariant *
7956sensor_threshold_skeleton_get_lower_warning (SensorThreshold *object)
7957{
7958 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7959 GVariant *value;
7960 g_mutex_lock (&skeleton->priv->lock);
7961 value = g_value_get_variant (&(skeleton->priv->properties[1]));
7962 g_mutex_unlock (&skeleton->priv->lock);
7963 return value;
7964}
7965
7966static GVariant *
7967sensor_threshold_skeleton_get_upper_warning (SensorThreshold *object)
7968{
7969 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7970 GVariant *value;
7971 g_mutex_lock (&skeleton->priv->lock);
7972 value = g_value_get_variant (&(skeleton->priv->properties[2]));
7973 g_mutex_unlock (&skeleton->priv->lock);
7974 return value;
7975}
7976
7977static GVariant *
7978sensor_threshold_skeleton_get_upper_critical (SensorThreshold *object)
7979{
7980 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7981 GVariant *value;
7982 g_mutex_lock (&skeleton->priv->lock);
7983 value = g_value_get_variant (&(skeleton->priv->properties[3]));
7984 g_mutex_unlock (&skeleton->priv->lock);
7985 return value;
7986}
7987
7988static guchar
7989sensor_threshold_skeleton_get_state (SensorThreshold *object)
7990{
7991 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7992 guchar value;
7993 g_mutex_lock (&skeleton->priv->lock);
7994 value = g_value_get_uchar (&(skeleton->priv->properties[4]));
7995 g_mutex_unlock (&skeleton->priv->lock);
7996 return value;
7997}
7998
7999static void
8000sensor_threshold_skeleton_class_init (SensorThresholdSkeletonClass *klass)
8001{
8002 GObjectClass *gobject_class;
8003 GDBusInterfaceSkeletonClass *skeleton_class;
8004
8005 gobject_class = G_OBJECT_CLASS (klass);
8006 gobject_class->finalize = sensor_threshold_skeleton_finalize;
8007 gobject_class->get_property = sensor_threshold_skeleton_get_property;
8008 gobject_class->set_property = sensor_threshold_skeleton_set_property;
8009 gobject_class->notify = sensor_threshold_skeleton_notify;
8010
8011
8012 sensor_threshold_override_properties (gobject_class, 1);
8013
8014 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
8015 skeleton_class->get_info = sensor_threshold_skeleton_dbus_interface_get_info;
8016 skeleton_class->get_properties = sensor_threshold_skeleton_dbus_interface_get_properties;
8017 skeleton_class->flush = sensor_threshold_skeleton_dbus_interface_flush;
8018 skeleton_class->get_vtable = sensor_threshold_skeleton_dbus_interface_get_vtable;
8019
8020#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
8021 g_type_class_add_private (klass, sizeof (SensorThresholdSkeletonPrivate));
8022#endif
8023}
8024
8025static void
8026sensor_threshold_skeleton_iface_init (SensorThresholdIface *iface)
8027{
8028 iface->warning = _sensor_threshold_on_signal_warning;
8029 iface->critical = _sensor_threshold_on_signal_critical;
8030 iface->normal = _sensor_threshold_on_signal_normal;
8031 iface->get_lower_critical = sensor_threshold_skeleton_get_lower_critical;
8032 iface->get_lower_warning = sensor_threshold_skeleton_get_lower_warning;
8033 iface->get_upper_warning = sensor_threshold_skeleton_get_upper_warning;
8034 iface->get_upper_critical = sensor_threshold_skeleton_get_upper_critical;
8035 iface->get_state = sensor_threshold_skeleton_get_state;
8036}
8037
8038/**
8039 * sensor_threshold_skeleton_new:
8040 *
8041 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link>.
8042 *
8043 * Returns: (transfer full) (type SensorThresholdSkeleton): The skeleton object.
8044 */
8045SensorThreshold *
8046sensor_threshold_skeleton_new (void)
8047{
8048 return SENSOR_THRESHOLD (g_object_new (TYPE_SENSOR_THRESHOLD_SKELETON, NULL));
8049}
8050
8051/* ------------------------------------------------------------------------
8052 * Code for interface org.openbmc.SensorI2c
8053 * ------------------------------------------------------------------------
8054 */
8055
8056/**
8057 * SECTION:SensorI2c
8058 * @title: SensorI2c
8059 * @short_description: Generated C code for the org.openbmc.SensorI2c D-Bus interface
8060 *
8061 * 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.
8062 */
8063
8064/* ---- Introspection data for org.openbmc.SensorI2c ---- */
8065
8066static const _ExtendedGDBusPropertyInfo _sensor_i2c_property_info_dev_path =
8067{
8068 {
8069 -1,
8070 (gchar *) "dev_path",
8071 (gchar *) "s",
8072 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
8073 NULL
8074 },
8075 "dev-path",
8076 FALSE
8077};
8078
8079static const _ExtendedGDBusPropertyInfo _sensor_i2c_property_info_address =
8080{
8081 {
8082 -1,
8083 (gchar *) "address",
8084 (gchar *) "s",
8085 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
8086 NULL
8087 },
8088 "address",
8089 FALSE
8090};
8091
8092static const _ExtendedGDBusPropertyInfo * const _sensor_i2c_property_info_pointers[] =
8093{
8094 &_sensor_i2c_property_info_dev_path,
8095 &_sensor_i2c_property_info_address,
8096 NULL
8097};
8098
8099static const _ExtendedGDBusInterfaceInfo _sensor_i2c_interface_info =
8100{
8101 {
8102 -1,
8103 (gchar *) "org.openbmc.SensorI2c",
8104 NULL,
8105 NULL,
8106 (GDBusPropertyInfo **) &_sensor_i2c_property_info_pointers,
8107 NULL
8108 },
8109 "sensor-i2c",
8110};
8111
8112
8113/**
8114 * sensor_i2c_interface_info:
8115 *
8116 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link> D-Bus interface.
8117 *
8118 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
8119 */
8120GDBusInterfaceInfo *
8121sensor_i2c_interface_info (void)
8122{
8123 return (GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct;
8124}
8125
8126/**
8127 * sensor_i2c_override_properties:
8128 * @klass: The class structure for a #GObject<!-- -->-derived class.
8129 * @property_id_begin: The property id to assign to the first overridden property.
8130 *
8131 * Overrides all #GObject properties in the #SensorI2c interface for a concrete class.
8132 * The properties are overridden in the order they are defined.
8133 *
8134 * Returns: The last property id.
8135 */
8136guint
8137sensor_i2c_override_properties (GObjectClass *klass, guint property_id_begin)
8138{
8139 g_object_class_override_property (klass, property_id_begin++, "dev-path");
8140 g_object_class_override_property (klass, property_id_begin++, "address");
8141 return property_id_begin - 1;
8142}
8143
8144
8145
8146/**
8147 * SensorI2c:
8148 *
8149 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>.
8150 */
8151
8152/**
8153 * SensorI2cIface:
8154 * @parent_iface: The parent interface.
8155 * @get_address: Getter for the #SensorI2c:address property.
8156 * @get_dev_path: Getter for the #SensorI2c:dev-path property.
8157 *
8158 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>.
8159 */
8160
8161typedef SensorI2cIface SensorI2cInterface;
8162G_DEFINE_INTERFACE (SensorI2c, sensor_i2c, G_TYPE_OBJECT);
8163
8164static void
8165sensor_i2c_default_init (SensorI2cIface *iface)
8166{
8167 /* GObject properties for D-Bus properties: */
8168 /**
8169 * SensorI2c:dev-path:
8170 *
8171 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link>.
8172 *
8173 * 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.
8174 */
8175 g_object_interface_install_property (iface,
8176 g_param_spec_string ("dev-path", "dev_path", "dev_path", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
8177 /**
8178 * SensorI2c:address:
8179 *
8180 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link>.
8181 *
8182 * 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.
8183 */
8184 g_object_interface_install_property (iface,
8185 g_param_spec_string ("address", "address", "address", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
8186}
8187
8188/**
8189 * sensor_i2c_get_dev_path: (skip)
8190 * @object: A #SensorI2c.
8191 *
8192 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link> D-Bus property.
8193 *
8194 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
8195 *
8196 * <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>
8197 *
8198 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
8199 */
8200const gchar *
8201sensor_i2c_get_dev_path (SensorI2c *object)
8202{
8203 return SENSOR_I2C_GET_IFACE (object)->get_dev_path (object);
8204}
8205
8206/**
8207 * sensor_i2c_dup_dev_path: (skip)
8208 * @object: A #SensorI2c.
8209 *
8210 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link> D-Bus property.
8211 *
8212 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
8213 *
8214 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
8215 */
8216gchar *
8217sensor_i2c_dup_dev_path (SensorI2c *object)
8218{
8219 gchar *value;
8220 g_object_get (G_OBJECT (object), "dev-path", &value, NULL);
8221 return value;
8222}
8223
8224/**
8225 * sensor_i2c_set_dev_path: (skip)
8226 * @object: A #SensorI2c.
8227 * @value: The value to set.
8228 *
8229 * Sets the <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link> D-Bus property to @value.
8230 *
8231 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
8232 */
8233void
8234sensor_i2c_set_dev_path (SensorI2c *object, const gchar *value)
8235{
8236 g_object_set (G_OBJECT (object), "dev-path", value, NULL);
8237}
8238
8239/**
8240 * sensor_i2c_get_address: (skip)
8241 * @object: A #SensorI2c.
8242 *
8243 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link> D-Bus property.
8244 *
8245 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
8246 *
8247 * <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>
8248 *
8249 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
8250 */
8251const gchar *
8252sensor_i2c_get_address (SensorI2c *object)
8253{
8254 return SENSOR_I2C_GET_IFACE (object)->get_address (object);
8255}
8256
8257/**
8258 * sensor_i2c_dup_address: (skip)
8259 * @object: A #SensorI2c.
8260 *
8261 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link> D-Bus property.
8262 *
8263 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
8264 *
8265 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
8266 */
8267gchar *
8268sensor_i2c_dup_address (SensorI2c *object)
8269{
8270 gchar *value;
8271 g_object_get (G_OBJECT (object), "address", &value, NULL);
8272 return value;
8273}
8274
8275/**
8276 * sensor_i2c_set_address: (skip)
8277 * @object: A #SensorI2c.
8278 * @value: The value to set.
8279 *
8280 * Sets the <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link> D-Bus property to @value.
8281 *
8282 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
8283 */
8284void
8285sensor_i2c_set_address (SensorI2c *object, const gchar *value)
8286{
8287 g_object_set (G_OBJECT (object), "address", value, NULL);
8288}
8289
8290/* ------------------------------------------------------------------------ */
8291
8292/**
8293 * SensorI2cProxy:
8294 *
8295 * The #SensorI2cProxy structure contains only private data and should only be accessed using the provided API.
8296 */
8297
8298/**
8299 * SensorI2cProxyClass:
8300 * @parent_class: The parent class.
8301 *
8302 * Class structure for #SensorI2cProxy.
8303 */
8304
8305struct _SensorI2cProxyPrivate
8306{
8307 GData *qdata;
8308};
8309
8310static void sensor_i2c_proxy_iface_init (SensorI2cIface *iface);
8311
8312#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
8313G_DEFINE_TYPE_WITH_CODE (SensorI2cProxy, sensor_i2c_proxy, G_TYPE_DBUS_PROXY,
8314 G_ADD_PRIVATE (SensorI2cProxy)
8315 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_proxy_iface_init));
8316
8317#else
8318G_DEFINE_TYPE_WITH_CODE (SensorI2cProxy, sensor_i2c_proxy, G_TYPE_DBUS_PROXY,
8319 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_proxy_iface_init));
8320
8321#endif
8322static void
8323sensor_i2c_proxy_finalize (GObject *object)
8324{
8325 SensorI2cProxy *proxy = SENSOR_I2C_PROXY (object);
8326 g_datalist_clear (&proxy->priv->qdata);
8327 G_OBJECT_CLASS (sensor_i2c_proxy_parent_class)->finalize (object);
8328}
8329
8330static void
8331sensor_i2c_proxy_get_property (GObject *object,
8332 guint prop_id,
8333 GValue *value,
8334 GParamSpec *pspec G_GNUC_UNUSED)
8335{
8336 const _ExtendedGDBusPropertyInfo *info;
8337 GVariant *variant;
8338 g_assert (prop_id != 0 && prop_id - 1 < 2);
8339 info = _sensor_i2c_property_info_pointers[prop_id - 1];
8340 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
8341 if (info->use_gvariant)
8342 {
8343 g_value_set_variant (value, variant);
8344 }
8345 else
8346 {
8347 if (variant != NULL)
8348 g_dbus_gvariant_to_gvalue (variant, value);
8349 }
8350 if (variant != NULL)
8351 g_variant_unref (variant);
8352}
8353
8354static void
8355sensor_i2c_proxy_set_property_cb (GDBusProxy *proxy,
8356 GAsyncResult *res,
8357 gpointer user_data)
8358{
8359 const _ExtendedGDBusPropertyInfo *info = user_data;
8360 GError *error;
8361 GVariant *_ret;
8362 error = NULL;
8363 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
8364 if (!_ret)
8365 {
8366 g_warning ("Error setting property '%s' on interface org.openbmc.SensorI2c: %s (%s, %d)",
8367 info->parent_struct.name,
8368 error->message, g_quark_to_string (error->domain), error->code);
8369 g_error_free (error);
8370 }
8371 else
8372 {
8373 g_variant_unref (_ret);
8374 }
8375}
8376
8377static void
8378sensor_i2c_proxy_set_property (GObject *object,
8379 guint prop_id,
8380 const GValue *value,
8381 GParamSpec *pspec G_GNUC_UNUSED)
8382{
8383 const _ExtendedGDBusPropertyInfo *info;
8384 GVariant *variant;
8385 g_assert (prop_id != 0 && prop_id - 1 < 2);
8386 info = _sensor_i2c_property_info_pointers[prop_id - 1];
8387 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
8388 g_dbus_proxy_call (G_DBUS_PROXY (object),
8389 "org.freedesktop.DBus.Properties.Set",
8390 g_variant_new ("(ssv)", "org.openbmc.SensorI2c", info->parent_struct.name, variant),
8391 G_DBUS_CALL_FLAGS_NONE,
8392 -1,
8393 NULL, (GAsyncReadyCallback) sensor_i2c_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
8394 g_variant_unref (variant);
8395}
8396
8397static void
8398sensor_i2c_proxy_g_signal (GDBusProxy *proxy,
8399 const gchar *sender_name G_GNUC_UNUSED,
8400 const gchar *signal_name,
8401 GVariant *parameters)
8402{
8403 _ExtendedGDBusSignalInfo *info;
8404 GVariantIter iter;
8405 GVariant *child;
8406 GValue *paramv;
8407 guint num_params;
8408 guint n;
8409 guint signal_id;
8410 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, signal_name);
8411 if (info == NULL)
8412 return;
8413 num_params = g_variant_n_children (parameters);
8414 paramv = g_new0 (GValue, num_params + 1);
8415 g_value_init (&paramv[0], TYPE_SENSOR_I2C);
8416 g_value_set_object (&paramv[0], proxy);
8417 g_variant_iter_init (&iter, parameters);
8418 n = 1;
8419 while ((child = g_variant_iter_next_value (&iter)) != NULL)
8420 {
8421 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
8422 if (arg_info->use_gvariant)
8423 {
8424 g_value_init (&paramv[n], G_TYPE_VARIANT);
8425 g_value_set_variant (&paramv[n], child);
8426 n++;
8427 }
8428 else
8429 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
8430 g_variant_unref (child);
8431 }
8432 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_I2C);
8433 g_signal_emitv (paramv, signal_id, 0, NULL);
8434 for (n = 0; n < num_params + 1; n++)
8435 g_value_unset (&paramv[n]);
8436 g_free (paramv);
8437}
8438
8439static void
8440sensor_i2c_proxy_g_properties_changed (GDBusProxy *_proxy,
8441 GVariant *changed_properties,
8442 const gchar *const *invalidated_properties)
8443{
8444 SensorI2cProxy *proxy = SENSOR_I2C_PROXY (_proxy);
8445 guint n;
8446 const gchar *key;
8447 GVariantIter *iter;
8448 _ExtendedGDBusPropertyInfo *info;
8449 g_variant_get (changed_properties, "a{sv}", &iter);
8450 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
8451 {
8452 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, key);
8453 g_datalist_remove_data (&proxy->priv->qdata, key);
8454 if (info != NULL)
8455 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
8456 }
8457 g_variant_iter_free (iter);
8458 for (n = 0; invalidated_properties[n] != NULL; n++)
8459 {
8460 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, invalidated_properties[n]);
8461 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
8462 if (info != NULL)
8463 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
8464 }
8465}
8466
8467static const gchar *
8468sensor_i2c_proxy_get_dev_path (SensorI2c *object)
8469{
8470 SensorI2cProxy *proxy = SENSOR_I2C_PROXY (object);
8471 GVariant *variant;
8472 const gchar *value = NULL;
8473 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "dev_path");
8474 if (variant != NULL)
8475 {
8476 value = g_variant_get_string (variant, NULL);
8477 g_variant_unref (variant);
8478 }
8479 return value;
8480}
8481
8482static const gchar *
8483sensor_i2c_proxy_get_address (SensorI2c *object)
8484{
8485 SensorI2cProxy *proxy = SENSOR_I2C_PROXY (object);
8486 GVariant *variant;
8487 const gchar *value = NULL;
8488 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "address");
8489 if (variant != NULL)
8490 {
8491 value = g_variant_get_string (variant, NULL);
8492 g_variant_unref (variant);
8493 }
8494 return value;
8495}
8496
8497static void
8498sensor_i2c_proxy_init (SensorI2cProxy *proxy)
8499{
8500#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
8501 proxy->priv = sensor_i2c_proxy_get_instance_private (proxy);
8502#else
8503 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_I2C_PROXY, SensorI2cProxyPrivate);
8504#endif
8505
8506 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_i2c_interface_info ());
8507}
8508
8509static void
8510sensor_i2c_proxy_class_init (SensorI2cProxyClass *klass)
8511{
8512 GObjectClass *gobject_class;
8513 GDBusProxyClass *proxy_class;
8514
8515 gobject_class = G_OBJECT_CLASS (klass);
8516 gobject_class->finalize = sensor_i2c_proxy_finalize;
8517 gobject_class->get_property = sensor_i2c_proxy_get_property;
8518 gobject_class->set_property = sensor_i2c_proxy_set_property;
8519
8520 proxy_class = G_DBUS_PROXY_CLASS (klass);
8521 proxy_class->g_signal = sensor_i2c_proxy_g_signal;
8522 proxy_class->g_properties_changed = sensor_i2c_proxy_g_properties_changed;
8523
8524 sensor_i2c_override_properties (gobject_class, 1);
8525
8526#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
8527 g_type_class_add_private (klass, sizeof (SensorI2cProxyPrivate));
8528#endif
8529}
8530
8531static void
8532sensor_i2c_proxy_iface_init (SensorI2cIface *iface)
8533{
8534 iface->get_dev_path = sensor_i2c_proxy_get_dev_path;
8535 iface->get_address = sensor_i2c_proxy_get_address;
8536}
8537
8538/**
8539 * sensor_i2c_proxy_new:
8540 * @connection: A #GDBusConnection.
8541 * @flags: Flags from the #GDBusProxyFlags enumeration.
8542 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
8543 * @object_path: An object path.
8544 * @cancellable: (allow-none): A #GCancellable or %NULL.
8545 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
8546 * @user_data: User data to pass to @callback.
8547 *
8548 * 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.
8549 *
8550 * 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.
8551 * You can then call sensor_i2c_proxy_new_finish() to get the result of the operation.
8552 *
8553 * See sensor_i2c_proxy_new_sync() for the synchronous, blocking version of this constructor.
8554 */
8555void
8556sensor_i2c_proxy_new (
8557 GDBusConnection *connection,
8558 GDBusProxyFlags flags,
8559 const gchar *name,
8560 const gchar *object_path,
8561 GCancellable *cancellable,
8562 GAsyncReadyCallback callback,
8563 gpointer user_data)
8564{
8565 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);
8566}
8567
8568/**
8569 * sensor_i2c_proxy_new_finish:
8570 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_i2c_proxy_new().
8571 * @error: Return location for error or %NULL
8572 *
8573 * Finishes an operation started with sensor_i2c_proxy_new().
8574 *
8575 * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set.
8576 */
8577SensorI2c *
8578sensor_i2c_proxy_new_finish (
8579 GAsyncResult *res,
8580 GError **error)
8581{
8582 GObject *ret;
8583 GObject *source_object;
8584 source_object = g_async_result_get_source_object (res);
8585 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
8586 g_object_unref (source_object);
8587 if (ret != NULL)
8588 return SENSOR_I2C (ret);
8589 else
8590 return NULL;
8591}
8592
8593/**
8594 * sensor_i2c_proxy_new_sync:
8595 * @connection: A #GDBusConnection.
8596 * @flags: Flags from the #GDBusProxyFlags enumeration.
8597 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
8598 * @object_path: An object path.
8599 * @cancellable: (allow-none): A #GCancellable or %NULL.
8600 * @error: Return location for error or %NULL
8601 *
8602 * 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.
8603 *
8604 * The calling thread is blocked until a reply is received.
8605 *
8606 * See sensor_i2c_proxy_new() for the asynchronous version of this constructor.
8607 *
8608 * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set.
8609 */
8610SensorI2c *
8611sensor_i2c_proxy_new_sync (
8612 GDBusConnection *connection,
8613 GDBusProxyFlags flags,
8614 const gchar *name,
8615 const gchar *object_path,
8616 GCancellable *cancellable,
8617 GError **error)
8618{
8619 GInitable *ret;
8620 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);
8621 if (ret != NULL)
8622 return SENSOR_I2C (ret);
8623 else
8624 return NULL;
8625}
8626
8627
8628/**
8629 * sensor_i2c_proxy_new_for_bus:
8630 * @bus_type: A #GBusType.
8631 * @flags: Flags from the #GDBusProxyFlags enumeration.
8632 * @name: A bus name (well-known or unique).
8633 * @object_path: An object path.
8634 * @cancellable: (allow-none): A #GCancellable or %NULL.
8635 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
8636 * @user_data: User data to pass to @callback.
8637 *
8638 * Like sensor_i2c_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
8639 *
8640 * 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.
8641 * You can then call sensor_i2c_proxy_new_for_bus_finish() to get the result of the operation.
8642 *
8643 * See sensor_i2c_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
8644 */
8645void
8646sensor_i2c_proxy_new_for_bus (
8647 GBusType bus_type,
8648 GDBusProxyFlags flags,
8649 const gchar *name,
8650 const gchar *object_path,
8651 GCancellable *cancellable,
8652 GAsyncReadyCallback callback,
8653 gpointer user_data)
8654{
8655 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);
8656}
8657
8658/**
8659 * sensor_i2c_proxy_new_for_bus_finish:
8660 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_i2c_proxy_new_for_bus().
8661 * @error: Return location for error or %NULL
8662 *
8663 * Finishes an operation started with sensor_i2c_proxy_new_for_bus().
8664 *
8665 * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set.
8666 */
8667SensorI2c *
8668sensor_i2c_proxy_new_for_bus_finish (
8669 GAsyncResult *res,
8670 GError **error)
8671{
8672 GObject *ret;
8673 GObject *source_object;
8674 source_object = g_async_result_get_source_object (res);
8675 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
8676 g_object_unref (source_object);
8677 if (ret != NULL)
8678 return SENSOR_I2C (ret);
8679 else
8680 return NULL;
8681}
8682
8683/**
8684 * sensor_i2c_proxy_new_for_bus_sync:
8685 * @bus_type: A #GBusType.
8686 * @flags: Flags from the #GDBusProxyFlags enumeration.
8687 * @name: A bus name (well-known or unique).
8688 * @object_path: An object path.
8689 * @cancellable: (allow-none): A #GCancellable or %NULL.
8690 * @error: Return location for error or %NULL
8691 *
8692 * Like sensor_i2c_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
8693 *
8694 * The calling thread is blocked until a reply is received.
8695 *
8696 * See sensor_i2c_proxy_new_for_bus() for the asynchronous version of this constructor.
8697 *
8698 * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set.
8699 */
8700SensorI2c *
8701sensor_i2c_proxy_new_for_bus_sync (
8702 GBusType bus_type,
8703 GDBusProxyFlags flags,
8704 const gchar *name,
8705 const gchar *object_path,
8706 GCancellable *cancellable,
8707 GError **error)
8708{
8709 GInitable *ret;
8710 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);
8711 if (ret != NULL)
8712 return SENSOR_I2C (ret);
8713 else
8714 return NULL;
8715}
8716
8717
8718/* ------------------------------------------------------------------------ */
8719
8720/**
8721 * SensorI2cSkeleton:
8722 *
8723 * The #SensorI2cSkeleton structure contains only private data and should only be accessed using the provided API.
8724 */
8725
8726/**
8727 * SensorI2cSkeletonClass:
8728 * @parent_class: The parent class.
8729 *
8730 * Class structure for #SensorI2cSkeleton.
8731 */
8732
8733struct _SensorI2cSkeletonPrivate
8734{
8735 GValue *properties;
8736 GList *changed_properties;
8737 GSource *changed_properties_idle_source;
8738 GMainContext *context;
8739 GMutex lock;
8740};
8741
8742static void
8743_sensor_i2c_skeleton_handle_method_call (
8744 GDBusConnection *connection G_GNUC_UNUSED,
8745 const gchar *sender G_GNUC_UNUSED,
8746 const gchar *object_path G_GNUC_UNUSED,
8747 const gchar *interface_name,
8748 const gchar *method_name,
8749 GVariant *parameters,
8750 GDBusMethodInvocation *invocation,
8751 gpointer user_data)
8752{
8753 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data);
8754 _ExtendedGDBusMethodInfo *info;
8755 GVariantIter iter;
8756 GVariant *child;
8757 GValue *paramv;
8758 guint num_params;
8759 guint num_extra;
8760 guint n;
8761 guint signal_id;
8762 GValue return_value = G_VALUE_INIT;
8763 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
8764 g_assert (info != NULL);
8765 num_params = g_variant_n_children (parameters);
8766 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
8767 n = 0;
8768 g_value_init (&paramv[n], TYPE_SENSOR_I2C);
8769 g_value_set_object (&paramv[n++], skeleton);
8770 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
8771 g_value_set_object (&paramv[n++], invocation);
8772 if (info->pass_fdlist)
8773 {
8774#ifdef G_OS_UNIX
8775 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
8776 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
8777#else
8778 g_assert_not_reached ();
8779#endif
8780 }
8781 g_variant_iter_init (&iter, parameters);
8782 while ((child = g_variant_iter_next_value (&iter)) != NULL)
8783 {
8784 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
8785 if (arg_info->use_gvariant)
8786 {
8787 g_value_init (&paramv[n], G_TYPE_VARIANT);
8788 g_value_set_variant (&paramv[n], child);
8789 n++;
8790 }
8791 else
8792 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
8793 g_variant_unref (child);
8794 }
8795 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_I2C);
8796 g_value_init (&return_value, G_TYPE_BOOLEAN);
8797 g_signal_emitv (paramv, signal_id, 0, &return_value);
8798 if (!g_value_get_boolean (&return_value))
8799 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);
8800 g_value_unset (&return_value);
8801 for (n = 0; n < num_params + num_extra; n++)
8802 g_value_unset (&paramv[n]);
8803 g_free (paramv);
8804}
8805
8806static GVariant *
8807_sensor_i2c_skeleton_handle_get_property (
8808 GDBusConnection *connection G_GNUC_UNUSED,
8809 const gchar *sender G_GNUC_UNUSED,
8810 const gchar *object_path G_GNUC_UNUSED,
8811 const gchar *interface_name G_GNUC_UNUSED,
8812 const gchar *property_name,
8813 GError **error,
8814 gpointer user_data)
8815{
8816 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data);
8817 GValue value = G_VALUE_INIT;
8818 GParamSpec *pspec;
8819 _ExtendedGDBusPropertyInfo *info;
8820 GVariant *ret;
8821 ret = NULL;
8822 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, property_name);
8823 g_assert (info != NULL);
8824 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
8825 if (pspec == NULL)
8826 {
8827 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
8828 }
8829 else
8830 {
8831 g_value_init (&value, pspec->value_type);
8832 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
8833 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
8834 g_value_unset (&value);
8835 }
8836 return ret;
8837}
8838
8839static gboolean
8840_sensor_i2c_skeleton_handle_set_property (
8841 GDBusConnection *connection G_GNUC_UNUSED,
8842 const gchar *sender G_GNUC_UNUSED,
8843 const gchar *object_path G_GNUC_UNUSED,
8844 const gchar *interface_name G_GNUC_UNUSED,
8845 const gchar *property_name,
8846 GVariant *variant,
8847 GError **error,
8848 gpointer user_data)
8849{
8850 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data);
8851 GValue value = G_VALUE_INIT;
8852 GParamSpec *pspec;
8853 _ExtendedGDBusPropertyInfo *info;
8854 gboolean ret;
8855 ret = FALSE;
8856 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, property_name);
8857 g_assert (info != NULL);
8858 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
8859 if (pspec == NULL)
8860 {
8861 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
8862 }
8863 else
8864 {
8865 if (info->use_gvariant)
8866 g_value_set_variant (&value, variant);
8867 else
8868 g_dbus_gvariant_to_gvalue (variant, &value);
8869 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
8870 g_value_unset (&value);
8871 ret = TRUE;
8872 }
8873 return ret;
8874}
8875
8876static const GDBusInterfaceVTable _sensor_i2c_skeleton_vtable =
8877{
8878 _sensor_i2c_skeleton_handle_method_call,
8879 _sensor_i2c_skeleton_handle_get_property,
8880 _sensor_i2c_skeleton_handle_set_property,
8881 {NULL}
8882};
8883
8884static GDBusInterfaceInfo *
8885sensor_i2c_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
8886{
8887 return sensor_i2c_interface_info ();
8888}
8889
8890static GDBusInterfaceVTable *
8891sensor_i2c_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
8892{
8893 return (GDBusInterfaceVTable *) &_sensor_i2c_skeleton_vtable;
8894}
8895
8896static GVariant *
8897sensor_i2c_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
8898{
8899 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (_skeleton);
8900
8901 GVariantBuilder builder;
8902 guint n;
8903 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
8904 if (_sensor_i2c_interface_info.parent_struct.properties == NULL)
8905 goto out;
8906 for (n = 0; _sensor_i2c_interface_info.parent_struct.properties[n] != NULL; n++)
8907 {
8908 GDBusPropertyInfo *info = _sensor_i2c_interface_info.parent_struct.properties[n];
8909 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
8910 {
8911 GVariant *value;
8912 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);
8913 if (value != NULL)
8914 {
8915 g_variant_take_ref (value);
8916 g_variant_builder_add (&builder, "{sv}", info->name, value);
8917 g_variant_unref (value);
8918 }
8919 }
8920 }
8921out:
8922 return g_variant_builder_end (&builder);
8923}
8924
8925static gboolean _sensor_i2c_emit_changed (gpointer user_data);
8926
8927static void
8928sensor_i2c_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
8929{
8930 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (_skeleton);
8931 gboolean emit_changed = FALSE;
8932
8933 g_mutex_lock (&skeleton->priv->lock);
8934 if (skeleton->priv->changed_properties_idle_source != NULL)
8935 {
8936 g_source_destroy (skeleton->priv->changed_properties_idle_source);
8937 skeleton->priv->changed_properties_idle_source = NULL;
8938 emit_changed = TRUE;
8939 }
8940 g_mutex_unlock (&skeleton->priv->lock);
8941
8942 if (emit_changed)
8943 _sensor_i2c_emit_changed (skeleton);
8944}
8945
8946static void sensor_i2c_skeleton_iface_init (SensorI2cIface *iface);
8947#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
8948G_DEFINE_TYPE_WITH_CODE (SensorI2cSkeleton, sensor_i2c_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
8949 G_ADD_PRIVATE (SensorI2cSkeleton)
8950 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_skeleton_iface_init));
8951
8952#else
8953G_DEFINE_TYPE_WITH_CODE (SensorI2cSkeleton, sensor_i2c_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
8954 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_skeleton_iface_init));
8955
8956#endif
8957static void
8958sensor_i2c_skeleton_finalize (GObject *object)
8959{
8960 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
8961 guint n;
8962 for (n = 0; n < 2; n++)
8963 g_value_unset (&skeleton->priv->properties[n]);
8964 g_free (skeleton->priv->properties);
8965 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
8966 if (skeleton->priv->changed_properties_idle_source != NULL)
8967 g_source_destroy (skeleton->priv->changed_properties_idle_source);
8968 g_main_context_unref (skeleton->priv->context);
8969 g_mutex_clear (&skeleton->priv->lock);
8970 G_OBJECT_CLASS (sensor_i2c_skeleton_parent_class)->finalize (object);
8971}
8972
8973static void
8974sensor_i2c_skeleton_get_property (GObject *object,
8975 guint prop_id,
8976 GValue *value,
8977 GParamSpec *pspec G_GNUC_UNUSED)
8978{
8979 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
8980 g_assert (prop_id != 0 && prop_id - 1 < 2);
8981 g_mutex_lock (&skeleton->priv->lock);
8982 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
8983 g_mutex_unlock (&skeleton->priv->lock);
8984}
8985
8986static gboolean
8987_sensor_i2c_emit_changed (gpointer user_data)
8988{
8989 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data);
8990 GList *l;
8991 GVariantBuilder builder;
8992 GVariantBuilder invalidated_builder;
8993 guint num_changes;
8994
8995 g_mutex_lock (&skeleton->priv->lock);
8996 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
8997 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
8998 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
8999 {
9000 ChangedProperty *cp = l->data;
9001 GVariant *variant;
9002 const GValue *cur_value;
9003
9004 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
9005 if (!_g_value_equal (cur_value, &cp->orig_value))
9006 {
9007 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
9008 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
9009 g_variant_unref (variant);
9010 num_changes++;
9011 }
9012 }
9013 if (num_changes > 0)
9014 {
9015 GList *connections, *ll;
9016 GVariant *signal_variant;
9017 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorI2c",
9018 &builder, &invalidated_builder));
9019 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
9020 for (ll = connections; ll != NULL; ll = ll->next)
9021 {
9022 GDBusConnection *connection = ll->data;
9023
9024 g_dbus_connection_emit_signal (connection,
9025 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
9026 "org.freedesktop.DBus.Properties",
9027 "PropertiesChanged",
9028 signal_variant,
9029 NULL);
9030 }
9031 g_variant_unref (signal_variant);
9032 g_list_free_full (connections, g_object_unref);
9033 }
9034 else
9035 {
9036 g_variant_builder_clear (&builder);
9037 g_variant_builder_clear (&invalidated_builder);
9038 }
9039 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
9040 skeleton->priv->changed_properties = NULL;
9041 skeleton->priv->changed_properties_idle_source = NULL;
9042 g_mutex_unlock (&skeleton->priv->lock);
9043 return FALSE;
9044}
9045
9046static void
9047_sensor_i2c_schedule_emit_changed (SensorI2cSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
9048{
9049 ChangedProperty *cp;
9050 GList *l;
9051 cp = NULL;
9052 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
9053 {
9054 ChangedProperty *i_cp = l->data;
9055 if (i_cp->info == info)
9056 {
9057 cp = i_cp;
9058 break;
9059 }
9060 }
9061 if (cp == NULL)
9062 {
9063 cp = g_new0 (ChangedProperty, 1);
9064 cp->prop_id = prop_id;
9065 cp->info = info;
9066 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
9067 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
9068 g_value_copy (orig_value, &cp->orig_value);
9069 }
9070}
9071
9072static void
9073sensor_i2c_skeleton_notify (GObject *object,
9074 GParamSpec *pspec G_GNUC_UNUSED)
9075{
9076 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
9077 g_mutex_lock (&skeleton->priv->lock);
9078 if (skeleton->priv->changed_properties != NULL &&
9079 skeleton->priv->changed_properties_idle_source == NULL)
9080 {
9081 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
9082 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
9083 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_i2c_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
9084 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
9085 g_source_unref (skeleton->priv->changed_properties_idle_source);
9086 }
9087 g_mutex_unlock (&skeleton->priv->lock);
9088}
9089
9090static void
9091sensor_i2c_skeleton_set_property (GObject *object,
9092 guint prop_id,
9093 const GValue *value,
9094 GParamSpec *pspec)
9095{
9096 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
9097 g_assert (prop_id != 0 && prop_id - 1 < 2);
9098 g_mutex_lock (&skeleton->priv->lock);
9099 g_object_freeze_notify (object);
9100 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
9101 {
9102 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
9103 _sensor_i2c_schedule_emit_changed (skeleton, _sensor_i2c_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
9104 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
9105 g_object_notify_by_pspec (object, pspec);
9106 }
9107 g_mutex_unlock (&skeleton->priv->lock);
9108 g_object_thaw_notify (object);
9109}
9110
9111static void
9112sensor_i2c_skeleton_init (SensorI2cSkeleton *skeleton)
9113{
9114#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
9115 skeleton->priv = sensor_i2c_skeleton_get_instance_private (skeleton);
9116#else
9117 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_I2C_SKELETON, SensorI2cSkeletonPrivate);
9118#endif
9119
9120 g_mutex_init (&skeleton->priv->lock);
9121 skeleton->priv->context = g_main_context_ref_thread_default ();
9122 skeleton->priv->properties = g_new0 (GValue, 2);
9123 g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING);
9124 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
9125}
9126
9127static const gchar *
9128sensor_i2c_skeleton_get_dev_path (SensorI2c *object)
9129{
9130 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
9131 const gchar *value;
9132 g_mutex_lock (&skeleton->priv->lock);
9133 value = g_value_get_string (&(skeleton->priv->properties[0]));
9134 g_mutex_unlock (&skeleton->priv->lock);
9135 return value;
9136}
9137
9138static const gchar *
9139sensor_i2c_skeleton_get_address (SensorI2c *object)
9140{
9141 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
9142 const gchar *value;
9143 g_mutex_lock (&skeleton->priv->lock);
9144 value = g_value_get_string (&(skeleton->priv->properties[1]));
9145 g_mutex_unlock (&skeleton->priv->lock);
9146 return value;
9147}
9148
9149static void
9150sensor_i2c_skeleton_class_init (SensorI2cSkeletonClass *klass)
9151{
9152 GObjectClass *gobject_class;
9153 GDBusInterfaceSkeletonClass *skeleton_class;
9154
9155 gobject_class = G_OBJECT_CLASS (klass);
9156 gobject_class->finalize = sensor_i2c_skeleton_finalize;
9157 gobject_class->get_property = sensor_i2c_skeleton_get_property;
9158 gobject_class->set_property = sensor_i2c_skeleton_set_property;
9159 gobject_class->notify = sensor_i2c_skeleton_notify;
9160
9161
9162 sensor_i2c_override_properties (gobject_class, 1);
9163
9164 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
9165 skeleton_class->get_info = sensor_i2c_skeleton_dbus_interface_get_info;
9166 skeleton_class->get_properties = sensor_i2c_skeleton_dbus_interface_get_properties;
9167 skeleton_class->flush = sensor_i2c_skeleton_dbus_interface_flush;
9168 skeleton_class->get_vtable = sensor_i2c_skeleton_dbus_interface_get_vtable;
9169
9170#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
9171 g_type_class_add_private (klass, sizeof (SensorI2cSkeletonPrivate));
9172#endif
9173}
9174
9175static void
9176sensor_i2c_skeleton_iface_init (SensorI2cIface *iface)
9177{
9178 iface->get_dev_path = sensor_i2c_skeleton_get_dev_path;
9179 iface->get_address = sensor_i2c_skeleton_get_address;
9180}
9181
9182/**
9183 * sensor_i2c_skeleton_new:
9184 *
9185 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>.
9186 *
9187 * Returns: (transfer full) (type SensorI2cSkeleton): The skeleton object.
9188 */
9189SensorI2c *
9190sensor_i2c_skeleton_new (void)
9191{
9192 return SENSOR_I2C (g_object_new (TYPE_SENSOR_I2C_SKELETON, NULL));
9193}
9194
9195/* ------------------------------------------------------------------------
9196 * Code for interface org.openbmc.SensorMatch
9197 * ------------------------------------------------------------------------
9198 */
9199
9200/**
9201 * SECTION:SensorMatch
9202 * @title: SensorMatch
9203 * @short_description: Generated C code for the org.openbmc.SensorMatch D-Bus interface
9204 *
9205 * 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.
9206 */
9207
9208/* ---- Introspection data for org.openbmc.SensorMatch ---- */
9209
9210static const _ExtendedGDBusArgInfo _sensor_match_signal_info_sensor_match_ARG_state =
9211{
9212 {
9213 -1,
9214 (gchar *) "state",
9215 (gchar *) "y",
9216 NULL
9217 },
9218 FALSE
9219};
9220
9221static const _ExtendedGDBusArgInfo * const _sensor_match_signal_info_sensor_match_ARG_pointers[] =
9222{
9223 &_sensor_match_signal_info_sensor_match_ARG_state,
9224 NULL
9225};
9226
9227static const _ExtendedGDBusSignalInfo _sensor_match_signal_info_sensor_match =
9228{
9229 {
9230 -1,
9231 (gchar *) "SensorMatch",
9232 (GDBusArgInfo **) &_sensor_match_signal_info_sensor_match_ARG_pointers,
9233 NULL
9234 },
9235 "sensor-match"
9236};
9237
9238static const _ExtendedGDBusSignalInfo * const _sensor_match_signal_info_pointers[] =
9239{
9240 &_sensor_match_signal_info_sensor_match,
9241 NULL
9242};
9243
9244static const _ExtendedGDBusPropertyInfo _sensor_match_property_info_match_value =
9245{
9246 {
9247 -1,
9248 (gchar *) "match_value",
9249 (gchar *) "v",
9250 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
9251 NULL
9252 },
9253 "match-value",
9254 FALSE
9255};
9256
9257static const _ExtendedGDBusPropertyInfo _sensor_match_property_info_state =
9258{
9259 {
9260 -1,
9261 (gchar *) "state",
9262 (gchar *) "y",
9263 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
9264 NULL
9265 },
9266 "state",
9267 FALSE
9268};
9269
9270static const _ExtendedGDBusPropertyInfo * const _sensor_match_property_info_pointers[] =
9271{
9272 &_sensor_match_property_info_match_value,
9273 &_sensor_match_property_info_state,
9274 NULL
9275};
9276
9277static const _ExtendedGDBusInterfaceInfo _sensor_match_interface_info =
9278{
9279 {
9280 -1,
9281 (gchar *) "org.openbmc.SensorMatch",
9282 NULL,
9283 (GDBusSignalInfo **) &_sensor_match_signal_info_pointers,
9284 (GDBusPropertyInfo **) &_sensor_match_property_info_pointers,
9285 NULL
9286 },
9287 "sensor-match",
9288};
9289
9290
9291/**
9292 * sensor_match_interface_info:
9293 *
9294 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link> D-Bus interface.
9295 *
9296 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
9297 */
9298GDBusInterfaceInfo *
9299sensor_match_interface_info (void)
9300{
9301 return (GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct;
9302}
9303
9304/**
9305 * sensor_match_override_properties:
9306 * @klass: The class structure for a #GObject<!-- -->-derived class.
9307 * @property_id_begin: The property id to assign to the first overridden property.
9308 *
9309 * Overrides all #GObject properties in the #SensorMatch interface for a concrete class.
9310 * The properties are overridden in the order they are defined.
9311 *
9312 * Returns: The last property id.
9313 */
9314guint
9315sensor_match_override_properties (GObjectClass *klass, guint property_id_begin)
9316{
9317 g_object_class_override_property (klass, property_id_begin++, "match-value");
9318 g_object_class_override_property (klass, property_id_begin++, "state");
9319 return property_id_begin - 1;
9320}
9321
9322
9323
9324/**
9325 * SensorMatch:
9326 *
9327 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>.
9328 */
9329
9330/**
9331 * SensorMatchIface:
9332 * @parent_iface: The parent interface.
9333 * @get_match_value: Getter for the #SensorMatch:match-value property.
9334 * @get_state: Getter for the #SensorMatch:state property.
9335 * @sensor_match: Handler for the #SensorMatch::sensor-match signal.
9336 *
9337 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>.
9338 */
9339
9340typedef SensorMatchIface SensorMatchInterface;
9341G_DEFINE_INTERFACE (SensorMatch, sensor_match, G_TYPE_OBJECT);
9342
9343static void
9344sensor_match_default_init (SensorMatchIface *iface)
9345{
9346 /* GObject signals for received D-Bus signals: */
9347 /**
9348 * SensorMatch::sensor-match:
9349 * @object: A #SensorMatch.
9350 * @arg_state: Argument.
9351 *
9352 * 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.
9353 *
9354 * 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.
9355 */
9356 g_signal_new ("sensor-match",
9357 G_TYPE_FROM_INTERFACE (iface),
9358 G_SIGNAL_RUN_LAST,
9359 G_STRUCT_OFFSET (SensorMatchIface, sensor_match),
9360 NULL,
9361 NULL,
9362 g_cclosure_marshal_generic,
9363 G_TYPE_NONE,
9364 1, G_TYPE_UCHAR);
9365
9366 /* GObject properties for D-Bus properties: */
9367 /**
9368 * SensorMatch:match-value:
9369 *
9370 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link>.
9371 *
9372 * 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.
9373 */
9374 g_object_interface_install_property (iface,
9375 g_param_spec_variant ("match-value", "match_value", "match_value", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
9376 /**
9377 * SensorMatch:state:
9378 *
9379 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorMatch.state">"state"</link>.
9380 *
9381 * 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.
9382 */
9383 g_object_interface_install_property (iface,
9384 g_param_spec_uchar ("state", "state", "state", 0, 255, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
9385}
9386
9387/**
9388 * sensor_match_get_match_value: (skip)
9389 * @object: A #SensorMatch.
9390 *
9391 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link> D-Bus property.
9392 *
9393 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
9394 *
9395 * <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>
9396 *
9397 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
9398 */
9399GVariant *
9400sensor_match_get_match_value (SensorMatch *object)
9401{
9402 return SENSOR_MATCH_GET_IFACE (object)->get_match_value (object);
9403}
9404
9405/**
9406 * sensor_match_dup_match_value: (skip)
9407 * @object: A #SensorMatch.
9408 *
9409 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link> D-Bus property.
9410 *
9411 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
9412 *
9413 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
9414 */
9415GVariant *
9416sensor_match_dup_match_value (SensorMatch *object)
9417{
9418 GVariant *value;
9419 g_object_get (G_OBJECT (object), "match-value", &value, NULL);
9420 return value;
9421}
9422
9423/**
9424 * sensor_match_set_match_value: (skip)
9425 * @object: A #SensorMatch.
9426 * @value: The value to set.
9427 *
9428 * Sets the <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link> D-Bus property to @value.
9429 *
9430 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
9431 */
9432void
9433sensor_match_set_match_value (SensorMatch *object, GVariant *value)
9434{
9435 g_object_set (G_OBJECT (object), "match-value", value, NULL);
9436}
9437
9438/**
9439 * sensor_match_get_state: (skip)
9440 * @object: A #SensorMatch.
9441 *
9442 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorMatch.state">"state"</link> D-Bus property.
9443 *
9444 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
9445 *
9446 * Returns: The property value.
9447 */
9448guchar
9449sensor_match_get_state (SensorMatch *object)
9450{
9451 return SENSOR_MATCH_GET_IFACE (object)->get_state (object);
9452}
9453
9454/**
9455 * sensor_match_set_state: (skip)
9456 * @object: A #SensorMatch.
9457 * @value: The value to set.
9458 *
9459 * Sets the <link linkend="gdbus-property-org-openbmc-SensorMatch.state">"state"</link> D-Bus property to @value.
9460 *
9461 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
9462 */
9463void
9464sensor_match_set_state (SensorMatch *object, guchar value)
9465{
9466 g_object_set (G_OBJECT (object), "state", value, NULL);
9467}
9468
9469/**
9470 * sensor_match_emit_sensor_match:
9471 * @object: A #SensorMatch.
9472 * @arg_state: Argument to pass with the signal.
9473 *
9474 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorMatch.SensorMatch">"SensorMatch"</link> D-Bus signal.
9475 */
9476void
9477sensor_match_emit_sensor_match (
9478 SensorMatch *object,
9479 guchar arg_state)
9480{
9481 g_signal_emit_by_name (object, "sensor-match", arg_state);
9482}
9483
9484/* ------------------------------------------------------------------------ */
9485
9486/**
9487 * SensorMatchProxy:
9488 *
9489 * The #SensorMatchProxy structure contains only private data and should only be accessed using the provided API.
9490 */
9491
9492/**
9493 * SensorMatchProxyClass:
9494 * @parent_class: The parent class.
9495 *
9496 * Class structure for #SensorMatchProxy.
9497 */
9498
9499struct _SensorMatchProxyPrivate
9500{
9501 GData *qdata;
9502};
9503
9504static void sensor_match_proxy_iface_init (SensorMatchIface *iface);
9505
9506#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
9507G_DEFINE_TYPE_WITH_CODE (SensorMatchProxy, sensor_match_proxy, G_TYPE_DBUS_PROXY,
9508 G_ADD_PRIVATE (SensorMatchProxy)
9509 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_proxy_iface_init));
9510
9511#else
9512G_DEFINE_TYPE_WITH_CODE (SensorMatchProxy, sensor_match_proxy, G_TYPE_DBUS_PROXY,
9513 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_proxy_iface_init));
9514
9515#endif
9516static void
9517sensor_match_proxy_finalize (GObject *object)
9518{
9519 SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (object);
9520 g_datalist_clear (&proxy->priv->qdata);
9521 G_OBJECT_CLASS (sensor_match_proxy_parent_class)->finalize (object);
9522}
9523
9524static void
9525sensor_match_proxy_get_property (GObject *object,
9526 guint prop_id,
9527 GValue *value,
9528 GParamSpec *pspec G_GNUC_UNUSED)
9529{
9530 const _ExtendedGDBusPropertyInfo *info;
9531 GVariant *variant;
9532 g_assert (prop_id != 0 && prop_id - 1 < 2);
9533 info = _sensor_match_property_info_pointers[prop_id - 1];
9534 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
9535 if (info->use_gvariant)
9536 {
9537 g_value_set_variant (value, variant);
9538 }
9539 else
9540 {
9541 if (variant != NULL)
9542 g_dbus_gvariant_to_gvalue (variant, value);
9543 }
9544 if (variant != NULL)
9545 g_variant_unref (variant);
9546}
9547
9548static void
9549sensor_match_proxy_set_property_cb (GDBusProxy *proxy,
9550 GAsyncResult *res,
9551 gpointer user_data)
9552{
9553 const _ExtendedGDBusPropertyInfo *info = user_data;
9554 GError *error;
9555 GVariant *_ret;
9556 error = NULL;
9557 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
9558 if (!_ret)
9559 {
9560 g_warning ("Error setting property '%s' on interface org.openbmc.SensorMatch: %s (%s, %d)",
9561 info->parent_struct.name,
9562 error->message, g_quark_to_string (error->domain), error->code);
9563 g_error_free (error);
9564 }
9565 else
9566 {
9567 g_variant_unref (_ret);
9568 }
9569}
9570
9571static void
9572sensor_match_proxy_set_property (GObject *object,
9573 guint prop_id,
9574 const GValue *value,
9575 GParamSpec *pspec G_GNUC_UNUSED)
9576{
9577 const _ExtendedGDBusPropertyInfo *info;
9578 GVariant *variant;
9579 g_assert (prop_id != 0 && prop_id - 1 < 2);
9580 info = _sensor_match_property_info_pointers[prop_id - 1];
9581 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
9582 g_dbus_proxy_call (G_DBUS_PROXY (object),
9583 "org.freedesktop.DBus.Properties.Set",
9584 g_variant_new ("(ssv)", "org.openbmc.SensorMatch", info->parent_struct.name, variant),
9585 G_DBUS_CALL_FLAGS_NONE,
9586 -1,
9587 NULL, (GAsyncReadyCallback) sensor_match_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
9588 g_variant_unref (variant);
9589}
9590
9591static void
9592sensor_match_proxy_g_signal (GDBusProxy *proxy,
9593 const gchar *sender_name G_GNUC_UNUSED,
9594 const gchar *signal_name,
9595 GVariant *parameters)
9596{
9597 _ExtendedGDBusSignalInfo *info;
9598 GVariantIter iter;
9599 GVariant *child;
9600 GValue *paramv;
9601 guint num_params;
9602 guint n;
9603 guint signal_id;
9604 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, signal_name);
9605 if (info == NULL)
9606 return;
9607 num_params = g_variant_n_children (parameters);
9608 paramv = g_new0 (GValue, num_params + 1);
9609 g_value_init (&paramv[0], TYPE_SENSOR_MATCH);
9610 g_value_set_object (&paramv[0], proxy);
9611 g_variant_iter_init (&iter, parameters);
9612 n = 1;
9613 while ((child = g_variant_iter_next_value (&iter)) != NULL)
9614 {
9615 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
9616 if (arg_info->use_gvariant)
9617 {
9618 g_value_init (&paramv[n], G_TYPE_VARIANT);
9619 g_value_set_variant (&paramv[n], child);
9620 n++;
9621 }
9622 else
9623 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
9624 g_variant_unref (child);
9625 }
9626 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_MATCH);
9627 g_signal_emitv (paramv, signal_id, 0, NULL);
9628 for (n = 0; n < num_params + 1; n++)
9629 g_value_unset (&paramv[n]);
9630 g_free (paramv);
9631}
9632
9633static void
9634sensor_match_proxy_g_properties_changed (GDBusProxy *_proxy,
9635 GVariant *changed_properties,
9636 const gchar *const *invalidated_properties)
9637{
9638 SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (_proxy);
9639 guint n;
9640 const gchar *key;
9641 GVariantIter *iter;
9642 _ExtendedGDBusPropertyInfo *info;
9643 g_variant_get (changed_properties, "a{sv}", &iter);
9644 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
9645 {
9646 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, key);
9647 g_datalist_remove_data (&proxy->priv->qdata, key);
9648 if (info != NULL)
9649 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
9650 }
9651 g_variant_iter_free (iter);
9652 for (n = 0; invalidated_properties[n] != NULL; n++)
9653 {
9654 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, invalidated_properties[n]);
9655 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
9656 if (info != NULL)
9657 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
9658 }
9659}
9660
9661static GVariant *
9662sensor_match_proxy_get_match_value (SensorMatch *object)
9663{
9664 SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (object);
9665 GVariant *variant;
9666 GVariant *value = NULL;
9667 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "match_value");
9668 value = variant;
9669 if (variant != NULL)
9670 g_variant_unref (variant);
9671 return value;
9672}
9673
9674static guchar
9675sensor_match_proxy_get_state (SensorMatch *object)
9676{
9677 SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (object);
9678 GVariant *variant;
9679 guchar value = 0;
9680 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state");
9681 if (variant != NULL)
9682 {
9683 value = g_variant_get_byte (variant);
9684 g_variant_unref (variant);
9685 }
9686 return value;
9687}
9688
9689static void
9690sensor_match_proxy_init (SensorMatchProxy *proxy)
9691{
9692#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
9693 proxy->priv = sensor_match_proxy_get_instance_private (proxy);
9694#else
9695 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_MATCH_PROXY, SensorMatchProxyPrivate);
9696#endif
9697
9698 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_match_interface_info ());
9699}
9700
9701static void
9702sensor_match_proxy_class_init (SensorMatchProxyClass *klass)
9703{
9704 GObjectClass *gobject_class;
9705 GDBusProxyClass *proxy_class;
9706
9707 gobject_class = G_OBJECT_CLASS (klass);
9708 gobject_class->finalize = sensor_match_proxy_finalize;
9709 gobject_class->get_property = sensor_match_proxy_get_property;
9710 gobject_class->set_property = sensor_match_proxy_set_property;
9711
9712 proxy_class = G_DBUS_PROXY_CLASS (klass);
9713 proxy_class->g_signal = sensor_match_proxy_g_signal;
9714 proxy_class->g_properties_changed = sensor_match_proxy_g_properties_changed;
9715
9716 sensor_match_override_properties (gobject_class, 1);
9717
9718#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
9719 g_type_class_add_private (klass, sizeof (SensorMatchProxyPrivate));
9720#endif
9721}
9722
9723static void
9724sensor_match_proxy_iface_init (SensorMatchIface *iface)
9725{
9726 iface->get_match_value = sensor_match_proxy_get_match_value;
9727 iface->get_state = sensor_match_proxy_get_state;
9728}
9729
9730/**
9731 * sensor_match_proxy_new:
9732 * @connection: A #GDBusConnection.
9733 * @flags: Flags from the #GDBusProxyFlags enumeration.
9734 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
9735 * @object_path: An object path.
9736 * @cancellable: (allow-none): A #GCancellable or %NULL.
9737 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
9738 * @user_data: User data to pass to @callback.
9739 *
9740 * 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.
9741 *
9742 * 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.
9743 * You can then call sensor_match_proxy_new_finish() to get the result of the operation.
9744 *
9745 * See sensor_match_proxy_new_sync() for the synchronous, blocking version of this constructor.
9746 */
9747void
9748sensor_match_proxy_new (
9749 GDBusConnection *connection,
9750 GDBusProxyFlags flags,
9751 const gchar *name,
9752 const gchar *object_path,
9753 GCancellable *cancellable,
9754 GAsyncReadyCallback callback,
9755 gpointer user_data)
9756{
9757 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);
9758}
9759
9760/**
9761 * sensor_match_proxy_new_finish:
9762 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_match_proxy_new().
9763 * @error: Return location for error or %NULL
9764 *
9765 * Finishes an operation started with sensor_match_proxy_new().
9766 *
9767 * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set.
9768 */
9769SensorMatch *
9770sensor_match_proxy_new_finish (
9771 GAsyncResult *res,
9772 GError **error)
9773{
9774 GObject *ret;
9775 GObject *source_object;
9776 source_object = g_async_result_get_source_object (res);
9777 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
9778 g_object_unref (source_object);
9779 if (ret != NULL)
9780 return SENSOR_MATCH (ret);
9781 else
9782 return NULL;
9783}
9784
9785/**
9786 * sensor_match_proxy_new_sync:
9787 * @connection: A #GDBusConnection.
9788 * @flags: Flags from the #GDBusProxyFlags enumeration.
9789 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
9790 * @object_path: An object path.
9791 * @cancellable: (allow-none): A #GCancellable or %NULL.
9792 * @error: Return location for error or %NULL
9793 *
9794 * 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.
9795 *
9796 * The calling thread is blocked until a reply is received.
9797 *
9798 * See sensor_match_proxy_new() for the asynchronous version of this constructor.
9799 *
9800 * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set.
9801 */
9802SensorMatch *
9803sensor_match_proxy_new_sync (
9804 GDBusConnection *connection,
9805 GDBusProxyFlags flags,
9806 const gchar *name,
9807 const gchar *object_path,
9808 GCancellable *cancellable,
9809 GError **error)
9810{
9811 GInitable *ret;
9812 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);
9813 if (ret != NULL)
9814 return SENSOR_MATCH (ret);
9815 else
9816 return NULL;
9817}
9818
9819
9820/**
9821 * sensor_match_proxy_new_for_bus:
9822 * @bus_type: A #GBusType.
9823 * @flags: Flags from the #GDBusProxyFlags enumeration.
9824 * @name: A bus name (well-known or unique).
9825 * @object_path: An object path.
9826 * @cancellable: (allow-none): A #GCancellable or %NULL.
9827 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
9828 * @user_data: User data to pass to @callback.
9829 *
9830 * Like sensor_match_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
9831 *
9832 * 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.
9833 * You can then call sensor_match_proxy_new_for_bus_finish() to get the result of the operation.
9834 *
9835 * See sensor_match_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
9836 */
9837void
9838sensor_match_proxy_new_for_bus (
9839 GBusType bus_type,
9840 GDBusProxyFlags flags,
9841 const gchar *name,
9842 const gchar *object_path,
9843 GCancellable *cancellable,
9844 GAsyncReadyCallback callback,
9845 gpointer user_data)
9846{
9847 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);
9848}
9849
9850/**
9851 * sensor_match_proxy_new_for_bus_finish:
9852 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_match_proxy_new_for_bus().
9853 * @error: Return location for error or %NULL
9854 *
9855 * Finishes an operation started with sensor_match_proxy_new_for_bus().
9856 *
9857 * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set.
9858 */
9859SensorMatch *
9860sensor_match_proxy_new_for_bus_finish (
9861 GAsyncResult *res,
9862 GError **error)
9863{
9864 GObject *ret;
9865 GObject *source_object;
9866 source_object = g_async_result_get_source_object (res);
9867 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
9868 g_object_unref (source_object);
9869 if (ret != NULL)
9870 return SENSOR_MATCH (ret);
9871 else
9872 return NULL;
9873}
9874
9875/**
9876 * sensor_match_proxy_new_for_bus_sync:
9877 * @bus_type: A #GBusType.
9878 * @flags: Flags from the #GDBusProxyFlags enumeration.
9879 * @name: A bus name (well-known or unique).
9880 * @object_path: An object path.
9881 * @cancellable: (allow-none): A #GCancellable or %NULL.
9882 * @error: Return location for error or %NULL
9883 *
9884 * Like sensor_match_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
9885 *
9886 * The calling thread is blocked until a reply is received.
9887 *
9888 * See sensor_match_proxy_new_for_bus() for the asynchronous version of this constructor.
9889 *
9890 * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set.
9891 */
9892SensorMatch *
9893sensor_match_proxy_new_for_bus_sync (
9894 GBusType bus_type,
9895 GDBusProxyFlags flags,
9896 const gchar *name,
9897 const gchar *object_path,
9898 GCancellable *cancellable,
9899 GError **error)
9900{
9901 GInitable *ret;
9902 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);
9903 if (ret != NULL)
9904 return SENSOR_MATCH (ret);
9905 else
9906 return NULL;
9907}
9908
9909
9910/* ------------------------------------------------------------------------ */
9911
9912/**
9913 * SensorMatchSkeleton:
9914 *
9915 * The #SensorMatchSkeleton structure contains only private data and should only be accessed using the provided API.
9916 */
9917
9918/**
9919 * SensorMatchSkeletonClass:
9920 * @parent_class: The parent class.
9921 *
9922 * Class structure for #SensorMatchSkeleton.
9923 */
9924
9925struct _SensorMatchSkeletonPrivate
9926{
9927 GValue *properties;
9928 GList *changed_properties;
9929 GSource *changed_properties_idle_source;
9930 GMainContext *context;
9931 GMutex lock;
9932};
9933
9934static void
9935_sensor_match_skeleton_handle_method_call (
9936 GDBusConnection *connection G_GNUC_UNUSED,
9937 const gchar *sender G_GNUC_UNUSED,
9938 const gchar *object_path G_GNUC_UNUSED,
9939 const gchar *interface_name,
9940 const gchar *method_name,
9941 GVariant *parameters,
9942 GDBusMethodInvocation *invocation,
9943 gpointer user_data)
9944{
9945 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data);
9946 _ExtendedGDBusMethodInfo *info;
9947 GVariantIter iter;
9948 GVariant *child;
9949 GValue *paramv;
9950 guint num_params;
9951 guint num_extra;
9952 guint n;
9953 guint signal_id;
9954 GValue return_value = G_VALUE_INIT;
9955 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
9956 g_assert (info != NULL);
9957 num_params = g_variant_n_children (parameters);
9958 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
9959 n = 0;
9960 g_value_init (&paramv[n], TYPE_SENSOR_MATCH);
9961 g_value_set_object (&paramv[n++], skeleton);
9962 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
9963 g_value_set_object (&paramv[n++], invocation);
9964 if (info->pass_fdlist)
9965 {
9966#ifdef G_OS_UNIX
9967 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
9968 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
9969#else
9970 g_assert_not_reached ();
9971#endif
9972 }
9973 g_variant_iter_init (&iter, parameters);
9974 while ((child = g_variant_iter_next_value (&iter)) != NULL)
9975 {
9976 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
9977 if (arg_info->use_gvariant)
9978 {
9979 g_value_init (&paramv[n], G_TYPE_VARIANT);
9980 g_value_set_variant (&paramv[n], child);
9981 n++;
9982 }
9983 else
9984 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
9985 g_variant_unref (child);
9986 }
9987 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_MATCH);
9988 g_value_init (&return_value, G_TYPE_BOOLEAN);
9989 g_signal_emitv (paramv, signal_id, 0, &return_value);
9990 if (!g_value_get_boolean (&return_value))
9991 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);
9992 g_value_unset (&return_value);
9993 for (n = 0; n < num_params + num_extra; n++)
9994 g_value_unset (&paramv[n]);
9995 g_free (paramv);
9996}
9997
9998static GVariant *
9999_sensor_match_skeleton_handle_get_property (
10000 GDBusConnection *connection G_GNUC_UNUSED,
10001 const gchar *sender G_GNUC_UNUSED,
10002 const gchar *object_path G_GNUC_UNUSED,
10003 const gchar *interface_name G_GNUC_UNUSED,
10004 const gchar *property_name,
10005 GError **error,
10006 gpointer user_data)
10007{
10008 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data);
10009 GValue value = G_VALUE_INIT;
10010 GParamSpec *pspec;
10011 _ExtendedGDBusPropertyInfo *info;
10012 GVariant *ret;
10013 ret = NULL;
10014 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, property_name);
10015 g_assert (info != NULL);
10016 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
10017 if (pspec == NULL)
10018 {
10019 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
10020 }
10021 else
10022 {
10023 g_value_init (&value, pspec->value_type);
10024 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
10025 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
10026 g_value_unset (&value);
10027 }
10028 return ret;
10029}
10030
10031static gboolean
10032_sensor_match_skeleton_handle_set_property (
10033 GDBusConnection *connection G_GNUC_UNUSED,
10034 const gchar *sender G_GNUC_UNUSED,
10035 const gchar *object_path G_GNUC_UNUSED,
10036 const gchar *interface_name G_GNUC_UNUSED,
10037 const gchar *property_name,
10038 GVariant *variant,
10039 GError **error,
10040 gpointer user_data)
10041{
10042 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data);
10043 GValue value = G_VALUE_INIT;
10044 GParamSpec *pspec;
10045 _ExtendedGDBusPropertyInfo *info;
10046 gboolean ret;
10047 ret = FALSE;
10048 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, property_name);
10049 g_assert (info != NULL);
10050 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
10051 if (pspec == NULL)
10052 {
10053 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
10054 }
10055 else
10056 {
10057 if (info->use_gvariant)
10058 g_value_set_variant (&value, variant);
10059 else
10060 g_dbus_gvariant_to_gvalue (variant, &value);
10061 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
10062 g_value_unset (&value);
10063 ret = TRUE;
10064 }
10065 return ret;
10066}
10067
10068static const GDBusInterfaceVTable _sensor_match_skeleton_vtable =
10069{
10070 _sensor_match_skeleton_handle_method_call,
10071 _sensor_match_skeleton_handle_get_property,
10072 _sensor_match_skeleton_handle_set_property,
10073 {NULL}
10074};
10075
10076static GDBusInterfaceInfo *
10077sensor_match_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
10078{
10079 return sensor_match_interface_info ();
10080}
10081
10082static GDBusInterfaceVTable *
10083sensor_match_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
10084{
10085 return (GDBusInterfaceVTable *) &_sensor_match_skeleton_vtable;
10086}
10087
10088static GVariant *
10089sensor_match_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
10090{
10091 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (_skeleton);
10092
10093 GVariantBuilder builder;
10094 guint n;
10095 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
10096 if (_sensor_match_interface_info.parent_struct.properties == NULL)
10097 goto out;
10098 for (n = 0; _sensor_match_interface_info.parent_struct.properties[n] != NULL; n++)
10099 {
10100 GDBusPropertyInfo *info = _sensor_match_interface_info.parent_struct.properties[n];
10101 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
10102 {
10103 GVariant *value;
10104 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);
10105 if (value != NULL)
10106 {
10107 g_variant_take_ref (value);
10108 g_variant_builder_add (&builder, "{sv}", info->name, value);
10109 g_variant_unref (value);
10110 }
10111 }
10112 }
10113out:
10114 return g_variant_builder_end (&builder);
10115}
10116
10117static gboolean _sensor_match_emit_changed (gpointer user_data);
10118
10119static void
10120sensor_match_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
10121{
10122 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (_skeleton);
10123 gboolean emit_changed = FALSE;
10124
10125 g_mutex_lock (&skeleton->priv->lock);
10126 if (skeleton->priv->changed_properties_idle_source != NULL)
10127 {
10128 g_source_destroy (skeleton->priv->changed_properties_idle_source);
10129 skeleton->priv->changed_properties_idle_source = NULL;
10130 emit_changed = TRUE;
10131 }
10132 g_mutex_unlock (&skeleton->priv->lock);
10133
10134 if (emit_changed)
10135 _sensor_match_emit_changed (skeleton);
10136}
10137
10138static void
10139_sensor_match_on_signal_sensor_match (
10140 SensorMatch *object,
10141 guchar arg_state)
10142{
10143 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
10144
10145 GList *connections, *l;
10146 GVariant *signal_variant;
10147 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
10148
10149 signal_variant = g_variant_ref_sink (g_variant_new ("(y)",
10150 arg_state));
10151 for (l = connections; l != NULL; l = l->next)
10152 {
10153 GDBusConnection *connection = l->data;
10154 g_dbus_connection_emit_signal (connection,
10155 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorMatch", "SensorMatch",
10156 signal_variant, NULL);
10157 }
10158 g_variant_unref (signal_variant);
10159 g_list_free_full (connections, g_object_unref);
10160}
10161
10162static void sensor_match_skeleton_iface_init (SensorMatchIface *iface);
10163#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
10164G_DEFINE_TYPE_WITH_CODE (SensorMatchSkeleton, sensor_match_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
10165 G_ADD_PRIVATE (SensorMatchSkeleton)
10166 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_skeleton_iface_init));
10167
10168#else
10169G_DEFINE_TYPE_WITH_CODE (SensorMatchSkeleton, sensor_match_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
10170 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_skeleton_iface_init));
10171
10172#endif
10173static void
10174sensor_match_skeleton_finalize (GObject *object)
10175{
10176 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
10177 guint n;
10178 for (n = 0; n < 2; n++)
10179 g_value_unset (&skeleton->priv->properties[n]);
10180 g_free (skeleton->priv->properties);
10181 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
10182 if (skeleton->priv->changed_properties_idle_source != NULL)
10183 g_source_destroy (skeleton->priv->changed_properties_idle_source);
10184 g_main_context_unref (skeleton->priv->context);
10185 g_mutex_clear (&skeleton->priv->lock);
10186 G_OBJECT_CLASS (sensor_match_skeleton_parent_class)->finalize (object);
10187}
10188
10189static void
10190sensor_match_skeleton_get_property (GObject *object,
10191 guint prop_id,
10192 GValue *value,
10193 GParamSpec *pspec G_GNUC_UNUSED)
10194{
10195 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
10196 g_assert (prop_id != 0 && prop_id - 1 < 2);
10197 g_mutex_lock (&skeleton->priv->lock);
10198 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
10199 g_mutex_unlock (&skeleton->priv->lock);
10200}
10201
10202static gboolean
10203_sensor_match_emit_changed (gpointer user_data)
10204{
10205 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data);
10206 GList *l;
10207 GVariantBuilder builder;
10208 GVariantBuilder invalidated_builder;
10209 guint num_changes;
10210
10211 g_mutex_lock (&skeleton->priv->lock);
10212 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
10213 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
10214 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
10215 {
10216 ChangedProperty *cp = l->data;
10217 GVariant *variant;
10218 const GValue *cur_value;
10219
10220 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
10221 if (!_g_value_equal (cur_value, &cp->orig_value))
10222 {
10223 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
10224 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
10225 g_variant_unref (variant);
10226 num_changes++;
10227 }
10228 }
10229 if (num_changes > 0)
10230 {
10231 GList *connections, *ll;
10232 GVariant *signal_variant;
10233 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorMatch",
10234 &builder, &invalidated_builder));
10235 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
10236 for (ll = connections; ll != NULL; ll = ll->next)
10237 {
10238 GDBusConnection *connection = ll->data;
10239
10240 g_dbus_connection_emit_signal (connection,
10241 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
10242 "org.freedesktop.DBus.Properties",
10243 "PropertiesChanged",
10244 signal_variant,
10245 NULL);
10246 }
10247 g_variant_unref (signal_variant);
10248 g_list_free_full (connections, g_object_unref);
10249 }
10250 else
10251 {
10252 g_variant_builder_clear (&builder);
10253 g_variant_builder_clear (&invalidated_builder);
10254 }
10255 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
10256 skeleton->priv->changed_properties = NULL;
10257 skeleton->priv->changed_properties_idle_source = NULL;
10258 g_mutex_unlock (&skeleton->priv->lock);
10259 return FALSE;
10260}
10261
10262static void
10263_sensor_match_schedule_emit_changed (SensorMatchSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
10264{
10265 ChangedProperty *cp;
10266 GList *l;
10267 cp = NULL;
10268 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
10269 {
10270 ChangedProperty *i_cp = l->data;
10271 if (i_cp->info == info)
10272 {
10273 cp = i_cp;
10274 break;
10275 }
10276 }
10277 if (cp == NULL)
10278 {
10279 cp = g_new0 (ChangedProperty, 1);
10280 cp->prop_id = prop_id;
10281 cp->info = info;
10282 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
10283 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
10284 g_value_copy (orig_value, &cp->orig_value);
10285 }
10286}
10287
10288static void
10289sensor_match_skeleton_notify (GObject *object,
10290 GParamSpec *pspec G_GNUC_UNUSED)
10291{
10292 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
10293 g_mutex_lock (&skeleton->priv->lock);
10294 if (skeleton->priv->changed_properties != NULL &&
10295 skeleton->priv->changed_properties_idle_source == NULL)
10296 {
10297 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
10298 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
10299 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_match_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
10300 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
10301 g_source_unref (skeleton->priv->changed_properties_idle_source);
10302 }
10303 g_mutex_unlock (&skeleton->priv->lock);
10304}
10305
10306static void
10307sensor_match_skeleton_set_property (GObject *object,
10308 guint prop_id,
10309 const GValue *value,
10310 GParamSpec *pspec)
10311{
10312 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
10313 g_assert (prop_id != 0 && prop_id - 1 < 2);
10314 g_mutex_lock (&skeleton->priv->lock);
10315 g_object_freeze_notify (object);
10316 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
10317 {
10318 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
10319 _sensor_match_schedule_emit_changed (skeleton, _sensor_match_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
10320 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
10321 g_object_notify_by_pspec (object, pspec);
10322 }
10323 g_mutex_unlock (&skeleton->priv->lock);
10324 g_object_thaw_notify (object);
10325}
10326
10327static void
10328sensor_match_skeleton_init (SensorMatchSkeleton *skeleton)
10329{
10330#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
10331 skeleton->priv = sensor_match_skeleton_get_instance_private (skeleton);
10332#else
10333 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_MATCH_SKELETON, SensorMatchSkeletonPrivate);
10334#endif
10335
10336 g_mutex_init (&skeleton->priv->lock);
10337 skeleton->priv->context = g_main_context_ref_thread_default ();
10338 skeleton->priv->properties = g_new0 (GValue, 2);
10339 g_value_init (&skeleton->priv->properties[0], G_TYPE_VARIANT);
10340 g_value_init (&skeleton->priv->properties[1], G_TYPE_UCHAR);
10341}
10342
10343static GVariant *
10344sensor_match_skeleton_get_match_value (SensorMatch *object)
10345{
10346 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
10347 GVariant *value;
10348 g_mutex_lock (&skeleton->priv->lock);
10349 value = g_value_get_variant (&(skeleton->priv->properties[0]));
10350 g_mutex_unlock (&skeleton->priv->lock);
10351 return value;
10352}
10353
10354static guchar
10355sensor_match_skeleton_get_state (SensorMatch *object)
10356{
10357 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
10358 guchar value;
10359 g_mutex_lock (&skeleton->priv->lock);
10360 value = g_value_get_uchar (&(skeleton->priv->properties[1]));
10361 g_mutex_unlock (&skeleton->priv->lock);
10362 return value;
10363}
10364
10365static void
10366sensor_match_skeleton_class_init (SensorMatchSkeletonClass *klass)
10367{
10368 GObjectClass *gobject_class;
10369 GDBusInterfaceSkeletonClass *skeleton_class;
10370
10371 gobject_class = G_OBJECT_CLASS (klass);
10372 gobject_class->finalize = sensor_match_skeleton_finalize;
10373 gobject_class->get_property = sensor_match_skeleton_get_property;
10374 gobject_class->set_property = sensor_match_skeleton_set_property;
10375 gobject_class->notify = sensor_match_skeleton_notify;
10376
10377
10378 sensor_match_override_properties (gobject_class, 1);
10379
10380 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
10381 skeleton_class->get_info = sensor_match_skeleton_dbus_interface_get_info;
10382 skeleton_class->get_properties = sensor_match_skeleton_dbus_interface_get_properties;
10383 skeleton_class->flush = sensor_match_skeleton_dbus_interface_flush;
10384 skeleton_class->get_vtable = sensor_match_skeleton_dbus_interface_get_vtable;
10385
10386#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
10387 g_type_class_add_private (klass, sizeof (SensorMatchSkeletonPrivate));
10388#endif
10389}
10390
10391static void
10392sensor_match_skeleton_iface_init (SensorMatchIface *iface)
10393{
10394 iface->sensor_match = _sensor_match_on_signal_sensor_match;
10395 iface->get_match_value = sensor_match_skeleton_get_match_value;
10396 iface->get_state = sensor_match_skeleton_get_state;
10397}
10398
10399/**
10400 * sensor_match_skeleton_new:
10401 *
10402 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>.
10403 *
10404 * Returns: (transfer full) (type SensorMatchSkeleton): The skeleton object.
10405 */
10406SensorMatch *
10407sensor_match_skeleton_new (void)
10408{
10409 return SENSOR_MATCH (g_object_new (TYPE_SENSOR_MATCH_SKELETON, NULL));
10410}
10411
10412/* ------------------------------------------------------------------------
10413 * Code for interface org.openbmc.Process
10414 * ------------------------------------------------------------------------
10415 */
10416
10417/**
10418 * SECTION:Process
10419 * @title: Process
10420 * @short_description: Generated C code for the org.openbmc.Process D-Bus interface
10421 *
10422 * 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.
10423 */
10424
10425/* ---- Introspection data for org.openbmc.Process ---- */
10426
10427static const _ExtendedGDBusMethodInfo _process_method_info_stop =
10428{
10429 {
10430 -1,
10431 (gchar *) "stop",
10432 NULL,
10433 NULL,
10434 NULL
10435 },
10436 "handle-stop",
10437 FALSE
10438};
10439
10440static const _ExtendedGDBusMethodInfo * const _process_method_info_pointers[] =
10441{
10442 &_process_method_info_stop,
10443 NULL
10444};
10445
10446static const _ExtendedGDBusInterfaceInfo _process_interface_info =
10447{
10448 {
10449 -1,
10450 (gchar *) "org.openbmc.Process",
10451 (GDBusMethodInfo **) &_process_method_info_pointers,
10452 NULL,
10453 NULL,
10454 NULL
10455 },
10456 "process",
10457};
10458
10459
10460/**
10461 * process_interface_info:
10462 *
10463 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link> D-Bus interface.
10464 *
10465 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
10466 */
10467GDBusInterfaceInfo *
10468process_interface_info (void)
10469{
10470 return (GDBusInterfaceInfo *) &_process_interface_info.parent_struct;
10471}
10472
10473/**
10474 * process_override_properties:
10475 * @klass: The class structure for a #GObject<!-- -->-derived class.
10476 * @property_id_begin: The property id to assign to the first overridden property.
10477 *
10478 * Overrides all #GObject properties in the #Process interface for a concrete class.
10479 * The properties are overridden in the order they are defined.
10480 *
10481 * Returns: The last property id.
10482 */
10483guint
10484process_override_properties (GObjectClass *klass, guint property_id_begin)
10485{
10486 return property_id_begin - 1;
10487}
10488
10489
10490
10491/**
10492 * Process:
10493 *
10494 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link>.
10495 */
10496
10497/**
10498 * ProcessIface:
10499 * @parent_iface: The parent interface.
10500 * @handle_stop: Handler for the #Process::handle-stop signal.
10501 *
10502 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link>.
10503 */
10504
10505typedef ProcessIface ProcessInterface;
10506G_DEFINE_INTERFACE (Process, process, G_TYPE_OBJECT);
10507
10508static void
10509process_default_init (ProcessIface *iface)
10510{
10511 /* GObject signals for incoming D-Bus method calls: */
10512 /**
10513 * Process::handle-stop:
10514 * @object: A #Process.
10515 * @invocation: A #GDBusMethodInvocation.
10516 *
10517 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Process.stop">stop()</link> D-Bus method.
10518 *
10519 * 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.
10520 *
10521 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
10522 */
10523 g_signal_new ("handle-stop",
10524 G_TYPE_FROM_INTERFACE (iface),
10525 G_SIGNAL_RUN_LAST,
10526 G_STRUCT_OFFSET (ProcessIface, handle_stop),
10527 g_signal_accumulator_true_handled,
10528 NULL,
10529 g_cclosure_marshal_generic,
10530 G_TYPE_BOOLEAN,
10531 1,
10532 G_TYPE_DBUS_METHOD_INVOCATION);
10533
10534}
10535
10536/**
10537 * process_call_stop:
10538 * @proxy: A #ProcessProxy.
10539 * @cancellable: (allow-none): A #GCancellable or %NULL.
10540 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
10541 * @user_data: User data to pass to @callback.
10542 *
10543 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Process.stop">stop()</link> D-Bus method on @proxy.
10544 * 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.
10545 * You can then call process_call_stop_finish() to get the result of the operation.
10546 *
10547 * See process_call_stop_sync() for the synchronous, blocking version of this method.
10548 */
10549void
10550process_call_stop (
10551 Process *proxy,
10552 GCancellable *cancellable,
10553 GAsyncReadyCallback callback,
10554 gpointer user_data)
10555{
10556 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
10557 "stop",
10558 g_variant_new ("()"),
10559 G_DBUS_CALL_FLAGS_NONE,
10560 -1,
10561 cancellable,
10562 callback,
10563 user_data);
10564}
10565
10566/**
10567 * process_call_stop_finish:
10568 * @proxy: A #ProcessProxy.
10569 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to process_call_stop().
10570 * @error: Return location for error or %NULL.
10571 *
10572 * Finishes an operation started with process_call_stop().
10573 *
10574 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
10575 */
10576gboolean
10577process_call_stop_finish (
10578 Process *proxy,
10579 GAsyncResult *res,
10580 GError **error)
10581{
10582 GVariant *_ret;
10583 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
10584 if (_ret == NULL)
10585 goto _out;
10586 g_variant_get (_ret,
10587 "()");
10588 g_variant_unref (_ret);
10589_out:
10590 return _ret != NULL;
10591}
10592
10593/**
10594 * process_call_stop_sync:
10595 * @proxy: A #ProcessProxy.
10596 * @cancellable: (allow-none): A #GCancellable or %NULL.
10597 * @error: Return location for error or %NULL.
10598 *
10599 * 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.
10600 *
10601 * See process_call_stop() for the asynchronous version of this method.
10602 *
10603 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
10604 */
10605gboolean
10606process_call_stop_sync (
10607 Process *proxy,
10608 GCancellable *cancellable,
10609 GError **error)
10610{
10611 GVariant *_ret;
10612 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
10613 "stop",
10614 g_variant_new ("()"),
10615 G_DBUS_CALL_FLAGS_NONE,
10616 -1,
10617 cancellable,
10618 error);
10619 if (_ret == NULL)
10620 goto _out;
10621 g_variant_get (_ret,
10622 "()");
10623 g_variant_unref (_ret);
10624_out:
10625 return _ret != NULL;
10626}
10627
10628/**
10629 * process_complete_stop:
10630 * @object: A #Process.
10631 * @invocation: (transfer full): A #GDBusMethodInvocation.
10632 *
10633 * 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.
10634 *
10635 * This method will free @invocation, you cannot use it afterwards.
10636 */
10637void
10638process_complete_stop (
10639 Process *object,
10640 GDBusMethodInvocation *invocation)
10641{
10642 g_dbus_method_invocation_return_value (invocation,
10643 g_variant_new ("()"));
10644}
10645
10646/* ------------------------------------------------------------------------ */
10647
10648/**
10649 * ProcessProxy:
10650 *
10651 * The #ProcessProxy structure contains only private data and should only be accessed using the provided API.
10652 */
10653
10654/**
10655 * ProcessProxyClass:
10656 * @parent_class: The parent class.
10657 *
10658 * Class structure for #ProcessProxy.
10659 */
10660
10661struct _ProcessProxyPrivate
10662{
10663 GData *qdata;
10664};
10665
10666static void process_proxy_iface_init (ProcessIface *iface);
10667
10668#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
10669G_DEFINE_TYPE_WITH_CODE (ProcessProxy, process_proxy, G_TYPE_DBUS_PROXY,
10670 G_ADD_PRIVATE (ProcessProxy)
10671 G_IMPLEMENT_INTERFACE (TYPE_PROCESS, process_proxy_iface_init));
10672
10673#else
10674G_DEFINE_TYPE_WITH_CODE (ProcessProxy, process_proxy, G_TYPE_DBUS_PROXY,
10675 G_IMPLEMENT_INTERFACE (TYPE_PROCESS, process_proxy_iface_init));
10676
10677#endif
10678static void
10679process_proxy_finalize (GObject *object)
10680{
10681 ProcessProxy *proxy = PROCESS_PROXY (object);
10682 g_datalist_clear (&proxy->priv->qdata);
10683 G_OBJECT_CLASS (process_proxy_parent_class)->finalize (object);
10684}
10685
10686static void
10687process_proxy_get_property (GObject *object,
10688 guint prop_id,
10689 GValue *value,
10690 GParamSpec *pspec G_GNUC_UNUSED)
10691{
10692}
10693
10694static void
10695process_proxy_set_property (GObject *object,
10696 guint prop_id,
10697 const GValue *value,
10698 GParamSpec *pspec G_GNUC_UNUSED)
10699{
10700}
10701
10702static void
10703process_proxy_g_signal (GDBusProxy *proxy,
10704 const gchar *sender_name G_GNUC_UNUSED,
10705 const gchar *signal_name,
10706 GVariant *parameters)
10707{
10708 _ExtendedGDBusSignalInfo *info;
10709 GVariantIter iter;
10710 GVariant *child;
10711 GValue *paramv;
10712 guint num_params;
10713 guint n;
10714 guint signal_id;
10715 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, signal_name);
10716 if (info == NULL)
10717 return;
10718 num_params = g_variant_n_children (parameters);
10719 paramv = g_new0 (GValue, num_params + 1);
10720 g_value_init (&paramv[0], TYPE_PROCESS);
10721 g_value_set_object (&paramv[0], proxy);
10722 g_variant_iter_init (&iter, parameters);
10723 n = 1;
10724 while ((child = g_variant_iter_next_value (&iter)) != NULL)
10725 {
10726 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
10727 if (arg_info->use_gvariant)
10728 {
10729 g_value_init (&paramv[n], G_TYPE_VARIANT);
10730 g_value_set_variant (&paramv[n], child);
10731 n++;
10732 }
10733 else
10734 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
10735 g_variant_unref (child);
10736 }
10737 signal_id = g_signal_lookup (info->signal_name, TYPE_PROCESS);
10738 g_signal_emitv (paramv, signal_id, 0, NULL);
10739 for (n = 0; n < num_params + 1; n++)
10740 g_value_unset (&paramv[n]);
10741 g_free (paramv);
10742}
10743
10744static void
10745process_proxy_g_properties_changed (GDBusProxy *_proxy,
10746 GVariant *changed_properties,
10747 const gchar *const *invalidated_properties)
10748{
10749 ProcessProxy *proxy = PROCESS_PROXY (_proxy);
10750 guint n;
10751 const gchar *key;
10752 GVariantIter *iter;
10753 _ExtendedGDBusPropertyInfo *info;
10754 g_variant_get (changed_properties, "a{sv}", &iter);
10755 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
10756 {
10757 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, key);
10758 g_datalist_remove_data (&proxy->priv->qdata, key);
10759 if (info != NULL)
10760 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
10761 }
10762 g_variant_iter_free (iter);
10763 for (n = 0; invalidated_properties[n] != NULL; n++)
10764 {
10765 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, invalidated_properties[n]);
10766 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
10767 if (info != NULL)
10768 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
10769 }
10770}
10771
10772static void
10773process_proxy_init (ProcessProxy *proxy)
10774{
10775#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
10776 proxy->priv = process_proxy_get_instance_private (proxy);
10777#else
10778 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_PROCESS_PROXY, ProcessProxyPrivate);
10779#endif
10780
10781 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), process_interface_info ());
10782}
10783
10784static void
10785process_proxy_class_init (ProcessProxyClass *klass)
10786{
10787 GObjectClass *gobject_class;
10788 GDBusProxyClass *proxy_class;
10789
10790 gobject_class = G_OBJECT_CLASS (klass);
10791 gobject_class->finalize = process_proxy_finalize;
10792 gobject_class->get_property = process_proxy_get_property;
10793 gobject_class->set_property = process_proxy_set_property;
10794
10795 proxy_class = G_DBUS_PROXY_CLASS (klass);
10796 proxy_class->g_signal = process_proxy_g_signal;
10797 proxy_class->g_properties_changed = process_proxy_g_properties_changed;
10798
10799#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
10800 g_type_class_add_private (klass, sizeof (ProcessProxyPrivate));
10801#endif
10802}
10803
10804static void
10805process_proxy_iface_init (ProcessIface *iface)
10806{
10807}
10808
10809/**
10810 * process_proxy_new:
10811 * @connection: A #GDBusConnection.
10812 * @flags: Flags from the #GDBusProxyFlags enumeration.
10813 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
10814 * @object_path: An object path.
10815 * @cancellable: (allow-none): A #GCancellable or %NULL.
10816 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
10817 * @user_data: User data to pass to @callback.
10818 *
10819 * 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.
10820 *
10821 * 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.
10822 * You can then call process_proxy_new_finish() to get the result of the operation.
10823 *
10824 * See process_proxy_new_sync() for the synchronous, blocking version of this constructor.
10825 */
10826void
10827process_proxy_new (
10828 GDBusConnection *connection,
10829 GDBusProxyFlags flags,
10830 const gchar *name,
10831 const gchar *object_path,
10832 GCancellable *cancellable,
10833 GAsyncReadyCallback callback,
10834 gpointer user_data)
10835{
10836 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);
10837}
10838
10839/**
10840 * process_proxy_new_finish:
10841 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to process_proxy_new().
10842 * @error: Return location for error or %NULL
10843 *
10844 * Finishes an operation started with process_proxy_new().
10845 *
10846 * Returns: (transfer full) (type ProcessProxy): The constructed proxy object or %NULL if @error is set.
10847 */
10848Process *
10849process_proxy_new_finish (
10850 GAsyncResult *res,
10851 GError **error)
10852{
10853 GObject *ret;
10854 GObject *source_object;
10855 source_object = g_async_result_get_source_object (res);
10856 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
10857 g_object_unref (source_object);
10858 if (ret != NULL)
10859 return PROCESS (ret);
10860 else
10861 return NULL;
10862}
10863
10864/**
10865 * process_proxy_new_sync:
10866 * @connection: A #GDBusConnection.
10867 * @flags: Flags from the #GDBusProxyFlags enumeration.
10868 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
10869 * @object_path: An object path.
10870 * @cancellable: (allow-none): A #GCancellable or %NULL.
10871 * @error: Return location for error or %NULL
10872 *
10873 * 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.
10874 *
10875 * The calling thread is blocked until a reply is received.
10876 *
10877 * See process_proxy_new() for the asynchronous version of this constructor.
10878 *
10879 * Returns: (transfer full) (type ProcessProxy): The constructed proxy object or %NULL if @error is set.
10880 */
10881Process *
10882process_proxy_new_sync (
10883 GDBusConnection *connection,
10884 GDBusProxyFlags flags,
10885 const gchar *name,
10886 const gchar *object_path,
10887 GCancellable *cancellable,
10888 GError **error)
10889{
10890 GInitable *ret;
10891 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);
10892 if (ret != NULL)
10893 return PROCESS (ret);
10894 else
10895 return NULL;
10896}
10897
10898
10899/**
10900 * process_proxy_new_for_bus:
10901 * @bus_type: A #GBusType.
10902 * @flags: Flags from the #GDBusProxyFlags enumeration.
10903 * @name: A bus name (well-known or unique).
10904 * @object_path: An object path.
10905 * @cancellable: (allow-none): A #GCancellable or %NULL.
10906 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
10907 * @user_data: User data to pass to @callback.
10908 *
10909 * Like process_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
10910 *
10911 * 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.
10912 * You can then call process_proxy_new_for_bus_finish() to get the result of the operation.
10913 *
10914 * See process_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
10915 */
10916void
10917process_proxy_new_for_bus (
10918 GBusType bus_type,
10919 GDBusProxyFlags flags,
10920 const gchar *name,
10921 const gchar *object_path,
10922 GCancellable *cancellable,
10923 GAsyncReadyCallback callback,
10924 gpointer user_data)
10925{
10926 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);
10927}
10928
10929/**
10930 * process_proxy_new_for_bus_finish:
10931 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to process_proxy_new_for_bus().
10932 * @error: Return location for error or %NULL
10933 *
10934 * Finishes an operation started with process_proxy_new_for_bus().
10935 *
10936 * Returns: (transfer full) (type ProcessProxy): The constructed proxy object or %NULL if @error is set.
10937 */
10938Process *
10939process_proxy_new_for_bus_finish (
10940 GAsyncResult *res,
10941 GError **error)
10942{
10943 GObject *ret;
10944 GObject *source_object;
10945 source_object = g_async_result_get_source_object (res);
10946 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
10947 g_object_unref (source_object);
10948 if (ret != NULL)
10949 return PROCESS (ret);
10950 else
10951 return NULL;
10952}
10953
10954/**
10955 * process_proxy_new_for_bus_sync:
10956 * @bus_type: A #GBusType.
10957 * @flags: Flags from the #GDBusProxyFlags enumeration.
10958 * @name: A bus name (well-known or unique).
10959 * @object_path: An object path.
10960 * @cancellable: (allow-none): A #GCancellable or %NULL.
10961 * @error: Return location for error or %NULL
10962 *
10963 * Like process_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
10964 *
10965 * The calling thread is blocked until a reply is received.
10966 *
10967 * See process_proxy_new_for_bus() for the asynchronous version of this constructor.
10968 *
10969 * Returns: (transfer full) (type ProcessProxy): The constructed proxy object or %NULL if @error is set.
10970 */
10971Process *
10972process_proxy_new_for_bus_sync (
10973 GBusType bus_type,
10974 GDBusProxyFlags flags,
10975 const gchar *name,
10976 const gchar *object_path,
10977 GCancellable *cancellable,
10978 GError **error)
10979{
10980 GInitable *ret;
10981 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);
10982 if (ret != NULL)
10983 return PROCESS (ret);
10984 else
10985 return NULL;
10986}
10987
10988
10989/* ------------------------------------------------------------------------ */
10990
10991/**
10992 * ProcessSkeleton:
10993 *
10994 * The #ProcessSkeleton structure contains only private data and should only be accessed using the provided API.
10995 */
10996
10997/**
10998 * ProcessSkeletonClass:
10999 * @parent_class: The parent class.
11000 *
11001 * Class structure for #ProcessSkeleton.
11002 */
11003
11004struct _ProcessSkeletonPrivate
11005{
11006 GValue *properties;
11007 GList *changed_properties;
11008 GSource *changed_properties_idle_source;
11009 GMainContext *context;
11010 GMutex lock;
11011};
11012
11013static void
11014_process_skeleton_handle_method_call (
11015 GDBusConnection *connection G_GNUC_UNUSED,
11016 const gchar *sender G_GNUC_UNUSED,
11017 const gchar *object_path G_GNUC_UNUSED,
11018 const gchar *interface_name,
11019 const gchar *method_name,
11020 GVariant *parameters,
11021 GDBusMethodInvocation *invocation,
11022 gpointer user_data)
11023{
11024 ProcessSkeleton *skeleton = PROCESS_SKELETON (user_data);
11025 _ExtendedGDBusMethodInfo *info;
11026 GVariantIter iter;
11027 GVariant *child;
11028 GValue *paramv;
11029 guint num_params;
11030 guint num_extra;
11031 guint n;
11032 guint signal_id;
11033 GValue return_value = G_VALUE_INIT;
11034 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
11035 g_assert (info != NULL);
11036 num_params = g_variant_n_children (parameters);
11037 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
11038 n = 0;
11039 g_value_init (&paramv[n], TYPE_PROCESS);
11040 g_value_set_object (&paramv[n++], skeleton);
11041 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
11042 g_value_set_object (&paramv[n++], invocation);
11043 if (info->pass_fdlist)
11044 {
11045#ifdef G_OS_UNIX
11046 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
11047 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
11048#else
11049 g_assert_not_reached ();
11050#endif
11051 }
11052 g_variant_iter_init (&iter, parameters);
11053 while ((child = g_variant_iter_next_value (&iter)) != NULL)
11054 {
11055 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
11056 if (arg_info->use_gvariant)
11057 {
11058 g_value_init (&paramv[n], G_TYPE_VARIANT);
11059 g_value_set_variant (&paramv[n], child);
11060 n++;
11061 }
11062 else
11063 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
11064 g_variant_unref (child);
11065 }
11066 signal_id = g_signal_lookup (info->signal_name, TYPE_PROCESS);
11067 g_value_init (&return_value, G_TYPE_BOOLEAN);
11068 g_signal_emitv (paramv, signal_id, 0, &return_value);
11069 if (!g_value_get_boolean (&return_value))
11070 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);
11071 g_value_unset (&return_value);
11072 for (n = 0; n < num_params + num_extra; n++)
11073 g_value_unset (&paramv[n]);
11074 g_free (paramv);
11075}
11076
11077static GVariant *
11078_process_skeleton_handle_get_property (
11079 GDBusConnection *connection G_GNUC_UNUSED,
11080 const gchar *sender G_GNUC_UNUSED,
11081 const gchar *object_path G_GNUC_UNUSED,
11082 const gchar *interface_name G_GNUC_UNUSED,
11083 const gchar *property_name,
11084 GError **error,
11085 gpointer user_data)
11086{
11087 ProcessSkeleton *skeleton = PROCESS_SKELETON (user_data);
11088 GValue value = G_VALUE_INIT;
11089 GParamSpec *pspec;
11090 _ExtendedGDBusPropertyInfo *info;
11091 GVariant *ret;
11092 ret = NULL;
11093 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, property_name);
11094 g_assert (info != NULL);
11095 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
11096 if (pspec == NULL)
11097 {
11098 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
11099 }
11100 else
11101 {
11102 g_value_init (&value, pspec->value_type);
11103 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
11104 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
11105 g_value_unset (&value);
11106 }
11107 return ret;
11108}
11109
11110static gboolean
11111_process_skeleton_handle_set_property (
11112 GDBusConnection *connection G_GNUC_UNUSED,
11113 const gchar *sender G_GNUC_UNUSED,
11114 const gchar *object_path G_GNUC_UNUSED,
11115 const gchar *interface_name G_GNUC_UNUSED,
11116 const gchar *property_name,
11117 GVariant *variant,
11118 GError **error,
11119 gpointer user_data)
11120{
11121 ProcessSkeleton *skeleton = PROCESS_SKELETON (user_data);
11122 GValue value = G_VALUE_INIT;
11123 GParamSpec *pspec;
11124 _ExtendedGDBusPropertyInfo *info;
11125 gboolean ret;
11126 ret = FALSE;
11127 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, property_name);
11128 g_assert (info != NULL);
11129 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
11130 if (pspec == NULL)
11131 {
11132 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
11133 }
11134 else
11135 {
11136 if (info->use_gvariant)
11137 g_value_set_variant (&value, variant);
11138 else
11139 g_dbus_gvariant_to_gvalue (variant, &value);
11140 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
11141 g_value_unset (&value);
11142 ret = TRUE;
11143 }
11144 return ret;
11145}
11146
11147static const GDBusInterfaceVTable _process_skeleton_vtable =
11148{
11149 _process_skeleton_handle_method_call,
11150 _process_skeleton_handle_get_property,
11151 _process_skeleton_handle_set_property,
11152 {NULL}
11153};
11154
11155static GDBusInterfaceInfo *
11156process_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
11157{
11158 return process_interface_info ();
11159}
11160
11161static GDBusInterfaceVTable *
11162process_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
11163{
11164 return (GDBusInterfaceVTable *) &_process_skeleton_vtable;
11165}
11166
11167static GVariant *
11168process_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
11169{
11170 ProcessSkeleton *skeleton = PROCESS_SKELETON (_skeleton);
11171
11172 GVariantBuilder builder;
11173 guint n;
11174 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
11175 if (_process_interface_info.parent_struct.properties == NULL)
11176 goto out;
11177 for (n = 0; _process_interface_info.parent_struct.properties[n] != NULL; n++)
11178 {
11179 GDBusPropertyInfo *info = _process_interface_info.parent_struct.properties[n];
11180 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
11181 {
11182 GVariant *value;
11183 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);
11184 if (value != NULL)
11185 {
11186 g_variant_take_ref (value);
11187 g_variant_builder_add (&builder, "{sv}", info->name, value);
11188 g_variant_unref (value);
11189 }
11190 }
11191 }
11192out:
11193 return g_variant_builder_end (&builder);
11194}
11195
11196static void
11197process_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
11198{
11199}
11200
11201static void process_skeleton_iface_init (ProcessIface *iface);
11202#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
11203G_DEFINE_TYPE_WITH_CODE (ProcessSkeleton, process_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
11204 G_ADD_PRIVATE (ProcessSkeleton)
11205 G_IMPLEMENT_INTERFACE (TYPE_PROCESS, process_skeleton_iface_init));
11206
11207#else
11208G_DEFINE_TYPE_WITH_CODE (ProcessSkeleton, process_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
11209 G_IMPLEMENT_INTERFACE (TYPE_PROCESS, process_skeleton_iface_init));
11210
11211#endif
11212static void
11213process_skeleton_finalize (GObject *object)
11214{
11215 ProcessSkeleton *skeleton = PROCESS_SKELETON (object);
11216 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
11217 if (skeleton->priv->changed_properties_idle_source != NULL)
11218 g_source_destroy (skeleton->priv->changed_properties_idle_source);
11219 g_main_context_unref (skeleton->priv->context);
11220 g_mutex_clear (&skeleton->priv->lock);
11221 G_OBJECT_CLASS (process_skeleton_parent_class)->finalize (object);
11222}
11223
11224static void
11225process_skeleton_init (ProcessSkeleton *skeleton)
11226{
11227#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
11228 skeleton->priv = process_skeleton_get_instance_private (skeleton);
11229#else
11230 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_PROCESS_SKELETON, ProcessSkeletonPrivate);
11231#endif
11232
11233 g_mutex_init (&skeleton->priv->lock);
11234 skeleton->priv->context = g_main_context_ref_thread_default ();
11235}
11236
11237static void
11238process_skeleton_class_init (ProcessSkeletonClass *klass)
11239{
11240 GObjectClass *gobject_class;
11241 GDBusInterfaceSkeletonClass *skeleton_class;
11242
11243 gobject_class = G_OBJECT_CLASS (klass);
11244 gobject_class->finalize = process_skeleton_finalize;
11245
11246 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
11247 skeleton_class->get_info = process_skeleton_dbus_interface_get_info;
11248 skeleton_class->get_properties = process_skeleton_dbus_interface_get_properties;
11249 skeleton_class->flush = process_skeleton_dbus_interface_flush;
11250 skeleton_class->get_vtable = process_skeleton_dbus_interface_get_vtable;
11251
11252#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
11253 g_type_class_add_private (klass, sizeof (ProcessSkeletonPrivate));
11254#endif
11255}
11256
11257static void
11258process_skeleton_iface_init (ProcessIface *iface)
11259{
11260}
11261
11262/**
11263 * process_skeleton_new:
11264 *
11265 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link>.
11266 *
11267 * Returns: (transfer full) (type ProcessSkeleton): The skeleton object.
11268 */
11269Process *
11270process_skeleton_new (void)
11271{
11272 return PROCESS (g_object_new (TYPE_PROCESS_SKELETON, NULL));
11273}
11274
11275/* ------------------------------------------------------------------------
Norman James18998182015-10-11 21:54:53 -050011276 * Code for interface org.openbmc.SharedResource
11277 * ------------------------------------------------------------------------
11278 */
11279
11280/**
11281 * SECTION:SharedResource
11282 * @title: SharedResource
11283 * @short_description: Generated C code for the org.openbmc.SharedResource D-Bus interface
11284 *
11285 * 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.
11286 */
11287
11288/* ---- Introspection data for org.openbmc.SharedResource ---- */
11289
11290static const _ExtendedGDBusArgInfo _shared_resource_method_info_lock_IN_ARG_name =
11291{
11292 {
11293 -1,
11294 (gchar *) "name",
11295 (gchar *) "s",
11296 NULL
11297 },
11298 FALSE
11299};
11300
11301static const _ExtendedGDBusArgInfo * const _shared_resource_method_info_lock_IN_ARG_pointers[] =
11302{
11303 &_shared_resource_method_info_lock_IN_ARG_name,
11304 NULL
11305};
11306
11307static const _ExtendedGDBusMethodInfo _shared_resource_method_info_lock =
11308{
11309 {
11310 -1,
11311 (gchar *) "lock",
11312 (GDBusArgInfo **) &_shared_resource_method_info_lock_IN_ARG_pointers,
11313 NULL,
11314 NULL
11315 },
11316 "handle-lock",
11317 FALSE
11318};
11319
11320static const _ExtendedGDBusMethodInfo _shared_resource_method_info_unlock =
11321{
11322 {
11323 -1,
11324 (gchar *) "unlock",
11325 NULL,
11326 NULL,
11327 NULL
11328 },
11329 "handle-unlock",
11330 FALSE
11331};
11332
11333static const _ExtendedGDBusArgInfo _shared_resource_method_info_is_locked_OUT_ARG_lock =
11334{
11335 {
11336 -1,
11337 (gchar *) "lock",
11338 (gchar *) "b",
11339 NULL
11340 },
11341 FALSE
11342};
11343
11344static const _ExtendedGDBusArgInfo _shared_resource_method_info_is_locked_OUT_ARG_name =
11345{
11346 {
11347 -1,
11348 (gchar *) "name",
11349 (gchar *) "s",
11350 NULL
11351 },
11352 FALSE
11353};
11354
11355static const _ExtendedGDBusArgInfo * const _shared_resource_method_info_is_locked_OUT_ARG_pointers[] =
11356{
11357 &_shared_resource_method_info_is_locked_OUT_ARG_lock,
11358 &_shared_resource_method_info_is_locked_OUT_ARG_name,
11359 NULL
11360};
11361
11362static const _ExtendedGDBusMethodInfo _shared_resource_method_info_is_locked =
11363{
11364 {
11365 -1,
11366 (gchar *) "isLocked",
11367 NULL,
11368 (GDBusArgInfo **) &_shared_resource_method_info_is_locked_OUT_ARG_pointers,
11369 NULL
11370 },
11371 "handle-is-locked",
11372 FALSE
11373};
11374
11375static const _ExtendedGDBusMethodInfo * const _shared_resource_method_info_pointers[] =
11376{
11377 &_shared_resource_method_info_lock,
11378 &_shared_resource_method_info_unlock,
11379 &_shared_resource_method_info_is_locked,
11380 NULL
11381};
11382
11383static const _ExtendedGDBusPropertyInfo _shared_resource_property_info_lock =
11384{
11385 {
11386 -1,
11387 (gchar *) "lock",
11388 (gchar *) "b",
11389 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
11390 NULL
11391 },
11392 "lock",
11393 FALSE
11394};
11395
11396static const _ExtendedGDBusPropertyInfo _shared_resource_property_info_name =
11397{
11398 {
11399 -1,
11400 (gchar *) "name",
11401 (gchar *) "s",
11402 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
11403 NULL
11404 },
11405 "name",
11406 FALSE
11407};
11408
11409static const _ExtendedGDBusPropertyInfo * const _shared_resource_property_info_pointers[] =
11410{
11411 &_shared_resource_property_info_lock,
11412 &_shared_resource_property_info_name,
11413 NULL
11414};
11415
11416static const _ExtendedGDBusInterfaceInfo _shared_resource_interface_info =
11417{
11418 {
11419 -1,
11420 (gchar *) "org.openbmc.SharedResource",
11421 (GDBusMethodInfo **) &_shared_resource_method_info_pointers,
11422 NULL,
11423 (GDBusPropertyInfo **) &_shared_resource_property_info_pointers,
11424 NULL
11425 },
11426 "shared-resource",
11427};
11428
11429
11430/**
11431 * shared_resource_interface_info:
11432 *
11433 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link> D-Bus interface.
11434 *
11435 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
11436 */
11437GDBusInterfaceInfo *
11438shared_resource_interface_info (void)
11439{
11440 return (GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct;
11441}
11442
11443/**
11444 * shared_resource_override_properties:
11445 * @klass: The class structure for a #GObject<!-- -->-derived class.
11446 * @property_id_begin: The property id to assign to the first overridden property.
11447 *
11448 * Overrides all #GObject properties in the #SharedResource interface for a concrete class.
11449 * The properties are overridden in the order they are defined.
11450 *
11451 * Returns: The last property id.
11452 */
11453guint
11454shared_resource_override_properties (GObjectClass *klass, guint property_id_begin)
11455{
11456 g_object_class_override_property (klass, property_id_begin++, "lock");
11457 g_object_class_override_property (klass, property_id_begin++, "name");
11458 return property_id_begin - 1;
11459}
11460
11461
11462
11463/**
11464 * SharedResource:
11465 *
11466 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link>.
11467 */
11468
11469/**
11470 * SharedResourceIface:
11471 * @parent_iface: The parent interface.
11472 * @handle_is_locked: Handler for the #SharedResource::handle-is-locked signal.
11473 * @handle_lock: Handler for the #SharedResource::handle-lock signal.
11474 * @handle_unlock: Handler for the #SharedResource::handle-unlock signal.
11475 * @get_lock: Getter for the #SharedResource:lock property.
11476 * @get_name: Getter for the #SharedResource:name property.
11477 *
11478 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link>.
11479 */
11480
11481typedef SharedResourceIface SharedResourceInterface;
11482G_DEFINE_INTERFACE (SharedResource, shared_resource, G_TYPE_OBJECT);
11483
11484static void
11485shared_resource_default_init (SharedResourceIface *iface)
11486{
11487 /* GObject signals for incoming D-Bus method calls: */
11488 /**
11489 * SharedResource::handle-lock:
11490 * @object: A #SharedResource.
11491 * @invocation: A #GDBusMethodInvocation.
11492 * @arg_name: Argument passed by remote caller.
11493 *
11494 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SharedResource.lock">lock()</link> D-Bus method.
11495 *
11496 * 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.
11497 *
11498 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
11499 */
11500 g_signal_new ("handle-lock",
11501 G_TYPE_FROM_INTERFACE (iface),
11502 G_SIGNAL_RUN_LAST,
11503 G_STRUCT_OFFSET (SharedResourceIface, handle_lock),
11504 g_signal_accumulator_true_handled,
11505 NULL,
11506 g_cclosure_marshal_generic,
11507 G_TYPE_BOOLEAN,
11508 2,
11509 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING);
11510
11511 /**
11512 * SharedResource::handle-unlock:
11513 * @object: A #SharedResource.
11514 * @invocation: A #GDBusMethodInvocation.
11515 *
11516 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SharedResource.unlock">unlock()</link> D-Bus method.
11517 *
11518 * 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.
11519 *
11520 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
11521 */
11522 g_signal_new ("handle-unlock",
11523 G_TYPE_FROM_INTERFACE (iface),
11524 G_SIGNAL_RUN_LAST,
11525 G_STRUCT_OFFSET (SharedResourceIface, handle_unlock),
11526 g_signal_accumulator_true_handled,
11527 NULL,
11528 g_cclosure_marshal_generic,
11529 G_TYPE_BOOLEAN,
11530 1,
11531 G_TYPE_DBUS_METHOD_INVOCATION);
11532
11533 /**
11534 * SharedResource::handle-is-locked:
11535 * @object: A #SharedResource.
11536 * @invocation: A #GDBusMethodInvocation.
11537 *
11538 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SharedResource.isLocked">isLocked()</link> D-Bus method.
11539 *
11540 * 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.
11541 *
11542 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
11543 */
11544 g_signal_new ("handle-is-locked",
11545 G_TYPE_FROM_INTERFACE (iface),
11546 G_SIGNAL_RUN_LAST,
11547 G_STRUCT_OFFSET (SharedResourceIface, handle_is_locked),
11548 g_signal_accumulator_true_handled,
11549 NULL,
11550 g_cclosure_marshal_generic,
11551 G_TYPE_BOOLEAN,
11552 1,
11553 G_TYPE_DBUS_METHOD_INVOCATION);
11554
11555 /* GObject properties for D-Bus properties: */
11556 /**
11557 * SharedResource:lock:
11558 *
11559 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SharedResource.lock">"lock"</link>.
11560 *
11561 * 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.
11562 */
11563 g_object_interface_install_property (iface,
11564 g_param_spec_boolean ("lock", "lock", "lock", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
11565 /**
11566 * SharedResource:name:
11567 *
11568 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SharedResource.name">"name"</link>.
11569 *
11570 * 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.
11571 */
11572 g_object_interface_install_property (iface,
11573 g_param_spec_string ("name", "name", "name", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
11574}
11575
11576/**
11577 * shared_resource_get_lock: (skip)
11578 * @object: A #SharedResource.
11579 *
11580 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SharedResource.lock">"lock"</link> D-Bus property.
11581 *
11582 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
11583 *
11584 * Returns: The property value.
11585 */
11586gboolean
11587shared_resource_get_lock (SharedResource *object)
11588{
11589 return SHARED_RESOURCE_GET_IFACE (object)->get_lock (object);
11590}
11591
11592/**
11593 * shared_resource_set_lock: (skip)
11594 * @object: A #SharedResource.
11595 * @value: The value to set.
11596 *
11597 * Sets the <link linkend="gdbus-property-org-openbmc-SharedResource.lock">"lock"</link> D-Bus property to @value.
11598 *
11599 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
11600 */
11601void
11602shared_resource_set_lock (SharedResource *object, gboolean value)
11603{
11604 g_object_set (G_OBJECT (object), "lock", value, NULL);
11605}
11606
11607/**
11608 * shared_resource_get_name: (skip)
11609 * @object: A #SharedResource.
11610 *
11611 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SharedResource.name">"name"</link> D-Bus property.
11612 *
11613 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
11614 *
11615 * <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>
11616 *
11617 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
11618 */
11619const gchar *
11620shared_resource_get_name (SharedResource *object)
11621{
11622 return SHARED_RESOURCE_GET_IFACE (object)->get_name (object);
11623}
11624
11625/**
11626 * shared_resource_dup_name: (skip)
11627 * @object: A #SharedResource.
11628 *
11629 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SharedResource.name">"name"</link> D-Bus property.
11630 *
11631 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
11632 *
11633 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
11634 */
11635gchar *
11636shared_resource_dup_name (SharedResource *object)
11637{
11638 gchar *value;
11639 g_object_get (G_OBJECT (object), "name", &value, NULL);
11640 return value;
11641}
11642
11643/**
11644 * shared_resource_set_name: (skip)
11645 * @object: A #SharedResource.
11646 * @value: The value to set.
11647 *
11648 * Sets the <link linkend="gdbus-property-org-openbmc-SharedResource.name">"name"</link> D-Bus property to @value.
11649 *
11650 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
11651 */
11652void
11653shared_resource_set_name (SharedResource *object, const gchar *value)
11654{
11655 g_object_set (G_OBJECT (object), "name", value, NULL);
11656}
11657
11658/**
11659 * shared_resource_call_lock:
11660 * @proxy: A #SharedResourceProxy.
11661 * @arg_name: Argument to pass with the method invocation.
11662 * @cancellable: (allow-none): A #GCancellable or %NULL.
11663 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
11664 * @user_data: User data to pass to @callback.
11665 *
11666 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SharedResource.lock">lock()</link> D-Bus method on @proxy.
11667 * 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.
11668 * You can then call shared_resource_call_lock_finish() to get the result of the operation.
11669 *
11670 * See shared_resource_call_lock_sync() for the synchronous, blocking version of this method.
11671 */
11672void
11673shared_resource_call_lock (
11674 SharedResource *proxy,
11675 const gchar *arg_name,
11676 GCancellable *cancellable,
11677 GAsyncReadyCallback callback,
11678 gpointer user_data)
11679{
11680 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
11681 "lock",
11682 g_variant_new ("(s)",
11683 arg_name),
11684 G_DBUS_CALL_FLAGS_NONE,
11685 -1,
11686 cancellable,
11687 callback,
11688 user_data);
11689}
11690
11691/**
11692 * shared_resource_call_lock_finish:
11693 * @proxy: A #SharedResourceProxy.
11694 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to shared_resource_call_lock().
11695 * @error: Return location for error or %NULL.
11696 *
11697 * Finishes an operation started with shared_resource_call_lock().
11698 *
11699 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
11700 */
11701gboolean
11702shared_resource_call_lock_finish (
11703 SharedResource *proxy,
11704 GAsyncResult *res,
11705 GError **error)
11706{
11707 GVariant *_ret;
11708 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
11709 if (_ret == NULL)
11710 goto _out;
11711 g_variant_get (_ret,
11712 "()");
11713 g_variant_unref (_ret);
11714_out:
11715 return _ret != NULL;
11716}
11717
11718/**
11719 * shared_resource_call_lock_sync:
11720 * @proxy: A #SharedResourceProxy.
11721 * @arg_name: Argument to pass with the method invocation.
11722 * @cancellable: (allow-none): A #GCancellable or %NULL.
11723 * @error: Return location for error or %NULL.
11724 *
11725 * 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.
11726 *
11727 * See shared_resource_call_lock() for the asynchronous version of this method.
11728 *
11729 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
11730 */
11731gboolean
11732shared_resource_call_lock_sync (
11733 SharedResource *proxy,
11734 const gchar *arg_name,
11735 GCancellable *cancellable,
11736 GError **error)
11737{
11738 GVariant *_ret;
11739 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
11740 "lock",
11741 g_variant_new ("(s)",
11742 arg_name),
11743 G_DBUS_CALL_FLAGS_NONE,
11744 -1,
11745 cancellable,
11746 error);
11747 if (_ret == NULL)
11748 goto _out;
11749 g_variant_get (_ret,
11750 "()");
11751 g_variant_unref (_ret);
11752_out:
11753 return _ret != NULL;
11754}
11755
11756/**
11757 * shared_resource_call_unlock:
11758 * @proxy: A #SharedResourceProxy.
11759 * @cancellable: (allow-none): A #GCancellable or %NULL.
11760 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
11761 * @user_data: User data to pass to @callback.
11762 *
11763 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SharedResource.unlock">unlock()</link> D-Bus method on @proxy.
11764 * 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.
11765 * You can then call shared_resource_call_unlock_finish() to get the result of the operation.
11766 *
11767 * See shared_resource_call_unlock_sync() for the synchronous, blocking version of this method.
11768 */
11769void
11770shared_resource_call_unlock (
11771 SharedResource *proxy,
11772 GCancellable *cancellable,
11773 GAsyncReadyCallback callback,
11774 gpointer user_data)
11775{
11776 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
11777 "unlock",
11778 g_variant_new ("()"),
11779 G_DBUS_CALL_FLAGS_NONE,
11780 -1,
11781 cancellable,
11782 callback,
11783 user_data);
11784}
11785
11786/**
11787 * shared_resource_call_unlock_finish:
11788 * @proxy: A #SharedResourceProxy.
11789 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to shared_resource_call_unlock().
11790 * @error: Return location for error or %NULL.
11791 *
11792 * Finishes an operation started with shared_resource_call_unlock().
11793 *
11794 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
11795 */
11796gboolean
11797shared_resource_call_unlock_finish (
11798 SharedResource *proxy,
11799 GAsyncResult *res,
11800 GError **error)
11801{
11802 GVariant *_ret;
11803 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
11804 if (_ret == NULL)
11805 goto _out;
11806 g_variant_get (_ret,
11807 "()");
11808 g_variant_unref (_ret);
11809_out:
11810 return _ret != NULL;
11811}
11812
11813/**
11814 * shared_resource_call_unlock_sync:
11815 * @proxy: A #SharedResourceProxy.
11816 * @cancellable: (allow-none): A #GCancellable or %NULL.
11817 * @error: Return location for error or %NULL.
11818 *
11819 * 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.
11820 *
11821 * See shared_resource_call_unlock() for the asynchronous version of this method.
11822 *
11823 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
11824 */
11825gboolean
11826shared_resource_call_unlock_sync (
11827 SharedResource *proxy,
11828 GCancellable *cancellable,
11829 GError **error)
11830{
11831 GVariant *_ret;
11832 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
11833 "unlock",
11834 g_variant_new ("()"),
11835 G_DBUS_CALL_FLAGS_NONE,
11836 -1,
11837 cancellable,
11838 error);
11839 if (_ret == NULL)
11840 goto _out;
11841 g_variant_get (_ret,
11842 "()");
11843 g_variant_unref (_ret);
11844_out:
11845 return _ret != NULL;
11846}
11847
11848/**
11849 * shared_resource_call_is_locked:
11850 * @proxy: A #SharedResourceProxy.
11851 * @cancellable: (allow-none): A #GCancellable or %NULL.
11852 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
11853 * @user_data: User data to pass to @callback.
11854 *
11855 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SharedResource.isLocked">isLocked()</link> D-Bus method on @proxy.
11856 * 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.
11857 * You can then call shared_resource_call_is_locked_finish() to get the result of the operation.
11858 *
11859 * See shared_resource_call_is_locked_sync() for the synchronous, blocking version of this method.
11860 */
11861void
11862shared_resource_call_is_locked (
11863 SharedResource *proxy,
11864 GCancellable *cancellable,
11865 GAsyncReadyCallback callback,
11866 gpointer user_data)
11867{
11868 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
11869 "isLocked",
11870 g_variant_new ("()"),
11871 G_DBUS_CALL_FLAGS_NONE,
11872 -1,
11873 cancellable,
11874 callback,
11875 user_data);
11876}
11877
11878/**
11879 * shared_resource_call_is_locked_finish:
11880 * @proxy: A #SharedResourceProxy.
11881 * @out_lock: (out): Return location for return parameter or %NULL to ignore.
11882 * @out_name: (out): Return location for return parameter or %NULL to ignore.
11883 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to shared_resource_call_is_locked().
11884 * @error: Return location for error or %NULL.
11885 *
11886 * Finishes an operation started with shared_resource_call_is_locked().
11887 *
11888 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
11889 */
11890gboolean
11891shared_resource_call_is_locked_finish (
11892 SharedResource *proxy,
11893 gboolean *out_lock,
11894 gchar **out_name,
11895 GAsyncResult *res,
11896 GError **error)
11897{
11898 GVariant *_ret;
11899 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
11900 if (_ret == NULL)
11901 goto _out;
11902 g_variant_get (_ret,
11903 "(bs)",
11904 out_lock,
11905 out_name);
11906 g_variant_unref (_ret);
11907_out:
11908 return _ret != NULL;
11909}
11910
11911/**
11912 * shared_resource_call_is_locked_sync:
11913 * @proxy: A #SharedResourceProxy.
11914 * @out_lock: (out): Return location for return parameter or %NULL to ignore.
11915 * @out_name: (out): Return location for return parameter or %NULL to ignore.
11916 * @cancellable: (allow-none): A #GCancellable or %NULL.
11917 * @error: Return location for error or %NULL.
11918 *
11919 * 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.
11920 *
11921 * See shared_resource_call_is_locked() for the asynchronous version of this method.
11922 *
11923 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
11924 */
11925gboolean
11926shared_resource_call_is_locked_sync (
11927 SharedResource *proxy,
11928 gboolean *out_lock,
11929 gchar **out_name,
11930 GCancellable *cancellable,
11931 GError **error)
11932{
11933 GVariant *_ret;
11934 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
11935 "isLocked",
11936 g_variant_new ("()"),
11937 G_DBUS_CALL_FLAGS_NONE,
11938 -1,
11939 cancellable,
11940 error);
11941 if (_ret == NULL)
11942 goto _out;
11943 g_variant_get (_ret,
11944 "(bs)",
11945 out_lock,
11946 out_name);
11947 g_variant_unref (_ret);
11948_out:
11949 return _ret != NULL;
11950}
11951
11952/**
11953 * shared_resource_complete_lock:
11954 * @object: A #SharedResource.
11955 * @invocation: (transfer full): A #GDBusMethodInvocation.
11956 *
11957 * 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.
11958 *
11959 * This method will free @invocation, you cannot use it afterwards.
11960 */
11961void
11962shared_resource_complete_lock (
11963 SharedResource *object,
11964 GDBusMethodInvocation *invocation)
11965{
11966 g_dbus_method_invocation_return_value (invocation,
11967 g_variant_new ("()"));
11968}
11969
11970/**
11971 * shared_resource_complete_unlock:
11972 * @object: A #SharedResource.
11973 * @invocation: (transfer full): A #GDBusMethodInvocation.
11974 *
11975 * 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.
11976 *
11977 * This method will free @invocation, you cannot use it afterwards.
11978 */
11979void
11980shared_resource_complete_unlock (
11981 SharedResource *object,
11982 GDBusMethodInvocation *invocation)
11983{
11984 g_dbus_method_invocation_return_value (invocation,
11985 g_variant_new ("()"));
11986}
11987
11988/**
11989 * shared_resource_complete_is_locked:
11990 * @object: A #SharedResource.
11991 * @invocation: (transfer full): A #GDBusMethodInvocation.
11992 * @lock: Parameter to return.
11993 * @name: Parameter to return.
11994 *
11995 * 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.
11996 *
11997 * This method will free @invocation, you cannot use it afterwards.
11998 */
11999void
12000shared_resource_complete_is_locked (
12001 SharedResource *object,
12002 GDBusMethodInvocation *invocation,
12003 gboolean lock,
12004 const gchar *name)
12005{
12006 g_dbus_method_invocation_return_value (invocation,
12007 g_variant_new ("(bs)",
12008 lock,
12009 name));
12010}
12011
12012/* ------------------------------------------------------------------------ */
12013
12014/**
12015 * SharedResourceProxy:
12016 *
12017 * The #SharedResourceProxy structure contains only private data and should only be accessed using the provided API.
12018 */
12019
12020/**
12021 * SharedResourceProxyClass:
12022 * @parent_class: The parent class.
12023 *
12024 * Class structure for #SharedResourceProxy.
12025 */
12026
12027struct _SharedResourceProxyPrivate
12028{
12029 GData *qdata;
12030};
12031
12032static void shared_resource_proxy_iface_init (SharedResourceIface *iface);
12033
12034#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
12035G_DEFINE_TYPE_WITH_CODE (SharedResourceProxy, shared_resource_proxy, G_TYPE_DBUS_PROXY,
12036 G_ADD_PRIVATE (SharedResourceProxy)
12037 G_IMPLEMENT_INTERFACE (TYPE_SHARED_RESOURCE, shared_resource_proxy_iface_init));
12038
12039#else
12040G_DEFINE_TYPE_WITH_CODE (SharedResourceProxy, shared_resource_proxy, G_TYPE_DBUS_PROXY,
12041 G_IMPLEMENT_INTERFACE (TYPE_SHARED_RESOURCE, shared_resource_proxy_iface_init));
12042
12043#endif
12044static void
12045shared_resource_proxy_finalize (GObject *object)
12046{
12047 SharedResourceProxy *proxy = SHARED_RESOURCE_PROXY (object);
12048 g_datalist_clear (&proxy->priv->qdata);
12049 G_OBJECT_CLASS (shared_resource_proxy_parent_class)->finalize (object);
12050}
12051
12052static void
12053shared_resource_proxy_get_property (GObject *object,
12054 guint prop_id,
12055 GValue *value,
12056 GParamSpec *pspec G_GNUC_UNUSED)
12057{
12058 const _ExtendedGDBusPropertyInfo *info;
12059 GVariant *variant;
12060 g_assert (prop_id != 0 && prop_id - 1 < 2);
12061 info = _shared_resource_property_info_pointers[prop_id - 1];
12062 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
12063 if (info->use_gvariant)
12064 {
12065 g_value_set_variant (value, variant);
12066 }
12067 else
12068 {
12069 if (variant != NULL)
12070 g_dbus_gvariant_to_gvalue (variant, value);
12071 }
12072 if (variant != NULL)
12073 g_variant_unref (variant);
12074}
12075
12076static void
12077shared_resource_proxy_set_property_cb (GDBusProxy *proxy,
12078 GAsyncResult *res,
12079 gpointer user_data)
12080{
12081 const _ExtendedGDBusPropertyInfo *info = user_data;
12082 GError *error;
12083 GVariant *_ret;
12084 error = NULL;
12085 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
12086 if (!_ret)
12087 {
12088 g_warning ("Error setting property '%s' on interface org.openbmc.SharedResource: %s (%s, %d)",
12089 info->parent_struct.name,
12090 error->message, g_quark_to_string (error->domain), error->code);
12091 g_error_free (error);
12092 }
12093 else
12094 {
12095 g_variant_unref (_ret);
12096 }
12097}
12098
12099static void
12100shared_resource_proxy_set_property (GObject *object,
12101 guint prop_id,
12102 const GValue *value,
12103 GParamSpec *pspec G_GNUC_UNUSED)
12104{
12105 const _ExtendedGDBusPropertyInfo *info;
12106 GVariant *variant;
12107 g_assert (prop_id != 0 && prop_id - 1 < 2);
12108 info = _shared_resource_property_info_pointers[prop_id - 1];
12109 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
12110 g_dbus_proxy_call (G_DBUS_PROXY (object),
12111 "org.freedesktop.DBus.Properties.Set",
12112 g_variant_new ("(ssv)", "org.openbmc.SharedResource", info->parent_struct.name, variant),
12113 G_DBUS_CALL_FLAGS_NONE,
12114 -1,
12115 NULL, (GAsyncReadyCallback) shared_resource_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
12116 g_variant_unref (variant);
12117}
12118
12119static void
12120shared_resource_proxy_g_signal (GDBusProxy *proxy,
12121 const gchar *sender_name G_GNUC_UNUSED,
12122 const gchar *signal_name,
12123 GVariant *parameters)
12124{
12125 _ExtendedGDBusSignalInfo *info;
12126 GVariantIter iter;
12127 GVariant *child;
12128 GValue *paramv;
12129 guint num_params;
12130 guint n;
12131 guint signal_id;
12132 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct, signal_name);
12133 if (info == NULL)
12134 return;
12135 num_params = g_variant_n_children (parameters);
12136 paramv = g_new0 (GValue, num_params + 1);
12137 g_value_init (&paramv[0], TYPE_SHARED_RESOURCE);
12138 g_value_set_object (&paramv[0], proxy);
12139 g_variant_iter_init (&iter, parameters);
12140 n = 1;
12141 while ((child = g_variant_iter_next_value (&iter)) != NULL)
12142 {
12143 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
12144 if (arg_info->use_gvariant)
12145 {
12146 g_value_init (&paramv[n], G_TYPE_VARIANT);
12147 g_value_set_variant (&paramv[n], child);
12148 n++;
12149 }
12150 else
12151 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
12152 g_variant_unref (child);
12153 }
12154 signal_id = g_signal_lookup (info->signal_name, TYPE_SHARED_RESOURCE);
12155 g_signal_emitv (paramv, signal_id, 0, NULL);
12156 for (n = 0; n < num_params + 1; n++)
12157 g_value_unset (&paramv[n]);
12158 g_free (paramv);
12159}
12160
12161static void
12162shared_resource_proxy_g_properties_changed (GDBusProxy *_proxy,
12163 GVariant *changed_properties,
12164 const gchar *const *invalidated_properties)
12165{
12166 SharedResourceProxy *proxy = SHARED_RESOURCE_PROXY (_proxy);
12167 guint n;
12168 const gchar *key;
12169 GVariantIter *iter;
12170 _ExtendedGDBusPropertyInfo *info;
12171 g_variant_get (changed_properties, "a{sv}", &iter);
12172 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
12173 {
12174 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct, key);
12175 g_datalist_remove_data (&proxy->priv->qdata, key);
12176 if (info != NULL)
12177 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
12178 }
12179 g_variant_iter_free (iter);
12180 for (n = 0; invalidated_properties[n] != NULL; n++)
12181 {
12182 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct, invalidated_properties[n]);
12183 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
12184 if (info != NULL)
12185 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
12186 }
12187}
12188
12189static gboolean
12190shared_resource_proxy_get_lock (SharedResource *object)
12191{
12192 SharedResourceProxy *proxy = SHARED_RESOURCE_PROXY (object);
12193 GVariant *variant;
12194 gboolean value = 0;
12195 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "lock");
12196 if (variant != NULL)
12197 {
12198 value = g_variant_get_boolean (variant);
12199 g_variant_unref (variant);
12200 }
12201 return value;
12202}
12203
12204static const gchar *
12205shared_resource_proxy_get_name (SharedResource *object)
12206{
12207 SharedResourceProxy *proxy = SHARED_RESOURCE_PROXY (object);
12208 GVariant *variant;
12209 const gchar *value = NULL;
12210 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "name");
12211 if (variant != NULL)
12212 {
12213 value = g_variant_get_string (variant, NULL);
12214 g_variant_unref (variant);
12215 }
12216 return value;
12217}
12218
12219static void
12220shared_resource_proxy_init (SharedResourceProxy *proxy)
12221{
12222#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
12223 proxy->priv = shared_resource_proxy_get_instance_private (proxy);
12224#else
12225 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SHARED_RESOURCE_PROXY, SharedResourceProxyPrivate);
12226#endif
12227
12228 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), shared_resource_interface_info ());
12229}
12230
12231static void
12232shared_resource_proxy_class_init (SharedResourceProxyClass *klass)
12233{
12234 GObjectClass *gobject_class;
12235 GDBusProxyClass *proxy_class;
12236
12237 gobject_class = G_OBJECT_CLASS (klass);
12238 gobject_class->finalize = shared_resource_proxy_finalize;
12239 gobject_class->get_property = shared_resource_proxy_get_property;
12240 gobject_class->set_property = shared_resource_proxy_set_property;
12241
12242 proxy_class = G_DBUS_PROXY_CLASS (klass);
12243 proxy_class->g_signal = shared_resource_proxy_g_signal;
12244 proxy_class->g_properties_changed = shared_resource_proxy_g_properties_changed;
12245
12246 shared_resource_override_properties (gobject_class, 1);
12247
12248#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
12249 g_type_class_add_private (klass, sizeof (SharedResourceProxyPrivate));
12250#endif
12251}
12252
12253static void
12254shared_resource_proxy_iface_init (SharedResourceIface *iface)
12255{
12256 iface->get_lock = shared_resource_proxy_get_lock;
12257 iface->get_name = shared_resource_proxy_get_name;
12258}
12259
12260/**
12261 * shared_resource_proxy_new:
12262 * @connection: A #GDBusConnection.
12263 * @flags: Flags from the #GDBusProxyFlags enumeration.
12264 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
12265 * @object_path: An object path.
12266 * @cancellable: (allow-none): A #GCancellable or %NULL.
12267 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
12268 * @user_data: User data to pass to @callback.
12269 *
12270 * 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.
12271 *
12272 * 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.
12273 * You can then call shared_resource_proxy_new_finish() to get the result of the operation.
12274 *
12275 * See shared_resource_proxy_new_sync() for the synchronous, blocking version of this constructor.
12276 */
12277void
12278shared_resource_proxy_new (
12279 GDBusConnection *connection,
12280 GDBusProxyFlags flags,
12281 const gchar *name,
12282 const gchar *object_path,
12283 GCancellable *cancellable,
12284 GAsyncReadyCallback callback,
12285 gpointer user_data)
12286{
12287 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);
12288}
12289
12290/**
12291 * shared_resource_proxy_new_finish:
12292 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to shared_resource_proxy_new().
12293 * @error: Return location for error or %NULL
12294 *
12295 * Finishes an operation started with shared_resource_proxy_new().
12296 *
12297 * Returns: (transfer full) (type SharedResourceProxy): The constructed proxy object or %NULL if @error is set.
12298 */
12299SharedResource *
12300shared_resource_proxy_new_finish (
12301 GAsyncResult *res,
12302 GError **error)
12303{
12304 GObject *ret;
12305 GObject *source_object;
12306 source_object = g_async_result_get_source_object (res);
12307 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
12308 g_object_unref (source_object);
12309 if (ret != NULL)
12310 return SHARED_RESOURCE (ret);
12311 else
12312 return NULL;
12313}
12314
12315/**
12316 * shared_resource_proxy_new_sync:
12317 * @connection: A #GDBusConnection.
12318 * @flags: Flags from the #GDBusProxyFlags enumeration.
12319 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
12320 * @object_path: An object path.
12321 * @cancellable: (allow-none): A #GCancellable or %NULL.
12322 * @error: Return location for error or %NULL
12323 *
12324 * 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.
12325 *
12326 * The calling thread is blocked until a reply is received.
12327 *
12328 * See shared_resource_proxy_new() for the asynchronous version of this constructor.
12329 *
12330 * Returns: (transfer full) (type SharedResourceProxy): The constructed proxy object or %NULL if @error is set.
12331 */
12332SharedResource *
12333shared_resource_proxy_new_sync (
12334 GDBusConnection *connection,
12335 GDBusProxyFlags flags,
12336 const gchar *name,
12337 const gchar *object_path,
12338 GCancellable *cancellable,
12339 GError **error)
12340{
12341 GInitable *ret;
12342 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);
12343 if (ret != NULL)
12344 return SHARED_RESOURCE (ret);
12345 else
12346 return NULL;
12347}
12348
12349
12350/**
12351 * shared_resource_proxy_new_for_bus:
12352 * @bus_type: A #GBusType.
12353 * @flags: Flags from the #GDBusProxyFlags enumeration.
12354 * @name: A bus name (well-known or unique).
12355 * @object_path: An object path.
12356 * @cancellable: (allow-none): A #GCancellable or %NULL.
12357 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
12358 * @user_data: User data to pass to @callback.
12359 *
12360 * Like shared_resource_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
12361 *
12362 * 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.
12363 * You can then call shared_resource_proxy_new_for_bus_finish() to get the result of the operation.
12364 *
12365 * See shared_resource_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
12366 */
12367void
12368shared_resource_proxy_new_for_bus (
12369 GBusType bus_type,
12370 GDBusProxyFlags flags,
12371 const gchar *name,
12372 const gchar *object_path,
12373 GCancellable *cancellable,
12374 GAsyncReadyCallback callback,
12375 gpointer user_data)
12376{
12377 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);
12378}
12379
12380/**
12381 * shared_resource_proxy_new_for_bus_finish:
12382 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to shared_resource_proxy_new_for_bus().
12383 * @error: Return location for error or %NULL
12384 *
12385 * Finishes an operation started with shared_resource_proxy_new_for_bus().
12386 *
12387 * Returns: (transfer full) (type SharedResourceProxy): The constructed proxy object or %NULL if @error is set.
12388 */
12389SharedResource *
12390shared_resource_proxy_new_for_bus_finish (
12391 GAsyncResult *res,
12392 GError **error)
12393{
12394 GObject *ret;
12395 GObject *source_object;
12396 source_object = g_async_result_get_source_object (res);
12397 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
12398 g_object_unref (source_object);
12399 if (ret != NULL)
12400 return SHARED_RESOURCE (ret);
12401 else
12402 return NULL;
12403}
12404
12405/**
12406 * shared_resource_proxy_new_for_bus_sync:
12407 * @bus_type: A #GBusType.
12408 * @flags: Flags from the #GDBusProxyFlags enumeration.
12409 * @name: A bus name (well-known or unique).
12410 * @object_path: An object path.
12411 * @cancellable: (allow-none): A #GCancellable or %NULL.
12412 * @error: Return location for error or %NULL
12413 *
12414 * Like shared_resource_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
12415 *
12416 * The calling thread is blocked until a reply is received.
12417 *
12418 * See shared_resource_proxy_new_for_bus() for the asynchronous version of this constructor.
12419 *
12420 * Returns: (transfer full) (type SharedResourceProxy): The constructed proxy object or %NULL if @error is set.
12421 */
12422SharedResource *
12423shared_resource_proxy_new_for_bus_sync (
12424 GBusType bus_type,
12425 GDBusProxyFlags flags,
12426 const gchar *name,
12427 const gchar *object_path,
12428 GCancellable *cancellable,
12429 GError **error)
12430{
12431 GInitable *ret;
12432 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);
12433 if (ret != NULL)
12434 return SHARED_RESOURCE (ret);
12435 else
12436 return NULL;
12437}
12438
12439
12440/* ------------------------------------------------------------------------ */
12441
12442/**
12443 * SharedResourceSkeleton:
12444 *
12445 * The #SharedResourceSkeleton structure contains only private data and should only be accessed using the provided API.
12446 */
12447
12448/**
12449 * SharedResourceSkeletonClass:
12450 * @parent_class: The parent class.
12451 *
12452 * Class structure for #SharedResourceSkeleton.
12453 */
12454
12455struct _SharedResourceSkeletonPrivate
12456{
12457 GValue *properties;
12458 GList *changed_properties;
12459 GSource *changed_properties_idle_source;
12460 GMainContext *context;
12461 GMutex lock;
12462};
12463
12464static void
12465_shared_resource_skeleton_handle_method_call (
12466 GDBusConnection *connection G_GNUC_UNUSED,
12467 const gchar *sender G_GNUC_UNUSED,
12468 const gchar *object_path G_GNUC_UNUSED,
12469 const gchar *interface_name,
12470 const gchar *method_name,
12471 GVariant *parameters,
12472 GDBusMethodInvocation *invocation,
12473 gpointer user_data)
12474{
12475 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (user_data);
12476 _ExtendedGDBusMethodInfo *info;
12477 GVariantIter iter;
12478 GVariant *child;
12479 GValue *paramv;
12480 guint num_params;
12481 guint num_extra;
12482 guint n;
12483 guint signal_id;
12484 GValue return_value = G_VALUE_INIT;
12485 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
12486 g_assert (info != NULL);
12487 num_params = g_variant_n_children (parameters);
12488 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
12489 n = 0;
12490 g_value_init (&paramv[n], TYPE_SHARED_RESOURCE);
12491 g_value_set_object (&paramv[n++], skeleton);
12492 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
12493 g_value_set_object (&paramv[n++], invocation);
12494 if (info->pass_fdlist)
12495 {
12496#ifdef G_OS_UNIX
12497 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
12498 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
12499#else
12500 g_assert_not_reached ();
12501#endif
12502 }
12503 g_variant_iter_init (&iter, parameters);
12504 while ((child = g_variant_iter_next_value (&iter)) != NULL)
12505 {
12506 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
12507 if (arg_info->use_gvariant)
12508 {
12509 g_value_init (&paramv[n], G_TYPE_VARIANT);
12510 g_value_set_variant (&paramv[n], child);
12511 n++;
12512 }
12513 else
12514 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
12515 g_variant_unref (child);
12516 }
12517 signal_id = g_signal_lookup (info->signal_name, TYPE_SHARED_RESOURCE);
12518 g_value_init (&return_value, G_TYPE_BOOLEAN);
12519 g_signal_emitv (paramv, signal_id, 0, &return_value);
12520 if (!g_value_get_boolean (&return_value))
12521 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);
12522 g_value_unset (&return_value);
12523 for (n = 0; n < num_params + num_extra; n++)
12524 g_value_unset (&paramv[n]);
12525 g_free (paramv);
12526}
12527
12528static GVariant *
12529_shared_resource_skeleton_handle_get_property (
12530 GDBusConnection *connection G_GNUC_UNUSED,
12531 const gchar *sender G_GNUC_UNUSED,
12532 const gchar *object_path G_GNUC_UNUSED,
12533 const gchar *interface_name G_GNUC_UNUSED,
12534 const gchar *property_name,
12535 GError **error,
12536 gpointer user_data)
12537{
12538 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (user_data);
12539 GValue value = G_VALUE_INIT;
12540 GParamSpec *pspec;
12541 _ExtendedGDBusPropertyInfo *info;
12542 GVariant *ret;
12543 ret = NULL;
12544 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct, property_name);
12545 g_assert (info != NULL);
12546 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
12547 if (pspec == NULL)
12548 {
12549 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
12550 }
12551 else
12552 {
12553 g_value_init (&value, pspec->value_type);
12554 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
12555 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
12556 g_value_unset (&value);
12557 }
12558 return ret;
12559}
12560
12561static gboolean
12562_shared_resource_skeleton_handle_set_property (
12563 GDBusConnection *connection G_GNUC_UNUSED,
12564 const gchar *sender G_GNUC_UNUSED,
12565 const gchar *object_path G_GNUC_UNUSED,
12566 const gchar *interface_name G_GNUC_UNUSED,
12567 const gchar *property_name,
12568 GVariant *variant,
12569 GError **error,
12570 gpointer user_data)
12571{
12572 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (user_data);
12573 GValue value = G_VALUE_INIT;
12574 GParamSpec *pspec;
12575 _ExtendedGDBusPropertyInfo *info;
12576 gboolean ret;
12577 ret = FALSE;
12578 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct, property_name);
12579 g_assert (info != NULL);
12580 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
12581 if (pspec == NULL)
12582 {
12583 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
12584 }
12585 else
12586 {
12587 if (info->use_gvariant)
12588 g_value_set_variant (&value, variant);
12589 else
12590 g_dbus_gvariant_to_gvalue (variant, &value);
12591 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
12592 g_value_unset (&value);
12593 ret = TRUE;
12594 }
12595 return ret;
12596}
12597
12598static const GDBusInterfaceVTable _shared_resource_skeleton_vtable =
12599{
12600 _shared_resource_skeleton_handle_method_call,
12601 _shared_resource_skeleton_handle_get_property,
12602 _shared_resource_skeleton_handle_set_property,
12603 {NULL}
12604};
12605
12606static GDBusInterfaceInfo *
12607shared_resource_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
12608{
12609 return shared_resource_interface_info ();
12610}
12611
12612static GDBusInterfaceVTable *
12613shared_resource_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
12614{
12615 return (GDBusInterfaceVTable *) &_shared_resource_skeleton_vtable;
12616}
12617
12618static GVariant *
12619shared_resource_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
12620{
12621 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (_skeleton);
12622
12623 GVariantBuilder builder;
12624 guint n;
12625 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
12626 if (_shared_resource_interface_info.parent_struct.properties == NULL)
12627 goto out;
12628 for (n = 0; _shared_resource_interface_info.parent_struct.properties[n] != NULL; n++)
12629 {
12630 GDBusPropertyInfo *info = _shared_resource_interface_info.parent_struct.properties[n];
12631 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
12632 {
12633 GVariant *value;
12634 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);
12635 if (value != NULL)
12636 {
12637 g_variant_take_ref (value);
12638 g_variant_builder_add (&builder, "{sv}", info->name, value);
12639 g_variant_unref (value);
12640 }
12641 }
12642 }
12643out:
12644 return g_variant_builder_end (&builder);
12645}
12646
12647static gboolean _shared_resource_emit_changed (gpointer user_data);
12648
12649static void
12650shared_resource_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
12651{
12652 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (_skeleton);
12653 gboolean emit_changed = FALSE;
12654
12655 g_mutex_lock (&skeleton->priv->lock);
12656 if (skeleton->priv->changed_properties_idle_source != NULL)
12657 {
12658 g_source_destroy (skeleton->priv->changed_properties_idle_source);
12659 skeleton->priv->changed_properties_idle_source = NULL;
12660 emit_changed = TRUE;
12661 }
12662 g_mutex_unlock (&skeleton->priv->lock);
12663
12664 if (emit_changed)
12665 _shared_resource_emit_changed (skeleton);
12666}
12667
12668static void shared_resource_skeleton_iface_init (SharedResourceIface *iface);
12669#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
12670G_DEFINE_TYPE_WITH_CODE (SharedResourceSkeleton, shared_resource_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
12671 G_ADD_PRIVATE (SharedResourceSkeleton)
12672 G_IMPLEMENT_INTERFACE (TYPE_SHARED_RESOURCE, shared_resource_skeleton_iface_init));
12673
12674#else
12675G_DEFINE_TYPE_WITH_CODE (SharedResourceSkeleton, shared_resource_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
12676 G_IMPLEMENT_INTERFACE (TYPE_SHARED_RESOURCE, shared_resource_skeleton_iface_init));
12677
12678#endif
12679static void
12680shared_resource_skeleton_finalize (GObject *object)
12681{
12682 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object);
12683 guint n;
12684 for (n = 0; n < 2; n++)
12685 g_value_unset (&skeleton->priv->properties[n]);
12686 g_free (skeleton->priv->properties);
12687 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
12688 if (skeleton->priv->changed_properties_idle_source != NULL)
12689 g_source_destroy (skeleton->priv->changed_properties_idle_source);
12690 g_main_context_unref (skeleton->priv->context);
12691 g_mutex_clear (&skeleton->priv->lock);
12692 G_OBJECT_CLASS (shared_resource_skeleton_parent_class)->finalize (object);
12693}
12694
12695static void
12696shared_resource_skeleton_get_property (GObject *object,
12697 guint prop_id,
12698 GValue *value,
12699 GParamSpec *pspec G_GNUC_UNUSED)
12700{
12701 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object);
12702 g_assert (prop_id != 0 && prop_id - 1 < 2);
12703 g_mutex_lock (&skeleton->priv->lock);
12704 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
12705 g_mutex_unlock (&skeleton->priv->lock);
12706}
12707
12708static gboolean
12709_shared_resource_emit_changed (gpointer user_data)
12710{
12711 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (user_data);
12712 GList *l;
12713 GVariantBuilder builder;
12714 GVariantBuilder invalidated_builder;
12715 guint num_changes;
12716
12717 g_mutex_lock (&skeleton->priv->lock);
12718 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
12719 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
12720 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
12721 {
12722 ChangedProperty *cp = l->data;
12723 GVariant *variant;
12724 const GValue *cur_value;
12725
12726 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
12727 if (!_g_value_equal (cur_value, &cp->orig_value))
12728 {
12729 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
12730 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
12731 g_variant_unref (variant);
12732 num_changes++;
12733 }
12734 }
12735 if (num_changes > 0)
12736 {
12737 GList *connections, *ll;
12738 GVariant *signal_variant;
12739 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SharedResource",
12740 &builder, &invalidated_builder));
12741 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
12742 for (ll = connections; ll != NULL; ll = ll->next)
12743 {
12744 GDBusConnection *connection = ll->data;
12745
12746 g_dbus_connection_emit_signal (connection,
12747 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
12748 "org.freedesktop.DBus.Properties",
12749 "PropertiesChanged",
12750 signal_variant,
12751 NULL);
12752 }
12753 g_variant_unref (signal_variant);
12754 g_list_free_full (connections, g_object_unref);
12755 }
12756 else
12757 {
12758 g_variant_builder_clear (&builder);
12759 g_variant_builder_clear (&invalidated_builder);
12760 }
12761 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
12762 skeleton->priv->changed_properties = NULL;
12763 skeleton->priv->changed_properties_idle_source = NULL;
12764 g_mutex_unlock (&skeleton->priv->lock);
12765 return FALSE;
12766}
12767
12768static void
12769_shared_resource_schedule_emit_changed (SharedResourceSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
12770{
12771 ChangedProperty *cp;
12772 GList *l;
12773 cp = NULL;
12774 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
12775 {
12776 ChangedProperty *i_cp = l->data;
12777 if (i_cp->info == info)
12778 {
12779 cp = i_cp;
12780 break;
12781 }
12782 }
12783 if (cp == NULL)
12784 {
12785 cp = g_new0 (ChangedProperty, 1);
12786 cp->prop_id = prop_id;
12787 cp->info = info;
12788 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
12789 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
12790 g_value_copy (orig_value, &cp->orig_value);
12791 }
12792}
12793
12794static void
12795shared_resource_skeleton_notify (GObject *object,
12796 GParamSpec *pspec G_GNUC_UNUSED)
12797{
12798 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object);
12799 g_mutex_lock (&skeleton->priv->lock);
12800 if (skeleton->priv->changed_properties != NULL &&
12801 skeleton->priv->changed_properties_idle_source == NULL)
12802 {
12803 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
12804 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
12805 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _shared_resource_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
12806 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
12807 g_source_unref (skeleton->priv->changed_properties_idle_source);
12808 }
12809 g_mutex_unlock (&skeleton->priv->lock);
12810}
12811
12812static void
12813shared_resource_skeleton_set_property (GObject *object,
12814 guint prop_id,
12815 const GValue *value,
12816 GParamSpec *pspec)
12817{
12818 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object);
12819 g_assert (prop_id != 0 && prop_id - 1 < 2);
12820 g_mutex_lock (&skeleton->priv->lock);
12821 g_object_freeze_notify (object);
12822 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
12823 {
12824 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
12825 _shared_resource_schedule_emit_changed (skeleton, _shared_resource_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
12826 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
12827 g_object_notify_by_pspec (object, pspec);
12828 }
12829 g_mutex_unlock (&skeleton->priv->lock);
12830 g_object_thaw_notify (object);
12831}
12832
12833static void
12834shared_resource_skeleton_init (SharedResourceSkeleton *skeleton)
12835{
12836#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
12837 skeleton->priv = shared_resource_skeleton_get_instance_private (skeleton);
12838#else
12839 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SHARED_RESOURCE_SKELETON, SharedResourceSkeletonPrivate);
12840#endif
12841
12842 g_mutex_init (&skeleton->priv->lock);
12843 skeleton->priv->context = g_main_context_ref_thread_default ();
12844 skeleton->priv->properties = g_new0 (GValue, 2);
12845 g_value_init (&skeleton->priv->properties[0], G_TYPE_BOOLEAN);
12846 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
12847}
12848
12849static gboolean
12850shared_resource_skeleton_get_lock (SharedResource *object)
12851{
12852 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object);
12853 gboolean value;
12854 g_mutex_lock (&skeleton->priv->lock);
12855 value = g_value_get_boolean (&(skeleton->priv->properties[0]));
12856 g_mutex_unlock (&skeleton->priv->lock);
12857 return value;
12858}
12859
12860static const gchar *
12861shared_resource_skeleton_get_name (SharedResource *object)
12862{
12863 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object);
12864 const gchar *value;
12865 g_mutex_lock (&skeleton->priv->lock);
12866 value = g_value_get_string (&(skeleton->priv->properties[1]));
12867 g_mutex_unlock (&skeleton->priv->lock);
12868 return value;
12869}
12870
12871static void
12872shared_resource_skeleton_class_init (SharedResourceSkeletonClass *klass)
12873{
12874 GObjectClass *gobject_class;
12875 GDBusInterfaceSkeletonClass *skeleton_class;
12876
12877 gobject_class = G_OBJECT_CLASS (klass);
12878 gobject_class->finalize = shared_resource_skeleton_finalize;
12879 gobject_class->get_property = shared_resource_skeleton_get_property;
12880 gobject_class->set_property = shared_resource_skeleton_set_property;
12881 gobject_class->notify = shared_resource_skeleton_notify;
12882
12883
12884 shared_resource_override_properties (gobject_class, 1);
12885
12886 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
12887 skeleton_class->get_info = shared_resource_skeleton_dbus_interface_get_info;
12888 skeleton_class->get_properties = shared_resource_skeleton_dbus_interface_get_properties;
12889 skeleton_class->flush = shared_resource_skeleton_dbus_interface_flush;
12890 skeleton_class->get_vtable = shared_resource_skeleton_dbus_interface_get_vtable;
12891
12892#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
12893 g_type_class_add_private (klass, sizeof (SharedResourceSkeletonPrivate));
12894#endif
12895}
12896
12897static void
12898shared_resource_skeleton_iface_init (SharedResourceIface *iface)
12899{
12900 iface->get_lock = shared_resource_skeleton_get_lock;
12901 iface->get_name = shared_resource_skeleton_get_name;
12902}
12903
12904/**
12905 * shared_resource_skeleton_new:
12906 *
12907 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link>.
12908 *
12909 * Returns: (transfer full) (type SharedResourceSkeleton): The skeleton object.
12910 */
12911SharedResource *
12912shared_resource_skeleton_new (void)
12913{
12914 return SHARED_RESOURCE (g_object_new (TYPE_SHARED_RESOURCE_SKELETON, NULL));
12915}
12916
12917/* ------------------------------------------------------------------------
Norman James362a80f2015-09-14 14:04:39 -050012918 * Code for interface org.openbmc.Control
12919 * ------------------------------------------------------------------------
12920 */
12921
12922/**
12923 * SECTION:Control
12924 * @title: Control
12925 * @short_description: Generated C code for the org.openbmc.Control D-Bus interface
12926 *
12927 * 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.
12928 */
12929
12930/* ---- Introspection data for org.openbmc.Control ---- */
12931
12932static const _ExtendedGDBusMethodInfo _control_method_info_init =
12933{
12934 {
12935 -1,
12936 (gchar *) "init",
12937 NULL,
12938 NULL,
12939 NULL
12940 },
12941 "handle-init",
12942 FALSE
12943};
12944
12945static const _ExtendedGDBusMethodInfo * const _control_method_info_pointers[] =
12946{
12947 &_control_method_info_init,
12948 NULL
12949};
12950
12951static const _ExtendedGDBusArgInfo _control_signal_info_heartbeat_ARG_bus_name =
12952{
12953 {
12954 -1,
12955 (gchar *) "bus_name",
12956 (gchar *) "s",
12957 NULL
12958 },
12959 FALSE
12960};
12961
12962static const _ExtendedGDBusArgInfo * const _control_signal_info_heartbeat_ARG_pointers[] =
12963{
12964 &_control_signal_info_heartbeat_ARG_bus_name,
12965 NULL
12966};
12967
12968static const _ExtendedGDBusSignalInfo _control_signal_info_heartbeat =
12969{
12970 {
12971 -1,
12972 (gchar *) "Heartbeat",
12973 (GDBusArgInfo **) &_control_signal_info_heartbeat_ARG_pointers,
12974 NULL
12975 },
12976 "heartbeat"
12977};
12978
12979static const _ExtendedGDBusArgInfo _control_signal_info_goto_system_state_ARG_state_name =
12980{
12981 {
12982 -1,
12983 (gchar *) "state_name",
12984 (gchar *) "s",
12985 NULL
12986 },
12987 FALSE
12988};
12989
12990static const _ExtendedGDBusArgInfo * const _control_signal_info_goto_system_state_ARG_pointers[] =
12991{
12992 &_control_signal_info_goto_system_state_ARG_state_name,
12993 NULL
12994};
12995
12996static const _ExtendedGDBusSignalInfo _control_signal_info_goto_system_state =
12997{
12998 {
12999 -1,
13000 (gchar *) "GotoSystemState",
13001 (GDBusArgInfo **) &_control_signal_info_goto_system_state_ARG_pointers,
13002 NULL
13003 },
13004 "goto-system-state"
13005};
13006
Norman Jamesa3e47c42015-10-18 14:43:10 -050013007static const _ExtendedGDBusSignalInfo _control_signal_info_started =
13008{
13009 {
13010 -1,
13011 (gchar *) "Started",
13012 NULL,
13013 NULL
13014 },
13015 "started"
13016};
13017
Norman James362a80f2015-09-14 14:04:39 -050013018static const _ExtendedGDBusSignalInfo * const _control_signal_info_pointers[] =
13019{
13020 &_control_signal_info_heartbeat,
13021 &_control_signal_info_goto_system_state,
Norman Jamesa3e47c42015-10-18 14:43:10 -050013022 &_control_signal_info_started,
Norman James362a80f2015-09-14 14:04:39 -050013023 NULL
13024};
13025
13026static const _ExtendedGDBusPropertyInfo _control_property_info_poll_interval =
13027{
13028 {
13029 -1,
13030 (gchar *) "poll_interval",
13031 (gchar *) "i",
13032 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
13033 NULL
13034 },
13035 "poll-interval",
13036 FALSE
13037};
13038
13039static const _ExtendedGDBusPropertyInfo _control_property_info_heatbeat =
13040{
13041 {
13042 -1,
13043 (gchar *) "heatbeat",
13044 (gchar *) "i",
13045 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
13046 NULL
13047 },
13048 "heatbeat",
13049 FALSE
13050};
13051
13052static const _ExtendedGDBusPropertyInfo * const _control_property_info_pointers[] =
13053{
13054 &_control_property_info_poll_interval,
13055 &_control_property_info_heatbeat,
13056 NULL
13057};
13058
13059static const _ExtendedGDBusInterfaceInfo _control_interface_info =
13060{
13061 {
13062 -1,
13063 (gchar *) "org.openbmc.Control",
13064 (GDBusMethodInfo **) &_control_method_info_pointers,
13065 (GDBusSignalInfo **) &_control_signal_info_pointers,
13066 (GDBusPropertyInfo **) &_control_property_info_pointers,
13067 NULL
13068 },
13069 "control",
13070};
13071
13072
13073/**
13074 * control_interface_info:
13075 *
13076 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link> D-Bus interface.
13077 *
13078 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
13079 */
13080GDBusInterfaceInfo *
13081control_interface_info (void)
13082{
13083 return (GDBusInterfaceInfo *) &_control_interface_info.parent_struct;
13084}
13085
13086/**
13087 * control_override_properties:
13088 * @klass: The class structure for a #GObject<!-- -->-derived class.
13089 * @property_id_begin: The property id to assign to the first overridden property.
13090 *
13091 * Overrides all #GObject properties in the #Control interface for a concrete class.
13092 * The properties are overridden in the order they are defined.
13093 *
13094 * Returns: The last property id.
13095 */
13096guint
13097control_override_properties (GObjectClass *klass, guint property_id_begin)
13098{
13099 g_object_class_override_property (klass, property_id_begin++, "poll-interval");
13100 g_object_class_override_property (klass, property_id_begin++, "heatbeat");
13101 return property_id_begin - 1;
13102}
13103
13104
13105
13106/**
13107 * Control:
13108 *
13109 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link>.
13110 */
13111
13112/**
13113 * ControlIface:
13114 * @parent_iface: The parent interface.
13115 * @handle_init: Handler for the #Control::handle-init signal.
13116 * @get_heatbeat: Getter for the #Control:heatbeat property.
13117 * @get_poll_interval: Getter for the #Control:poll-interval property.
13118 * @goto_system_state: Handler for the #Control::goto-system-state signal.
13119 * @heartbeat: Handler for the #Control::heartbeat signal.
Norman Jamesa3e47c42015-10-18 14:43:10 -050013120 * @started: Handler for the #Control::started signal.
Norman James362a80f2015-09-14 14:04:39 -050013121 *
13122 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link>.
13123 */
13124
13125typedef ControlIface ControlInterface;
13126G_DEFINE_INTERFACE (Control, control, G_TYPE_OBJECT);
13127
13128static void
13129control_default_init (ControlIface *iface)
13130{
13131 /* GObject signals for incoming D-Bus method calls: */
13132 /**
13133 * Control::handle-init:
13134 * @object: A #Control.
13135 * @invocation: A #GDBusMethodInvocation.
13136 *
13137 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Control.init">init()</link> D-Bus method.
13138 *
13139 * 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.
13140 *
13141 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
13142 */
13143 g_signal_new ("handle-init",
13144 G_TYPE_FROM_INTERFACE (iface),
13145 G_SIGNAL_RUN_LAST,
13146 G_STRUCT_OFFSET (ControlIface, handle_init),
13147 g_signal_accumulator_true_handled,
13148 NULL,
13149 g_cclosure_marshal_generic,
13150 G_TYPE_BOOLEAN,
13151 1,
13152 G_TYPE_DBUS_METHOD_INVOCATION);
13153
13154 /* GObject signals for received D-Bus signals: */
13155 /**
13156 * Control::heartbeat:
13157 * @object: A #Control.
13158 * @arg_bus_name: Argument.
13159 *
13160 * 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.
13161 *
13162 * 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.
13163 */
13164 g_signal_new ("heartbeat",
13165 G_TYPE_FROM_INTERFACE (iface),
13166 G_SIGNAL_RUN_LAST,
13167 G_STRUCT_OFFSET (ControlIface, heartbeat),
13168 NULL,
13169 NULL,
13170 g_cclosure_marshal_generic,
13171 G_TYPE_NONE,
13172 1, G_TYPE_STRING);
13173
13174 /**
13175 * Control::goto-system-state:
13176 * @object: A #Control.
13177 * @arg_state_name: Argument.
13178 *
13179 * 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.
13180 *
13181 * 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.
13182 */
13183 g_signal_new ("goto-system-state",
13184 G_TYPE_FROM_INTERFACE (iface),
13185 G_SIGNAL_RUN_LAST,
13186 G_STRUCT_OFFSET (ControlIface, goto_system_state),
13187 NULL,
13188 NULL,
13189 g_cclosure_marshal_generic,
13190 G_TYPE_NONE,
13191 1, G_TYPE_STRING);
13192
Norman Jamesa3e47c42015-10-18 14:43:10 -050013193 /**
13194 * Control::started:
13195 * @object: A #Control.
13196 *
13197 * 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.
13198 *
13199 * 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.
13200 */
13201 g_signal_new ("started",
13202 G_TYPE_FROM_INTERFACE (iface),
13203 G_SIGNAL_RUN_LAST,
13204 G_STRUCT_OFFSET (ControlIface, started),
13205 NULL,
13206 NULL,
13207 g_cclosure_marshal_generic,
13208 G_TYPE_NONE,
13209 0);
13210
Norman James362a80f2015-09-14 14:04:39 -050013211 /* GObject properties for D-Bus properties: */
13212 /**
13213 * Control:poll-interval:
13214 *
13215 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Control.poll_interval">"poll_interval"</link>.
13216 *
13217 * 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.
13218 */
13219 g_object_interface_install_property (iface,
13220 g_param_spec_int ("poll-interval", "poll_interval", "poll_interval", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
13221 /**
13222 * Control:heatbeat:
13223 *
13224 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Control.heatbeat">"heatbeat"</link>.
13225 *
13226 * 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.
13227 */
13228 g_object_interface_install_property (iface,
13229 g_param_spec_int ("heatbeat", "heatbeat", "heatbeat", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
13230}
13231
13232/**
13233 * control_get_poll_interval: (skip)
13234 * @object: A #Control.
13235 *
13236 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Control.poll_interval">"poll_interval"</link> D-Bus property.
13237 *
13238 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
13239 *
13240 * Returns: The property value.
13241 */
13242gint
13243control_get_poll_interval (Control *object)
13244{
13245 return CONTROL_GET_IFACE (object)->get_poll_interval (object);
13246}
13247
13248/**
13249 * control_set_poll_interval: (skip)
13250 * @object: A #Control.
13251 * @value: The value to set.
13252 *
13253 * Sets the <link linkend="gdbus-property-org-openbmc-Control.poll_interval">"poll_interval"</link> D-Bus property to @value.
13254 *
13255 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
13256 */
13257void
13258control_set_poll_interval (Control *object, gint value)
13259{
13260 g_object_set (G_OBJECT (object), "poll-interval", value, NULL);
13261}
13262
13263/**
13264 * control_get_heatbeat: (skip)
13265 * @object: A #Control.
13266 *
13267 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Control.heatbeat">"heatbeat"</link> D-Bus property.
13268 *
13269 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
13270 *
13271 * Returns: The property value.
13272 */
13273gint
13274control_get_heatbeat (Control *object)
13275{
13276 return CONTROL_GET_IFACE (object)->get_heatbeat (object);
13277}
13278
13279/**
13280 * control_set_heatbeat: (skip)
13281 * @object: A #Control.
13282 * @value: The value to set.
13283 *
13284 * Sets the <link linkend="gdbus-property-org-openbmc-Control.heatbeat">"heatbeat"</link> D-Bus property to @value.
13285 *
13286 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
13287 */
13288void
13289control_set_heatbeat (Control *object, gint value)
13290{
13291 g_object_set (G_OBJECT (object), "heatbeat", value, NULL);
13292}
13293
13294/**
13295 * control_emit_heartbeat:
13296 * @object: A #Control.
13297 * @arg_bus_name: Argument to pass with the signal.
13298 *
13299 * Emits the <link linkend="gdbus-signal-org-openbmc-Control.Heartbeat">"Heartbeat"</link> D-Bus signal.
13300 */
13301void
13302control_emit_heartbeat (
13303 Control *object,
13304 const gchar *arg_bus_name)
13305{
13306 g_signal_emit_by_name (object, "heartbeat", arg_bus_name);
13307}
13308
13309/**
13310 * control_emit_goto_system_state:
13311 * @object: A #Control.
13312 * @arg_state_name: Argument to pass with the signal.
13313 *
13314 * Emits the <link linkend="gdbus-signal-org-openbmc-Control.GotoSystemState">"GotoSystemState"</link> D-Bus signal.
13315 */
13316void
13317control_emit_goto_system_state (
13318 Control *object,
13319 const gchar *arg_state_name)
13320{
13321 g_signal_emit_by_name (object, "goto-system-state", arg_state_name);
13322}
13323
13324/**
Norman Jamesa3e47c42015-10-18 14:43:10 -050013325 * control_emit_started:
13326 * @object: A #Control.
13327 *
13328 * Emits the <link linkend="gdbus-signal-org-openbmc-Control.Started">"Started"</link> D-Bus signal.
13329 */
13330void
13331control_emit_started (
13332 Control *object)
13333{
13334 g_signal_emit_by_name (object, "started");
13335}
13336
13337/**
Norman James362a80f2015-09-14 14:04:39 -050013338 * control_call_init:
13339 * @proxy: A #ControlProxy.
13340 * @cancellable: (allow-none): A #GCancellable or %NULL.
13341 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
13342 * @user_data: User data to pass to @callback.
13343 *
13344 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Control.init">init()</link> D-Bus method on @proxy.
13345 * 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.
13346 * You can then call control_call_init_finish() to get the result of the operation.
13347 *
13348 * See control_call_init_sync() for the synchronous, blocking version of this method.
13349 */
13350void
13351control_call_init (
13352 Control *proxy,
13353 GCancellable *cancellable,
13354 GAsyncReadyCallback callback,
13355 gpointer user_data)
13356{
13357 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
13358 "init",
13359 g_variant_new ("()"),
13360 G_DBUS_CALL_FLAGS_NONE,
13361 -1,
13362 cancellable,
13363 callback,
13364 user_data);
13365}
13366
13367/**
13368 * control_call_init_finish:
13369 * @proxy: A #ControlProxy.
13370 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_call_init().
13371 * @error: Return location for error or %NULL.
13372 *
13373 * Finishes an operation started with control_call_init().
13374 *
13375 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
13376 */
13377gboolean
13378control_call_init_finish (
13379 Control *proxy,
13380 GAsyncResult *res,
13381 GError **error)
13382{
13383 GVariant *_ret;
13384 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
13385 if (_ret == NULL)
13386 goto _out;
13387 g_variant_get (_ret,
13388 "()");
13389 g_variant_unref (_ret);
13390_out:
13391 return _ret != NULL;
13392}
13393
13394/**
13395 * control_call_init_sync:
13396 * @proxy: A #ControlProxy.
13397 * @cancellable: (allow-none): A #GCancellable or %NULL.
13398 * @error: Return location for error or %NULL.
13399 *
13400 * 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.
13401 *
13402 * See control_call_init() for the asynchronous version of this method.
13403 *
13404 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
13405 */
13406gboolean
13407control_call_init_sync (
13408 Control *proxy,
13409 GCancellable *cancellable,
13410 GError **error)
13411{
13412 GVariant *_ret;
13413 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
13414 "init",
13415 g_variant_new ("()"),
13416 G_DBUS_CALL_FLAGS_NONE,
13417 -1,
13418 cancellable,
13419 error);
13420 if (_ret == NULL)
13421 goto _out;
13422 g_variant_get (_ret,
13423 "()");
13424 g_variant_unref (_ret);
13425_out:
13426 return _ret != NULL;
13427}
13428
13429/**
13430 * control_complete_init:
13431 * @object: A #Control.
13432 * @invocation: (transfer full): A #GDBusMethodInvocation.
13433 *
13434 * 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.
13435 *
13436 * This method will free @invocation, you cannot use it afterwards.
13437 */
13438void
13439control_complete_init (
13440 Control *object,
13441 GDBusMethodInvocation *invocation)
13442{
13443 g_dbus_method_invocation_return_value (invocation,
13444 g_variant_new ("()"));
13445}
13446
13447/* ------------------------------------------------------------------------ */
13448
13449/**
13450 * ControlProxy:
13451 *
13452 * The #ControlProxy structure contains only private data and should only be accessed using the provided API.
13453 */
13454
13455/**
13456 * ControlProxyClass:
13457 * @parent_class: The parent class.
13458 *
13459 * Class structure for #ControlProxy.
13460 */
13461
13462struct _ControlProxyPrivate
13463{
13464 GData *qdata;
13465};
13466
13467static void control_proxy_iface_init (ControlIface *iface);
13468
13469#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
13470G_DEFINE_TYPE_WITH_CODE (ControlProxy, control_proxy, G_TYPE_DBUS_PROXY,
13471 G_ADD_PRIVATE (ControlProxy)
13472 G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_proxy_iface_init));
13473
13474#else
13475G_DEFINE_TYPE_WITH_CODE (ControlProxy, control_proxy, G_TYPE_DBUS_PROXY,
13476 G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_proxy_iface_init));
13477
13478#endif
13479static void
13480control_proxy_finalize (GObject *object)
13481{
13482 ControlProxy *proxy = CONTROL_PROXY (object);
13483 g_datalist_clear (&proxy->priv->qdata);
13484 G_OBJECT_CLASS (control_proxy_parent_class)->finalize (object);
13485}
13486
13487static void
13488control_proxy_get_property (GObject *object,
13489 guint prop_id,
13490 GValue *value,
13491 GParamSpec *pspec G_GNUC_UNUSED)
13492{
13493 const _ExtendedGDBusPropertyInfo *info;
13494 GVariant *variant;
13495 g_assert (prop_id != 0 && prop_id - 1 < 2);
13496 info = _control_property_info_pointers[prop_id - 1];
13497 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
13498 if (info->use_gvariant)
13499 {
13500 g_value_set_variant (value, variant);
13501 }
13502 else
13503 {
13504 if (variant != NULL)
13505 g_dbus_gvariant_to_gvalue (variant, value);
13506 }
13507 if (variant != NULL)
13508 g_variant_unref (variant);
13509}
13510
13511static void
13512control_proxy_set_property_cb (GDBusProxy *proxy,
13513 GAsyncResult *res,
13514 gpointer user_data)
13515{
13516 const _ExtendedGDBusPropertyInfo *info = user_data;
13517 GError *error;
13518 GVariant *_ret;
13519 error = NULL;
13520 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
13521 if (!_ret)
13522 {
13523 g_warning ("Error setting property '%s' on interface org.openbmc.Control: %s (%s, %d)",
13524 info->parent_struct.name,
13525 error->message, g_quark_to_string (error->domain), error->code);
13526 g_error_free (error);
13527 }
13528 else
13529 {
13530 g_variant_unref (_ret);
13531 }
13532}
13533
13534static void
13535control_proxy_set_property (GObject *object,
13536 guint prop_id,
13537 const GValue *value,
13538 GParamSpec *pspec G_GNUC_UNUSED)
13539{
13540 const _ExtendedGDBusPropertyInfo *info;
13541 GVariant *variant;
13542 g_assert (prop_id != 0 && prop_id - 1 < 2);
13543 info = _control_property_info_pointers[prop_id - 1];
13544 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
13545 g_dbus_proxy_call (G_DBUS_PROXY (object),
13546 "org.freedesktop.DBus.Properties.Set",
13547 g_variant_new ("(ssv)", "org.openbmc.Control", info->parent_struct.name, variant),
13548 G_DBUS_CALL_FLAGS_NONE,
13549 -1,
13550 NULL, (GAsyncReadyCallback) control_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
13551 g_variant_unref (variant);
13552}
13553
13554static void
13555control_proxy_g_signal (GDBusProxy *proxy,
13556 const gchar *sender_name G_GNUC_UNUSED,
13557 const gchar *signal_name,
13558 GVariant *parameters)
13559{
13560 _ExtendedGDBusSignalInfo *info;
13561 GVariantIter iter;
13562 GVariant *child;
13563 GValue *paramv;
13564 guint num_params;
13565 guint n;
13566 guint signal_id;
13567 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, signal_name);
13568 if (info == NULL)
13569 return;
13570 num_params = g_variant_n_children (parameters);
13571 paramv = g_new0 (GValue, num_params + 1);
13572 g_value_init (&paramv[0], TYPE_CONTROL);
13573 g_value_set_object (&paramv[0], proxy);
13574 g_variant_iter_init (&iter, parameters);
13575 n = 1;
13576 while ((child = g_variant_iter_next_value (&iter)) != NULL)
13577 {
13578 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
13579 if (arg_info->use_gvariant)
13580 {
13581 g_value_init (&paramv[n], G_TYPE_VARIANT);
13582 g_value_set_variant (&paramv[n], child);
13583 n++;
13584 }
13585 else
13586 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
13587 g_variant_unref (child);
13588 }
13589 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL);
13590 g_signal_emitv (paramv, signal_id, 0, NULL);
13591 for (n = 0; n < num_params + 1; n++)
13592 g_value_unset (&paramv[n]);
13593 g_free (paramv);
13594}
13595
13596static void
13597control_proxy_g_properties_changed (GDBusProxy *_proxy,
13598 GVariant *changed_properties,
13599 const gchar *const *invalidated_properties)
13600{
13601 ControlProxy *proxy = CONTROL_PROXY (_proxy);
13602 guint n;
13603 const gchar *key;
13604 GVariantIter *iter;
13605 _ExtendedGDBusPropertyInfo *info;
13606 g_variant_get (changed_properties, "a{sv}", &iter);
13607 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
13608 {
13609 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, key);
13610 g_datalist_remove_data (&proxy->priv->qdata, key);
13611 if (info != NULL)
13612 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
13613 }
13614 g_variant_iter_free (iter);
13615 for (n = 0; invalidated_properties[n] != NULL; n++)
13616 {
13617 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, invalidated_properties[n]);
13618 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
13619 if (info != NULL)
13620 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
13621 }
13622}
13623
13624static gint
13625control_proxy_get_poll_interval (Control *object)
13626{
13627 ControlProxy *proxy = CONTROL_PROXY (object);
13628 GVariant *variant;
13629 gint value = 0;
13630 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "poll_interval");
13631 if (variant != NULL)
13632 {
13633 value = g_variant_get_int32 (variant);
13634 g_variant_unref (variant);
13635 }
13636 return value;
13637}
13638
13639static gint
13640control_proxy_get_heatbeat (Control *object)
13641{
13642 ControlProxy *proxy = CONTROL_PROXY (object);
13643 GVariant *variant;
13644 gint value = 0;
13645 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "heatbeat");
13646 if (variant != NULL)
13647 {
13648 value = g_variant_get_int32 (variant);
13649 g_variant_unref (variant);
13650 }
13651 return value;
13652}
13653
13654static void
13655control_proxy_init (ControlProxy *proxy)
13656{
13657#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
13658 proxy->priv = control_proxy_get_instance_private (proxy);
13659#else
13660 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_PROXY, ControlProxyPrivate);
13661#endif
13662
13663 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_interface_info ());
13664}
13665
13666static void
13667control_proxy_class_init (ControlProxyClass *klass)
13668{
13669 GObjectClass *gobject_class;
13670 GDBusProxyClass *proxy_class;
13671
13672 gobject_class = G_OBJECT_CLASS (klass);
13673 gobject_class->finalize = control_proxy_finalize;
13674 gobject_class->get_property = control_proxy_get_property;
13675 gobject_class->set_property = control_proxy_set_property;
13676
13677 proxy_class = G_DBUS_PROXY_CLASS (klass);
13678 proxy_class->g_signal = control_proxy_g_signal;
13679 proxy_class->g_properties_changed = control_proxy_g_properties_changed;
13680
13681 control_override_properties (gobject_class, 1);
13682
13683#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
13684 g_type_class_add_private (klass, sizeof (ControlProxyPrivate));
13685#endif
13686}
13687
13688static void
13689control_proxy_iface_init (ControlIface *iface)
13690{
13691 iface->get_poll_interval = control_proxy_get_poll_interval;
13692 iface->get_heatbeat = control_proxy_get_heatbeat;
13693}
13694
13695/**
13696 * control_proxy_new:
13697 * @connection: A #GDBusConnection.
13698 * @flags: Flags from the #GDBusProxyFlags enumeration.
13699 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
13700 * @object_path: An object path.
13701 * @cancellable: (allow-none): A #GCancellable or %NULL.
13702 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
13703 * @user_data: User data to pass to @callback.
13704 *
13705 * 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.
13706 *
13707 * 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.
13708 * You can then call control_proxy_new_finish() to get the result of the operation.
13709 *
13710 * See control_proxy_new_sync() for the synchronous, blocking version of this constructor.
13711 */
13712void
13713control_proxy_new (
13714 GDBusConnection *connection,
13715 GDBusProxyFlags flags,
13716 const gchar *name,
13717 const gchar *object_path,
13718 GCancellable *cancellable,
13719 GAsyncReadyCallback callback,
13720 gpointer user_data)
13721{
13722 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);
13723}
13724
13725/**
13726 * control_proxy_new_finish:
13727 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_proxy_new().
13728 * @error: Return location for error or %NULL
13729 *
13730 * Finishes an operation started with control_proxy_new().
13731 *
13732 * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set.
13733 */
13734Control *
13735control_proxy_new_finish (
13736 GAsyncResult *res,
13737 GError **error)
13738{
13739 GObject *ret;
13740 GObject *source_object;
13741 source_object = g_async_result_get_source_object (res);
13742 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
13743 g_object_unref (source_object);
13744 if (ret != NULL)
13745 return CONTROL (ret);
13746 else
13747 return NULL;
13748}
13749
13750/**
13751 * control_proxy_new_sync:
13752 * @connection: A #GDBusConnection.
13753 * @flags: Flags from the #GDBusProxyFlags enumeration.
13754 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
13755 * @object_path: An object path.
13756 * @cancellable: (allow-none): A #GCancellable or %NULL.
13757 * @error: Return location for error or %NULL
13758 *
13759 * 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.
13760 *
13761 * The calling thread is blocked until a reply is received.
13762 *
13763 * See control_proxy_new() for the asynchronous version of this constructor.
13764 *
13765 * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set.
13766 */
13767Control *
13768control_proxy_new_sync (
13769 GDBusConnection *connection,
13770 GDBusProxyFlags flags,
13771 const gchar *name,
13772 const gchar *object_path,
13773 GCancellable *cancellable,
13774 GError **error)
13775{
13776 GInitable *ret;
13777 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);
13778 if (ret != NULL)
13779 return CONTROL (ret);
13780 else
13781 return NULL;
13782}
13783
13784
13785/**
13786 * control_proxy_new_for_bus:
13787 * @bus_type: A #GBusType.
13788 * @flags: Flags from the #GDBusProxyFlags enumeration.
13789 * @name: A bus name (well-known or unique).
13790 * @object_path: An object path.
13791 * @cancellable: (allow-none): A #GCancellable or %NULL.
13792 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
13793 * @user_data: User data to pass to @callback.
13794 *
13795 * Like control_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
13796 *
13797 * 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.
13798 * You can then call control_proxy_new_for_bus_finish() to get the result of the operation.
13799 *
13800 * See control_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
13801 */
13802void
13803control_proxy_new_for_bus (
13804 GBusType bus_type,
13805 GDBusProxyFlags flags,
13806 const gchar *name,
13807 const gchar *object_path,
13808 GCancellable *cancellable,
13809 GAsyncReadyCallback callback,
13810 gpointer user_data)
13811{
13812 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);
13813}
13814
13815/**
13816 * control_proxy_new_for_bus_finish:
13817 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_proxy_new_for_bus().
13818 * @error: Return location for error or %NULL
13819 *
13820 * Finishes an operation started with control_proxy_new_for_bus().
13821 *
13822 * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set.
13823 */
13824Control *
13825control_proxy_new_for_bus_finish (
13826 GAsyncResult *res,
13827 GError **error)
13828{
13829 GObject *ret;
13830 GObject *source_object;
13831 source_object = g_async_result_get_source_object (res);
13832 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
13833 g_object_unref (source_object);
13834 if (ret != NULL)
13835 return CONTROL (ret);
13836 else
13837 return NULL;
13838}
13839
13840/**
13841 * control_proxy_new_for_bus_sync:
13842 * @bus_type: A #GBusType.
13843 * @flags: Flags from the #GDBusProxyFlags enumeration.
13844 * @name: A bus name (well-known or unique).
13845 * @object_path: An object path.
13846 * @cancellable: (allow-none): A #GCancellable or %NULL.
13847 * @error: Return location for error or %NULL
13848 *
13849 * Like control_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
13850 *
13851 * The calling thread is blocked until a reply is received.
13852 *
13853 * See control_proxy_new_for_bus() for the asynchronous version of this constructor.
13854 *
13855 * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set.
13856 */
13857Control *
13858control_proxy_new_for_bus_sync (
13859 GBusType bus_type,
13860 GDBusProxyFlags flags,
13861 const gchar *name,
13862 const gchar *object_path,
13863 GCancellable *cancellable,
13864 GError **error)
13865{
13866 GInitable *ret;
13867 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);
13868 if (ret != NULL)
13869 return CONTROL (ret);
13870 else
13871 return NULL;
13872}
13873
13874
13875/* ------------------------------------------------------------------------ */
13876
13877/**
13878 * ControlSkeleton:
13879 *
13880 * The #ControlSkeleton structure contains only private data and should only be accessed using the provided API.
13881 */
13882
13883/**
13884 * ControlSkeletonClass:
13885 * @parent_class: The parent class.
13886 *
13887 * Class structure for #ControlSkeleton.
13888 */
13889
13890struct _ControlSkeletonPrivate
13891{
13892 GValue *properties;
13893 GList *changed_properties;
13894 GSource *changed_properties_idle_source;
13895 GMainContext *context;
13896 GMutex lock;
13897};
13898
13899static void
13900_control_skeleton_handle_method_call (
13901 GDBusConnection *connection G_GNUC_UNUSED,
13902 const gchar *sender G_GNUC_UNUSED,
13903 const gchar *object_path G_GNUC_UNUSED,
13904 const gchar *interface_name,
13905 const gchar *method_name,
13906 GVariant *parameters,
13907 GDBusMethodInvocation *invocation,
13908 gpointer user_data)
13909{
13910 ControlSkeleton *skeleton = CONTROL_SKELETON (user_data);
13911 _ExtendedGDBusMethodInfo *info;
13912 GVariantIter iter;
13913 GVariant *child;
13914 GValue *paramv;
13915 guint num_params;
13916 guint num_extra;
13917 guint n;
13918 guint signal_id;
13919 GValue return_value = G_VALUE_INIT;
13920 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
13921 g_assert (info != NULL);
13922 num_params = g_variant_n_children (parameters);
13923 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
13924 n = 0;
13925 g_value_init (&paramv[n], TYPE_CONTROL);
13926 g_value_set_object (&paramv[n++], skeleton);
13927 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
13928 g_value_set_object (&paramv[n++], invocation);
13929 if (info->pass_fdlist)
13930 {
13931#ifdef G_OS_UNIX
13932 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
13933 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
13934#else
13935 g_assert_not_reached ();
13936#endif
13937 }
13938 g_variant_iter_init (&iter, parameters);
13939 while ((child = g_variant_iter_next_value (&iter)) != NULL)
13940 {
13941 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
13942 if (arg_info->use_gvariant)
13943 {
13944 g_value_init (&paramv[n], G_TYPE_VARIANT);
13945 g_value_set_variant (&paramv[n], child);
13946 n++;
13947 }
13948 else
13949 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
13950 g_variant_unref (child);
13951 }
13952 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL);
13953 g_value_init (&return_value, G_TYPE_BOOLEAN);
13954 g_signal_emitv (paramv, signal_id, 0, &return_value);
13955 if (!g_value_get_boolean (&return_value))
13956 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);
13957 g_value_unset (&return_value);
13958 for (n = 0; n < num_params + num_extra; n++)
13959 g_value_unset (&paramv[n]);
13960 g_free (paramv);
13961}
13962
13963static GVariant *
13964_control_skeleton_handle_get_property (
13965 GDBusConnection *connection G_GNUC_UNUSED,
13966 const gchar *sender G_GNUC_UNUSED,
13967 const gchar *object_path G_GNUC_UNUSED,
13968 const gchar *interface_name G_GNUC_UNUSED,
13969 const gchar *property_name,
13970 GError **error,
13971 gpointer user_data)
13972{
13973 ControlSkeleton *skeleton = CONTROL_SKELETON (user_data);
13974 GValue value = G_VALUE_INIT;
13975 GParamSpec *pspec;
13976 _ExtendedGDBusPropertyInfo *info;
13977 GVariant *ret;
13978 ret = NULL;
13979 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, property_name);
13980 g_assert (info != NULL);
13981 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
13982 if (pspec == NULL)
13983 {
13984 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
13985 }
13986 else
13987 {
13988 g_value_init (&value, pspec->value_type);
13989 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
13990 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
13991 g_value_unset (&value);
13992 }
13993 return ret;
13994}
13995
13996static gboolean
13997_control_skeleton_handle_set_property (
13998 GDBusConnection *connection G_GNUC_UNUSED,
13999 const gchar *sender G_GNUC_UNUSED,
14000 const gchar *object_path G_GNUC_UNUSED,
14001 const gchar *interface_name G_GNUC_UNUSED,
14002 const gchar *property_name,
14003 GVariant *variant,
14004 GError **error,
14005 gpointer user_data)
14006{
14007 ControlSkeleton *skeleton = CONTROL_SKELETON (user_data);
14008 GValue value = G_VALUE_INIT;
14009 GParamSpec *pspec;
14010 _ExtendedGDBusPropertyInfo *info;
14011 gboolean ret;
14012 ret = FALSE;
14013 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, property_name);
14014 g_assert (info != NULL);
14015 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
14016 if (pspec == NULL)
14017 {
14018 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
14019 }
14020 else
14021 {
14022 if (info->use_gvariant)
14023 g_value_set_variant (&value, variant);
14024 else
14025 g_dbus_gvariant_to_gvalue (variant, &value);
14026 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
14027 g_value_unset (&value);
14028 ret = TRUE;
14029 }
14030 return ret;
14031}
14032
14033static const GDBusInterfaceVTable _control_skeleton_vtable =
14034{
14035 _control_skeleton_handle_method_call,
14036 _control_skeleton_handle_get_property,
14037 _control_skeleton_handle_set_property,
14038 {NULL}
14039};
14040
14041static GDBusInterfaceInfo *
14042control_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
14043{
14044 return control_interface_info ();
14045}
14046
14047static GDBusInterfaceVTable *
14048control_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
14049{
14050 return (GDBusInterfaceVTable *) &_control_skeleton_vtable;
14051}
14052
14053static GVariant *
14054control_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
14055{
14056 ControlSkeleton *skeleton = CONTROL_SKELETON (_skeleton);
14057
14058 GVariantBuilder builder;
14059 guint n;
14060 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
14061 if (_control_interface_info.parent_struct.properties == NULL)
14062 goto out;
14063 for (n = 0; _control_interface_info.parent_struct.properties[n] != NULL; n++)
14064 {
14065 GDBusPropertyInfo *info = _control_interface_info.parent_struct.properties[n];
14066 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
14067 {
14068 GVariant *value;
14069 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);
14070 if (value != NULL)
14071 {
14072 g_variant_take_ref (value);
14073 g_variant_builder_add (&builder, "{sv}", info->name, value);
14074 g_variant_unref (value);
14075 }
14076 }
14077 }
14078out:
14079 return g_variant_builder_end (&builder);
14080}
14081
14082static gboolean _control_emit_changed (gpointer user_data);
14083
14084static void
14085control_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
14086{
14087 ControlSkeleton *skeleton = CONTROL_SKELETON (_skeleton);
14088 gboolean emit_changed = FALSE;
14089
14090 g_mutex_lock (&skeleton->priv->lock);
14091 if (skeleton->priv->changed_properties_idle_source != NULL)
14092 {
14093 g_source_destroy (skeleton->priv->changed_properties_idle_source);
14094 skeleton->priv->changed_properties_idle_source = NULL;
14095 emit_changed = TRUE;
14096 }
14097 g_mutex_unlock (&skeleton->priv->lock);
14098
14099 if (emit_changed)
14100 _control_emit_changed (skeleton);
14101}
14102
14103static void
14104_control_on_signal_heartbeat (
14105 Control *object,
14106 const gchar *arg_bus_name)
14107{
14108 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
14109
14110 GList *connections, *l;
14111 GVariant *signal_variant;
14112 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
14113
14114 signal_variant = g_variant_ref_sink (g_variant_new ("(s)",
14115 arg_bus_name));
14116 for (l = connections; l != NULL; l = l->next)
14117 {
14118 GDBusConnection *connection = l->data;
14119 g_dbus_connection_emit_signal (connection,
14120 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Control", "Heartbeat",
14121 signal_variant, NULL);
14122 }
14123 g_variant_unref (signal_variant);
14124 g_list_free_full (connections, g_object_unref);
14125}
14126
14127static void
14128_control_on_signal_goto_system_state (
14129 Control *object,
14130 const gchar *arg_state_name)
14131{
14132 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
14133
14134 GList *connections, *l;
14135 GVariant *signal_variant;
14136 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
14137
14138 signal_variant = g_variant_ref_sink (g_variant_new ("(s)",
14139 arg_state_name));
14140 for (l = connections; l != NULL; l = l->next)
14141 {
14142 GDBusConnection *connection = l->data;
14143 g_dbus_connection_emit_signal (connection,
14144 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Control", "GotoSystemState",
14145 signal_variant, NULL);
14146 }
14147 g_variant_unref (signal_variant);
14148 g_list_free_full (connections, g_object_unref);
14149}
14150
Norman Jamesa3e47c42015-10-18 14:43:10 -050014151static void
14152_control_on_signal_started (
14153 Control *object)
14154{
14155 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
14156
14157 GList *connections, *l;
14158 GVariant *signal_variant;
14159 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
14160
14161 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
14162 for (l = connections; l != NULL; l = l->next)
14163 {
14164 GDBusConnection *connection = l->data;
14165 g_dbus_connection_emit_signal (connection,
14166 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Control", "Started",
14167 signal_variant, NULL);
14168 }
14169 g_variant_unref (signal_variant);
14170 g_list_free_full (connections, g_object_unref);
14171}
14172
Norman James362a80f2015-09-14 14:04:39 -050014173static void control_skeleton_iface_init (ControlIface *iface);
14174#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
14175G_DEFINE_TYPE_WITH_CODE (ControlSkeleton, control_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
14176 G_ADD_PRIVATE (ControlSkeleton)
14177 G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_skeleton_iface_init));
14178
14179#else
14180G_DEFINE_TYPE_WITH_CODE (ControlSkeleton, control_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
14181 G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_skeleton_iface_init));
14182
14183#endif
14184static void
14185control_skeleton_finalize (GObject *object)
14186{
14187 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
14188 guint n;
14189 for (n = 0; n < 2; n++)
14190 g_value_unset (&skeleton->priv->properties[n]);
14191 g_free (skeleton->priv->properties);
14192 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
14193 if (skeleton->priv->changed_properties_idle_source != NULL)
14194 g_source_destroy (skeleton->priv->changed_properties_idle_source);
14195 g_main_context_unref (skeleton->priv->context);
14196 g_mutex_clear (&skeleton->priv->lock);
14197 G_OBJECT_CLASS (control_skeleton_parent_class)->finalize (object);
14198}
14199
14200static void
14201control_skeleton_get_property (GObject *object,
14202 guint prop_id,
14203 GValue *value,
14204 GParamSpec *pspec G_GNUC_UNUSED)
14205{
14206 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
14207 g_assert (prop_id != 0 && prop_id - 1 < 2);
14208 g_mutex_lock (&skeleton->priv->lock);
14209 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
14210 g_mutex_unlock (&skeleton->priv->lock);
14211}
14212
14213static gboolean
14214_control_emit_changed (gpointer user_data)
14215{
14216 ControlSkeleton *skeleton = CONTROL_SKELETON (user_data);
14217 GList *l;
14218 GVariantBuilder builder;
14219 GVariantBuilder invalidated_builder;
14220 guint num_changes;
14221
14222 g_mutex_lock (&skeleton->priv->lock);
14223 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
14224 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
14225 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
14226 {
14227 ChangedProperty *cp = l->data;
14228 GVariant *variant;
14229 const GValue *cur_value;
14230
14231 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
14232 if (!_g_value_equal (cur_value, &cp->orig_value))
14233 {
14234 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
14235 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
14236 g_variant_unref (variant);
14237 num_changes++;
14238 }
14239 }
14240 if (num_changes > 0)
14241 {
14242 GList *connections, *ll;
14243 GVariant *signal_variant;
14244 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Control",
14245 &builder, &invalidated_builder));
14246 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
14247 for (ll = connections; ll != NULL; ll = ll->next)
14248 {
14249 GDBusConnection *connection = ll->data;
14250
14251 g_dbus_connection_emit_signal (connection,
14252 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
14253 "org.freedesktop.DBus.Properties",
14254 "PropertiesChanged",
14255 signal_variant,
14256 NULL);
14257 }
14258 g_variant_unref (signal_variant);
14259 g_list_free_full (connections, g_object_unref);
14260 }
14261 else
14262 {
14263 g_variant_builder_clear (&builder);
14264 g_variant_builder_clear (&invalidated_builder);
14265 }
14266 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
14267 skeleton->priv->changed_properties = NULL;
14268 skeleton->priv->changed_properties_idle_source = NULL;
14269 g_mutex_unlock (&skeleton->priv->lock);
14270 return FALSE;
14271}
14272
14273static void
14274_control_schedule_emit_changed (ControlSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
14275{
14276 ChangedProperty *cp;
14277 GList *l;
14278 cp = NULL;
14279 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
14280 {
14281 ChangedProperty *i_cp = l->data;
14282 if (i_cp->info == info)
14283 {
14284 cp = i_cp;
14285 break;
14286 }
14287 }
14288 if (cp == NULL)
14289 {
14290 cp = g_new0 (ChangedProperty, 1);
14291 cp->prop_id = prop_id;
14292 cp->info = info;
14293 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
14294 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
14295 g_value_copy (orig_value, &cp->orig_value);
14296 }
14297}
14298
14299static void
14300control_skeleton_notify (GObject *object,
14301 GParamSpec *pspec G_GNUC_UNUSED)
14302{
14303 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
14304 g_mutex_lock (&skeleton->priv->lock);
14305 if (skeleton->priv->changed_properties != NULL &&
14306 skeleton->priv->changed_properties_idle_source == NULL)
14307 {
14308 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
14309 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
14310 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _control_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
14311 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
14312 g_source_unref (skeleton->priv->changed_properties_idle_source);
14313 }
14314 g_mutex_unlock (&skeleton->priv->lock);
14315}
14316
14317static void
14318control_skeleton_set_property (GObject *object,
14319 guint prop_id,
14320 const GValue *value,
14321 GParamSpec *pspec)
14322{
14323 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
14324 g_assert (prop_id != 0 && prop_id - 1 < 2);
14325 g_mutex_lock (&skeleton->priv->lock);
14326 g_object_freeze_notify (object);
14327 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
14328 {
14329 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
14330 _control_schedule_emit_changed (skeleton, _control_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
14331 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
14332 g_object_notify_by_pspec (object, pspec);
14333 }
14334 g_mutex_unlock (&skeleton->priv->lock);
14335 g_object_thaw_notify (object);
14336}
14337
14338static void
14339control_skeleton_init (ControlSkeleton *skeleton)
14340{
14341#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
14342 skeleton->priv = control_skeleton_get_instance_private (skeleton);
14343#else
14344 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_SKELETON, ControlSkeletonPrivate);
14345#endif
14346
14347 g_mutex_init (&skeleton->priv->lock);
14348 skeleton->priv->context = g_main_context_ref_thread_default ();
14349 skeleton->priv->properties = g_new0 (GValue, 2);
14350 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
14351 g_value_init (&skeleton->priv->properties[1], G_TYPE_INT);
14352}
14353
14354static gint
14355control_skeleton_get_poll_interval (Control *object)
14356{
14357 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
14358 gint value;
14359 g_mutex_lock (&skeleton->priv->lock);
14360 value = g_value_get_int (&(skeleton->priv->properties[0]));
14361 g_mutex_unlock (&skeleton->priv->lock);
14362 return value;
14363}
14364
14365static gint
14366control_skeleton_get_heatbeat (Control *object)
14367{
14368 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
14369 gint value;
14370 g_mutex_lock (&skeleton->priv->lock);
14371 value = g_value_get_int (&(skeleton->priv->properties[1]));
14372 g_mutex_unlock (&skeleton->priv->lock);
14373 return value;
14374}
14375
14376static void
14377control_skeleton_class_init (ControlSkeletonClass *klass)
14378{
14379 GObjectClass *gobject_class;
14380 GDBusInterfaceSkeletonClass *skeleton_class;
14381
14382 gobject_class = G_OBJECT_CLASS (klass);
14383 gobject_class->finalize = control_skeleton_finalize;
14384 gobject_class->get_property = control_skeleton_get_property;
14385 gobject_class->set_property = control_skeleton_set_property;
14386 gobject_class->notify = control_skeleton_notify;
14387
14388
14389 control_override_properties (gobject_class, 1);
14390
14391 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
14392 skeleton_class->get_info = control_skeleton_dbus_interface_get_info;
14393 skeleton_class->get_properties = control_skeleton_dbus_interface_get_properties;
14394 skeleton_class->flush = control_skeleton_dbus_interface_flush;
14395 skeleton_class->get_vtable = control_skeleton_dbus_interface_get_vtable;
14396
14397#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
14398 g_type_class_add_private (klass, sizeof (ControlSkeletonPrivate));
14399#endif
14400}
14401
14402static void
14403control_skeleton_iface_init (ControlIface *iface)
14404{
14405 iface->heartbeat = _control_on_signal_heartbeat;
14406 iface->goto_system_state = _control_on_signal_goto_system_state;
Norman Jamesa3e47c42015-10-18 14:43:10 -050014407 iface->started = _control_on_signal_started;
Norman James362a80f2015-09-14 14:04:39 -050014408 iface->get_poll_interval = control_skeleton_get_poll_interval;
14409 iface->get_heatbeat = control_skeleton_get_heatbeat;
14410}
14411
14412/**
14413 * control_skeleton_new:
14414 *
14415 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link>.
14416 *
14417 * Returns: (transfer full) (type ControlSkeleton): The skeleton object.
14418 */
14419Control *
14420control_skeleton_new (void)
14421{
14422 return CONTROL (g_object_new (TYPE_CONTROL_SKELETON, NULL));
14423}
14424
14425/* ------------------------------------------------------------------------
14426 * Code for interface org.openbmc.control.Bmc
14427 * ------------------------------------------------------------------------
14428 */
14429
14430/**
14431 * SECTION:ControlBmc
14432 * @title: ControlBmc
14433 * @short_description: Generated C code for the org.openbmc.control.Bmc D-Bus interface
14434 *
14435 * 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.
14436 */
14437
14438/* ---- Introspection data for org.openbmc.control.Bmc ---- */
14439
14440static const _ExtendedGDBusMethodInfo _control_bmc_method_info_place_holder =
14441{
14442 {
14443 -1,
14444 (gchar *) "place_holder",
14445 NULL,
14446 NULL,
14447 NULL
14448 },
14449 "handle-place-holder",
14450 FALSE
14451};
14452
14453static const _ExtendedGDBusMethodInfo * const _control_bmc_method_info_pointers[] =
14454{
14455 &_control_bmc_method_info_place_holder,
14456 NULL
14457};
14458
14459static const _ExtendedGDBusInterfaceInfo _control_bmc_interface_info =
14460{
14461 {
14462 -1,
14463 (gchar *) "org.openbmc.control.Bmc",
14464 (GDBusMethodInfo **) &_control_bmc_method_info_pointers,
14465 NULL,
14466 NULL,
14467 NULL
14468 },
14469 "control-bmc",
14470};
14471
14472
14473/**
14474 * control_bmc_interface_info:
14475 *
14476 * 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.
14477 *
14478 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
14479 */
14480GDBusInterfaceInfo *
14481control_bmc_interface_info (void)
14482{
14483 return (GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct;
14484}
14485
14486/**
14487 * control_bmc_override_properties:
14488 * @klass: The class structure for a #GObject<!-- -->-derived class.
14489 * @property_id_begin: The property id to assign to the first overridden property.
14490 *
14491 * Overrides all #GObject properties in the #ControlBmc interface for a concrete class.
14492 * The properties are overridden in the order they are defined.
14493 *
14494 * Returns: The last property id.
14495 */
14496guint
14497control_bmc_override_properties (GObjectClass *klass, guint property_id_begin)
14498{
14499 return property_id_begin - 1;
14500}
14501
14502
14503
14504/**
14505 * ControlBmc:
14506 *
14507 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Bmc.top_of_page">org.openbmc.control.Bmc</link>.
14508 */
14509
14510/**
14511 * ControlBmcIface:
14512 * @parent_iface: The parent interface.
14513 * @handle_place_holder: Handler for the #ControlBmc::handle-place-holder signal.
14514 *
14515 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Bmc.top_of_page">org.openbmc.control.Bmc</link>.
14516 */
14517
14518typedef ControlBmcIface ControlBmcInterface;
14519G_DEFINE_INTERFACE (ControlBmc, control_bmc, G_TYPE_OBJECT);
14520
14521static void
14522control_bmc_default_init (ControlBmcIface *iface)
14523{
14524 /* GObject signals for incoming D-Bus method calls: */
14525 /**
14526 * ControlBmc::handle-place-holder:
14527 * @object: A #ControlBmc.
14528 * @invocation: A #GDBusMethodInvocation.
14529 *
14530 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Bmc.place_holder">place_holder()</link> D-Bus method.
14531 *
14532 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call control_bmc_complete_place_holder() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
14533 *
14534 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
14535 */
14536 g_signal_new ("handle-place-holder",
14537 G_TYPE_FROM_INTERFACE (iface),
14538 G_SIGNAL_RUN_LAST,
14539 G_STRUCT_OFFSET (ControlBmcIface, handle_place_holder),
14540 g_signal_accumulator_true_handled,
14541 NULL,
14542 g_cclosure_marshal_generic,
14543 G_TYPE_BOOLEAN,
14544 1,
14545 G_TYPE_DBUS_METHOD_INVOCATION);
14546
14547}
14548
14549/**
14550 * control_bmc_call_place_holder:
14551 * @proxy: A #ControlBmcProxy.
14552 * @cancellable: (allow-none): A #GCancellable or %NULL.
14553 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
14554 * @user_data: User data to pass to @callback.
14555 *
14556 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Bmc.place_holder">place_holder()</link> D-Bus method on @proxy.
14557 * 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.
14558 * You can then call control_bmc_call_place_holder_finish() to get the result of the operation.
14559 *
14560 * See control_bmc_call_place_holder_sync() for the synchronous, blocking version of this method.
14561 */
14562void
14563control_bmc_call_place_holder (
14564 ControlBmc *proxy,
14565 GCancellable *cancellable,
14566 GAsyncReadyCallback callback,
14567 gpointer user_data)
14568{
14569 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
14570 "place_holder",
14571 g_variant_new ("()"),
14572 G_DBUS_CALL_FLAGS_NONE,
14573 -1,
14574 cancellable,
14575 callback,
14576 user_data);
14577}
14578
14579/**
14580 * control_bmc_call_place_holder_finish:
14581 * @proxy: A #ControlBmcProxy.
14582 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_bmc_call_place_holder().
14583 * @error: Return location for error or %NULL.
14584 *
14585 * Finishes an operation started with control_bmc_call_place_holder().
14586 *
14587 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
14588 */
14589gboolean
14590control_bmc_call_place_holder_finish (
14591 ControlBmc *proxy,
14592 GAsyncResult *res,
14593 GError **error)
14594{
14595 GVariant *_ret;
14596 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
14597 if (_ret == NULL)
14598 goto _out;
14599 g_variant_get (_ret,
14600 "()");
14601 g_variant_unref (_ret);
14602_out:
14603 return _ret != NULL;
14604}
14605
14606/**
14607 * control_bmc_call_place_holder_sync:
14608 * @proxy: A #ControlBmcProxy.
14609 * @cancellable: (allow-none): A #GCancellable or %NULL.
14610 * @error: Return location for error or %NULL.
14611 *
14612 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Bmc.place_holder">place_holder()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
14613 *
14614 * See control_bmc_call_place_holder() for the asynchronous version of this method.
14615 *
14616 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
14617 */
14618gboolean
14619control_bmc_call_place_holder_sync (
14620 ControlBmc *proxy,
14621 GCancellable *cancellable,
14622 GError **error)
14623{
14624 GVariant *_ret;
14625 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
14626 "place_holder",
14627 g_variant_new ("()"),
14628 G_DBUS_CALL_FLAGS_NONE,
14629 -1,
14630 cancellable,
14631 error);
14632 if (_ret == NULL)
14633 goto _out;
14634 g_variant_get (_ret,
14635 "()");
14636 g_variant_unref (_ret);
14637_out:
14638 return _ret != NULL;
14639}
14640
14641/**
14642 * control_bmc_complete_place_holder:
14643 * @object: A #ControlBmc.
14644 * @invocation: (transfer full): A #GDBusMethodInvocation.
14645 *
14646 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-control-Bmc.place_holder">place_holder()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
14647 *
14648 * This method will free @invocation, you cannot use it afterwards.
14649 */
14650void
14651control_bmc_complete_place_holder (
14652 ControlBmc *object,
14653 GDBusMethodInvocation *invocation)
14654{
14655 g_dbus_method_invocation_return_value (invocation,
14656 g_variant_new ("()"));
14657}
14658
14659/* ------------------------------------------------------------------------ */
14660
14661/**
14662 * ControlBmcProxy:
14663 *
14664 * The #ControlBmcProxy structure contains only private data and should only be accessed using the provided API.
14665 */
14666
14667/**
14668 * ControlBmcProxyClass:
14669 * @parent_class: The parent class.
14670 *
14671 * Class structure for #ControlBmcProxy.
14672 */
14673
14674struct _ControlBmcProxyPrivate
14675{
14676 GData *qdata;
14677};
14678
14679static void control_bmc_proxy_iface_init (ControlBmcIface *iface);
14680
14681#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
14682G_DEFINE_TYPE_WITH_CODE (ControlBmcProxy, control_bmc_proxy, G_TYPE_DBUS_PROXY,
14683 G_ADD_PRIVATE (ControlBmcProxy)
14684 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_BMC, control_bmc_proxy_iface_init));
14685
14686#else
14687G_DEFINE_TYPE_WITH_CODE (ControlBmcProxy, control_bmc_proxy, G_TYPE_DBUS_PROXY,
14688 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_BMC, control_bmc_proxy_iface_init));
14689
14690#endif
14691static void
14692control_bmc_proxy_finalize (GObject *object)
14693{
14694 ControlBmcProxy *proxy = CONTROL_BMC_PROXY (object);
14695 g_datalist_clear (&proxy->priv->qdata);
14696 G_OBJECT_CLASS (control_bmc_proxy_parent_class)->finalize (object);
14697}
14698
14699static void
14700control_bmc_proxy_get_property (GObject *object,
14701 guint prop_id,
14702 GValue *value,
14703 GParamSpec *pspec G_GNUC_UNUSED)
14704{
14705}
14706
14707static void
14708control_bmc_proxy_set_property (GObject *object,
14709 guint prop_id,
14710 const GValue *value,
14711 GParamSpec *pspec G_GNUC_UNUSED)
14712{
14713}
14714
14715static void
14716control_bmc_proxy_g_signal (GDBusProxy *proxy,
14717 const gchar *sender_name G_GNUC_UNUSED,
14718 const gchar *signal_name,
14719 GVariant *parameters)
14720{
14721 _ExtendedGDBusSignalInfo *info;
14722 GVariantIter iter;
14723 GVariant *child;
14724 GValue *paramv;
14725 guint num_params;
14726 guint n;
14727 guint signal_id;
14728 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, signal_name);
14729 if (info == NULL)
14730 return;
14731 num_params = g_variant_n_children (parameters);
14732 paramv = g_new0 (GValue, num_params + 1);
14733 g_value_init (&paramv[0], TYPE_CONTROL_BMC);
14734 g_value_set_object (&paramv[0], proxy);
14735 g_variant_iter_init (&iter, parameters);
14736 n = 1;
14737 while ((child = g_variant_iter_next_value (&iter)) != NULL)
14738 {
14739 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
14740 if (arg_info->use_gvariant)
14741 {
14742 g_value_init (&paramv[n], G_TYPE_VARIANT);
14743 g_value_set_variant (&paramv[n], child);
14744 n++;
14745 }
14746 else
14747 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
14748 g_variant_unref (child);
14749 }
14750 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_BMC);
14751 g_signal_emitv (paramv, signal_id, 0, NULL);
14752 for (n = 0; n < num_params + 1; n++)
14753 g_value_unset (&paramv[n]);
14754 g_free (paramv);
14755}
14756
14757static void
14758control_bmc_proxy_g_properties_changed (GDBusProxy *_proxy,
14759 GVariant *changed_properties,
14760 const gchar *const *invalidated_properties)
14761{
14762 ControlBmcProxy *proxy = CONTROL_BMC_PROXY (_proxy);
14763 guint n;
14764 const gchar *key;
14765 GVariantIter *iter;
14766 _ExtendedGDBusPropertyInfo *info;
14767 g_variant_get (changed_properties, "a{sv}", &iter);
14768 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
14769 {
14770 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, key);
14771 g_datalist_remove_data (&proxy->priv->qdata, key);
14772 if (info != NULL)
14773 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
14774 }
14775 g_variant_iter_free (iter);
14776 for (n = 0; invalidated_properties[n] != NULL; n++)
14777 {
14778 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, invalidated_properties[n]);
14779 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
14780 if (info != NULL)
14781 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
14782 }
14783}
14784
14785static void
14786control_bmc_proxy_init (ControlBmcProxy *proxy)
14787{
14788#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
14789 proxy->priv = control_bmc_proxy_get_instance_private (proxy);
14790#else
14791 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_BMC_PROXY, ControlBmcProxyPrivate);
14792#endif
14793
14794 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_bmc_interface_info ());
14795}
14796
14797static void
14798control_bmc_proxy_class_init (ControlBmcProxyClass *klass)
14799{
14800 GObjectClass *gobject_class;
14801 GDBusProxyClass *proxy_class;
14802
14803 gobject_class = G_OBJECT_CLASS (klass);
14804 gobject_class->finalize = control_bmc_proxy_finalize;
14805 gobject_class->get_property = control_bmc_proxy_get_property;
14806 gobject_class->set_property = control_bmc_proxy_set_property;
14807
14808 proxy_class = G_DBUS_PROXY_CLASS (klass);
14809 proxy_class->g_signal = control_bmc_proxy_g_signal;
14810 proxy_class->g_properties_changed = control_bmc_proxy_g_properties_changed;
14811
14812#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
14813 g_type_class_add_private (klass, sizeof (ControlBmcProxyPrivate));
14814#endif
14815}
14816
14817static void
14818control_bmc_proxy_iface_init (ControlBmcIface *iface)
14819{
14820}
14821
14822/**
14823 * control_bmc_proxy_new:
14824 * @connection: A #GDBusConnection.
14825 * @flags: Flags from the #GDBusProxyFlags enumeration.
14826 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
14827 * @object_path: An object path.
14828 * @cancellable: (allow-none): A #GCancellable or %NULL.
14829 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
14830 * @user_data: User data to pass to @callback.
14831 *
14832 * 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.
14833 *
14834 * 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.
14835 * You can then call control_bmc_proxy_new_finish() to get the result of the operation.
14836 *
14837 * See control_bmc_proxy_new_sync() for the synchronous, blocking version of this constructor.
14838 */
14839void
14840control_bmc_proxy_new (
14841 GDBusConnection *connection,
14842 GDBusProxyFlags flags,
14843 const gchar *name,
14844 const gchar *object_path,
14845 GCancellable *cancellable,
14846 GAsyncReadyCallback callback,
14847 gpointer user_data)
14848{
14849 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);
14850}
14851
14852/**
14853 * control_bmc_proxy_new_finish:
14854 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_bmc_proxy_new().
14855 * @error: Return location for error or %NULL
14856 *
14857 * Finishes an operation started with control_bmc_proxy_new().
14858 *
14859 * Returns: (transfer full) (type ControlBmcProxy): The constructed proxy object or %NULL if @error is set.
14860 */
14861ControlBmc *
14862control_bmc_proxy_new_finish (
14863 GAsyncResult *res,
14864 GError **error)
14865{
14866 GObject *ret;
14867 GObject *source_object;
14868 source_object = g_async_result_get_source_object (res);
14869 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
14870 g_object_unref (source_object);
14871 if (ret != NULL)
14872 return CONTROL_BMC (ret);
14873 else
14874 return NULL;
14875}
14876
14877/**
14878 * control_bmc_proxy_new_sync:
14879 * @connection: A #GDBusConnection.
14880 * @flags: Flags from the #GDBusProxyFlags enumeration.
14881 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
14882 * @object_path: An object path.
14883 * @cancellable: (allow-none): A #GCancellable or %NULL.
14884 * @error: Return location for error or %NULL
14885 *
14886 * 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.
14887 *
14888 * The calling thread is blocked until a reply is received.
14889 *
14890 * See control_bmc_proxy_new() for the asynchronous version of this constructor.
14891 *
14892 * Returns: (transfer full) (type ControlBmcProxy): The constructed proxy object or %NULL if @error is set.
14893 */
14894ControlBmc *
14895control_bmc_proxy_new_sync (
14896 GDBusConnection *connection,
14897 GDBusProxyFlags flags,
14898 const gchar *name,
14899 const gchar *object_path,
14900 GCancellable *cancellable,
14901 GError **error)
14902{
14903 GInitable *ret;
14904 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);
14905 if (ret != NULL)
14906 return CONTROL_BMC (ret);
14907 else
14908 return NULL;
14909}
14910
14911
14912/**
14913 * control_bmc_proxy_new_for_bus:
14914 * @bus_type: A #GBusType.
14915 * @flags: Flags from the #GDBusProxyFlags enumeration.
14916 * @name: A bus name (well-known or unique).
14917 * @object_path: An object path.
14918 * @cancellable: (allow-none): A #GCancellable or %NULL.
14919 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
14920 * @user_data: User data to pass to @callback.
14921 *
14922 * Like control_bmc_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
14923 *
14924 * 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.
14925 * You can then call control_bmc_proxy_new_for_bus_finish() to get the result of the operation.
14926 *
14927 * See control_bmc_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
14928 */
14929void
14930control_bmc_proxy_new_for_bus (
14931 GBusType bus_type,
14932 GDBusProxyFlags flags,
14933 const gchar *name,
14934 const gchar *object_path,
14935 GCancellable *cancellable,
14936 GAsyncReadyCallback callback,
14937 gpointer user_data)
14938{
14939 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);
14940}
14941
14942/**
14943 * control_bmc_proxy_new_for_bus_finish:
14944 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_bmc_proxy_new_for_bus().
14945 * @error: Return location for error or %NULL
14946 *
14947 * Finishes an operation started with control_bmc_proxy_new_for_bus().
14948 *
14949 * Returns: (transfer full) (type ControlBmcProxy): The constructed proxy object or %NULL if @error is set.
14950 */
14951ControlBmc *
14952control_bmc_proxy_new_for_bus_finish (
14953 GAsyncResult *res,
14954 GError **error)
14955{
14956 GObject *ret;
14957 GObject *source_object;
14958 source_object = g_async_result_get_source_object (res);
14959 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
14960 g_object_unref (source_object);
14961 if (ret != NULL)
14962 return CONTROL_BMC (ret);
14963 else
14964 return NULL;
14965}
14966
14967/**
14968 * control_bmc_proxy_new_for_bus_sync:
14969 * @bus_type: A #GBusType.
14970 * @flags: Flags from the #GDBusProxyFlags enumeration.
14971 * @name: A bus name (well-known or unique).
14972 * @object_path: An object path.
14973 * @cancellable: (allow-none): A #GCancellable or %NULL.
14974 * @error: Return location for error or %NULL
14975 *
14976 * Like control_bmc_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
14977 *
14978 * The calling thread is blocked until a reply is received.
14979 *
14980 * See control_bmc_proxy_new_for_bus() for the asynchronous version of this constructor.
14981 *
14982 * Returns: (transfer full) (type ControlBmcProxy): The constructed proxy object or %NULL if @error is set.
14983 */
14984ControlBmc *
14985control_bmc_proxy_new_for_bus_sync (
14986 GBusType bus_type,
14987 GDBusProxyFlags flags,
14988 const gchar *name,
14989 const gchar *object_path,
14990 GCancellable *cancellable,
14991 GError **error)
14992{
14993 GInitable *ret;
14994 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);
14995 if (ret != NULL)
14996 return CONTROL_BMC (ret);
14997 else
14998 return NULL;
14999}
15000
15001
15002/* ------------------------------------------------------------------------ */
15003
15004/**
15005 * ControlBmcSkeleton:
15006 *
15007 * The #ControlBmcSkeleton structure contains only private data and should only be accessed using the provided API.
15008 */
15009
15010/**
15011 * ControlBmcSkeletonClass:
15012 * @parent_class: The parent class.
15013 *
15014 * Class structure for #ControlBmcSkeleton.
15015 */
15016
15017struct _ControlBmcSkeletonPrivate
15018{
15019 GValue *properties;
15020 GList *changed_properties;
15021 GSource *changed_properties_idle_source;
15022 GMainContext *context;
15023 GMutex lock;
15024};
15025
15026static void
15027_control_bmc_skeleton_handle_method_call (
15028 GDBusConnection *connection G_GNUC_UNUSED,
15029 const gchar *sender G_GNUC_UNUSED,
15030 const gchar *object_path G_GNUC_UNUSED,
15031 const gchar *interface_name,
15032 const gchar *method_name,
15033 GVariant *parameters,
15034 GDBusMethodInvocation *invocation,
15035 gpointer user_data)
15036{
15037 ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (user_data);
15038 _ExtendedGDBusMethodInfo *info;
15039 GVariantIter iter;
15040 GVariant *child;
15041 GValue *paramv;
15042 guint num_params;
15043 guint num_extra;
15044 guint n;
15045 guint signal_id;
15046 GValue return_value = G_VALUE_INIT;
15047 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
15048 g_assert (info != NULL);
15049 num_params = g_variant_n_children (parameters);
15050 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
15051 n = 0;
15052 g_value_init (&paramv[n], TYPE_CONTROL_BMC);
15053 g_value_set_object (&paramv[n++], skeleton);
15054 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
15055 g_value_set_object (&paramv[n++], invocation);
15056 if (info->pass_fdlist)
15057 {
15058#ifdef G_OS_UNIX
15059 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
15060 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
15061#else
15062 g_assert_not_reached ();
15063#endif
15064 }
15065 g_variant_iter_init (&iter, parameters);
15066 while ((child = g_variant_iter_next_value (&iter)) != NULL)
15067 {
15068 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
15069 if (arg_info->use_gvariant)
15070 {
15071 g_value_init (&paramv[n], G_TYPE_VARIANT);
15072 g_value_set_variant (&paramv[n], child);
15073 n++;
15074 }
15075 else
15076 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
15077 g_variant_unref (child);
15078 }
15079 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_BMC);
15080 g_value_init (&return_value, G_TYPE_BOOLEAN);
15081 g_signal_emitv (paramv, signal_id, 0, &return_value);
15082 if (!g_value_get_boolean (&return_value))
15083 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);
15084 g_value_unset (&return_value);
15085 for (n = 0; n < num_params + num_extra; n++)
15086 g_value_unset (&paramv[n]);
15087 g_free (paramv);
15088}
15089
15090static GVariant *
15091_control_bmc_skeleton_handle_get_property (
15092 GDBusConnection *connection G_GNUC_UNUSED,
15093 const gchar *sender G_GNUC_UNUSED,
15094 const gchar *object_path G_GNUC_UNUSED,
15095 const gchar *interface_name G_GNUC_UNUSED,
15096 const gchar *property_name,
15097 GError **error,
15098 gpointer user_data)
15099{
15100 ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (user_data);
15101 GValue value = G_VALUE_INIT;
15102 GParamSpec *pspec;
15103 _ExtendedGDBusPropertyInfo *info;
15104 GVariant *ret;
15105 ret = NULL;
15106 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, property_name);
15107 g_assert (info != NULL);
15108 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
15109 if (pspec == NULL)
15110 {
15111 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
15112 }
15113 else
15114 {
15115 g_value_init (&value, pspec->value_type);
15116 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
15117 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
15118 g_value_unset (&value);
15119 }
15120 return ret;
15121}
15122
15123static gboolean
15124_control_bmc_skeleton_handle_set_property (
15125 GDBusConnection *connection G_GNUC_UNUSED,
15126 const gchar *sender G_GNUC_UNUSED,
15127 const gchar *object_path G_GNUC_UNUSED,
15128 const gchar *interface_name G_GNUC_UNUSED,
15129 const gchar *property_name,
15130 GVariant *variant,
15131 GError **error,
15132 gpointer user_data)
15133{
15134 ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (user_data);
15135 GValue value = G_VALUE_INIT;
15136 GParamSpec *pspec;
15137 _ExtendedGDBusPropertyInfo *info;
15138 gboolean ret;
15139 ret = FALSE;
15140 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, property_name);
15141 g_assert (info != NULL);
15142 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
15143 if (pspec == NULL)
15144 {
15145 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
15146 }
15147 else
15148 {
15149 if (info->use_gvariant)
15150 g_value_set_variant (&value, variant);
15151 else
15152 g_dbus_gvariant_to_gvalue (variant, &value);
15153 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
15154 g_value_unset (&value);
15155 ret = TRUE;
15156 }
15157 return ret;
15158}
15159
15160static const GDBusInterfaceVTable _control_bmc_skeleton_vtable =
15161{
15162 _control_bmc_skeleton_handle_method_call,
15163 _control_bmc_skeleton_handle_get_property,
15164 _control_bmc_skeleton_handle_set_property,
15165 {NULL}
15166};
15167
15168static GDBusInterfaceInfo *
15169control_bmc_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
15170{
15171 return control_bmc_interface_info ();
15172}
15173
15174static GDBusInterfaceVTable *
15175control_bmc_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
15176{
15177 return (GDBusInterfaceVTable *) &_control_bmc_skeleton_vtable;
15178}
15179
15180static GVariant *
15181control_bmc_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
15182{
15183 ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (_skeleton);
15184
15185 GVariantBuilder builder;
15186 guint n;
15187 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
15188 if (_control_bmc_interface_info.parent_struct.properties == NULL)
15189 goto out;
15190 for (n = 0; _control_bmc_interface_info.parent_struct.properties[n] != NULL; n++)
15191 {
15192 GDBusPropertyInfo *info = _control_bmc_interface_info.parent_struct.properties[n];
15193 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
15194 {
15195 GVariant *value;
15196 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);
15197 if (value != NULL)
15198 {
15199 g_variant_take_ref (value);
15200 g_variant_builder_add (&builder, "{sv}", info->name, value);
15201 g_variant_unref (value);
15202 }
15203 }
15204 }
15205out:
15206 return g_variant_builder_end (&builder);
15207}
15208
15209static void
15210control_bmc_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
15211{
15212}
15213
15214static void control_bmc_skeleton_iface_init (ControlBmcIface *iface);
15215#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
15216G_DEFINE_TYPE_WITH_CODE (ControlBmcSkeleton, control_bmc_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
15217 G_ADD_PRIVATE (ControlBmcSkeleton)
15218 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_BMC, control_bmc_skeleton_iface_init));
15219
15220#else
15221G_DEFINE_TYPE_WITH_CODE (ControlBmcSkeleton, control_bmc_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
15222 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_BMC, control_bmc_skeleton_iface_init));
15223
15224#endif
15225static void
15226control_bmc_skeleton_finalize (GObject *object)
15227{
15228 ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (object);
15229 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
15230 if (skeleton->priv->changed_properties_idle_source != NULL)
15231 g_source_destroy (skeleton->priv->changed_properties_idle_source);
15232 g_main_context_unref (skeleton->priv->context);
15233 g_mutex_clear (&skeleton->priv->lock);
15234 G_OBJECT_CLASS (control_bmc_skeleton_parent_class)->finalize (object);
15235}
15236
15237static void
15238control_bmc_skeleton_init (ControlBmcSkeleton *skeleton)
15239{
15240#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
15241 skeleton->priv = control_bmc_skeleton_get_instance_private (skeleton);
15242#else
15243 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_BMC_SKELETON, ControlBmcSkeletonPrivate);
15244#endif
15245
15246 g_mutex_init (&skeleton->priv->lock);
15247 skeleton->priv->context = g_main_context_ref_thread_default ();
15248}
15249
15250static void
15251control_bmc_skeleton_class_init (ControlBmcSkeletonClass *klass)
15252{
15253 GObjectClass *gobject_class;
15254 GDBusInterfaceSkeletonClass *skeleton_class;
15255
15256 gobject_class = G_OBJECT_CLASS (klass);
15257 gobject_class->finalize = control_bmc_skeleton_finalize;
15258
15259 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
15260 skeleton_class->get_info = control_bmc_skeleton_dbus_interface_get_info;
15261 skeleton_class->get_properties = control_bmc_skeleton_dbus_interface_get_properties;
15262 skeleton_class->flush = control_bmc_skeleton_dbus_interface_flush;
15263 skeleton_class->get_vtable = control_bmc_skeleton_dbus_interface_get_vtable;
15264
15265#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
15266 g_type_class_add_private (klass, sizeof (ControlBmcSkeletonPrivate));
15267#endif
15268}
15269
15270static void
15271control_bmc_skeleton_iface_init (ControlBmcIface *iface)
15272{
15273}
15274
15275/**
15276 * control_bmc_skeleton_new:
15277 *
15278 * 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>.
15279 *
15280 * Returns: (transfer full) (type ControlBmcSkeleton): The skeleton object.
15281 */
15282ControlBmc *
15283control_bmc_skeleton_new (void)
15284{
15285 return CONTROL_BMC (g_object_new (TYPE_CONTROL_BMC_SKELETON, NULL));
15286}
15287
15288/* ------------------------------------------------------------------------
15289 * Code for interface org.openbmc.control.Host
15290 * ------------------------------------------------------------------------
15291 */
15292
15293/**
15294 * SECTION:ControlHost
15295 * @title: ControlHost
15296 * @short_description: Generated C code for the org.openbmc.control.Host D-Bus interface
15297 *
15298 * 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.
15299 */
15300
15301/* ---- Introspection data for org.openbmc.control.Host ---- */
15302
15303static const _ExtendedGDBusMethodInfo _control_host_method_info_boot =
15304{
15305 {
15306 -1,
15307 (gchar *) "boot",
15308 NULL,
15309 NULL,
15310 NULL
15311 },
15312 "handle-boot",
15313 FALSE
15314};
15315
15316static const _ExtendedGDBusMethodInfo _control_host_method_info_shutdown =
15317{
15318 {
15319 -1,
15320 (gchar *) "shutdown",
15321 NULL,
15322 NULL,
15323 NULL
15324 },
15325 "handle-shutdown",
15326 FALSE
15327};
15328
15329static const _ExtendedGDBusMethodInfo _control_host_method_info_reboot =
15330{
15331 {
15332 -1,
15333 (gchar *) "reboot",
15334 NULL,
15335 NULL,
15336 NULL
15337 },
15338 "handle-reboot",
15339 FALSE
15340};
15341
15342static const _ExtendedGDBusMethodInfo * const _control_host_method_info_pointers[] =
15343{
15344 &_control_host_method_info_boot,
15345 &_control_host_method_info_shutdown,
15346 &_control_host_method_info_reboot,
15347 NULL
15348};
15349
15350static const _ExtendedGDBusSignalInfo _control_host_signal_info_booted =
15351{
15352 {
15353 -1,
15354 (gchar *) "Booted",
15355 NULL,
15356 NULL
15357 },
15358 "booted"
15359};
15360
15361static const _ExtendedGDBusSignalInfo * const _control_host_signal_info_pointers[] =
15362{
15363 &_control_host_signal_info_booted,
15364 NULL
15365};
15366
Norman James493996c2015-10-31 17:27:13 -050015367static const _ExtendedGDBusPropertyInfo _control_host_property_info_debug_mode =
15368{
15369 {
15370 -1,
15371 (gchar *) "debug_mode",
15372 (gchar *) "i",
15373 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
15374 NULL
15375 },
15376 "debug-mode",
15377 FALSE
15378};
15379
15380static const _ExtendedGDBusPropertyInfo _control_host_property_info_flash_side =
15381{
15382 {
15383 -1,
15384 (gchar *) "flash_side",
15385 (gchar *) "s",
15386 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
15387 NULL
15388 },
15389 "flash-side",
15390 FALSE
15391};
15392
15393static const _ExtendedGDBusPropertyInfo * const _control_host_property_info_pointers[] =
15394{
15395 &_control_host_property_info_debug_mode,
15396 &_control_host_property_info_flash_side,
15397 NULL
15398};
15399
Norman James362a80f2015-09-14 14:04:39 -050015400static const _ExtendedGDBusInterfaceInfo _control_host_interface_info =
15401{
15402 {
15403 -1,
15404 (gchar *) "org.openbmc.control.Host",
15405 (GDBusMethodInfo **) &_control_host_method_info_pointers,
15406 (GDBusSignalInfo **) &_control_host_signal_info_pointers,
Norman James493996c2015-10-31 17:27:13 -050015407 (GDBusPropertyInfo **) &_control_host_property_info_pointers,
Norman James362a80f2015-09-14 14:04:39 -050015408 NULL
15409 },
15410 "control-host",
15411};
15412
15413
15414/**
15415 * control_host_interface_info:
15416 *
15417 * 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.
15418 *
15419 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
15420 */
15421GDBusInterfaceInfo *
15422control_host_interface_info (void)
15423{
15424 return (GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct;
15425}
15426
15427/**
15428 * control_host_override_properties:
15429 * @klass: The class structure for a #GObject<!-- -->-derived class.
15430 * @property_id_begin: The property id to assign to the first overridden property.
15431 *
15432 * Overrides all #GObject properties in the #ControlHost interface for a concrete class.
15433 * The properties are overridden in the order they are defined.
15434 *
15435 * Returns: The last property id.
15436 */
15437guint
15438control_host_override_properties (GObjectClass *klass, guint property_id_begin)
15439{
Norman James493996c2015-10-31 17:27:13 -050015440 g_object_class_override_property (klass, property_id_begin++, "debug-mode");
15441 g_object_class_override_property (klass, property_id_begin++, "flash-side");
Norman James362a80f2015-09-14 14:04:39 -050015442 return property_id_begin - 1;
15443}
15444
15445
15446
15447/**
15448 * ControlHost:
15449 *
15450 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link>.
15451 */
15452
15453/**
15454 * ControlHostIface:
15455 * @parent_iface: The parent interface.
15456 * @handle_boot: Handler for the #ControlHost::handle-boot signal.
15457 * @handle_reboot: Handler for the #ControlHost::handle-reboot signal.
15458 * @handle_shutdown: Handler for the #ControlHost::handle-shutdown signal.
Norman James493996c2015-10-31 17:27:13 -050015459 * @get_debug_mode: Getter for the #ControlHost:debug-mode property.
15460 * @get_flash_side: Getter for the #ControlHost:flash-side property.
Norman James362a80f2015-09-14 14:04:39 -050015461 * @booted: Handler for the #ControlHost::booted signal.
15462 *
15463 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link>.
15464 */
15465
15466typedef ControlHostIface ControlHostInterface;
15467G_DEFINE_INTERFACE (ControlHost, control_host, G_TYPE_OBJECT);
15468
15469static void
15470control_host_default_init (ControlHostIface *iface)
15471{
15472 /* GObject signals for incoming D-Bus method calls: */
15473 /**
15474 * ControlHost::handle-boot:
15475 * @object: A #ControlHost.
15476 * @invocation: A #GDBusMethodInvocation.
15477 *
15478 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Host.boot">boot()</link> D-Bus method.
15479 *
15480 * 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.
15481 *
15482 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
15483 */
15484 g_signal_new ("handle-boot",
15485 G_TYPE_FROM_INTERFACE (iface),
15486 G_SIGNAL_RUN_LAST,
15487 G_STRUCT_OFFSET (ControlHostIface, handle_boot),
15488 g_signal_accumulator_true_handled,
15489 NULL,
15490 g_cclosure_marshal_generic,
15491 G_TYPE_BOOLEAN,
15492 1,
15493 G_TYPE_DBUS_METHOD_INVOCATION);
15494
15495 /**
15496 * ControlHost::handle-shutdown:
15497 * @object: A #ControlHost.
15498 * @invocation: A #GDBusMethodInvocation.
15499 *
15500 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Host.shutdown">shutdown()</link> D-Bus method.
15501 *
15502 * 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.
15503 *
15504 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
15505 */
15506 g_signal_new ("handle-shutdown",
15507 G_TYPE_FROM_INTERFACE (iface),
15508 G_SIGNAL_RUN_LAST,
15509 G_STRUCT_OFFSET (ControlHostIface, handle_shutdown),
15510 g_signal_accumulator_true_handled,
15511 NULL,
15512 g_cclosure_marshal_generic,
15513 G_TYPE_BOOLEAN,
15514 1,
15515 G_TYPE_DBUS_METHOD_INVOCATION);
15516
15517 /**
15518 * ControlHost::handle-reboot:
15519 * @object: A #ControlHost.
15520 * @invocation: A #GDBusMethodInvocation.
15521 *
15522 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Host.reboot">reboot()</link> D-Bus method.
15523 *
15524 * 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.
15525 *
15526 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
15527 */
15528 g_signal_new ("handle-reboot",
15529 G_TYPE_FROM_INTERFACE (iface),
15530 G_SIGNAL_RUN_LAST,
15531 G_STRUCT_OFFSET (ControlHostIface, handle_reboot),
15532 g_signal_accumulator_true_handled,
15533 NULL,
15534 g_cclosure_marshal_generic,
15535 G_TYPE_BOOLEAN,
15536 1,
15537 G_TYPE_DBUS_METHOD_INVOCATION);
15538
15539 /* GObject signals for received D-Bus signals: */
15540 /**
15541 * ControlHost::booted:
15542 * @object: A #ControlHost.
15543 *
15544 * 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.
15545 *
15546 * 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.
15547 */
15548 g_signal_new ("booted",
15549 G_TYPE_FROM_INTERFACE (iface),
15550 G_SIGNAL_RUN_LAST,
15551 G_STRUCT_OFFSET (ControlHostIface, booted),
15552 NULL,
15553 NULL,
15554 g_cclosure_marshal_generic,
15555 G_TYPE_NONE,
15556 0);
15557
Norman James493996c2015-10-31 17:27:13 -050015558 /* GObject properties for D-Bus properties: */
15559 /**
15560 * ControlHost:debug-mode:
15561 *
15562 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-control-Host.debug_mode">"debug_mode"</link>.
15563 *
15564 * 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.
15565 */
15566 g_object_interface_install_property (iface,
15567 g_param_spec_int ("debug-mode", "debug_mode", "debug_mode", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
15568 /**
15569 * ControlHost:flash-side:
15570 *
15571 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-control-Host.flash_side">"flash_side"</link>.
15572 *
15573 * 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.
15574 */
15575 g_object_interface_install_property (iface,
15576 g_param_spec_string ("flash-side", "flash_side", "flash_side", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
15577}
15578
15579/**
15580 * control_host_get_debug_mode: (skip)
15581 * @object: A #ControlHost.
15582 *
15583 * Gets the value of the <link linkend="gdbus-property-org-openbmc-control-Host.debug_mode">"debug_mode"</link> D-Bus property.
15584 *
15585 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
15586 *
15587 * Returns: The property value.
15588 */
15589gint
15590control_host_get_debug_mode (ControlHost *object)
15591{
15592 return CONTROL_HOST_GET_IFACE (object)->get_debug_mode (object);
15593}
15594
15595/**
15596 * control_host_set_debug_mode: (skip)
15597 * @object: A #ControlHost.
15598 * @value: The value to set.
15599 *
15600 * Sets the <link linkend="gdbus-property-org-openbmc-control-Host.debug_mode">"debug_mode"</link> D-Bus property to @value.
15601 *
15602 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
15603 */
15604void
15605control_host_set_debug_mode (ControlHost *object, gint value)
15606{
15607 g_object_set (G_OBJECT (object), "debug-mode", value, NULL);
15608}
15609
15610/**
15611 * control_host_get_flash_side: (skip)
15612 * @object: A #ControlHost.
15613 *
15614 * Gets the value of the <link linkend="gdbus-property-org-openbmc-control-Host.flash_side">"flash_side"</link> D-Bus property.
15615 *
15616 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
15617 *
15618 * <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>
15619 *
15620 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
15621 */
15622const gchar *
15623control_host_get_flash_side (ControlHost *object)
15624{
15625 return CONTROL_HOST_GET_IFACE (object)->get_flash_side (object);
15626}
15627
15628/**
15629 * control_host_dup_flash_side: (skip)
15630 * @object: A #ControlHost.
15631 *
15632 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-control-Host.flash_side">"flash_side"</link> D-Bus property.
15633 *
15634 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
15635 *
15636 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
15637 */
15638gchar *
15639control_host_dup_flash_side (ControlHost *object)
15640{
15641 gchar *value;
15642 g_object_get (G_OBJECT (object), "flash-side", &value, NULL);
15643 return value;
15644}
15645
15646/**
15647 * control_host_set_flash_side: (skip)
15648 * @object: A #ControlHost.
15649 * @value: The value to set.
15650 *
15651 * Sets the <link linkend="gdbus-property-org-openbmc-control-Host.flash_side">"flash_side"</link> D-Bus property to @value.
15652 *
15653 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
15654 */
15655void
15656control_host_set_flash_side (ControlHost *object, const gchar *value)
15657{
15658 g_object_set (G_OBJECT (object), "flash-side", value, NULL);
Norman James362a80f2015-09-14 14:04:39 -050015659}
15660
15661/**
15662 * control_host_emit_booted:
15663 * @object: A #ControlHost.
15664 *
15665 * Emits the <link linkend="gdbus-signal-org-openbmc-control-Host.Booted">"Booted"</link> D-Bus signal.
15666 */
15667void
15668control_host_emit_booted (
15669 ControlHost *object)
15670{
15671 g_signal_emit_by_name (object, "booted");
15672}
15673
15674/**
15675 * control_host_call_boot:
15676 * @proxy: A #ControlHostProxy.
15677 * @cancellable: (allow-none): A #GCancellable or %NULL.
15678 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
15679 * @user_data: User data to pass to @callback.
15680 *
15681 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Host.boot">boot()</link> D-Bus method on @proxy.
15682 * 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.
15683 * You can then call control_host_call_boot_finish() to get the result of the operation.
15684 *
15685 * See control_host_call_boot_sync() for the synchronous, blocking version of this method.
15686 */
15687void
15688control_host_call_boot (
15689 ControlHost *proxy,
15690 GCancellable *cancellable,
15691 GAsyncReadyCallback callback,
15692 gpointer user_data)
15693{
15694 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
15695 "boot",
15696 g_variant_new ("()"),
15697 G_DBUS_CALL_FLAGS_NONE,
15698 -1,
15699 cancellable,
15700 callback,
15701 user_data);
15702}
15703
15704/**
15705 * control_host_call_boot_finish:
15706 * @proxy: A #ControlHostProxy.
15707 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_call_boot().
15708 * @error: Return location for error or %NULL.
15709 *
15710 * Finishes an operation started with control_host_call_boot().
15711 *
15712 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
15713 */
15714gboolean
15715control_host_call_boot_finish (
15716 ControlHost *proxy,
15717 GAsyncResult *res,
15718 GError **error)
15719{
15720 GVariant *_ret;
15721 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
15722 if (_ret == NULL)
15723 goto _out;
15724 g_variant_get (_ret,
15725 "()");
15726 g_variant_unref (_ret);
15727_out:
15728 return _ret != NULL;
15729}
15730
15731/**
15732 * control_host_call_boot_sync:
15733 * @proxy: A #ControlHostProxy.
15734 * @cancellable: (allow-none): A #GCancellable or %NULL.
15735 * @error: Return location for error or %NULL.
15736 *
15737 * 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.
15738 *
15739 * See control_host_call_boot() for the asynchronous version of this method.
15740 *
15741 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
15742 */
15743gboolean
15744control_host_call_boot_sync (
15745 ControlHost *proxy,
15746 GCancellable *cancellable,
15747 GError **error)
15748{
15749 GVariant *_ret;
15750 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
15751 "boot",
15752 g_variant_new ("()"),
15753 G_DBUS_CALL_FLAGS_NONE,
15754 -1,
15755 cancellable,
15756 error);
15757 if (_ret == NULL)
15758 goto _out;
15759 g_variant_get (_ret,
15760 "()");
15761 g_variant_unref (_ret);
15762_out:
15763 return _ret != NULL;
15764}
15765
15766/**
15767 * control_host_call_shutdown:
15768 * @proxy: A #ControlHostProxy.
15769 * @cancellable: (allow-none): A #GCancellable or %NULL.
15770 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
15771 * @user_data: User data to pass to @callback.
15772 *
15773 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Host.shutdown">shutdown()</link> D-Bus method on @proxy.
15774 * 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.
15775 * You can then call control_host_call_shutdown_finish() to get the result of the operation.
15776 *
15777 * See control_host_call_shutdown_sync() for the synchronous, blocking version of this method.
15778 */
15779void
15780control_host_call_shutdown (
15781 ControlHost *proxy,
15782 GCancellable *cancellable,
15783 GAsyncReadyCallback callback,
15784 gpointer user_data)
15785{
15786 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
15787 "shutdown",
15788 g_variant_new ("()"),
15789 G_DBUS_CALL_FLAGS_NONE,
15790 -1,
15791 cancellable,
15792 callback,
15793 user_data);
15794}
15795
15796/**
15797 * control_host_call_shutdown_finish:
15798 * @proxy: A #ControlHostProxy.
15799 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_call_shutdown().
15800 * @error: Return location for error or %NULL.
15801 *
15802 * Finishes an operation started with control_host_call_shutdown().
15803 *
15804 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
15805 */
15806gboolean
15807control_host_call_shutdown_finish (
15808 ControlHost *proxy,
15809 GAsyncResult *res,
15810 GError **error)
15811{
15812 GVariant *_ret;
15813 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
15814 if (_ret == NULL)
15815 goto _out;
15816 g_variant_get (_ret,
15817 "()");
15818 g_variant_unref (_ret);
15819_out:
15820 return _ret != NULL;
15821}
15822
15823/**
15824 * control_host_call_shutdown_sync:
15825 * @proxy: A #ControlHostProxy.
15826 * @cancellable: (allow-none): A #GCancellable or %NULL.
15827 * @error: Return location for error or %NULL.
15828 *
15829 * 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.
15830 *
15831 * See control_host_call_shutdown() for the asynchronous version of this method.
15832 *
15833 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
15834 */
15835gboolean
15836control_host_call_shutdown_sync (
15837 ControlHost *proxy,
15838 GCancellable *cancellable,
15839 GError **error)
15840{
15841 GVariant *_ret;
15842 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
15843 "shutdown",
15844 g_variant_new ("()"),
15845 G_DBUS_CALL_FLAGS_NONE,
15846 -1,
15847 cancellable,
15848 error);
15849 if (_ret == NULL)
15850 goto _out;
15851 g_variant_get (_ret,
15852 "()");
15853 g_variant_unref (_ret);
15854_out:
15855 return _ret != NULL;
15856}
15857
15858/**
15859 * control_host_call_reboot:
15860 * @proxy: A #ControlHostProxy.
15861 * @cancellable: (allow-none): A #GCancellable or %NULL.
15862 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
15863 * @user_data: User data to pass to @callback.
15864 *
15865 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Host.reboot">reboot()</link> D-Bus method on @proxy.
15866 * 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.
15867 * You can then call control_host_call_reboot_finish() to get the result of the operation.
15868 *
15869 * See control_host_call_reboot_sync() for the synchronous, blocking version of this method.
15870 */
15871void
15872control_host_call_reboot (
15873 ControlHost *proxy,
15874 GCancellable *cancellable,
15875 GAsyncReadyCallback callback,
15876 gpointer user_data)
15877{
15878 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
15879 "reboot",
15880 g_variant_new ("()"),
15881 G_DBUS_CALL_FLAGS_NONE,
15882 -1,
15883 cancellable,
15884 callback,
15885 user_data);
15886}
15887
15888/**
15889 * control_host_call_reboot_finish:
15890 * @proxy: A #ControlHostProxy.
15891 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_call_reboot().
15892 * @error: Return location for error or %NULL.
15893 *
15894 * Finishes an operation started with control_host_call_reboot().
15895 *
15896 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
15897 */
15898gboolean
15899control_host_call_reboot_finish (
15900 ControlHost *proxy,
15901 GAsyncResult *res,
15902 GError **error)
15903{
15904 GVariant *_ret;
15905 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
15906 if (_ret == NULL)
15907 goto _out;
15908 g_variant_get (_ret,
15909 "()");
15910 g_variant_unref (_ret);
15911_out:
15912 return _ret != NULL;
15913}
15914
15915/**
15916 * control_host_call_reboot_sync:
15917 * @proxy: A #ControlHostProxy.
15918 * @cancellable: (allow-none): A #GCancellable or %NULL.
15919 * @error: Return location for error or %NULL.
15920 *
15921 * 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.
15922 *
15923 * See control_host_call_reboot() for the asynchronous version of this method.
15924 *
15925 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
15926 */
15927gboolean
15928control_host_call_reboot_sync (
15929 ControlHost *proxy,
15930 GCancellable *cancellable,
15931 GError **error)
15932{
15933 GVariant *_ret;
15934 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
15935 "reboot",
15936 g_variant_new ("()"),
15937 G_DBUS_CALL_FLAGS_NONE,
15938 -1,
15939 cancellable,
15940 error);
15941 if (_ret == NULL)
15942 goto _out;
15943 g_variant_get (_ret,
15944 "()");
15945 g_variant_unref (_ret);
15946_out:
15947 return _ret != NULL;
15948}
15949
15950/**
15951 * control_host_complete_boot:
15952 * @object: A #ControlHost.
15953 * @invocation: (transfer full): A #GDBusMethodInvocation.
15954 *
15955 * 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.
15956 *
15957 * This method will free @invocation, you cannot use it afterwards.
15958 */
15959void
15960control_host_complete_boot (
15961 ControlHost *object,
15962 GDBusMethodInvocation *invocation)
15963{
15964 g_dbus_method_invocation_return_value (invocation,
15965 g_variant_new ("()"));
15966}
15967
15968/**
15969 * control_host_complete_shutdown:
15970 * @object: A #ControlHost.
15971 * @invocation: (transfer full): A #GDBusMethodInvocation.
15972 *
15973 * 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.
15974 *
15975 * This method will free @invocation, you cannot use it afterwards.
15976 */
15977void
15978control_host_complete_shutdown (
15979 ControlHost *object,
15980 GDBusMethodInvocation *invocation)
15981{
15982 g_dbus_method_invocation_return_value (invocation,
15983 g_variant_new ("()"));
15984}
15985
15986/**
15987 * control_host_complete_reboot:
15988 * @object: A #ControlHost.
15989 * @invocation: (transfer full): A #GDBusMethodInvocation.
15990 *
15991 * 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.
15992 *
15993 * This method will free @invocation, you cannot use it afterwards.
15994 */
15995void
15996control_host_complete_reboot (
15997 ControlHost *object,
15998 GDBusMethodInvocation *invocation)
15999{
16000 g_dbus_method_invocation_return_value (invocation,
16001 g_variant_new ("()"));
16002}
16003
16004/* ------------------------------------------------------------------------ */
16005
16006/**
16007 * ControlHostProxy:
16008 *
16009 * The #ControlHostProxy structure contains only private data and should only be accessed using the provided API.
16010 */
16011
16012/**
16013 * ControlHostProxyClass:
16014 * @parent_class: The parent class.
16015 *
16016 * Class structure for #ControlHostProxy.
16017 */
16018
16019struct _ControlHostProxyPrivate
16020{
16021 GData *qdata;
16022};
16023
16024static void control_host_proxy_iface_init (ControlHostIface *iface);
16025
16026#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
16027G_DEFINE_TYPE_WITH_CODE (ControlHostProxy, control_host_proxy, G_TYPE_DBUS_PROXY,
16028 G_ADD_PRIVATE (ControlHostProxy)
16029 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_proxy_iface_init));
16030
16031#else
16032G_DEFINE_TYPE_WITH_CODE (ControlHostProxy, control_host_proxy, G_TYPE_DBUS_PROXY,
16033 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_proxy_iface_init));
16034
16035#endif
16036static void
16037control_host_proxy_finalize (GObject *object)
16038{
16039 ControlHostProxy *proxy = CONTROL_HOST_PROXY (object);
16040 g_datalist_clear (&proxy->priv->qdata);
16041 G_OBJECT_CLASS (control_host_proxy_parent_class)->finalize (object);
16042}
16043
16044static void
16045control_host_proxy_get_property (GObject *object,
16046 guint prop_id,
16047 GValue *value,
16048 GParamSpec *pspec G_GNUC_UNUSED)
16049{
Norman James493996c2015-10-31 17:27:13 -050016050 const _ExtendedGDBusPropertyInfo *info;
16051 GVariant *variant;
16052 g_assert (prop_id != 0 && prop_id - 1 < 2);
16053 info = _control_host_property_info_pointers[prop_id - 1];
16054 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
16055 if (info->use_gvariant)
16056 {
16057 g_value_set_variant (value, variant);
16058 }
16059 else
16060 {
16061 if (variant != NULL)
16062 g_dbus_gvariant_to_gvalue (variant, value);
16063 }
16064 if (variant != NULL)
16065 g_variant_unref (variant);
16066}
16067
16068static void
16069control_host_proxy_set_property_cb (GDBusProxy *proxy,
16070 GAsyncResult *res,
16071 gpointer user_data)
16072{
16073 const _ExtendedGDBusPropertyInfo *info = user_data;
16074 GError *error;
16075 GVariant *_ret;
16076 error = NULL;
16077 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
16078 if (!_ret)
16079 {
16080 g_warning ("Error setting property '%s' on interface org.openbmc.control.Host: %s (%s, %d)",
16081 info->parent_struct.name,
16082 error->message, g_quark_to_string (error->domain), error->code);
16083 g_error_free (error);
16084 }
16085 else
16086 {
16087 g_variant_unref (_ret);
16088 }
Norman James362a80f2015-09-14 14:04:39 -050016089}
16090
16091static void
16092control_host_proxy_set_property (GObject *object,
16093 guint prop_id,
16094 const GValue *value,
16095 GParamSpec *pspec G_GNUC_UNUSED)
16096{
Norman James493996c2015-10-31 17:27:13 -050016097 const _ExtendedGDBusPropertyInfo *info;
16098 GVariant *variant;
16099 g_assert (prop_id != 0 && prop_id - 1 < 2);
16100 info = _control_host_property_info_pointers[prop_id - 1];
16101 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
16102 g_dbus_proxy_call (G_DBUS_PROXY (object),
16103 "org.freedesktop.DBus.Properties.Set",
16104 g_variant_new ("(ssv)", "org.openbmc.control.Host", info->parent_struct.name, variant),
16105 G_DBUS_CALL_FLAGS_NONE,
16106 -1,
16107 NULL, (GAsyncReadyCallback) control_host_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
16108 g_variant_unref (variant);
Norman James362a80f2015-09-14 14:04:39 -050016109}
16110
16111static void
16112control_host_proxy_g_signal (GDBusProxy *proxy,
16113 const gchar *sender_name G_GNUC_UNUSED,
16114 const gchar *signal_name,
16115 GVariant *parameters)
16116{
16117 _ExtendedGDBusSignalInfo *info;
16118 GVariantIter iter;
16119 GVariant *child;
16120 GValue *paramv;
16121 guint num_params;
16122 guint n;
16123 guint signal_id;
16124 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, signal_name);
16125 if (info == NULL)
16126 return;
16127 num_params = g_variant_n_children (parameters);
16128 paramv = g_new0 (GValue, num_params + 1);
16129 g_value_init (&paramv[0], TYPE_CONTROL_HOST);
16130 g_value_set_object (&paramv[0], proxy);
16131 g_variant_iter_init (&iter, parameters);
16132 n = 1;
16133 while ((child = g_variant_iter_next_value (&iter)) != NULL)
16134 {
16135 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
16136 if (arg_info->use_gvariant)
16137 {
16138 g_value_init (&paramv[n], G_TYPE_VARIANT);
16139 g_value_set_variant (&paramv[n], child);
16140 n++;
16141 }
16142 else
16143 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
16144 g_variant_unref (child);
16145 }
16146 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_HOST);
16147 g_signal_emitv (paramv, signal_id, 0, NULL);
16148 for (n = 0; n < num_params + 1; n++)
16149 g_value_unset (&paramv[n]);
16150 g_free (paramv);
16151}
16152
16153static void
16154control_host_proxy_g_properties_changed (GDBusProxy *_proxy,
16155 GVariant *changed_properties,
16156 const gchar *const *invalidated_properties)
16157{
16158 ControlHostProxy *proxy = CONTROL_HOST_PROXY (_proxy);
16159 guint n;
16160 const gchar *key;
16161 GVariantIter *iter;
16162 _ExtendedGDBusPropertyInfo *info;
16163 g_variant_get (changed_properties, "a{sv}", &iter);
16164 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
16165 {
16166 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, key);
16167 g_datalist_remove_data (&proxy->priv->qdata, key);
16168 if (info != NULL)
16169 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
16170 }
16171 g_variant_iter_free (iter);
16172 for (n = 0; invalidated_properties[n] != NULL; n++)
16173 {
16174 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, invalidated_properties[n]);
16175 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
16176 if (info != NULL)
16177 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
16178 }
16179}
16180
Norman James493996c2015-10-31 17:27:13 -050016181static gint
16182control_host_proxy_get_debug_mode (ControlHost *object)
16183{
16184 ControlHostProxy *proxy = CONTROL_HOST_PROXY (object);
16185 GVariant *variant;
16186 gint value = 0;
16187 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "debug_mode");
16188 if (variant != NULL)
16189 {
16190 value = g_variant_get_int32 (variant);
16191 g_variant_unref (variant);
16192 }
16193 return value;
16194}
16195
16196static const gchar *
16197control_host_proxy_get_flash_side (ControlHost *object)
16198{
16199 ControlHostProxy *proxy = CONTROL_HOST_PROXY (object);
16200 GVariant *variant;
16201 const gchar *value = NULL;
16202 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "flash_side");
16203 if (variant != NULL)
16204 {
16205 value = g_variant_get_string (variant, NULL);
16206 g_variant_unref (variant);
16207 }
16208 return value;
16209}
16210
Norman James362a80f2015-09-14 14:04:39 -050016211static void
16212control_host_proxy_init (ControlHostProxy *proxy)
16213{
16214#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
16215 proxy->priv = control_host_proxy_get_instance_private (proxy);
16216#else
16217 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_HOST_PROXY, ControlHostProxyPrivate);
16218#endif
16219
16220 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_host_interface_info ());
16221}
16222
16223static void
16224control_host_proxy_class_init (ControlHostProxyClass *klass)
16225{
16226 GObjectClass *gobject_class;
16227 GDBusProxyClass *proxy_class;
16228
16229 gobject_class = G_OBJECT_CLASS (klass);
16230 gobject_class->finalize = control_host_proxy_finalize;
16231 gobject_class->get_property = control_host_proxy_get_property;
16232 gobject_class->set_property = control_host_proxy_set_property;
16233
16234 proxy_class = G_DBUS_PROXY_CLASS (klass);
16235 proxy_class->g_signal = control_host_proxy_g_signal;
16236 proxy_class->g_properties_changed = control_host_proxy_g_properties_changed;
16237
Norman James493996c2015-10-31 17:27:13 -050016238 control_host_override_properties (gobject_class, 1);
16239
Norman James362a80f2015-09-14 14:04:39 -050016240#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
16241 g_type_class_add_private (klass, sizeof (ControlHostProxyPrivate));
16242#endif
16243}
16244
16245static void
16246control_host_proxy_iface_init (ControlHostIface *iface)
16247{
Norman James493996c2015-10-31 17:27:13 -050016248 iface->get_debug_mode = control_host_proxy_get_debug_mode;
16249 iface->get_flash_side = control_host_proxy_get_flash_side;
Norman James362a80f2015-09-14 14:04:39 -050016250}
16251
16252/**
16253 * control_host_proxy_new:
16254 * @connection: A #GDBusConnection.
16255 * @flags: Flags from the #GDBusProxyFlags enumeration.
16256 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
16257 * @object_path: An object path.
16258 * @cancellable: (allow-none): A #GCancellable or %NULL.
16259 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
16260 * @user_data: User data to pass to @callback.
16261 *
16262 * 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.
16263 *
16264 * 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.
16265 * You can then call control_host_proxy_new_finish() to get the result of the operation.
16266 *
16267 * See control_host_proxy_new_sync() for the synchronous, blocking version of this constructor.
16268 */
16269void
16270control_host_proxy_new (
16271 GDBusConnection *connection,
16272 GDBusProxyFlags flags,
16273 const gchar *name,
16274 const gchar *object_path,
16275 GCancellable *cancellable,
16276 GAsyncReadyCallback callback,
16277 gpointer user_data)
16278{
16279 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);
16280}
16281
16282/**
16283 * control_host_proxy_new_finish:
16284 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_proxy_new().
16285 * @error: Return location for error or %NULL
16286 *
16287 * Finishes an operation started with control_host_proxy_new().
16288 *
16289 * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set.
16290 */
16291ControlHost *
16292control_host_proxy_new_finish (
16293 GAsyncResult *res,
16294 GError **error)
16295{
16296 GObject *ret;
16297 GObject *source_object;
16298 source_object = g_async_result_get_source_object (res);
16299 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
16300 g_object_unref (source_object);
16301 if (ret != NULL)
16302 return CONTROL_HOST (ret);
16303 else
16304 return NULL;
16305}
16306
16307/**
16308 * control_host_proxy_new_sync:
16309 * @connection: A #GDBusConnection.
16310 * @flags: Flags from the #GDBusProxyFlags enumeration.
16311 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
16312 * @object_path: An object path.
16313 * @cancellable: (allow-none): A #GCancellable or %NULL.
16314 * @error: Return location for error or %NULL
16315 *
16316 * 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.
16317 *
16318 * The calling thread is blocked until a reply is received.
16319 *
16320 * See control_host_proxy_new() for the asynchronous version of this constructor.
16321 *
16322 * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set.
16323 */
16324ControlHost *
16325control_host_proxy_new_sync (
16326 GDBusConnection *connection,
16327 GDBusProxyFlags flags,
16328 const gchar *name,
16329 const gchar *object_path,
16330 GCancellable *cancellable,
16331 GError **error)
16332{
16333 GInitable *ret;
16334 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);
16335 if (ret != NULL)
16336 return CONTROL_HOST (ret);
16337 else
16338 return NULL;
16339}
16340
16341
16342/**
16343 * control_host_proxy_new_for_bus:
16344 * @bus_type: A #GBusType.
16345 * @flags: Flags from the #GDBusProxyFlags enumeration.
16346 * @name: A bus name (well-known or unique).
16347 * @object_path: An object path.
16348 * @cancellable: (allow-none): A #GCancellable or %NULL.
16349 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
16350 * @user_data: User data to pass to @callback.
16351 *
16352 * Like control_host_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
16353 *
16354 * 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.
16355 * You can then call control_host_proxy_new_for_bus_finish() to get the result of the operation.
16356 *
16357 * See control_host_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
16358 */
16359void
16360control_host_proxy_new_for_bus (
16361 GBusType bus_type,
16362 GDBusProxyFlags flags,
16363 const gchar *name,
16364 const gchar *object_path,
16365 GCancellable *cancellable,
16366 GAsyncReadyCallback callback,
16367 gpointer user_data)
16368{
16369 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);
16370}
16371
16372/**
16373 * control_host_proxy_new_for_bus_finish:
16374 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_proxy_new_for_bus().
16375 * @error: Return location for error or %NULL
16376 *
16377 * Finishes an operation started with control_host_proxy_new_for_bus().
16378 *
16379 * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set.
16380 */
16381ControlHost *
16382control_host_proxy_new_for_bus_finish (
16383 GAsyncResult *res,
16384 GError **error)
16385{
16386 GObject *ret;
16387 GObject *source_object;
16388 source_object = g_async_result_get_source_object (res);
16389 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
16390 g_object_unref (source_object);
16391 if (ret != NULL)
16392 return CONTROL_HOST (ret);
16393 else
16394 return NULL;
16395}
16396
16397/**
16398 * control_host_proxy_new_for_bus_sync:
16399 * @bus_type: A #GBusType.
16400 * @flags: Flags from the #GDBusProxyFlags enumeration.
16401 * @name: A bus name (well-known or unique).
16402 * @object_path: An object path.
16403 * @cancellable: (allow-none): A #GCancellable or %NULL.
16404 * @error: Return location for error or %NULL
16405 *
16406 * Like control_host_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
16407 *
16408 * The calling thread is blocked until a reply is received.
16409 *
16410 * See control_host_proxy_new_for_bus() for the asynchronous version of this constructor.
16411 *
16412 * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set.
16413 */
16414ControlHost *
16415control_host_proxy_new_for_bus_sync (
16416 GBusType bus_type,
16417 GDBusProxyFlags flags,
16418 const gchar *name,
16419 const gchar *object_path,
16420 GCancellable *cancellable,
16421 GError **error)
16422{
16423 GInitable *ret;
16424 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);
16425 if (ret != NULL)
16426 return CONTROL_HOST (ret);
16427 else
16428 return NULL;
16429}
16430
16431
16432/* ------------------------------------------------------------------------ */
16433
16434/**
16435 * ControlHostSkeleton:
16436 *
16437 * The #ControlHostSkeleton structure contains only private data and should only be accessed using the provided API.
16438 */
16439
16440/**
16441 * ControlHostSkeletonClass:
16442 * @parent_class: The parent class.
16443 *
16444 * Class structure for #ControlHostSkeleton.
16445 */
16446
16447struct _ControlHostSkeletonPrivate
16448{
16449 GValue *properties;
16450 GList *changed_properties;
16451 GSource *changed_properties_idle_source;
16452 GMainContext *context;
16453 GMutex lock;
16454};
16455
16456static void
16457_control_host_skeleton_handle_method_call (
16458 GDBusConnection *connection G_GNUC_UNUSED,
16459 const gchar *sender G_GNUC_UNUSED,
16460 const gchar *object_path G_GNUC_UNUSED,
16461 const gchar *interface_name,
16462 const gchar *method_name,
16463 GVariant *parameters,
16464 GDBusMethodInvocation *invocation,
16465 gpointer user_data)
16466{
16467 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (user_data);
16468 _ExtendedGDBusMethodInfo *info;
16469 GVariantIter iter;
16470 GVariant *child;
16471 GValue *paramv;
16472 guint num_params;
16473 guint num_extra;
16474 guint n;
16475 guint signal_id;
16476 GValue return_value = G_VALUE_INIT;
16477 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
16478 g_assert (info != NULL);
16479 num_params = g_variant_n_children (parameters);
16480 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
16481 n = 0;
16482 g_value_init (&paramv[n], TYPE_CONTROL_HOST);
16483 g_value_set_object (&paramv[n++], skeleton);
16484 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
16485 g_value_set_object (&paramv[n++], invocation);
16486 if (info->pass_fdlist)
16487 {
16488#ifdef G_OS_UNIX
16489 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
16490 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
16491#else
16492 g_assert_not_reached ();
16493#endif
16494 }
16495 g_variant_iter_init (&iter, parameters);
16496 while ((child = g_variant_iter_next_value (&iter)) != NULL)
16497 {
16498 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
16499 if (arg_info->use_gvariant)
16500 {
16501 g_value_init (&paramv[n], G_TYPE_VARIANT);
16502 g_value_set_variant (&paramv[n], child);
16503 n++;
16504 }
16505 else
16506 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
16507 g_variant_unref (child);
16508 }
16509 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_HOST);
16510 g_value_init (&return_value, G_TYPE_BOOLEAN);
16511 g_signal_emitv (paramv, signal_id, 0, &return_value);
16512 if (!g_value_get_boolean (&return_value))
16513 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);
16514 g_value_unset (&return_value);
16515 for (n = 0; n < num_params + num_extra; n++)
16516 g_value_unset (&paramv[n]);
16517 g_free (paramv);
16518}
16519
16520static GVariant *
16521_control_host_skeleton_handle_get_property (
16522 GDBusConnection *connection G_GNUC_UNUSED,
16523 const gchar *sender G_GNUC_UNUSED,
16524 const gchar *object_path G_GNUC_UNUSED,
16525 const gchar *interface_name G_GNUC_UNUSED,
16526 const gchar *property_name,
16527 GError **error,
16528 gpointer user_data)
16529{
16530 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (user_data);
16531 GValue value = G_VALUE_INIT;
16532 GParamSpec *pspec;
16533 _ExtendedGDBusPropertyInfo *info;
16534 GVariant *ret;
16535 ret = NULL;
16536 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, property_name);
16537 g_assert (info != NULL);
16538 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
16539 if (pspec == NULL)
16540 {
16541 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
16542 }
16543 else
16544 {
16545 g_value_init (&value, pspec->value_type);
16546 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
16547 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
16548 g_value_unset (&value);
16549 }
16550 return ret;
16551}
16552
16553static gboolean
16554_control_host_skeleton_handle_set_property (
16555 GDBusConnection *connection G_GNUC_UNUSED,
16556 const gchar *sender G_GNUC_UNUSED,
16557 const gchar *object_path G_GNUC_UNUSED,
16558 const gchar *interface_name G_GNUC_UNUSED,
16559 const gchar *property_name,
16560 GVariant *variant,
16561 GError **error,
16562 gpointer user_data)
16563{
16564 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (user_data);
16565 GValue value = G_VALUE_INIT;
16566 GParamSpec *pspec;
16567 _ExtendedGDBusPropertyInfo *info;
16568 gboolean ret;
16569 ret = FALSE;
16570 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, property_name);
16571 g_assert (info != NULL);
16572 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
16573 if (pspec == NULL)
16574 {
16575 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
16576 }
16577 else
16578 {
16579 if (info->use_gvariant)
16580 g_value_set_variant (&value, variant);
16581 else
16582 g_dbus_gvariant_to_gvalue (variant, &value);
16583 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
16584 g_value_unset (&value);
16585 ret = TRUE;
16586 }
16587 return ret;
16588}
16589
16590static const GDBusInterfaceVTable _control_host_skeleton_vtable =
16591{
16592 _control_host_skeleton_handle_method_call,
16593 _control_host_skeleton_handle_get_property,
16594 _control_host_skeleton_handle_set_property,
16595 {NULL}
16596};
16597
16598static GDBusInterfaceInfo *
16599control_host_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
16600{
16601 return control_host_interface_info ();
16602}
16603
16604static GDBusInterfaceVTable *
16605control_host_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
16606{
16607 return (GDBusInterfaceVTable *) &_control_host_skeleton_vtable;
16608}
16609
16610static GVariant *
16611control_host_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
16612{
16613 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (_skeleton);
16614
16615 GVariantBuilder builder;
16616 guint n;
16617 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
16618 if (_control_host_interface_info.parent_struct.properties == NULL)
16619 goto out;
16620 for (n = 0; _control_host_interface_info.parent_struct.properties[n] != NULL; n++)
16621 {
16622 GDBusPropertyInfo *info = _control_host_interface_info.parent_struct.properties[n];
16623 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
16624 {
16625 GVariant *value;
16626 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);
16627 if (value != NULL)
16628 {
16629 g_variant_take_ref (value);
16630 g_variant_builder_add (&builder, "{sv}", info->name, value);
16631 g_variant_unref (value);
16632 }
16633 }
16634 }
16635out:
16636 return g_variant_builder_end (&builder);
16637}
16638
Norman James493996c2015-10-31 17:27:13 -050016639static gboolean _control_host_emit_changed (gpointer user_data);
16640
Norman James362a80f2015-09-14 14:04:39 -050016641static void
16642control_host_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
16643{
Norman James493996c2015-10-31 17:27:13 -050016644 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (_skeleton);
16645 gboolean emit_changed = FALSE;
16646
16647 g_mutex_lock (&skeleton->priv->lock);
16648 if (skeleton->priv->changed_properties_idle_source != NULL)
16649 {
16650 g_source_destroy (skeleton->priv->changed_properties_idle_source);
16651 skeleton->priv->changed_properties_idle_source = NULL;
16652 emit_changed = TRUE;
16653 }
16654 g_mutex_unlock (&skeleton->priv->lock);
16655
16656 if (emit_changed)
16657 _control_host_emit_changed (skeleton);
Norman James362a80f2015-09-14 14:04:39 -050016658}
16659
16660static void
16661_control_host_on_signal_booted (
16662 ControlHost *object)
16663{
16664 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object);
16665
16666 GList *connections, *l;
16667 GVariant *signal_variant;
16668 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
16669
16670 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
16671 for (l = connections; l != NULL; l = l->next)
16672 {
16673 GDBusConnection *connection = l->data;
16674 g_dbus_connection_emit_signal (connection,
16675 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.control.Host", "Booted",
16676 signal_variant, NULL);
16677 }
16678 g_variant_unref (signal_variant);
16679 g_list_free_full (connections, g_object_unref);
16680}
16681
16682static void control_host_skeleton_iface_init (ControlHostIface *iface);
16683#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
16684G_DEFINE_TYPE_WITH_CODE (ControlHostSkeleton, control_host_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
16685 G_ADD_PRIVATE (ControlHostSkeleton)
16686 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_skeleton_iface_init));
16687
16688#else
16689G_DEFINE_TYPE_WITH_CODE (ControlHostSkeleton, control_host_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
16690 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_skeleton_iface_init));
16691
16692#endif
16693static void
16694control_host_skeleton_finalize (GObject *object)
16695{
16696 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object);
Norman James493996c2015-10-31 17:27:13 -050016697 guint n;
16698 for (n = 0; n < 2; n++)
16699 g_value_unset (&skeleton->priv->properties[n]);
16700 g_free (skeleton->priv->properties);
Norman James362a80f2015-09-14 14:04:39 -050016701 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
16702 if (skeleton->priv->changed_properties_idle_source != NULL)
16703 g_source_destroy (skeleton->priv->changed_properties_idle_source);
16704 g_main_context_unref (skeleton->priv->context);
16705 g_mutex_clear (&skeleton->priv->lock);
16706 G_OBJECT_CLASS (control_host_skeleton_parent_class)->finalize (object);
16707}
16708
16709static void
Norman James493996c2015-10-31 17:27:13 -050016710control_host_skeleton_get_property (GObject *object,
16711 guint prop_id,
16712 GValue *value,
16713 GParamSpec *pspec G_GNUC_UNUSED)
16714{
16715 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object);
16716 g_assert (prop_id != 0 && prop_id - 1 < 2);
16717 g_mutex_lock (&skeleton->priv->lock);
16718 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
16719 g_mutex_unlock (&skeleton->priv->lock);
16720}
16721
16722static gboolean
16723_control_host_emit_changed (gpointer user_data)
16724{
16725 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (user_data);
16726 GList *l;
16727 GVariantBuilder builder;
16728 GVariantBuilder invalidated_builder;
16729 guint num_changes;
16730
16731 g_mutex_lock (&skeleton->priv->lock);
16732 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
16733 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
16734 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
16735 {
16736 ChangedProperty *cp = l->data;
16737 GVariant *variant;
16738 const GValue *cur_value;
16739
16740 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
16741 if (!_g_value_equal (cur_value, &cp->orig_value))
16742 {
16743 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
16744 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
16745 g_variant_unref (variant);
16746 num_changes++;
16747 }
16748 }
16749 if (num_changes > 0)
16750 {
16751 GList *connections, *ll;
16752 GVariant *signal_variant;
16753 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.control.Host",
16754 &builder, &invalidated_builder));
16755 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
16756 for (ll = connections; ll != NULL; ll = ll->next)
16757 {
16758 GDBusConnection *connection = ll->data;
16759
16760 g_dbus_connection_emit_signal (connection,
16761 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
16762 "org.freedesktop.DBus.Properties",
16763 "PropertiesChanged",
16764 signal_variant,
16765 NULL);
16766 }
16767 g_variant_unref (signal_variant);
16768 g_list_free_full (connections, g_object_unref);
16769 }
16770 else
16771 {
16772 g_variant_builder_clear (&builder);
16773 g_variant_builder_clear (&invalidated_builder);
16774 }
16775 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
16776 skeleton->priv->changed_properties = NULL;
16777 skeleton->priv->changed_properties_idle_source = NULL;
16778 g_mutex_unlock (&skeleton->priv->lock);
16779 return FALSE;
16780}
16781
16782static void
16783_control_host_schedule_emit_changed (ControlHostSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
16784{
16785 ChangedProperty *cp;
16786 GList *l;
16787 cp = NULL;
16788 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
16789 {
16790 ChangedProperty *i_cp = l->data;
16791 if (i_cp->info == info)
16792 {
16793 cp = i_cp;
16794 break;
16795 }
16796 }
16797 if (cp == NULL)
16798 {
16799 cp = g_new0 (ChangedProperty, 1);
16800 cp->prop_id = prop_id;
16801 cp->info = info;
16802 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
16803 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
16804 g_value_copy (orig_value, &cp->orig_value);
16805 }
16806}
16807
16808static void
16809control_host_skeleton_notify (GObject *object,
16810 GParamSpec *pspec G_GNUC_UNUSED)
16811{
16812 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object);
16813 g_mutex_lock (&skeleton->priv->lock);
16814 if (skeleton->priv->changed_properties != NULL &&
16815 skeleton->priv->changed_properties_idle_source == NULL)
16816 {
16817 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
16818 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
16819 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _control_host_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
16820 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
16821 g_source_unref (skeleton->priv->changed_properties_idle_source);
16822 }
16823 g_mutex_unlock (&skeleton->priv->lock);
16824}
16825
16826static void
16827control_host_skeleton_set_property (GObject *object,
16828 guint prop_id,
16829 const GValue *value,
16830 GParamSpec *pspec)
16831{
16832 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object);
16833 g_assert (prop_id != 0 && prop_id - 1 < 2);
16834 g_mutex_lock (&skeleton->priv->lock);
16835 g_object_freeze_notify (object);
16836 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
16837 {
16838 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
16839 _control_host_schedule_emit_changed (skeleton, _control_host_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
16840 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
16841 g_object_notify_by_pspec (object, pspec);
16842 }
16843 g_mutex_unlock (&skeleton->priv->lock);
16844 g_object_thaw_notify (object);
16845}
16846
16847static void
Norman James362a80f2015-09-14 14:04:39 -050016848control_host_skeleton_init (ControlHostSkeleton *skeleton)
16849{
16850#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
16851 skeleton->priv = control_host_skeleton_get_instance_private (skeleton);
16852#else
16853 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_HOST_SKELETON, ControlHostSkeletonPrivate);
16854#endif
16855
16856 g_mutex_init (&skeleton->priv->lock);
16857 skeleton->priv->context = g_main_context_ref_thread_default ();
Norman James493996c2015-10-31 17:27:13 -050016858 skeleton->priv->properties = g_new0 (GValue, 2);
16859 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
16860 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
16861}
16862
16863static gint
16864control_host_skeleton_get_debug_mode (ControlHost *object)
16865{
16866 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object);
16867 gint value;
16868 g_mutex_lock (&skeleton->priv->lock);
16869 value = g_value_get_int (&(skeleton->priv->properties[0]));
16870 g_mutex_unlock (&skeleton->priv->lock);
16871 return value;
16872}
16873
16874static const gchar *
16875control_host_skeleton_get_flash_side (ControlHost *object)
16876{
16877 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object);
16878 const gchar *value;
16879 g_mutex_lock (&skeleton->priv->lock);
16880 value = g_value_get_string (&(skeleton->priv->properties[1]));
16881 g_mutex_unlock (&skeleton->priv->lock);
16882 return value;
Norman James362a80f2015-09-14 14:04:39 -050016883}
16884
16885static void
16886control_host_skeleton_class_init (ControlHostSkeletonClass *klass)
16887{
16888 GObjectClass *gobject_class;
16889 GDBusInterfaceSkeletonClass *skeleton_class;
16890
16891 gobject_class = G_OBJECT_CLASS (klass);
16892 gobject_class->finalize = control_host_skeleton_finalize;
Norman James493996c2015-10-31 17:27:13 -050016893 gobject_class->get_property = control_host_skeleton_get_property;
16894 gobject_class->set_property = control_host_skeleton_set_property;
16895 gobject_class->notify = control_host_skeleton_notify;
16896
16897
16898 control_host_override_properties (gobject_class, 1);
Norman James362a80f2015-09-14 14:04:39 -050016899
16900 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
16901 skeleton_class->get_info = control_host_skeleton_dbus_interface_get_info;
16902 skeleton_class->get_properties = control_host_skeleton_dbus_interface_get_properties;
16903 skeleton_class->flush = control_host_skeleton_dbus_interface_flush;
16904 skeleton_class->get_vtable = control_host_skeleton_dbus_interface_get_vtable;
16905
16906#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
16907 g_type_class_add_private (klass, sizeof (ControlHostSkeletonPrivate));
16908#endif
16909}
16910
16911static void
16912control_host_skeleton_iface_init (ControlHostIface *iface)
16913{
16914 iface->booted = _control_host_on_signal_booted;
Norman James493996c2015-10-31 17:27:13 -050016915 iface->get_debug_mode = control_host_skeleton_get_debug_mode;
16916 iface->get_flash_side = control_host_skeleton_get_flash_side;
Norman James362a80f2015-09-14 14:04:39 -050016917}
16918
16919/**
16920 * control_host_skeleton_new:
16921 *
16922 * 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>.
16923 *
16924 * Returns: (transfer full) (type ControlHostSkeleton): The skeleton object.
16925 */
16926ControlHost *
16927control_host_skeleton_new (void)
16928{
16929 return CONTROL_HOST (g_object_new (TYPE_CONTROL_HOST_SKELETON, NULL));
16930}
16931
16932/* ------------------------------------------------------------------------
16933 * Code for interface org.openbmc.control.Power
16934 * ------------------------------------------------------------------------
16935 */
16936
16937/**
16938 * SECTION:ControlPower
16939 * @title: ControlPower
16940 * @short_description: Generated C code for the org.openbmc.control.Power D-Bus interface
16941 *
16942 * 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.
16943 */
16944
16945/* ---- Introspection data for org.openbmc.control.Power ---- */
16946
16947static const _ExtendedGDBusArgInfo _control_power_method_info_set_power_state_IN_ARG_state =
16948{
16949 {
16950 -1,
16951 (gchar *) "state",
16952 (gchar *) "i",
16953 NULL
16954 },
16955 FALSE
16956};
16957
16958static const _ExtendedGDBusArgInfo * const _control_power_method_info_set_power_state_IN_ARG_pointers[] =
16959{
16960 &_control_power_method_info_set_power_state_IN_ARG_state,
16961 NULL
16962};
16963
16964static const _ExtendedGDBusMethodInfo _control_power_method_info_set_power_state =
16965{
16966 {
16967 -1,
16968 (gchar *) "setPowerState",
16969 (GDBusArgInfo **) &_control_power_method_info_set_power_state_IN_ARG_pointers,
16970 NULL,
16971 NULL
16972 },
16973 "handle-set-power-state",
16974 FALSE
16975};
16976
16977static const _ExtendedGDBusArgInfo _control_power_method_info_get_power_state_OUT_ARG_state =
16978{
16979 {
16980 -1,
16981 (gchar *) "state",
16982 (gchar *) "i",
16983 NULL
16984 },
16985 FALSE
16986};
16987
16988static const _ExtendedGDBusArgInfo * const _control_power_method_info_get_power_state_OUT_ARG_pointers[] =
16989{
16990 &_control_power_method_info_get_power_state_OUT_ARG_state,
16991 NULL
16992};
16993
16994static const _ExtendedGDBusMethodInfo _control_power_method_info_get_power_state =
16995{
16996 {
16997 -1,
16998 (gchar *) "getPowerState",
16999 NULL,
17000 (GDBusArgInfo **) &_control_power_method_info_get_power_state_OUT_ARG_pointers,
17001 NULL
17002 },
17003 "handle-get-power-state",
17004 FALSE
17005};
17006
17007static const _ExtendedGDBusMethodInfo * const _control_power_method_info_pointers[] =
17008{
17009 &_control_power_method_info_set_power_state,
17010 &_control_power_method_info_get_power_state,
17011 NULL
17012};
17013
17014static const _ExtendedGDBusSignalInfo _control_power_signal_info_power_good =
17015{
17016 {
17017 -1,
17018 (gchar *) "PowerGood",
17019 NULL,
17020 NULL
17021 },
17022 "power-good"
17023};
17024
17025static const _ExtendedGDBusSignalInfo _control_power_signal_info_power_lost =
17026{
17027 {
17028 -1,
17029 (gchar *) "PowerLost",
17030 NULL,
17031 NULL
17032 },
17033 "power-lost"
17034};
17035
17036static const _ExtendedGDBusSignalInfo * const _control_power_signal_info_pointers[] =
17037{
17038 &_control_power_signal_info_power_good,
17039 &_control_power_signal_info_power_lost,
17040 NULL
17041};
17042
17043static const _ExtendedGDBusPropertyInfo _control_power_property_info_pgood =
17044{
17045 {
17046 -1,
17047 (gchar *) "pgood",
17048 (gchar *) "i",
17049 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
17050 NULL
17051 },
17052 "pgood",
17053 FALSE
17054};
17055
17056static const _ExtendedGDBusPropertyInfo _control_power_property_info_state =
17057{
17058 {
17059 -1,
17060 (gchar *) "state",
17061 (gchar *) "i",
17062 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
17063 NULL
17064 },
17065 "state",
17066 FALSE
17067};
17068
Norman James32e74e22015-09-15 21:28:06 -050017069static const _ExtendedGDBusPropertyInfo _control_power_property_info_pgood_timeout =
17070{
17071 {
17072 -1,
17073 (gchar *) "pgood_timeout",
17074 (gchar *) "i",
17075 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
17076 NULL
17077 },
17078 "pgood-timeout",
17079 FALSE
17080};
17081
Norman James362a80f2015-09-14 14:04:39 -050017082static const _ExtendedGDBusPropertyInfo * const _control_power_property_info_pointers[] =
17083{
17084 &_control_power_property_info_pgood,
17085 &_control_power_property_info_state,
Norman James32e74e22015-09-15 21:28:06 -050017086 &_control_power_property_info_pgood_timeout,
Norman James362a80f2015-09-14 14:04:39 -050017087 NULL
17088};
17089
17090static const _ExtendedGDBusInterfaceInfo _control_power_interface_info =
17091{
17092 {
17093 -1,
17094 (gchar *) "org.openbmc.control.Power",
17095 (GDBusMethodInfo **) &_control_power_method_info_pointers,
17096 (GDBusSignalInfo **) &_control_power_signal_info_pointers,
17097 (GDBusPropertyInfo **) &_control_power_property_info_pointers,
17098 NULL
17099 },
17100 "control-power",
17101};
17102
17103
17104/**
17105 * control_power_interface_info:
17106 *
17107 * 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.
17108 *
17109 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
17110 */
17111GDBusInterfaceInfo *
17112control_power_interface_info (void)
17113{
17114 return (GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct;
17115}
17116
17117/**
17118 * control_power_override_properties:
17119 * @klass: The class structure for a #GObject<!-- -->-derived class.
17120 * @property_id_begin: The property id to assign to the first overridden property.
17121 *
17122 * Overrides all #GObject properties in the #ControlPower interface for a concrete class.
17123 * The properties are overridden in the order they are defined.
17124 *
17125 * Returns: The last property id.
17126 */
17127guint
17128control_power_override_properties (GObjectClass *klass, guint property_id_begin)
17129{
17130 g_object_class_override_property (klass, property_id_begin++, "pgood");
17131 g_object_class_override_property (klass, property_id_begin++, "state");
Norman James32e74e22015-09-15 21:28:06 -050017132 g_object_class_override_property (klass, property_id_begin++, "pgood-timeout");
Norman James362a80f2015-09-14 14:04:39 -050017133 return property_id_begin - 1;
17134}
17135
17136
17137
17138/**
17139 * ControlPower:
17140 *
17141 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Power.top_of_page">org.openbmc.control.Power</link>.
17142 */
17143
17144/**
17145 * ControlPowerIface:
17146 * @parent_iface: The parent interface.
17147 * @handle_get_power_state: Handler for the #ControlPower::handle-get-power-state signal.
17148 * @handle_set_power_state: Handler for the #ControlPower::handle-set-power-state signal.
17149 * @get_pgood: Getter for the #ControlPower:pgood property.
Norman James32e74e22015-09-15 21:28:06 -050017150 * @get_pgood_timeout: Getter for the #ControlPower:pgood-timeout property.
Norman James362a80f2015-09-14 14:04:39 -050017151 * @get_state: Getter for the #ControlPower:state property.
17152 * @power_good: Handler for the #ControlPower::power-good signal.
17153 * @power_lost: Handler for the #ControlPower::power-lost signal.
17154 *
17155 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Power.top_of_page">org.openbmc.control.Power</link>.
17156 */
17157
17158typedef ControlPowerIface ControlPowerInterface;
17159G_DEFINE_INTERFACE (ControlPower, control_power, G_TYPE_OBJECT);
17160
17161static void
17162control_power_default_init (ControlPowerIface *iface)
17163{
17164 /* GObject signals for incoming D-Bus method calls: */
17165 /**
17166 * ControlPower::handle-set-power-state:
17167 * @object: A #ControlPower.
17168 * @invocation: A #GDBusMethodInvocation.
17169 * @arg_state: Argument passed by remote caller.
17170 *
17171 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Power.setPowerState">setPowerState()</link> D-Bus method.
17172 *
17173 * 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.
17174 *
17175 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
17176 */
17177 g_signal_new ("handle-set-power-state",
17178 G_TYPE_FROM_INTERFACE (iface),
17179 G_SIGNAL_RUN_LAST,
17180 G_STRUCT_OFFSET (ControlPowerIface, handle_set_power_state),
17181 g_signal_accumulator_true_handled,
17182 NULL,
17183 g_cclosure_marshal_generic,
17184 G_TYPE_BOOLEAN,
17185 2,
17186 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT);
17187
17188 /**
17189 * ControlPower::handle-get-power-state:
17190 * @object: A #ControlPower.
17191 * @invocation: A #GDBusMethodInvocation.
17192 *
17193 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Power.getPowerState">getPowerState()</link> D-Bus method.
17194 *
17195 * 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.
17196 *
17197 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
17198 */
17199 g_signal_new ("handle-get-power-state",
17200 G_TYPE_FROM_INTERFACE (iface),
17201 G_SIGNAL_RUN_LAST,
17202 G_STRUCT_OFFSET (ControlPowerIface, handle_get_power_state),
17203 g_signal_accumulator_true_handled,
17204 NULL,
17205 g_cclosure_marshal_generic,
17206 G_TYPE_BOOLEAN,
17207 1,
17208 G_TYPE_DBUS_METHOD_INVOCATION);
17209
17210 /* GObject signals for received D-Bus signals: */
17211 /**
17212 * ControlPower::power-good:
17213 * @object: A #ControlPower.
17214 *
17215 * 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.
17216 *
17217 * 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.
17218 */
17219 g_signal_new ("power-good",
17220 G_TYPE_FROM_INTERFACE (iface),
17221 G_SIGNAL_RUN_LAST,
17222 G_STRUCT_OFFSET (ControlPowerIface, power_good),
17223 NULL,
17224 NULL,
17225 g_cclosure_marshal_generic,
17226 G_TYPE_NONE,
17227 0);
17228
17229 /**
17230 * ControlPower::power-lost:
17231 * @object: A #ControlPower.
17232 *
17233 * 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.
17234 *
17235 * 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.
17236 */
17237 g_signal_new ("power-lost",
17238 G_TYPE_FROM_INTERFACE (iface),
17239 G_SIGNAL_RUN_LAST,
17240 G_STRUCT_OFFSET (ControlPowerIface, power_lost),
17241 NULL,
17242 NULL,
17243 g_cclosure_marshal_generic,
17244 G_TYPE_NONE,
17245 0);
17246
17247 /* GObject properties for D-Bus properties: */
17248 /**
17249 * ControlPower:pgood:
17250 *
17251 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-control-Power.pgood">"pgood"</link>.
17252 *
17253 * 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.
17254 */
17255 g_object_interface_install_property (iface,
17256 g_param_spec_int ("pgood", "pgood", "pgood", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
17257 /**
17258 * ControlPower:state:
17259 *
17260 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-control-Power.state">"state"</link>.
17261 *
17262 * 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.
17263 */
17264 g_object_interface_install_property (iface,
17265 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 -050017266 /**
17267 * ControlPower:pgood-timeout:
17268 *
17269 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-control-Power.pgood_timeout">"pgood_timeout"</link>.
17270 *
17271 * 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.
17272 */
17273 g_object_interface_install_property (iface,
17274 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 -050017275}
17276
17277/**
17278 * control_power_get_pgood: (skip)
17279 * @object: A #ControlPower.
17280 *
17281 * Gets the value of the <link linkend="gdbus-property-org-openbmc-control-Power.pgood">"pgood"</link> D-Bus property.
17282 *
17283 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
17284 *
17285 * Returns: The property value.
17286 */
17287gint
17288control_power_get_pgood (ControlPower *object)
17289{
17290 return CONTROL_POWER_GET_IFACE (object)->get_pgood (object);
17291}
17292
17293/**
17294 * control_power_set_pgood: (skip)
17295 * @object: A #ControlPower.
17296 * @value: The value to set.
17297 *
17298 * Sets the <link linkend="gdbus-property-org-openbmc-control-Power.pgood">"pgood"</link> D-Bus property to @value.
17299 *
17300 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
17301 */
17302void
17303control_power_set_pgood (ControlPower *object, gint value)
17304{
17305 g_object_set (G_OBJECT (object), "pgood", value, NULL);
17306}
17307
17308/**
17309 * control_power_get_state: (skip)
17310 * @object: A #ControlPower.
17311 *
17312 * Gets the value of the <link linkend="gdbus-property-org-openbmc-control-Power.state">"state"</link> D-Bus property.
17313 *
17314 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
17315 *
17316 * Returns: The property value.
17317 */
17318gint
17319control_power_get_state (ControlPower *object)
17320{
17321 return CONTROL_POWER_GET_IFACE (object)->get_state (object);
17322}
17323
17324/**
17325 * control_power_set_state: (skip)
17326 * @object: A #ControlPower.
17327 * @value: The value to set.
17328 *
17329 * Sets the <link linkend="gdbus-property-org-openbmc-control-Power.state">"state"</link> D-Bus property to @value.
17330 *
17331 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
17332 */
17333void
17334control_power_set_state (ControlPower *object, gint value)
17335{
17336 g_object_set (G_OBJECT (object), "state", value, NULL);
17337}
17338
17339/**
Norman James32e74e22015-09-15 21:28:06 -050017340 * control_power_get_pgood_timeout: (skip)
17341 * @object: A #ControlPower.
17342 *
17343 * Gets the value of the <link linkend="gdbus-property-org-openbmc-control-Power.pgood_timeout">"pgood_timeout"</link> D-Bus property.
17344 *
17345 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
17346 *
17347 * Returns: The property value.
17348 */
17349gint
17350control_power_get_pgood_timeout (ControlPower *object)
17351{
17352 return CONTROL_POWER_GET_IFACE (object)->get_pgood_timeout (object);
17353}
17354
17355/**
17356 * control_power_set_pgood_timeout: (skip)
17357 * @object: A #ControlPower.
17358 * @value: The value to set.
17359 *
17360 * Sets the <link linkend="gdbus-property-org-openbmc-control-Power.pgood_timeout">"pgood_timeout"</link> D-Bus property to @value.
17361 *
17362 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
17363 */
17364void
17365control_power_set_pgood_timeout (ControlPower *object, gint value)
17366{
17367 g_object_set (G_OBJECT (object), "pgood-timeout", value, NULL);
17368}
17369
17370/**
Norman James362a80f2015-09-14 14:04:39 -050017371 * control_power_emit_power_good:
17372 * @object: A #ControlPower.
17373 *
17374 * Emits the <link linkend="gdbus-signal-org-openbmc-control-Power.PowerGood">"PowerGood"</link> D-Bus signal.
17375 */
17376void
17377control_power_emit_power_good (
17378 ControlPower *object)
17379{
17380 g_signal_emit_by_name (object, "power-good");
17381}
17382
17383/**
17384 * control_power_emit_power_lost:
17385 * @object: A #ControlPower.
17386 *
17387 * Emits the <link linkend="gdbus-signal-org-openbmc-control-Power.PowerLost">"PowerLost"</link> D-Bus signal.
17388 */
17389void
17390control_power_emit_power_lost (
17391 ControlPower *object)
17392{
17393 g_signal_emit_by_name (object, "power-lost");
17394}
17395
17396/**
17397 * control_power_call_set_power_state:
17398 * @proxy: A #ControlPowerProxy.
17399 * @arg_state: Argument to pass with the method invocation.
17400 * @cancellable: (allow-none): A #GCancellable or %NULL.
17401 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
17402 * @user_data: User data to pass to @callback.
17403 *
17404 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Power.setPowerState">setPowerState()</link> D-Bus method on @proxy.
17405 * 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.
17406 * You can then call control_power_call_set_power_state_finish() to get the result of the operation.
17407 *
17408 * See control_power_call_set_power_state_sync() for the synchronous, blocking version of this method.
17409 */
17410void
17411control_power_call_set_power_state (
17412 ControlPower *proxy,
17413 gint arg_state,
17414 GCancellable *cancellable,
17415 GAsyncReadyCallback callback,
17416 gpointer user_data)
17417{
17418 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
17419 "setPowerState",
17420 g_variant_new ("(i)",
17421 arg_state),
17422 G_DBUS_CALL_FLAGS_NONE,
17423 -1,
17424 cancellable,
17425 callback,
17426 user_data);
17427}
17428
17429/**
17430 * control_power_call_set_power_state_finish:
17431 * @proxy: A #ControlPowerProxy.
17432 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_call_set_power_state().
17433 * @error: Return location for error or %NULL.
17434 *
17435 * Finishes an operation started with control_power_call_set_power_state().
17436 *
17437 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
17438 */
17439gboolean
17440control_power_call_set_power_state_finish (
17441 ControlPower *proxy,
17442 GAsyncResult *res,
17443 GError **error)
17444{
17445 GVariant *_ret;
17446 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
17447 if (_ret == NULL)
17448 goto _out;
17449 g_variant_get (_ret,
17450 "()");
17451 g_variant_unref (_ret);
17452_out:
17453 return _ret != NULL;
17454}
17455
17456/**
17457 * control_power_call_set_power_state_sync:
17458 * @proxy: A #ControlPowerProxy.
17459 * @arg_state: Argument to pass with the method invocation.
17460 * @cancellable: (allow-none): A #GCancellable or %NULL.
17461 * @error: Return location for error or %NULL.
17462 *
17463 * 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.
17464 *
17465 * See control_power_call_set_power_state() for the asynchronous version of this method.
17466 *
17467 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
17468 */
17469gboolean
17470control_power_call_set_power_state_sync (
17471 ControlPower *proxy,
17472 gint arg_state,
17473 GCancellable *cancellable,
17474 GError **error)
17475{
17476 GVariant *_ret;
17477 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
17478 "setPowerState",
17479 g_variant_new ("(i)",
17480 arg_state),
17481 G_DBUS_CALL_FLAGS_NONE,
17482 -1,
17483 cancellable,
17484 error);
17485 if (_ret == NULL)
17486 goto _out;
17487 g_variant_get (_ret,
17488 "()");
17489 g_variant_unref (_ret);
17490_out:
17491 return _ret != NULL;
17492}
17493
17494/**
17495 * control_power_call_get_power_state:
17496 * @proxy: A #ControlPowerProxy.
17497 * @cancellable: (allow-none): A #GCancellable or %NULL.
17498 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
17499 * @user_data: User data to pass to @callback.
17500 *
17501 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Power.getPowerState">getPowerState()</link> D-Bus method on @proxy.
17502 * 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.
17503 * You can then call control_power_call_get_power_state_finish() to get the result of the operation.
17504 *
17505 * See control_power_call_get_power_state_sync() for the synchronous, blocking version of this method.
17506 */
17507void
17508control_power_call_get_power_state (
17509 ControlPower *proxy,
17510 GCancellable *cancellable,
17511 GAsyncReadyCallback callback,
17512 gpointer user_data)
17513{
17514 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
17515 "getPowerState",
17516 g_variant_new ("()"),
17517 G_DBUS_CALL_FLAGS_NONE,
17518 -1,
17519 cancellable,
17520 callback,
17521 user_data);
17522}
17523
17524/**
17525 * control_power_call_get_power_state_finish:
17526 * @proxy: A #ControlPowerProxy.
17527 * @out_state: (out): Return location for return parameter or %NULL to ignore.
17528 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_call_get_power_state().
17529 * @error: Return location for error or %NULL.
17530 *
17531 * Finishes an operation started with control_power_call_get_power_state().
17532 *
17533 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
17534 */
17535gboolean
17536control_power_call_get_power_state_finish (
17537 ControlPower *proxy,
17538 gint *out_state,
17539 GAsyncResult *res,
17540 GError **error)
17541{
17542 GVariant *_ret;
17543 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
17544 if (_ret == NULL)
17545 goto _out;
17546 g_variant_get (_ret,
17547 "(i)",
17548 out_state);
17549 g_variant_unref (_ret);
17550_out:
17551 return _ret != NULL;
17552}
17553
17554/**
17555 * control_power_call_get_power_state_sync:
17556 * @proxy: A #ControlPowerProxy.
17557 * @out_state: (out): Return location for return parameter or %NULL to ignore.
17558 * @cancellable: (allow-none): A #GCancellable or %NULL.
17559 * @error: Return location for error or %NULL.
17560 *
17561 * 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.
17562 *
17563 * See control_power_call_get_power_state() for the asynchronous version of this method.
17564 *
17565 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
17566 */
17567gboolean
17568control_power_call_get_power_state_sync (
17569 ControlPower *proxy,
17570 gint *out_state,
17571 GCancellable *cancellable,
17572 GError **error)
17573{
17574 GVariant *_ret;
17575 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
17576 "getPowerState",
17577 g_variant_new ("()"),
17578 G_DBUS_CALL_FLAGS_NONE,
17579 -1,
17580 cancellable,
17581 error);
17582 if (_ret == NULL)
17583 goto _out;
17584 g_variant_get (_ret,
17585 "(i)",
17586 out_state);
17587 g_variant_unref (_ret);
17588_out:
17589 return _ret != NULL;
17590}
17591
17592/**
17593 * control_power_complete_set_power_state:
17594 * @object: A #ControlPower.
17595 * @invocation: (transfer full): A #GDBusMethodInvocation.
17596 *
17597 * 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.
17598 *
17599 * This method will free @invocation, you cannot use it afterwards.
17600 */
17601void
17602control_power_complete_set_power_state (
17603 ControlPower *object,
17604 GDBusMethodInvocation *invocation)
17605{
17606 g_dbus_method_invocation_return_value (invocation,
17607 g_variant_new ("()"));
17608}
17609
17610/**
17611 * control_power_complete_get_power_state:
17612 * @object: A #ControlPower.
17613 * @invocation: (transfer full): A #GDBusMethodInvocation.
17614 * @state: Parameter to return.
17615 *
17616 * 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.
17617 *
17618 * This method will free @invocation, you cannot use it afterwards.
17619 */
17620void
17621control_power_complete_get_power_state (
17622 ControlPower *object,
17623 GDBusMethodInvocation *invocation,
17624 gint state)
17625{
17626 g_dbus_method_invocation_return_value (invocation,
17627 g_variant_new ("(i)",
17628 state));
17629}
17630
17631/* ------------------------------------------------------------------------ */
17632
17633/**
17634 * ControlPowerProxy:
17635 *
17636 * The #ControlPowerProxy structure contains only private data and should only be accessed using the provided API.
17637 */
17638
17639/**
17640 * ControlPowerProxyClass:
17641 * @parent_class: The parent class.
17642 *
17643 * Class structure for #ControlPowerProxy.
17644 */
17645
17646struct _ControlPowerProxyPrivate
17647{
17648 GData *qdata;
17649};
17650
17651static void control_power_proxy_iface_init (ControlPowerIface *iface);
17652
17653#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
17654G_DEFINE_TYPE_WITH_CODE (ControlPowerProxy, control_power_proxy, G_TYPE_DBUS_PROXY,
17655 G_ADD_PRIVATE (ControlPowerProxy)
17656 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_proxy_iface_init));
17657
17658#else
17659G_DEFINE_TYPE_WITH_CODE (ControlPowerProxy, control_power_proxy, G_TYPE_DBUS_PROXY,
17660 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_proxy_iface_init));
17661
17662#endif
17663static void
17664control_power_proxy_finalize (GObject *object)
17665{
17666 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (object);
17667 g_datalist_clear (&proxy->priv->qdata);
17668 G_OBJECT_CLASS (control_power_proxy_parent_class)->finalize (object);
17669}
17670
17671static void
17672control_power_proxy_get_property (GObject *object,
17673 guint prop_id,
17674 GValue *value,
17675 GParamSpec *pspec G_GNUC_UNUSED)
17676{
17677 const _ExtendedGDBusPropertyInfo *info;
17678 GVariant *variant;
Norman James32e74e22015-09-15 21:28:06 -050017679 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -050017680 info = _control_power_property_info_pointers[prop_id - 1];
17681 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
17682 if (info->use_gvariant)
17683 {
17684 g_value_set_variant (value, variant);
17685 }
17686 else
17687 {
17688 if (variant != NULL)
17689 g_dbus_gvariant_to_gvalue (variant, value);
17690 }
17691 if (variant != NULL)
17692 g_variant_unref (variant);
17693}
17694
17695static void
17696control_power_proxy_set_property_cb (GDBusProxy *proxy,
17697 GAsyncResult *res,
17698 gpointer user_data)
17699{
17700 const _ExtendedGDBusPropertyInfo *info = user_data;
17701 GError *error;
17702 GVariant *_ret;
17703 error = NULL;
17704 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
17705 if (!_ret)
17706 {
17707 g_warning ("Error setting property '%s' on interface org.openbmc.control.Power: %s (%s, %d)",
17708 info->parent_struct.name,
17709 error->message, g_quark_to_string (error->domain), error->code);
17710 g_error_free (error);
17711 }
17712 else
17713 {
17714 g_variant_unref (_ret);
17715 }
17716}
17717
17718static void
17719control_power_proxy_set_property (GObject *object,
17720 guint prop_id,
17721 const GValue *value,
17722 GParamSpec *pspec G_GNUC_UNUSED)
17723{
17724 const _ExtendedGDBusPropertyInfo *info;
17725 GVariant *variant;
Norman James32e74e22015-09-15 21:28:06 -050017726 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -050017727 info = _control_power_property_info_pointers[prop_id - 1];
17728 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
17729 g_dbus_proxy_call (G_DBUS_PROXY (object),
17730 "org.freedesktop.DBus.Properties.Set",
17731 g_variant_new ("(ssv)", "org.openbmc.control.Power", info->parent_struct.name, variant),
17732 G_DBUS_CALL_FLAGS_NONE,
17733 -1,
17734 NULL, (GAsyncReadyCallback) control_power_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
17735 g_variant_unref (variant);
17736}
17737
17738static void
17739control_power_proxy_g_signal (GDBusProxy *proxy,
17740 const gchar *sender_name G_GNUC_UNUSED,
17741 const gchar *signal_name,
17742 GVariant *parameters)
17743{
17744 _ExtendedGDBusSignalInfo *info;
17745 GVariantIter iter;
17746 GVariant *child;
17747 GValue *paramv;
17748 guint num_params;
17749 guint n;
17750 guint signal_id;
17751 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, signal_name);
17752 if (info == NULL)
17753 return;
17754 num_params = g_variant_n_children (parameters);
17755 paramv = g_new0 (GValue, num_params + 1);
17756 g_value_init (&paramv[0], TYPE_CONTROL_POWER);
17757 g_value_set_object (&paramv[0], proxy);
17758 g_variant_iter_init (&iter, parameters);
17759 n = 1;
17760 while ((child = g_variant_iter_next_value (&iter)) != NULL)
17761 {
17762 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
17763 if (arg_info->use_gvariant)
17764 {
17765 g_value_init (&paramv[n], G_TYPE_VARIANT);
17766 g_value_set_variant (&paramv[n], child);
17767 n++;
17768 }
17769 else
17770 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
17771 g_variant_unref (child);
17772 }
17773 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_POWER);
17774 g_signal_emitv (paramv, signal_id, 0, NULL);
17775 for (n = 0; n < num_params + 1; n++)
17776 g_value_unset (&paramv[n]);
17777 g_free (paramv);
17778}
17779
17780static void
17781control_power_proxy_g_properties_changed (GDBusProxy *_proxy,
17782 GVariant *changed_properties,
17783 const gchar *const *invalidated_properties)
17784{
17785 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (_proxy);
17786 guint n;
17787 const gchar *key;
17788 GVariantIter *iter;
17789 _ExtendedGDBusPropertyInfo *info;
17790 g_variant_get (changed_properties, "a{sv}", &iter);
17791 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
17792 {
17793 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, key);
17794 g_datalist_remove_data (&proxy->priv->qdata, key);
17795 if (info != NULL)
17796 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
17797 }
17798 g_variant_iter_free (iter);
17799 for (n = 0; invalidated_properties[n] != NULL; n++)
17800 {
17801 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, invalidated_properties[n]);
17802 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
17803 if (info != NULL)
17804 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
17805 }
17806}
17807
17808static gint
17809control_power_proxy_get_pgood (ControlPower *object)
17810{
17811 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (object);
17812 GVariant *variant;
17813 gint value = 0;
17814 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "pgood");
17815 if (variant != NULL)
17816 {
17817 value = g_variant_get_int32 (variant);
17818 g_variant_unref (variant);
17819 }
17820 return value;
17821}
17822
17823static gint
17824control_power_proxy_get_state (ControlPower *object)
17825{
17826 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (object);
17827 GVariant *variant;
17828 gint value = 0;
17829 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state");
17830 if (variant != NULL)
17831 {
17832 value = g_variant_get_int32 (variant);
17833 g_variant_unref (variant);
17834 }
17835 return value;
17836}
17837
Norman James32e74e22015-09-15 21:28:06 -050017838static gint
17839control_power_proxy_get_pgood_timeout (ControlPower *object)
17840{
17841 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (object);
17842 GVariant *variant;
17843 gint value = 0;
17844 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "pgood_timeout");
17845 if (variant != NULL)
17846 {
17847 value = g_variant_get_int32 (variant);
17848 g_variant_unref (variant);
17849 }
17850 return value;
17851}
17852
Norman James362a80f2015-09-14 14:04:39 -050017853static void
17854control_power_proxy_init (ControlPowerProxy *proxy)
17855{
17856#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
17857 proxy->priv = control_power_proxy_get_instance_private (proxy);
17858#else
17859 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_POWER_PROXY, ControlPowerProxyPrivate);
17860#endif
17861
17862 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_power_interface_info ());
17863}
17864
17865static void
17866control_power_proxy_class_init (ControlPowerProxyClass *klass)
17867{
17868 GObjectClass *gobject_class;
17869 GDBusProxyClass *proxy_class;
17870
17871 gobject_class = G_OBJECT_CLASS (klass);
17872 gobject_class->finalize = control_power_proxy_finalize;
17873 gobject_class->get_property = control_power_proxy_get_property;
17874 gobject_class->set_property = control_power_proxy_set_property;
17875
17876 proxy_class = G_DBUS_PROXY_CLASS (klass);
17877 proxy_class->g_signal = control_power_proxy_g_signal;
17878 proxy_class->g_properties_changed = control_power_proxy_g_properties_changed;
17879
17880 control_power_override_properties (gobject_class, 1);
17881
17882#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
17883 g_type_class_add_private (klass, sizeof (ControlPowerProxyPrivate));
17884#endif
17885}
17886
17887static void
17888control_power_proxy_iface_init (ControlPowerIface *iface)
17889{
17890 iface->get_pgood = control_power_proxy_get_pgood;
17891 iface->get_state = control_power_proxy_get_state;
Norman James32e74e22015-09-15 21:28:06 -050017892 iface->get_pgood_timeout = control_power_proxy_get_pgood_timeout;
Norman James362a80f2015-09-14 14:04:39 -050017893}
17894
17895/**
17896 * control_power_proxy_new:
17897 * @connection: A #GDBusConnection.
17898 * @flags: Flags from the #GDBusProxyFlags enumeration.
17899 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
17900 * @object_path: An object path.
17901 * @cancellable: (allow-none): A #GCancellable or %NULL.
17902 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
17903 * @user_data: User data to pass to @callback.
17904 *
17905 * 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.
17906 *
17907 * 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.
17908 * You can then call control_power_proxy_new_finish() to get the result of the operation.
17909 *
17910 * See control_power_proxy_new_sync() for the synchronous, blocking version of this constructor.
17911 */
17912void
17913control_power_proxy_new (
17914 GDBusConnection *connection,
17915 GDBusProxyFlags flags,
17916 const gchar *name,
17917 const gchar *object_path,
17918 GCancellable *cancellable,
17919 GAsyncReadyCallback callback,
17920 gpointer user_data)
17921{
17922 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);
17923}
17924
17925/**
17926 * control_power_proxy_new_finish:
17927 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_proxy_new().
17928 * @error: Return location for error or %NULL
17929 *
17930 * Finishes an operation started with control_power_proxy_new().
17931 *
17932 * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set.
17933 */
17934ControlPower *
17935control_power_proxy_new_finish (
17936 GAsyncResult *res,
17937 GError **error)
17938{
17939 GObject *ret;
17940 GObject *source_object;
17941 source_object = g_async_result_get_source_object (res);
17942 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
17943 g_object_unref (source_object);
17944 if (ret != NULL)
17945 return CONTROL_POWER (ret);
17946 else
17947 return NULL;
17948}
17949
17950/**
17951 * control_power_proxy_new_sync:
17952 * @connection: A #GDBusConnection.
17953 * @flags: Flags from the #GDBusProxyFlags enumeration.
17954 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
17955 * @object_path: An object path.
17956 * @cancellable: (allow-none): A #GCancellable or %NULL.
17957 * @error: Return location for error or %NULL
17958 *
17959 * 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.
17960 *
17961 * The calling thread is blocked until a reply is received.
17962 *
17963 * See control_power_proxy_new() for the asynchronous version of this constructor.
17964 *
17965 * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set.
17966 */
17967ControlPower *
17968control_power_proxy_new_sync (
17969 GDBusConnection *connection,
17970 GDBusProxyFlags flags,
17971 const gchar *name,
17972 const gchar *object_path,
17973 GCancellable *cancellable,
17974 GError **error)
17975{
17976 GInitable *ret;
17977 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);
17978 if (ret != NULL)
17979 return CONTROL_POWER (ret);
17980 else
17981 return NULL;
17982}
17983
17984
17985/**
17986 * control_power_proxy_new_for_bus:
17987 * @bus_type: A #GBusType.
17988 * @flags: Flags from the #GDBusProxyFlags enumeration.
17989 * @name: A bus name (well-known or unique).
17990 * @object_path: An object path.
17991 * @cancellable: (allow-none): A #GCancellable or %NULL.
17992 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
17993 * @user_data: User data to pass to @callback.
17994 *
17995 * Like control_power_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
17996 *
17997 * 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.
17998 * You can then call control_power_proxy_new_for_bus_finish() to get the result of the operation.
17999 *
18000 * See control_power_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
18001 */
18002void
18003control_power_proxy_new_for_bus (
18004 GBusType bus_type,
18005 GDBusProxyFlags flags,
18006 const gchar *name,
18007 const gchar *object_path,
18008 GCancellable *cancellable,
18009 GAsyncReadyCallback callback,
18010 gpointer user_data)
18011{
18012 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);
18013}
18014
18015/**
18016 * control_power_proxy_new_for_bus_finish:
18017 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_proxy_new_for_bus().
18018 * @error: Return location for error or %NULL
18019 *
18020 * Finishes an operation started with control_power_proxy_new_for_bus().
18021 *
18022 * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set.
18023 */
18024ControlPower *
18025control_power_proxy_new_for_bus_finish (
18026 GAsyncResult *res,
18027 GError **error)
18028{
18029 GObject *ret;
18030 GObject *source_object;
18031 source_object = g_async_result_get_source_object (res);
18032 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
18033 g_object_unref (source_object);
18034 if (ret != NULL)
18035 return CONTROL_POWER (ret);
18036 else
18037 return NULL;
18038}
18039
18040/**
18041 * control_power_proxy_new_for_bus_sync:
18042 * @bus_type: A #GBusType.
18043 * @flags: Flags from the #GDBusProxyFlags enumeration.
18044 * @name: A bus name (well-known or unique).
18045 * @object_path: An object path.
18046 * @cancellable: (allow-none): A #GCancellable or %NULL.
18047 * @error: Return location for error or %NULL
18048 *
18049 * Like control_power_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
18050 *
18051 * The calling thread is blocked until a reply is received.
18052 *
18053 * See control_power_proxy_new_for_bus() for the asynchronous version of this constructor.
18054 *
18055 * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set.
18056 */
18057ControlPower *
18058control_power_proxy_new_for_bus_sync (
18059 GBusType bus_type,
18060 GDBusProxyFlags flags,
18061 const gchar *name,
18062 const gchar *object_path,
18063 GCancellable *cancellable,
18064 GError **error)
18065{
18066 GInitable *ret;
18067 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);
18068 if (ret != NULL)
18069 return CONTROL_POWER (ret);
18070 else
18071 return NULL;
18072}
18073
18074
18075/* ------------------------------------------------------------------------ */
18076
18077/**
18078 * ControlPowerSkeleton:
18079 *
18080 * The #ControlPowerSkeleton structure contains only private data and should only be accessed using the provided API.
18081 */
18082
18083/**
18084 * ControlPowerSkeletonClass:
18085 * @parent_class: The parent class.
18086 *
18087 * Class structure for #ControlPowerSkeleton.
18088 */
18089
18090struct _ControlPowerSkeletonPrivate
18091{
18092 GValue *properties;
18093 GList *changed_properties;
18094 GSource *changed_properties_idle_source;
18095 GMainContext *context;
18096 GMutex lock;
18097};
18098
18099static void
18100_control_power_skeleton_handle_method_call (
18101 GDBusConnection *connection G_GNUC_UNUSED,
18102 const gchar *sender G_GNUC_UNUSED,
18103 const gchar *object_path G_GNUC_UNUSED,
18104 const gchar *interface_name,
18105 const gchar *method_name,
18106 GVariant *parameters,
18107 GDBusMethodInvocation *invocation,
18108 gpointer user_data)
18109{
18110 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data);
18111 _ExtendedGDBusMethodInfo *info;
18112 GVariantIter iter;
18113 GVariant *child;
18114 GValue *paramv;
18115 guint num_params;
18116 guint num_extra;
18117 guint n;
18118 guint signal_id;
18119 GValue return_value = G_VALUE_INIT;
18120 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
18121 g_assert (info != NULL);
18122 num_params = g_variant_n_children (parameters);
18123 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
18124 n = 0;
18125 g_value_init (&paramv[n], TYPE_CONTROL_POWER);
18126 g_value_set_object (&paramv[n++], skeleton);
18127 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
18128 g_value_set_object (&paramv[n++], invocation);
18129 if (info->pass_fdlist)
18130 {
18131#ifdef G_OS_UNIX
18132 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
18133 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
18134#else
18135 g_assert_not_reached ();
18136#endif
18137 }
18138 g_variant_iter_init (&iter, parameters);
18139 while ((child = g_variant_iter_next_value (&iter)) != NULL)
18140 {
18141 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
18142 if (arg_info->use_gvariant)
18143 {
18144 g_value_init (&paramv[n], G_TYPE_VARIANT);
18145 g_value_set_variant (&paramv[n], child);
18146 n++;
18147 }
18148 else
18149 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
18150 g_variant_unref (child);
18151 }
18152 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_POWER);
18153 g_value_init (&return_value, G_TYPE_BOOLEAN);
18154 g_signal_emitv (paramv, signal_id, 0, &return_value);
18155 if (!g_value_get_boolean (&return_value))
18156 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);
18157 g_value_unset (&return_value);
18158 for (n = 0; n < num_params + num_extra; n++)
18159 g_value_unset (&paramv[n]);
18160 g_free (paramv);
18161}
18162
18163static GVariant *
18164_control_power_skeleton_handle_get_property (
18165 GDBusConnection *connection G_GNUC_UNUSED,
18166 const gchar *sender G_GNUC_UNUSED,
18167 const gchar *object_path G_GNUC_UNUSED,
18168 const gchar *interface_name G_GNUC_UNUSED,
18169 const gchar *property_name,
18170 GError **error,
18171 gpointer user_data)
18172{
18173 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data);
18174 GValue value = G_VALUE_INIT;
18175 GParamSpec *pspec;
18176 _ExtendedGDBusPropertyInfo *info;
18177 GVariant *ret;
18178 ret = NULL;
18179 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, property_name);
18180 g_assert (info != NULL);
18181 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
18182 if (pspec == NULL)
18183 {
18184 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
18185 }
18186 else
18187 {
18188 g_value_init (&value, pspec->value_type);
18189 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
18190 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
18191 g_value_unset (&value);
18192 }
18193 return ret;
18194}
18195
18196static gboolean
18197_control_power_skeleton_handle_set_property (
18198 GDBusConnection *connection G_GNUC_UNUSED,
18199 const gchar *sender G_GNUC_UNUSED,
18200 const gchar *object_path G_GNUC_UNUSED,
18201 const gchar *interface_name G_GNUC_UNUSED,
18202 const gchar *property_name,
18203 GVariant *variant,
18204 GError **error,
18205 gpointer user_data)
18206{
18207 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data);
18208 GValue value = G_VALUE_INIT;
18209 GParamSpec *pspec;
18210 _ExtendedGDBusPropertyInfo *info;
18211 gboolean ret;
18212 ret = FALSE;
18213 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, property_name);
18214 g_assert (info != NULL);
18215 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
18216 if (pspec == NULL)
18217 {
18218 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
18219 }
18220 else
18221 {
18222 if (info->use_gvariant)
18223 g_value_set_variant (&value, variant);
18224 else
18225 g_dbus_gvariant_to_gvalue (variant, &value);
18226 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
18227 g_value_unset (&value);
18228 ret = TRUE;
18229 }
18230 return ret;
18231}
18232
18233static const GDBusInterfaceVTable _control_power_skeleton_vtable =
18234{
18235 _control_power_skeleton_handle_method_call,
18236 _control_power_skeleton_handle_get_property,
18237 _control_power_skeleton_handle_set_property,
18238 {NULL}
18239};
18240
18241static GDBusInterfaceInfo *
18242control_power_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
18243{
18244 return control_power_interface_info ();
18245}
18246
18247static GDBusInterfaceVTable *
18248control_power_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
18249{
18250 return (GDBusInterfaceVTable *) &_control_power_skeleton_vtable;
18251}
18252
18253static GVariant *
18254control_power_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
18255{
18256 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (_skeleton);
18257
18258 GVariantBuilder builder;
18259 guint n;
18260 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
18261 if (_control_power_interface_info.parent_struct.properties == NULL)
18262 goto out;
18263 for (n = 0; _control_power_interface_info.parent_struct.properties[n] != NULL; n++)
18264 {
18265 GDBusPropertyInfo *info = _control_power_interface_info.parent_struct.properties[n];
18266 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
18267 {
18268 GVariant *value;
18269 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);
18270 if (value != NULL)
18271 {
18272 g_variant_take_ref (value);
18273 g_variant_builder_add (&builder, "{sv}", info->name, value);
18274 g_variant_unref (value);
18275 }
18276 }
18277 }
18278out:
18279 return g_variant_builder_end (&builder);
18280}
18281
18282static gboolean _control_power_emit_changed (gpointer user_data);
18283
18284static void
18285control_power_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
18286{
18287 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (_skeleton);
18288 gboolean emit_changed = FALSE;
18289
18290 g_mutex_lock (&skeleton->priv->lock);
18291 if (skeleton->priv->changed_properties_idle_source != NULL)
18292 {
18293 g_source_destroy (skeleton->priv->changed_properties_idle_source);
18294 skeleton->priv->changed_properties_idle_source = NULL;
18295 emit_changed = TRUE;
18296 }
18297 g_mutex_unlock (&skeleton->priv->lock);
18298
18299 if (emit_changed)
18300 _control_power_emit_changed (skeleton);
18301}
18302
18303static void
18304_control_power_on_signal_power_good (
18305 ControlPower *object)
18306{
18307 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
18308
18309 GList *connections, *l;
18310 GVariant *signal_variant;
18311 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
18312
18313 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
18314 for (l = connections; l != NULL; l = l->next)
18315 {
18316 GDBusConnection *connection = l->data;
18317 g_dbus_connection_emit_signal (connection,
18318 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.control.Power", "PowerGood",
18319 signal_variant, NULL);
18320 }
18321 g_variant_unref (signal_variant);
18322 g_list_free_full (connections, g_object_unref);
18323}
18324
18325static void
18326_control_power_on_signal_power_lost (
18327 ControlPower *object)
18328{
18329 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
18330
18331 GList *connections, *l;
18332 GVariant *signal_variant;
18333 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
18334
18335 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
18336 for (l = connections; l != NULL; l = l->next)
18337 {
18338 GDBusConnection *connection = l->data;
18339 g_dbus_connection_emit_signal (connection,
18340 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.control.Power", "PowerLost",
18341 signal_variant, NULL);
18342 }
18343 g_variant_unref (signal_variant);
18344 g_list_free_full (connections, g_object_unref);
18345}
18346
18347static void control_power_skeleton_iface_init (ControlPowerIface *iface);
18348#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
18349G_DEFINE_TYPE_WITH_CODE (ControlPowerSkeleton, control_power_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
18350 G_ADD_PRIVATE (ControlPowerSkeleton)
18351 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_skeleton_iface_init));
18352
18353#else
18354G_DEFINE_TYPE_WITH_CODE (ControlPowerSkeleton, control_power_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
18355 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_skeleton_iface_init));
18356
18357#endif
18358static void
18359control_power_skeleton_finalize (GObject *object)
18360{
18361 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
18362 guint n;
Norman James32e74e22015-09-15 21:28:06 -050018363 for (n = 0; n < 3; n++)
Norman James362a80f2015-09-14 14:04:39 -050018364 g_value_unset (&skeleton->priv->properties[n]);
18365 g_free (skeleton->priv->properties);
18366 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
18367 if (skeleton->priv->changed_properties_idle_source != NULL)
18368 g_source_destroy (skeleton->priv->changed_properties_idle_source);
18369 g_main_context_unref (skeleton->priv->context);
18370 g_mutex_clear (&skeleton->priv->lock);
18371 G_OBJECT_CLASS (control_power_skeleton_parent_class)->finalize (object);
18372}
18373
18374static void
18375control_power_skeleton_get_property (GObject *object,
18376 guint prop_id,
18377 GValue *value,
18378 GParamSpec *pspec G_GNUC_UNUSED)
18379{
18380 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
Norman James32e74e22015-09-15 21:28:06 -050018381 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -050018382 g_mutex_lock (&skeleton->priv->lock);
18383 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
18384 g_mutex_unlock (&skeleton->priv->lock);
18385}
18386
18387static gboolean
18388_control_power_emit_changed (gpointer user_data)
18389{
18390 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data);
18391 GList *l;
18392 GVariantBuilder builder;
18393 GVariantBuilder invalidated_builder;
18394 guint num_changes;
18395
18396 g_mutex_lock (&skeleton->priv->lock);
18397 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
18398 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
18399 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
18400 {
18401 ChangedProperty *cp = l->data;
18402 GVariant *variant;
18403 const GValue *cur_value;
18404
18405 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
18406 if (!_g_value_equal (cur_value, &cp->orig_value))
18407 {
18408 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
18409 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
18410 g_variant_unref (variant);
18411 num_changes++;
18412 }
18413 }
18414 if (num_changes > 0)
18415 {
18416 GList *connections, *ll;
18417 GVariant *signal_variant;
18418 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.control.Power",
18419 &builder, &invalidated_builder));
18420 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
18421 for (ll = connections; ll != NULL; ll = ll->next)
18422 {
18423 GDBusConnection *connection = ll->data;
18424
18425 g_dbus_connection_emit_signal (connection,
18426 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
18427 "org.freedesktop.DBus.Properties",
18428 "PropertiesChanged",
18429 signal_variant,
18430 NULL);
18431 }
18432 g_variant_unref (signal_variant);
18433 g_list_free_full (connections, g_object_unref);
18434 }
18435 else
18436 {
18437 g_variant_builder_clear (&builder);
18438 g_variant_builder_clear (&invalidated_builder);
18439 }
18440 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
18441 skeleton->priv->changed_properties = NULL;
18442 skeleton->priv->changed_properties_idle_source = NULL;
18443 g_mutex_unlock (&skeleton->priv->lock);
18444 return FALSE;
18445}
18446
18447static void
18448_control_power_schedule_emit_changed (ControlPowerSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
18449{
18450 ChangedProperty *cp;
18451 GList *l;
18452 cp = NULL;
18453 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
18454 {
18455 ChangedProperty *i_cp = l->data;
18456 if (i_cp->info == info)
18457 {
18458 cp = i_cp;
18459 break;
18460 }
18461 }
18462 if (cp == NULL)
18463 {
18464 cp = g_new0 (ChangedProperty, 1);
18465 cp->prop_id = prop_id;
18466 cp->info = info;
18467 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
18468 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
18469 g_value_copy (orig_value, &cp->orig_value);
18470 }
18471}
18472
18473static void
18474control_power_skeleton_notify (GObject *object,
18475 GParamSpec *pspec G_GNUC_UNUSED)
18476{
18477 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
18478 g_mutex_lock (&skeleton->priv->lock);
18479 if (skeleton->priv->changed_properties != NULL &&
18480 skeleton->priv->changed_properties_idle_source == NULL)
18481 {
18482 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
18483 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
18484 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _control_power_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
18485 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
18486 g_source_unref (skeleton->priv->changed_properties_idle_source);
18487 }
18488 g_mutex_unlock (&skeleton->priv->lock);
18489}
18490
18491static void
18492control_power_skeleton_set_property (GObject *object,
18493 guint prop_id,
18494 const GValue *value,
18495 GParamSpec *pspec)
18496{
18497 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
Norman James32e74e22015-09-15 21:28:06 -050018498 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -050018499 g_mutex_lock (&skeleton->priv->lock);
18500 g_object_freeze_notify (object);
18501 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
18502 {
18503 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
18504 _control_power_schedule_emit_changed (skeleton, _control_power_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
18505 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
18506 g_object_notify_by_pspec (object, pspec);
18507 }
18508 g_mutex_unlock (&skeleton->priv->lock);
18509 g_object_thaw_notify (object);
18510}
18511
18512static void
18513control_power_skeleton_init (ControlPowerSkeleton *skeleton)
18514{
18515#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
18516 skeleton->priv = control_power_skeleton_get_instance_private (skeleton);
18517#else
18518 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_POWER_SKELETON, ControlPowerSkeletonPrivate);
18519#endif
18520
18521 g_mutex_init (&skeleton->priv->lock);
18522 skeleton->priv->context = g_main_context_ref_thread_default ();
Norman James32e74e22015-09-15 21:28:06 -050018523 skeleton->priv->properties = g_new0 (GValue, 3);
Norman James362a80f2015-09-14 14:04:39 -050018524 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
18525 g_value_init (&skeleton->priv->properties[1], G_TYPE_INT);
Norman James32e74e22015-09-15 21:28:06 -050018526 g_value_init (&skeleton->priv->properties[2], G_TYPE_INT);
Norman James362a80f2015-09-14 14:04:39 -050018527}
18528
18529static gint
18530control_power_skeleton_get_pgood (ControlPower *object)
18531{
18532 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
18533 gint value;
18534 g_mutex_lock (&skeleton->priv->lock);
18535 value = g_value_get_int (&(skeleton->priv->properties[0]));
18536 g_mutex_unlock (&skeleton->priv->lock);
18537 return value;
18538}
18539
18540static gint
18541control_power_skeleton_get_state (ControlPower *object)
18542{
18543 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
18544 gint value;
18545 g_mutex_lock (&skeleton->priv->lock);
18546 value = g_value_get_int (&(skeleton->priv->properties[1]));
18547 g_mutex_unlock (&skeleton->priv->lock);
18548 return value;
18549}
18550
Norman James32e74e22015-09-15 21:28:06 -050018551static gint
18552control_power_skeleton_get_pgood_timeout (ControlPower *object)
18553{
18554 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
18555 gint value;
18556 g_mutex_lock (&skeleton->priv->lock);
18557 value = g_value_get_int (&(skeleton->priv->properties[2]));
18558 g_mutex_unlock (&skeleton->priv->lock);
18559 return value;
18560}
18561
Norman James362a80f2015-09-14 14:04:39 -050018562static void
18563control_power_skeleton_class_init (ControlPowerSkeletonClass *klass)
18564{
18565 GObjectClass *gobject_class;
18566 GDBusInterfaceSkeletonClass *skeleton_class;
18567
18568 gobject_class = G_OBJECT_CLASS (klass);
18569 gobject_class->finalize = control_power_skeleton_finalize;
18570 gobject_class->get_property = control_power_skeleton_get_property;
18571 gobject_class->set_property = control_power_skeleton_set_property;
18572 gobject_class->notify = control_power_skeleton_notify;
18573
18574
18575 control_power_override_properties (gobject_class, 1);
18576
18577 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
18578 skeleton_class->get_info = control_power_skeleton_dbus_interface_get_info;
18579 skeleton_class->get_properties = control_power_skeleton_dbus_interface_get_properties;
18580 skeleton_class->flush = control_power_skeleton_dbus_interface_flush;
18581 skeleton_class->get_vtable = control_power_skeleton_dbus_interface_get_vtable;
18582
18583#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
18584 g_type_class_add_private (klass, sizeof (ControlPowerSkeletonPrivate));
18585#endif
18586}
18587
18588static void
18589control_power_skeleton_iface_init (ControlPowerIface *iface)
18590{
18591 iface->power_good = _control_power_on_signal_power_good;
18592 iface->power_lost = _control_power_on_signal_power_lost;
18593 iface->get_pgood = control_power_skeleton_get_pgood;
18594 iface->get_state = control_power_skeleton_get_state;
Norman James32e74e22015-09-15 21:28:06 -050018595 iface->get_pgood_timeout = control_power_skeleton_get_pgood_timeout;
Norman James362a80f2015-09-14 14:04:39 -050018596}
18597
18598/**
18599 * control_power_skeleton_new:
18600 *
18601 * 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>.
18602 *
18603 * Returns: (transfer full) (type ControlPowerSkeleton): The skeleton object.
18604 */
18605ControlPower *
18606control_power_skeleton_new (void)
18607{
18608 return CONTROL_POWER (g_object_new (TYPE_CONTROL_POWER_SKELETON, NULL));
18609}
18610
18611/* ------------------------------------------------------------------------
18612 * Code for interface org.openbmc.Watchdog
18613 * ------------------------------------------------------------------------
18614 */
18615
18616/**
18617 * SECTION:Watchdog
18618 * @title: Watchdog
18619 * @short_description: Generated C code for the org.openbmc.Watchdog D-Bus interface
18620 *
18621 * 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.
18622 */
18623
18624/* ---- Introspection data for org.openbmc.Watchdog ---- */
18625
18626static const _ExtendedGDBusMethodInfo _watchdog_method_info_start =
18627{
18628 {
18629 -1,
18630 (gchar *) "start",
18631 NULL,
18632 NULL,
18633 NULL
18634 },
18635 "handle-start",
18636 FALSE
18637};
18638
18639static const _ExtendedGDBusMethodInfo _watchdog_method_info_poke =
18640{
18641 {
18642 -1,
18643 (gchar *) "poke",
18644 NULL,
18645 NULL,
18646 NULL
18647 },
18648 "handle-poke",
18649 FALSE
18650};
18651
18652static const _ExtendedGDBusMethodInfo _watchdog_method_info_stop =
18653{
18654 {
18655 -1,
18656 (gchar *) "stop",
18657 NULL,
18658 NULL,
18659 NULL
18660 },
18661 "handle-stop",
18662 FALSE
18663};
18664
Adriana Kobylak2cb27752015-10-19 16:23:14 -050018665static const _ExtendedGDBusArgInfo _watchdog_method_info_set_IN_ARG_interval =
18666{
18667 {
18668 -1,
18669 (gchar *) "interval",
18670 (gchar *) "i",
18671 NULL
18672 },
18673 FALSE
18674};
18675
18676static const _ExtendedGDBusArgInfo * const _watchdog_method_info_set_IN_ARG_pointers[] =
18677{
18678 &_watchdog_method_info_set_IN_ARG_interval,
18679 NULL
18680};
18681
18682static const _ExtendedGDBusMethodInfo _watchdog_method_info_set =
18683{
18684 {
18685 -1,
18686 (gchar *) "set",
18687 (GDBusArgInfo **) &_watchdog_method_info_set_IN_ARG_pointers,
18688 NULL,
18689 NULL
18690 },
18691 "handle-set",
18692 FALSE
18693};
18694
Norman James362a80f2015-09-14 14:04:39 -050018695static const _ExtendedGDBusMethodInfo * const _watchdog_method_info_pointers[] =
18696{
18697 &_watchdog_method_info_start,
18698 &_watchdog_method_info_poke,
18699 &_watchdog_method_info_stop,
Adriana Kobylak2cb27752015-10-19 16:23:14 -050018700 &_watchdog_method_info_set,
Norman James362a80f2015-09-14 14:04:39 -050018701 NULL
18702};
18703
18704static const _ExtendedGDBusSignalInfo _watchdog_signal_info_watchdog_error =
18705{
18706 {
18707 -1,
18708 (gchar *) "WatchdogError",
18709 NULL,
18710 NULL
18711 },
18712 "watchdog-error"
18713};
18714
18715static const _ExtendedGDBusSignalInfo * const _watchdog_signal_info_pointers[] =
18716{
18717 &_watchdog_signal_info_watchdog_error,
18718 NULL
18719};
18720
18721static const _ExtendedGDBusPropertyInfo _watchdog_property_info_watchdog =
18722{
18723 {
18724 -1,
18725 (gchar *) "watchdog",
18726 (gchar *) "i",
18727 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
18728 NULL
18729 },
18730 "watchdog",
18731 FALSE
18732};
18733
18734static const _ExtendedGDBusPropertyInfo _watchdog_property_info_poll_interval =
18735{
18736 {
18737 -1,
18738 (gchar *) "poll_interval",
18739 (gchar *) "i",
18740 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
18741 NULL
18742 },
18743 "poll-interval",
18744 FALSE
18745};
18746
18747static const _ExtendedGDBusPropertyInfo * const _watchdog_property_info_pointers[] =
18748{
18749 &_watchdog_property_info_watchdog,
18750 &_watchdog_property_info_poll_interval,
18751 NULL
18752};
18753
18754static const _ExtendedGDBusInterfaceInfo _watchdog_interface_info =
18755{
18756 {
18757 -1,
18758 (gchar *) "org.openbmc.Watchdog",
18759 (GDBusMethodInfo **) &_watchdog_method_info_pointers,
18760 (GDBusSignalInfo **) &_watchdog_signal_info_pointers,
18761 (GDBusPropertyInfo **) &_watchdog_property_info_pointers,
18762 NULL
18763 },
18764 "watchdog",
18765};
18766
18767
18768/**
18769 * watchdog_interface_info:
18770 *
18771 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link> D-Bus interface.
18772 *
18773 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
18774 */
18775GDBusInterfaceInfo *
18776watchdog_interface_info (void)
18777{
18778 return (GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct;
18779}
18780
18781/**
18782 * watchdog_override_properties:
18783 * @klass: The class structure for a #GObject<!-- -->-derived class.
18784 * @property_id_begin: The property id to assign to the first overridden property.
18785 *
18786 * Overrides all #GObject properties in the #Watchdog interface for a concrete class.
18787 * The properties are overridden in the order they are defined.
18788 *
18789 * Returns: The last property id.
18790 */
18791guint
18792watchdog_override_properties (GObjectClass *klass, guint property_id_begin)
18793{
18794 g_object_class_override_property (klass, property_id_begin++, "watchdog");
18795 g_object_class_override_property (klass, property_id_begin++, "poll-interval");
18796 return property_id_begin - 1;
18797}
18798
18799
18800
18801/**
18802 * Watchdog:
18803 *
18804 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link>.
18805 */
18806
18807/**
18808 * WatchdogIface:
18809 * @parent_iface: The parent interface.
18810 * @handle_poke: Handler for the #Watchdog::handle-poke signal.
Adriana Kobylak2cb27752015-10-19 16:23:14 -050018811 * @handle_set: Handler for the #Watchdog::handle-set signal.
Norman James362a80f2015-09-14 14:04:39 -050018812 * @handle_start: Handler for the #Watchdog::handle-start signal.
18813 * @handle_stop: Handler for the #Watchdog::handle-stop signal.
18814 * @get_poll_interval: Getter for the #Watchdog:poll-interval property.
18815 * @get_watchdog: Getter for the #Watchdog:watchdog property.
18816 * @watchdog_error: Handler for the #Watchdog::watchdog-error signal.
18817 *
18818 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link>.
18819 */
18820
18821typedef WatchdogIface WatchdogInterface;
18822G_DEFINE_INTERFACE (Watchdog, watchdog, G_TYPE_OBJECT);
18823
18824static void
18825watchdog_default_init (WatchdogIface *iface)
18826{
18827 /* GObject signals for incoming D-Bus method calls: */
18828 /**
18829 * Watchdog::handle-start:
18830 * @object: A #Watchdog.
18831 * @invocation: A #GDBusMethodInvocation.
18832 *
18833 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Watchdog.start">start()</link> D-Bus method.
18834 *
18835 * 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.
18836 *
18837 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
18838 */
18839 g_signal_new ("handle-start",
18840 G_TYPE_FROM_INTERFACE (iface),
18841 G_SIGNAL_RUN_LAST,
18842 G_STRUCT_OFFSET (WatchdogIface, handle_start),
18843 g_signal_accumulator_true_handled,
18844 NULL,
18845 g_cclosure_marshal_generic,
18846 G_TYPE_BOOLEAN,
18847 1,
18848 G_TYPE_DBUS_METHOD_INVOCATION);
18849
18850 /**
18851 * Watchdog::handle-poke:
18852 * @object: A #Watchdog.
18853 * @invocation: A #GDBusMethodInvocation.
18854 *
18855 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Watchdog.poke">poke()</link> D-Bus method.
18856 *
18857 * 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.
18858 *
18859 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
18860 */
18861 g_signal_new ("handle-poke",
18862 G_TYPE_FROM_INTERFACE (iface),
18863 G_SIGNAL_RUN_LAST,
18864 G_STRUCT_OFFSET (WatchdogIface, handle_poke),
18865 g_signal_accumulator_true_handled,
18866 NULL,
18867 g_cclosure_marshal_generic,
18868 G_TYPE_BOOLEAN,
18869 1,
18870 G_TYPE_DBUS_METHOD_INVOCATION);
18871
18872 /**
18873 * Watchdog::handle-stop:
18874 * @object: A #Watchdog.
18875 * @invocation: A #GDBusMethodInvocation.
18876 *
18877 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Watchdog.stop">stop()</link> D-Bus method.
18878 *
18879 * 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.
18880 *
18881 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
18882 */
18883 g_signal_new ("handle-stop",
18884 G_TYPE_FROM_INTERFACE (iface),
18885 G_SIGNAL_RUN_LAST,
18886 G_STRUCT_OFFSET (WatchdogIface, handle_stop),
18887 g_signal_accumulator_true_handled,
18888 NULL,
18889 g_cclosure_marshal_generic,
18890 G_TYPE_BOOLEAN,
18891 1,
18892 G_TYPE_DBUS_METHOD_INVOCATION);
18893
Adriana Kobylak2cb27752015-10-19 16:23:14 -050018894 /**
18895 * Watchdog::handle-set:
18896 * @object: A #Watchdog.
18897 * @invocation: A #GDBusMethodInvocation.
18898 * @arg_interval: Argument passed by remote caller.
18899 *
18900 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Watchdog.set">set()</link> D-Bus method.
18901 *
18902 * 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.
18903 *
18904 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
18905 */
18906 g_signal_new ("handle-set",
18907 G_TYPE_FROM_INTERFACE (iface),
18908 G_SIGNAL_RUN_LAST,
18909 G_STRUCT_OFFSET (WatchdogIface, handle_set),
18910 g_signal_accumulator_true_handled,
18911 NULL,
18912 g_cclosure_marshal_generic,
18913 G_TYPE_BOOLEAN,
18914 2,
18915 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT);
18916
Norman James362a80f2015-09-14 14:04:39 -050018917 /* GObject signals for received D-Bus signals: */
18918 /**
18919 * Watchdog::watchdog-error:
18920 * @object: A #Watchdog.
18921 *
18922 * 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.
18923 *
18924 * 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.
18925 */
18926 g_signal_new ("watchdog-error",
18927 G_TYPE_FROM_INTERFACE (iface),
18928 G_SIGNAL_RUN_LAST,
18929 G_STRUCT_OFFSET (WatchdogIface, watchdog_error),
18930 NULL,
18931 NULL,
18932 g_cclosure_marshal_generic,
18933 G_TYPE_NONE,
18934 0);
18935
18936 /* GObject properties for D-Bus properties: */
18937 /**
18938 * Watchdog:watchdog:
18939 *
18940 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Watchdog.watchdog">"watchdog"</link>.
18941 *
18942 * 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.
18943 */
18944 g_object_interface_install_property (iface,
18945 g_param_spec_int ("watchdog", "watchdog", "watchdog", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
18946 /**
18947 * Watchdog:poll-interval:
18948 *
18949 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Watchdog.poll_interval">"poll_interval"</link>.
18950 *
18951 * 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.
18952 */
18953 g_object_interface_install_property (iface,
18954 g_param_spec_int ("poll-interval", "poll_interval", "poll_interval", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
18955}
18956
18957/**
18958 * watchdog_get_watchdog: (skip)
18959 * @object: A #Watchdog.
18960 *
18961 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Watchdog.watchdog">"watchdog"</link> D-Bus property.
18962 *
18963 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
18964 *
18965 * Returns: The property value.
18966 */
18967gint
18968watchdog_get_watchdog (Watchdog *object)
18969{
18970 return WATCHDOG_GET_IFACE (object)->get_watchdog (object);
18971}
18972
18973/**
18974 * watchdog_set_watchdog: (skip)
18975 * @object: A #Watchdog.
18976 * @value: The value to set.
18977 *
18978 * Sets the <link linkend="gdbus-property-org-openbmc-Watchdog.watchdog">"watchdog"</link> D-Bus property to @value.
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 */
18982void
18983watchdog_set_watchdog (Watchdog *object, gint value)
18984{
18985 g_object_set (G_OBJECT (object), "watchdog", value, NULL);
18986}
18987
18988/**
18989 * watchdog_get_poll_interval: (skip)
18990 * @object: A #Watchdog.
18991 *
18992 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Watchdog.poll_interval">"poll_interval"</link> D-Bus property.
18993 *
18994 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
18995 *
18996 * Returns: The property value.
18997 */
18998gint
18999watchdog_get_poll_interval (Watchdog *object)
19000{
19001 return WATCHDOG_GET_IFACE (object)->get_poll_interval (object);
19002}
19003
19004/**
19005 * watchdog_set_poll_interval: (skip)
19006 * @object: A #Watchdog.
19007 * @value: The value to set.
19008 *
19009 * Sets the <link linkend="gdbus-property-org-openbmc-Watchdog.poll_interval">"poll_interval"</link> D-Bus property to @value.
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 */
19013void
19014watchdog_set_poll_interval (Watchdog *object, gint value)
19015{
19016 g_object_set (G_OBJECT (object), "poll-interval", value, NULL);
19017}
19018
19019/**
19020 * watchdog_emit_watchdog_error:
19021 * @object: A #Watchdog.
19022 *
19023 * Emits the <link linkend="gdbus-signal-org-openbmc-Watchdog.WatchdogError">"WatchdogError"</link> D-Bus signal.
19024 */
19025void
19026watchdog_emit_watchdog_error (
19027 Watchdog *object)
19028{
19029 g_signal_emit_by_name (object, "watchdog-error");
19030}
19031
19032/**
19033 * watchdog_call_start:
19034 * @proxy: A #WatchdogProxy.
19035 * @cancellable: (allow-none): A #GCancellable or %NULL.
19036 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
19037 * @user_data: User data to pass to @callback.
19038 *
19039 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.start">start()</link> D-Bus method on @proxy.
19040 * 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.
19041 * You can then call watchdog_call_start_finish() to get the result of the operation.
19042 *
19043 * See watchdog_call_start_sync() for the synchronous, blocking version of this method.
19044 */
19045void
19046watchdog_call_start (
19047 Watchdog *proxy,
19048 GCancellable *cancellable,
19049 GAsyncReadyCallback callback,
19050 gpointer user_data)
19051{
19052 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
19053 "start",
19054 g_variant_new ("()"),
19055 G_DBUS_CALL_FLAGS_NONE,
19056 -1,
19057 cancellable,
19058 callback,
19059 user_data);
19060}
19061
19062/**
19063 * watchdog_call_start_finish:
19064 * @proxy: A #WatchdogProxy.
19065 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_call_start().
19066 * @error: Return location for error or %NULL.
19067 *
19068 * Finishes an operation started with watchdog_call_start().
19069 *
19070 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19071 */
19072gboolean
19073watchdog_call_start_finish (
19074 Watchdog *proxy,
19075 GAsyncResult *res,
19076 GError **error)
19077{
19078 GVariant *_ret;
19079 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
19080 if (_ret == NULL)
19081 goto _out;
19082 g_variant_get (_ret,
19083 "()");
19084 g_variant_unref (_ret);
19085_out:
19086 return _ret != NULL;
19087}
19088
19089/**
19090 * watchdog_call_start_sync:
19091 * @proxy: A #WatchdogProxy.
19092 * @cancellable: (allow-none): A #GCancellable or %NULL.
19093 * @error: Return location for error or %NULL.
19094 *
19095 * 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.
19096 *
19097 * See watchdog_call_start() for the asynchronous version of this method.
19098 *
19099 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19100 */
19101gboolean
19102watchdog_call_start_sync (
19103 Watchdog *proxy,
19104 GCancellable *cancellable,
19105 GError **error)
19106{
19107 GVariant *_ret;
19108 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
19109 "start",
19110 g_variant_new ("()"),
19111 G_DBUS_CALL_FLAGS_NONE,
19112 -1,
19113 cancellable,
19114 error);
19115 if (_ret == NULL)
19116 goto _out;
19117 g_variant_get (_ret,
19118 "()");
19119 g_variant_unref (_ret);
19120_out:
19121 return _ret != NULL;
19122}
19123
19124/**
19125 * watchdog_call_poke:
19126 * @proxy: A #WatchdogProxy.
19127 * @cancellable: (allow-none): A #GCancellable or %NULL.
19128 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
19129 * @user_data: User data to pass to @callback.
19130 *
19131 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.poke">poke()</link> D-Bus method on @proxy.
19132 * 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.
19133 * You can then call watchdog_call_poke_finish() to get the result of the operation.
19134 *
19135 * See watchdog_call_poke_sync() for the synchronous, blocking version of this method.
19136 */
19137void
19138watchdog_call_poke (
19139 Watchdog *proxy,
19140 GCancellable *cancellable,
19141 GAsyncReadyCallback callback,
19142 gpointer user_data)
19143{
19144 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
19145 "poke",
19146 g_variant_new ("()"),
19147 G_DBUS_CALL_FLAGS_NONE,
19148 -1,
19149 cancellable,
19150 callback,
19151 user_data);
19152}
19153
19154/**
19155 * watchdog_call_poke_finish:
19156 * @proxy: A #WatchdogProxy.
19157 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_call_poke().
19158 * @error: Return location for error or %NULL.
19159 *
19160 * Finishes an operation started with watchdog_call_poke().
19161 *
19162 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19163 */
19164gboolean
19165watchdog_call_poke_finish (
19166 Watchdog *proxy,
19167 GAsyncResult *res,
19168 GError **error)
19169{
19170 GVariant *_ret;
19171 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
19172 if (_ret == NULL)
19173 goto _out;
19174 g_variant_get (_ret,
19175 "()");
19176 g_variant_unref (_ret);
19177_out:
19178 return _ret != NULL;
19179}
19180
19181/**
19182 * watchdog_call_poke_sync:
19183 * @proxy: A #WatchdogProxy.
19184 * @cancellable: (allow-none): A #GCancellable or %NULL.
19185 * @error: Return location for error or %NULL.
19186 *
19187 * 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.
19188 *
19189 * See watchdog_call_poke() for the asynchronous version of this method.
19190 *
19191 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19192 */
19193gboolean
19194watchdog_call_poke_sync (
19195 Watchdog *proxy,
19196 GCancellable *cancellable,
19197 GError **error)
19198{
19199 GVariant *_ret;
19200 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
19201 "poke",
19202 g_variant_new ("()"),
19203 G_DBUS_CALL_FLAGS_NONE,
19204 -1,
19205 cancellable,
19206 error);
19207 if (_ret == NULL)
19208 goto _out;
19209 g_variant_get (_ret,
19210 "()");
19211 g_variant_unref (_ret);
19212_out:
19213 return _ret != NULL;
19214}
19215
19216/**
19217 * watchdog_call_stop:
19218 * @proxy: A #WatchdogProxy.
19219 * @cancellable: (allow-none): A #GCancellable or %NULL.
19220 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
19221 * @user_data: User data to pass to @callback.
19222 *
19223 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.stop">stop()</link> D-Bus method on @proxy.
19224 * 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.
19225 * You can then call watchdog_call_stop_finish() to get the result of the operation.
19226 *
19227 * See watchdog_call_stop_sync() for the synchronous, blocking version of this method.
19228 */
19229void
19230watchdog_call_stop (
19231 Watchdog *proxy,
19232 GCancellable *cancellable,
19233 GAsyncReadyCallback callback,
19234 gpointer user_data)
19235{
19236 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
19237 "stop",
19238 g_variant_new ("()"),
19239 G_DBUS_CALL_FLAGS_NONE,
19240 -1,
19241 cancellable,
19242 callback,
19243 user_data);
19244}
19245
19246/**
19247 * watchdog_call_stop_finish:
19248 * @proxy: A #WatchdogProxy.
19249 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_call_stop().
19250 * @error: Return location for error or %NULL.
19251 *
19252 * Finishes an operation started with watchdog_call_stop().
19253 *
19254 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19255 */
19256gboolean
19257watchdog_call_stop_finish (
19258 Watchdog *proxy,
19259 GAsyncResult *res,
19260 GError **error)
19261{
19262 GVariant *_ret;
19263 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
19264 if (_ret == NULL)
19265 goto _out;
19266 g_variant_get (_ret,
19267 "()");
19268 g_variant_unref (_ret);
19269_out:
19270 return _ret != NULL;
19271}
19272
19273/**
19274 * watchdog_call_stop_sync:
19275 * @proxy: A #WatchdogProxy.
19276 * @cancellable: (allow-none): A #GCancellable or %NULL.
19277 * @error: Return location for error or %NULL.
19278 *
19279 * 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.
19280 *
19281 * See watchdog_call_stop() for the asynchronous version of this method.
19282 *
19283 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19284 */
19285gboolean
19286watchdog_call_stop_sync (
19287 Watchdog *proxy,
19288 GCancellable *cancellable,
19289 GError **error)
19290{
19291 GVariant *_ret;
19292 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
19293 "stop",
19294 g_variant_new ("()"),
19295 G_DBUS_CALL_FLAGS_NONE,
19296 -1,
19297 cancellable,
19298 error);
19299 if (_ret == NULL)
19300 goto _out;
19301 g_variant_get (_ret,
19302 "()");
19303 g_variant_unref (_ret);
19304_out:
19305 return _ret != NULL;
19306}
19307
19308/**
Adriana Kobylak2cb27752015-10-19 16:23:14 -050019309 * watchdog_call_set:
19310 * @proxy: A #WatchdogProxy.
19311 * @arg_interval: Argument to pass with the method invocation.
19312 * @cancellable: (allow-none): A #GCancellable or %NULL.
19313 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
19314 * @user_data: User data to pass to @callback.
19315 *
19316 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.set">set()</link> D-Bus method on @proxy.
19317 * 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.
19318 * You can then call watchdog_call_set_finish() to get the result of the operation.
19319 *
19320 * See watchdog_call_set_sync() for the synchronous, blocking version of this method.
19321 */
19322void
19323watchdog_call_set (
19324 Watchdog *proxy,
19325 gint arg_interval,
19326 GCancellable *cancellable,
19327 GAsyncReadyCallback callback,
19328 gpointer user_data)
19329{
19330 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
19331 "set",
19332 g_variant_new ("(i)",
19333 arg_interval),
19334 G_DBUS_CALL_FLAGS_NONE,
19335 -1,
19336 cancellable,
19337 callback,
19338 user_data);
19339}
19340
19341/**
19342 * watchdog_call_set_finish:
19343 * @proxy: A #WatchdogProxy.
19344 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_call_set().
19345 * @error: Return location for error or %NULL.
19346 *
19347 * Finishes an operation started with watchdog_call_set().
19348 *
19349 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19350 */
19351gboolean
19352watchdog_call_set_finish (
19353 Watchdog *proxy,
19354 GAsyncResult *res,
19355 GError **error)
19356{
19357 GVariant *_ret;
19358 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
19359 if (_ret == NULL)
19360 goto _out;
19361 g_variant_get (_ret,
19362 "()");
19363 g_variant_unref (_ret);
19364_out:
19365 return _ret != NULL;
19366}
19367
19368/**
19369 * watchdog_call_set_sync:
19370 * @proxy: A #WatchdogProxy.
19371 * @arg_interval: Argument to pass with the method invocation.
19372 * @cancellable: (allow-none): A #GCancellable or %NULL.
19373 * @error: Return location for error or %NULL.
19374 *
19375 * 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.
19376 *
19377 * See watchdog_call_set() for the asynchronous version of this method.
19378 *
19379 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19380 */
19381gboolean
19382watchdog_call_set_sync (
19383 Watchdog *proxy,
19384 gint arg_interval,
19385 GCancellable *cancellable,
19386 GError **error)
19387{
19388 GVariant *_ret;
19389 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
19390 "set",
19391 g_variant_new ("(i)",
19392 arg_interval),
19393 G_DBUS_CALL_FLAGS_NONE,
19394 -1,
19395 cancellable,
19396 error);
19397 if (_ret == NULL)
19398 goto _out;
19399 g_variant_get (_ret,
19400 "()");
19401 g_variant_unref (_ret);
19402_out:
19403 return _ret != NULL;
19404}
19405
19406/**
Norman James362a80f2015-09-14 14:04:39 -050019407 * watchdog_complete_start:
19408 * @object: A #Watchdog.
19409 * @invocation: (transfer full): A #GDBusMethodInvocation.
19410 *
19411 * 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.
19412 *
19413 * This method will free @invocation, you cannot use it afterwards.
19414 */
19415void
19416watchdog_complete_start (
19417 Watchdog *object,
19418 GDBusMethodInvocation *invocation)
19419{
19420 g_dbus_method_invocation_return_value (invocation,
19421 g_variant_new ("()"));
19422}
19423
19424/**
19425 * watchdog_complete_poke:
19426 * @object: A #Watchdog.
19427 * @invocation: (transfer full): A #GDBusMethodInvocation.
19428 *
19429 * 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.
19430 *
19431 * This method will free @invocation, you cannot use it afterwards.
19432 */
19433void
19434watchdog_complete_poke (
19435 Watchdog *object,
19436 GDBusMethodInvocation *invocation)
19437{
19438 g_dbus_method_invocation_return_value (invocation,
19439 g_variant_new ("()"));
19440}
19441
19442/**
19443 * watchdog_complete_stop:
19444 * @object: A #Watchdog.
19445 * @invocation: (transfer full): A #GDBusMethodInvocation.
19446 *
19447 * 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.
19448 *
19449 * This method will free @invocation, you cannot use it afterwards.
19450 */
19451void
19452watchdog_complete_stop (
19453 Watchdog *object,
19454 GDBusMethodInvocation *invocation)
19455{
19456 g_dbus_method_invocation_return_value (invocation,
19457 g_variant_new ("()"));
19458}
19459
Adriana Kobylak2cb27752015-10-19 16:23:14 -050019460/**
19461 * watchdog_complete_set:
19462 * @object: A #Watchdog.
19463 * @invocation: (transfer full): A #GDBusMethodInvocation.
19464 *
19465 * 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.
19466 *
19467 * This method will free @invocation, you cannot use it afterwards.
19468 */
19469void
19470watchdog_complete_set (
19471 Watchdog *object,
19472 GDBusMethodInvocation *invocation)
19473{
19474 g_dbus_method_invocation_return_value (invocation,
19475 g_variant_new ("()"));
19476}
19477
Norman James362a80f2015-09-14 14:04:39 -050019478/* ------------------------------------------------------------------------ */
19479
19480/**
19481 * WatchdogProxy:
19482 *
19483 * The #WatchdogProxy structure contains only private data and should only be accessed using the provided API.
19484 */
19485
19486/**
19487 * WatchdogProxyClass:
19488 * @parent_class: The parent class.
19489 *
19490 * Class structure for #WatchdogProxy.
19491 */
19492
19493struct _WatchdogProxyPrivate
19494{
19495 GData *qdata;
19496};
19497
19498static void watchdog_proxy_iface_init (WatchdogIface *iface);
19499
19500#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
19501G_DEFINE_TYPE_WITH_CODE (WatchdogProxy, watchdog_proxy, G_TYPE_DBUS_PROXY,
19502 G_ADD_PRIVATE (WatchdogProxy)
19503 G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_proxy_iface_init));
19504
19505#else
19506G_DEFINE_TYPE_WITH_CODE (WatchdogProxy, watchdog_proxy, G_TYPE_DBUS_PROXY,
19507 G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_proxy_iface_init));
19508
19509#endif
19510static void
19511watchdog_proxy_finalize (GObject *object)
19512{
19513 WatchdogProxy *proxy = WATCHDOG_PROXY (object);
19514 g_datalist_clear (&proxy->priv->qdata);
19515 G_OBJECT_CLASS (watchdog_proxy_parent_class)->finalize (object);
19516}
19517
19518static void
19519watchdog_proxy_get_property (GObject *object,
19520 guint prop_id,
19521 GValue *value,
19522 GParamSpec *pspec G_GNUC_UNUSED)
19523{
19524 const _ExtendedGDBusPropertyInfo *info;
19525 GVariant *variant;
19526 g_assert (prop_id != 0 && prop_id - 1 < 2);
19527 info = _watchdog_property_info_pointers[prop_id - 1];
19528 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
19529 if (info->use_gvariant)
19530 {
19531 g_value_set_variant (value, variant);
19532 }
19533 else
19534 {
19535 if (variant != NULL)
19536 g_dbus_gvariant_to_gvalue (variant, value);
19537 }
19538 if (variant != NULL)
19539 g_variant_unref (variant);
19540}
19541
19542static void
19543watchdog_proxy_set_property_cb (GDBusProxy *proxy,
19544 GAsyncResult *res,
19545 gpointer user_data)
19546{
19547 const _ExtendedGDBusPropertyInfo *info = user_data;
19548 GError *error;
19549 GVariant *_ret;
19550 error = NULL;
19551 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
19552 if (!_ret)
19553 {
19554 g_warning ("Error setting property '%s' on interface org.openbmc.Watchdog: %s (%s, %d)",
19555 info->parent_struct.name,
19556 error->message, g_quark_to_string (error->domain), error->code);
19557 g_error_free (error);
19558 }
19559 else
19560 {
19561 g_variant_unref (_ret);
19562 }
19563}
19564
19565static void
19566watchdog_proxy_set_property (GObject *object,
19567 guint prop_id,
19568 const GValue *value,
19569 GParamSpec *pspec G_GNUC_UNUSED)
19570{
19571 const _ExtendedGDBusPropertyInfo *info;
19572 GVariant *variant;
19573 g_assert (prop_id != 0 && prop_id - 1 < 2);
19574 info = _watchdog_property_info_pointers[prop_id - 1];
19575 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
19576 g_dbus_proxy_call (G_DBUS_PROXY (object),
19577 "org.freedesktop.DBus.Properties.Set",
19578 g_variant_new ("(ssv)", "org.openbmc.Watchdog", info->parent_struct.name, variant),
19579 G_DBUS_CALL_FLAGS_NONE,
19580 -1,
19581 NULL, (GAsyncReadyCallback) watchdog_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
19582 g_variant_unref (variant);
19583}
19584
19585static void
19586watchdog_proxy_g_signal (GDBusProxy *proxy,
19587 const gchar *sender_name G_GNUC_UNUSED,
19588 const gchar *signal_name,
19589 GVariant *parameters)
19590{
19591 _ExtendedGDBusSignalInfo *info;
19592 GVariantIter iter;
19593 GVariant *child;
19594 GValue *paramv;
19595 guint num_params;
19596 guint n;
19597 guint signal_id;
19598 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, signal_name);
19599 if (info == NULL)
19600 return;
19601 num_params = g_variant_n_children (parameters);
19602 paramv = g_new0 (GValue, num_params + 1);
19603 g_value_init (&paramv[0], TYPE_WATCHDOG);
19604 g_value_set_object (&paramv[0], proxy);
19605 g_variant_iter_init (&iter, parameters);
19606 n = 1;
19607 while ((child = g_variant_iter_next_value (&iter)) != NULL)
19608 {
19609 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
19610 if (arg_info->use_gvariant)
19611 {
19612 g_value_init (&paramv[n], G_TYPE_VARIANT);
19613 g_value_set_variant (&paramv[n], child);
19614 n++;
19615 }
19616 else
19617 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
19618 g_variant_unref (child);
19619 }
19620 signal_id = g_signal_lookup (info->signal_name, TYPE_WATCHDOG);
19621 g_signal_emitv (paramv, signal_id, 0, NULL);
19622 for (n = 0; n < num_params + 1; n++)
19623 g_value_unset (&paramv[n]);
19624 g_free (paramv);
19625}
19626
19627static void
19628watchdog_proxy_g_properties_changed (GDBusProxy *_proxy,
19629 GVariant *changed_properties,
19630 const gchar *const *invalidated_properties)
19631{
19632 WatchdogProxy *proxy = WATCHDOG_PROXY (_proxy);
19633 guint n;
19634 const gchar *key;
19635 GVariantIter *iter;
19636 _ExtendedGDBusPropertyInfo *info;
19637 g_variant_get (changed_properties, "a{sv}", &iter);
19638 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
19639 {
19640 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, key);
19641 g_datalist_remove_data (&proxy->priv->qdata, key);
19642 if (info != NULL)
19643 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
19644 }
19645 g_variant_iter_free (iter);
19646 for (n = 0; invalidated_properties[n] != NULL; n++)
19647 {
19648 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, invalidated_properties[n]);
19649 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
19650 if (info != NULL)
19651 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
19652 }
19653}
19654
19655static gint
19656watchdog_proxy_get_watchdog (Watchdog *object)
19657{
19658 WatchdogProxy *proxy = WATCHDOG_PROXY (object);
19659 GVariant *variant;
19660 gint value = 0;
19661 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "watchdog");
19662 if (variant != NULL)
19663 {
19664 value = g_variant_get_int32 (variant);
19665 g_variant_unref (variant);
19666 }
19667 return value;
19668}
19669
19670static gint
19671watchdog_proxy_get_poll_interval (Watchdog *object)
19672{
19673 WatchdogProxy *proxy = WATCHDOG_PROXY (object);
19674 GVariant *variant;
19675 gint value = 0;
19676 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "poll_interval");
19677 if (variant != NULL)
19678 {
19679 value = g_variant_get_int32 (variant);
19680 g_variant_unref (variant);
19681 }
19682 return value;
19683}
19684
19685static void
19686watchdog_proxy_init (WatchdogProxy *proxy)
19687{
19688#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
19689 proxy->priv = watchdog_proxy_get_instance_private (proxy);
19690#else
19691 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_WATCHDOG_PROXY, WatchdogProxyPrivate);
19692#endif
19693
19694 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), watchdog_interface_info ());
19695}
19696
19697static void
19698watchdog_proxy_class_init (WatchdogProxyClass *klass)
19699{
19700 GObjectClass *gobject_class;
19701 GDBusProxyClass *proxy_class;
19702
19703 gobject_class = G_OBJECT_CLASS (klass);
19704 gobject_class->finalize = watchdog_proxy_finalize;
19705 gobject_class->get_property = watchdog_proxy_get_property;
19706 gobject_class->set_property = watchdog_proxy_set_property;
19707
19708 proxy_class = G_DBUS_PROXY_CLASS (klass);
19709 proxy_class->g_signal = watchdog_proxy_g_signal;
19710 proxy_class->g_properties_changed = watchdog_proxy_g_properties_changed;
19711
19712 watchdog_override_properties (gobject_class, 1);
19713
19714#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
19715 g_type_class_add_private (klass, sizeof (WatchdogProxyPrivate));
19716#endif
19717}
19718
19719static void
19720watchdog_proxy_iface_init (WatchdogIface *iface)
19721{
19722 iface->get_watchdog = watchdog_proxy_get_watchdog;
19723 iface->get_poll_interval = watchdog_proxy_get_poll_interval;
19724}
19725
19726/**
19727 * watchdog_proxy_new:
19728 * @connection: A #GDBusConnection.
19729 * @flags: Flags from the #GDBusProxyFlags enumeration.
19730 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
19731 * @object_path: An object path.
19732 * @cancellable: (allow-none): A #GCancellable or %NULL.
19733 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
19734 * @user_data: User data to pass to @callback.
19735 *
19736 * 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.
19737 *
19738 * 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.
19739 * You can then call watchdog_proxy_new_finish() to get the result of the operation.
19740 *
19741 * See watchdog_proxy_new_sync() for the synchronous, blocking version of this constructor.
19742 */
19743void
19744watchdog_proxy_new (
19745 GDBusConnection *connection,
19746 GDBusProxyFlags flags,
19747 const gchar *name,
19748 const gchar *object_path,
19749 GCancellable *cancellable,
19750 GAsyncReadyCallback callback,
19751 gpointer user_data)
19752{
19753 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);
19754}
19755
19756/**
19757 * watchdog_proxy_new_finish:
19758 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_proxy_new().
19759 * @error: Return location for error or %NULL
19760 *
19761 * Finishes an operation started with watchdog_proxy_new().
19762 *
19763 * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set.
19764 */
19765Watchdog *
19766watchdog_proxy_new_finish (
19767 GAsyncResult *res,
19768 GError **error)
19769{
19770 GObject *ret;
19771 GObject *source_object;
19772 source_object = g_async_result_get_source_object (res);
19773 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
19774 g_object_unref (source_object);
19775 if (ret != NULL)
19776 return WATCHDOG (ret);
19777 else
19778 return NULL;
19779}
19780
19781/**
19782 * watchdog_proxy_new_sync:
19783 * @connection: A #GDBusConnection.
19784 * @flags: Flags from the #GDBusProxyFlags enumeration.
19785 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
19786 * @object_path: An object path.
19787 * @cancellable: (allow-none): A #GCancellable or %NULL.
19788 * @error: Return location for error or %NULL
19789 *
19790 * 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.
19791 *
19792 * The calling thread is blocked until a reply is received.
19793 *
19794 * See watchdog_proxy_new() for the asynchronous version of this constructor.
19795 *
19796 * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set.
19797 */
19798Watchdog *
19799watchdog_proxy_new_sync (
19800 GDBusConnection *connection,
19801 GDBusProxyFlags flags,
19802 const gchar *name,
19803 const gchar *object_path,
19804 GCancellable *cancellable,
19805 GError **error)
19806{
19807 GInitable *ret;
19808 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);
19809 if (ret != NULL)
19810 return WATCHDOG (ret);
19811 else
19812 return NULL;
19813}
19814
19815
19816/**
19817 * watchdog_proxy_new_for_bus:
19818 * @bus_type: A #GBusType.
19819 * @flags: Flags from the #GDBusProxyFlags enumeration.
19820 * @name: A bus name (well-known or unique).
19821 * @object_path: An object path.
19822 * @cancellable: (allow-none): A #GCancellable or %NULL.
19823 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
19824 * @user_data: User data to pass to @callback.
19825 *
19826 * Like watchdog_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
19827 *
19828 * 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.
19829 * You can then call watchdog_proxy_new_for_bus_finish() to get the result of the operation.
19830 *
19831 * See watchdog_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
19832 */
19833void
19834watchdog_proxy_new_for_bus (
19835 GBusType bus_type,
19836 GDBusProxyFlags flags,
19837 const gchar *name,
19838 const gchar *object_path,
19839 GCancellable *cancellable,
19840 GAsyncReadyCallback callback,
19841 gpointer user_data)
19842{
19843 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);
19844}
19845
19846/**
19847 * watchdog_proxy_new_for_bus_finish:
19848 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_proxy_new_for_bus().
19849 * @error: Return location for error or %NULL
19850 *
19851 * Finishes an operation started with watchdog_proxy_new_for_bus().
19852 *
19853 * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set.
19854 */
19855Watchdog *
19856watchdog_proxy_new_for_bus_finish (
19857 GAsyncResult *res,
19858 GError **error)
19859{
19860 GObject *ret;
19861 GObject *source_object;
19862 source_object = g_async_result_get_source_object (res);
19863 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
19864 g_object_unref (source_object);
19865 if (ret != NULL)
19866 return WATCHDOG (ret);
19867 else
19868 return NULL;
19869}
19870
19871/**
19872 * watchdog_proxy_new_for_bus_sync:
19873 * @bus_type: A #GBusType.
19874 * @flags: Flags from the #GDBusProxyFlags enumeration.
19875 * @name: A bus name (well-known or unique).
19876 * @object_path: An object path.
19877 * @cancellable: (allow-none): A #GCancellable or %NULL.
19878 * @error: Return location for error or %NULL
19879 *
19880 * Like watchdog_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
19881 *
19882 * The calling thread is blocked until a reply is received.
19883 *
19884 * See watchdog_proxy_new_for_bus() for the asynchronous version of this constructor.
19885 *
19886 * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set.
19887 */
19888Watchdog *
19889watchdog_proxy_new_for_bus_sync (
19890 GBusType bus_type,
19891 GDBusProxyFlags flags,
19892 const gchar *name,
19893 const gchar *object_path,
19894 GCancellable *cancellable,
19895 GError **error)
19896{
19897 GInitable *ret;
19898 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);
19899 if (ret != NULL)
19900 return WATCHDOG (ret);
19901 else
19902 return NULL;
19903}
19904
19905
19906/* ------------------------------------------------------------------------ */
19907
19908/**
19909 * WatchdogSkeleton:
19910 *
19911 * The #WatchdogSkeleton structure contains only private data and should only be accessed using the provided API.
19912 */
19913
19914/**
19915 * WatchdogSkeletonClass:
19916 * @parent_class: The parent class.
19917 *
19918 * Class structure for #WatchdogSkeleton.
19919 */
19920
19921struct _WatchdogSkeletonPrivate
19922{
19923 GValue *properties;
19924 GList *changed_properties;
19925 GSource *changed_properties_idle_source;
19926 GMainContext *context;
19927 GMutex lock;
19928};
19929
19930static void
19931_watchdog_skeleton_handle_method_call (
19932 GDBusConnection *connection G_GNUC_UNUSED,
19933 const gchar *sender G_GNUC_UNUSED,
19934 const gchar *object_path G_GNUC_UNUSED,
19935 const gchar *interface_name,
19936 const gchar *method_name,
19937 GVariant *parameters,
19938 GDBusMethodInvocation *invocation,
19939 gpointer user_data)
19940{
19941 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data);
19942 _ExtendedGDBusMethodInfo *info;
19943 GVariantIter iter;
19944 GVariant *child;
19945 GValue *paramv;
19946 guint num_params;
19947 guint num_extra;
19948 guint n;
19949 guint signal_id;
19950 GValue return_value = G_VALUE_INIT;
19951 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
19952 g_assert (info != NULL);
19953 num_params = g_variant_n_children (parameters);
19954 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
19955 n = 0;
19956 g_value_init (&paramv[n], TYPE_WATCHDOG);
19957 g_value_set_object (&paramv[n++], skeleton);
19958 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
19959 g_value_set_object (&paramv[n++], invocation);
19960 if (info->pass_fdlist)
19961 {
19962#ifdef G_OS_UNIX
19963 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
19964 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
19965#else
19966 g_assert_not_reached ();
19967#endif
19968 }
19969 g_variant_iter_init (&iter, parameters);
19970 while ((child = g_variant_iter_next_value (&iter)) != NULL)
19971 {
19972 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
19973 if (arg_info->use_gvariant)
19974 {
19975 g_value_init (&paramv[n], G_TYPE_VARIANT);
19976 g_value_set_variant (&paramv[n], child);
19977 n++;
19978 }
19979 else
19980 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
19981 g_variant_unref (child);
19982 }
19983 signal_id = g_signal_lookup (info->signal_name, TYPE_WATCHDOG);
19984 g_value_init (&return_value, G_TYPE_BOOLEAN);
19985 g_signal_emitv (paramv, signal_id, 0, &return_value);
19986 if (!g_value_get_boolean (&return_value))
19987 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);
19988 g_value_unset (&return_value);
19989 for (n = 0; n < num_params + num_extra; n++)
19990 g_value_unset (&paramv[n]);
19991 g_free (paramv);
19992}
19993
19994static GVariant *
19995_watchdog_skeleton_handle_get_property (
19996 GDBusConnection *connection G_GNUC_UNUSED,
19997 const gchar *sender G_GNUC_UNUSED,
19998 const gchar *object_path G_GNUC_UNUSED,
19999 const gchar *interface_name G_GNUC_UNUSED,
20000 const gchar *property_name,
20001 GError **error,
20002 gpointer user_data)
20003{
20004 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data);
20005 GValue value = G_VALUE_INIT;
20006 GParamSpec *pspec;
20007 _ExtendedGDBusPropertyInfo *info;
20008 GVariant *ret;
20009 ret = NULL;
20010 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, property_name);
20011 g_assert (info != NULL);
20012 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
20013 if (pspec == NULL)
20014 {
20015 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
20016 }
20017 else
20018 {
20019 g_value_init (&value, pspec->value_type);
20020 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
20021 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
20022 g_value_unset (&value);
20023 }
20024 return ret;
20025}
20026
20027static gboolean
20028_watchdog_skeleton_handle_set_property (
20029 GDBusConnection *connection G_GNUC_UNUSED,
20030 const gchar *sender G_GNUC_UNUSED,
20031 const gchar *object_path G_GNUC_UNUSED,
20032 const gchar *interface_name G_GNUC_UNUSED,
20033 const gchar *property_name,
20034 GVariant *variant,
20035 GError **error,
20036 gpointer user_data)
20037{
20038 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data);
20039 GValue value = G_VALUE_INIT;
20040 GParamSpec *pspec;
20041 _ExtendedGDBusPropertyInfo *info;
20042 gboolean ret;
20043 ret = FALSE;
20044 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, property_name);
20045 g_assert (info != NULL);
20046 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
20047 if (pspec == NULL)
20048 {
20049 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
20050 }
20051 else
20052 {
20053 if (info->use_gvariant)
20054 g_value_set_variant (&value, variant);
20055 else
20056 g_dbus_gvariant_to_gvalue (variant, &value);
20057 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
20058 g_value_unset (&value);
20059 ret = TRUE;
20060 }
20061 return ret;
20062}
20063
20064static const GDBusInterfaceVTable _watchdog_skeleton_vtable =
20065{
20066 _watchdog_skeleton_handle_method_call,
20067 _watchdog_skeleton_handle_get_property,
20068 _watchdog_skeleton_handle_set_property,
20069 {NULL}
20070};
20071
20072static GDBusInterfaceInfo *
20073watchdog_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
20074{
20075 return watchdog_interface_info ();
20076}
20077
20078static GDBusInterfaceVTable *
20079watchdog_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
20080{
20081 return (GDBusInterfaceVTable *) &_watchdog_skeleton_vtable;
20082}
20083
20084static GVariant *
20085watchdog_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
20086{
20087 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (_skeleton);
20088
20089 GVariantBuilder builder;
20090 guint n;
20091 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
20092 if (_watchdog_interface_info.parent_struct.properties == NULL)
20093 goto out;
20094 for (n = 0; _watchdog_interface_info.parent_struct.properties[n] != NULL; n++)
20095 {
20096 GDBusPropertyInfo *info = _watchdog_interface_info.parent_struct.properties[n];
20097 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
20098 {
20099 GVariant *value;
20100 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);
20101 if (value != NULL)
20102 {
20103 g_variant_take_ref (value);
20104 g_variant_builder_add (&builder, "{sv}", info->name, value);
20105 g_variant_unref (value);
20106 }
20107 }
20108 }
20109out:
20110 return g_variant_builder_end (&builder);
20111}
20112
20113static gboolean _watchdog_emit_changed (gpointer user_data);
20114
20115static void
20116watchdog_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
20117{
20118 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (_skeleton);
20119 gboolean emit_changed = FALSE;
20120
20121 g_mutex_lock (&skeleton->priv->lock);
20122 if (skeleton->priv->changed_properties_idle_source != NULL)
20123 {
20124 g_source_destroy (skeleton->priv->changed_properties_idle_source);
20125 skeleton->priv->changed_properties_idle_source = NULL;
20126 emit_changed = TRUE;
20127 }
20128 g_mutex_unlock (&skeleton->priv->lock);
20129
20130 if (emit_changed)
20131 _watchdog_emit_changed (skeleton);
20132}
20133
20134static void
20135_watchdog_on_signal_watchdog_error (
20136 Watchdog *object)
20137{
20138 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
20139
20140 GList *connections, *l;
20141 GVariant *signal_variant;
20142 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
20143
20144 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
20145 for (l = connections; l != NULL; l = l->next)
20146 {
20147 GDBusConnection *connection = l->data;
20148 g_dbus_connection_emit_signal (connection,
20149 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Watchdog", "WatchdogError",
20150 signal_variant, NULL);
20151 }
20152 g_variant_unref (signal_variant);
20153 g_list_free_full (connections, g_object_unref);
20154}
20155
20156static void watchdog_skeleton_iface_init (WatchdogIface *iface);
20157#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
20158G_DEFINE_TYPE_WITH_CODE (WatchdogSkeleton, watchdog_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
20159 G_ADD_PRIVATE (WatchdogSkeleton)
20160 G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_skeleton_iface_init));
20161
20162#else
20163G_DEFINE_TYPE_WITH_CODE (WatchdogSkeleton, watchdog_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
20164 G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_skeleton_iface_init));
20165
20166#endif
20167static void
20168watchdog_skeleton_finalize (GObject *object)
20169{
20170 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
20171 guint n;
20172 for (n = 0; n < 2; n++)
20173 g_value_unset (&skeleton->priv->properties[n]);
20174 g_free (skeleton->priv->properties);
20175 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
20176 if (skeleton->priv->changed_properties_idle_source != NULL)
20177 g_source_destroy (skeleton->priv->changed_properties_idle_source);
20178 g_main_context_unref (skeleton->priv->context);
20179 g_mutex_clear (&skeleton->priv->lock);
20180 G_OBJECT_CLASS (watchdog_skeleton_parent_class)->finalize (object);
20181}
20182
20183static void
20184watchdog_skeleton_get_property (GObject *object,
20185 guint prop_id,
20186 GValue *value,
20187 GParamSpec *pspec G_GNUC_UNUSED)
20188{
20189 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
20190 g_assert (prop_id != 0 && prop_id - 1 < 2);
20191 g_mutex_lock (&skeleton->priv->lock);
20192 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
20193 g_mutex_unlock (&skeleton->priv->lock);
20194}
20195
20196static gboolean
20197_watchdog_emit_changed (gpointer user_data)
20198{
20199 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data);
20200 GList *l;
20201 GVariantBuilder builder;
20202 GVariantBuilder invalidated_builder;
20203 guint num_changes;
20204
20205 g_mutex_lock (&skeleton->priv->lock);
20206 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
20207 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
20208 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
20209 {
20210 ChangedProperty *cp = l->data;
20211 GVariant *variant;
20212 const GValue *cur_value;
20213
20214 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
20215 if (!_g_value_equal (cur_value, &cp->orig_value))
20216 {
20217 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
20218 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
20219 g_variant_unref (variant);
20220 num_changes++;
20221 }
20222 }
20223 if (num_changes > 0)
20224 {
20225 GList *connections, *ll;
20226 GVariant *signal_variant;
20227 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Watchdog",
20228 &builder, &invalidated_builder));
20229 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
20230 for (ll = connections; ll != NULL; ll = ll->next)
20231 {
20232 GDBusConnection *connection = ll->data;
20233
20234 g_dbus_connection_emit_signal (connection,
20235 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
20236 "org.freedesktop.DBus.Properties",
20237 "PropertiesChanged",
20238 signal_variant,
20239 NULL);
20240 }
20241 g_variant_unref (signal_variant);
20242 g_list_free_full (connections, g_object_unref);
20243 }
20244 else
20245 {
20246 g_variant_builder_clear (&builder);
20247 g_variant_builder_clear (&invalidated_builder);
20248 }
20249 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
20250 skeleton->priv->changed_properties = NULL;
20251 skeleton->priv->changed_properties_idle_source = NULL;
20252 g_mutex_unlock (&skeleton->priv->lock);
20253 return FALSE;
20254}
20255
20256static void
20257_watchdog_schedule_emit_changed (WatchdogSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
20258{
20259 ChangedProperty *cp;
20260 GList *l;
20261 cp = NULL;
20262 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
20263 {
20264 ChangedProperty *i_cp = l->data;
20265 if (i_cp->info == info)
20266 {
20267 cp = i_cp;
20268 break;
20269 }
20270 }
20271 if (cp == NULL)
20272 {
20273 cp = g_new0 (ChangedProperty, 1);
20274 cp->prop_id = prop_id;
20275 cp->info = info;
20276 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
20277 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
20278 g_value_copy (orig_value, &cp->orig_value);
20279 }
20280}
20281
20282static void
20283watchdog_skeleton_notify (GObject *object,
20284 GParamSpec *pspec G_GNUC_UNUSED)
20285{
20286 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
20287 g_mutex_lock (&skeleton->priv->lock);
20288 if (skeleton->priv->changed_properties != NULL &&
20289 skeleton->priv->changed_properties_idle_source == NULL)
20290 {
20291 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
20292 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
20293 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _watchdog_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
20294 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
20295 g_source_unref (skeleton->priv->changed_properties_idle_source);
20296 }
20297 g_mutex_unlock (&skeleton->priv->lock);
20298}
20299
20300static void
20301watchdog_skeleton_set_property (GObject *object,
20302 guint prop_id,
20303 const GValue *value,
20304 GParamSpec *pspec)
20305{
20306 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
20307 g_assert (prop_id != 0 && prop_id - 1 < 2);
20308 g_mutex_lock (&skeleton->priv->lock);
20309 g_object_freeze_notify (object);
20310 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
20311 {
20312 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
20313 _watchdog_schedule_emit_changed (skeleton, _watchdog_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
20314 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
20315 g_object_notify_by_pspec (object, pspec);
20316 }
20317 g_mutex_unlock (&skeleton->priv->lock);
20318 g_object_thaw_notify (object);
20319}
20320
20321static void
20322watchdog_skeleton_init (WatchdogSkeleton *skeleton)
20323{
20324#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
20325 skeleton->priv = watchdog_skeleton_get_instance_private (skeleton);
20326#else
20327 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_WATCHDOG_SKELETON, WatchdogSkeletonPrivate);
20328#endif
20329
20330 g_mutex_init (&skeleton->priv->lock);
20331 skeleton->priv->context = g_main_context_ref_thread_default ();
20332 skeleton->priv->properties = g_new0 (GValue, 2);
20333 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
20334 g_value_init (&skeleton->priv->properties[1], G_TYPE_INT);
20335}
20336
20337static gint
20338watchdog_skeleton_get_watchdog (Watchdog *object)
20339{
20340 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
20341 gint value;
20342 g_mutex_lock (&skeleton->priv->lock);
20343 value = g_value_get_int (&(skeleton->priv->properties[0]));
20344 g_mutex_unlock (&skeleton->priv->lock);
20345 return value;
20346}
20347
20348static gint
20349watchdog_skeleton_get_poll_interval (Watchdog *object)
20350{
20351 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
20352 gint value;
20353 g_mutex_lock (&skeleton->priv->lock);
20354 value = g_value_get_int (&(skeleton->priv->properties[1]));
20355 g_mutex_unlock (&skeleton->priv->lock);
20356 return value;
20357}
20358
20359static void
20360watchdog_skeleton_class_init (WatchdogSkeletonClass *klass)
20361{
20362 GObjectClass *gobject_class;
20363 GDBusInterfaceSkeletonClass *skeleton_class;
20364
20365 gobject_class = G_OBJECT_CLASS (klass);
20366 gobject_class->finalize = watchdog_skeleton_finalize;
20367 gobject_class->get_property = watchdog_skeleton_get_property;
20368 gobject_class->set_property = watchdog_skeleton_set_property;
20369 gobject_class->notify = watchdog_skeleton_notify;
20370
20371
20372 watchdog_override_properties (gobject_class, 1);
20373
20374 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
20375 skeleton_class->get_info = watchdog_skeleton_dbus_interface_get_info;
20376 skeleton_class->get_properties = watchdog_skeleton_dbus_interface_get_properties;
20377 skeleton_class->flush = watchdog_skeleton_dbus_interface_flush;
20378 skeleton_class->get_vtable = watchdog_skeleton_dbus_interface_get_vtable;
20379
20380#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
20381 g_type_class_add_private (klass, sizeof (WatchdogSkeletonPrivate));
20382#endif
20383}
20384
20385static void
20386watchdog_skeleton_iface_init (WatchdogIface *iface)
20387{
20388 iface->watchdog_error = _watchdog_on_signal_watchdog_error;
20389 iface->get_watchdog = watchdog_skeleton_get_watchdog;
20390 iface->get_poll_interval = watchdog_skeleton_get_poll_interval;
20391}
20392
20393/**
20394 * watchdog_skeleton_new:
20395 *
20396 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link>.
20397 *
20398 * Returns: (transfer full) (type WatchdogSkeleton): The skeleton object.
20399 */
20400Watchdog *
20401watchdog_skeleton_new (void)
20402{
20403 return WATCHDOG (g_object_new (TYPE_WATCHDOG_SKELETON, NULL));
20404}
20405
20406/* ------------------------------------------------------------------------
20407 * Code for interface org.openbmc.EventLog
20408 * ------------------------------------------------------------------------
20409 */
20410
20411/**
20412 * SECTION:EventLog
20413 * @title: EventLog
20414 * @short_description: Generated C code for the org.openbmc.EventLog D-Bus interface
20415 *
20416 * 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.
20417 */
20418
20419/* ---- Introspection data for org.openbmc.EventLog ---- */
20420
Norman James2d1ee892015-09-16 23:13:45 -050020421static const _ExtendedGDBusArgInfo _event_log_method_info_get_event_log_OUT_ARG_log =
20422{
20423 {
20424 -1,
20425 (gchar *) "log",
20426 (gchar *) "a(s)",
20427 NULL
20428 },
20429 FALSE
20430};
20431
20432static const _ExtendedGDBusArgInfo * const _event_log_method_info_get_event_log_OUT_ARG_pointers[] =
20433{
20434 &_event_log_method_info_get_event_log_OUT_ARG_log,
20435 NULL
20436};
20437
20438static const _ExtendedGDBusMethodInfo _event_log_method_info_get_event_log =
20439{
20440 {
20441 -1,
20442 (gchar *) "getEventLog",
20443 NULL,
20444 (GDBusArgInfo **) &_event_log_method_info_get_event_log_OUT_ARG_pointers,
20445 NULL
20446 },
20447 "handle-get-event-log",
20448 FALSE
20449};
20450
20451static const _ExtendedGDBusMethodInfo * const _event_log_method_info_pointers[] =
20452{
20453 &_event_log_method_info_get_event_log,
20454 NULL
20455};
20456
Norman James8abb50c2015-09-16 10:58:16 -050020457static const _ExtendedGDBusArgInfo _event_log_signal_info_event_log_ARG_priority =
Norman James362a80f2015-09-14 14:04:39 -050020458{
20459 {
20460 -1,
Norman James8abb50c2015-09-16 10:58:16 -050020461 (gchar *) "priority",
20462 (gchar *) "i",
Norman James362a80f2015-09-14 14:04:39 -050020463 NULL
20464 },
20465 FALSE
20466};
20467
Norman James362a80f2015-09-14 14:04:39 -050020468static const _ExtendedGDBusArgInfo _event_log_signal_info_event_log_ARG_message =
20469{
20470 {
20471 -1,
20472 (gchar *) "message",
Norman James32e74e22015-09-15 21:28:06 -050020473 (gchar *) "s",
Norman James362a80f2015-09-14 14:04:39 -050020474 NULL
20475 },
20476 FALSE
20477};
20478
Norman James88872672015-09-21 16:51:35 -050020479static const _ExtendedGDBusArgInfo _event_log_signal_info_event_log_ARG_rc =
20480{
20481 {
20482 -1,
20483 (gchar *) "rc",
20484 (gchar *) "i",
20485 NULL
20486 },
20487 FALSE
20488};
20489
Norman James362a80f2015-09-14 14:04:39 -050020490static const _ExtendedGDBusArgInfo * const _event_log_signal_info_event_log_ARG_pointers[] =
20491{
Norman James8abb50c2015-09-16 10:58:16 -050020492 &_event_log_signal_info_event_log_ARG_priority,
Norman James362a80f2015-09-14 14:04:39 -050020493 &_event_log_signal_info_event_log_ARG_message,
Norman James88872672015-09-21 16:51:35 -050020494 &_event_log_signal_info_event_log_ARG_rc,
Norman James362a80f2015-09-14 14:04:39 -050020495 NULL
20496};
20497
20498static const _ExtendedGDBusSignalInfo _event_log_signal_info_event_log =
20499{
20500 {
20501 -1,
20502 (gchar *) "EventLog",
20503 (GDBusArgInfo **) &_event_log_signal_info_event_log_ARG_pointers,
20504 NULL
20505 },
20506 "event-log"
20507};
20508
20509static const _ExtendedGDBusSignalInfo * const _event_log_signal_info_pointers[] =
20510{
20511 &_event_log_signal_info_event_log,
20512 NULL
20513};
20514
Norman James362a80f2015-09-14 14:04:39 -050020515static const _ExtendedGDBusInterfaceInfo _event_log_interface_info =
20516{
20517 {
20518 -1,
20519 (gchar *) "org.openbmc.EventLog",
Norman James2d1ee892015-09-16 23:13:45 -050020520 (GDBusMethodInfo **) &_event_log_method_info_pointers,
Norman James362a80f2015-09-14 14:04:39 -050020521 (GDBusSignalInfo **) &_event_log_signal_info_pointers,
Norman James32e74e22015-09-15 21:28:06 -050020522 NULL,
Norman James362a80f2015-09-14 14:04:39 -050020523 NULL
20524 },
20525 "event-log",
20526};
20527
20528
20529/**
20530 * event_log_interface_info:
20531 *
20532 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link> D-Bus interface.
20533 *
20534 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
20535 */
20536GDBusInterfaceInfo *
20537event_log_interface_info (void)
20538{
20539 return (GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct;
20540}
20541
20542/**
20543 * event_log_override_properties:
20544 * @klass: The class structure for a #GObject<!-- -->-derived class.
20545 * @property_id_begin: The property id to assign to the first overridden property.
20546 *
20547 * Overrides all #GObject properties in the #EventLog interface for a concrete class.
20548 * The properties are overridden in the order they are defined.
20549 *
20550 * Returns: The last property id.
20551 */
20552guint
20553event_log_override_properties (GObjectClass *klass, guint property_id_begin)
20554{
Norman James362a80f2015-09-14 14:04:39 -050020555 return property_id_begin - 1;
20556}
20557
20558
20559
20560/**
20561 * EventLog:
20562 *
20563 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>.
20564 */
20565
20566/**
20567 * EventLogIface:
20568 * @parent_iface: The parent interface.
Norman James2d1ee892015-09-16 23:13:45 -050020569 * @handle_get_event_log: Handler for the #EventLog::handle-get-event-log signal.
Norman James362a80f2015-09-14 14:04:39 -050020570 * @event_log: Handler for the #EventLog::event-log signal.
20571 *
20572 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>.
20573 */
20574
20575typedef EventLogIface EventLogInterface;
20576G_DEFINE_INTERFACE (EventLog, event_log, G_TYPE_OBJECT);
20577
20578static void
20579event_log_default_init (EventLogIface *iface)
20580{
Norman James2d1ee892015-09-16 23:13:45 -050020581 /* GObject signals for incoming D-Bus method calls: */
20582 /**
20583 * EventLog::handle-get-event-log:
20584 * @object: A #EventLog.
20585 * @invocation: A #GDBusMethodInvocation.
20586 *
20587 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-EventLog.getEventLog">getEventLog()</link> D-Bus method.
20588 *
20589 * 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.
20590 *
20591 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
20592 */
20593 g_signal_new ("handle-get-event-log",
20594 G_TYPE_FROM_INTERFACE (iface),
20595 G_SIGNAL_RUN_LAST,
20596 G_STRUCT_OFFSET (EventLogIface, handle_get_event_log),
20597 g_signal_accumulator_true_handled,
20598 NULL,
20599 g_cclosure_marshal_generic,
20600 G_TYPE_BOOLEAN,
20601 1,
20602 G_TYPE_DBUS_METHOD_INVOCATION);
20603
Norman James362a80f2015-09-14 14:04:39 -050020604 /* GObject signals for received D-Bus signals: */
20605 /**
20606 * EventLog::event-log:
20607 * @object: A #EventLog.
Norman James8abb50c2015-09-16 10:58:16 -050020608 * @arg_priority: Argument.
Norman James362a80f2015-09-14 14:04:39 -050020609 * @arg_message: Argument.
Norman James88872672015-09-21 16:51:35 -050020610 * @arg_rc: Argument.
Norman James362a80f2015-09-14 14:04:39 -050020611 *
20612 * 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.
20613 *
20614 * 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.
20615 */
20616 g_signal_new ("event-log",
20617 G_TYPE_FROM_INTERFACE (iface),
20618 G_SIGNAL_RUN_LAST,
20619 G_STRUCT_OFFSET (EventLogIface, event_log),
20620 NULL,
20621 NULL,
20622 g_cclosure_marshal_generic,
20623 G_TYPE_NONE,
Norman James88872672015-09-21 16:51:35 -050020624 3, G_TYPE_INT, G_TYPE_STRING, G_TYPE_INT);
Norman James362a80f2015-09-14 14:04:39 -050020625
Norman James362a80f2015-09-14 14:04:39 -050020626}
20627
20628/**
20629 * event_log_emit_event_log:
20630 * @object: A #EventLog.
Norman James8abb50c2015-09-16 10:58:16 -050020631 * @arg_priority: Argument to pass with the signal.
Norman James362a80f2015-09-14 14:04:39 -050020632 * @arg_message: Argument to pass with the signal.
Norman James88872672015-09-21 16:51:35 -050020633 * @arg_rc: Argument to pass with the signal.
Norman James362a80f2015-09-14 14:04:39 -050020634 *
20635 * Emits the <link linkend="gdbus-signal-org-openbmc-EventLog.EventLog">"EventLog"</link> D-Bus signal.
20636 */
20637void
20638event_log_emit_event_log (
20639 EventLog *object,
Norman James8abb50c2015-09-16 10:58:16 -050020640 gint arg_priority,
Norman James88872672015-09-21 16:51:35 -050020641 const gchar *arg_message,
20642 gint arg_rc)
Norman James362a80f2015-09-14 14:04:39 -050020643{
Norman James88872672015-09-21 16:51:35 -050020644 g_signal_emit_by_name (object, "event-log", arg_priority, arg_message, arg_rc);
Norman James362a80f2015-09-14 14:04:39 -050020645}
20646
Norman James2d1ee892015-09-16 23:13:45 -050020647/**
20648 * event_log_call_get_event_log:
20649 * @proxy: A #EventLogProxy.
20650 * @cancellable: (allow-none): A #GCancellable or %NULL.
20651 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
20652 * @user_data: User data to pass to @callback.
20653 *
20654 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-EventLog.getEventLog">getEventLog()</link> D-Bus method on @proxy.
20655 * 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.
20656 * You can then call event_log_call_get_event_log_finish() to get the result of the operation.
20657 *
20658 * See event_log_call_get_event_log_sync() for the synchronous, blocking version of this method.
20659 */
20660void
20661event_log_call_get_event_log (
20662 EventLog *proxy,
20663 GCancellable *cancellable,
20664 GAsyncReadyCallback callback,
20665 gpointer user_data)
20666{
20667 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
20668 "getEventLog",
20669 g_variant_new ("()"),
20670 G_DBUS_CALL_FLAGS_NONE,
20671 -1,
20672 cancellable,
20673 callback,
20674 user_data);
20675}
20676
20677/**
20678 * event_log_call_get_event_log_finish:
20679 * @proxy: A #EventLogProxy.
20680 * @out_log: (out): Return location for return parameter or %NULL to ignore.
20681 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to event_log_call_get_event_log().
20682 * @error: Return location for error or %NULL.
20683 *
20684 * Finishes an operation started with event_log_call_get_event_log().
20685 *
20686 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
20687 */
20688gboolean
20689event_log_call_get_event_log_finish (
20690 EventLog *proxy,
20691 GVariant **out_log,
20692 GAsyncResult *res,
20693 GError **error)
20694{
20695 GVariant *_ret;
20696 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
20697 if (_ret == NULL)
20698 goto _out;
20699 g_variant_get (_ret,
20700 "(@a(s))",
20701 out_log);
20702 g_variant_unref (_ret);
20703_out:
20704 return _ret != NULL;
20705}
20706
20707/**
20708 * event_log_call_get_event_log_sync:
20709 * @proxy: A #EventLogProxy.
20710 * @out_log: (out): Return location for return parameter or %NULL to ignore.
20711 * @cancellable: (allow-none): A #GCancellable or %NULL.
20712 * @error: Return location for error or %NULL.
20713 *
20714 * 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.
20715 *
20716 * See event_log_call_get_event_log() for the asynchronous version of this method.
20717 *
20718 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
20719 */
20720gboolean
20721event_log_call_get_event_log_sync (
20722 EventLog *proxy,
20723 GVariant **out_log,
20724 GCancellable *cancellable,
20725 GError **error)
20726{
20727 GVariant *_ret;
20728 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
20729 "getEventLog",
20730 g_variant_new ("()"),
20731 G_DBUS_CALL_FLAGS_NONE,
20732 -1,
20733 cancellable,
20734 error);
20735 if (_ret == NULL)
20736 goto _out;
20737 g_variant_get (_ret,
20738 "(@a(s))",
20739 out_log);
20740 g_variant_unref (_ret);
20741_out:
20742 return _ret != NULL;
20743}
20744
20745/**
20746 * event_log_complete_get_event_log:
20747 * @object: A #EventLog.
20748 * @invocation: (transfer full): A #GDBusMethodInvocation.
20749 * @log: Parameter to return.
20750 *
20751 * 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.
20752 *
20753 * This method will free @invocation, you cannot use it afterwards.
20754 */
20755void
20756event_log_complete_get_event_log (
20757 EventLog *object,
20758 GDBusMethodInvocation *invocation,
20759 GVariant *log)
20760{
20761 g_dbus_method_invocation_return_value (invocation,
20762 g_variant_new ("(@a(s))",
20763 log));
20764}
20765
Norman James362a80f2015-09-14 14:04:39 -050020766/* ------------------------------------------------------------------------ */
20767
20768/**
20769 * EventLogProxy:
20770 *
20771 * The #EventLogProxy structure contains only private data and should only be accessed using the provided API.
20772 */
20773
20774/**
20775 * EventLogProxyClass:
20776 * @parent_class: The parent class.
20777 *
20778 * Class structure for #EventLogProxy.
20779 */
20780
20781struct _EventLogProxyPrivate
20782{
20783 GData *qdata;
20784};
20785
20786static void event_log_proxy_iface_init (EventLogIface *iface);
20787
20788#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
20789G_DEFINE_TYPE_WITH_CODE (EventLogProxy, event_log_proxy, G_TYPE_DBUS_PROXY,
20790 G_ADD_PRIVATE (EventLogProxy)
20791 G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_proxy_iface_init));
20792
20793#else
20794G_DEFINE_TYPE_WITH_CODE (EventLogProxy, event_log_proxy, G_TYPE_DBUS_PROXY,
20795 G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_proxy_iface_init));
20796
20797#endif
20798static void
20799event_log_proxy_finalize (GObject *object)
20800{
20801 EventLogProxy *proxy = EVENT_LOG_PROXY (object);
20802 g_datalist_clear (&proxy->priv->qdata);
20803 G_OBJECT_CLASS (event_log_proxy_parent_class)->finalize (object);
20804}
20805
20806static void
20807event_log_proxy_get_property (GObject *object,
20808 guint prop_id,
20809 GValue *value,
20810 GParamSpec *pspec G_GNUC_UNUSED)
20811{
Norman James362a80f2015-09-14 14:04:39 -050020812}
20813
20814static void
20815event_log_proxy_set_property (GObject *object,
20816 guint prop_id,
20817 const GValue *value,
20818 GParamSpec *pspec G_GNUC_UNUSED)
20819{
Norman James362a80f2015-09-14 14:04:39 -050020820}
20821
20822static void
20823event_log_proxy_g_signal (GDBusProxy *proxy,
20824 const gchar *sender_name G_GNUC_UNUSED,
20825 const gchar *signal_name,
20826 GVariant *parameters)
20827{
20828 _ExtendedGDBusSignalInfo *info;
20829 GVariantIter iter;
20830 GVariant *child;
20831 GValue *paramv;
20832 guint num_params;
20833 guint n;
20834 guint signal_id;
20835 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, signal_name);
20836 if (info == NULL)
20837 return;
20838 num_params = g_variant_n_children (parameters);
20839 paramv = g_new0 (GValue, num_params + 1);
20840 g_value_init (&paramv[0], TYPE_EVENT_LOG);
20841 g_value_set_object (&paramv[0], proxy);
20842 g_variant_iter_init (&iter, parameters);
20843 n = 1;
20844 while ((child = g_variant_iter_next_value (&iter)) != NULL)
20845 {
20846 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
20847 if (arg_info->use_gvariant)
20848 {
20849 g_value_init (&paramv[n], G_TYPE_VARIANT);
20850 g_value_set_variant (&paramv[n], child);
20851 n++;
20852 }
20853 else
20854 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
20855 g_variant_unref (child);
20856 }
20857 signal_id = g_signal_lookup (info->signal_name, TYPE_EVENT_LOG);
20858 g_signal_emitv (paramv, signal_id, 0, NULL);
20859 for (n = 0; n < num_params + 1; n++)
20860 g_value_unset (&paramv[n]);
20861 g_free (paramv);
20862}
20863
20864static void
20865event_log_proxy_g_properties_changed (GDBusProxy *_proxy,
20866 GVariant *changed_properties,
20867 const gchar *const *invalidated_properties)
20868{
20869 EventLogProxy *proxy = EVENT_LOG_PROXY (_proxy);
20870 guint n;
20871 const gchar *key;
20872 GVariantIter *iter;
20873 _ExtendedGDBusPropertyInfo *info;
20874 g_variant_get (changed_properties, "a{sv}", &iter);
20875 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
20876 {
20877 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, key);
20878 g_datalist_remove_data (&proxy->priv->qdata, key);
20879 if (info != NULL)
20880 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
20881 }
20882 g_variant_iter_free (iter);
20883 for (n = 0; invalidated_properties[n] != NULL; n++)
20884 {
20885 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, invalidated_properties[n]);
20886 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
20887 if (info != NULL)
20888 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
20889 }
20890}
20891
Norman James362a80f2015-09-14 14:04:39 -050020892static void
20893event_log_proxy_init (EventLogProxy *proxy)
20894{
20895#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
20896 proxy->priv = event_log_proxy_get_instance_private (proxy);
20897#else
20898 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_EVENT_LOG_PROXY, EventLogProxyPrivate);
20899#endif
20900
20901 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), event_log_interface_info ());
20902}
20903
20904static void
20905event_log_proxy_class_init (EventLogProxyClass *klass)
20906{
20907 GObjectClass *gobject_class;
20908 GDBusProxyClass *proxy_class;
20909
20910 gobject_class = G_OBJECT_CLASS (klass);
20911 gobject_class->finalize = event_log_proxy_finalize;
20912 gobject_class->get_property = event_log_proxy_get_property;
20913 gobject_class->set_property = event_log_proxy_set_property;
20914
20915 proxy_class = G_DBUS_PROXY_CLASS (klass);
20916 proxy_class->g_signal = event_log_proxy_g_signal;
20917 proxy_class->g_properties_changed = event_log_proxy_g_properties_changed;
20918
Norman James362a80f2015-09-14 14:04:39 -050020919#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
20920 g_type_class_add_private (klass, sizeof (EventLogProxyPrivate));
20921#endif
20922}
20923
20924static void
20925event_log_proxy_iface_init (EventLogIface *iface)
20926{
Norman James362a80f2015-09-14 14:04:39 -050020927}
20928
20929/**
20930 * event_log_proxy_new:
20931 * @connection: A #GDBusConnection.
20932 * @flags: Flags from the #GDBusProxyFlags enumeration.
20933 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
20934 * @object_path: An object path.
20935 * @cancellable: (allow-none): A #GCancellable or %NULL.
20936 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
20937 * @user_data: User data to pass to @callback.
20938 *
20939 * 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.
20940 *
20941 * 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.
20942 * You can then call event_log_proxy_new_finish() to get the result of the operation.
20943 *
20944 * See event_log_proxy_new_sync() for the synchronous, blocking version of this constructor.
20945 */
20946void
20947event_log_proxy_new (
20948 GDBusConnection *connection,
20949 GDBusProxyFlags flags,
20950 const gchar *name,
20951 const gchar *object_path,
20952 GCancellable *cancellable,
20953 GAsyncReadyCallback callback,
20954 gpointer user_data)
20955{
20956 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);
20957}
20958
20959/**
20960 * event_log_proxy_new_finish:
20961 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to event_log_proxy_new().
20962 * @error: Return location for error or %NULL
20963 *
20964 * Finishes an operation started with event_log_proxy_new().
20965 *
20966 * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set.
20967 */
20968EventLog *
20969event_log_proxy_new_finish (
20970 GAsyncResult *res,
20971 GError **error)
20972{
20973 GObject *ret;
20974 GObject *source_object;
20975 source_object = g_async_result_get_source_object (res);
20976 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
20977 g_object_unref (source_object);
20978 if (ret != NULL)
20979 return EVENT_LOG (ret);
20980 else
20981 return NULL;
20982}
20983
20984/**
20985 * event_log_proxy_new_sync:
20986 * @connection: A #GDBusConnection.
20987 * @flags: Flags from the #GDBusProxyFlags enumeration.
20988 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
20989 * @object_path: An object path.
20990 * @cancellable: (allow-none): A #GCancellable or %NULL.
20991 * @error: Return location for error or %NULL
20992 *
20993 * 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.
20994 *
20995 * The calling thread is blocked until a reply is received.
20996 *
20997 * See event_log_proxy_new() for the asynchronous version of this constructor.
20998 *
20999 * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set.
21000 */
21001EventLog *
21002event_log_proxy_new_sync (
21003 GDBusConnection *connection,
21004 GDBusProxyFlags flags,
21005 const gchar *name,
21006 const gchar *object_path,
21007 GCancellable *cancellable,
21008 GError **error)
21009{
21010 GInitable *ret;
21011 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);
21012 if (ret != NULL)
21013 return EVENT_LOG (ret);
21014 else
21015 return NULL;
21016}
21017
21018
21019/**
21020 * event_log_proxy_new_for_bus:
21021 * @bus_type: A #GBusType.
21022 * @flags: Flags from the #GDBusProxyFlags enumeration.
21023 * @name: A bus name (well-known or unique).
21024 * @object_path: An object path.
21025 * @cancellable: (allow-none): A #GCancellable or %NULL.
21026 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
21027 * @user_data: User data to pass to @callback.
21028 *
21029 * Like event_log_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
21030 *
21031 * 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.
21032 * You can then call event_log_proxy_new_for_bus_finish() to get the result of the operation.
21033 *
21034 * See event_log_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
21035 */
21036void
21037event_log_proxy_new_for_bus (
21038 GBusType bus_type,
21039 GDBusProxyFlags flags,
21040 const gchar *name,
21041 const gchar *object_path,
21042 GCancellable *cancellable,
21043 GAsyncReadyCallback callback,
21044 gpointer user_data)
21045{
21046 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);
21047}
21048
21049/**
21050 * event_log_proxy_new_for_bus_finish:
21051 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to event_log_proxy_new_for_bus().
21052 * @error: Return location for error or %NULL
21053 *
21054 * Finishes an operation started with event_log_proxy_new_for_bus().
21055 *
21056 * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set.
21057 */
21058EventLog *
21059event_log_proxy_new_for_bus_finish (
21060 GAsyncResult *res,
21061 GError **error)
21062{
21063 GObject *ret;
21064 GObject *source_object;
21065 source_object = g_async_result_get_source_object (res);
21066 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
21067 g_object_unref (source_object);
21068 if (ret != NULL)
21069 return EVENT_LOG (ret);
21070 else
21071 return NULL;
21072}
21073
21074/**
21075 * event_log_proxy_new_for_bus_sync:
21076 * @bus_type: A #GBusType.
21077 * @flags: Flags from the #GDBusProxyFlags enumeration.
21078 * @name: A bus name (well-known or unique).
21079 * @object_path: An object path.
21080 * @cancellable: (allow-none): A #GCancellable or %NULL.
21081 * @error: Return location for error or %NULL
21082 *
21083 * Like event_log_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
21084 *
21085 * The calling thread is blocked until a reply is received.
21086 *
21087 * See event_log_proxy_new_for_bus() for the asynchronous version of this constructor.
21088 *
21089 * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set.
21090 */
21091EventLog *
21092event_log_proxy_new_for_bus_sync (
21093 GBusType bus_type,
21094 GDBusProxyFlags flags,
21095 const gchar *name,
21096 const gchar *object_path,
21097 GCancellable *cancellable,
21098 GError **error)
21099{
21100 GInitable *ret;
21101 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);
21102 if (ret != NULL)
21103 return EVENT_LOG (ret);
21104 else
21105 return NULL;
21106}
21107
21108
21109/* ------------------------------------------------------------------------ */
21110
21111/**
21112 * EventLogSkeleton:
21113 *
21114 * The #EventLogSkeleton structure contains only private data and should only be accessed using the provided API.
21115 */
21116
21117/**
21118 * EventLogSkeletonClass:
21119 * @parent_class: The parent class.
21120 *
21121 * Class structure for #EventLogSkeleton.
21122 */
21123
21124struct _EventLogSkeletonPrivate
21125{
21126 GValue *properties;
21127 GList *changed_properties;
21128 GSource *changed_properties_idle_source;
21129 GMainContext *context;
21130 GMutex lock;
21131};
21132
21133static void
21134_event_log_skeleton_handle_method_call (
21135 GDBusConnection *connection G_GNUC_UNUSED,
21136 const gchar *sender G_GNUC_UNUSED,
21137 const gchar *object_path G_GNUC_UNUSED,
21138 const gchar *interface_name,
21139 const gchar *method_name,
21140 GVariant *parameters,
21141 GDBusMethodInvocation *invocation,
21142 gpointer user_data)
21143{
21144 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (user_data);
21145 _ExtendedGDBusMethodInfo *info;
21146 GVariantIter iter;
21147 GVariant *child;
21148 GValue *paramv;
21149 guint num_params;
21150 guint num_extra;
21151 guint n;
21152 guint signal_id;
21153 GValue return_value = G_VALUE_INIT;
21154 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
21155 g_assert (info != NULL);
21156 num_params = g_variant_n_children (parameters);
21157 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
21158 n = 0;
21159 g_value_init (&paramv[n], TYPE_EVENT_LOG);
21160 g_value_set_object (&paramv[n++], skeleton);
21161 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
21162 g_value_set_object (&paramv[n++], invocation);
21163 if (info->pass_fdlist)
21164 {
21165#ifdef G_OS_UNIX
21166 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
21167 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
21168#else
21169 g_assert_not_reached ();
21170#endif
21171 }
21172 g_variant_iter_init (&iter, parameters);
21173 while ((child = g_variant_iter_next_value (&iter)) != NULL)
21174 {
21175 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
21176 if (arg_info->use_gvariant)
21177 {
21178 g_value_init (&paramv[n], G_TYPE_VARIANT);
21179 g_value_set_variant (&paramv[n], child);
21180 n++;
21181 }
21182 else
21183 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
21184 g_variant_unref (child);
21185 }
21186 signal_id = g_signal_lookup (info->signal_name, TYPE_EVENT_LOG);
21187 g_value_init (&return_value, G_TYPE_BOOLEAN);
21188 g_signal_emitv (paramv, signal_id, 0, &return_value);
21189 if (!g_value_get_boolean (&return_value))
21190 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);
21191 g_value_unset (&return_value);
21192 for (n = 0; n < num_params + num_extra; n++)
21193 g_value_unset (&paramv[n]);
21194 g_free (paramv);
21195}
21196
21197static GVariant *
21198_event_log_skeleton_handle_get_property (
21199 GDBusConnection *connection G_GNUC_UNUSED,
21200 const gchar *sender G_GNUC_UNUSED,
21201 const gchar *object_path G_GNUC_UNUSED,
21202 const gchar *interface_name G_GNUC_UNUSED,
21203 const gchar *property_name,
21204 GError **error,
21205 gpointer user_data)
21206{
21207 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (user_data);
21208 GValue value = G_VALUE_INIT;
21209 GParamSpec *pspec;
21210 _ExtendedGDBusPropertyInfo *info;
21211 GVariant *ret;
21212 ret = NULL;
21213 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, property_name);
21214 g_assert (info != NULL);
21215 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
21216 if (pspec == NULL)
21217 {
21218 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
21219 }
21220 else
21221 {
21222 g_value_init (&value, pspec->value_type);
21223 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
21224 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
21225 g_value_unset (&value);
21226 }
21227 return ret;
21228}
21229
21230static gboolean
21231_event_log_skeleton_handle_set_property (
21232 GDBusConnection *connection G_GNUC_UNUSED,
21233 const gchar *sender G_GNUC_UNUSED,
21234 const gchar *object_path G_GNUC_UNUSED,
21235 const gchar *interface_name G_GNUC_UNUSED,
21236 const gchar *property_name,
21237 GVariant *variant,
21238 GError **error,
21239 gpointer user_data)
21240{
21241 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (user_data);
21242 GValue value = G_VALUE_INIT;
21243 GParamSpec *pspec;
21244 _ExtendedGDBusPropertyInfo *info;
21245 gboolean ret;
21246 ret = FALSE;
21247 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, property_name);
21248 g_assert (info != NULL);
21249 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
21250 if (pspec == NULL)
21251 {
21252 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
21253 }
21254 else
21255 {
21256 if (info->use_gvariant)
21257 g_value_set_variant (&value, variant);
21258 else
21259 g_dbus_gvariant_to_gvalue (variant, &value);
21260 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
21261 g_value_unset (&value);
21262 ret = TRUE;
21263 }
21264 return ret;
21265}
21266
21267static const GDBusInterfaceVTable _event_log_skeleton_vtable =
21268{
21269 _event_log_skeleton_handle_method_call,
21270 _event_log_skeleton_handle_get_property,
21271 _event_log_skeleton_handle_set_property,
21272 {NULL}
21273};
21274
21275static GDBusInterfaceInfo *
21276event_log_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
21277{
21278 return event_log_interface_info ();
21279}
21280
21281static GDBusInterfaceVTable *
21282event_log_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
21283{
21284 return (GDBusInterfaceVTable *) &_event_log_skeleton_vtable;
21285}
21286
21287static GVariant *
21288event_log_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
21289{
21290 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (_skeleton);
21291
21292 GVariantBuilder builder;
21293 guint n;
21294 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
21295 if (_event_log_interface_info.parent_struct.properties == NULL)
21296 goto out;
21297 for (n = 0; _event_log_interface_info.parent_struct.properties[n] != NULL; n++)
21298 {
21299 GDBusPropertyInfo *info = _event_log_interface_info.parent_struct.properties[n];
21300 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
21301 {
21302 GVariant *value;
21303 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);
21304 if (value != NULL)
21305 {
21306 g_variant_take_ref (value);
21307 g_variant_builder_add (&builder, "{sv}", info->name, value);
21308 g_variant_unref (value);
21309 }
21310 }
21311 }
21312out:
21313 return g_variant_builder_end (&builder);
21314}
21315
Norman James362a80f2015-09-14 14:04:39 -050021316static void
21317event_log_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
21318{
Norman James362a80f2015-09-14 14:04:39 -050021319}
21320
21321static void
21322_event_log_on_signal_event_log (
21323 EventLog *object,
Norman James8abb50c2015-09-16 10:58:16 -050021324 gint arg_priority,
Norman James88872672015-09-21 16:51:35 -050021325 const gchar *arg_message,
21326 gint arg_rc)
Norman James362a80f2015-09-14 14:04:39 -050021327{
21328 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (object);
21329
21330 GList *connections, *l;
21331 GVariant *signal_variant;
21332 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
21333
Norman James88872672015-09-21 16:51:35 -050021334 signal_variant = g_variant_ref_sink (g_variant_new ("(isi)",
Norman James8abb50c2015-09-16 10:58:16 -050021335 arg_priority,
Norman James88872672015-09-21 16:51:35 -050021336 arg_message,
21337 arg_rc));
Norman James362a80f2015-09-14 14:04:39 -050021338 for (l = connections; l != NULL; l = l->next)
21339 {
21340 GDBusConnection *connection = l->data;
21341 g_dbus_connection_emit_signal (connection,
21342 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.EventLog", "EventLog",
21343 signal_variant, NULL);
21344 }
21345 g_variant_unref (signal_variant);
21346 g_list_free_full (connections, g_object_unref);
21347}
21348
21349static void event_log_skeleton_iface_init (EventLogIface *iface);
21350#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
21351G_DEFINE_TYPE_WITH_CODE (EventLogSkeleton, event_log_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
21352 G_ADD_PRIVATE (EventLogSkeleton)
21353 G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_skeleton_iface_init));
21354
21355#else
21356G_DEFINE_TYPE_WITH_CODE (EventLogSkeleton, event_log_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
21357 G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_skeleton_iface_init));
21358
21359#endif
21360static void
21361event_log_skeleton_finalize (GObject *object)
21362{
21363 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (object);
Norman James362a80f2015-09-14 14:04:39 -050021364 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
21365 if (skeleton->priv->changed_properties_idle_source != NULL)
21366 g_source_destroy (skeleton->priv->changed_properties_idle_source);
21367 g_main_context_unref (skeleton->priv->context);
21368 g_mutex_clear (&skeleton->priv->lock);
21369 G_OBJECT_CLASS (event_log_skeleton_parent_class)->finalize (object);
21370}
21371
21372static void
Norman James362a80f2015-09-14 14:04:39 -050021373event_log_skeleton_init (EventLogSkeleton *skeleton)
21374{
21375#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
21376 skeleton->priv = event_log_skeleton_get_instance_private (skeleton);
21377#else
21378 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_EVENT_LOG_SKELETON, EventLogSkeletonPrivate);
21379#endif
21380
21381 g_mutex_init (&skeleton->priv->lock);
21382 skeleton->priv->context = g_main_context_ref_thread_default ();
Norman James362a80f2015-09-14 14:04:39 -050021383}
21384
21385static void
21386event_log_skeleton_class_init (EventLogSkeletonClass *klass)
21387{
21388 GObjectClass *gobject_class;
21389 GDBusInterfaceSkeletonClass *skeleton_class;
21390
21391 gobject_class = G_OBJECT_CLASS (klass);
21392 gobject_class->finalize = event_log_skeleton_finalize;
Norman James362a80f2015-09-14 14:04:39 -050021393
21394 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
21395 skeleton_class->get_info = event_log_skeleton_dbus_interface_get_info;
21396 skeleton_class->get_properties = event_log_skeleton_dbus_interface_get_properties;
21397 skeleton_class->flush = event_log_skeleton_dbus_interface_flush;
21398 skeleton_class->get_vtable = event_log_skeleton_dbus_interface_get_vtable;
21399
21400#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
21401 g_type_class_add_private (klass, sizeof (EventLogSkeletonPrivate));
21402#endif
21403}
21404
21405static void
21406event_log_skeleton_iface_init (EventLogIface *iface)
21407{
21408 iface->event_log = _event_log_on_signal_event_log;
Norman James362a80f2015-09-14 14:04:39 -050021409}
21410
21411/**
21412 * event_log_skeleton_new:
21413 *
21414 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>.
21415 *
21416 * Returns: (transfer full) (type EventLogSkeleton): The skeleton object.
21417 */
21418EventLog *
21419event_log_skeleton_new (void)
21420{
21421 return EVENT_LOG (g_object_new (TYPE_EVENT_LOG_SKELETON, NULL));
21422}
21423
21424/* ------------------------------------------------------------------------
21425 * Code for interface org.openbmc.Flash
21426 * ------------------------------------------------------------------------
21427 */
21428
21429/**
21430 * SECTION:Flash
21431 * @title: Flash
21432 * @short_description: Generated C code for the org.openbmc.Flash D-Bus interface
21433 *
21434 * 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.
21435 */
21436
21437/* ---- Introspection data for org.openbmc.Flash ---- */
21438
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021439static const _ExtendedGDBusArgInfo _flash_method_info_update_IN_ARG_filename =
Norman James362a80f2015-09-14 14:04:39 -050021440{
21441 {
21442 -1,
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021443 (gchar *) "filename",
Norman James362a80f2015-09-14 14:04:39 -050021444 (gchar *) "s",
21445 NULL
21446 },
21447 FALSE
21448};
21449
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021450static const _ExtendedGDBusArgInfo * const _flash_method_info_update_IN_ARG_pointers[] =
Norman James362a80f2015-09-14 14:04:39 -050021451{
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021452 &_flash_method_info_update_IN_ARG_filename,
Norman James362a80f2015-09-14 14:04:39 -050021453 NULL
21454};
21455
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021456static const _ExtendedGDBusMethodInfo _flash_method_info_update =
Norman James362a80f2015-09-14 14:04:39 -050021457{
21458 {
21459 -1,
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021460 (gchar *) "update",
21461 (GDBusArgInfo **) &_flash_method_info_update_IN_ARG_pointers,
Norman James362a80f2015-09-14 14:04:39 -050021462 NULL,
21463 NULL
21464 },
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021465 "handle-update",
Norman James362a80f2015-09-14 14:04:39 -050021466 FALSE
21467};
21468
Norman James166acf42015-10-22 07:11:51 -050021469static const _ExtendedGDBusArgInfo _flash_method_info_error_IN_ARG_message =
21470{
21471 {
21472 -1,
21473 (gchar *) "message",
21474 (gchar *) "s",
21475 NULL
21476 },
21477 FALSE
21478};
21479
21480static const _ExtendedGDBusArgInfo * const _flash_method_info_error_IN_ARG_pointers[] =
21481{
21482 &_flash_method_info_error_IN_ARG_message,
21483 NULL
21484};
21485
21486static const _ExtendedGDBusMethodInfo _flash_method_info_error =
21487{
21488 {
21489 -1,
21490 (gchar *) "error",
21491 (GDBusArgInfo **) &_flash_method_info_error_IN_ARG_pointers,
21492 NULL,
21493 NULL
21494 },
21495 "handle-error",
21496 FALSE
21497};
21498
21499static const _ExtendedGDBusMethodInfo _flash_method_info_done =
21500{
21501 {
21502 -1,
21503 (gchar *) "done",
21504 NULL,
21505 NULL,
21506 NULL
21507 },
21508 "handle-done",
21509 FALSE
21510};
21511
Norman Jamesf066e872015-10-07 15:29:51 -050021512static const _ExtendedGDBusArgInfo _flash_method_info_update_via_tftp_IN_ARG_url =
21513{
21514 {
21515 -1,
21516 (gchar *) "url",
21517 (gchar *) "s",
21518 NULL
21519 },
21520 FALSE
21521};
21522
21523static const _ExtendedGDBusArgInfo _flash_method_info_update_via_tftp_IN_ARG_filename =
21524{
21525 {
21526 -1,
21527 (gchar *) "filename",
21528 (gchar *) "s",
21529 NULL
21530 },
21531 FALSE
21532};
21533
21534static const _ExtendedGDBusArgInfo * const _flash_method_info_update_via_tftp_IN_ARG_pointers[] =
21535{
21536 &_flash_method_info_update_via_tftp_IN_ARG_url,
21537 &_flash_method_info_update_via_tftp_IN_ARG_filename,
21538 NULL
21539};
21540
21541static const _ExtendedGDBusMethodInfo _flash_method_info_update_via_tftp =
21542{
21543 {
21544 -1,
21545 (gchar *) "updateViaTftp",
21546 (GDBusArgInfo **) &_flash_method_info_update_via_tftp_IN_ARG_pointers,
21547 NULL,
21548 NULL
21549 },
21550 "handle-update-via-tftp",
21551 FALSE
21552};
21553
Norman James362a80f2015-09-14 14:04:39 -050021554static const _ExtendedGDBusMethodInfo _flash_method_info_init =
21555{
21556 {
21557 -1,
21558 (gchar *) "init",
21559 NULL,
21560 NULL,
21561 NULL
21562 },
21563 "handle-init",
21564 FALSE
21565};
21566
21567static const _ExtendedGDBusMethodInfo * const _flash_method_info_pointers[] =
21568{
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021569 &_flash_method_info_update,
Norman James166acf42015-10-22 07:11:51 -050021570 &_flash_method_info_error,
21571 &_flash_method_info_done,
Norman Jamesf066e872015-10-07 15:29:51 -050021572 &_flash_method_info_update_via_tftp,
Norman James362a80f2015-09-14 14:04:39 -050021573 &_flash_method_info_init,
21574 NULL
21575};
21576
21577static const _ExtendedGDBusSignalInfo _flash_signal_info_updated =
21578{
21579 {
21580 -1,
21581 (gchar *) "Updated",
21582 NULL,
21583 NULL
21584 },
21585 "updated"
21586};
21587
Norman Jamesf066e872015-10-07 15:29:51 -050021588static const _ExtendedGDBusArgInfo _flash_signal_info_download_ARG_url =
21589{
21590 {
21591 -1,
21592 (gchar *) "url",
21593 (gchar *) "s",
21594 NULL
21595 },
21596 FALSE
21597};
21598
21599static const _ExtendedGDBusArgInfo _flash_signal_info_download_ARG_filename =
21600{
21601 {
21602 -1,
21603 (gchar *) "filename",
21604 (gchar *) "s",
21605 NULL
21606 },
21607 FALSE
21608};
21609
21610static const _ExtendedGDBusArgInfo * const _flash_signal_info_download_ARG_pointers[] =
21611{
21612 &_flash_signal_info_download_ARG_url,
21613 &_flash_signal_info_download_ARG_filename,
21614 NULL
21615};
21616
21617static const _ExtendedGDBusSignalInfo _flash_signal_info_download =
21618{
21619 {
21620 -1,
21621 (gchar *) "Download",
21622 (GDBusArgInfo **) &_flash_signal_info_download_ARG_pointers,
21623 NULL
21624 },
21625 "download"
21626};
21627
Norman James362a80f2015-09-14 14:04:39 -050021628static const _ExtendedGDBusSignalInfo * const _flash_signal_info_pointers[] =
21629{
21630 &_flash_signal_info_updated,
Norman Jamesf066e872015-10-07 15:29:51 -050021631 &_flash_signal_info_download,
Norman James362a80f2015-09-14 14:04:39 -050021632 NULL
21633};
21634
Norman James18998182015-10-11 21:54:53 -050021635static const _ExtendedGDBusPropertyInfo _flash_property_info_filename =
21636{
21637 {
21638 -1,
21639 (gchar *) "filename",
21640 (gchar *) "s",
21641 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
21642 NULL
21643 },
21644 "filename",
21645 FALSE
21646};
21647
21648static const _ExtendedGDBusPropertyInfo _flash_property_info_flasher_path =
21649{
21650 {
21651 -1,
21652 (gchar *) "flasher_path",
21653 (gchar *) "s",
21654 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
21655 NULL
21656 },
21657 "flasher-path",
21658 FALSE
21659};
21660
21661static const _ExtendedGDBusPropertyInfo _flash_property_info_flasher_name =
21662{
21663 {
21664 -1,
21665 (gchar *) "flasher_name",
21666 (gchar *) "s",
21667 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
21668 NULL
21669 },
21670 "flasher-name",
21671 FALSE
21672};
21673
21674static const _ExtendedGDBusPropertyInfo _flash_property_info_flasher_instance =
21675{
21676 {
21677 -1,
21678 (gchar *) "flasher_instance",
21679 (gchar *) "s",
21680 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
21681 NULL
21682 },
21683 "flasher-instance",
21684 FALSE
21685};
21686
Norman James166acf42015-10-22 07:11:51 -050021687static const _ExtendedGDBusPropertyInfo _flash_property_info_status =
21688{
21689 {
21690 -1,
21691 (gchar *) "status",
21692 (gchar *) "s",
21693 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
21694 NULL
21695 },
21696 "status",
21697 FALSE
21698};
21699
Norman James18998182015-10-11 21:54:53 -050021700static const _ExtendedGDBusPropertyInfo * const _flash_property_info_pointers[] =
21701{
21702 &_flash_property_info_filename,
21703 &_flash_property_info_flasher_path,
21704 &_flash_property_info_flasher_name,
21705 &_flash_property_info_flasher_instance,
Norman James166acf42015-10-22 07:11:51 -050021706 &_flash_property_info_status,
Norman James18998182015-10-11 21:54:53 -050021707 NULL
21708};
21709
Norman James362a80f2015-09-14 14:04:39 -050021710static const _ExtendedGDBusInterfaceInfo _flash_interface_info =
21711{
21712 {
21713 -1,
21714 (gchar *) "org.openbmc.Flash",
21715 (GDBusMethodInfo **) &_flash_method_info_pointers,
21716 (GDBusSignalInfo **) &_flash_signal_info_pointers,
Norman James18998182015-10-11 21:54:53 -050021717 (GDBusPropertyInfo **) &_flash_property_info_pointers,
Norman James362a80f2015-09-14 14:04:39 -050021718 NULL
21719 },
21720 "flash",
21721};
21722
21723
21724/**
21725 * flash_interface_info:
21726 *
21727 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link> D-Bus interface.
21728 *
21729 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
21730 */
21731GDBusInterfaceInfo *
21732flash_interface_info (void)
21733{
21734 return (GDBusInterfaceInfo *) &_flash_interface_info.parent_struct;
21735}
21736
21737/**
21738 * flash_override_properties:
21739 * @klass: The class structure for a #GObject<!-- -->-derived class.
21740 * @property_id_begin: The property id to assign to the first overridden property.
21741 *
21742 * Overrides all #GObject properties in the #Flash interface for a concrete class.
21743 * The properties are overridden in the order they are defined.
21744 *
21745 * Returns: The last property id.
21746 */
21747guint
21748flash_override_properties (GObjectClass *klass, guint property_id_begin)
21749{
Norman James18998182015-10-11 21:54:53 -050021750 g_object_class_override_property (klass, property_id_begin++, "filename");
21751 g_object_class_override_property (klass, property_id_begin++, "flasher-path");
21752 g_object_class_override_property (klass, property_id_begin++, "flasher-name");
21753 g_object_class_override_property (klass, property_id_begin++, "flasher-instance");
Norman James166acf42015-10-22 07:11:51 -050021754 g_object_class_override_property (klass, property_id_begin++, "status");
Norman James362a80f2015-09-14 14:04:39 -050021755 return property_id_begin - 1;
21756}
21757
21758
21759
21760/**
21761 * Flash:
21762 *
21763 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>.
21764 */
21765
21766/**
21767 * FlashIface:
21768 * @parent_iface: The parent interface.
Norman James166acf42015-10-22 07:11:51 -050021769 * @handle_done: Handler for the #Flash::handle-done signal.
21770 * @handle_error: Handler for the #Flash::handle-error signal.
Norman James362a80f2015-09-14 14:04:39 -050021771 * @handle_init: Handler for the #Flash::handle-init signal.
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021772 * @handle_update: Handler for the #Flash::handle-update signal.
Norman Jamesf066e872015-10-07 15:29:51 -050021773 * @handle_update_via_tftp: Handler for the #Flash::handle-update-via-tftp signal.
Norman James18998182015-10-11 21:54:53 -050021774 * @get_filename: Getter for the #Flash:filename property.
21775 * @get_flasher_instance: Getter for the #Flash:flasher-instance property.
21776 * @get_flasher_name: Getter for the #Flash:flasher-name property.
21777 * @get_flasher_path: Getter for the #Flash:flasher-path property.
Norman James166acf42015-10-22 07:11:51 -050021778 * @get_status: Getter for the #Flash:status property.
Norman Jamesf066e872015-10-07 15:29:51 -050021779 * @download: Handler for the #Flash::download signal.
Norman James362a80f2015-09-14 14:04:39 -050021780 * @updated: Handler for the #Flash::updated signal.
21781 *
21782 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>.
21783 */
21784
21785typedef FlashIface FlashInterface;
21786G_DEFINE_INTERFACE (Flash, flash, G_TYPE_OBJECT);
21787
21788static void
21789flash_default_init (FlashIface *iface)
21790{
21791 /* GObject signals for incoming D-Bus method calls: */
21792 /**
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021793 * Flash::handle-update:
Norman James362a80f2015-09-14 14:04:39 -050021794 * @object: A #Flash.
21795 * @invocation: A #GDBusMethodInvocation.
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021796 * @arg_filename: Argument passed by remote caller.
Norman James362a80f2015-09-14 14:04:39 -050021797 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021798 * 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 -050021799 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021800 * 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 -050021801 *
21802 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
21803 */
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021804 g_signal_new ("handle-update",
Norman James362a80f2015-09-14 14:04:39 -050021805 G_TYPE_FROM_INTERFACE (iface),
21806 G_SIGNAL_RUN_LAST,
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021807 G_STRUCT_OFFSET (FlashIface, handle_update),
Norman James362a80f2015-09-14 14:04:39 -050021808 g_signal_accumulator_true_handled,
21809 NULL,
21810 g_cclosure_marshal_generic,
21811 G_TYPE_BOOLEAN,
21812 2,
21813 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING);
21814
21815 /**
Norman James166acf42015-10-22 07:11:51 -050021816 * Flash::handle-error:
21817 * @object: A #Flash.
21818 * @invocation: A #GDBusMethodInvocation.
21819 * @arg_message: Argument passed by remote caller.
21820 *
21821 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.error">error()</link> D-Bus method.
21822 *
21823 * 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.
21824 *
21825 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
21826 */
21827 g_signal_new ("handle-error",
21828 G_TYPE_FROM_INTERFACE (iface),
21829 G_SIGNAL_RUN_LAST,
21830 G_STRUCT_OFFSET (FlashIface, handle_error),
21831 g_signal_accumulator_true_handled,
21832 NULL,
21833 g_cclosure_marshal_generic,
21834 G_TYPE_BOOLEAN,
21835 2,
21836 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING);
21837
21838 /**
21839 * Flash::handle-done:
21840 * @object: A #Flash.
21841 * @invocation: A #GDBusMethodInvocation.
21842 *
21843 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.done">done()</link> D-Bus method.
21844 *
21845 * 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.
21846 *
21847 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
21848 */
21849 g_signal_new ("handle-done",
21850 G_TYPE_FROM_INTERFACE (iface),
21851 G_SIGNAL_RUN_LAST,
21852 G_STRUCT_OFFSET (FlashIface, handle_done),
21853 g_signal_accumulator_true_handled,
21854 NULL,
21855 g_cclosure_marshal_generic,
21856 G_TYPE_BOOLEAN,
21857 1,
21858 G_TYPE_DBUS_METHOD_INVOCATION);
21859
21860 /**
Norman Jamesf066e872015-10-07 15:29:51 -050021861 * Flash::handle-update-via-tftp:
21862 * @object: A #Flash.
21863 * @invocation: A #GDBusMethodInvocation.
21864 * @arg_url: Argument passed by remote caller.
21865 * @arg_filename: Argument passed by remote caller.
21866 *
21867 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.updateViaTftp">updateViaTftp()</link> D-Bus method.
21868 *
21869 * 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.
21870 *
21871 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
21872 */
21873 g_signal_new ("handle-update-via-tftp",
21874 G_TYPE_FROM_INTERFACE (iface),
21875 G_SIGNAL_RUN_LAST,
21876 G_STRUCT_OFFSET (FlashIface, handle_update_via_tftp),
21877 g_signal_accumulator_true_handled,
21878 NULL,
21879 g_cclosure_marshal_generic,
21880 G_TYPE_BOOLEAN,
21881 3,
21882 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_STRING);
21883
21884 /**
Norman James362a80f2015-09-14 14:04:39 -050021885 * Flash::handle-init:
21886 * @object: A #Flash.
21887 * @invocation: A #GDBusMethodInvocation.
21888 *
21889 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.init">init()</link> D-Bus method.
21890 *
21891 * 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.
21892 *
21893 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
21894 */
21895 g_signal_new ("handle-init",
21896 G_TYPE_FROM_INTERFACE (iface),
21897 G_SIGNAL_RUN_LAST,
21898 G_STRUCT_OFFSET (FlashIface, handle_init),
21899 g_signal_accumulator_true_handled,
21900 NULL,
21901 g_cclosure_marshal_generic,
21902 G_TYPE_BOOLEAN,
21903 1,
21904 G_TYPE_DBUS_METHOD_INVOCATION);
21905
21906 /* GObject signals for received D-Bus signals: */
21907 /**
21908 * Flash::updated:
21909 * @object: A #Flash.
21910 *
21911 * 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.
21912 *
21913 * 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.
21914 */
21915 g_signal_new ("updated",
21916 G_TYPE_FROM_INTERFACE (iface),
21917 G_SIGNAL_RUN_LAST,
21918 G_STRUCT_OFFSET (FlashIface, updated),
21919 NULL,
21920 NULL,
21921 g_cclosure_marshal_generic,
21922 G_TYPE_NONE,
21923 0);
21924
Norman Jamesf066e872015-10-07 15:29:51 -050021925 /**
21926 * Flash::download:
21927 * @object: A #Flash.
21928 * @arg_url: Argument.
21929 * @arg_filename: Argument.
21930 *
21931 * 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.
21932 *
21933 * 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.
21934 */
21935 g_signal_new ("download",
21936 G_TYPE_FROM_INTERFACE (iface),
21937 G_SIGNAL_RUN_LAST,
21938 G_STRUCT_OFFSET (FlashIface, download),
21939 NULL,
21940 NULL,
21941 g_cclosure_marshal_generic,
21942 G_TYPE_NONE,
21943 2, G_TYPE_STRING, G_TYPE_STRING);
21944
Norman James18998182015-10-11 21:54:53 -050021945 /* GObject properties for D-Bus properties: */
21946 /**
21947 * Flash:filename:
21948 *
21949 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Flash.filename">"filename"</link>.
21950 *
21951 * 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.
21952 */
21953 g_object_interface_install_property (iface,
21954 g_param_spec_string ("filename", "filename", "filename", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
21955 /**
21956 * Flash:flasher-path:
21957 *
21958 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Flash.flasher_path">"flasher_path"</link>.
21959 *
21960 * 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.
21961 */
21962 g_object_interface_install_property (iface,
21963 g_param_spec_string ("flasher-path", "flasher_path", "flasher_path", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
21964 /**
21965 * Flash:flasher-name:
21966 *
21967 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Flash.flasher_name">"flasher_name"</link>.
21968 *
21969 * 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.
21970 */
21971 g_object_interface_install_property (iface,
21972 g_param_spec_string ("flasher-name", "flasher_name", "flasher_name", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
21973 /**
21974 * Flash:flasher-instance:
21975 *
21976 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Flash.flasher_instance">"flasher_instance"</link>.
21977 *
21978 * 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.
21979 */
21980 g_object_interface_install_property (iface,
21981 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 -050021982 /**
21983 * Flash:status:
21984 *
21985 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Flash.status">"status"</link>.
21986 *
21987 * 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.
21988 */
21989 g_object_interface_install_property (iface,
21990 g_param_spec_string ("status", "status", "status", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Norman James18998182015-10-11 21:54:53 -050021991}
21992
21993/**
21994 * flash_get_filename: (skip)
21995 * @object: A #Flash.
21996 *
21997 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Flash.filename">"filename"</link> D-Bus property.
21998 *
21999 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
22000 *
22001 * <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>
22002 *
22003 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
22004 */
22005const gchar *
22006flash_get_filename (Flash *object)
22007{
22008 return FLASH_GET_IFACE (object)->get_filename (object);
22009}
22010
22011/**
22012 * flash_dup_filename: (skip)
22013 * @object: A #Flash.
22014 *
22015 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Flash.filename">"filename"</link> D-Bus property.
22016 *
22017 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
22018 *
22019 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
22020 */
22021gchar *
22022flash_dup_filename (Flash *object)
22023{
22024 gchar *value;
22025 g_object_get (G_OBJECT (object), "filename", &value, NULL);
22026 return value;
22027}
22028
22029/**
22030 * flash_set_filename: (skip)
22031 * @object: A #Flash.
22032 * @value: The value to set.
22033 *
22034 * Sets the <link linkend="gdbus-property-org-openbmc-Flash.filename">"filename"</link> D-Bus property to @value.
22035 *
22036 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
22037 */
22038void
22039flash_set_filename (Flash *object, const gchar *value)
22040{
22041 g_object_set (G_OBJECT (object), "filename", value, NULL);
22042}
22043
22044/**
22045 * flash_get_flasher_path: (skip)
22046 * @object: A #Flash.
22047 *
22048 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_path">"flasher_path"</link> D-Bus property.
22049 *
22050 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
22051 *
22052 * <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>
22053 *
22054 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
22055 */
22056const gchar *
22057flash_get_flasher_path (Flash *object)
22058{
22059 return FLASH_GET_IFACE (object)->get_flasher_path (object);
22060}
22061
22062/**
22063 * flash_dup_flasher_path: (skip)
22064 * @object: A #Flash.
22065 *
22066 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_path">"flasher_path"</link> D-Bus property.
22067 *
22068 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
22069 *
22070 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
22071 */
22072gchar *
22073flash_dup_flasher_path (Flash *object)
22074{
22075 gchar *value;
22076 g_object_get (G_OBJECT (object), "flasher-path", &value, NULL);
22077 return value;
22078}
22079
22080/**
22081 * flash_set_flasher_path: (skip)
22082 * @object: A #Flash.
22083 * @value: The value to set.
22084 *
22085 * Sets the <link linkend="gdbus-property-org-openbmc-Flash.flasher_path">"flasher_path"</link> D-Bus property to @value.
22086 *
22087 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
22088 */
22089void
22090flash_set_flasher_path (Flash *object, const gchar *value)
22091{
22092 g_object_set (G_OBJECT (object), "flasher-path", value, NULL);
22093}
22094
22095/**
22096 * flash_get_flasher_name: (skip)
22097 * @object: A #Flash.
22098 *
22099 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_name">"flasher_name"</link> D-Bus property.
22100 *
22101 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
22102 *
22103 * <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>
22104 *
22105 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
22106 */
22107const gchar *
22108flash_get_flasher_name (Flash *object)
22109{
22110 return FLASH_GET_IFACE (object)->get_flasher_name (object);
22111}
22112
22113/**
22114 * flash_dup_flasher_name: (skip)
22115 * @object: A #Flash.
22116 *
22117 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_name">"flasher_name"</link> D-Bus property.
22118 *
22119 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
22120 *
22121 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
22122 */
22123gchar *
22124flash_dup_flasher_name (Flash *object)
22125{
22126 gchar *value;
22127 g_object_get (G_OBJECT (object), "flasher-name", &value, NULL);
22128 return value;
22129}
22130
22131/**
22132 * flash_set_flasher_name: (skip)
22133 * @object: A #Flash.
22134 * @value: The value to set.
22135 *
22136 * Sets the <link linkend="gdbus-property-org-openbmc-Flash.flasher_name">"flasher_name"</link> D-Bus property to @value.
22137 *
22138 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
22139 */
22140void
22141flash_set_flasher_name (Flash *object, const gchar *value)
22142{
22143 g_object_set (G_OBJECT (object), "flasher-name", value, NULL);
22144}
22145
22146/**
22147 * flash_get_flasher_instance: (skip)
22148 * @object: A #Flash.
22149 *
22150 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_instance">"flasher_instance"</link> D-Bus property.
22151 *
22152 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
22153 *
22154 * <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>
22155 *
22156 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
22157 */
22158const gchar *
22159flash_get_flasher_instance (Flash *object)
22160{
22161 return FLASH_GET_IFACE (object)->get_flasher_instance (object);
22162}
22163
22164/**
22165 * flash_dup_flasher_instance: (skip)
22166 * @object: A #Flash.
22167 *
22168 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_instance">"flasher_instance"</link> D-Bus property.
22169 *
22170 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
22171 *
22172 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
22173 */
22174gchar *
22175flash_dup_flasher_instance (Flash *object)
22176{
22177 gchar *value;
22178 g_object_get (G_OBJECT (object), "flasher-instance", &value, NULL);
22179 return value;
22180}
22181
22182/**
22183 * flash_set_flasher_instance: (skip)
22184 * @object: A #Flash.
22185 * @value: The value to set.
22186 *
22187 * Sets the <link linkend="gdbus-property-org-openbmc-Flash.flasher_instance">"flasher_instance"</link> D-Bus property to @value.
22188 *
22189 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
22190 */
22191void
22192flash_set_flasher_instance (Flash *object, const gchar *value)
22193{
22194 g_object_set (G_OBJECT (object), "flasher-instance", value, NULL);
Norman James362a80f2015-09-14 14:04:39 -050022195}
22196
22197/**
Norman James166acf42015-10-22 07:11:51 -050022198 * flash_get_status: (skip)
22199 * @object: A #Flash.
22200 *
22201 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Flash.status">"status"</link> D-Bus property.
22202 *
22203 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
22204 *
22205 * <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>
22206 *
22207 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
22208 */
22209const gchar *
22210flash_get_status (Flash *object)
22211{
22212 return FLASH_GET_IFACE (object)->get_status (object);
22213}
22214
22215/**
22216 * flash_dup_status: (skip)
22217 * @object: A #Flash.
22218 *
22219 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Flash.status">"status"</link> D-Bus property.
22220 *
22221 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
22222 *
22223 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
22224 */
22225gchar *
22226flash_dup_status (Flash *object)
22227{
22228 gchar *value;
22229 g_object_get (G_OBJECT (object), "status", &value, NULL);
22230 return value;
22231}
22232
22233/**
22234 * flash_set_status: (skip)
22235 * @object: A #Flash.
22236 * @value: The value to set.
22237 *
22238 * Sets the <link linkend="gdbus-property-org-openbmc-Flash.status">"status"</link> D-Bus property to @value.
22239 *
22240 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
22241 */
22242void
22243flash_set_status (Flash *object, const gchar *value)
22244{
22245 g_object_set (G_OBJECT (object), "status", value, NULL);
22246}
22247
22248/**
Norman James362a80f2015-09-14 14:04:39 -050022249 * flash_emit_updated:
22250 * @object: A #Flash.
22251 *
22252 * Emits the <link linkend="gdbus-signal-org-openbmc-Flash.Updated">"Updated"</link> D-Bus signal.
22253 */
22254void
22255flash_emit_updated (
22256 Flash *object)
22257{
22258 g_signal_emit_by_name (object, "updated");
22259}
22260
22261/**
Norman Jamesf066e872015-10-07 15:29:51 -050022262 * flash_emit_download:
22263 * @object: A #Flash.
22264 * @arg_url: Argument to pass with the signal.
22265 * @arg_filename: Argument to pass with the signal.
22266 *
22267 * Emits the <link linkend="gdbus-signal-org-openbmc-Flash.Download">"Download"</link> D-Bus signal.
22268 */
22269void
22270flash_emit_download (
22271 Flash *object,
22272 const gchar *arg_url,
22273 const gchar *arg_filename)
22274{
22275 g_signal_emit_by_name (object, "download", arg_url, arg_filename);
22276}
22277
22278/**
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022279 * flash_call_update:
Norman James362a80f2015-09-14 14:04:39 -050022280 * @proxy: A #FlashProxy.
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022281 * @arg_filename: Argument to pass with the method invocation.
Norman James362a80f2015-09-14 14:04:39 -050022282 * @cancellable: (allow-none): A #GCancellable or %NULL.
22283 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
22284 * @user_data: User data to pass to @callback.
22285 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022286 * 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 -050022287 * 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 -050022288 * You can then call flash_call_update_finish() to get the result of the operation.
Norman James362a80f2015-09-14 14:04:39 -050022289 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022290 * See flash_call_update_sync() for the synchronous, blocking version of this method.
Norman James362a80f2015-09-14 14:04:39 -050022291 */
22292void
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022293flash_call_update (
Norman James362a80f2015-09-14 14:04:39 -050022294 Flash *proxy,
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022295 const gchar *arg_filename,
Norman James362a80f2015-09-14 14:04:39 -050022296 GCancellable *cancellable,
22297 GAsyncReadyCallback callback,
22298 gpointer user_data)
22299{
22300 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022301 "update",
Norman James362a80f2015-09-14 14:04:39 -050022302 g_variant_new ("(s)",
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022303 arg_filename),
Norman James362a80f2015-09-14 14:04:39 -050022304 G_DBUS_CALL_FLAGS_NONE,
22305 -1,
22306 cancellable,
22307 callback,
22308 user_data);
22309}
22310
22311/**
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022312 * flash_call_update_finish:
Norman James362a80f2015-09-14 14:04:39 -050022313 * @proxy: A #FlashProxy.
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022314 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_update().
Norman James362a80f2015-09-14 14:04:39 -050022315 * @error: Return location for error or %NULL.
22316 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022317 * Finishes an operation started with flash_call_update().
Norman James362a80f2015-09-14 14:04:39 -050022318 *
22319 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
22320 */
22321gboolean
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022322flash_call_update_finish (
Norman James362a80f2015-09-14 14:04:39 -050022323 Flash *proxy,
22324 GAsyncResult *res,
22325 GError **error)
22326{
22327 GVariant *_ret;
22328 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
22329 if (_ret == NULL)
22330 goto _out;
22331 g_variant_get (_ret,
22332 "()");
22333 g_variant_unref (_ret);
22334_out:
22335 return _ret != NULL;
22336}
22337
22338/**
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022339 * flash_call_update_sync:
Norman James362a80f2015-09-14 14:04:39 -050022340 * @proxy: A #FlashProxy.
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022341 * @arg_filename: Argument to pass with the method invocation.
Norman James362a80f2015-09-14 14:04:39 -050022342 * @cancellable: (allow-none): A #GCancellable or %NULL.
22343 * @error: Return location for error or %NULL.
22344 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022345 * 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 -050022346 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022347 * See flash_call_update() for the asynchronous version of this method.
Norman James362a80f2015-09-14 14:04:39 -050022348 *
22349 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
22350 */
22351gboolean
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022352flash_call_update_sync (
Norman James362a80f2015-09-14 14:04:39 -050022353 Flash *proxy,
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022354 const gchar *arg_filename,
Norman James362a80f2015-09-14 14:04:39 -050022355 GCancellable *cancellable,
22356 GError **error)
22357{
22358 GVariant *_ret;
22359 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022360 "update",
Norman James362a80f2015-09-14 14:04:39 -050022361 g_variant_new ("(s)",
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022362 arg_filename),
Norman James362a80f2015-09-14 14:04:39 -050022363 G_DBUS_CALL_FLAGS_NONE,
22364 -1,
22365 cancellable,
22366 error);
22367 if (_ret == NULL)
22368 goto _out;
22369 g_variant_get (_ret,
22370 "()");
22371 g_variant_unref (_ret);
22372_out:
22373 return _ret != NULL;
22374}
22375
22376/**
Norman James166acf42015-10-22 07:11:51 -050022377 * flash_call_error:
22378 * @proxy: A #FlashProxy.
22379 * @arg_message: Argument to pass with the method invocation.
22380 * @cancellable: (allow-none): A #GCancellable or %NULL.
22381 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
22382 * @user_data: User data to pass to @callback.
22383 *
22384 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.error">error()</link> D-Bus method on @proxy.
22385 * 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.
22386 * You can then call flash_call_error_finish() to get the result of the operation.
22387 *
22388 * See flash_call_error_sync() for the synchronous, blocking version of this method.
22389 */
22390void
22391flash_call_error (
22392 Flash *proxy,
22393 const gchar *arg_message,
22394 GCancellable *cancellable,
22395 GAsyncReadyCallback callback,
22396 gpointer user_data)
22397{
22398 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
22399 "error",
22400 g_variant_new ("(s)",
22401 arg_message),
22402 G_DBUS_CALL_FLAGS_NONE,
22403 -1,
22404 cancellable,
22405 callback,
22406 user_data);
22407}
22408
22409/**
22410 * flash_call_error_finish:
22411 * @proxy: A #FlashProxy.
22412 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_error().
22413 * @error: Return location for error or %NULL.
22414 *
22415 * Finishes an operation started with flash_call_error().
22416 *
22417 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
22418 */
22419gboolean
22420flash_call_error_finish (
22421 Flash *proxy,
22422 GAsyncResult *res,
22423 GError **error)
22424{
22425 GVariant *_ret;
22426 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
22427 if (_ret == NULL)
22428 goto _out;
22429 g_variant_get (_ret,
22430 "()");
22431 g_variant_unref (_ret);
22432_out:
22433 return _ret != NULL;
22434}
22435
22436/**
22437 * flash_call_error_sync:
22438 * @proxy: A #FlashProxy.
22439 * @arg_message: Argument to pass with the method invocation.
22440 * @cancellable: (allow-none): A #GCancellable or %NULL.
22441 * @error: Return location for error or %NULL.
22442 *
22443 * 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.
22444 *
22445 * See flash_call_error() for the asynchronous version of this method.
22446 *
22447 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
22448 */
22449gboolean
22450flash_call_error_sync (
22451 Flash *proxy,
22452 const gchar *arg_message,
22453 GCancellable *cancellable,
22454 GError **error)
22455{
22456 GVariant *_ret;
22457 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
22458 "error",
22459 g_variant_new ("(s)",
22460 arg_message),
22461 G_DBUS_CALL_FLAGS_NONE,
22462 -1,
22463 cancellable,
22464 error);
22465 if (_ret == NULL)
22466 goto _out;
22467 g_variant_get (_ret,
22468 "()");
22469 g_variant_unref (_ret);
22470_out:
22471 return _ret != NULL;
22472}
22473
22474/**
22475 * flash_call_done:
22476 * @proxy: A #FlashProxy.
22477 * @cancellable: (allow-none): A #GCancellable or %NULL.
22478 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
22479 * @user_data: User data to pass to @callback.
22480 *
22481 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.done">done()</link> D-Bus method on @proxy.
22482 * 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.
22483 * You can then call flash_call_done_finish() to get the result of the operation.
22484 *
22485 * See flash_call_done_sync() for the synchronous, blocking version of this method.
22486 */
22487void
22488flash_call_done (
22489 Flash *proxy,
22490 GCancellable *cancellable,
22491 GAsyncReadyCallback callback,
22492 gpointer user_data)
22493{
22494 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
22495 "done",
22496 g_variant_new ("()"),
22497 G_DBUS_CALL_FLAGS_NONE,
22498 -1,
22499 cancellable,
22500 callback,
22501 user_data);
22502}
22503
22504/**
22505 * flash_call_done_finish:
22506 * @proxy: A #FlashProxy.
22507 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_done().
22508 * @error: Return location for error or %NULL.
22509 *
22510 * Finishes an operation started with flash_call_done().
22511 *
22512 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
22513 */
22514gboolean
22515flash_call_done_finish (
22516 Flash *proxy,
22517 GAsyncResult *res,
22518 GError **error)
22519{
22520 GVariant *_ret;
22521 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
22522 if (_ret == NULL)
22523 goto _out;
22524 g_variant_get (_ret,
22525 "()");
22526 g_variant_unref (_ret);
22527_out:
22528 return _ret != NULL;
22529}
22530
22531/**
22532 * flash_call_done_sync:
22533 * @proxy: A #FlashProxy.
22534 * @cancellable: (allow-none): A #GCancellable or %NULL.
22535 * @error: Return location for error or %NULL.
22536 *
22537 * 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.
22538 *
22539 * See flash_call_done() for the asynchronous version of this method.
22540 *
22541 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
22542 */
22543gboolean
22544flash_call_done_sync (
22545 Flash *proxy,
22546 GCancellable *cancellable,
22547 GError **error)
22548{
22549 GVariant *_ret;
22550 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
22551 "done",
22552 g_variant_new ("()"),
22553 G_DBUS_CALL_FLAGS_NONE,
22554 -1,
22555 cancellable,
22556 error);
22557 if (_ret == NULL)
22558 goto _out;
22559 g_variant_get (_ret,
22560 "()");
22561 g_variant_unref (_ret);
22562_out:
22563 return _ret != NULL;
22564}
22565
22566/**
Norman Jamesf066e872015-10-07 15:29:51 -050022567 * flash_call_update_via_tftp:
22568 * @proxy: A #FlashProxy.
22569 * @arg_url: Argument to pass with the method invocation.
22570 * @arg_filename: Argument to pass with the method invocation.
22571 * @cancellable: (allow-none): A #GCancellable or %NULL.
22572 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
22573 * @user_data: User data to pass to @callback.
22574 *
22575 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.updateViaTftp">updateViaTftp()</link> D-Bus method on @proxy.
22576 * 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.
22577 * You can then call flash_call_update_via_tftp_finish() to get the result of the operation.
22578 *
22579 * See flash_call_update_via_tftp_sync() for the synchronous, blocking version of this method.
22580 */
22581void
22582flash_call_update_via_tftp (
22583 Flash *proxy,
22584 const gchar *arg_url,
22585 const gchar *arg_filename,
22586 GCancellable *cancellable,
22587 GAsyncReadyCallback callback,
22588 gpointer user_data)
22589{
22590 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
22591 "updateViaTftp",
22592 g_variant_new ("(ss)",
22593 arg_url,
22594 arg_filename),
22595 G_DBUS_CALL_FLAGS_NONE,
22596 -1,
22597 cancellable,
22598 callback,
22599 user_data);
22600}
22601
22602/**
22603 * flash_call_update_via_tftp_finish:
22604 * @proxy: A #FlashProxy.
22605 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_update_via_tftp().
22606 * @error: Return location for error or %NULL.
22607 *
22608 * Finishes an operation started with flash_call_update_via_tftp().
22609 *
22610 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
22611 */
22612gboolean
22613flash_call_update_via_tftp_finish (
22614 Flash *proxy,
22615 GAsyncResult *res,
22616 GError **error)
22617{
22618 GVariant *_ret;
22619 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
22620 if (_ret == NULL)
22621 goto _out;
22622 g_variant_get (_ret,
22623 "()");
22624 g_variant_unref (_ret);
22625_out:
22626 return _ret != NULL;
22627}
22628
22629/**
22630 * flash_call_update_via_tftp_sync:
22631 * @proxy: A #FlashProxy.
22632 * @arg_url: Argument to pass with the method invocation.
22633 * @arg_filename: Argument to pass with the method invocation.
22634 * @cancellable: (allow-none): A #GCancellable or %NULL.
22635 * @error: Return location for error or %NULL.
22636 *
22637 * 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.
22638 *
22639 * See flash_call_update_via_tftp() for the asynchronous version of this method.
22640 *
22641 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
22642 */
22643gboolean
22644flash_call_update_via_tftp_sync (
22645 Flash *proxy,
22646 const gchar *arg_url,
22647 const gchar *arg_filename,
22648 GCancellable *cancellable,
22649 GError **error)
22650{
22651 GVariant *_ret;
22652 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
22653 "updateViaTftp",
22654 g_variant_new ("(ss)",
22655 arg_url,
22656 arg_filename),
22657 G_DBUS_CALL_FLAGS_NONE,
22658 -1,
22659 cancellable,
22660 error);
22661 if (_ret == NULL)
22662 goto _out;
22663 g_variant_get (_ret,
22664 "()");
22665 g_variant_unref (_ret);
22666_out:
22667 return _ret != NULL;
22668}
22669
22670/**
Norman James362a80f2015-09-14 14:04:39 -050022671 * flash_call_init:
22672 * @proxy: A #FlashProxy.
22673 * @cancellable: (allow-none): A #GCancellable or %NULL.
22674 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
22675 * @user_data: User data to pass to @callback.
22676 *
22677 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.init">init()</link> D-Bus method on @proxy.
22678 * 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.
22679 * You can then call flash_call_init_finish() to get the result of the operation.
22680 *
22681 * See flash_call_init_sync() for the synchronous, blocking version of this method.
22682 */
22683void
22684flash_call_init (
22685 Flash *proxy,
22686 GCancellable *cancellable,
22687 GAsyncReadyCallback callback,
22688 gpointer user_data)
22689{
22690 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
22691 "init",
22692 g_variant_new ("()"),
22693 G_DBUS_CALL_FLAGS_NONE,
22694 -1,
22695 cancellable,
22696 callback,
22697 user_data);
22698}
22699
22700/**
22701 * flash_call_init_finish:
22702 * @proxy: A #FlashProxy.
22703 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_init().
22704 * @error: Return location for error or %NULL.
22705 *
22706 * Finishes an operation started with flash_call_init().
22707 *
22708 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
22709 */
22710gboolean
22711flash_call_init_finish (
22712 Flash *proxy,
22713 GAsyncResult *res,
22714 GError **error)
22715{
22716 GVariant *_ret;
22717 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
22718 if (_ret == NULL)
22719 goto _out;
22720 g_variant_get (_ret,
22721 "()");
22722 g_variant_unref (_ret);
22723_out:
22724 return _ret != NULL;
22725}
22726
22727/**
22728 * flash_call_init_sync:
22729 * @proxy: A #FlashProxy.
22730 * @cancellable: (allow-none): A #GCancellable or %NULL.
22731 * @error: Return location for error or %NULL.
22732 *
22733 * 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.
22734 *
22735 * See flash_call_init() for the asynchronous version of this method.
22736 *
22737 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
22738 */
22739gboolean
22740flash_call_init_sync (
22741 Flash *proxy,
22742 GCancellable *cancellable,
22743 GError **error)
22744{
22745 GVariant *_ret;
22746 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
22747 "init",
22748 g_variant_new ("()"),
22749 G_DBUS_CALL_FLAGS_NONE,
22750 -1,
22751 cancellable,
22752 error);
22753 if (_ret == NULL)
22754 goto _out;
22755 g_variant_get (_ret,
22756 "()");
22757 g_variant_unref (_ret);
22758_out:
22759 return _ret != NULL;
22760}
22761
22762/**
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022763 * flash_complete_update:
Norman James362a80f2015-09-14 14:04:39 -050022764 * @object: A #Flash.
22765 * @invocation: (transfer full): A #GDBusMethodInvocation.
22766 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022767 * 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 -050022768 *
22769 * This method will free @invocation, you cannot use it afterwards.
22770 */
22771void
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022772flash_complete_update (
Norman James362a80f2015-09-14 14:04:39 -050022773 Flash *object,
22774 GDBusMethodInvocation *invocation)
22775{
22776 g_dbus_method_invocation_return_value (invocation,
22777 g_variant_new ("()"));
22778}
22779
22780/**
Norman James166acf42015-10-22 07:11:51 -050022781 * flash_complete_error:
22782 * @object: A #Flash.
22783 * @invocation: (transfer full): A #GDBusMethodInvocation.
22784 *
22785 * 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.
22786 *
22787 * This method will free @invocation, you cannot use it afterwards.
22788 */
22789void
22790flash_complete_error (
22791 Flash *object,
22792 GDBusMethodInvocation *invocation)
22793{
22794 g_dbus_method_invocation_return_value (invocation,
22795 g_variant_new ("()"));
22796}
22797
22798/**
22799 * flash_complete_done:
22800 * @object: A #Flash.
22801 * @invocation: (transfer full): A #GDBusMethodInvocation.
22802 *
22803 * 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.
22804 *
22805 * This method will free @invocation, you cannot use it afterwards.
22806 */
22807void
22808flash_complete_done (
22809 Flash *object,
22810 GDBusMethodInvocation *invocation)
22811{
22812 g_dbus_method_invocation_return_value (invocation,
22813 g_variant_new ("()"));
22814}
22815
22816/**
Norman Jamesf066e872015-10-07 15:29:51 -050022817 * flash_complete_update_via_tftp:
22818 * @object: A #Flash.
22819 * @invocation: (transfer full): A #GDBusMethodInvocation.
22820 *
22821 * 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.
22822 *
22823 * This method will free @invocation, you cannot use it afterwards.
22824 */
22825void
22826flash_complete_update_via_tftp (
22827 Flash *object,
22828 GDBusMethodInvocation *invocation)
22829{
22830 g_dbus_method_invocation_return_value (invocation,
22831 g_variant_new ("()"));
22832}
22833
22834/**
Norman James362a80f2015-09-14 14:04:39 -050022835 * flash_complete_init:
22836 * @object: A #Flash.
22837 * @invocation: (transfer full): A #GDBusMethodInvocation.
22838 *
22839 * 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.
22840 *
22841 * This method will free @invocation, you cannot use it afterwards.
22842 */
22843void
22844flash_complete_init (
22845 Flash *object,
22846 GDBusMethodInvocation *invocation)
22847{
22848 g_dbus_method_invocation_return_value (invocation,
22849 g_variant_new ("()"));
22850}
22851
22852/* ------------------------------------------------------------------------ */
22853
22854/**
22855 * FlashProxy:
22856 *
22857 * The #FlashProxy structure contains only private data and should only be accessed using the provided API.
22858 */
22859
22860/**
22861 * FlashProxyClass:
22862 * @parent_class: The parent class.
22863 *
22864 * Class structure for #FlashProxy.
22865 */
22866
22867struct _FlashProxyPrivate
22868{
22869 GData *qdata;
22870};
22871
22872static void flash_proxy_iface_init (FlashIface *iface);
22873
22874#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
22875G_DEFINE_TYPE_WITH_CODE (FlashProxy, flash_proxy, G_TYPE_DBUS_PROXY,
22876 G_ADD_PRIVATE (FlashProxy)
22877 G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_proxy_iface_init));
22878
22879#else
22880G_DEFINE_TYPE_WITH_CODE (FlashProxy, flash_proxy, G_TYPE_DBUS_PROXY,
22881 G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_proxy_iface_init));
22882
22883#endif
22884static void
22885flash_proxy_finalize (GObject *object)
22886{
22887 FlashProxy *proxy = FLASH_PROXY (object);
22888 g_datalist_clear (&proxy->priv->qdata);
22889 G_OBJECT_CLASS (flash_proxy_parent_class)->finalize (object);
22890}
22891
22892static void
22893flash_proxy_get_property (GObject *object,
22894 guint prop_id,
22895 GValue *value,
22896 GParamSpec *pspec G_GNUC_UNUSED)
22897{
Norman James18998182015-10-11 21:54:53 -050022898 const _ExtendedGDBusPropertyInfo *info;
22899 GVariant *variant;
Norman James166acf42015-10-22 07:11:51 -050022900 g_assert (prop_id != 0 && prop_id - 1 < 5);
Norman James18998182015-10-11 21:54:53 -050022901 info = _flash_property_info_pointers[prop_id - 1];
22902 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
22903 if (info->use_gvariant)
22904 {
22905 g_value_set_variant (value, variant);
22906 }
22907 else
22908 {
22909 if (variant != NULL)
22910 g_dbus_gvariant_to_gvalue (variant, value);
22911 }
22912 if (variant != NULL)
22913 g_variant_unref (variant);
22914}
22915
22916static void
22917flash_proxy_set_property_cb (GDBusProxy *proxy,
22918 GAsyncResult *res,
22919 gpointer user_data)
22920{
22921 const _ExtendedGDBusPropertyInfo *info = user_data;
22922 GError *error;
22923 GVariant *_ret;
22924 error = NULL;
22925 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
22926 if (!_ret)
22927 {
22928 g_warning ("Error setting property '%s' on interface org.openbmc.Flash: %s (%s, %d)",
22929 info->parent_struct.name,
22930 error->message, g_quark_to_string (error->domain), error->code);
22931 g_error_free (error);
22932 }
22933 else
22934 {
22935 g_variant_unref (_ret);
22936 }
Norman James362a80f2015-09-14 14:04:39 -050022937}
22938
22939static void
22940flash_proxy_set_property (GObject *object,
22941 guint prop_id,
22942 const GValue *value,
22943 GParamSpec *pspec G_GNUC_UNUSED)
22944{
Norman James18998182015-10-11 21:54:53 -050022945 const _ExtendedGDBusPropertyInfo *info;
22946 GVariant *variant;
Norman James166acf42015-10-22 07:11:51 -050022947 g_assert (prop_id != 0 && prop_id - 1 < 5);
Norman James18998182015-10-11 21:54:53 -050022948 info = _flash_property_info_pointers[prop_id - 1];
22949 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
22950 g_dbus_proxy_call (G_DBUS_PROXY (object),
22951 "org.freedesktop.DBus.Properties.Set",
22952 g_variant_new ("(ssv)", "org.openbmc.Flash", info->parent_struct.name, variant),
22953 G_DBUS_CALL_FLAGS_NONE,
22954 -1,
22955 NULL, (GAsyncReadyCallback) flash_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
22956 g_variant_unref (variant);
Norman James362a80f2015-09-14 14:04:39 -050022957}
22958
22959static void
22960flash_proxy_g_signal (GDBusProxy *proxy,
22961 const gchar *sender_name G_GNUC_UNUSED,
22962 const gchar *signal_name,
22963 GVariant *parameters)
22964{
22965 _ExtendedGDBusSignalInfo *info;
22966 GVariantIter iter;
22967 GVariant *child;
22968 GValue *paramv;
22969 guint num_params;
22970 guint n;
22971 guint signal_id;
22972 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, signal_name);
22973 if (info == NULL)
22974 return;
22975 num_params = g_variant_n_children (parameters);
22976 paramv = g_new0 (GValue, num_params + 1);
22977 g_value_init (&paramv[0], TYPE_FLASH);
22978 g_value_set_object (&paramv[0], proxy);
22979 g_variant_iter_init (&iter, parameters);
22980 n = 1;
22981 while ((child = g_variant_iter_next_value (&iter)) != NULL)
22982 {
22983 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
22984 if (arg_info->use_gvariant)
22985 {
22986 g_value_init (&paramv[n], G_TYPE_VARIANT);
22987 g_value_set_variant (&paramv[n], child);
22988 n++;
22989 }
22990 else
22991 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
22992 g_variant_unref (child);
22993 }
22994 signal_id = g_signal_lookup (info->signal_name, TYPE_FLASH);
22995 g_signal_emitv (paramv, signal_id, 0, NULL);
22996 for (n = 0; n < num_params + 1; n++)
22997 g_value_unset (&paramv[n]);
22998 g_free (paramv);
22999}
23000
23001static void
23002flash_proxy_g_properties_changed (GDBusProxy *_proxy,
23003 GVariant *changed_properties,
23004 const gchar *const *invalidated_properties)
23005{
23006 FlashProxy *proxy = FLASH_PROXY (_proxy);
23007 guint n;
23008 const gchar *key;
23009 GVariantIter *iter;
23010 _ExtendedGDBusPropertyInfo *info;
23011 g_variant_get (changed_properties, "a{sv}", &iter);
23012 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
23013 {
23014 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, key);
23015 g_datalist_remove_data (&proxy->priv->qdata, key);
23016 if (info != NULL)
23017 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
23018 }
23019 g_variant_iter_free (iter);
23020 for (n = 0; invalidated_properties[n] != NULL; n++)
23021 {
23022 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, invalidated_properties[n]);
23023 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
23024 if (info != NULL)
23025 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
23026 }
23027}
23028
Norman James18998182015-10-11 21:54:53 -050023029static const gchar *
23030flash_proxy_get_filename (Flash *object)
23031{
23032 FlashProxy *proxy = FLASH_PROXY (object);
23033 GVariant *variant;
23034 const gchar *value = NULL;
23035 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "filename");
23036 if (variant != NULL)
23037 {
23038 value = g_variant_get_string (variant, NULL);
23039 g_variant_unref (variant);
23040 }
23041 return value;
23042}
23043
23044static const gchar *
23045flash_proxy_get_flasher_path (Flash *object)
23046{
23047 FlashProxy *proxy = FLASH_PROXY (object);
23048 GVariant *variant;
23049 const gchar *value = NULL;
23050 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "flasher_path");
23051 if (variant != NULL)
23052 {
23053 value = g_variant_get_string (variant, NULL);
23054 g_variant_unref (variant);
23055 }
23056 return value;
23057}
23058
23059static const gchar *
23060flash_proxy_get_flasher_name (Flash *object)
23061{
23062 FlashProxy *proxy = FLASH_PROXY (object);
23063 GVariant *variant;
23064 const gchar *value = NULL;
23065 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "flasher_name");
23066 if (variant != NULL)
23067 {
23068 value = g_variant_get_string (variant, NULL);
23069 g_variant_unref (variant);
23070 }
23071 return value;
23072}
23073
23074static const gchar *
23075flash_proxy_get_flasher_instance (Flash *object)
23076{
23077 FlashProxy *proxy = FLASH_PROXY (object);
23078 GVariant *variant;
23079 const gchar *value = NULL;
23080 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "flasher_instance");
23081 if (variant != NULL)
23082 {
23083 value = g_variant_get_string (variant, NULL);
23084 g_variant_unref (variant);
23085 }
23086 return value;
23087}
23088
Norman James166acf42015-10-22 07:11:51 -050023089static const gchar *
23090flash_proxy_get_status (Flash *object)
23091{
23092 FlashProxy *proxy = FLASH_PROXY (object);
23093 GVariant *variant;
23094 const gchar *value = NULL;
23095 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "status");
23096 if (variant != NULL)
23097 {
23098 value = g_variant_get_string (variant, NULL);
23099 g_variant_unref (variant);
23100 }
23101 return value;
23102}
23103
Norman James362a80f2015-09-14 14:04:39 -050023104static void
23105flash_proxy_init (FlashProxy *proxy)
23106{
23107#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
23108 proxy->priv = flash_proxy_get_instance_private (proxy);
23109#else
23110 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_FLASH_PROXY, FlashProxyPrivate);
23111#endif
23112
23113 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), flash_interface_info ());
23114}
23115
23116static void
23117flash_proxy_class_init (FlashProxyClass *klass)
23118{
23119 GObjectClass *gobject_class;
23120 GDBusProxyClass *proxy_class;
23121
23122 gobject_class = G_OBJECT_CLASS (klass);
23123 gobject_class->finalize = flash_proxy_finalize;
23124 gobject_class->get_property = flash_proxy_get_property;
23125 gobject_class->set_property = flash_proxy_set_property;
23126
23127 proxy_class = G_DBUS_PROXY_CLASS (klass);
23128 proxy_class->g_signal = flash_proxy_g_signal;
23129 proxy_class->g_properties_changed = flash_proxy_g_properties_changed;
23130
Norman James18998182015-10-11 21:54:53 -050023131 flash_override_properties (gobject_class, 1);
23132
Norman James362a80f2015-09-14 14:04:39 -050023133#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
23134 g_type_class_add_private (klass, sizeof (FlashProxyPrivate));
23135#endif
23136}
23137
23138static void
23139flash_proxy_iface_init (FlashIface *iface)
23140{
Norman James18998182015-10-11 21:54:53 -050023141 iface->get_filename = flash_proxy_get_filename;
23142 iface->get_flasher_path = flash_proxy_get_flasher_path;
23143 iface->get_flasher_name = flash_proxy_get_flasher_name;
23144 iface->get_flasher_instance = flash_proxy_get_flasher_instance;
Norman James166acf42015-10-22 07:11:51 -050023145 iface->get_status = flash_proxy_get_status;
Norman James362a80f2015-09-14 14:04:39 -050023146}
23147
23148/**
23149 * flash_proxy_new:
23150 * @connection: A #GDBusConnection.
23151 * @flags: Flags from the #GDBusProxyFlags enumeration.
23152 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
23153 * @object_path: An object path.
23154 * @cancellable: (allow-none): A #GCancellable or %NULL.
23155 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
23156 * @user_data: User data to pass to @callback.
23157 *
23158 * 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.
23159 *
23160 * 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.
23161 * You can then call flash_proxy_new_finish() to get the result of the operation.
23162 *
23163 * See flash_proxy_new_sync() for the synchronous, blocking version of this constructor.
23164 */
23165void
23166flash_proxy_new (
23167 GDBusConnection *connection,
23168 GDBusProxyFlags flags,
23169 const gchar *name,
23170 const gchar *object_path,
23171 GCancellable *cancellable,
23172 GAsyncReadyCallback callback,
23173 gpointer user_data)
23174{
23175 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);
23176}
23177
23178/**
23179 * flash_proxy_new_finish:
23180 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_proxy_new().
23181 * @error: Return location for error or %NULL
23182 *
23183 * Finishes an operation started with flash_proxy_new().
23184 *
23185 * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set.
23186 */
23187Flash *
23188flash_proxy_new_finish (
23189 GAsyncResult *res,
23190 GError **error)
23191{
23192 GObject *ret;
23193 GObject *source_object;
23194 source_object = g_async_result_get_source_object (res);
23195 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
23196 g_object_unref (source_object);
23197 if (ret != NULL)
23198 return FLASH (ret);
23199 else
23200 return NULL;
23201}
23202
23203/**
23204 * flash_proxy_new_sync:
23205 * @connection: A #GDBusConnection.
23206 * @flags: Flags from the #GDBusProxyFlags enumeration.
23207 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
23208 * @object_path: An object path.
23209 * @cancellable: (allow-none): A #GCancellable or %NULL.
23210 * @error: Return location for error or %NULL
23211 *
23212 * 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.
23213 *
23214 * The calling thread is blocked until a reply is received.
23215 *
23216 * See flash_proxy_new() for the asynchronous version of this constructor.
23217 *
23218 * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set.
23219 */
23220Flash *
23221flash_proxy_new_sync (
23222 GDBusConnection *connection,
23223 GDBusProxyFlags flags,
23224 const gchar *name,
23225 const gchar *object_path,
23226 GCancellable *cancellable,
23227 GError **error)
23228{
23229 GInitable *ret;
23230 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);
23231 if (ret != NULL)
23232 return FLASH (ret);
23233 else
23234 return NULL;
23235}
23236
23237
23238/**
23239 * flash_proxy_new_for_bus:
23240 * @bus_type: A #GBusType.
23241 * @flags: Flags from the #GDBusProxyFlags enumeration.
23242 * @name: A bus name (well-known or unique).
23243 * @object_path: An object path.
23244 * @cancellable: (allow-none): A #GCancellable or %NULL.
23245 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
23246 * @user_data: User data to pass to @callback.
23247 *
23248 * Like flash_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
23249 *
23250 * 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.
23251 * You can then call flash_proxy_new_for_bus_finish() to get the result of the operation.
23252 *
23253 * See flash_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
23254 */
23255void
23256flash_proxy_new_for_bus (
23257 GBusType bus_type,
23258 GDBusProxyFlags flags,
23259 const gchar *name,
23260 const gchar *object_path,
23261 GCancellable *cancellable,
23262 GAsyncReadyCallback callback,
23263 gpointer user_data)
23264{
23265 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);
23266}
23267
23268/**
23269 * flash_proxy_new_for_bus_finish:
23270 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_proxy_new_for_bus().
23271 * @error: Return location for error or %NULL
23272 *
23273 * Finishes an operation started with flash_proxy_new_for_bus().
23274 *
23275 * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set.
23276 */
23277Flash *
23278flash_proxy_new_for_bus_finish (
23279 GAsyncResult *res,
23280 GError **error)
23281{
23282 GObject *ret;
23283 GObject *source_object;
23284 source_object = g_async_result_get_source_object (res);
23285 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
23286 g_object_unref (source_object);
23287 if (ret != NULL)
23288 return FLASH (ret);
23289 else
23290 return NULL;
23291}
23292
23293/**
23294 * flash_proxy_new_for_bus_sync:
23295 * @bus_type: A #GBusType.
23296 * @flags: Flags from the #GDBusProxyFlags enumeration.
23297 * @name: A bus name (well-known or unique).
23298 * @object_path: An object path.
23299 * @cancellable: (allow-none): A #GCancellable or %NULL.
23300 * @error: Return location for error or %NULL
23301 *
23302 * Like flash_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
23303 *
23304 * The calling thread is blocked until a reply is received.
23305 *
23306 * See flash_proxy_new_for_bus() for the asynchronous version of this constructor.
23307 *
23308 * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set.
23309 */
23310Flash *
23311flash_proxy_new_for_bus_sync (
23312 GBusType bus_type,
23313 GDBusProxyFlags flags,
23314 const gchar *name,
23315 const gchar *object_path,
23316 GCancellable *cancellable,
23317 GError **error)
23318{
23319 GInitable *ret;
23320 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);
23321 if (ret != NULL)
23322 return FLASH (ret);
23323 else
23324 return NULL;
23325}
23326
23327
23328/* ------------------------------------------------------------------------ */
23329
23330/**
23331 * FlashSkeleton:
23332 *
23333 * The #FlashSkeleton structure contains only private data and should only be accessed using the provided API.
23334 */
23335
23336/**
23337 * FlashSkeletonClass:
23338 * @parent_class: The parent class.
23339 *
23340 * Class structure for #FlashSkeleton.
23341 */
23342
23343struct _FlashSkeletonPrivate
23344{
23345 GValue *properties;
23346 GList *changed_properties;
23347 GSource *changed_properties_idle_source;
23348 GMainContext *context;
23349 GMutex lock;
23350};
23351
23352static void
23353_flash_skeleton_handle_method_call (
23354 GDBusConnection *connection G_GNUC_UNUSED,
23355 const gchar *sender G_GNUC_UNUSED,
23356 const gchar *object_path G_GNUC_UNUSED,
23357 const gchar *interface_name,
23358 const gchar *method_name,
23359 GVariant *parameters,
23360 GDBusMethodInvocation *invocation,
23361 gpointer user_data)
23362{
23363 FlashSkeleton *skeleton = FLASH_SKELETON (user_data);
23364 _ExtendedGDBusMethodInfo *info;
23365 GVariantIter iter;
23366 GVariant *child;
23367 GValue *paramv;
23368 guint num_params;
23369 guint num_extra;
23370 guint n;
23371 guint signal_id;
23372 GValue return_value = G_VALUE_INIT;
23373 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
23374 g_assert (info != NULL);
23375 num_params = g_variant_n_children (parameters);
23376 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
23377 n = 0;
23378 g_value_init (&paramv[n], TYPE_FLASH);
23379 g_value_set_object (&paramv[n++], skeleton);
23380 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
23381 g_value_set_object (&paramv[n++], invocation);
23382 if (info->pass_fdlist)
23383 {
23384#ifdef G_OS_UNIX
23385 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
23386 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
23387#else
23388 g_assert_not_reached ();
23389#endif
23390 }
23391 g_variant_iter_init (&iter, parameters);
23392 while ((child = g_variant_iter_next_value (&iter)) != NULL)
23393 {
23394 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
23395 if (arg_info->use_gvariant)
23396 {
23397 g_value_init (&paramv[n], G_TYPE_VARIANT);
23398 g_value_set_variant (&paramv[n], child);
23399 n++;
23400 }
23401 else
23402 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
23403 g_variant_unref (child);
23404 }
23405 signal_id = g_signal_lookup (info->signal_name, TYPE_FLASH);
23406 g_value_init (&return_value, G_TYPE_BOOLEAN);
23407 g_signal_emitv (paramv, signal_id, 0, &return_value);
23408 if (!g_value_get_boolean (&return_value))
23409 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);
23410 g_value_unset (&return_value);
23411 for (n = 0; n < num_params + num_extra; n++)
23412 g_value_unset (&paramv[n]);
23413 g_free (paramv);
23414}
23415
23416static GVariant *
23417_flash_skeleton_handle_get_property (
23418 GDBusConnection *connection G_GNUC_UNUSED,
23419 const gchar *sender G_GNUC_UNUSED,
23420 const gchar *object_path G_GNUC_UNUSED,
23421 const gchar *interface_name G_GNUC_UNUSED,
23422 const gchar *property_name,
23423 GError **error,
23424 gpointer user_data)
23425{
23426 FlashSkeleton *skeleton = FLASH_SKELETON (user_data);
23427 GValue value = G_VALUE_INIT;
23428 GParamSpec *pspec;
23429 _ExtendedGDBusPropertyInfo *info;
23430 GVariant *ret;
23431 ret = NULL;
23432 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, property_name);
23433 g_assert (info != NULL);
23434 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
23435 if (pspec == NULL)
23436 {
23437 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
23438 }
23439 else
23440 {
23441 g_value_init (&value, pspec->value_type);
23442 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
23443 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
23444 g_value_unset (&value);
23445 }
23446 return ret;
23447}
23448
23449static gboolean
23450_flash_skeleton_handle_set_property (
23451 GDBusConnection *connection G_GNUC_UNUSED,
23452 const gchar *sender G_GNUC_UNUSED,
23453 const gchar *object_path G_GNUC_UNUSED,
23454 const gchar *interface_name G_GNUC_UNUSED,
23455 const gchar *property_name,
23456 GVariant *variant,
23457 GError **error,
23458 gpointer user_data)
23459{
23460 FlashSkeleton *skeleton = FLASH_SKELETON (user_data);
23461 GValue value = G_VALUE_INIT;
23462 GParamSpec *pspec;
23463 _ExtendedGDBusPropertyInfo *info;
23464 gboolean ret;
23465 ret = FALSE;
23466 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, property_name);
23467 g_assert (info != NULL);
23468 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
23469 if (pspec == NULL)
23470 {
23471 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
23472 }
23473 else
23474 {
23475 if (info->use_gvariant)
23476 g_value_set_variant (&value, variant);
23477 else
23478 g_dbus_gvariant_to_gvalue (variant, &value);
23479 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
23480 g_value_unset (&value);
23481 ret = TRUE;
23482 }
23483 return ret;
23484}
23485
23486static const GDBusInterfaceVTable _flash_skeleton_vtable =
23487{
23488 _flash_skeleton_handle_method_call,
23489 _flash_skeleton_handle_get_property,
23490 _flash_skeleton_handle_set_property,
23491 {NULL}
23492};
23493
23494static GDBusInterfaceInfo *
23495flash_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
23496{
23497 return flash_interface_info ();
23498}
23499
23500static GDBusInterfaceVTable *
23501flash_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
23502{
23503 return (GDBusInterfaceVTable *) &_flash_skeleton_vtable;
23504}
23505
23506static GVariant *
23507flash_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
23508{
23509 FlashSkeleton *skeleton = FLASH_SKELETON (_skeleton);
23510
23511 GVariantBuilder builder;
23512 guint n;
23513 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
23514 if (_flash_interface_info.parent_struct.properties == NULL)
23515 goto out;
23516 for (n = 0; _flash_interface_info.parent_struct.properties[n] != NULL; n++)
23517 {
23518 GDBusPropertyInfo *info = _flash_interface_info.parent_struct.properties[n];
23519 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
23520 {
23521 GVariant *value;
23522 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);
23523 if (value != NULL)
23524 {
23525 g_variant_take_ref (value);
23526 g_variant_builder_add (&builder, "{sv}", info->name, value);
23527 g_variant_unref (value);
23528 }
23529 }
23530 }
23531out:
23532 return g_variant_builder_end (&builder);
23533}
23534
Norman James18998182015-10-11 21:54:53 -050023535static gboolean _flash_emit_changed (gpointer user_data);
23536
Norman James362a80f2015-09-14 14:04:39 -050023537static void
23538flash_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
23539{
Norman James18998182015-10-11 21:54:53 -050023540 FlashSkeleton *skeleton = FLASH_SKELETON (_skeleton);
23541 gboolean emit_changed = FALSE;
23542
23543 g_mutex_lock (&skeleton->priv->lock);
23544 if (skeleton->priv->changed_properties_idle_source != NULL)
23545 {
23546 g_source_destroy (skeleton->priv->changed_properties_idle_source);
23547 skeleton->priv->changed_properties_idle_source = NULL;
23548 emit_changed = TRUE;
23549 }
23550 g_mutex_unlock (&skeleton->priv->lock);
23551
23552 if (emit_changed)
23553 _flash_emit_changed (skeleton);
Norman James362a80f2015-09-14 14:04:39 -050023554}
23555
23556static void
23557_flash_on_signal_updated (
23558 Flash *object)
23559{
23560 FlashSkeleton *skeleton = FLASH_SKELETON (object);
23561
23562 GList *connections, *l;
23563 GVariant *signal_variant;
23564 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
23565
23566 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
23567 for (l = connections; l != NULL; l = l->next)
23568 {
23569 GDBusConnection *connection = l->data;
23570 g_dbus_connection_emit_signal (connection,
23571 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Flash", "Updated",
23572 signal_variant, NULL);
23573 }
23574 g_variant_unref (signal_variant);
23575 g_list_free_full (connections, g_object_unref);
23576}
23577
Norman Jamesf066e872015-10-07 15:29:51 -050023578static void
23579_flash_on_signal_download (
23580 Flash *object,
23581 const gchar *arg_url,
23582 const gchar *arg_filename)
23583{
23584 FlashSkeleton *skeleton = FLASH_SKELETON (object);
23585
23586 GList *connections, *l;
23587 GVariant *signal_variant;
23588 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
23589
23590 signal_variant = g_variant_ref_sink (g_variant_new ("(ss)",
23591 arg_url,
23592 arg_filename));
23593 for (l = connections; l != NULL; l = l->next)
23594 {
23595 GDBusConnection *connection = l->data;
23596 g_dbus_connection_emit_signal (connection,
23597 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Flash", "Download",
23598 signal_variant, NULL);
23599 }
23600 g_variant_unref (signal_variant);
23601 g_list_free_full (connections, g_object_unref);
23602}
23603
Norman James362a80f2015-09-14 14:04:39 -050023604static void flash_skeleton_iface_init (FlashIface *iface);
23605#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
23606G_DEFINE_TYPE_WITH_CODE (FlashSkeleton, flash_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
23607 G_ADD_PRIVATE (FlashSkeleton)
23608 G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_skeleton_iface_init));
23609
23610#else
23611G_DEFINE_TYPE_WITH_CODE (FlashSkeleton, flash_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
23612 G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_skeleton_iface_init));
23613
23614#endif
23615static void
23616flash_skeleton_finalize (GObject *object)
23617{
23618 FlashSkeleton *skeleton = FLASH_SKELETON (object);
Norman James18998182015-10-11 21:54:53 -050023619 guint n;
Norman James166acf42015-10-22 07:11:51 -050023620 for (n = 0; n < 5; n++)
Norman James18998182015-10-11 21:54:53 -050023621 g_value_unset (&skeleton->priv->properties[n]);
23622 g_free (skeleton->priv->properties);
Norman James362a80f2015-09-14 14:04:39 -050023623 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
23624 if (skeleton->priv->changed_properties_idle_source != NULL)
23625 g_source_destroy (skeleton->priv->changed_properties_idle_source);
23626 g_main_context_unref (skeleton->priv->context);
23627 g_mutex_clear (&skeleton->priv->lock);
23628 G_OBJECT_CLASS (flash_skeleton_parent_class)->finalize (object);
23629}
23630
23631static void
Norman James18998182015-10-11 21:54:53 -050023632flash_skeleton_get_property (GObject *object,
23633 guint prop_id,
23634 GValue *value,
23635 GParamSpec *pspec G_GNUC_UNUSED)
23636{
23637 FlashSkeleton *skeleton = FLASH_SKELETON (object);
Norman James166acf42015-10-22 07:11:51 -050023638 g_assert (prop_id != 0 && prop_id - 1 < 5);
Norman James18998182015-10-11 21:54:53 -050023639 g_mutex_lock (&skeleton->priv->lock);
23640 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
23641 g_mutex_unlock (&skeleton->priv->lock);
23642}
23643
23644static gboolean
23645_flash_emit_changed (gpointer user_data)
23646{
23647 FlashSkeleton *skeleton = FLASH_SKELETON (user_data);
23648 GList *l;
23649 GVariantBuilder builder;
23650 GVariantBuilder invalidated_builder;
23651 guint num_changes;
23652
23653 g_mutex_lock (&skeleton->priv->lock);
23654 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
23655 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
23656 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
23657 {
23658 ChangedProperty *cp = l->data;
23659 GVariant *variant;
23660 const GValue *cur_value;
23661
23662 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
23663 if (!_g_value_equal (cur_value, &cp->orig_value))
23664 {
23665 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
23666 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
23667 g_variant_unref (variant);
23668 num_changes++;
23669 }
23670 }
23671 if (num_changes > 0)
23672 {
23673 GList *connections, *ll;
23674 GVariant *signal_variant;
23675 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Flash",
23676 &builder, &invalidated_builder));
23677 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
23678 for (ll = connections; ll != NULL; ll = ll->next)
23679 {
23680 GDBusConnection *connection = ll->data;
23681
23682 g_dbus_connection_emit_signal (connection,
23683 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
23684 "org.freedesktop.DBus.Properties",
23685 "PropertiesChanged",
23686 signal_variant,
23687 NULL);
23688 }
23689 g_variant_unref (signal_variant);
23690 g_list_free_full (connections, g_object_unref);
23691 }
23692 else
23693 {
23694 g_variant_builder_clear (&builder);
23695 g_variant_builder_clear (&invalidated_builder);
23696 }
23697 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
23698 skeleton->priv->changed_properties = NULL;
23699 skeleton->priv->changed_properties_idle_source = NULL;
23700 g_mutex_unlock (&skeleton->priv->lock);
23701 return FALSE;
23702}
23703
23704static void
23705_flash_schedule_emit_changed (FlashSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
23706{
23707 ChangedProperty *cp;
23708 GList *l;
23709 cp = NULL;
23710 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
23711 {
23712 ChangedProperty *i_cp = l->data;
23713 if (i_cp->info == info)
23714 {
23715 cp = i_cp;
23716 break;
23717 }
23718 }
23719 if (cp == NULL)
23720 {
23721 cp = g_new0 (ChangedProperty, 1);
23722 cp->prop_id = prop_id;
23723 cp->info = info;
23724 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
23725 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
23726 g_value_copy (orig_value, &cp->orig_value);
23727 }
23728}
23729
23730static void
23731flash_skeleton_notify (GObject *object,
23732 GParamSpec *pspec G_GNUC_UNUSED)
23733{
23734 FlashSkeleton *skeleton = FLASH_SKELETON (object);
23735 g_mutex_lock (&skeleton->priv->lock);
23736 if (skeleton->priv->changed_properties != NULL &&
23737 skeleton->priv->changed_properties_idle_source == NULL)
23738 {
23739 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
23740 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
23741 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _flash_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
23742 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
23743 g_source_unref (skeleton->priv->changed_properties_idle_source);
23744 }
23745 g_mutex_unlock (&skeleton->priv->lock);
23746}
23747
23748static void
23749flash_skeleton_set_property (GObject *object,
23750 guint prop_id,
23751 const GValue *value,
23752 GParamSpec *pspec)
23753{
23754 FlashSkeleton *skeleton = FLASH_SKELETON (object);
Norman James166acf42015-10-22 07:11:51 -050023755 g_assert (prop_id != 0 && prop_id - 1 < 5);
Norman James18998182015-10-11 21:54:53 -050023756 g_mutex_lock (&skeleton->priv->lock);
23757 g_object_freeze_notify (object);
23758 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
23759 {
23760 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
23761 _flash_schedule_emit_changed (skeleton, _flash_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
23762 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
23763 g_object_notify_by_pspec (object, pspec);
23764 }
23765 g_mutex_unlock (&skeleton->priv->lock);
23766 g_object_thaw_notify (object);
23767}
23768
23769static void
Norman James362a80f2015-09-14 14:04:39 -050023770flash_skeleton_init (FlashSkeleton *skeleton)
23771{
23772#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
23773 skeleton->priv = flash_skeleton_get_instance_private (skeleton);
23774#else
23775 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_FLASH_SKELETON, FlashSkeletonPrivate);
23776#endif
23777
23778 g_mutex_init (&skeleton->priv->lock);
23779 skeleton->priv->context = g_main_context_ref_thread_default ();
Norman James166acf42015-10-22 07:11:51 -050023780 skeleton->priv->properties = g_new0 (GValue, 5);
Norman James18998182015-10-11 21:54:53 -050023781 g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING);
23782 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
23783 g_value_init (&skeleton->priv->properties[2], G_TYPE_STRING);
23784 g_value_init (&skeleton->priv->properties[3], G_TYPE_STRING);
Norman James166acf42015-10-22 07:11:51 -050023785 g_value_init (&skeleton->priv->properties[4], G_TYPE_STRING);
Norman James18998182015-10-11 21:54:53 -050023786}
23787
23788static const gchar *
23789flash_skeleton_get_filename (Flash *object)
23790{
23791 FlashSkeleton *skeleton = FLASH_SKELETON (object);
23792 const gchar *value;
23793 g_mutex_lock (&skeleton->priv->lock);
23794 value = g_value_get_string (&(skeleton->priv->properties[0]));
23795 g_mutex_unlock (&skeleton->priv->lock);
23796 return value;
23797}
23798
23799static const gchar *
23800flash_skeleton_get_flasher_path (Flash *object)
23801{
23802 FlashSkeleton *skeleton = FLASH_SKELETON (object);
23803 const gchar *value;
23804 g_mutex_lock (&skeleton->priv->lock);
23805 value = g_value_get_string (&(skeleton->priv->properties[1]));
23806 g_mutex_unlock (&skeleton->priv->lock);
23807 return value;
23808}
23809
23810static const gchar *
23811flash_skeleton_get_flasher_name (Flash *object)
23812{
23813 FlashSkeleton *skeleton = FLASH_SKELETON (object);
23814 const gchar *value;
23815 g_mutex_lock (&skeleton->priv->lock);
23816 value = g_value_get_string (&(skeleton->priv->properties[2]));
23817 g_mutex_unlock (&skeleton->priv->lock);
23818 return value;
23819}
23820
23821static const gchar *
23822flash_skeleton_get_flasher_instance (Flash *object)
23823{
23824 FlashSkeleton *skeleton = FLASH_SKELETON (object);
23825 const gchar *value;
23826 g_mutex_lock (&skeleton->priv->lock);
23827 value = g_value_get_string (&(skeleton->priv->properties[3]));
23828 g_mutex_unlock (&skeleton->priv->lock);
23829 return value;
Norman James362a80f2015-09-14 14:04:39 -050023830}
23831
Norman James166acf42015-10-22 07:11:51 -050023832static const gchar *
23833flash_skeleton_get_status (Flash *object)
23834{
23835 FlashSkeleton *skeleton = FLASH_SKELETON (object);
23836 const gchar *value;
23837 g_mutex_lock (&skeleton->priv->lock);
23838 value = g_value_get_string (&(skeleton->priv->properties[4]));
23839 g_mutex_unlock (&skeleton->priv->lock);
23840 return value;
23841}
23842
Norman James362a80f2015-09-14 14:04:39 -050023843static void
23844flash_skeleton_class_init (FlashSkeletonClass *klass)
23845{
23846 GObjectClass *gobject_class;
23847 GDBusInterfaceSkeletonClass *skeleton_class;
23848
23849 gobject_class = G_OBJECT_CLASS (klass);
23850 gobject_class->finalize = flash_skeleton_finalize;
Norman James18998182015-10-11 21:54:53 -050023851 gobject_class->get_property = flash_skeleton_get_property;
23852 gobject_class->set_property = flash_skeleton_set_property;
23853 gobject_class->notify = flash_skeleton_notify;
23854
23855
23856 flash_override_properties (gobject_class, 1);
Norman James362a80f2015-09-14 14:04:39 -050023857
23858 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
23859 skeleton_class->get_info = flash_skeleton_dbus_interface_get_info;
23860 skeleton_class->get_properties = flash_skeleton_dbus_interface_get_properties;
23861 skeleton_class->flush = flash_skeleton_dbus_interface_flush;
23862 skeleton_class->get_vtable = flash_skeleton_dbus_interface_get_vtable;
23863
23864#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
23865 g_type_class_add_private (klass, sizeof (FlashSkeletonPrivate));
23866#endif
23867}
23868
23869static void
23870flash_skeleton_iface_init (FlashIface *iface)
23871{
23872 iface->updated = _flash_on_signal_updated;
Norman Jamesf066e872015-10-07 15:29:51 -050023873 iface->download = _flash_on_signal_download;
Norman James18998182015-10-11 21:54:53 -050023874 iface->get_filename = flash_skeleton_get_filename;
23875 iface->get_flasher_path = flash_skeleton_get_flasher_path;
23876 iface->get_flasher_name = flash_skeleton_get_flasher_name;
23877 iface->get_flasher_instance = flash_skeleton_get_flasher_instance;
Norman James166acf42015-10-22 07:11:51 -050023878 iface->get_status = flash_skeleton_get_status;
Norman James362a80f2015-09-14 14:04:39 -050023879}
23880
23881/**
23882 * flash_skeleton_new:
23883 *
23884 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>.
23885 *
23886 * Returns: (transfer full) (type FlashSkeleton): The skeleton object.
23887 */
23888Flash *
23889flash_skeleton_new (void)
23890{
23891 return FLASH (g_object_new (TYPE_FLASH_SKELETON, NULL));
23892}
23893
23894/* ------------------------------------------------------------------------
Norman James18998182015-10-11 21:54:53 -050023895 * Code for interface org.openbmc.FlashControl
23896 * ------------------------------------------------------------------------
23897 */
23898
23899/**
23900 * SECTION:FlashControl
23901 * @title: FlashControl
23902 * @short_description: Generated C code for the org.openbmc.FlashControl D-Bus interface
23903 *
23904 * 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.
23905 */
23906
23907/* ---- Introspection data for org.openbmc.FlashControl ---- */
23908
23909static const _ExtendedGDBusArgInfo _flash_control_method_info_flash_IN_ARG_type =
23910{
23911 {
23912 -1,
23913 (gchar *) "type",
23914 (gchar *) "s",
23915 NULL
23916 },
23917 FALSE
23918};
23919
23920static const _ExtendedGDBusArgInfo _flash_control_method_info_flash_IN_ARG_filename =
23921{
23922 {
23923 -1,
23924 (gchar *) "filename",
23925 (gchar *) "s",
23926 NULL
23927 },
23928 FALSE
23929};
23930
23931static const _ExtendedGDBusArgInfo * const _flash_control_method_info_flash_IN_ARG_pointers[] =
23932{
23933 &_flash_control_method_info_flash_IN_ARG_type,
23934 &_flash_control_method_info_flash_IN_ARG_filename,
23935 NULL
23936};
23937
23938static const _ExtendedGDBusMethodInfo _flash_control_method_info_flash =
23939{
23940 {
23941 -1,
23942 (gchar *) "flash",
23943 (GDBusArgInfo **) &_flash_control_method_info_flash_IN_ARG_pointers,
23944 NULL,
23945 NULL
23946 },
23947 "handle-flash",
23948 FALSE
23949};
23950
23951static const _ExtendedGDBusMethodInfo * const _flash_control_method_info_pointers[] =
23952{
23953 &_flash_control_method_info_flash,
23954 NULL
23955};
23956
23957static const _ExtendedGDBusArgInfo _flash_control_signal_info_done_ARG_filename =
23958{
23959 {
23960 -1,
23961 (gchar *) "filename",
23962 (gchar *) "s",
23963 NULL
23964 },
23965 FALSE
23966};
23967
23968static const _ExtendedGDBusArgInfo * const _flash_control_signal_info_done_ARG_pointers[] =
23969{
23970 &_flash_control_signal_info_done_ARG_filename,
23971 NULL
23972};
23973
23974static const _ExtendedGDBusSignalInfo _flash_control_signal_info_done =
23975{
23976 {
23977 -1,
23978 (gchar *) "Done",
23979 (GDBusArgInfo **) &_flash_control_signal_info_done_ARG_pointers,
23980 NULL
23981 },
23982 "done"
23983};
23984
23985static const _ExtendedGDBusArgInfo _flash_control_signal_info_error_ARG_filename =
23986{
23987 {
23988 -1,
23989 (gchar *) "filename",
23990 (gchar *) "s",
23991 NULL
23992 },
23993 FALSE
23994};
23995
23996static const _ExtendedGDBusArgInfo * const _flash_control_signal_info_error_ARG_pointers[] =
23997{
23998 &_flash_control_signal_info_error_ARG_filename,
23999 NULL
24000};
24001
24002static const _ExtendedGDBusSignalInfo _flash_control_signal_info_error =
24003{
24004 {
24005 -1,
24006 (gchar *) "Error",
24007 (GDBusArgInfo **) &_flash_control_signal_info_error_ARG_pointers,
24008 NULL
24009 },
24010 "error"
24011};
24012
24013static const _ExtendedGDBusArgInfo _flash_control_signal_info_progress_ARG_filename =
24014{
24015 {
24016 -1,
24017 (gchar *) "filename",
24018 (gchar *) "s",
24019 NULL
24020 },
24021 FALSE
24022};
24023
24024static const _ExtendedGDBusArgInfo _flash_control_signal_info_progress_ARG_progress =
24025{
24026 {
24027 -1,
24028 (gchar *) "progress",
24029 (gchar *) "y",
24030 NULL
24031 },
24032 FALSE
24033};
24034
24035static const _ExtendedGDBusArgInfo * const _flash_control_signal_info_progress_ARG_pointers[] =
24036{
24037 &_flash_control_signal_info_progress_ARG_filename,
24038 &_flash_control_signal_info_progress_ARG_progress,
24039 NULL
24040};
24041
24042static const _ExtendedGDBusSignalInfo _flash_control_signal_info_progress =
24043{
24044 {
24045 -1,
24046 (gchar *) "Progress",
24047 (GDBusArgInfo **) &_flash_control_signal_info_progress_ARG_pointers,
24048 NULL
24049 },
24050 "progress"
24051};
24052
24053static const _ExtendedGDBusSignalInfo * const _flash_control_signal_info_pointers[] =
24054{
24055 &_flash_control_signal_info_done,
24056 &_flash_control_signal_info_error,
24057 &_flash_control_signal_info_progress,
24058 NULL
24059};
24060
24061static const _ExtendedGDBusPropertyInfo _flash_control_property_info_filename =
24062{
24063 {
24064 -1,
24065 (gchar *) "filename",
24066 (gchar *) "s",
24067 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
24068 NULL
24069 },
24070 "filename",
24071 FALSE
24072};
24073
24074static const _ExtendedGDBusPropertyInfo _flash_control_property_info_type_ =
24075{
24076 {
24077 -1,
24078 (gchar *) "type",
24079 (gchar *) "s",
24080 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
24081 NULL
24082 },
24083 "type",
24084 FALSE
24085};
24086
24087static const _ExtendedGDBusPropertyInfo * const _flash_control_property_info_pointers[] =
24088{
24089 &_flash_control_property_info_filename,
24090 &_flash_control_property_info_type_,
24091 NULL
24092};
24093
24094static const _ExtendedGDBusInterfaceInfo _flash_control_interface_info =
24095{
24096 {
24097 -1,
24098 (gchar *) "org.openbmc.FlashControl",
24099 (GDBusMethodInfo **) &_flash_control_method_info_pointers,
24100 (GDBusSignalInfo **) &_flash_control_signal_info_pointers,
24101 (GDBusPropertyInfo **) &_flash_control_property_info_pointers,
24102 NULL
24103 },
24104 "flash-control",
24105};
24106
24107
24108/**
24109 * flash_control_interface_info:
24110 *
24111 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link> D-Bus interface.
24112 *
24113 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
24114 */
24115GDBusInterfaceInfo *
24116flash_control_interface_info (void)
24117{
24118 return (GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct;
24119}
24120
24121/**
24122 * flash_control_override_properties:
24123 * @klass: The class structure for a #GObject<!-- -->-derived class.
24124 * @property_id_begin: The property id to assign to the first overridden property.
24125 *
24126 * Overrides all #GObject properties in the #FlashControl interface for a concrete class.
24127 * The properties are overridden in the order they are defined.
24128 *
24129 * Returns: The last property id.
24130 */
24131guint
24132flash_control_override_properties (GObjectClass *klass, guint property_id_begin)
24133{
24134 g_object_class_override_property (klass, property_id_begin++, "filename");
24135 g_object_class_override_property (klass, property_id_begin++, "type");
24136 return property_id_begin - 1;
24137}
24138
24139
24140
24141/**
24142 * FlashControl:
24143 *
24144 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link>.
24145 */
24146
24147/**
24148 * FlashControlIface:
24149 * @parent_iface: The parent interface.
24150 * @handle_flash: Handler for the #FlashControl::handle-flash signal.
24151 * @get_filename: Getter for the #FlashControl:filename property.
24152 * @get_type_: Getter for the #FlashControl:type property.
24153 * @done: Handler for the #FlashControl::done signal.
24154 * @error: Handler for the #FlashControl::error signal.
24155 * @progress: Handler for the #FlashControl::progress signal.
24156 *
24157 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link>.
24158 */
24159
24160typedef FlashControlIface FlashControlInterface;
24161G_DEFINE_INTERFACE (FlashControl, flash_control, G_TYPE_OBJECT);
24162
24163static void
24164flash_control_default_init (FlashControlIface *iface)
24165{
24166 /* GObject signals for incoming D-Bus method calls: */
24167 /**
24168 * FlashControl::handle-flash:
24169 * @object: A #FlashControl.
24170 * @invocation: A #GDBusMethodInvocation.
24171 * @arg_type: Argument passed by remote caller.
24172 * @arg_filename: Argument passed by remote caller.
24173 *
24174 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-FlashControl.flash">flash()</link> D-Bus method.
24175 *
24176 * 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.
24177 *
24178 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
24179 */
24180 g_signal_new ("handle-flash",
24181 G_TYPE_FROM_INTERFACE (iface),
24182 G_SIGNAL_RUN_LAST,
24183 G_STRUCT_OFFSET (FlashControlIface, handle_flash),
24184 g_signal_accumulator_true_handled,
24185 NULL,
24186 g_cclosure_marshal_generic,
24187 G_TYPE_BOOLEAN,
24188 3,
24189 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_STRING);
24190
24191 /* GObject signals for received D-Bus signals: */
24192 /**
24193 * FlashControl::done:
24194 * @object: A #FlashControl.
24195 * @arg_filename: Argument.
24196 *
24197 * 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.
24198 *
24199 * 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.
24200 */
24201 g_signal_new ("done",
24202 G_TYPE_FROM_INTERFACE (iface),
24203 G_SIGNAL_RUN_LAST,
24204 G_STRUCT_OFFSET (FlashControlIface, done),
24205 NULL,
24206 NULL,
24207 g_cclosure_marshal_generic,
24208 G_TYPE_NONE,
24209 1, G_TYPE_STRING);
24210
24211 /**
24212 * FlashControl::error:
24213 * @object: A #FlashControl.
24214 * @arg_filename: Argument.
24215 *
24216 * 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.
24217 *
24218 * 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.
24219 */
24220 g_signal_new ("error",
24221 G_TYPE_FROM_INTERFACE (iface),
24222 G_SIGNAL_RUN_LAST,
24223 G_STRUCT_OFFSET (FlashControlIface, error),
24224 NULL,
24225 NULL,
24226 g_cclosure_marshal_generic,
24227 G_TYPE_NONE,
24228 1, G_TYPE_STRING);
24229
24230 /**
24231 * FlashControl::progress:
24232 * @object: A #FlashControl.
24233 * @arg_filename: Argument.
24234 * @arg_progress: Argument.
24235 *
24236 * 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.
24237 *
24238 * 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.
24239 */
24240 g_signal_new ("progress",
24241 G_TYPE_FROM_INTERFACE (iface),
24242 G_SIGNAL_RUN_LAST,
24243 G_STRUCT_OFFSET (FlashControlIface, progress),
24244 NULL,
24245 NULL,
24246 g_cclosure_marshal_generic,
24247 G_TYPE_NONE,
24248 2, G_TYPE_STRING, G_TYPE_UCHAR);
24249
24250 /* GObject properties for D-Bus properties: */
24251 /**
24252 * FlashControl:filename:
24253 *
24254 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-FlashControl.filename">"filename"</link>.
24255 *
24256 * 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.
24257 */
24258 g_object_interface_install_property (iface,
24259 g_param_spec_string ("filename", "filename", "filename", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
24260 /**
24261 * FlashControl:type:
24262 *
24263 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-FlashControl.type">"type"</link>.
24264 *
24265 * 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.
24266 */
24267 g_object_interface_install_property (iface,
24268 g_param_spec_string ("type", "type", "type", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
24269}
24270
24271/**
24272 * flash_control_get_filename: (skip)
24273 * @object: A #FlashControl.
24274 *
24275 * Gets the value of the <link linkend="gdbus-property-org-openbmc-FlashControl.filename">"filename"</link> D-Bus property.
24276 *
24277 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
24278 *
24279 * <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>
24280 *
24281 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
24282 */
24283const gchar *
24284flash_control_get_filename (FlashControl *object)
24285{
24286 return FLASH_CONTROL_GET_IFACE (object)->get_filename (object);
24287}
24288
24289/**
24290 * flash_control_dup_filename: (skip)
24291 * @object: A #FlashControl.
24292 *
24293 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-FlashControl.filename">"filename"</link> D-Bus property.
24294 *
24295 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
24296 *
24297 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
24298 */
24299gchar *
24300flash_control_dup_filename (FlashControl *object)
24301{
24302 gchar *value;
24303 g_object_get (G_OBJECT (object), "filename", &value, NULL);
24304 return value;
24305}
24306
24307/**
24308 * flash_control_set_filename: (skip)
24309 * @object: A #FlashControl.
24310 * @value: The value to set.
24311 *
24312 * Sets the <link linkend="gdbus-property-org-openbmc-FlashControl.filename">"filename"</link> D-Bus property to @value.
24313 *
24314 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
24315 */
24316void
24317flash_control_set_filename (FlashControl *object, const gchar *value)
24318{
24319 g_object_set (G_OBJECT (object), "filename", value, NULL);
24320}
24321
24322/**
24323 * flash_control_get_type_: (skip)
24324 * @object: A #FlashControl.
24325 *
24326 * Gets the value of the <link linkend="gdbus-property-org-openbmc-FlashControl.type">"type"</link> D-Bus property.
24327 *
24328 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
24329 *
24330 * <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>
24331 *
24332 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
24333 */
24334const gchar *
24335flash_control_get_type_ (FlashControl *object)
24336{
24337 return FLASH_CONTROL_GET_IFACE (object)->get_type_ (object);
24338}
24339
24340/**
24341 * flash_control_dup_type_: (skip)
24342 * @object: A #FlashControl.
24343 *
24344 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-FlashControl.type">"type"</link> D-Bus property.
24345 *
24346 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
24347 *
24348 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
24349 */
24350gchar *
24351flash_control_dup_type_ (FlashControl *object)
24352{
24353 gchar *value;
24354 g_object_get (G_OBJECT (object), "type", &value, NULL);
24355 return value;
24356}
24357
24358/**
24359 * flash_control_set_type_: (skip)
24360 * @object: A #FlashControl.
24361 * @value: The value to set.
24362 *
24363 * Sets the <link linkend="gdbus-property-org-openbmc-FlashControl.type">"type"</link> D-Bus property to @value.
24364 *
24365 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
24366 */
24367void
24368flash_control_set_type_ (FlashControl *object, const gchar *value)
24369{
24370 g_object_set (G_OBJECT (object), "type", value, NULL);
24371}
24372
24373/**
24374 * flash_control_emit_done:
24375 * @object: A #FlashControl.
24376 * @arg_filename: Argument to pass with the signal.
24377 *
24378 * Emits the <link linkend="gdbus-signal-org-openbmc-FlashControl.Done">"Done"</link> D-Bus signal.
24379 */
24380void
24381flash_control_emit_done (
24382 FlashControl *object,
24383 const gchar *arg_filename)
24384{
24385 g_signal_emit_by_name (object, "done", arg_filename);
24386}
24387
24388/**
24389 * flash_control_emit_error:
24390 * @object: A #FlashControl.
24391 * @arg_filename: Argument to pass with the signal.
24392 *
24393 * Emits the <link linkend="gdbus-signal-org-openbmc-FlashControl.Error">"Error"</link> D-Bus signal.
24394 */
24395void
24396flash_control_emit_error (
24397 FlashControl *object,
24398 const gchar *arg_filename)
24399{
24400 g_signal_emit_by_name (object, "error", arg_filename);
24401}
24402
24403/**
24404 * flash_control_emit_progress:
24405 * @object: A #FlashControl.
24406 * @arg_filename: Argument to pass with the signal.
24407 * @arg_progress: Argument to pass with the signal.
24408 *
24409 * Emits the <link linkend="gdbus-signal-org-openbmc-FlashControl.Progress">"Progress"</link> D-Bus signal.
24410 */
24411void
24412flash_control_emit_progress (
24413 FlashControl *object,
24414 const gchar *arg_filename,
24415 guchar arg_progress)
24416{
24417 g_signal_emit_by_name (object, "progress", arg_filename, arg_progress);
24418}
24419
24420/**
24421 * flash_control_call_flash:
24422 * @proxy: A #FlashControlProxy.
24423 * @arg_type: Argument to pass with the method invocation.
24424 * @arg_filename: Argument to pass with the method invocation.
24425 * @cancellable: (allow-none): A #GCancellable or %NULL.
24426 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
24427 * @user_data: User data to pass to @callback.
24428 *
24429 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-FlashControl.flash">flash()</link> D-Bus method on @proxy.
24430 * 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.
24431 * You can then call flash_control_call_flash_finish() to get the result of the operation.
24432 *
24433 * See flash_control_call_flash_sync() for the synchronous, blocking version of this method.
24434 */
24435void
24436flash_control_call_flash (
24437 FlashControl *proxy,
24438 const gchar *arg_type,
24439 const gchar *arg_filename,
24440 GCancellable *cancellable,
24441 GAsyncReadyCallback callback,
24442 gpointer user_data)
24443{
24444 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
24445 "flash",
24446 g_variant_new ("(ss)",
24447 arg_type,
24448 arg_filename),
24449 G_DBUS_CALL_FLAGS_NONE,
24450 -1,
24451 cancellable,
24452 callback,
24453 user_data);
24454}
24455
24456/**
24457 * flash_control_call_flash_finish:
24458 * @proxy: A #FlashControlProxy.
24459 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_control_call_flash().
24460 * @error: Return location for error or %NULL.
24461 *
24462 * Finishes an operation started with flash_control_call_flash().
24463 *
24464 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
24465 */
24466gboolean
24467flash_control_call_flash_finish (
24468 FlashControl *proxy,
24469 GAsyncResult *res,
24470 GError **error)
24471{
24472 GVariant *_ret;
24473 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
24474 if (_ret == NULL)
24475 goto _out;
24476 g_variant_get (_ret,
24477 "()");
24478 g_variant_unref (_ret);
24479_out:
24480 return _ret != NULL;
24481}
24482
24483/**
24484 * flash_control_call_flash_sync:
24485 * @proxy: A #FlashControlProxy.
24486 * @arg_type: Argument to pass with the method invocation.
24487 * @arg_filename: Argument to pass with the method invocation.
24488 * @cancellable: (allow-none): A #GCancellable or %NULL.
24489 * @error: Return location for error or %NULL.
24490 *
24491 * 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.
24492 *
24493 * See flash_control_call_flash() for the asynchronous version of this method.
24494 *
24495 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
24496 */
24497gboolean
24498flash_control_call_flash_sync (
24499 FlashControl *proxy,
24500 const gchar *arg_type,
24501 const gchar *arg_filename,
24502 GCancellable *cancellable,
24503 GError **error)
24504{
24505 GVariant *_ret;
24506 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
24507 "flash",
24508 g_variant_new ("(ss)",
24509 arg_type,
24510 arg_filename),
24511 G_DBUS_CALL_FLAGS_NONE,
24512 -1,
24513 cancellable,
24514 error);
24515 if (_ret == NULL)
24516 goto _out;
24517 g_variant_get (_ret,
24518 "()");
24519 g_variant_unref (_ret);
24520_out:
24521 return _ret != NULL;
24522}
24523
24524/**
24525 * flash_control_complete_flash:
24526 * @object: A #FlashControl.
24527 * @invocation: (transfer full): A #GDBusMethodInvocation.
24528 *
24529 * 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.
24530 *
24531 * This method will free @invocation, you cannot use it afterwards.
24532 */
24533void
24534flash_control_complete_flash (
24535 FlashControl *object,
24536 GDBusMethodInvocation *invocation)
24537{
24538 g_dbus_method_invocation_return_value (invocation,
24539 g_variant_new ("()"));
24540}
24541
24542/* ------------------------------------------------------------------------ */
24543
24544/**
24545 * FlashControlProxy:
24546 *
24547 * The #FlashControlProxy structure contains only private data and should only be accessed using the provided API.
24548 */
24549
24550/**
24551 * FlashControlProxyClass:
24552 * @parent_class: The parent class.
24553 *
24554 * Class structure for #FlashControlProxy.
24555 */
24556
24557struct _FlashControlProxyPrivate
24558{
24559 GData *qdata;
24560};
24561
24562static void flash_control_proxy_iface_init (FlashControlIface *iface);
24563
24564#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
24565G_DEFINE_TYPE_WITH_CODE (FlashControlProxy, flash_control_proxy, G_TYPE_DBUS_PROXY,
24566 G_ADD_PRIVATE (FlashControlProxy)
24567 G_IMPLEMENT_INTERFACE (TYPE_FLASH_CONTROL, flash_control_proxy_iface_init));
24568
24569#else
24570G_DEFINE_TYPE_WITH_CODE (FlashControlProxy, flash_control_proxy, G_TYPE_DBUS_PROXY,
24571 G_IMPLEMENT_INTERFACE (TYPE_FLASH_CONTROL, flash_control_proxy_iface_init));
24572
24573#endif
24574static void
24575flash_control_proxy_finalize (GObject *object)
24576{
24577 FlashControlProxy *proxy = FLASH_CONTROL_PROXY (object);
24578 g_datalist_clear (&proxy->priv->qdata);
24579 G_OBJECT_CLASS (flash_control_proxy_parent_class)->finalize (object);
24580}
24581
24582static void
24583flash_control_proxy_get_property (GObject *object,
24584 guint prop_id,
24585 GValue *value,
24586 GParamSpec *pspec G_GNUC_UNUSED)
24587{
24588 const _ExtendedGDBusPropertyInfo *info;
24589 GVariant *variant;
24590 g_assert (prop_id != 0 && prop_id - 1 < 2);
24591 info = _flash_control_property_info_pointers[prop_id - 1];
24592 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
24593 if (info->use_gvariant)
24594 {
24595 g_value_set_variant (value, variant);
24596 }
24597 else
24598 {
24599 if (variant != NULL)
24600 g_dbus_gvariant_to_gvalue (variant, value);
24601 }
24602 if (variant != NULL)
24603 g_variant_unref (variant);
24604}
24605
24606static void
24607flash_control_proxy_set_property_cb (GDBusProxy *proxy,
24608 GAsyncResult *res,
24609 gpointer user_data)
24610{
24611 const _ExtendedGDBusPropertyInfo *info = user_data;
24612 GError *error;
24613 GVariant *_ret;
24614 error = NULL;
24615 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
24616 if (!_ret)
24617 {
24618 g_warning ("Error setting property '%s' on interface org.openbmc.FlashControl: %s (%s, %d)",
24619 info->parent_struct.name,
24620 error->message, g_quark_to_string (error->domain), error->code);
24621 g_error_free (error);
24622 }
24623 else
24624 {
24625 g_variant_unref (_ret);
24626 }
24627}
24628
24629static void
24630flash_control_proxy_set_property (GObject *object,
24631 guint prop_id,
24632 const GValue *value,
24633 GParamSpec *pspec G_GNUC_UNUSED)
24634{
24635 const _ExtendedGDBusPropertyInfo *info;
24636 GVariant *variant;
24637 g_assert (prop_id != 0 && prop_id - 1 < 2);
24638 info = _flash_control_property_info_pointers[prop_id - 1];
24639 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
24640 g_dbus_proxy_call (G_DBUS_PROXY (object),
24641 "org.freedesktop.DBus.Properties.Set",
24642 g_variant_new ("(ssv)", "org.openbmc.FlashControl", info->parent_struct.name, variant),
24643 G_DBUS_CALL_FLAGS_NONE,
24644 -1,
24645 NULL, (GAsyncReadyCallback) flash_control_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
24646 g_variant_unref (variant);
24647}
24648
24649static void
24650flash_control_proxy_g_signal (GDBusProxy *proxy,
24651 const gchar *sender_name G_GNUC_UNUSED,
24652 const gchar *signal_name,
24653 GVariant *parameters)
24654{
24655 _ExtendedGDBusSignalInfo *info;
24656 GVariantIter iter;
24657 GVariant *child;
24658 GValue *paramv;
24659 guint num_params;
24660 guint n;
24661 guint signal_id;
24662 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct, signal_name);
24663 if (info == NULL)
24664 return;
24665 num_params = g_variant_n_children (parameters);
24666 paramv = g_new0 (GValue, num_params + 1);
24667 g_value_init (&paramv[0], TYPE_FLASH_CONTROL);
24668 g_value_set_object (&paramv[0], proxy);
24669 g_variant_iter_init (&iter, parameters);
24670 n = 1;
24671 while ((child = g_variant_iter_next_value (&iter)) != NULL)
24672 {
24673 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
24674 if (arg_info->use_gvariant)
24675 {
24676 g_value_init (&paramv[n], G_TYPE_VARIANT);
24677 g_value_set_variant (&paramv[n], child);
24678 n++;
24679 }
24680 else
24681 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
24682 g_variant_unref (child);
24683 }
24684 signal_id = g_signal_lookup (info->signal_name, TYPE_FLASH_CONTROL);
24685 g_signal_emitv (paramv, signal_id, 0, NULL);
24686 for (n = 0; n < num_params + 1; n++)
24687 g_value_unset (&paramv[n]);
24688 g_free (paramv);
24689}
24690
24691static void
24692flash_control_proxy_g_properties_changed (GDBusProxy *_proxy,
24693 GVariant *changed_properties,
24694 const gchar *const *invalidated_properties)
24695{
24696 FlashControlProxy *proxy = FLASH_CONTROL_PROXY (_proxy);
24697 guint n;
24698 const gchar *key;
24699 GVariantIter *iter;
24700 _ExtendedGDBusPropertyInfo *info;
24701 g_variant_get (changed_properties, "a{sv}", &iter);
24702 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
24703 {
24704 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct, key);
24705 g_datalist_remove_data (&proxy->priv->qdata, key);
24706 if (info != NULL)
24707 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
24708 }
24709 g_variant_iter_free (iter);
24710 for (n = 0; invalidated_properties[n] != NULL; n++)
24711 {
24712 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct, invalidated_properties[n]);
24713 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
24714 if (info != NULL)
24715 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
24716 }
24717}
24718
24719static const gchar *
24720flash_control_proxy_get_filename (FlashControl *object)
24721{
24722 FlashControlProxy *proxy = FLASH_CONTROL_PROXY (object);
24723 GVariant *variant;
24724 const gchar *value = NULL;
24725 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "filename");
24726 if (variant != NULL)
24727 {
24728 value = g_variant_get_string (variant, NULL);
24729 g_variant_unref (variant);
24730 }
24731 return value;
24732}
24733
24734static const gchar *
24735flash_control_proxy_get_type_ (FlashControl *object)
24736{
24737 FlashControlProxy *proxy = FLASH_CONTROL_PROXY (object);
24738 GVariant *variant;
24739 const gchar *value = NULL;
24740 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "type");
24741 if (variant != NULL)
24742 {
24743 value = g_variant_get_string (variant, NULL);
24744 g_variant_unref (variant);
24745 }
24746 return value;
24747}
24748
24749static void
24750flash_control_proxy_init (FlashControlProxy *proxy)
24751{
24752#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
24753 proxy->priv = flash_control_proxy_get_instance_private (proxy);
24754#else
24755 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_FLASH_CONTROL_PROXY, FlashControlProxyPrivate);
24756#endif
24757
24758 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), flash_control_interface_info ());
24759}
24760
24761static void
24762flash_control_proxy_class_init (FlashControlProxyClass *klass)
24763{
24764 GObjectClass *gobject_class;
24765 GDBusProxyClass *proxy_class;
24766
24767 gobject_class = G_OBJECT_CLASS (klass);
24768 gobject_class->finalize = flash_control_proxy_finalize;
24769 gobject_class->get_property = flash_control_proxy_get_property;
24770 gobject_class->set_property = flash_control_proxy_set_property;
24771
24772 proxy_class = G_DBUS_PROXY_CLASS (klass);
24773 proxy_class->g_signal = flash_control_proxy_g_signal;
24774 proxy_class->g_properties_changed = flash_control_proxy_g_properties_changed;
24775
24776 flash_control_override_properties (gobject_class, 1);
24777
24778#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
24779 g_type_class_add_private (klass, sizeof (FlashControlProxyPrivate));
24780#endif
24781}
24782
24783static void
24784flash_control_proxy_iface_init (FlashControlIface *iface)
24785{
24786 iface->get_filename = flash_control_proxy_get_filename;
24787 iface->get_type_ = flash_control_proxy_get_type_;
24788}
24789
24790/**
24791 * flash_control_proxy_new:
24792 * @connection: A #GDBusConnection.
24793 * @flags: Flags from the #GDBusProxyFlags enumeration.
24794 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
24795 * @object_path: An object path.
24796 * @cancellable: (allow-none): A #GCancellable or %NULL.
24797 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
24798 * @user_data: User data to pass to @callback.
24799 *
24800 * 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.
24801 *
24802 * 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.
24803 * You can then call flash_control_proxy_new_finish() to get the result of the operation.
24804 *
24805 * See flash_control_proxy_new_sync() for the synchronous, blocking version of this constructor.
24806 */
24807void
24808flash_control_proxy_new (
24809 GDBusConnection *connection,
24810 GDBusProxyFlags flags,
24811 const gchar *name,
24812 const gchar *object_path,
24813 GCancellable *cancellable,
24814 GAsyncReadyCallback callback,
24815 gpointer user_data)
24816{
24817 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);
24818}
24819
24820/**
24821 * flash_control_proxy_new_finish:
24822 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_control_proxy_new().
24823 * @error: Return location for error or %NULL
24824 *
24825 * Finishes an operation started with flash_control_proxy_new().
24826 *
24827 * Returns: (transfer full) (type FlashControlProxy): The constructed proxy object or %NULL if @error is set.
24828 */
24829FlashControl *
24830flash_control_proxy_new_finish (
24831 GAsyncResult *res,
24832 GError **error)
24833{
24834 GObject *ret;
24835 GObject *source_object;
24836 source_object = g_async_result_get_source_object (res);
24837 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
24838 g_object_unref (source_object);
24839 if (ret != NULL)
24840 return FLASH_CONTROL (ret);
24841 else
24842 return NULL;
24843}
24844
24845/**
24846 * flash_control_proxy_new_sync:
24847 * @connection: A #GDBusConnection.
24848 * @flags: Flags from the #GDBusProxyFlags enumeration.
24849 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
24850 * @object_path: An object path.
24851 * @cancellable: (allow-none): A #GCancellable or %NULL.
24852 * @error: Return location for error or %NULL
24853 *
24854 * 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.
24855 *
24856 * The calling thread is blocked until a reply is received.
24857 *
24858 * See flash_control_proxy_new() for the asynchronous version of this constructor.
24859 *
24860 * Returns: (transfer full) (type FlashControlProxy): The constructed proxy object or %NULL if @error is set.
24861 */
24862FlashControl *
24863flash_control_proxy_new_sync (
24864 GDBusConnection *connection,
24865 GDBusProxyFlags flags,
24866 const gchar *name,
24867 const gchar *object_path,
24868 GCancellable *cancellable,
24869 GError **error)
24870{
24871 GInitable *ret;
24872 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);
24873 if (ret != NULL)
24874 return FLASH_CONTROL (ret);
24875 else
24876 return NULL;
24877}
24878
24879
24880/**
24881 * flash_control_proxy_new_for_bus:
24882 * @bus_type: A #GBusType.
24883 * @flags: Flags from the #GDBusProxyFlags enumeration.
24884 * @name: A bus name (well-known or unique).
24885 * @object_path: An object path.
24886 * @cancellable: (allow-none): A #GCancellable or %NULL.
24887 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
24888 * @user_data: User data to pass to @callback.
24889 *
24890 * Like flash_control_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
24891 *
24892 * 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.
24893 * You can then call flash_control_proxy_new_for_bus_finish() to get the result of the operation.
24894 *
24895 * See flash_control_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
24896 */
24897void
24898flash_control_proxy_new_for_bus (
24899 GBusType bus_type,
24900 GDBusProxyFlags flags,
24901 const gchar *name,
24902 const gchar *object_path,
24903 GCancellable *cancellable,
24904 GAsyncReadyCallback callback,
24905 gpointer user_data)
24906{
24907 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);
24908}
24909
24910/**
24911 * flash_control_proxy_new_for_bus_finish:
24912 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_control_proxy_new_for_bus().
24913 * @error: Return location for error or %NULL
24914 *
24915 * Finishes an operation started with flash_control_proxy_new_for_bus().
24916 *
24917 * Returns: (transfer full) (type FlashControlProxy): The constructed proxy object or %NULL if @error is set.
24918 */
24919FlashControl *
24920flash_control_proxy_new_for_bus_finish (
24921 GAsyncResult *res,
24922 GError **error)
24923{
24924 GObject *ret;
24925 GObject *source_object;
24926 source_object = g_async_result_get_source_object (res);
24927 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
24928 g_object_unref (source_object);
24929 if (ret != NULL)
24930 return FLASH_CONTROL (ret);
24931 else
24932 return NULL;
24933}
24934
24935/**
24936 * flash_control_proxy_new_for_bus_sync:
24937 * @bus_type: A #GBusType.
24938 * @flags: Flags from the #GDBusProxyFlags enumeration.
24939 * @name: A bus name (well-known or unique).
24940 * @object_path: An object path.
24941 * @cancellable: (allow-none): A #GCancellable or %NULL.
24942 * @error: Return location for error or %NULL
24943 *
24944 * Like flash_control_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
24945 *
24946 * The calling thread is blocked until a reply is received.
24947 *
24948 * See flash_control_proxy_new_for_bus() for the asynchronous version of this constructor.
24949 *
24950 * Returns: (transfer full) (type FlashControlProxy): The constructed proxy object or %NULL if @error is set.
24951 */
24952FlashControl *
24953flash_control_proxy_new_for_bus_sync (
24954 GBusType bus_type,
24955 GDBusProxyFlags flags,
24956 const gchar *name,
24957 const gchar *object_path,
24958 GCancellable *cancellable,
24959 GError **error)
24960{
24961 GInitable *ret;
24962 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);
24963 if (ret != NULL)
24964 return FLASH_CONTROL (ret);
24965 else
24966 return NULL;
24967}
24968
24969
24970/* ------------------------------------------------------------------------ */
24971
24972/**
24973 * FlashControlSkeleton:
24974 *
24975 * The #FlashControlSkeleton structure contains only private data and should only be accessed using the provided API.
24976 */
24977
24978/**
24979 * FlashControlSkeletonClass:
24980 * @parent_class: The parent class.
24981 *
24982 * Class structure for #FlashControlSkeleton.
24983 */
24984
24985struct _FlashControlSkeletonPrivate
24986{
24987 GValue *properties;
24988 GList *changed_properties;
24989 GSource *changed_properties_idle_source;
24990 GMainContext *context;
24991 GMutex lock;
24992};
24993
24994static void
24995_flash_control_skeleton_handle_method_call (
24996 GDBusConnection *connection G_GNUC_UNUSED,
24997 const gchar *sender G_GNUC_UNUSED,
24998 const gchar *object_path G_GNUC_UNUSED,
24999 const gchar *interface_name,
25000 const gchar *method_name,
25001 GVariant *parameters,
25002 GDBusMethodInvocation *invocation,
25003 gpointer user_data)
25004{
25005 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (user_data);
25006 _ExtendedGDBusMethodInfo *info;
25007 GVariantIter iter;
25008 GVariant *child;
25009 GValue *paramv;
25010 guint num_params;
25011 guint num_extra;
25012 guint n;
25013 guint signal_id;
25014 GValue return_value = G_VALUE_INIT;
25015 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
25016 g_assert (info != NULL);
25017 num_params = g_variant_n_children (parameters);
25018 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
25019 n = 0;
25020 g_value_init (&paramv[n], TYPE_FLASH_CONTROL);
25021 g_value_set_object (&paramv[n++], skeleton);
25022 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
25023 g_value_set_object (&paramv[n++], invocation);
25024 if (info->pass_fdlist)
25025 {
25026#ifdef G_OS_UNIX
25027 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
25028 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
25029#else
25030 g_assert_not_reached ();
25031#endif
25032 }
25033 g_variant_iter_init (&iter, parameters);
25034 while ((child = g_variant_iter_next_value (&iter)) != NULL)
25035 {
25036 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
25037 if (arg_info->use_gvariant)
25038 {
25039 g_value_init (&paramv[n], G_TYPE_VARIANT);
25040 g_value_set_variant (&paramv[n], child);
25041 n++;
25042 }
25043 else
25044 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
25045 g_variant_unref (child);
25046 }
25047 signal_id = g_signal_lookup (info->signal_name, TYPE_FLASH_CONTROL);
25048 g_value_init (&return_value, G_TYPE_BOOLEAN);
25049 g_signal_emitv (paramv, signal_id, 0, &return_value);
25050 if (!g_value_get_boolean (&return_value))
25051 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);
25052 g_value_unset (&return_value);
25053 for (n = 0; n < num_params + num_extra; n++)
25054 g_value_unset (&paramv[n]);
25055 g_free (paramv);
25056}
25057
25058static GVariant *
25059_flash_control_skeleton_handle_get_property (
25060 GDBusConnection *connection G_GNUC_UNUSED,
25061 const gchar *sender G_GNUC_UNUSED,
25062 const gchar *object_path G_GNUC_UNUSED,
25063 const gchar *interface_name G_GNUC_UNUSED,
25064 const gchar *property_name,
25065 GError **error,
25066 gpointer user_data)
25067{
25068 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (user_data);
25069 GValue value = G_VALUE_INIT;
25070 GParamSpec *pspec;
25071 _ExtendedGDBusPropertyInfo *info;
25072 GVariant *ret;
25073 ret = NULL;
25074 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct, property_name);
25075 g_assert (info != NULL);
25076 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
25077 if (pspec == NULL)
25078 {
25079 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
25080 }
25081 else
25082 {
25083 g_value_init (&value, pspec->value_type);
25084 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
25085 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
25086 g_value_unset (&value);
25087 }
25088 return ret;
25089}
25090
25091static gboolean
25092_flash_control_skeleton_handle_set_property (
25093 GDBusConnection *connection G_GNUC_UNUSED,
25094 const gchar *sender G_GNUC_UNUSED,
25095 const gchar *object_path G_GNUC_UNUSED,
25096 const gchar *interface_name G_GNUC_UNUSED,
25097 const gchar *property_name,
25098 GVariant *variant,
25099 GError **error,
25100 gpointer user_data)
25101{
25102 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (user_data);
25103 GValue value = G_VALUE_INIT;
25104 GParamSpec *pspec;
25105 _ExtendedGDBusPropertyInfo *info;
25106 gboolean ret;
25107 ret = FALSE;
25108 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct, property_name);
25109 g_assert (info != NULL);
25110 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
25111 if (pspec == NULL)
25112 {
25113 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
25114 }
25115 else
25116 {
25117 if (info->use_gvariant)
25118 g_value_set_variant (&value, variant);
25119 else
25120 g_dbus_gvariant_to_gvalue (variant, &value);
25121 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
25122 g_value_unset (&value);
25123 ret = TRUE;
25124 }
25125 return ret;
25126}
25127
25128static const GDBusInterfaceVTable _flash_control_skeleton_vtable =
25129{
25130 _flash_control_skeleton_handle_method_call,
25131 _flash_control_skeleton_handle_get_property,
25132 _flash_control_skeleton_handle_set_property,
25133 {NULL}
25134};
25135
25136static GDBusInterfaceInfo *
25137flash_control_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
25138{
25139 return flash_control_interface_info ();
25140}
25141
25142static GDBusInterfaceVTable *
25143flash_control_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
25144{
25145 return (GDBusInterfaceVTable *) &_flash_control_skeleton_vtable;
25146}
25147
25148static GVariant *
25149flash_control_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
25150{
25151 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (_skeleton);
25152
25153 GVariantBuilder builder;
25154 guint n;
25155 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
25156 if (_flash_control_interface_info.parent_struct.properties == NULL)
25157 goto out;
25158 for (n = 0; _flash_control_interface_info.parent_struct.properties[n] != NULL; n++)
25159 {
25160 GDBusPropertyInfo *info = _flash_control_interface_info.parent_struct.properties[n];
25161 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
25162 {
25163 GVariant *value;
25164 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);
25165 if (value != NULL)
25166 {
25167 g_variant_take_ref (value);
25168 g_variant_builder_add (&builder, "{sv}", info->name, value);
25169 g_variant_unref (value);
25170 }
25171 }
25172 }
25173out:
25174 return g_variant_builder_end (&builder);
25175}
25176
25177static gboolean _flash_control_emit_changed (gpointer user_data);
25178
25179static void
25180flash_control_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
25181{
25182 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (_skeleton);
25183 gboolean emit_changed = FALSE;
25184
25185 g_mutex_lock (&skeleton->priv->lock);
25186 if (skeleton->priv->changed_properties_idle_source != NULL)
25187 {
25188 g_source_destroy (skeleton->priv->changed_properties_idle_source);
25189 skeleton->priv->changed_properties_idle_source = NULL;
25190 emit_changed = TRUE;
25191 }
25192 g_mutex_unlock (&skeleton->priv->lock);
25193
25194 if (emit_changed)
25195 _flash_control_emit_changed (skeleton);
25196}
25197
25198static void
25199_flash_control_on_signal_done (
25200 FlashControl *object,
25201 const gchar *arg_filename)
25202{
25203 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
25204
25205 GList *connections, *l;
25206 GVariant *signal_variant;
25207 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
25208
25209 signal_variant = g_variant_ref_sink (g_variant_new ("(s)",
25210 arg_filename));
25211 for (l = connections; l != NULL; l = l->next)
25212 {
25213 GDBusConnection *connection = l->data;
25214 g_dbus_connection_emit_signal (connection,
25215 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.FlashControl", "Done",
25216 signal_variant, NULL);
25217 }
25218 g_variant_unref (signal_variant);
25219 g_list_free_full (connections, g_object_unref);
25220}
25221
25222static void
25223_flash_control_on_signal_error (
25224 FlashControl *object,
25225 const gchar *arg_filename)
25226{
25227 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
25228
25229 GList *connections, *l;
25230 GVariant *signal_variant;
25231 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
25232
25233 signal_variant = g_variant_ref_sink (g_variant_new ("(s)",
25234 arg_filename));
25235 for (l = connections; l != NULL; l = l->next)
25236 {
25237 GDBusConnection *connection = l->data;
25238 g_dbus_connection_emit_signal (connection,
25239 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.FlashControl", "Error",
25240 signal_variant, NULL);
25241 }
25242 g_variant_unref (signal_variant);
25243 g_list_free_full (connections, g_object_unref);
25244}
25245
25246static void
25247_flash_control_on_signal_progress (
25248 FlashControl *object,
25249 const gchar *arg_filename,
25250 guchar arg_progress)
25251{
25252 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
25253
25254 GList *connections, *l;
25255 GVariant *signal_variant;
25256 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
25257
25258 signal_variant = g_variant_ref_sink (g_variant_new ("(sy)",
25259 arg_filename,
25260 arg_progress));
25261 for (l = connections; l != NULL; l = l->next)
25262 {
25263 GDBusConnection *connection = l->data;
25264 g_dbus_connection_emit_signal (connection,
25265 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.FlashControl", "Progress",
25266 signal_variant, NULL);
25267 }
25268 g_variant_unref (signal_variant);
25269 g_list_free_full (connections, g_object_unref);
25270}
25271
25272static void flash_control_skeleton_iface_init (FlashControlIface *iface);
25273#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
25274G_DEFINE_TYPE_WITH_CODE (FlashControlSkeleton, flash_control_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
25275 G_ADD_PRIVATE (FlashControlSkeleton)
25276 G_IMPLEMENT_INTERFACE (TYPE_FLASH_CONTROL, flash_control_skeleton_iface_init));
25277
25278#else
25279G_DEFINE_TYPE_WITH_CODE (FlashControlSkeleton, flash_control_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
25280 G_IMPLEMENT_INTERFACE (TYPE_FLASH_CONTROL, flash_control_skeleton_iface_init));
25281
25282#endif
25283static void
25284flash_control_skeleton_finalize (GObject *object)
25285{
25286 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
25287 guint n;
25288 for (n = 0; n < 2; n++)
25289 g_value_unset (&skeleton->priv->properties[n]);
25290 g_free (skeleton->priv->properties);
25291 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
25292 if (skeleton->priv->changed_properties_idle_source != NULL)
25293 g_source_destroy (skeleton->priv->changed_properties_idle_source);
25294 g_main_context_unref (skeleton->priv->context);
25295 g_mutex_clear (&skeleton->priv->lock);
25296 G_OBJECT_CLASS (flash_control_skeleton_parent_class)->finalize (object);
25297}
25298
25299static void
25300flash_control_skeleton_get_property (GObject *object,
25301 guint prop_id,
25302 GValue *value,
25303 GParamSpec *pspec G_GNUC_UNUSED)
25304{
25305 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
25306 g_assert (prop_id != 0 && prop_id - 1 < 2);
25307 g_mutex_lock (&skeleton->priv->lock);
25308 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
25309 g_mutex_unlock (&skeleton->priv->lock);
25310}
25311
25312static gboolean
25313_flash_control_emit_changed (gpointer user_data)
25314{
25315 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (user_data);
25316 GList *l;
25317 GVariantBuilder builder;
25318 GVariantBuilder invalidated_builder;
25319 guint num_changes;
25320
25321 g_mutex_lock (&skeleton->priv->lock);
25322 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
25323 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
25324 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
25325 {
25326 ChangedProperty *cp = l->data;
25327 GVariant *variant;
25328 const GValue *cur_value;
25329
25330 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
25331 if (!_g_value_equal (cur_value, &cp->orig_value))
25332 {
25333 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
25334 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
25335 g_variant_unref (variant);
25336 num_changes++;
25337 }
25338 }
25339 if (num_changes > 0)
25340 {
25341 GList *connections, *ll;
25342 GVariant *signal_variant;
25343 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.FlashControl",
25344 &builder, &invalidated_builder));
25345 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
25346 for (ll = connections; ll != NULL; ll = ll->next)
25347 {
25348 GDBusConnection *connection = ll->data;
25349
25350 g_dbus_connection_emit_signal (connection,
25351 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
25352 "org.freedesktop.DBus.Properties",
25353 "PropertiesChanged",
25354 signal_variant,
25355 NULL);
25356 }
25357 g_variant_unref (signal_variant);
25358 g_list_free_full (connections, g_object_unref);
25359 }
25360 else
25361 {
25362 g_variant_builder_clear (&builder);
25363 g_variant_builder_clear (&invalidated_builder);
25364 }
25365 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
25366 skeleton->priv->changed_properties = NULL;
25367 skeleton->priv->changed_properties_idle_source = NULL;
25368 g_mutex_unlock (&skeleton->priv->lock);
25369 return FALSE;
25370}
25371
25372static void
25373_flash_control_schedule_emit_changed (FlashControlSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
25374{
25375 ChangedProperty *cp;
25376 GList *l;
25377 cp = NULL;
25378 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
25379 {
25380 ChangedProperty *i_cp = l->data;
25381 if (i_cp->info == info)
25382 {
25383 cp = i_cp;
25384 break;
25385 }
25386 }
25387 if (cp == NULL)
25388 {
25389 cp = g_new0 (ChangedProperty, 1);
25390 cp->prop_id = prop_id;
25391 cp->info = info;
25392 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
25393 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
25394 g_value_copy (orig_value, &cp->orig_value);
25395 }
25396}
25397
25398static void
25399flash_control_skeleton_notify (GObject *object,
25400 GParamSpec *pspec G_GNUC_UNUSED)
25401{
25402 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
25403 g_mutex_lock (&skeleton->priv->lock);
25404 if (skeleton->priv->changed_properties != NULL &&
25405 skeleton->priv->changed_properties_idle_source == NULL)
25406 {
25407 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
25408 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
25409 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _flash_control_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
25410 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
25411 g_source_unref (skeleton->priv->changed_properties_idle_source);
25412 }
25413 g_mutex_unlock (&skeleton->priv->lock);
25414}
25415
25416static void
25417flash_control_skeleton_set_property (GObject *object,
25418 guint prop_id,
25419 const GValue *value,
25420 GParamSpec *pspec)
25421{
25422 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
25423 g_assert (prop_id != 0 && prop_id - 1 < 2);
25424 g_mutex_lock (&skeleton->priv->lock);
25425 g_object_freeze_notify (object);
25426 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
25427 {
25428 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
25429 _flash_control_schedule_emit_changed (skeleton, _flash_control_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
25430 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
25431 g_object_notify_by_pspec (object, pspec);
25432 }
25433 g_mutex_unlock (&skeleton->priv->lock);
25434 g_object_thaw_notify (object);
25435}
25436
25437static void
25438flash_control_skeleton_init (FlashControlSkeleton *skeleton)
25439{
25440#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
25441 skeleton->priv = flash_control_skeleton_get_instance_private (skeleton);
25442#else
25443 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_FLASH_CONTROL_SKELETON, FlashControlSkeletonPrivate);
25444#endif
25445
25446 g_mutex_init (&skeleton->priv->lock);
25447 skeleton->priv->context = g_main_context_ref_thread_default ();
25448 skeleton->priv->properties = g_new0 (GValue, 2);
25449 g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING);
25450 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
25451}
25452
25453static const gchar *
25454flash_control_skeleton_get_filename (FlashControl *object)
25455{
25456 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
25457 const gchar *value;
25458 g_mutex_lock (&skeleton->priv->lock);
25459 value = g_value_get_string (&(skeleton->priv->properties[0]));
25460 g_mutex_unlock (&skeleton->priv->lock);
25461 return value;
25462}
25463
25464static const gchar *
25465flash_control_skeleton_get_type_ (FlashControl *object)
25466{
25467 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
25468 const gchar *value;
25469 g_mutex_lock (&skeleton->priv->lock);
25470 value = g_value_get_string (&(skeleton->priv->properties[1]));
25471 g_mutex_unlock (&skeleton->priv->lock);
25472 return value;
25473}
25474
25475static void
25476flash_control_skeleton_class_init (FlashControlSkeletonClass *klass)
25477{
25478 GObjectClass *gobject_class;
25479 GDBusInterfaceSkeletonClass *skeleton_class;
25480
25481 gobject_class = G_OBJECT_CLASS (klass);
25482 gobject_class->finalize = flash_control_skeleton_finalize;
25483 gobject_class->get_property = flash_control_skeleton_get_property;
25484 gobject_class->set_property = flash_control_skeleton_set_property;
25485 gobject_class->notify = flash_control_skeleton_notify;
25486
25487
25488 flash_control_override_properties (gobject_class, 1);
25489
25490 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
25491 skeleton_class->get_info = flash_control_skeleton_dbus_interface_get_info;
25492 skeleton_class->get_properties = flash_control_skeleton_dbus_interface_get_properties;
25493 skeleton_class->flush = flash_control_skeleton_dbus_interface_flush;
25494 skeleton_class->get_vtable = flash_control_skeleton_dbus_interface_get_vtable;
25495
25496#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
25497 g_type_class_add_private (klass, sizeof (FlashControlSkeletonPrivate));
25498#endif
25499}
25500
25501static void
25502flash_control_skeleton_iface_init (FlashControlIface *iface)
25503{
25504 iface->done = _flash_control_on_signal_done;
25505 iface->error = _flash_control_on_signal_error;
25506 iface->progress = _flash_control_on_signal_progress;
25507 iface->get_filename = flash_control_skeleton_get_filename;
25508 iface->get_type_ = flash_control_skeleton_get_type_;
25509}
25510
25511/**
25512 * flash_control_skeleton_new:
25513 *
25514 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link>.
25515 *
25516 * Returns: (transfer full) (type FlashControlSkeleton): The skeleton object.
25517 */
25518FlashControl *
25519flash_control_skeleton_new (void)
25520{
25521 return FLASH_CONTROL (g_object_new (TYPE_FLASH_CONTROL_SKELETON, NULL));
25522}
25523
25524/* ------------------------------------------------------------------------
Norman James362a80f2015-09-14 14:04:39 -050025525 * Code for interface org.openbmc.Button
25526 * ------------------------------------------------------------------------
25527 */
25528
25529/**
25530 * SECTION:Button
25531 * @title: Button
25532 * @short_description: Generated C code for the org.openbmc.Button D-Bus interface
25533 *
25534 * 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.
25535 */
25536
25537/* ---- Introspection data for org.openbmc.Button ---- */
25538
25539static const _ExtendedGDBusArgInfo _button_method_info_is_on_OUT_ARG_state =
25540{
25541 {
25542 -1,
25543 (gchar *) "state",
25544 (gchar *) "b",
25545 NULL
25546 },
25547 FALSE
25548};
25549
25550static const _ExtendedGDBusArgInfo * const _button_method_info_is_on_OUT_ARG_pointers[] =
25551{
25552 &_button_method_info_is_on_OUT_ARG_state,
25553 NULL
25554};
25555
25556static const _ExtendedGDBusMethodInfo _button_method_info_is_on =
25557{
25558 {
25559 -1,
25560 (gchar *) "isOn",
25561 NULL,
25562 (GDBusArgInfo **) &_button_method_info_is_on_OUT_ARG_pointers,
25563 NULL
25564 },
25565 "handle-is-on",
25566 FALSE
25567};
25568
Norman James493996c2015-10-31 17:27:13 -050025569static const _ExtendedGDBusMethodInfo _button_method_info_sim_press =
Norman James362a80f2015-09-14 14:04:39 -050025570{
25571 {
25572 -1,
Norman James493996c2015-10-31 17:27:13 -050025573 (gchar *) "simPress",
Norman James362a80f2015-09-14 14:04:39 -050025574 NULL,
25575 NULL,
25576 NULL
25577 },
Norman James493996c2015-10-31 17:27:13 -050025578 "handle-sim-press",
Norman James362a80f2015-09-14 14:04:39 -050025579 FALSE
25580};
25581
Norman James493996c2015-10-31 17:27:13 -050025582static const _ExtendedGDBusMethodInfo _button_method_info_sim_long_press =
Norman James362a80f2015-09-14 14:04:39 -050025583{
25584 {
25585 -1,
Norman James493996c2015-10-31 17:27:13 -050025586 (gchar *) "simLongPress",
Norman James362a80f2015-09-14 14:04:39 -050025587 NULL,
25588 NULL,
25589 NULL
25590 },
Norman James493996c2015-10-31 17:27:13 -050025591 "handle-sim-long-press",
Norman James362a80f2015-09-14 14:04:39 -050025592 FALSE
25593};
25594
25595static const _ExtendedGDBusMethodInfo * const _button_method_info_pointers[] =
25596{
25597 &_button_method_info_is_on,
Norman James493996c2015-10-31 17:27:13 -050025598 &_button_method_info_sim_press,
25599 &_button_method_info_sim_long_press,
Norman James362a80f2015-09-14 14:04:39 -050025600 NULL
25601};
25602
Norman James493996c2015-10-31 17:27:13 -050025603static const _ExtendedGDBusSignalInfo _button_signal_info_released =
Norman James362a80f2015-09-14 14:04:39 -050025604{
25605 {
25606 -1,
Norman James493996c2015-10-31 17:27:13 -050025607 (gchar *) "Released",
Norman James362a80f2015-09-14 14:04:39 -050025608 NULL,
25609 NULL
25610 },
Norman James493996c2015-10-31 17:27:13 -050025611 "released"
Norman James362a80f2015-09-14 14:04:39 -050025612};
25613
Norman James493996c2015-10-31 17:27:13 -050025614static const _ExtendedGDBusSignalInfo _button_signal_info_pressed =
Norman James362a80f2015-09-14 14:04:39 -050025615{
25616 {
25617 -1,
Norman James493996c2015-10-31 17:27:13 -050025618 (gchar *) "Pressed",
Norman James362a80f2015-09-14 14:04:39 -050025619 NULL,
25620 NULL
25621 },
Norman James493996c2015-10-31 17:27:13 -050025622 "pressed"
Norman James362a80f2015-09-14 14:04:39 -050025623};
25624
Norman James493996c2015-10-31 17:27:13 -050025625static const _ExtendedGDBusSignalInfo _button_signal_info_pressed_long =
Norman James362a80f2015-09-14 14:04:39 -050025626{
25627 {
25628 -1,
Norman James493996c2015-10-31 17:27:13 -050025629 (gchar *) "PressedLong",
Norman James362a80f2015-09-14 14:04:39 -050025630 NULL,
25631 NULL
25632 },
Norman James493996c2015-10-31 17:27:13 -050025633 "pressed-long"
Norman James362a80f2015-09-14 14:04:39 -050025634};
25635
25636static const _ExtendedGDBusSignalInfo * const _button_signal_info_pointers[] =
25637{
Norman James493996c2015-10-31 17:27:13 -050025638 &_button_signal_info_released,
25639 &_button_signal_info_pressed,
25640 &_button_signal_info_pressed_long,
Norman James362a80f2015-09-14 14:04:39 -050025641 NULL
25642};
25643
25644static const _ExtendedGDBusPropertyInfo _button_property_info_state =
25645{
25646 {
25647 -1,
25648 (gchar *) "state",
25649 (gchar *) "b",
25650 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
25651 NULL
25652 },
25653 "state",
25654 FALSE
25655};
25656
Norman James493996c2015-10-31 17:27:13 -050025657static const _ExtendedGDBusPropertyInfo _button_property_info_timer =
25658{
25659 {
25660 -1,
25661 (gchar *) "timer",
25662 (gchar *) "t",
25663 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
25664 NULL
25665 },
25666 "timer",
25667 FALSE
25668};
25669
Norman James362a80f2015-09-14 14:04:39 -050025670static const _ExtendedGDBusPropertyInfo * const _button_property_info_pointers[] =
25671{
25672 &_button_property_info_state,
Norman James493996c2015-10-31 17:27:13 -050025673 &_button_property_info_timer,
Norman James362a80f2015-09-14 14:04:39 -050025674 NULL
25675};
25676
25677static const _ExtendedGDBusInterfaceInfo _button_interface_info =
25678{
25679 {
25680 -1,
25681 (gchar *) "org.openbmc.Button",
25682 (GDBusMethodInfo **) &_button_method_info_pointers,
25683 (GDBusSignalInfo **) &_button_signal_info_pointers,
25684 (GDBusPropertyInfo **) &_button_property_info_pointers,
25685 NULL
25686 },
25687 "button",
25688};
25689
25690
25691/**
25692 * button_interface_info:
25693 *
25694 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link> D-Bus interface.
25695 *
25696 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
25697 */
25698GDBusInterfaceInfo *
25699button_interface_info (void)
25700{
25701 return (GDBusInterfaceInfo *) &_button_interface_info.parent_struct;
25702}
25703
25704/**
25705 * button_override_properties:
25706 * @klass: The class structure for a #GObject<!-- -->-derived class.
25707 * @property_id_begin: The property id to assign to the first overridden property.
25708 *
25709 * Overrides all #GObject properties in the #Button interface for a concrete class.
25710 * The properties are overridden in the order they are defined.
25711 *
25712 * Returns: The last property id.
25713 */
25714guint
25715button_override_properties (GObjectClass *klass, guint property_id_begin)
25716{
25717 g_object_class_override_property (klass, property_id_begin++, "state");
Norman James493996c2015-10-31 17:27:13 -050025718 g_object_class_override_property (klass, property_id_begin++, "timer");
Norman James362a80f2015-09-14 14:04:39 -050025719 return property_id_begin - 1;
25720}
25721
25722
25723
25724/**
25725 * Button:
25726 *
25727 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link>.
25728 */
25729
25730/**
25731 * ButtonIface:
25732 * @parent_iface: The parent interface.
25733 * @handle_is_on: Handler for the #Button::handle-is-on signal.
Norman James493996c2015-10-31 17:27:13 -050025734 * @handle_sim_long_press: Handler for the #Button::handle-sim-long-press signal.
25735 * @handle_sim_press: Handler for the #Button::handle-sim-press signal.
Norman James362a80f2015-09-14 14:04:39 -050025736 * @get_state: Getter for the #Button:state property.
Norman James493996c2015-10-31 17:27:13 -050025737 * @get_timer: Getter for the #Button:timer property.
25738 * @pressed: Handler for the #Button::pressed signal.
25739 * @pressed_long: Handler for the #Button::pressed-long signal.
25740 * @released: Handler for the #Button::released signal.
Norman James362a80f2015-09-14 14:04:39 -050025741 *
25742 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link>.
25743 */
25744
25745typedef ButtonIface ButtonInterface;
25746G_DEFINE_INTERFACE (Button, button, G_TYPE_OBJECT);
25747
25748static void
25749button_default_init (ButtonIface *iface)
25750{
25751 /* GObject signals for incoming D-Bus method calls: */
25752 /**
25753 * Button::handle-is-on:
25754 * @object: A #Button.
25755 * @invocation: A #GDBusMethodInvocation.
25756 *
25757 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Button.isOn">isOn()</link> D-Bus method.
25758 *
25759 * 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.
25760 *
25761 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
25762 */
25763 g_signal_new ("handle-is-on",
25764 G_TYPE_FROM_INTERFACE (iface),
25765 G_SIGNAL_RUN_LAST,
25766 G_STRUCT_OFFSET (ButtonIface, handle_is_on),
25767 g_signal_accumulator_true_handled,
25768 NULL,
25769 g_cclosure_marshal_generic,
25770 G_TYPE_BOOLEAN,
25771 1,
25772 G_TYPE_DBUS_METHOD_INVOCATION);
25773
25774 /**
Norman James493996c2015-10-31 17:27:13 -050025775 * Button::handle-sim-press:
Norman James362a80f2015-09-14 14:04:39 -050025776 * @object: A #Button.
25777 * @invocation: A #GDBusMethodInvocation.
25778 *
Norman James493996c2015-10-31 17:27:13 -050025779 * 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 -050025780 *
Norman James493996c2015-10-31 17:27:13 -050025781 * 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 -050025782 *
25783 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
25784 */
Norman James493996c2015-10-31 17:27:13 -050025785 g_signal_new ("handle-sim-press",
Norman James362a80f2015-09-14 14:04:39 -050025786 G_TYPE_FROM_INTERFACE (iface),
25787 G_SIGNAL_RUN_LAST,
Norman James493996c2015-10-31 17:27:13 -050025788 G_STRUCT_OFFSET (ButtonIface, handle_sim_press),
Norman James362a80f2015-09-14 14:04:39 -050025789 g_signal_accumulator_true_handled,
25790 NULL,
25791 g_cclosure_marshal_generic,
25792 G_TYPE_BOOLEAN,
25793 1,
25794 G_TYPE_DBUS_METHOD_INVOCATION);
25795
25796 /**
Norman James493996c2015-10-31 17:27:13 -050025797 * Button::handle-sim-long-press:
Norman James362a80f2015-09-14 14:04:39 -050025798 * @object: A #Button.
25799 * @invocation: A #GDBusMethodInvocation.
25800 *
Norman James493996c2015-10-31 17:27:13 -050025801 * 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 -050025802 *
Norman James493996c2015-10-31 17:27:13 -050025803 * 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 -050025804 *
25805 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
25806 */
Norman James493996c2015-10-31 17:27:13 -050025807 g_signal_new ("handle-sim-long-press",
Norman James362a80f2015-09-14 14:04:39 -050025808 G_TYPE_FROM_INTERFACE (iface),
25809 G_SIGNAL_RUN_LAST,
Norman James493996c2015-10-31 17:27:13 -050025810 G_STRUCT_OFFSET (ButtonIface, handle_sim_long_press),
Norman James362a80f2015-09-14 14:04:39 -050025811 g_signal_accumulator_true_handled,
25812 NULL,
25813 g_cclosure_marshal_generic,
25814 G_TYPE_BOOLEAN,
25815 1,
25816 G_TYPE_DBUS_METHOD_INVOCATION);
25817
25818 /* GObject signals for received D-Bus signals: */
25819 /**
Norman James493996c2015-10-31 17:27:13 -050025820 * Button::released:
Norman James362a80f2015-09-14 14:04:39 -050025821 * @object: A #Button.
25822 *
Norman James493996c2015-10-31 17:27:13 -050025823 * 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 -050025824 *
25825 * 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.
25826 */
Norman James493996c2015-10-31 17:27:13 -050025827 g_signal_new ("released",
Norman James362a80f2015-09-14 14:04:39 -050025828 G_TYPE_FROM_INTERFACE (iface),
25829 G_SIGNAL_RUN_LAST,
Norman James493996c2015-10-31 17:27:13 -050025830 G_STRUCT_OFFSET (ButtonIface, released),
Norman James362a80f2015-09-14 14:04:39 -050025831 NULL,
25832 NULL,
25833 g_cclosure_marshal_generic,
25834 G_TYPE_NONE,
25835 0);
25836
25837 /**
Norman James493996c2015-10-31 17:27:13 -050025838 * Button::pressed:
Norman James362a80f2015-09-14 14:04:39 -050025839 * @object: A #Button.
25840 *
Norman James493996c2015-10-31 17:27:13 -050025841 * 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 -050025842 *
25843 * 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.
25844 */
Norman James493996c2015-10-31 17:27:13 -050025845 g_signal_new ("pressed",
Norman James362a80f2015-09-14 14:04:39 -050025846 G_TYPE_FROM_INTERFACE (iface),
25847 G_SIGNAL_RUN_LAST,
Norman James493996c2015-10-31 17:27:13 -050025848 G_STRUCT_OFFSET (ButtonIface, pressed),
Norman James362a80f2015-09-14 14:04:39 -050025849 NULL,
25850 NULL,
25851 g_cclosure_marshal_generic,
25852 G_TYPE_NONE,
25853 0);
25854
25855 /**
Norman James493996c2015-10-31 17:27:13 -050025856 * Button::pressed-long:
Norman James362a80f2015-09-14 14:04:39 -050025857 * @object: A #Button.
25858 *
Norman James493996c2015-10-31 17:27:13 -050025859 * 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 -050025860 *
25861 * 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.
25862 */
Norman James493996c2015-10-31 17:27:13 -050025863 g_signal_new ("pressed-long",
Norman James362a80f2015-09-14 14:04:39 -050025864 G_TYPE_FROM_INTERFACE (iface),
25865 G_SIGNAL_RUN_LAST,
Norman James493996c2015-10-31 17:27:13 -050025866 G_STRUCT_OFFSET (ButtonIface, pressed_long),
Norman James362a80f2015-09-14 14:04:39 -050025867 NULL,
25868 NULL,
25869 g_cclosure_marshal_generic,
25870 G_TYPE_NONE,
25871 0);
25872
25873 /* GObject properties for D-Bus properties: */
25874 /**
25875 * Button:state:
25876 *
25877 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Button.state">"state"</link>.
25878 *
25879 * 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.
25880 */
25881 g_object_interface_install_property (iface,
25882 g_param_spec_boolean ("state", "state", "state", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Norman James493996c2015-10-31 17:27:13 -050025883 /**
25884 * Button:timer:
25885 *
25886 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Button.timer">"timer"</link>.
25887 *
25888 * 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.
25889 */
25890 g_object_interface_install_property (iface,
25891 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 -050025892}
25893
25894/**
25895 * button_get_state: (skip)
25896 * @object: A #Button.
25897 *
25898 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Button.state">"state"</link> D-Bus property.
25899 *
25900 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
25901 *
25902 * Returns: The property value.
25903 */
25904gboolean
25905button_get_state (Button *object)
25906{
25907 return BUTTON_GET_IFACE (object)->get_state (object);
25908}
25909
25910/**
25911 * button_set_state: (skip)
25912 * @object: A #Button.
25913 * @value: The value to set.
25914 *
25915 * Sets the <link linkend="gdbus-property-org-openbmc-Button.state">"state"</link> D-Bus property to @value.
25916 *
25917 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
25918 */
25919void
25920button_set_state (Button *object, gboolean value)
25921{
25922 g_object_set (G_OBJECT (object), "state", value, NULL);
25923}
25924
25925/**
Norman James493996c2015-10-31 17:27:13 -050025926 * button_get_timer: (skip)
Norman James362a80f2015-09-14 14:04:39 -050025927 * @object: A #Button.
25928 *
Norman James493996c2015-10-31 17:27:13 -050025929 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Button.timer">"timer"</link> D-Bus property.
25930 *
25931 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
25932 *
25933 * Returns: The property value.
Norman James362a80f2015-09-14 14:04:39 -050025934 */
Norman James493996c2015-10-31 17:27:13 -050025935guint64
25936button_get_timer (Button *object)
Norman James362a80f2015-09-14 14:04:39 -050025937{
Norman James493996c2015-10-31 17:27:13 -050025938 return BUTTON_GET_IFACE (object)->get_timer (object);
Norman James362a80f2015-09-14 14:04:39 -050025939}
25940
25941/**
Norman James493996c2015-10-31 17:27:13 -050025942 * button_set_timer: (skip)
Norman James362a80f2015-09-14 14:04:39 -050025943 * @object: A #Button.
Norman James493996c2015-10-31 17:27:13 -050025944 * @value: The value to set.
Norman James362a80f2015-09-14 14:04:39 -050025945 *
Norman James493996c2015-10-31 17:27:13 -050025946 * Sets the <link linkend="gdbus-property-org-openbmc-Button.timer">"timer"</link> D-Bus property to @value.
25947 *
25948 * 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 -050025949 */
25950void
Norman James493996c2015-10-31 17:27:13 -050025951button_set_timer (Button *object, guint64 value)
Norman James362a80f2015-09-14 14:04:39 -050025952{
Norman James493996c2015-10-31 17:27:13 -050025953 g_object_set (G_OBJECT (object), "timer", value, NULL);
Norman James362a80f2015-09-14 14:04:39 -050025954}
25955
25956/**
Norman James493996c2015-10-31 17:27:13 -050025957 * button_emit_released:
Norman James362a80f2015-09-14 14:04:39 -050025958 * @object: A #Button.
25959 *
Norman James493996c2015-10-31 17:27:13 -050025960 * Emits the <link linkend="gdbus-signal-org-openbmc-Button.Released">"Released"</link> D-Bus signal.
Norman James362a80f2015-09-14 14:04:39 -050025961 */
25962void
Norman James493996c2015-10-31 17:27:13 -050025963button_emit_released (
Norman James362a80f2015-09-14 14:04:39 -050025964 Button *object)
25965{
Norman James493996c2015-10-31 17:27:13 -050025966 g_signal_emit_by_name (object, "released");
25967}
25968
25969/**
25970 * button_emit_pressed:
25971 * @object: A #Button.
25972 *
25973 * Emits the <link linkend="gdbus-signal-org-openbmc-Button.Pressed">"Pressed"</link> D-Bus signal.
25974 */
25975void
25976button_emit_pressed (
25977 Button *object)
25978{
25979 g_signal_emit_by_name (object, "pressed");
25980}
25981
25982/**
25983 * button_emit_pressed_long:
25984 * @object: A #Button.
25985 *
25986 * Emits the <link linkend="gdbus-signal-org-openbmc-Button.PressedLong">"PressedLong"</link> D-Bus signal.
25987 */
25988void
25989button_emit_pressed_long (
25990 Button *object)
25991{
25992 g_signal_emit_by_name (object, "pressed-long");
Norman James362a80f2015-09-14 14:04:39 -050025993}
25994
25995/**
25996 * button_call_is_on:
25997 * @proxy: A #ButtonProxy.
25998 * @cancellable: (allow-none): A #GCancellable or %NULL.
25999 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
26000 * @user_data: User data to pass to @callback.
26001 *
26002 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.isOn">isOn()</link> D-Bus method on @proxy.
26003 * 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.
26004 * You can then call button_call_is_on_finish() to get the result of the operation.
26005 *
26006 * See button_call_is_on_sync() for the synchronous, blocking version of this method.
26007 */
26008void
26009button_call_is_on (
26010 Button *proxy,
26011 GCancellable *cancellable,
26012 GAsyncReadyCallback callback,
26013 gpointer user_data)
26014{
26015 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
26016 "isOn",
26017 g_variant_new ("()"),
26018 G_DBUS_CALL_FLAGS_NONE,
26019 -1,
26020 cancellable,
26021 callback,
26022 user_data);
26023}
26024
26025/**
26026 * button_call_is_on_finish:
26027 * @proxy: A #ButtonProxy.
26028 * @out_state: (out): Return location for return parameter or %NULL to ignore.
26029 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_call_is_on().
26030 * @error: Return location for error or %NULL.
26031 *
26032 * Finishes an operation started with button_call_is_on().
26033 *
26034 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
26035 */
26036gboolean
26037button_call_is_on_finish (
26038 Button *proxy,
26039 gboolean *out_state,
26040 GAsyncResult *res,
26041 GError **error)
26042{
26043 GVariant *_ret;
26044 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
26045 if (_ret == NULL)
26046 goto _out;
26047 g_variant_get (_ret,
26048 "(b)",
26049 out_state);
26050 g_variant_unref (_ret);
26051_out:
26052 return _ret != NULL;
26053}
26054
26055/**
26056 * button_call_is_on_sync:
26057 * @proxy: A #ButtonProxy.
26058 * @out_state: (out): Return location for return parameter or %NULL to ignore.
26059 * @cancellable: (allow-none): A #GCancellable or %NULL.
26060 * @error: Return location for error or %NULL.
26061 *
26062 * 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.
26063 *
26064 * See button_call_is_on() for the asynchronous version of this method.
26065 *
26066 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
26067 */
26068gboolean
26069button_call_is_on_sync (
26070 Button *proxy,
26071 gboolean *out_state,
26072 GCancellable *cancellable,
26073 GError **error)
26074{
26075 GVariant *_ret;
26076 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
26077 "isOn",
26078 g_variant_new ("()"),
26079 G_DBUS_CALL_FLAGS_NONE,
26080 -1,
26081 cancellable,
26082 error);
26083 if (_ret == NULL)
26084 goto _out;
26085 g_variant_get (_ret,
26086 "(b)",
26087 out_state);
26088 g_variant_unref (_ret);
26089_out:
26090 return _ret != NULL;
26091}
26092
26093/**
Norman James493996c2015-10-31 17:27:13 -050026094 * button_call_sim_press:
Norman James362a80f2015-09-14 14:04:39 -050026095 * @proxy: A #ButtonProxy.
26096 * @cancellable: (allow-none): A #GCancellable or %NULL.
26097 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
26098 * @user_data: User data to pass to @callback.
26099 *
Norman James493996c2015-10-31 17:27:13 -050026100 * 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 -050026101 * 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 -050026102 * You can then call button_call_sim_press_finish() to get the result of the operation.
Norman James362a80f2015-09-14 14:04:39 -050026103 *
Norman James493996c2015-10-31 17:27:13 -050026104 * See button_call_sim_press_sync() for the synchronous, blocking version of this method.
Norman James362a80f2015-09-14 14:04:39 -050026105 */
26106void
Norman James493996c2015-10-31 17:27:13 -050026107button_call_sim_press (
Norman James362a80f2015-09-14 14:04:39 -050026108 Button *proxy,
26109 GCancellable *cancellable,
26110 GAsyncReadyCallback callback,
26111 gpointer user_data)
26112{
26113 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
Norman James493996c2015-10-31 17:27:13 -050026114 "simPress",
Norman James362a80f2015-09-14 14:04:39 -050026115 g_variant_new ("()"),
26116 G_DBUS_CALL_FLAGS_NONE,
26117 -1,
26118 cancellable,
26119 callback,
26120 user_data);
26121}
26122
26123/**
Norman James493996c2015-10-31 17:27:13 -050026124 * button_call_sim_press_finish:
Norman James362a80f2015-09-14 14:04:39 -050026125 * @proxy: A #ButtonProxy.
Norman James493996c2015-10-31 17:27:13 -050026126 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_call_sim_press().
Norman James362a80f2015-09-14 14:04:39 -050026127 * @error: Return location for error or %NULL.
26128 *
Norman James493996c2015-10-31 17:27:13 -050026129 * Finishes an operation started with button_call_sim_press().
Norman James362a80f2015-09-14 14:04:39 -050026130 *
26131 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
26132 */
26133gboolean
Norman James493996c2015-10-31 17:27:13 -050026134button_call_sim_press_finish (
Norman James362a80f2015-09-14 14:04:39 -050026135 Button *proxy,
26136 GAsyncResult *res,
26137 GError **error)
26138{
26139 GVariant *_ret;
26140 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
26141 if (_ret == NULL)
26142 goto _out;
26143 g_variant_get (_ret,
26144 "()");
26145 g_variant_unref (_ret);
26146_out:
26147 return _ret != NULL;
26148}
26149
26150/**
Norman James493996c2015-10-31 17:27:13 -050026151 * button_call_sim_press_sync:
Norman James362a80f2015-09-14 14:04:39 -050026152 * @proxy: A #ButtonProxy.
26153 * @cancellable: (allow-none): A #GCancellable or %NULL.
26154 * @error: Return location for error or %NULL.
26155 *
Norman James493996c2015-10-31 17:27:13 -050026156 * 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 -050026157 *
Norman James493996c2015-10-31 17:27:13 -050026158 * See button_call_sim_press() for the asynchronous version of this method.
Norman James362a80f2015-09-14 14:04:39 -050026159 *
26160 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
26161 */
26162gboolean
Norman James493996c2015-10-31 17:27:13 -050026163button_call_sim_press_sync (
Norman James362a80f2015-09-14 14:04:39 -050026164 Button *proxy,
26165 GCancellable *cancellable,
26166 GError **error)
26167{
26168 GVariant *_ret;
26169 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
Norman James493996c2015-10-31 17:27:13 -050026170 "simPress",
Norman James362a80f2015-09-14 14:04:39 -050026171 g_variant_new ("()"),
26172 G_DBUS_CALL_FLAGS_NONE,
26173 -1,
26174 cancellable,
26175 error);
26176 if (_ret == NULL)
26177 goto _out;
26178 g_variant_get (_ret,
26179 "()");
26180 g_variant_unref (_ret);
26181_out:
26182 return _ret != NULL;
26183}
26184
26185/**
Norman James493996c2015-10-31 17:27:13 -050026186 * button_call_sim_long_press:
Norman James362a80f2015-09-14 14:04:39 -050026187 * @proxy: A #ButtonProxy.
26188 * @cancellable: (allow-none): A #GCancellable or %NULL.
26189 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
26190 * @user_data: User data to pass to @callback.
26191 *
Norman James493996c2015-10-31 17:27:13 -050026192 * 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 -050026193 * 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 -050026194 * You can then call button_call_sim_long_press_finish() to get the result of the operation.
Norman James362a80f2015-09-14 14:04:39 -050026195 *
Norman James493996c2015-10-31 17:27:13 -050026196 * See button_call_sim_long_press_sync() for the synchronous, blocking version of this method.
Norman James362a80f2015-09-14 14:04:39 -050026197 */
26198void
Norman James493996c2015-10-31 17:27:13 -050026199button_call_sim_long_press (
Norman James362a80f2015-09-14 14:04:39 -050026200 Button *proxy,
26201 GCancellable *cancellable,
26202 GAsyncReadyCallback callback,
26203 gpointer user_data)
26204{
26205 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
Norman James493996c2015-10-31 17:27:13 -050026206 "simLongPress",
Norman James362a80f2015-09-14 14:04:39 -050026207 g_variant_new ("()"),
26208 G_DBUS_CALL_FLAGS_NONE,
26209 -1,
26210 cancellable,
26211 callback,
26212 user_data);
26213}
26214
26215/**
Norman James493996c2015-10-31 17:27:13 -050026216 * button_call_sim_long_press_finish:
Norman James362a80f2015-09-14 14:04:39 -050026217 * @proxy: A #ButtonProxy.
Norman James493996c2015-10-31 17:27:13 -050026218 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_call_sim_long_press().
Norman James362a80f2015-09-14 14:04:39 -050026219 * @error: Return location for error or %NULL.
26220 *
Norman James493996c2015-10-31 17:27:13 -050026221 * Finishes an operation started with button_call_sim_long_press().
Norman James362a80f2015-09-14 14:04:39 -050026222 *
26223 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
26224 */
26225gboolean
Norman James493996c2015-10-31 17:27:13 -050026226button_call_sim_long_press_finish (
Norman James362a80f2015-09-14 14:04:39 -050026227 Button *proxy,
26228 GAsyncResult *res,
26229 GError **error)
26230{
26231 GVariant *_ret;
26232 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
26233 if (_ret == NULL)
26234 goto _out;
26235 g_variant_get (_ret,
26236 "()");
26237 g_variant_unref (_ret);
26238_out:
26239 return _ret != NULL;
26240}
26241
26242/**
Norman James493996c2015-10-31 17:27:13 -050026243 * button_call_sim_long_press_sync:
Norman James362a80f2015-09-14 14:04:39 -050026244 * @proxy: A #ButtonProxy.
26245 * @cancellable: (allow-none): A #GCancellable or %NULL.
26246 * @error: Return location for error or %NULL.
26247 *
Norman James493996c2015-10-31 17:27:13 -050026248 * 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 -050026249 *
Norman James493996c2015-10-31 17:27:13 -050026250 * See button_call_sim_long_press() for the asynchronous version of this method.
Norman James362a80f2015-09-14 14:04:39 -050026251 *
26252 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
26253 */
26254gboolean
Norman James493996c2015-10-31 17:27:13 -050026255button_call_sim_long_press_sync (
Norman James362a80f2015-09-14 14:04:39 -050026256 Button *proxy,
26257 GCancellable *cancellable,
26258 GError **error)
26259{
26260 GVariant *_ret;
26261 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
Norman James493996c2015-10-31 17:27:13 -050026262 "simLongPress",
Norman James362a80f2015-09-14 14:04:39 -050026263 g_variant_new ("()"),
26264 G_DBUS_CALL_FLAGS_NONE,
26265 -1,
26266 cancellable,
26267 error);
26268 if (_ret == NULL)
26269 goto _out;
26270 g_variant_get (_ret,
26271 "()");
26272 g_variant_unref (_ret);
26273_out:
26274 return _ret != NULL;
26275}
26276
26277/**
26278 * button_complete_is_on:
26279 * @object: A #Button.
26280 * @invocation: (transfer full): A #GDBusMethodInvocation.
26281 * @state: Parameter to return.
26282 *
26283 * 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.
26284 *
26285 * This method will free @invocation, you cannot use it afterwards.
26286 */
26287void
26288button_complete_is_on (
26289 Button *object,
26290 GDBusMethodInvocation *invocation,
26291 gboolean state)
26292{
26293 g_dbus_method_invocation_return_value (invocation,
26294 g_variant_new ("(b)",
26295 state));
26296}
26297
26298/**
Norman James493996c2015-10-31 17:27:13 -050026299 * button_complete_sim_press:
Norman James362a80f2015-09-14 14:04:39 -050026300 * @object: A #Button.
26301 * @invocation: (transfer full): A #GDBusMethodInvocation.
26302 *
Norman James493996c2015-10-31 17:27:13 -050026303 * 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 -050026304 *
26305 * This method will free @invocation, you cannot use it afterwards.
26306 */
26307void
Norman James493996c2015-10-31 17:27:13 -050026308button_complete_sim_press (
Norman James362a80f2015-09-14 14:04:39 -050026309 Button *object,
26310 GDBusMethodInvocation *invocation)
26311{
26312 g_dbus_method_invocation_return_value (invocation,
26313 g_variant_new ("()"));
26314}
26315
26316/**
Norman James493996c2015-10-31 17:27:13 -050026317 * button_complete_sim_long_press:
Norman James362a80f2015-09-14 14:04:39 -050026318 * @object: A #Button.
26319 * @invocation: (transfer full): A #GDBusMethodInvocation.
26320 *
Norman James493996c2015-10-31 17:27:13 -050026321 * 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 -050026322 *
26323 * This method will free @invocation, you cannot use it afterwards.
26324 */
26325void
Norman James493996c2015-10-31 17:27:13 -050026326button_complete_sim_long_press (
Norman James362a80f2015-09-14 14:04:39 -050026327 Button *object,
26328 GDBusMethodInvocation *invocation)
26329{
26330 g_dbus_method_invocation_return_value (invocation,
26331 g_variant_new ("()"));
26332}
26333
26334/* ------------------------------------------------------------------------ */
26335
26336/**
26337 * ButtonProxy:
26338 *
26339 * The #ButtonProxy structure contains only private data and should only be accessed using the provided API.
26340 */
26341
26342/**
26343 * ButtonProxyClass:
26344 * @parent_class: The parent class.
26345 *
26346 * Class structure for #ButtonProxy.
26347 */
26348
26349struct _ButtonProxyPrivate
26350{
26351 GData *qdata;
26352};
26353
26354static void button_proxy_iface_init (ButtonIface *iface);
26355
26356#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
26357G_DEFINE_TYPE_WITH_CODE (ButtonProxy, button_proxy, G_TYPE_DBUS_PROXY,
26358 G_ADD_PRIVATE (ButtonProxy)
26359 G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_proxy_iface_init));
26360
26361#else
26362G_DEFINE_TYPE_WITH_CODE (ButtonProxy, button_proxy, G_TYPE_DBUS_PROXY,
26363 G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_proxy_iface_init));
26364
26365#endif
26366static void
26367button_proxy_finalize (GObject *object)
26368{
26369 ButtonProxy *proxy = BUTTON_PROXY (object);
26370 g_datalist_clear (&proxy->priv->qdata);
26371 G_OBJECT_CLASS (button_proxy_parent_class)->finalize (object);
26372}
26373
26374static void
26375button_proxy_get_property (GObject *object,
26376 guint prop_id,
26377 GValue *value,
26378 GParamSpec *pspec G_GNUC_UNUSED)
26379{
26380 const _ExtendedGDBusPropertyInfo *info;
26381 GVariant *variant;
Norman James493996c2015-10-31 17:27:13 -050026382 g_assert (prop_id != 0 && prop_id - 1 < 2);
Norman James362a80f2015-09-14 14:04:39 -050026383 info = _button_property_info_pointers[prop_id - 1];
26384 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
26385 if (info->use_gvariant)
26386 {
26387 g_value_set_variant (value, variant);
26388 }
26389 else
26390 {
26391 if (variant != NULL)
26392 g_dbus_gvariant_to_gvalue (variant, value);
26393 }
26394 if (variant != NULL)
26395 g_variant_unref (variant);
26396}
26397
26398static void
26399button_proxy_set_property_cb (GDBusProxy *proxy,
26400 GAsyncResult *res,
26401 gpointer user_data)
26402{
26403 const _ExtendedGDBusPropertyInfo *info = user_data;
26404 GError *error;
26405 GVariant *_ret;
26406 error = NULL;
26407 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
26408 if (!_ret)
26409 {
26410 g_warning ("Error setting property '%s' on interface org.openbmc.Button: %s (%s, %d)",
26411 info->parent_struct.name,
26412 error->message, g_quark_to_string (error->domain), error->code);
26413 g_error_free (error);
26414 }
26415 else
26416 {
26417 g_variant_unref (_ret);
26418 }
26419}
26420
26421static void
26422button_proxy_set_property (GObject *object,
26423 guint prop_id,
26424 const GValue *value,
26425 GParamSpec *pspec G_GNUC_UNUSED)
26426{
26427 const _ExtendedGDBusPropertyInfo *info;
26428 GVariant *variant;
Norman James493996c2015-10-31 17:27:13 -050026429 g_assert (prop_id != 0 && prop_id - 1 < 2);
Norman James362a80f2015-09-14 14:04:39 -050026430 info = _button_property_info_pointers[prop_id - 1];
26431 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
26432 g_dbus_proxy_call (G_DBUS_PROXY (object),
26433 "org.freedesktop.DBus.Properties.Set",
26434 g_variant_new ("(ssv)", "org.openbmc.Button", info->parent_struct.name, variant),
26435 G_DBUS_CALL_FLAGS_NONE,
26436 -1,
26437 NULL, (GAsyncReadyCallback) button_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
26438 g_variant_unref (variant);
26439}
26440
26441static void
26442button_proxy_g_signal (GDBusProxy *proxy,
26443 const gchar *sender_name G_GNUC_UNUSED,
26444 const gchar *signal_name,
26445 GVariant *parameters)
26446{
26447 _ExtendedGDBusSignalInfo *info;
26448 GVariantIter iter;
26449 GVariant *child;
26450 GValue *paramv;
26451 guint num_params;
26452 guint n;
26453 guint signal_id;
26454 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, signal_name);
26455 if (info == NULL)
26456 return;
26457 num_params = g_variant_n_children (parameters);
26458 paramv = g_new0 (GValue, num_params + 1);
26459 g_value_init (&paramv[0], TYPE_BUTTON);
26460 g_value_set_object (&paramv[0], proxy);
26461 g_variant_iter_init (&iter, parameters);
26462 n = 1;
26463 while ((child = g_variant_iter_next_value (&iter)) != NULL)
26464 {
26465 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
26466 if (arg_info->use_gvariant)
26467 {
26468 g_value_init (&paramv[n], G_TYPE_VARIANT);
26469 g_value_set_variant (&paramv[n], child);
26470 n++;
26471 }
26472 else
26473 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
26474 g_variant_unref (child);
26475 }
26476 signal_id = g_signal_lookup (info->signal_name, TYPE_BUTTON);
26477 g_signal_emitv (paramv, signal_id, 0, NULL);
26478 for (n = 0; n < num_params + 1; n++)
26479 g_value_unset (&paramv[n]);
26480 g_free (paramv);
26481}
26482
26483static void
26484button_proxy_g_properties_changed (GDBusProxy *_proxy,
26485 GVariant *changed_properties,
26486 const gchar *const *invalidated_properties)
26487{
26488 ButtonProxy *proxy = BUTTON_PROXY (_proxy);
26489 guint n;
26490 const gchar *key;
26491 GVariantIter *iter;
26492 _ExtendedGDBusPropertyInfo *info;
26493 g_variant_get (changed_properties, "a{sv}", &iter);
26494 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
26495 {
26496 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, key);
26497 g_datalist_remove_data (&proxy->priv->qdata, key);
26498 if (info != NULL)
26499 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
26500 }
26501 g_variant_iter_free (iter);
26502 for (n = 0; invalidated_properties[n] != NULL; n++)
26503 {
26504 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, invalidated_properties[n]);
26505 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
26506 if (info != NULL)
26507 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
26508 }
26509}
26510
26511static gboolean
26512button_proxy_get_state (Button *object)
26513{
26514 ButtonProxy *proxy = BUTTON_PROXY (object);
26515 GVariant *variant;
26516 gboolean value = 0;
26517 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state");
26518 if (variant != NULL)
26519 {
26520 value = g_variant_get_boolean (variant);
26521 g_variant_unref (variant);
26522 }
26523 return value;
26524}
26525
Norman James493996c2015-10-31 17:27:13 -050026526static guint64
26527button_proxy_get_timer (Button *object)
26528{
26529 ButtonProxy *proxy = BUTTON_PROXY (object);
26530 GVariant *variant;
26531 guint64 value = 0;
26532 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "timer");
26533 if (variant != NULL)
26534 {
26535 value = g_variant_get_uint64 (variant);
26536 g_variant_unref (variant);
26537 }
26538 return value;
26539}
26540
Norman James362a80f2015-09-14 14:04:39 -050026541static void
26542button_proxy_init (ButtonProxy *proxy)
26543{
26544#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
26545 proxy->priv = button_proxy_get_instance_private (proxy);
26546#else
26547 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_BUTTON_PROXY, ButtonProxyPrivate);
26548#endif
26549
26550 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), button_interface_info ());
26551}
26552
26553static void
26554button_proxy_class_init (ButtonProxyClass *klass)
26555{
26556 GObjectClass *gobject_class;
26557 GDBusProxyClass *proxy_class;
26558
26559 gobject_class = G_OBJECT_CLASS (klass);
26560 gobject_class->finalize = button_proxy_finalize;
26561 gobject_class->get_property = button_proxy_get_property;
26562 gobject_class->set_property = button_proxy_set_property;
26563
26564 proxy_class = G_DBUS_PROXY_CLASS (klass);
26565 proxy_class->g_signal = button_proxy_g_signal;
26566 proxy_class->g_properties_changed = button_proxy_g_properties_changed;
26567
26568 button_override_properties (gobject_class, 1);
26569
26570#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
26571 g_type_class_add_private (klass, sizeof (ButtonProxyPrivate));
26572#endif
26573}
26574
26575static void
26576button_proxy_iface_init (ButtonIface *iface)
26577{
26578 iface->get_state = button_proxy_get_state;
Norman James493996c2015-10-31 17:27:13 -050026579 iface->get_timer = button_proxy_get_timer;
Norman James362a80f2015-09-14 14:04:39 -050026580}
26581
26582/**
26583 * button_proxy_new:
26584 * @connection: A #GDBusConnection.
26585 * @flags: Flags from the #GDBusProxyFlags enumeration.
26586 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
26587 * @object_path: An object path.
26588 * @cancellable: (allow-none): A #GCancellable or %NULL.
26589 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
26590 * @user_data: User data to pass to @callback.
26591 *
26592 * 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.
26593 *
26594 * 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.
26595 * You can then call button_proxy_new_finish() to get the result of the operation.
26596 *
26597 * See button_proxy_new_sync() for the synchronous, blocking version of this constructor.
26598 */
26599void
26600button_proxy_new (
26601 GDBusConnection *connection,
26602 GDBusProxyFlags flags,
26603 const gchar *name,
26604 const gchar *object_path,
26605 GCancellable *cancellable,
26606 GAsyncReadyCallback callback,
26607 gpointer user_data)
26608{
26609 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);
26610}
26611
26612/**
26613 * button_proxy_new_finish:
26614 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_proxy_new().
26615 * @error: Return location for error or %NULL
26616 *
26617 * Finishes an operation started with button_proxy_new().
26618 *
26619 * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set.
26620 */
26621Button *
26622button_proxy_new_finish (
26623 GAsyncResult *res,
26624 GError **error)
26625{
26626 GObject *ret;
26627 GObject *source_object;
26628 source_object = g_async_result_get_source_object (res);
26629 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
26630 g_object_unref (source_object);
26631 if (ret != NULL)
26632 return BUTTON (ret);
26633 else
26634 return NULL;
26635}
26636
26637/**
26638 * button_proxy_new_sync:
26639 * @connection: A #GDBusConnection.
26640 * @flags: Flags from the #GDBusProxyFlags enumeration.
26641 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
26642 * @object_path: An object path.
26643 * @cancellable: (allow-none): A #GCancellable or %NULL.
26644 * @error: Return location for error or %NULL
26645 *
26646 * 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.
26647 *
26648 * The calling thread is blocked until a reply is received.
26649 *
26650 * See button_proxy_new() for the asynchronous version of this constructor.
26651 *
26652 * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set.
26653 */
26654Button *
26655button_proxy_new_sync (
26656 GDBusConnection *connection,
26657 GDBusProxyFlags flags,
26658 const gchar *name,
26659 const gchar *object_path,
26660 GCancellable *cancellable,
26661 GError **error)
26662{
26663 GInitable *ret;
26664 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);
26665 if (ret != NULL)
26666 return BUTTON (ret);
26667 else
26668 return NULL;
26669}
26670
26671
26672/**
26673 * button_proxy_new_for_bus:
26674 * @bus_type: A #GBusType.
26675 * @flags: Flags from the #GDBusProxyFlags enumeration.
26676 * @name: A bus name (well-known or unique).
26677 * @object_path: An object path.
26678 * @cancellable: (allow-none): A #GCancellable or %NULL.
26679 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
26680 * @user_data: User data to pass to @callback.
26681 *
26682 * Like button_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
26683 *
26684 * 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.
26685 * You can then call button_proxy_new_for_bus_finish() to get the result of the operation.
26686 *
26687 * See button_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
26688 */
26689void
26690button_proxy_new_for_bus (
26691 GBusType bus_type,
26692 GDBusProxyFlags flags,
26693 const gchar *name,
26694 const gchar *object_path,
26695 GCancellable *cancellable,
26696 GAsyncReadyCallback callback,
26697 gpointer user_data)
26698{
26699 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);
26700}
26701
26702/**
26703 * button_proxy_new_for_bus_finish:
26704 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_proxy_new_for_bus().
26705 * @error: Return location for error or %NULL
26706 *
26707 * Finishes an operation started with button_proxy_new_for_bus().
26708 *
26709 * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set.
26710 */
26711Button *
26712button_proxy_new_for_bus_finish (
26713 GAsyncResult *res,
26714 GError **error)
26715{
26716 GObject *ret;
26717 GObject *source_object;
26718 source_object = g_async_result_get_source_object (res);
26719 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
26720 g_object_unref (source_object);
26721 if (ret != NULL)
26722 return BUTTON (ret);
26723 else
26724 return NULL;
26725}
26726
26727/**
26728 * button_proxy_new_for_bus_sync:
26729 * @bus_type: A #GBusType.
26730 * @flags: Flags from the #GDBusProxyFlags enumeration.
26731 * @name: A bus name (well-known or unique).
26732 * @object_path: An object path.
26733 * @cancellable: (allow-none): A #GCancellable or %NULL.
26734 * @error: Return location for error or %NULL
26735 *
26736 * Like button_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
26737 *
26738 * The calling thread is blocked until a reply is received.
26739 *
26740 * See button_proxy_new_for_bus() for the asynchronous version of this constructor.
26741 *
26742 * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set.
26743 */
26744Button *
26745button_proxy_new_for_bus_sync (
26746 GBusType bus_type,
26747 GDBusProxyFlags flags,
26748 const gchar *name,
26749 const gchar *object_path,
26750 GCancellable *cancellable,
26751 GError **error)
26752{
26753 GInitable *ret;
26754 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);
26755 if (ret != NULL)
26756 return BUTTON (ret);
26757 else
26758 return NULL;
26759}
26760
26761
26762/* ------------------------------------------------------------------------ */
26763
26764/**
26765 * ButtonSkeleton:
26766 *
26767 * The #ButtonSkeleton structure contains only private data and should only be accessed using the provided API.
26768 */
26769
26770/**
26771 * ButtonSkeletonClass:
26772 * @parent_class: The parent class.
26773 *
26774 * Class structure for #ButtonSkeleton.
26775 */
26776
26777struct _ButtonSkeletonPrivate
26778{
26779 GValue *properties;
26780 GList *changed_properties;
26781 GSource *changed_properties_idle_source;
26782 GMainContext *context;
26783 GMutex lock;
26784};
26785
26786static void
26787_button_skeleton_handle_method_call (
26788 GDBusConnection *connection G_GNUC_UNUSED,
26789 const gchar *sender G_GNUC_UNUSED,
26790 const gchar *object_path G_GNUC_UNUSED,
26791 const gchar *interface_name,
26792 const gchar *method_name,
26793 GVariant *parameters,
26794 GDBusMethodInvocation *invocation,
26795 gpointer user_data)
26796{
26797 ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data);
26798 _ExtendedGDBusMethodInfo *info;
26799 GVariantIter iter;
26800 GVariant *child;
26801 GValue *paramv;
26802 guint num_params;
26803 guint num_extra;
26804 guint n;
26805 guint signal_id;
26806 GValue return_value = G_VALUE_INIT;
26807 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
26808 g_assert (info != NULL);
26809 num_params = g_variant_n_children (parameters);
26810 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
26811 n = 0;
26812 g_value_init (&paramv[n], TYPE_BUTTON);
26813 g_value_set_object (&paramv[n++], skeleton);
26814 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
26815 g_value_set_object (&paramv[n++], invocation);
26816 if (info->pass_fdlist)
26817 {
26818#ifdef G_OS_UNIX
26819 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
26820 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
26821#else
26822 g_assert_not_reached ();
26823#endif
26824 }
26825 g_variant_iter_init (&iter, parameters);
26826 while ((child = g_variant_iter_next_value (&iter)) != NULL)
26827 {
26828 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
26829 if (arg_info->use_gvariant)
26830 {
26831 g_value_init (&paramv[n], G_TYPE_VARIANT);
26832 g_value_set_variant (&paramv[n], child);
26833 n++;
26834 }
26835 else
26836 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
26837 g_variant_unref (child);
26838 }
26839 signal_id = g_signal_lookup (info->signal_name, TYPE_BUTTON);
26840 g_value_init (&return_value, G_TYPE_BOOLEAN);
26841 g_signal_emitv (paramv, signal_id, 0, &return_value);
26842 if (!g_value_get_boolean (&return_value))
26843 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);
26844 g_value_unset (&return_value);
26845 for (n = 0; n < num_params + num_extra; n++)
26846 g_value_unset (&paramv[n]);
26847 g_free (paramv);
26848}
26849
26850static GVariant *
26851_button_skeleton_handle_get_property (
26852 GDBusConnection *connection G_GNUC_UNUSED,
26853 const gchar *sender G_GNUC_UNUSED,
26854 const gchar *object_path G_GNUC_UNUSED,
26855 const gchar *interface_name G_GNUC_UNUSED,
26856 const gchar *property_name,
26857 GError **error,
26858 gpointer user_data)
26859{
26860 ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data);
26861 GValue value = G_VALUE_INIT;
26862 GParamSpec *pspec;
26863 _ExtendedGDBusPropertyInfo *info;
26864 GVariant *ret;
26865 ret = NULL;
26866 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, property_name);
26867 g_assert (info != NULL);
26868 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
26869 if (pspec == NULL)
26870 {
26871 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
26872 }
26873 else
26874 {
26875 g_value_init (&value, pspec->value_type);
26876 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
26877 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
26878 g_value_unset (&value);
26879 }
26880 return ret;
26881}
26882
26883static gboolean
26884_button_skeleton_handle_set_property (
26885 GDBusConnection *connection G_GNUC_UNUSED,
26886 const gchar *sender G_GNUC_UNUSED,
26887 const gchar *object_path G_GNUC_UNUSED,
26888 const gchar *interface_name G_GNUC_UNUSED,
26889 const gchar *property_name,
26890 GVariant *variant,
26891 GError **error,
26892 gpointer user_data)
26893{
26894 ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data);
26895 GValue value = G_VALUE_INIT;
26896 GParamSpec *pspec;
26897 _ExtendedGDBusPropertyInfo *info;
26898 gboolean ret;
26899 ret = FALSE;
26900 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, property_name);
26901 g_assert (info != NULL);
26902 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
26903 if (pspec == NULL)
26904 {
26905 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
26906 }
26907 else
26908 {
26909 if (info->use_gvariant)
26910 g_value_set_variant (&value, variant);
26911 else
26912 g_dbus_gvariant_to_gvalue (variant, &value);
26913 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
26914 g_value_unset (&value);
26915 ret = TRUE;
26916 }
26917 return ret;
26918}
26919
26920static const GDBusInterfaceVTable _button_skeleton_vtable =
26921{
26922 _button_skeleton_handle_method_call,
26923 _button_skeleton_handle_get_property,
26924 _button_skeleton_handle_set_property,
26925 {NULL}
26926};
26927
26928static GDBusInterfaceInfo *
26929button_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
26930{
26931 return button_interface_info ();
26932}
26933
26934static GDBusInterfaceVTable *
26935button_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
26936{
26937 return (GDBusInterfaceVTable *) &_button_skeleton_vtable;
26938}
26939
26940static GVariant *
26941button_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
26942{
26943 ButtonSkeleton *skeleton = BUTTON_SKELETON (_skeleton);
26944
26945 GVariantBuilder builder;
26946 guint n;
26947 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
26948 if (_button_interface_info.parent_struct.properties == NULL)
26949 goto out;
26950 for (n = 0; _button_interface_info.parent_struct.properties[n] != NULL; n++)
26951 {
26952 GDBusPropertyInfo *info = _button_interface_info.parent_struct.properties[n];
26953 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
26954 {
26955 GVariant *value;
26956 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);
26957 if (value != NULL)
26958 {
26959 g_variant_take_ref (value);
26960 g_variant_builder_add (&builder, "{sv}", info->name, value);
26961 g_variant_unref (value);
26962 }
26963 }
26964 }
26965out:
26966 return g_variant_builder_end (&builder);
26967}
26968
26969static gboolean _button_emit_changed (gpointer user_data);
26970
26971static void
26972button_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
26973{
26974 ButtonSkeleton *skeleton = BUTTON_SKELETON (_skeleton);
26975 gboolean emit_changed = FALSE;
26976
26977 g_mutex_lock (&skeleton->priv->lock);
26978 if (skeleton->priv->changed_properties_idle_source != NULL)
26979 {
26980 g_source_destroy (skeleton->priv->changed_properties_idle_source);
26981 skeleton->priv->changed_properties_idle_source = NULL;
26982 emit_changed = TRUE;
26983 }
26984 g_mutex_unlock (&skeleton->priv->lock);
26985
26986 if (emit_changed)
26987 _button_emit_changed (skeleton);
26988}
26989
26990static void
Norman James493996c2015-10-31 17:27:13 -050026991_button_on_signal_released (
Norman James362a80f2015-09-14 14:04:39 -050026992 Button *object)
26993{
26994 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
26995
26996 GList *connections, *l;
26997 GVariant *signal_variant;
26998 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
26999
27000 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
27001 for (l = connections; l != NULL; l = l->next)
27002 {
27003 GDBusConnection *connection = l->data;
27004 g_dbus_connection_emit_signal (connection,
Norman James493996c2015-10-31 17:27:13 -050027005 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Button", "Released",
Norman James362a80f2015-09-14 14:04:39 -050027006 signal_variant, NULL);
27007 }
27008 g_variant_unref (signal_variant);
27009 g_list_free_full (connections, g_object_unref);
27010}
27011
27012static void
Norman James493996c2015-10-31 17:27:13 -050027013_button_on_signal_pressed (
Norman James362a80f2015-09-14 14:04:39 -050027014 Button *object)
27015{
27016 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
27017
27018 GList *connections, *l;
27019 GVariant *signal_variant;
27020 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
27021
27022 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
27023 for (l = connections; l != NULL; l = l->next)
27024 {
27025 GDBusConnection *connection = l->data;
27026 g_dbus_connection_emit_signal (connection,
Norman James493996c2015-10-31 17:27:13 -050027027 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Button", "Pressed",
Norman James362a80f2015-09-14 14:04:39 -050027028 signal_variant, NULL);
27029 }
27030 g_variant_unref (signal_variant);
27031 g_list_free_full (connections, g_object_unref);
27032}
27033
27034static void
Norman James493996c2015-10-31 17:27:13 -050027035_button_on_signal_pressed_long (
Norman James362a80f2015-09-14 14:04:39 -050027036 Button *object)
27037{
27038 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
27039
27040 GList *connections, *l;
27041 GVariant *signal_variant;
27042 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
27043
27044 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
27045 for (l = connections; l != NULL; l = l->next)
27046 {
27047 GDBusConnection *connection = l->data;
27048 g_dbus_connection_emit_signal (connection,
Norman James493996c2015-10-31 17:27:13 -050027049 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Button", "PressedLong",
Norman James362a80f2015-09-14 14:04:39 -050027050 signal_variant, NULL);
27051 }
27052 g_variant_unref (signal_variant);
27053 g_list_free_full (connections, g_object_unref);
27054}
27055
27056static void button_skeleton_iface_init (ButtonIface *iface);
27057#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
27058G_DEFINE_TYPE_WITH_CODE (ButtonSkeleton, button_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
27059 G_ADD_PRIVATE (ButtonSkeleton)
27060 G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_skeleton_iface_init));
27061
27062#else
27063G_DEFINE_TYPE_WITH_CODE (ButtonSkeleton, button_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
27064 G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_skeleton_iface_init));
27065
27066#endif
27067static void
27068button_skeleton_finalize (GObject *object)
27069{
27070 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
27071 guint n;
Norman James493996c2015-10-31 17:27:13 -050027072 for (n = 0; n < 2; n++)
Norman James362a80f2015-09-14 14:04:39 -050027073 g_value_unset (&skeleton->priv->properties[n]);
27074 g_free (skeleton->priv->properties);
27075 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
27076 if (skeleton->priv->changed_properties_idle_source != NULL)
27077 g_source_destroy (skeleton->priv->changed_properties_idle_source);
27078 g_main_context_unref (skeleton->priv->context);
27079 g_mutex_clear (&skeleton->priv->lock);
27080 G_OBJECT_CLASS (button_skeleton_parent_class)->finalize (object);
27081}
27082
27083static void
27084button_skeleton_get_property (GObject *object,
27085 guint prop_id,
27086 GValue *value,
27087 GParamSpec *pspec G_GNUC_UNUSED)
27088{
27089 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
Norman James493996c2015-10-31 17:27:13 -050027090 g_assert (prop_id != 0 && prop_id - 1 < 2);
Norman James362a80f2015-09-14 14:04:39 -050027091 g_mutex_lock (&skeleton->priv->lock);
27092 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
27093 g_mutex_unlock (&skeleton->priv->lock);
27094}
27095
27096static gboolean
27097_button_emit_changed (gpointer user_data)
27098{
27099 ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data);
27100 GList *l;
27101 GVariantBuilder builder;
27102 GVariantBuilder invalidated_builder;
27103 guint num_changes;
27104
27105 g_mutex_lock (&skeleton->priv->lock);
27106 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
27107 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
27108 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
27109 {
27110 ChangedProperty *cp = l->data;
27111 GVariant *variant;
27112 const GValue *cur_value;
27113
27114 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
27115 if (!_g_value_equal (cur_value, &cp->orig_value))
27116 {
27117 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
27118 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
27119 g_variant_unref (variant);
27120 num_changes++;
27121 }
27122 }
27123 if (num_changes > 0)
27124 {
27125 GList *connections, *ll;
27126 GVariant *signal_variant;
27127 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Button",
27128 &builder, &invalidated_builder));
27129 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
27130 for (ll = connections; ll != NULL; ll = ll->next)
27131 {
27132 GDBusConnection *connection = ll->data;
27133
27134 g_dbus_connection_emit_signal (connection,
27135 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
27136 "org.freedesktop.DBus.Properties",
27137 "PropertiesChanged",
27138 signal_variant,
27139 NULL);
27140 }
27141 g_variant_unref (signal_variant);
27142 g_list_free_full (connections, g_object_unref);
27143 }
27144 else
27145 {
27146 g_variant_builder_clear (&builder);
27147 g_variant_builder_clear (&invalidated_builder);
27148 }
27149 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
27150 skeleton->priv->changed_properties = NULL;
27151 skeleton->priv->changed_properties_idle_source = NULL;
27152 g_mutex_unlock (&skeleton->priv->lock);
27153 return FALSE;
27154}
27155
27156static void
27157_button_schedule_emit_changed (ButtonSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
27158{
27159 ChangedProperty *cp;
27160 GList *l;
27161 cp = NULL;
27162 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
27163 {
27164 ChangedProperty *i_cp = l->data;
27165 if (i_cp->info == info)
27166 {
27167 cp = i_cp;
27168 break;
27169 }
27170 }
27171 if (cp == NULL)
27172 {
27173 cp = g_new0 (ChangedProperty, 1);
27174 cp->prop_id = prop_id;
27175 cp->info = info;
27176 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
27177 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
27178 g_value_copy (orig_value, &cp->orig_value);
27179 }
27180}
27181
27182static void
27183button_skeleton_notify (GObject *object,
27184 GParamSpec *pspec G_GNUC_UNUSED)
27185{
27186 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
27187 g_mutex_lock (&skeleton->priv->lock);
27188 if (skeleton->priv->changed_properties != NULL &&
27189 skeleton->priv->changed_properties_idle_source == NULL)
27190 {
27191 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
27192 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
27193 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _button_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
27194 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
27195 g_source_unref (skeleton->priv->changed_properties_idle_source);
27196 }
27197 g_mutex_unlock (&skeleton->priv->lock);
27198}
27199
27200static void
27201button_skeleton_set_property (GObject *object,
27202 guint prop_id,
27203 const GValue *value,
27204 GParamSpec *pspec)
27205{
27206 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
Norman James493996c2015-10-31 17:27:13 -050027207 g_assert (prop_id != 0 && prop_id - 1 < 2);
Norman James362a80f2015-09-14 14:04:39 -050027208 g_mutex_lock (&skeleton->priv->lock);
27209 g_object_freeze_notify (object);
27210 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
27211 {
27212 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
27213 _button_schedule_emit_changed (skeleton, _button_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
27214 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
27215 g_object_notify_by_pspec (object, pspec);
27216 }
27217 g_mutex_unlock (&skeleton->priv->lock);
27218 g_object_thaw_notify (object);
27219}
27220
27221static void
27222button_skeleton_init (ButtonSkeleton *skeleton)
27223{
27224#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
27225 skeleton->priv = button_skeleton_get_instance_private (skeleton);
27226#else
27227 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_BUTTON_SKELETON, ButtonSkeletonPrivate);
27228#endif
27229
27230 g_mutex_init (&skeleton->priv->lock);
27231 skeleton->priv->context = g_main_context_ref_thread_default ();
Norman James493996c2015-10-31 17:27:13 -050027232 skeleton->priv->properties = g_new0 (GValue, 2);
Norman James362a80f2015-09-14 14:04:39 -050027233 g_value_init (&skeleton->priv->properties[0], G_TYPE_BOOLEAN);
Norman James493996c2015-10-31 17:27:13 -050027234 g_value_init (&skeleton->priv->properties[1], G_TYPE_UINT64);
Norman James362a80f2015-09-14 14:04:39 -050027235}
27236
27237static gboolean
27238button_skeleton_get_state (Button *object)
27239{
27240 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
27241 gboolean value;
27242 g_mutex_lock (&skeleton->priv->lock);
27243 value = g_value_get_boolean (&(skeleton->priv->properties[0]));
27244 g_mutex_unlock (&skeleton->priv->lock);
27245 return value;
27246}
27247
Norman James493996c2015-10-31 17:27:13 -050027248static guint64
27249button_skeleton_get_timer (Button *object)
27250{
27251 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
27252 guint64 value;
27253 g_mutex_lock (&skeleton->priv->lock);
27254 value = g_value_get_uint64 (&(skeleton->priv->properties[1]));
27255 g_mutex_unlock (&skeleton->priv->lock);
27256 return value;
27257}
27258
Norman James362a80f2015-09-14 14:04:39 -050027259static void
27260button_skeleton_class_init (ButtonSkeletonClass *klass)
27261{
27262 GObjectClass *gobject_class;
27263 GDBusInterfaceSkeletonClass *skeleton_class;
27264
27265 gobject_class = G_OBJECT_CLASS (klass);
27266 gobject_class->finalize = button_skeleton_finalize;
27267 gobject_class->get_property = button_skeleton_get_property;
27268 gobject_class->set_property = button_skeleton_set_property;
27269 gobject_class->notify = button_skeleton_notify;
27270
27271
27272 button_override_properties (gobject_class, 1);
27273
27274 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
27275 skeleton_class->get_info = button_skeleton_dbus_interface_get_info;
27276 skeleton_class->get_properties = button_skeleton_dbus_interface_get_properties;
27277 skeleton_class->flush = button_skeleton_dbus_interface_flush;
27278 skeleton_class->get_vtable = button_skeleton_dbus_interface_get_vtable;
27279
27280#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
27281 g_type_class_add_private (klass, sizeof (ButtonSkeletonPrivate));
27282#endif
27283}
27284
27285static void
27286button_skeleton_iface_init (ButtonIface *iface)
27287{
Norman James493996c2015-10-31 17:27:13 -050027288 iface->released = _button_on_signal_released;
27289 iface->pressed = _button_on_signal_pressed;
27290 iface->pressed_long = _button_on_signal_pressed_long;
Norman James362a80f2015-09-14 14:04:39 -050027291 iface->get_state = button_skeleton_get_state;
Norman James493996c2015-10-31 17:27:13 -050027292 iface->get_timer = button_skeleton_get_timer;
Norman James362a80f2015-09-14 14:04:39 -050027293}
27294
27295/**
27296 * button_skeleton_new:
27297 *
27298 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link>.
27299 *
27300 * Returns: (transfer full) (type ButtonSkeleton): The skeleton object.
27301 */
27302Button *
27303button_skeleton_new (void)
27304{
27305 return BUTTON (g_object_new (TYPE_BUTTON_SKELETON, NULL));
27306}
27307
27308/* ------------------------------------------------------------------------
27309 * Code for interface org.openbmc.Led
27310 * ------------------------------------------------------------------------
27311 */
27312
27313/**
27314 * SECTION:Led
27315 * @title: Led
27316 * @short_description: Generated C code for the org.openbmc.Led D-Bus interface
27317 *
27318 * 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.
27319 */
27320
27321/* ---- Introspection data for org.openbmc.Led ---- */
27322
27323static const _ExtendedGDBusMethodInfo _led_method_info_set_on =
27324{
27325 {
27326 -1,
27327 (gchar *) "setOn",
27328 NULL,
27329 NULL,
27330 NULL
27331 },
27332 "handle-set-on",
27333 FALSE
27334};
27335
27336static const _ExtendedGDBusMethodInfo _led_method_info_set_off =
27337{
27338 {
27339 -1,
27340 (gchar *) "setOff",
27341 NULL,
27342 NULL,
27343 NULL
27344 },
27345 "handle-set-off",
27346 FALSE
27347};
27348
27349static const _ExtendedGDBusMethodInfo _led_method_info_set_blink_slow =
27350{
27351 {
27352 -1,
27353 (gchar *) "setBlinkSlow",
27354 NULL,
27355 NULL,
27356 NULL
27357 },
27358 "handle-set-blink-slow",
27359 FALSE
27360};
27361
27362static const _ExtendedGDBusMethodInfo _led_method_info_set_blink_fast =
27363{
27364 {
27365 -1,
27366 (gchar *) "setBlinkFast",
27367 NULL,
27368 NULL,
27369 NULL
27370 },
27371 "handle-set-blink-fast",
27372 FALSE
27373};
27374
27375static const _ExtendedGDBusMethodInfo * const _led_method_info_pointers[] =
27376{
27377 &_led_method_info_set_on,
27378 &_led_method_info_set_off,
27379 &_led_method_info_set_blink_slow,
27380 &_led_method_info_set_blink_fast,
27381 NULL
27382};
27383
27384static const _ExtendedGDBusPropertyInfo _led_property_info_color =
27385{
27386 {
27387 -1,
27388 (gchar *) "color",
27389 (gchar *) "i",
27390 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
27391 NULL
27392 },
27393 "color",
27394 FALSE
27395};
27396
27397static const _ExtendedGDBusPropertyInfo _led_property_info_function =
27398{
27399 {
27400 -1,
27401 (gchar *) "function",
27402 (gchar *) "s",
27403 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
27404 NULL
27405 },
27406 "function",
27407 FALSE
27408};
27409
Norman James493996c2015-10-31 17:27:13 -050027410static const _ExtendedGDBusPropertyInfo _led_property_info_state =
27411{
27412 {
27413 -1,
27414 (gchar *) "state",
27415 (gchar *) "s",
27416 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
27417 NULL
27418 },
27419 "state",
27420 FALSE
27421};
27422
Norman James362a80f2015-09-14 14:04:39 -050027423static const _ExtendedGDBusPropertyInfo * const _led_property_info_pointers[] =
27424{
27425 &_led_property_info_color,
27426 &_led_property_info_function,
Norman James493996c2015-10-31 17:27:13 -050027427 &_led_property_info_state,
Norman James362a80f2015-09-14 14:04:39 -050027428 NULL
27429};
27430
27431static const _ExtendedGDBusInterfaceInfo _led_interface_info =
27432{
27433 {
27434 -1,
27435 (gchar *) "org.openbmc.Led",
27436 (GDBusMethodInfo **) &_led_method_info_pointers,
27437 NULL,
27438 (GDBusPropertyInfo **) &_led_property_info_pointers,
27439 NULL
27440 },
27441 "led",
27442};
27443
27444
27445/**
27446 * led_interface_info:
27447 *
27448 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link> D-Bus interface.
27449 *
27450 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
27451 */
27452GDBusInterfaceInfo *
27453led_interface_info (void)
27454{
27455 return (GDBusInterfaceInfo *) &_led_interface_info.parent_struct;
27456}
27457
27458/**
27459 * led_override_properties:
27460 * @klass: The class structure for a #GObject<!-- -->-derived class.
27461 * @property_id_begin: The property id to assign to the first overridden property.
27462 *
27463 * Overrides all #GObject properties in the #Led interface for a concrete class.
27464 * The properties are overridden in the order they are defined.
27465 *
27466 * Returns: The last property id.
27467 */
27468guint
27469led_override_properties (GObjectClass *klass, guint property_id_begin)
27470{
27471 g_object_class_override_property (klass, property_id_begin++, "color");
27472 g_object_class_override_property (klass, property_id_begin++, "function");
Norman James493996c2015-10-31 17:27:13 -050027473 g_object_class_override_property (klass, property_id_begin++, "state");
Norman James362a80f2015-09-14 14:04:39 -050027474 return property_id_begin - 1;
27475}
27476
27477
27478
27479/**
27480 * Led:
27481 *
27482 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>.
27483 */
27484
27485/**
27486 * LedIface:
27487 * @parent_iface: The parent interface.
27488 * @handle_set_blink_fast: Handler for the #Led::handle-set-blink-fast signal.
27489 * @handle_set_blink_slow: Handler for the #Led::handle-set-blink-slow signal.
27490 * @handle_set_off: Handler for the #Led::handle-set-off signal.
27491 * @handle_set_on: Handler for the #Led::handle-set-on signal.
27492 * @get_color: Getter for the #Led:color property.
27493 * @get_function: Getter for the #Led:function property.
Norman James493996c2015-10-31 17:27:13 -050027494 * @get_state: Getter for the #Led:state property.
Norman James362a80f2015-09-14 14:04:39 -050027495 *
27496 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>.
27497 */
27498
27499typedef LedIface LedInterface;
27500G_DEFINE_INTERFACE (Led, led, G_TYPE_OBJECT);
27501
27502static void
27503led_default_init (LedIface *iface)
27504{
27505 /* GObject signals for incoming D-Bus method calls: */
27506 /**
27507 * Led::handle-set-on:
27508 * @object: A #Led.
27509 * @invocation: A #GDBusMethodInvocation.
27510 *
27511 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setOn">setOn()</link> D-Bus method.
27512 *
27513 * 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.
27514 *
27515 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
27516 */
27517 g_signal_new ("handle-set-on",
27518 G_TYPE_FROM_INTERFACE (iface),
27519 G_SIGNAL_RUN_LAST,
27520 G_STRUCT_OFFSET (LedIface, handle_set_on),
27521 g_signal_accumulator_true_handled,
27522 NULL,
27523 g_cclosure_marshal_generic,
27524 G_TYPE_BOOLEAN,
27525 1,
27526 G_TYPE_DBUS_METHOD_INVOCATION);
27527
27528 /**
27529 * Led::handle-set-off:
27530 * @object: A #Led.
27531 * @invocation: A #GDBusMethodInvocation.
27532 *
27533 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setOff">setOff()</link> D-Bus method.
27534 *
27535 * 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.
27536 *
27537 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
27538 */
27539 g_signal_new ("handle-set-off",
27540 G_TYPE_FROM_INTERFACE (iface),
27541 G_SIGNAL_RUN_LAST,
27542 G_STRUCT_OFFSET (LedIface, handle_set_off),
27543 g_signal_accumulator_true_handled,
27544 NULL,
27545 g_cclosure_marshal_generic,
27546 G_TYPE_BOOLEAN,
27547 1,
27548 G_TYPE_DBUS_METHOD_INVOCATION);
27549
27550 /**
27551 * Led::handle-set-blink-slow:
27552 * @object: A #Led.
27553 * @invocation: A #GDBusMethodInvocation.
27554 *
27555 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setBlinkSlow">setBlinkSlow()</link> D-Bus method.
27556 *
27557 * 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.
27558 *
27559 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
27560 */
27561 g_signal_new ("handle-set-blink-slow",
27562 G_TYPE_FROM_INTERFACE (iface),
27563 G_SIGNAL_RUN_LAST,
27564 G_STRUCT_OFFSET (LedIface, handle_set_blink_slow),
27565 g_signal_accumulator_true_handled,
27566 NULL,
27567 g_cclosure_marshal_generic,
27568 G_TYPE_BOOLEAN,
27569 1,
27570 G_TYPE_DBUS_METHOD_INVOCATION);
27571
27572 /**
27573 * Led::handle-set-blink-fast:
27574 * @object: A #Led.
27575 * @invocation: A #GDBusMethodInvocation.
27576 *
27577 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setBlinkFast">setBlinkFast()</link> D-Bus method.
27578 *
27579 * 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.
27580 *
27581 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
27582 */
27583 g_signal_new ("handle-set-blink-fast",
27584 G_TYPE_FROM_INTERFACE (iface),
27585 G_SIGNAL_RUN_LAST,
27586 G_STRUCT_OFFSET (LedIface, handle_set_blink_fast),
27587 g_signal_accumulator_true_handled,
27588 NULL,
27589 g_cclosure_marshal_generic,
27590 G_TYPE_BOOLEAN,
27591 1,
27592 G_TYPE_DBUS_METHOD_INVOCATION);
27593
27594 /* GObject properties for D-Bus properties: */
27595 /**
27596 * Led:color:
27597 *
27598 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Led.color">"color"</link>.
27599 *
27600 * 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.
27601 */
27602 g_object_interface_install_property (iface,
27603 g_param_spec_int ("color", "color", "color", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
27604 /**
27605 * Led:function:
27606 *
27607 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link>.
27608 *
27609 * 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.
27610 */
27611 g_object_interface_install_property (iface,
27612 g_param_spec_string ("function", "function", "function", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Norman James493996c2015-10-31 17:27:13 -050027613 /**
27614 * Led:state:
27615 *
27616 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Led.state">"state"</link>.
27617 *
27618 * 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.
27619 */
27620 g_object_interface_install_property (iface,
27621 g_param_spec_string ("state", "state", "state", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Norman James362a80f2015-09-14 14:04:39 -050027622}
27623
27624/**
27625 * led_get_color: (skip)
27626 * @object: A #Led.
27627 *
27628 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Led.color">"color"</link> D-Bus property.
27629 *
27630 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
27631 *
27632 * Returns: The property value.
27633 */
27634gint
27635led_get_color (Led *object)
27636{
27637 return LED_GET_IFACE (object)->get_color (object);
27638}
27639
27640/**
27641 * led_set_color: (skip)
27642 * @object: A #Led.
27643 * @value: The value to set.
27644 *
27645 * Sets the <link linkend="gdbus-property-org-openbmc-Led.color">"color"</link> D-Bus property to @value.
27646 *
27647 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
27648 */
27649void
27650led_set_color (Led *object, gint value)
27651{
27652 g_object_set (G_OBJECT (object), "color", value, NULL);
27653}
27654
27655/**
27656 * led_get_function: (skip)
27657 * @object: A #Led.
27658 *
27659 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link> D-Bus property.
27660 *
27661 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
27662 *
27663 * <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>
27664 *
27665 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
27666 */
27667const gchar *
27668led_get_function (Led *object)
27669{
27670 return LED_GET_IFACE (object)->get_function (object);
27671}
27672
27673/**
27674 * led_dup_function: (skip)
27675 * @object: A #Led.
27676 *
27677 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link> D-Bus property.
27678 *
27679 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
27680 *
27681 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
27682 */
27683gchar *
27684led_dup_function (Led *object)
27685{
27686 gchar *value;
27687 g_object_get (G_OBJECT (object), "function", &value, NULL);
27688 return value;
27689}
27690
27691/**
27692 * led_set_function: (skip)
27693 * @object: A #Led.
27694 * @value: The value to set.
27695 *
27696 * Sets the <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link> D-Bus property to @value.
27697 *
27698 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
27699 */
27700void
27701led_set_function (Led *object, const gchar *value)
27702{
27703 g_object_set (G_OBJECT (object), "function", value, NULL);
27704}
27705
27706/**
Norman James493996c2015-10-31 17:27:13 -050027707 * led_get_state: (skip)
27708 * @object: A #Led.
27709 *
27710 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Led.state">"state"</link> D-Bus property.
27711 *
27712 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
27713 *
27714 * <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>
27715 *
27716 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
27717 */
27718const gchar *
27719led_get_state (Led *object)
27720{
27721 return LED_GET_IFACE (object)->get_state (object);
27722}
27723
27724/**
27725 * led_dup_state: (skip)
27726 * @object: A #Led.
27727 *
27728 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Led.state">"state"</link> D-Bus property.
27729 *
27730 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
27731 *
27732 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
27733 */
27734gchar *
27735led_dup_state (Led *object)
27736{
27737 gchar *value;
27738 g_object_get (G_OBJECT (object), "state", &value, NULL);
27739 return value;
27740}
27741
27742/**
27743 * led_set_state: (skip)
27744 * @object: A #Led.
27745 * @value: The value to set.
27746 *
27747 * Sets the <link linkend="gdbus-property-org-openbmc-Led.state">"state"</link> D-Bus property to @value.
27748 *
27749 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
27750 */
27751void
27752led_set_state (Led *object, const gchar *value)
27753{
27754 g_object_set (G_OBJECT (object), "state", value, NULL);
27755}
27756
27757/**
Norman James362a80f2015-09-14 14:04:39 -050027758 * led_call_set_on:
27759 * @proxy: A #LedProxy.
27760 * @cancellable: (allow-none): A #GCancellable or %NULL.
27761 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
27762 * @user_data: User data to pass to @callback.
27763 *
27764 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setOn">setOn()</link> D-Bus method on @proxy.
27765 * 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.
27766 * You can then call led_call_set_on_finish() to get the result of the operation.
27767 *
27768 * See led_call_set_on_sync() for the synchronous, blocking version of this method.
27769 */
27770void
27771led_call_set_on (
27772 Led *proxy,
27773 GCancellable *cancellable,
27774 GAsyncReadyCallback callback,
27775 gpointer user_data)
27776{
27777 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
27778 "setOn",
27779 g_variant_new ("()"),
27780 G_DBUS_CALL_FLAGS_NONE,
27781 -1,
27782 cancellable,
27783 callback,
27784 user_data);
27785}
27786
27787/**
27788 * led_call_set_on_finish:
27789 * @proxy: A #LedProxy.
27790 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_on().
27791 * @error: Return location for error or %NULL.
27792 *
27793 * Finishes an operation started with led_call_set_on().
27794 *
27795 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
27796 */
27797gboolean
27798led_call_set_on_finish (
27799 Led *proxy,
27800 GAsyncResult *res,
27801 GError **error)
27802{
27803 GVariant *_ret;
27804 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
27805 if (_ret == NULL)
27806 goto _out;
27807 g_variant_get (_ret,
27808 "()");
27809 g_variant_unref (_ret);
27810_out:
27811 return _ret != NULL;
27812}
27813
27814/**
27815 * led_call_set_on_sync:
27816 * @proxy: A #LedProxy.
27817 * @cancellable: (allow-none): A #GCancellable or %NULL.
27818 * @error: Return location for error or %NULL.
27819 *
27820 * 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.
27821 *
27822 * See led_call_set_on() for the asynchronous version of this method.
27823 *
27824 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
27825 */
27826gboolean
27827led_call_set_on_sync (
27828 Led *proxy,
27829 GCancellable *cancellable,
27830 GError **error)
27831{
27832 GVariant *_ret;
27833 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
27834 "setOn",
27835 g_variant_new ("()"),
27836 G_DBUS_CALL_FLAGS_NONE,
27837 -1,
27838 cancellable,
27839 error);
27840 if (_ret == NULL)
27841 goto _out;
27842 g_variant_get (_ret,
27843 "()");
27844 g_variant_unref (_ret);
27845_out:
27846 return _ret != NULL;
27847}
27848
27849/**
27850 * led_call_set_off:
27851 * @proxy: A #LedProxy.
27852 * @cancellable: (allow-none): A #GCancellable or %NULL.
27853 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
27854 * @user_data: User data to pass to @callback.
27855 *
27856 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setOff">setOff()</link> D-Bus method on @proxy.
27857 * 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.
27858 * You can then call led_call_set_off_finish() to get the result of the operation.
27859 *
27860 * See led_call_set_off_sync() for the synchronous, blocking version of this method.
27861 */
27862void
27863led_call_set_off (
27864 Led *proxy,
27865 GCancellable *cancellable,
27866 GAsyncReadyCallback callback,
27867 gpointer user_data)
27868{
27869 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
27870 "setOff",
27871 g_variant_new ("()"),
27872 G_DBUS_CALL_FLAGS_NONE,
27873 -1,
27874 cancellable,
27875 callback,
27876 user_data);
27877}
27878
27879/**
27880 * led_call_set_off_finish:
27881 * @proxy: A #LedProxy.
27882 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_off().
27883 * @error: Return location for error or %NULL.
27884 *
27885 * Finishes an operation started with led_call_set_off().
27886 *
27887 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
27888 */
27889gboolean
27890led_call_set_off_finish (
27891 Led *proxy,
27892 GAsyncResult *res,
27893 GError **error)
27894{
27895 GVariant *_ret;
27896 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
27897 if (_ret == NULL)
27898 goto _out;
27899 g_variant_get (_ret,
27900 "()");
27901 g_variant_unref (_ret);
27902_out:
27903 return _ret != NULL;
27904}
27905
27906/**
27907 * led_call_set_off_sync:
27908 * @proxy: A #LedProxy.
27909 * @cancellable: (allow-none): A #GCancellable or %NULL.
27910 * @error: Return location for error or %NULL.
27911 *
27912 * 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.
27913 *
27914 * See led_call_set_off() for the asynchronous version of this method.
27915 *
27916 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
27917 */
27918gboolean
27919led_call_set_off_sync (
27920 Led *proxy,
27921 GCancellable *cancellable,
27922 GError **error)
27923{
27924 GVariant *_ret;
27925 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
27926 "setOff",
27927 g_variant_new ("()"),
27928 G_DBUS_CALL_FLAGS_NONE,
27929 -1,
27930 cancellable,
27931 error);
27932 if (_ret == NULL)
27933 goto _out;
27934 g_variant_get (_ret,
27935 "()");
27936 g_variant_unref (_ret);
27937_out:
27938 return _ret != NULL;
27939}
27940
27941/**
27942 * led_call_set_blink_slow:
27943 * @proxy: A #LedProxy.
27944 * @cancellable: (allow-none): A #GCancellable or %NULL.
27945 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
27946 * @user_data: User data to pass to @callback.
27947 *
27948 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setBlinkSlow">setBlinkSlow()</link> D-Bus method on @proxy.
27949 * 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.
27950 * You can then call led_call_set_blink_slow_finish() to get the result of the operation.
27951 *
27952 * See led_call_set_blink_slow_sync() for the synchronous, blocking version of this method.
27953 */
27954void
27955led_call_set_blink_slow (
27956 Led *proxy,
27957 GCancellable *cancellable,
27958 GAsyncReadyCallback callback,
27959 gpointer user_data)
27960{
27961 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
27962 "setBlinkSlow",
27963 g_variant_new ("()"),
27964 G_DBUS_CALL_FLAGS_NONE,
27965 -1,
27966 cancellable,
27967 callback,
27968 user_data);
27969}
27970
27971/**
27972 * led_call_set_blink_slow_finish:
27973 * @proxy: A #LedProxy.
27974 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_blink_slow().
27975 * @error: Return location for error or %NULL.
27976 *
27977 * Finishes an operation started with led_call_set_blink_slow().
27978 *
27979 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
27980 */
27981gboolean
27982led_call_set_blink_slow_finish (
27983 Led *proxy,
27984 GAsyncResult *res,
27985 GError **error)
27986{
27987 GVariant *_ret;
27988 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
27989 if (_ret == NULL)
27990 goto _out;
27991 g_variant_get (_ret,
27992 "()");
27993 g_variant_unref (_ret);
27994_out:
27995 return _ret != NULL;
27996}
27997
27998/**
27999 * led_call_set_blink_slow_sync:
28000 * @proxy: A #LedProxy.
28001 * @cancellable: (allow-none): A #GCancellable or %NULL.
28002 * @error: Return location for error or %NULL.
28003 *
28004 * 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.
28005 *
28006 * See led_call_set_blink_slow() for the asynchronous version of this method.
28007 *
28008 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
28009 */
28010gboolean
28011led_call_set_blink_slow_sync (
28012 Led *proxy,
28013 GCancellable *cancellable,
28014 GError **error)
28015{
28016 GVariant *_ret;
28017 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
28018 "setBlinkSlow",
28019 g_variant_new ("()"),
28020 G_DBUS_CALL_FLAGS_NONE,
28021 -1,
28022 cancellable,
28023 error);
28024 if (_ret == NULL)
28025 goto _out;
28026 g_variant_get (_ret,
28027 "()");
28028 g_variant_unref (_ret);
28029_out:
28030 return _ret != NULL;
28031}
28032
28033/**
28034 * led_call_set_blink_fast:
28035 * @proxy: A #LedProxy.
28036 * @cancellable: (allow-none): A #GCancellable or %NULL.
28037 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
28038 * @user_data: User data to pass to @callback.
28039 *
28040 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setBlinkFast">setBlinkFast()</link> D-Bus method on @proxy.
28041 * 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.
28042 * You can then call led_call_set_blink_fast_finish() to get the result of the operation.
28043 *
28044 * See led_call_set_blink_fast_sync() for the synchronous, blocking version of this method.
28045 */
28046void
28047led_call_set_blink_fast (
28048 Led *proxy,
28049 GCancellable *cancellable,
28050 GAsyncReadyCallback callback,
28051 gpointer user_data)
28052{
28053 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
28054 "setBlinkFast",
28055 g_variant_new ("()"),
28056 G_DBUS_CALL_FLAGS_NONE,
28057 -1,
28058 cancellable,
28059 callback,
28060 user_data);
28061}
28062
28063/**
28064 * led_call_set_blink_fast_finish:
28065 * @proxy: A #LedProxy.
28066 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_blink_fast().
28067 * @error: Return location for error or %NULL.
28068 *
28069 * Finishes an operation started with led_call_set_blink_fast().
28070 *
28071 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
28072 */
28073gboolean
28074led_call_set_blink_fast_finish (
28075 Led *proxy,
28076 GAsyncResult *res,
28077 GError **error)
28078{
28079 GVariant *_ret;
28080 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
28081 if (_ret == NULL)
28082 goto _out;
28083 g_variant_get (_ret,
28084 "()");
28085 g_variant_unref (_ret);
28086_out:
28087 return _ret != NULL;
28088}
28089
28090/**
28091 * led_call_set_blink_fast_sync:
28092 * @proxy: A #LedProxy.
28093 * @cancellable: (allow-none): A #GCancellable or %NULL.
28094 * @error: Return location for error or %NULL.
28095 *
28096 * 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.
28097 *
28098 * See led_call_set_blink_fast() for the asynchronous version of this method.
28099 *
28100 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
28101 */
28102gboolean
28103led_call_set_blink_fast_sync (
28104 Led *proxy,
28105 GCancellable *cancellable,
28106 GError **error)
28107{
28108 GVariant *_ret;
28109 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
28110 "setBlinkFast",
28111 g_variant_new ("()"),
28112 G_DBUS_CALL_FLAGS_NONE,
28113 -1,
28114 cancellable,
28115 error);
28116 if (_ret == NULL)
28117 goto _out;
28118 g_variant_get (_ret,
28119 "()");
28120 g_variant_unref (_ret);
28121_out:
28122 return _ret != NULL;
28123}
28124
28125/**
28126 * led_complete_set_on:
28127 * @object: A #Led.
28128 * @invocation: (transfer full): A #GDBusMethodInvocation.
28129 *
28130 * 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.
28131 *
28132 * This method will free @invocation, you cannot use it afterwards.
28133 */
28134void
28135led_complete_set_on (
28136 Led *object,
28137 GDBusMethodInvocation *invocation)
28138{
28139 g_dbus_method_invocation_return_value (invocation,
28140 g_variant_new ("()"));
28141}
28142
28143/**
28144 * led_complete_set_off:
28145 * @object: A #Led.
28146 * @invocation: (transfer full): A #GDBusMethodInvocation.
28147 *
28148 * 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.
28149 *
28150 * This method will free @invocation, you cannot use it afterwards.
28151 */
28152void
28153led_complete_set_off (
28154 Led *object,
28155 GDBusMethodInvocation *invocation)
28156{
28157 g_dbus_method_invocation_return_value (invocation,
28158 g_variant_new ("()"));
28159}
28160
28161/**
28162 * led_complete_set_blink_slow:
28163 * @object: A #Led.
28164 * @invocation: (transfer full): A #GDBusMethodInvocation.
28165 *
28166 * 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.
28167 *
28168 * This method will free @invocation, you cannot use it afterwards.
28169 */
28170void
28171led_complete_set_blink_slow (
28172 Led *object,
28173 GDBusMethodInvocation *invocation)
28174{
28175 g_dbus_method_invocation_return_value (invocation,
28176 g_variant_new ("()"));
28177}
28178
28179/**
28180 * led_complete_set_blink_fast:
28181 * @object: A #Led.
28182 * @invocation: (transfer full): A #GDBusMethodInvocation.
28183 *
28184 * 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.
28185 *
28186 * This method will free @invocation, you cannot use it afterwards.
28187 */
28188void
28189led_complete_set_blink_fast (
28190 Led *object,
28191 GDBusMethodInvocation *invocation)
28192{
28193 g_dbus_method_invocation_return_value (invocation,
28194 g_variant_new ("()"));
28195}
28196
28197/* ------------------------------------------------------------------------ */
28198
28199/**
28200 * LedProxy:
28201 *
28202 * The #LedProxy structure contains only private data and should only be accessed using the provided API.
28203 */
28204
28205/**
28206 * LedProxyClass:
28207 * @parent_class: The parent class.
28208 *
28209 * Class structure for #LedProxy.
28210 */
28211
28212struct _LedProxyPrivate
28213{
28214 GData *qdata;
28215};
28216
28217static void led_proxy_iface_init (LedIface *iface);
28218
28219#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
28220G_DEFINE_TYPE_WITH_CODE (LedProxy, led_proxy, G_TYPE_DBUS_PROXY,
28221 G_ADD_PRIVATE (LedProxy)
28222 G_IMPLEMENT_INTERFACE (TYPE_LED, led_proxy_iface_init));
28223
28224#else
28225G_DEFINE_TYPE_WITH_CODE (LedProxy, led_proxy, G_TYPE_DBUS_PROXY,
28226 G_IMPLEMENT_INTERFACE (TYPE_LED, led_proxy_iface_init));
28227
28228#endif
28229static void
28230led_proxy_finalize (GObject *object)
28231{
28232 LedProxy *proxy = LED_PROXY (object);
28233 g_datalist_clear (&proxy->priv->qdata);
28234 G_OBJECT_CLASS (led_proxy_parent_class)->finalize (object);
28235}
28236
28237static void
28238led_proxy_get_property (GObject *object,
28239 guint prop_id,
28240 GValue *value,
28241 GParamSpec *pspec G_GNUC_UNUSED)
28242{
28243 const _ExtendedGDBusPropertyInfo *info;
28244 GVariant *variant;
Norman James493996c2015-10-31 17:27:13 -050028245 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -050028246 info = _led_property_info_pointers[prop_id - 1];
28247 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
28248 if (info->use_gvariant)
28249 {
28250 g_value_set_variant (value, variant);
28251 }
28252 else
28253 {
28254 if (variant != NULL)
28255 g_dbus_gvariant_to_gvalue (variant, value);
28256 }
28257 if (variant != NULL)
28258 g_variant_unref (variant);
28259}
28260
28261static void
28262led_proxy_set_property_cb (GDBusProxy *proxy,
28263 GAsyncResult *res,
28264 gpointer user_data)
28265{
28266 const _ExtendedGDBusPropertyInfo *info = user_data;
28267 GError *error;
28268 GVariant *_ret;
28269 error = NULL;
28270 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
28271 if (!_ret)
28272 {
28273 g_warning ("Error setting property '%s' on interface org.openbmc.Led: %s (%s, %d)",
28274 info->parent_struct.name,
28275 error->message, g_quark_to_string (error->domain), error->code);
28276 g_error_free (error);
28277 }
28278 else
28279 {
28280 g_variant_unref (_ret);
28281 }
28282}
28283
28284static void
28285led_proxy_set_property (GObject *object,
28286 guint prop_id,
28287 const GValue *value,
28288 GParamSpec *pspec G_GNUC_UNUSED)
28289{
28290 const _ExtendedGDBusPropertyInfo *info;
28291 GVariant *variant;
Norman James493996c2015-10-31 17:27:13 -050028292 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -050028293 info = _led_property_info_pointers[prop_id - 1];
28294 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
28295 g_dbus_proxy_call (G_DBUS_PROXY (object),
28296 "org.freedesktop.DBus.Properties.Set",
28297 g_variant_new ("(ssv)", "org.openbmc.Led", info->parent_struct.name, variant),
28298 G_DBUS_CALL_FLAGS_NONE,
28299 -1,
28300 NULL, (GAsyncReadyCallback) led_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
28301 g_variant_unref (variant);
28302}
28303
28304static void
28305led_proxy_g_signal (GDBusProxy *proxy,
28306 const gchar *sender_name G_GNUC_UNUSED,
28307 const gchar *signal_name,
28308 GVariant *parameters)
28309{
28310 _ExtendedGDBusSignalInfo *info;
28311 GVariantIter iter;
28312 GVariant *child;
28313 GValue *paramv;
28314 guint num_params;
28315 guint n;
28316 guint signal_id;
28317 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, signal_name);
28318 if (info == NULL)
28319 return;
28320 num_params = g_variant_n_children (parameters);
28321 paramv = g_new0 (GValue, num_params + 1);
28322 g_value_init (&paramv[0], TYPE_LED);
28323 g_value_set_object (&paramv[0], proxy);
28324 g_variant_iter_init (&iter, parameters);
28325 n = 1;
28326 while ((child = g_variant_iter_next_value (&iter)) != NULL)
28327 {
28328 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
28329 if (arg_info->use_gvariant)
28330 {
28331 g_value_init (&paramv[n], G_TYPE_VARIANT);
28332 g_value_set_variant (&paramv[n], child);
28333 n++;
28334 }
28335 else
28336 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
28337 g_variant_unref (child);
28338 }
28339 signal_id = g_signal_lookup (info->signal_name, TYPE_LED);
28340 g_signal_emitv (paramv, signal_id, 0, NULL);
28341 for (n = 0; n < num_params + 1; n++)
28342 g_value_unset (&paramv[n]);
28343 g_free (paramv);
28344}
28345
28346static void
28347led_proxy_g_properties_changed (GDBusProxy *_proxy,
28348 GVariant *changed_properties,
28349 const gchar *const *invalidated_properties)
28350{
28351 LedProxy *proxy = LED_PROXY (_proxy);
28352 guint n;
28353 const gchar *key;
28354 GVariantIter *iter;
28355 _ExtendedGDBusPropertyInfo *info;
28356 g_variant_get (changed_properties, "a{sv}", &iter);
28357 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
28358 {
28359 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, key);
28360 g_datalist_remove_data (&proxy->priv->qdata, key);
28361 if (info != NULL)
28362 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
28363 }
28364 g_variant_iter_free (iter);
28365 for (n = 0; invalidated_properties[n] != NULL; n++)
28366 {
28367 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, invalidated_properties[n]);
28368 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
28369 if (info != NULL)
28370 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
28371 }
28372}
28373
28374static gint
28375led_proxy_get_color (Led *object)
28376{
28377 LedProxy *proxy = LED_PROXY (object);
28378 GVariant *variant;
28379 gint value = 0;
28380 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "color");
28381 if (variant != NULL)
28382 {
28383 value = g_variant_get_int32 (variant);
28384 g_variant_unref (variant);
28385 }
28386 return value;
28387}
28388
28389static const gchar *
28390led_proxy_get_function (Led *object)
28391{
28392 LedProxy *proxy = LED_PROXY (object);
28393 GVariant *variant;
28394 const gchar *value = NULL;
28395 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "function");
28396 if (variant != NULL)
28397 {
28398 value = g_variant_get_string (variant, NULL);
28399 g_variant_unref (variant);
28400 }
28401 return value;
28402}
28403
Norman James493996c2015-10-31 17:27:13 -050028404static const gchar *
28405led_proxy_get_state (Led *object)
28406{
28407 LedProxy *proxy = LED_PROXY (object);
28408 GVariant *variant;
28409 const gchar *value = NULL;
28410 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state");
28411 if (variant != NULL)
28412 {
28413 value = g_variant_get_string (variant, NULL);
28414 g_variant_unref (variant);
28415 }
28416 return value;
28417}
28418
Norman James362a80f2015-09-14 14:04:39 -050028419static void
28420led_proxy_init (LedProxy *proxy)
28421{
28422#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
28423 proxy->priv = led_proxy_get_instance_private (proxy);
28424#else
28425 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_LED_PROXY, LedProxyPrivate);
28426#endif
28427
28428 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), led_interface_info ());
28429}
28430
28431static void
28432led_proxy_class_init (LedProxyClass *klass)
28433{
28434 GObjectClass *gobject_class;
28435 GDBusProxyClass *proxy_class;
28436
28437 gobject_class = G_OBJECT_CLASS (klass);
28438 gobject_class->finalize = led_proxy_finalize;
28439 gobject_class->get_property = led_proxy_get_property;
28440 gobject_class->set_property = led_proxy_set_property;
28441
28442 proxy_class = G_DBUS_PROXY_CLASS (klass);
28443 proxy_class->g_signal = led_proxy_g_signal;
28444 proxy_class->g_properties_changed = led_proxy_g_properties_changed;
28445
28446 led_override_properties (gobject_class, 1);
28447
28448#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
28449 g_type_class_add_private (klass, sizeof (LedProxyPrivate));
28450#endif
28451}
28452
28453static void
28454led_proxy_iface_init (LedIface *iface)
28455{
28456 iface->get_color = led_proxy_get_color;
28457 iface->get_function = led_proxy_get_function;
Norman James493996c2015-10-31 17:27:13 -050028458 iface->get_state = led_proxy_get_state;
Norman James362a80f2015-09-14 14:04:39 -050028459}
28460
28461/**
28462 * led_proxy_new:
28463 * @connection: A #GDBusConnection.
28464 * @flags: Flags from the #GDBusProxyFlags enumeration.
28465 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
28466 * @object_path: An object path.
28467 * @cancellable: (allow-none): A #GCancellable or %NULL.
28468 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
28469 * @user_data: User data to pass to @callback.
28470 *
28471 * 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.
28472 *
28473 * 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.
28474 * You can then call led_proxy_new_finish() to get the result of the operation.
28475 *
28476 * See led_proxy_new_sync() for the synchronous, blocking version of this constructor.
28477 */
28478void
28479led_proxy_new (
28480 GDBusConnection *connection,
28481 GDBusProxyFlags flags,
28482 const gchar *name,
28483 const gchar *object_path,
28484 GCancellable *cancellable,
28485 GAsyncReadyCallback callback,
28486 gpointer user_data)
28487{
28488 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);
28489}
28490
28491/**
28492 * led_proxy_new_finish:
28493 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_proxy_new().
28494 * @error: Return location for error or %NULL
28495 *
28496 * Finishes an operation started with led_proxy_new().
28497 *
28498 * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set.
28499 */
28500Led *
28501led_proxy_new_finish (
28502 GAsyncResult *res,
28503 GError **error)
28504{
28505 GObject *ret;
28506 GObject *source_object;
28507 source_object = g_async_result_get_source_object (res);
28508 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
28509 g_object_unref (source_object);
28510 if (ret != NULL)
28511 return LED (ret);
28512 else
28513 return NULL;
28514}
28515
28516/**
28517 * led_proxy_new_sync:
28518 * @connection: A #GDBusConnection.
28519 * @flags: Flags from the #GDBusProxyFlags enumeration.
28520 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
28521 * @object_path: An object path.
28522 * @cancellable: (allow-none): A #GCancellable or %NULL.
28523 * @error: Return location for error or %NULL
28524 *
28525 * 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.
28526 *
28527 * The calling thread is blocked until a reply is received.
28528 *
28529 * See led_proxy_new() for the asynchronous version of this constructor.
28530 *
28531 * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set.
28532 */
28533Led *
28534led_proxy_new_sync (
28535 GDBusConnection *connection,
28536 GDBusProxyFlags flags,
28537 const gchar *name,
28538 const gchar *object_path,
28539 GCancellable *cancellable,
28540 GError **error)
28541{
28542 GInitable *ret;
28543 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);
28544 if (ret != NULL)
28545 return LED (ret);
28546 else
28547 return NULL;
28548}
28549
28550
28551/**
28552 * led_proxy_new_for_bus:
28553 * @bus_type: A #GBusType.
28554 * @flags: Flags from the #GDBusProxyFlags enumeration.
28555 * @name: A bus name (well-known or unique).
28556 * @object_path: An object path.
28557 * @cancellable: (allow-none): A #GCancellable or %NULL.
28558 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
28559 * @user_data: User data to pass to @callback.
28560 *
28561 * Like led_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
28562 *
28563 * 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.
28564 * You can then call led_proxy_new_for_bus_finish() to get the result of the operation.
28565 *
28566 * See led_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
28567 */
28568void
28569led_proxy_new_for_bus (
28570 GBusType bus_type,
28571 GDBusProxyFlags flags,
28572 const gchar *name,
28573 const gchar *object_path,
28574 GCancellable *cancellable,
28575 GAsyncReadyCallback callback,
28576 gpointer user_data)
28577{
28578 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);
28579}
28580
28581/**
28582 * led_proxy_new_for_bus_finish:
28583 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_proxy_new_for_bus().
28584 * @error: Return location for error or %NULL
28585 *
28586 * Finishes an operation started with led_proxy_new_for_bus().
28587 *
28588 * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set.
28589 */
28590Led *
28591led_proxy_new_for_bus_finish (
28592 GAsyncResult *res,
28593 GError **error)
28594{
28595 GObject *ret;
28596 GObject *source_object;
28597 source_object = g_async_result_get_source_object (res);
28598 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
28599 g_object_unref (source_object);
28600 if (ret != NULL)
28601 return LED (ret);
28602 else
28603 return NULL;
28604}
28605
28606/**
28607 * led_proxy_new_for_bus_sync:
28608 * @bus_type: A #GBusType.
28609 * @flags: Flags from the #GDBusProxyFlags enumeration.
28610 * @name: A bus name (well-known or unique).
28611 * @object_path: An object path.
28612 * @cancellable: (allow-none): A #GCancellable or %NULL.
28613 * @error: Return location for error or %NULL
28614 *
28615 * Like led_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
28616 *
28617 * The calling thread is blocked until a reply is received.
28618 *
28619 * See led_proxy_new_for_bus() for the asynchronous version of this constructor.
28620 *
28621 * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set.
28622 */
28623Led *
28624led_proxy_new_for_bus_sync (
28625 GBusType bus_type,
28626 GDBusProxyFlags flags,
28627 const gchar *name,
28628 const gchar *object_path,
28629 GCancellable *cancellable,
28630 GError **error)
28631{
28632 GInitable *ret;
28633 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);
28634 if (ret != NULL)
28635 return LED (ret);
28636 else
28637 return NULL;
28638}
28639
28640
28641/* ------------------------------------------------------------------------ */
28642
28643/**
28644 * LedSkeleton:
28645 *
28646 * The #LedSkeleton structure contains only private data and should only be accessed using the provided API.
28647 */
28648
28649/**
28650 * LedSkeletonClass:
28651 * @parent_class: The parent class.
28652 *
28653 * Class structure for #LedSkeleton.
28654 */
28655
28656struct _LedSkeletonPrivate
28657{
28658 GValue *properties;
28659 GList *changed_properties;
28660 GSource *changed_properties_idle_source;
28661 GMainContext *context;
28662 GMutex lock;
28663};
28664
28665static void
28666_led_skeleton_handle_method_call (
28667 GDBusConnection *connection G_GNUC_UNUSED,
28668 const gchar *sender G_GNUC_UNUSED,
28669 const gchar *object_path G_GNUC_UNUSED,
28670 const gchar *interface_name,
28671 const gchar *method_name,
28672 GVariant *parameters,
28673 GDBusMethodInvocation *invocation,
28674 gpointer user_data)
28675{
28676 LedSkeleton *skeleton = LED_SKELETON (user_data);
28677 _ExtendedGDBusMethodInfo *info;
28678 GVariantIter iter;
28679 GVariant *child;
28680 GValue *paramv;
28681 guint num_params;
28682 guint num_extra;
28683 guint n;
28684 guint signal_id;
28685 GValue return_value = G_VALUE_INIT;
28686 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
28687 g_assert (info != NULL);
28688 num_params = g_variant_n_children (parameters);
28689 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
28690 n = 0;
28691 g_value_init (&paramv[n], TYPE_LED);
28692 g_value_set_object (&paramv[n++], skeleton);
28693 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
28694 g_value_set_object (&paramv[n++], invocation);
28695 if (info->pass_fdlist)
28696 {
28697#ifdef G_OS_UNIX
28698 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
28699 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
28700#else
28701 g_assert_not_reached ();
28702#endif
28703 }
28704 g_variant_iter_init (&iter, parameters);
28705 while ((child = g_variant_iter_next_value (&iter)) != NULL)
28706 {
28707 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
28708 if (arg_info->use_gvariant)
28709 {
28710 g_value_init (&paramv[n], G_TYPE_VARIANT);
28711 g_value_set_variant (&paramv[n], child);
28712 n++;
28713 }
28714 else
28715 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
28716 g_variant_unref (child);
28717 }
28718 signal_id = g_signal_lookup (info->signal_name, TYPE_LED);
28719 g_value_init (&return_value, G_TYPE_BOOLEAN);
28720 g_signal_emitv (paramv, signal_id, 0, &return_value);
28721 if (!g_value_get_boolean (&return_value))
28722 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);
28723 g_value_unset (&return_value);
28724 for (n = 0; n < num_params + num_extra; n++)
28725 g_value_unset (&paramv[n]);
28726 g_free (paramv);
28727}
28728
28729static GVariant *
28730_led_skeleton_handle_get_property (
28731 GDBusConnection *connection G_GNUC_UNUSED,
28732 const gchar *sender G_GNUC_UNUSED,
28733 const gchar *object_path G_GNUC_UNUSED,
28734 const gchar *interface_name G_GNUC_UNUSED,
28735 const gchar *property_name,
28736 GError **error,
28737 gpointer user_data)
28738{
28739 LedSkeleton *skeleton = LED_SKELETON (user_data);
28740 GValue value = G_VALUE_INIT;
28741 GParamSpec *pspec;
28742 _ExtendedGDBusPropertyInfo *info;
28743 GVariant *ret;
28744 ret = NULL;
28745 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, property_name);
28746 g_assert (info != NULL);
28747 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
28748 if (pspec == NULL)
28749 {
28750 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
28751 }
28752 else
28753 {
28754 g_value_init (&value, pspec->value_type);
28755 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
28756 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
28757 g_value_unset (&value);
28758 }
28759 return ret;
28760}
28761
28762static gboolean
28763_led_skeleton_handle_set_property (
28764 GDBusConnection *connection G_GNUC_UNUSED,
28765 const gchar *sender G_GNUC_UNUSED,
28766 const gchar *object_path G_GNUC_UNUSED,
28767 const gchar *interface_name G_GNUC_UNUSED,
28768 const gchar *property_name,
28769 GVariant *variant,
28770 GError **error,
28771 gpointer user_data)
28772{
28773 LedSkeleton *skeleton = LED_SKELETON (user_data);
28774 GValue value = G_VALUE_INIT;
28775 GParamSpec *pspec;
28776 _ExtendedGDBusPropertyInfo *info;
28777 gboolean ret;
28778 ret = FALSE;
28779 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, property_name);
28780 g_assert (info != NULL);
28781 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
28782 if (pspec == NULL)
28783 {
28784 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
28785 }
28786 else
28787 {
28788 if (info->use_gvariant)
28789 g_value_set_variant (&value, variant);
28790 else
28791 g_dbus_gvariant_to_gvalue (variant, &value);
28792 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
28793 g_value_unset (&value);
28794 ret = TRUE;
28795 }
28796 return ret;
28797}
28798
28799static const GDBusInterfaceVTable _led_skeleton_vtable =
28800{
28801 _led_skeleton_handle_method_call,
28802 _led_skeleton_handle_get_property,
28803 _led_skeleton_handle_set_property,
28804 {NULL}
28805};
28806
28807static GDBusInterfaceInfo *
28808led_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
28809{
28810 return led_interface_info ();
28811}
28812
28813static GDBusInterfaceVTable *
28814led_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
28815{
28816 return (GDBusInterfaceVTable *) &_led_skeleton_vtable;
28817}
28818
28819static GVariant *
28820led_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
28821{
28822 LedSkeleton *skeleton = LED_SKELETON (_skeleton);
28823
28824 GVariantBuilder builder;
28825 guint n;
28826 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
28827 if (_led_interface_info.parent_struct.properties == NULL)
28828 goto out;
28829 for (n = 0; _led_interface_info.parent_struct.properties[n] != NULL; n++)
28830 {
28831 GDBusPropertyInfo *info = _led_interface_info.parent_struct.properties[n];
28832 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
28833 {
28834 GVariant *value;
28835 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);
28836 if (value != NULL)
28837 {
28838 g_variant_take_ref (value);
28839 g_variant_builder_add (&builder, "{sv}", info->name, value);
28840 g_variant_unref (value);
28841 }
28842 }
28843 }
28844out:
28845 return g_variant_builder_end (&builder);
28846}
28847
28848static gboolean _led_emit_changed (gpointer user_data);
28849
28850static void
28851led_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
28852{
28853 LedSkeleton *skeleton = LED_SKELETON (_skeleton);
28854 gboolean emit_changed = FALSE;
28855
28856 g_mutex_lock (&skeleton->priv->lock);
28857 if (skeleton->priv->changed_properties_idle_source != NULL)
28858 {
28859 g_source_destroy (skeleton->priv->changed_properties_idle_source);
28860 skeleton->priv->changed_properties_idle_source = NULL;
28861 emit_changed = TRUE;
28862 }
28863 g_mutex_unlock (&skeleton->priv->lock);
28864
28865 if (emit_changed)
28866 _led_emit_changed (skeleton);
28867}
28868
28869static void led_skeleton_iface_init (LedIface *iface);
28870#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
28871G_DEFINE_TYPE_WITH_CODE (LedSkeleton, led_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
28872 G_ADD_PRIVATE (LedSkeleton)
28873 G_IMPLEMENT_INTERFACE (TYPE_LED, led_skeleton_iface_init));
28874
28875#else
28876G_DEFINE_TYPE_WITH_CODE (LedSkeleton, led_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
28877 G_IMPLEMENT_INTERFACE (TYPE_LED, led_skeleton_iface_init));
28878
28879#endif
28880static void
28881led_skeleton_finalize (GObject *object)
28882{
28883 LedSkeleton *skeleton = LED_SKELETON (object);
28884 guint n;
Norman James493996c2015-10-31 17:27:13 -050028885 for (n = 0; n < 3; n++)
Norman James362a80f2015-09-14 14:04:39 -050028886 g_value_unset (&skeleton->priv->properties[n]);
28887 g_free (skeleton->priv->properties);
28888 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
28889 if (skeleton->priv->changed_properties_idle_source != NULL)
28890 g_source_destroy (skeleton->priv->changed_properties_idle_source);
28891 g_main_context_unref (skeleton->priv->context);
28892 g_mutex_clear (&skeleton->priv->lock);
28893 G_OBJECT_CLASS (led_skeleton_parent_class)->finalize (object);
28894}
28895
28896static void
28897led_skeleton_get_property (GObject *object,
28898 guint prop_id,
28899 GValue *value,
28900 GParamSpec *pspec G_GNUC_UNUSED)
28901{
28902 LedSkeleton *skeleton = LED_SKELETON (object);
Norman James493996c2015-10-31 17:27:13 -050028903 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -050028904 g_mutex_lock (&skeleton->priv->lock);
28905 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
28906 g_mutex_unlock (&skeleton->priv->lock);
28907}
28908
28909static gboolean
28910_led_emit_changed (gpointer user_data)
28911{
28912 LedSkeleton *skeleton = LED_SKELETON (user_data);
28913 GList *l;
28914 GVariantBuilder builder;
28915 GVariantBuilder invalidated_builder;
28916 guint num_changes;
28917
28918 g_mutex_lock (&skeleton->priv->lock);
28919 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
28920 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
28921 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
28922 {
28923 ChangedProperty *cp = l->data;
28924 GVariant *variant;
28925 const GValue *cur_value;
28926
28927 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
28928 if (!_g_value_equal (cur_value, &cp->orig_value))
28929 {
28930 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
28931 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
28932 g_variant_unref (variant);
28933 num_changes++;
28934 }
28935 }
28936 if (num_changes > 0)
28937 {
28938 GList *connections, *ll;
28939 GVariant *signal_variant;
28940 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Led",
28941 &builder, &invalidated_builder));
28942 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
28943 for (ll = connections; ll != NULL; ll = ll->next)
28944 {
28945 GDBusConnection *connection = ll->data;
28946
28947 g_dbus_connection_emit_signal (connection,
28948 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
28949 "org.freedesktop.DBus.Properties",
28950 "PropertiesChanged",
28951 signal_variant,
28952 NULL);
28953 }
28954 g_variant_unref (signal_variant);
28955 g_list_free_full (connections, g_object_unref);
28956 }
28957 else
28958 {
28959 g_variant_builder_clear (&builder);
28960 g_variant_builder_clear (&invalidated_builder);
28961 }
28962 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
28963 skeleton->priv->changed_properties = NULL;
28964 skeleton->priv->changed_properties_idle_source = NULL;
28965 g_mutex_unlock (&skeleton->priv->lock);
28966 return FALSE;
28967}
28968
28969static void
28970_led_schedule_emit_changed (LedSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
28971{
28972 ChangedProperty *cp;
28973 GList *l;
28974 cp = NULL;
28975 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
28976 {
28977 ChangedProperty *i_cp = l->data;
28978 if (i_cp->info == info)
28979 {
28980 cp = i_cp;
28981 break;
28982 }
28983 }
28984 if (cp == NULL)
28985 {
28986 cp = g_new0 (ChangedProperty, 1);
28987 cp->prop_id = prop_id;
28988 cp->info = info;
28989 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
28990 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
28991 g_value_copy (orig_value, &cp->orig_value);
28992 }
28993}
28994
28995static void
28996led_skeleton_notify (GObject *object,
28997 GParamSpec *pspec G_GNUC_UNUSED)
28998{
28999 LedSkeleton *skeleton = LED_SKELETON (object);
29000 g_mutex_lock (&skeleton->priv->lock);
29001 if (skeleton->priv->changed_properties != NULL &&
29002 skeleton->priv->changed_properties_idle_source == NULL)
29003 {
29004 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
29005 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
29006 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _led_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
29007 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
29008 g_source_unref (skeleton->priv->changed_properties_idle_source);
29009 }
29010 g_mutex_unlock (&skeleton->priv->lock);
29011}
29012
29013static void
29014led_skeleton_set_property (GObject *object,
29015 guint prop_id,
29016 const GValue *value,
29017 GParamSpec *pspec)
29018{
29019 LedSkeleton *skeleton = LED_SKELETON (object);
Norman James493996c2015-10-31 17:27:13 -050029020 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -050029021 g_mutex_lock (&skeleton->priv->lock);
29022 g_object_freeze_notify (object);
29023 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
29024 {
29025 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
29026 _led_schedule_emit_changed (skeleton, _led_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
29027 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
29028 g_object_notify_by_pspec (object, pspec);
29029 }
29030 g_mutex_unlock (&skeleton->priv->lock);
29031 g_object_thaw_notify (object);
29032}
29033
29034static void
29035led_skeleton_init (LedSkeleton *skeleton)
29036{
29037#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
29038 skeleton->priv = led_skeleton_get_instance_private (skeleton);
29039#else
29040 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_LED_SKELETON, LedSkeletonPrivate);
29041#endif
29042
29043 g_mutex_init (&skeleton->priv->lock);
29044 skeleton->priv->context = g_main_context_ref_thread_default ();
Norman James493996c2015-10-31 17:27:13 -050029045 skeleton->priv->properties = g_new0 (GValue, 3);
Norman James362a80f2015-09-14 14:04:39 -050029046 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
29047 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
Norman James493996c2015-10-31 17:27:13 -050029048 g_value_init (&skeleton->priv->properties[2], G_TYPE_STRING);
Norman James362a80f2015-09-14 14:04:39 -050029049}
29050
29051static gint
29052led_skeleton_get_color (Led *object)
29053{
29054 LedSkeleton *skeleton = LED_SKELETON (object);
29055 gint value;
29056 g_mutex_lock (&skeleton->priv->lock);
29057 value = g_value_get_int (&(skeleton->priv->properties[0]));
29058 g_mutex_unlock (&skeleton->priv->lock);
29059 return value;
29060}
29061
29062static const gchar *
29063led_skeleton_get_function (Led *object)
29064{
29065 LedSkeleton *skeleton = LED_SKELETON (object);
29066 const gchar *value;
29067 g_mutex_lock (&skeleton->priv->lock);
29068 value = g_value_get_string (&(skeleton->priv->properties[1]));
29069 g_mutex_unlock (&skeleton->priv->lock);
29070 return value;
29071}
29072
Norman James493996c2015-10-31 17:27:13 -050029073static const gchar *
29074led_skeleton_get_state (Led *object)
29075{
29076 LedSkeleton *skeleton = LED_SKELETON (object);
29077 const gchar *value;
29078 g_mutex_lock (&skeleton->priv->lock);
29079 value = g_value_get_string (&(skeleton->priv->properties[2]));
29080 g_mutex_unlock (&skeleton->priv->lock);
29081 return value;
29082}
29083
Norman James362a80f2015-09-14 14:04:39 -050029084static void
29085led_skeleton_class_init (LedSkeletonClass *klass)
29086{
29087 GObjectClass *gobject_class;
29088 GDBusInterfaceSkeletonClass *skeleton_class;
29089
29090 gobject_class = G_OBJECT_CLASS (klass);
29091 gobject_class->finalize = led_skeleton_finalize;
29092 gobject_class->get_property = led_skeleton_get_property;
29093 gobject_class->set_property = led_skeleton_set_property;
29094 gobject_class->notify = led_skeleton_notify;
29095
29096
29097 led_override_properties (gobject_class, 1);
29098
29099 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
29100 skeleton_class->get_info = led_skeleton_dbus_interface_get_info;
29101 skeleton_class->get_properties = led_skeleton_dbus_interface_get_properties;
29102 skeleton_class->flush = led_skeleton_dbus_interface_flush;
29103 skeleton_class->get_vtable = led_skeleton_dbus_interface_get_vtable;
29104
29105#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
29106 g_type_class_add_private (klass, sizeof (LedSkeletonPrivate));
29107#endif
29108}
29109
29110static void
29111led_skeleton_iface_init (LedIface *iface)
29112{
29113 iface->get_color = led_skeleton_get_color;
29114 iface->get_function = led_skeleton_get_function;
Norman James493996c2015-10-31 17:27:13 -050029115 iface->get_state = led_skeleton_get_state;
Norman James362a80f2015-09-14 14:04:39 -050029116}
29117
29118/**
29119 * led_skeleton_new:
29120 *
29121 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>.
29122 *
29123 * Returns: (transfer full) (type LedSkeleton): The skeleton object.
29124 */
29125Led *
29126led_skeleton_new (void)
29127{
29128 return LED (g_object_new (TYPE_LED_SKELETON, NULL));
29129}
29130
29131/* ------------------------------------------------------------------------
Norman Jamesdbcffbd2015-10-06 16:53:06 -050029132 * Code for interface org.openbmc.HostIpmi
29133 * ------------------------------------------------------------------------
29134 */
29135
29136/**
29137 * SECTION:HostIpmi
29138 * @title: HostIpmi
29139 * @short_description: Generated C code for the org.openbmc.HostIpmi D-Bus interface
29140 *
29141 * 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.
29142 */
29143
29144/* ---- Introspection data for org.openbmc.HostIpmi ---- */
29145
29146static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_IN_ARG_seq =
29147{
29148 {
29149 -1,
29150 (gchar *) "seq",
29151 (gchar *) "y",
29152 NULL
29153 },
29154 FALSE
29155};
29156
29157static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_IN_ARG_netfn =
29158{
29159 {
29160 -1,
29161 (gchar *) "netfn",
29162 (gchar *) "y",
29163 NULL
29164 },
29165 FALSE
29166};
29167
29168static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_IN_ARG_cmd =
29169{
29170 {
29171 -1,
29172 (gchar *) "cmd",
29173 (gchar *) "y",
29174 NULL
29175 },
29176 FALSE
29177};
29178
29179static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_IN_ARG_data =
29180{
29181 {
29182 -1,
29183 (gchar *) "data",
29184 (gchar *) "ay",
29185 NULL
29186 },
29187 FALSE
29188};
29189
29190static const _ExtendedGDBusArgInfo * const _host_ipmi_method_info_send_message_IN_ARG_pointers[] =
29191{
29192 &_host_ipmi_method_info_send_message_IN_ARG_seq,
29193 &_host_ipmi_method_info_send_message_IN_ARG_netfn,
29194 &_host_ipmi_method_info_send_message_IN_ARG_cmd,
29195 &_host_ipmi_method_info_send_message_IN_ARG_data,
29196 NULL
29197};
29198
29199static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_OUT_ARG_unnamed_arg4 =
29200{
29201 {
29202 -1,
29203 (gchar *) "unnamed_arg4",
29204 (gchar *) "x",
29205 NULL
29206 },
29207 FALSE
29208};
29209
29210static const _ExtendedGDBusArgInfo * const _host_ipmi_method_info_send_message_OUT_ARG_pointers[] =
29211{
29212 &_host_ipmi_method_info_send_message_OUT_ARG_unnamed_arg4,
29213 NULL
29214};
29215
29216static const _ExtendedGDBusMethodInfo _host_ipmi_method_info_send_message =
29217{
29218 {
29219 -1,
29220 (gchar *) "sendMessage",
29221 (GDBusArgInfo **) &_host_ipmi_method_info_send_message_IN_ARG_pointers,
29222 (GDBusArgInfo **) &_host_ipmi_method_info_send_message_OUT_ARG_pointers,
29223 NULL
29224 },
29225 "handle-send-message",
29226 FALSE
29227};
29228
29229static const _ExtendedGDBusMethodInfo * const _host_ipmi_method_info_pointers[] =
29230{
29231 &_host_ipmi_method_info_send_message,
29232 NULL
29233};
29234
29235static const _ExtendedGDBusArgInfo _host_ipmi_signal_info_received_message_ARG_seq =
29236{
29237 {
29238 -1,
29239 (gchar *) "seq",
29240 (gchar *) "y",
29241 NULL
29242 },
29243 FALSE
29244};
29245
29246static const _ExtendedGDBusArgInfo _host_ipmi_signal_info_received_message_ARG_netfn =
29247{
29248 {
29249 -1,
29250 (gchar *) "netfn",
29251 (gchar *) "y",
29252 NULL
29253 },
29254 FALSE
29255};
29256
29257static const _ExtendedGDBusArgInfo _host_ipmi_signal_info_received_message_ARG_cmd =
29258{
29259 {
29260 -1,
29261 (gchar *) "cmd",
29262 (gchar *) "y",
29263 NULL
29264 },
29265 FALSE
29266};
29267
29268static const _ExtendedGDBusArgInfo _host_ipmi_signal_info_received_message_ARG_data =
29269{
29270 {
29271 -1,
29272 (gchar *) "data",
29273 (gchar *) "ay",
29274 NULL
29275 },
29276 FALSE
29277};
29278
29279static const _ExtendedGDBusArgInfo * const _host_ipmi_signal_info_received_message_ARG_pointers[] =
29280{
29281 &_host_ipmi_signal_info_received_message_ARG_seq,
29282 &_host_ipmi_signal_info_received_message_ARG_netfn,
29283 &_host_ipmi_signal_info_received_message_ARG_cmd,
29284 &_host_ipmi_signal_info_received_message_ARG_data,
29285 NULL
29286};
29287
29288static const _ExtendedGDBusSignalInfo _host_ipmi_signal_info_received_message =
29289{
29290 {
29291 -1,
29292 (gchar *) "ReceivedMessage",
29293 (GDBusArgInfo **) &_host_ipmi_signal_info_received_message_ARG_pointers,
29294 NULL
29295 },
29296 "received-message"
29297};
29298
29299static const _ExtendedGDBusSignalInfo * const _host_ipmi_signal_info_pointers[] =
29300{
29301 &_host_ipmi_signal_info_received_message,
29302 NULL
29303};
29304
29305static const _ExtendedGDBusInterfaceInfo _host_ipmi_interface_info =
29306{
29307 {
29308 -1,
29309 (gchar *) "org.openbmc.HostIpmi",
29310 (GDBusMethodInfo **) &_host_ipmi_method_info_pointers,
29311 (GDBusSignalInfo **) &_host_ipmi_signal_info_pointers,
29312 NULL,
29313 NULL
29314 },
29315 "host-ipmi",
29316};
29317
29318
29319/**
29320 * host_ipmi_interface_info:
29321 *
29322 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link> D-Bus interface.
29323 *
29324 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
29325 */
29326GDBusInterfaceInfo *
29327host_ipmi_interface_info (void)
29328{
29329 return (GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct;
29330}
29331
29332/**
29333 * host_ipmi_override_properties:
29334 * @klass: The class structure for a #GObject<!-- -->-derived class.
29335 * @property_id_begin: The property id to assign to the first overridden property.
29336 *
29337 * Overrides all #GObject properties in the #HostIpmi interface for a concrete class.
29338 * The properties are overridden in the order they are defined.
29339 *
29340 * Returns: The last property id.
29341 */
29342guint
29343host_ipmi_override_properties (GObjectClass *klass, guint property_id_begin)
29344{
29345 return property_id_begin - 1;
29346}
29347
29348
29349
29350/**
29351 * HostIpmi:
29352 *
29353 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link>.
29354 */
29355
29356/**
29357 * HostIpmiIface:
29358 * @parent_iface: The parent interface.
29359 * @handle_send_message: Handler for the #HostIpmi::handle-send-message signal.
29360 * @received_message: Handler for the #HostIpmi::received-message signal.
29361 *
29362 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link>.
29363 */
29364
29365typedef HostIpmiIface HostIpmiInterface;
29366G_DEFINE_INTERFACE (HostIpmi, host_ipmi, G_TYPE_OBJECT);
29367
29368static void
29369host_ipmi_default_init (HostIpmiIface *iface)
29370{
29371 /* GObject signals for incoming D-Bus method calls: */
29372 /**
29373 * HostIpmi::handle-send-message:
29374 * @object: A #HostIpmi.
29375 * @invocation: A #GDBusMethodInvocation.
29376 * @arg_seq: Argument passed by remote caller.
29377 * @arg_netfn: Argument passed by remote caller.
29378 * @arg_cmd: Argument passed by remote caller.
29379 * @arg_data: Argument passed by remote caller.
29380 *
29381 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-HostIpmi.sendMessage">sendMessage()</link> D-Bus method.
29382 *
29383 * 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.
29384 *
29385 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
29386 */
29387 g_signal_new ("handle-send-message",
29388 G_TYPE_FROM_INTERFACE (iface),
29389 G_SIGNAL_RUN_LAST,
29390 G_STRUCT_OFFSET (HostIpmiIface, handle_send_message),
29391 g_signal_accumulator_true_handled,
29392 NULL,
29393 g_cclosure_marshal_generic,
29394 G_TYPE_BOOLEAN,
29395 5,
29396 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_UCHAR, G_TYPE_UCHAR, G_TYPE_UCHAR, G_TYPE_STRING);
29397
29398 /* GObject signals for received D-Bus signals: */
29399 /**
29400 * HostIpmi::received-message:
29401 * @object: A #HostIpmi.
29402 * @arg_seq: Argument.
29403 * @arg_netfn: Argument.
29404 * @arg_cmd: Argument.
29405 * @arg_data: Argument.
29406 *
29407 * 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.
29408 *
29409 * 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.
29410 */
29411 g_signal_new ("received-message",
29412 G_TYPE_FROM_INTERFACE (iface),
29413 G_SIGNAL_RUN_LAST,
29414 G_STRUCT_OFFSET (HostIpmiIface, received_message),
29415 NULL,
29416 NULL,
29417 g_cclosure_marshal_generic,
29418 G_TYPE_NONE,
29419 4, G_TYPE_UCHAR, G_TYPE_UCHAR, G_TYPE_UCHAR, G_TYPE_STRING);
29420
29421}
29422
29423/**
29424 * host_ipmi_emit_received_message:
29425 * @object: A #HostIpmi.
29426 * @arg_seq: Argument to pass with the signal.
29427 * @arg_netfn: Argument to pass with the signal.
29428 * @arg_cmd: Argument to pass with the signal.
29429 * @arg_data: Argument to pass with the signal.
29430 *
29431 * Emits the <link linkend="gdbus-signal-org-openbmc-HostIpmi.ReceivedMessage">"ReceivedMessage"</link> D-Bus signal.
29432 */
29433void
29434host_ipmi_emit_received_message (
29435 HostIpmi *object,
29436 guchar arg_seq,
29437 guchar arg_netfn,
29438 guchar arg_cmd,
29439 const gchar *arg_data)
29440{
29441 g_signal_emit_by_name (object, "received-message", arg_seq, arg_netfn, arg_cmd, arg_data);
29442}
29443
29444/**
29445 * host_ipmi_call_send_message:
29446 * @proxy: A #HostIpmiProxy.
29447 * @arg_seq: Argument to pass with the method invocation.
29448 * @arg_netfn: Argument to pass with the method invocation.
29449 * @arg_cmd: Argument to pass with the method invocation.
29450 * @arg_data: Argument to pass with the method invocation.
29451 * @cancellable: (allow-none): A #GCancellable or %NULL.
29452 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
29453 * @user_data: User data to pass to @callback.
29454 *
29455 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-HostIpmi.sendMessage">sendMessage()</link> D-Bus method on @proxy.
29456 * 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.
29457 * You can then call host_ipmi_call_send_message_finish() to get the result of the operation.
29458 *
29459 * See host_ipmi_call_send_message_sync() for the synchronous, blocking version of this method.
29460 */
29461void
29462host_ipmi_call_send_message (
29463 HostIpmi *proxy,
29464 guchar arg_seq,
29465 guchar arg_netfn,
29466 guchar arg_cmd,
29467 const gchar *arg_data,
29468 GCancellable *cancellable,
29469 GAsyncReadyCallback callback,
29470 gpointer user_data)
29471{
29472 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
29473 "sendMessage",
29474 g_variant_new ("(yyy^ay)",
29475 arg_seq,
29476 arg_netfn,
29477 arg_cmd,
29478 arg_data),
29479 G_DBUS_CALL_FLAGS_NONE,
29480 -1,
29481 cancellable,
29482 callback,
29483 user_data);
29484}
29485
29486/**
29487 * host_ipmi_call_send_message_finish:
29488 * @proxy: A #HostIpmiProxy.
29489 * @out_unnamed_arg4: (out): Return location for return parameter or %NULL to ignore.
29490 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to host_ipmi_call_send_message().
29491 * @error: Return location for error or %NULL.
29492 *
29493 * Finishes an operation started with host_ipmi_call_send_message().
29494 *
29495 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
29496 */
29497gboolean
29498host_ipmi_call_send_message_finish (
29499 HostIpmi *proxy,
29500 gint64 *out_unnamed_arg4,
29501 GAsyncResult *res,
29502 GError **error)
29503{
29504 GVariant *_ret;
29505 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
29506 if (_ret == NULL)
29507 goto _out;
29508 g_variant_get (_ret,
29509 "(x)",
29510 out_unnamed_arg4);
29511 g_variant_unref (_ret);
29512_out:
29513 return _ret != NULL;
29514}
29515
29516/**
29517 * host_ipmi_call_send_message_sync:
29518 * @proxy: A #HostIpmiProxy.
29519 * @arg_seq: Argument to pass with the method invocation.
29520 * @arg_netfn: Argument to pass with the method invocation.
29521 * @arg_cmd: Argument to pass with the method invocation.
29522 * @arg_data: Argument to pass with the method invocation.
29523 * @out_unnamed_arg4: (out): Return location for return parameter or %NULL to ignore.
29524 * @cancellable: (allow-none): A #GCancellable or %NULL.
29525 * @error: Return location for error or %NULL.
29526 *
29527 * 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.
29528 *
29529 * See host_ipmi_call_send_message() for the asynchronous version of this method.
29530 *
29531 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
29532 */
29533gboolean
29534host_ipmi_call_send_message_sync (
29535 HostIpmi *proxy,
29536 guchar arg_seq,
29537 guchar arg_netfn,
29538 guchar arg_cmd,
29539 const gchar *arg_data,
29540 gint64 *out_unnamed_arg4,
29541 GCancellable *cancellable,
29542 GError **error)
29543{
29544 GVariant *_ret;
29545 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
29546 "sendMessage",
29547 g_variant_new ("(yyy^ay)",
29548 arg_seq,
29549 arg_netfn,
29550 arg_cmd,
29551 arg_data),
29552 G_DBUS_CALL_FLAGS_NONE,
29553 -1,
29554 cancellable,
29555 error);
29556 if (_ret == NULL)
29557 goto _out;
29558 g_variant_get (_ret,
29559 "(x)",
29560 out_unnamed_arg4);
29561 g_variant_unref (_ret);
29562_out:
29563 return _ret != NULL;
29564}
29565
29566/**
29567 * host_ipmi_complete_send_message:
29568 * @object: A #HostIpmi.
29569 * @invocation: (transfer full): A #GDBusMethodInvocation.
29570 * @unnamed_arg4: Parameter to return.
29571 *
29572 * 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.
29573 *
29574 * This method will free @invocation, you cannot use it afterwards.
29575 */
29576void
29577host_ipmi_complete_send_message (
29578 HostIpmi *object,
29579 GDBusMethodInvocation *invocation,
29580 gint64 unnamed_arg4)
29581{
29582 g_dbus_method_invocation_return_value (invocation,
29583 g_variant_new ("(x)",
29584 unnamed_arg4));
29585}
29586
29587/* ------------------------------------------------------------------------ */
29588
29589/**
29590 * HostIpmiProxy:
29591 *
29592 * The #HostIpmiProxy structure contains only private data and should only be accessed using the provided API.
29593 */
29594
29595/**
29596 * HostIpmiProxyClass:
29597 * @parent_class: The parent class.
29598 *
29599 * Class structure for #HostIpmiProxy.
29600 */
29601
29602struct _HostIpmiProxyPrivate
29603{
29604 GData *qdata;
29605};
29606
29607static void host_ipmi_proxy_iface_init (HostIpmiIface *iface);
29608
29609#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
29610G_DEFINE_TYPE_WITH_CODE (HostIpmiProxy, host_ipmi_proxy, G_TYPE_DBUS_PROXY,
29611 G_ADD_PRIVATE (HostIpmiProxy)
29612 G_IMPLEMENT_INTERFACE (TYPE_HOST_IPMI, host_ipmi_proxy_iface_init));
29613
29614#else
29615G_DEFINE_TYPE_WITH_CODE (HostIpmiProxy, host_ipmi_proxy, G_TYPE_DBUS_PROXY,
29616 G_IMPLEMENT_INTERFACE (TYPE_HOST_IPMI, host_ipmi_proxy_iface_init));
29617
29618#endif
29619static void
29620host_ipmi_proxy_finalize (GObject *object)
29621{
29622 HostIpmiProxy *proxy = HOST_IPMI_PROXY (object);
29623 g_datalist_clear (&proxy->priv->qdata);
29624 G_OBJECT_CLASS (host_ipmi_proxy_parent_class)->finalize (object);
29625}
29626
29627static void
29628host_ipmi_proxy_get_property (GObject *object,
29629 guint prop_id,
29630 GValue *value,
29631 GParamSpec *pspec G_GNUC_UNUSED)
29632{
29633}
29634
29635static void
29636host_ipmi_proxy_set_property (GObject *object,
29637 guint prop_id,
29638 const GValue *value,
29639 GParamSpec *pspec G_GNUC_UNUSED)
29640{
29641}
29642
29643static void
29644host_ipmi_proxy_g_signal (GDBusProxy *proxy,
29645 const gchar *sender_name G_GNUC_UNUSED,
29646 const gchar *signal_name,
29647 GVariant *parameters)
29648{
29649 _ExtendedGDBusSignalInfo *info;
29650 GVariantIter iter;
29651 GVariant *child;
29652 GValue *paramv;
29653 guint num_params;
29654 guint n;
29655 guint signal_id;
29656 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, signal_name);
29657 if (info == NULL)
29658 return;
29659 num_params = g_variant_n_children (parameters);
29660 paramv = g_new0 (GValue, num_params + 1);
29661 g_value_init (&paramv[0], TYPE_HOST_IPMI);
29662 g_value_set_object (&paramv[0], proxy);
29663 g_variant_iter_init (&iter, parameters);
29664 n = 1;
29665 while ((child = g_variant_iter_next_value (&iter)) != NULL)
29666 {
29667 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
29668 if (arg_info->use_gvariant)
29669 {
29670 g_value_init (&paramv[n], G_TYPE_VARIANT);
29671 g_value_set_variant (&paramv[n], child);
29672 n++;
29673 }
29674 else
29675 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
29676 g_variant_unref (child);
29677 }
29678 signal_id = g_signal_lookup (info->signal_name, TYPE_HOST_IPMI);
29679 g_signal_emitv (paramv, signal_id, 0, NULL);
29680 for (n = 0; n < num_params + 1; n++)
29681 g_value_unset (&paramv[n]);
29682 g_free (paramv);
29683}
29684
29685static void
29686host_ipmi_proxy_g_properties_changed (GDBusProxy *_proxy,
29687 GVariant *changed_properties,
29688 const gchar *const *invalidated_properties)
29689{
29690 HostIpmiProxy *proxy = HOST_IPMI_PROXY (_proxy);
29691 guint n;
29692 const gchar *key;
29693 GVariantIter *iter;
29694 _ExtendedGDBusPropertyInfo *info;
29695 g_variant_get (changed_properties, "a{sv}", &iter);
29696 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
29697 {
29698 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, key);
29699 g_datalist_remove_data (&proxy->priv->qdata, key);
29700 if (info != NULL)
29701 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
29702 }
29703 g_variant_iter_free (iter);
29704 for (n = 0; invalidated_properties[n] != NULL; n++)
29705 {
29706 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, invalidated_properties[n]);
29707 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
29708 if (info != NULL)
29709 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
29710 }
29711}
29712
29713static void
29714host_ipmi_proxy_init (HostIpmiProxy *proxy)
29715{
29716#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
29717 proxy->priv = host_ipmi_proxy_get_instance_private (proxy);
29718#else
29719 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_HOST_IPMI_PROXY, HostIpmiProxyPrivate);
29720#endif
29721
29722 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), host_ipmi_interface_info ());
29723}
29724
29725static void
29726host_ipmi_proxy_class_init (HostIpmiProxyClass *klass)
29727{
29728 GObjectClass *gobject_class;
29729 GDBusProxyClass *proxy_class;
29730
29731 gobject_class = G_OBJECT_CLASS (klass);
29732 gobject_class->finalize = host_ipmi_proxy_finalize;
29733 gobject_class->get_property = host_ipmi_proxy_get_property;
29734 gobject_class->set_property = host_ipmi_proxy_set_property;
29735
29736 proxy_class = G_DBUS_PROXY_CLASS (klass);
29737 proxy_class->g_signal = host_ipmi_proxy_g_signal;
29738 proxy_class->g_properties_changed = host_ipmi_proxy_g_properties_changed;
29739
29740#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
29741 g_type_class_add_private (klass, sizeof (HostIpmiProxyPrivate));
29742#endif
29743}
29744
29745static void
29746host_ipmi_proxy_iface_init (HostIpmiIface *iface)
29747{
29748}
29749
29750/**
29751 * host_ipmi_proxy_new:
29752 * @connection: A #GDBusConnection.
29753 * @flags: Flags from the #GDBusProxyFlags enumeration.
29754 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
29755 * @object_path: An object path.
29756 * @cancellable: (allow-none): A #GCancellable or %NULL.
29757 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
29758 * @user_data: User data to pass to @callback.
29759 *
29760 * 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.
29761 *
29762 * 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.
29763 * You can then call host_ipmi_proxy_new_finish() to get the result of the operation.
29764 *
29765 * See host_ipmi_proxy_new_sync() for the synchronous, blocking version of this constructor.
29766 */
29767void
29768host_ipmi_proxy_new (
29769 GDBusConnection *connection,
29770 GDBusProxyFlags flags,
29771 const gchar *name,
29772 const gchar *object_path,
29773 GCancellable *cancellable,
29774 GAsyncReadyCallback callback,
29775 gpointer user_data)
29776{
29777 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);
29778}
29779
29780/**
29781 * host_ipmi_proxy_new_finish:
29782 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to host_ipmi_proxy_new().
29783 * @error: Return location for error or %NULL
29784 *
29785 * Finishes an operation started with host_ipmi_proxy_new().
29786 *
29787 * Returns: (transfer full) (type HostIpmiProxy): The constructed proxy object or %NULL if @error is set.
29788 */
29789HostIpmi *
29790host_ipmi_proxy_new_finish (
29791 GAsyncResult *res,
29792 GError **error)
29793{
29794 GObject *ret;
29795 GObject *source_object;
29796 source_object = g_async_result_get_source_object (res);
29797 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
29798 g_object_unref (source_object);
29799 if (ret != NULL)
29800 return HOST_IPMI (ret);
29801 else
29802 return NULL;
29803}
29804
29805/**
29806 * host_ipmi_proxy_new_sync:
29807 * @connection: A #GDBusConnection.
29808 * @flags: Flags from the #GDBusProxyFlags enumeration.
29809 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
29810 * @object_path: An object path.
29811 * @cancellable: (allow-none): A #GCancellable or %NULL.
29812 * @error: Return location for error or %NULL
29813 *
29814 * 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.
29815 *
29816 * The calling thread is blocked until a reply is received.
29817 *
29818 * See host_ipmi_proxy_new() for the asynchronous version of this constructor.
29819 *
29820 * Returns: (transfer full) (type HostIpmiProxy): The constructed proxy object or %NULL if @error is set.
29821 */
29822HostIpmi *
29823host_ipmi_proxy_new_sync (
29824 GDBusConnection *connection,
29825 GDBusProxyFlags flags,
29826 const gchar *name,
29827 const gchar *object_path,
29828 GCancellable *cancellable,
29829 GError **error)
29830{
29831 GInitable *ret;
29832 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);
29833 if (ret != NULL)
29834 return HOST_IPMI (ret);
29835 else
29836 return NULL;
29837}
29838
29839
29840/**
29841 * host_ipmi_proxy_new_for_bus:
29842 * @bus_type: A #GBusType.
29843 * @flags: Flags from the #GDBusProxyFlags enumeration.
29844 * @name: A bus name (well-known or unique).
29845 * @object_path: An object path.
29846 * @cancellable: (allow-none): A #GCancellable or %NULL.
29847 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
29848 * @user_data: User data to pass to @callback.
29849 *
29850 * Like host_ipmi_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
29851 *
29852 * 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.
29853 * You can then call host_ipmi_proxy_new_for_bus_finish() to get the result of the operation.
29854 *
29855 * See host_ipmi_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
29856 */
29857void
29858host_ipmi_proxy_new_for_bus (
29859 GBusType bus_type,
29860 GDBusProxyFlags flags,
29861 const gchar *name,
29862 const gchar *object_path,
29863 GCancellable *cancellable,
29864 GAsyncReadyCallback callback,
29865 gpointer user_data)
29866{
29867 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);
29868}
29869
29870/**
29871 * host_ipmi_proxy_new_for_bus_finish:
29872 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to host_ipmi_proxy_new_for_bus().
29873 * @error: Return location for error or %NULL
29874 *
29875 * Finishes an operation started with host_ipmi_proxy_new_for_bus().
29876 *
29877 * Returns: (transfer full) (type HostIpmiProxy): The constructed proxy object or %NULL if @error is set.
29878 */
29879HostIpmi *
29880host_ipmi_proxy_new_for_bus_finish (
29881 GAsyncResult *res,
29882 GError **error)
29883{
29884 GObject *ret;
29885 GObject *source_object;
29886 source_object = g_async_result_get_source_object (res);
29887 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
29888 g_object_unref (source_object);
29889 if (ret != NULL)
29890 return HOST_IPMI (ret);
29891 else
29892 return NULL;
29893}
29894
29895/**
29896 * host_ipmi_proxy_new_for_bus_sync:
29897 * @bus_type: A #GBusType.
29898 * @flags: Flags from the #GDBusProxyFlags enumeration.
29899 * @name: A bus name (well-known or unique).
29900 * @object_path: An object path.
29901 * @cancellable: (allow-none): A #GCancellable or %NULL.
29902 * @error: Return location for error or %NULL
29903 *
29904 * Like host_ipmi_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
29905 *
29906 * The calling thread is blocked until a reply is received.
29907 *
29908 * See host_ipmi_proxy_new_for_bus() for the asynchronous version of this constructor.
29909 *
29910 * Returns: (transfer full) (type HostIpmiProxy): The constructed proxy object or %NULL if @error is set.
29911 */
29912HostIpmi *
29913host_ipmi_proxy_new_for_bus_sync (
29914 GBusType bus_type,
29915 GDBusProxyFlags flags,
29916 const gchar *name,
29917 const gchar *object_path,
29918 GCancellable *cancellable,
29919 GError **error)
29920{
29921 GInitable *ret;
29922 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);
29923 if (ret != NULL)
29924 return HOST_IPMI (ret);
29925 else
29926 return NULL;
29927}
29928
29929
29930/* ------------------------------------------------------------------------ */
29931
29932/**
29933 * HostIpmiSkeleton:
29934 *
29935 * The #HostIpmiSkeleton structure contains only private data and should only be accessed using the provided API.
29936 */
29937
29938/**
29939 * HostIpmiSkeletonClass:
29940 * @parent_class: The parent class.
29941 *
29942 * Class structure for #HostIpmiSkeleton.
29943 */
29944
29945struct _HostIpmiSkeletonPrivate
29946{
29947 GValue *properties;
29948 GList *changed_properties;
29949 GSource *changed_properties_idle_source;
29950 GMainContext *context;
29951 GMutex lock;
29952};
29953
29954static void
29955_host_ipmi_skeleton_handle_method_call (
29956 GDBusConnection *connection G_GNUC_UNUSED,
29957 const gchar *sender G_GNUC_UNUSED,
29958 const gchar *object_path G_GNUC_UNUSED,
29959 const gchar *interface_name,
29960 const gchar *method_name,
29961 GVariant *parameters,
29962 GDBusMethodInvocation *invocation,
29963 gpointer user_data)
29964{
29965 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (user_data);
29966 _ExtendedGDBusMethodInfo *info;
29967 GVariantIter iter;
29968 GVariant *child;
29969 GValue *paramv;
29970 guint num_params;
29971 guint num_extra;
29972 guint n;
29973 guint signal_id;
29974 GValue return_value = G_VALUE_INIT;
29975 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
29976 g_assert (info != NULL);
29977 num_params = g_variant_n_children (parameters);
29978 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
29979 n = 0;
29980 g_value_init (&paramv[n], TYPE_HOST_IPMI);
29981 g_value_set_object (&paramv[n++], skeleton);
29982 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
29983 g_value_set_object (&paramv[n++], invocation);
29984 if (info->pass_fdlist)
29985 {
29986#ifdef G_OS_UNIX
29987 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
29988 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
29989#else
29990 g_assert_not_reached ();
29991#endif
29992 }
29993 g_variant_iter_init (&iter, parameters);
29994 while ((child = g_variant_iter_next_value (&iter)) != NULL)
29995 {
29996 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
29997 if (arg_info->use_gvariant)
29998 {
29999 g_value_init (&paramv[n], G_TYPE_VARIANT);
30000 g_value_set_variant (&paramv[n], child);
30001 n++;
30002 }
30003 else
30004 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
30005 g_variant_unref (child);
30006 }
30007 signal_id = g_signal_lookup (info->signal_name, TYPE_HOST_IPMI);
30008 g_value_init (&return_value, G_TYPE_BOOLEAN);
30009 g_signal_emitv (paramv, signal_id, 0, &return_value);
30010 if (!g_value_get_boolean (&return_value))
30011 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);
30012 g_value_unset (&return_value);
30013 for (n = 0; n < num_params + num_extra; n++)
30014 g_value_unset (&paramv[n]);
30015 g_free (paramv);
30016}
30017
30018static GVariant *
30019_host_ipmi_skeleton_handle_get_property (
30020 GDBusConnection *connection G_GNUC_UNUSED,
30021 const gchar *sender G_GNUC_UNUSED,
30022 const gchar *object_path G_GNUC_UNUSED,
30023 const gchar *interface_name G_GNUC_UNUSED,
30024 const gchar *property_name,
30025 GError **error,
30026 gpointer user_data)
30027{
30028 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (user_data);
30029 GValue value = G_VALUE_INIT;
30030 GParamSpec *pspec;
30031 _ExtendedGDBusPropertyInfo *info;
30032 GVariant *ret;
30033 ret = NULL;
30034 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, property_name);
30035 g_assert (info != NULL);
30036 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
30037 if (pspec == NULL)
30038 {
30039 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
30040 }
30041 else
30042 {
30043 g_value_init (&value, pspec->value_type);
30044 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
30045 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
30046 g_value_unset (&value);
30047 }
30048 return ret;
30049}
30050
30051static gboolean
30052_host_ipmi_skeleton_handle_set_property (
30053 GDBusConnection *connection G_GNUC_UNUSED,
30054 const gchar *sender G_GNUC_UNUSED,
30055 const gchar *object_path G_GNUC_UNUSED,
30056 const gchar *interface_name G_GNUC_UNUSED,
30057 const gchar *property_name,
30058 GVariant *variant,
30059 GError **error,
30060 gpointer user_data)
30061{
30062 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (user_data);
30063 GValue value = G_VALUE_INIT;
30064 GParamSpec *pspec;
30065 _ExtendedGDBusPropertyInfo *info;
30066 gboolean ret;
30067 ret = FALSE;
30068 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, property_name);
30069 g_assert (info != NULL);
30070 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
30071 if (pspec == NULL)
30072 {
30073 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
30074 }
30075 else
30076 {
30077 if (info->use_gvariant)
30078 g_value_set_variant (&value, variant);
30079 else
30080 g_dbus_gvariant_to_gvalue (variant, &value);
30081 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
30082 g_value_unset (&value);
30083 ret = TRUE;
30084 }
30085 return ret;
30086}
30087
30088static const GDBusInterfaceVTable _host_ipmi_skeleton_vtable =
30089{
30090 _host_ipmi_skeleton_handle_method_call,
30091 _host_ipmi_skeleton_handle_get_property,
30092 _host_ipmi_skeleton_handle_set_property,
30093 {NULL}
30094};
30095
30096static GDBusInterfaceInfo *
30097host_ipmi_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
30098{
30099 return host_ipmi_interface_info ();
30100}
30101
30102static GDBusInterfaceVTable *
30103host_ipmi_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
30104{
30105 return (GDBusInterfaceVTable *) &_host_ipmi_skeleton_vtable;
30106}
30107
30108static GVariant *
30109host_ipmi_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
30110{
30111 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (_skeleton);
30112
30113 GVariantBuilder builder;
30114 guint n;
30115 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
30116 if (_host_ipmi_interface_info.parent_struct.properties == NULL)
30117 goto out;
30118 for (n = 0; _host_ipmi_interface_info.parent_struct.properties[n] != NULL; n++)
30119 {
30120 GDBusPropertyInfo *info = _host_ipmi_interface_info.parent_struct.properties[n];
30121 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
30122 {
30123 GVariant *value;
30124 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);
30125 if (value != NULL)
30126 {
30127 g_variant_take_ref (value);
30128 g_variant_builder_add (&builder, "{sv}", info->name, value);
30129 g_variant_unref (value);
30130 }
30131 }
30132 }
30133out:
30134 return g_variant_builder_end (&builder);
30135}
30136
30137static void
30138host_ipmi_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
30139{
30140}
30141
30142static void
30143_host_ipmi_on_signal_received_message (
30144 HostIpmi *object,
30145 guchar arg_seq,
30146 guchar arg_netfn,
30147 guchar arg_cmd,
30148 const gchar *arg_data)
30149{
30150 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (object);
30151
30152 GList *connections, *l;
30153 GVariant *signal_variant;
30154 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
30155
30156 signal_variant = g_variant_ref_sink (g_variant_new ("(yyy^ay)",
30157 arg_seq,
30158 arg_netfn,
30159 arg_cmd,
30160 arg_data));
30161 for (l = connections; l != NULL; l = l->next)
30162 {
30163 GDBusConnection *connection = l->data;
30164 g_dbus_connection_emit_signal (connection,
30165 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.HostIpmi", "ReceivedMessage",
30166 signal_variant, NULL);
30167 }
30168 g_variant_unref (signal_variant);
30169 g_list_free_full (connections, g_object_unref);
30170}
30171
30172static void host_ipmi_skeleton_iface_init (HostIpmiIface *iface);
30173#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
30174G_DEFINE_TYPE_WITH_CODE (HostIpmiSkeleton, host_ipmi_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
30175 G_ADD_PRIVATE (HostIpmiSkeleton)
30176 G_IMPLEMENT_INTERFACE (TYPE_HOST_IPMI, host_ipmi_skeleton_iface_init));
30177
30178#else
30179G_DEFINE_TYPE_WITH_CODE (HostIpmiSkeleton, host_ipmi_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
30180 G_IMPLEMENT_INTERFACE (TYPE_HOST_IPMI, host_ipmi_skeleton_iface_init));
30181
30182#endif
30183static void
30184host_ipmi_skeleton_finalize (GObject *object)
30185{
30186 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (object);
30187 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
30188 if (skeleton->priv->changed_properties_idle_source != NULL)
30189 g_source_destroy (skeleton->priv->changed_properties_idle_source);
30190 g_main_context_unref (skeleton->priv->context);
30191 g_mutex_clear (&skeleton->priv->lock);
30192 G_OBJECT_CLASS (host_ipmi_skeleton_parent_class)->finalize (object);
30193}
30194
30195static void
30196host_ipmi_skeleton_init (HostIpmiSkeleton *skeleton)
30197{
30198#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
30199 skeleton->priv = host_ipmi_skeleton_get_instance_private (skeleton);
30200#else
30201 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_HOST_IPMI_SKELETON, HostIpmiSkeletonPrivate);
30202#endif
30203
30204 g_mutex_init (&skeleton->priv->lock);
30205 skeleton->priv->context = g_main_context_ref_thread_default ();
30206}
30207
30208static void
30209host_ipmi_skeleton_class_init (HostIpmiSkeletonClass *klass)
30210{
30211 GObjectClass *gobject_class;
30212 GDBusInterfaceSkeletonClass *skeleton_class;
30213
30214 gobject_class = G_OBJECT_CLASS (klass);
30215 gobject_class->finalize = host_ipmi_skeleton_finalize;
30216
30217 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
30218 skeleton_class->get_info = host_ipmi_skeleton_dbus_interface_get_info;
30219 skeleton_class->get_properties = host_ipmi_skeleton_dbus_interface_get_properties;
30220 skeleton_class->flush = host_ipmi_skeleton_dbus_interface_flush;
30221 skeleton_class->get_vtable = host_ipmi_skeleton_dbus_interface_get_vtable;
30222
30223#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
30224 g_type_class_add_private (klass, sizeof (HostIpmiSkeletonPrivate));
30225#endif
30226}
30227
30228static void
30229host_ipmi_skeleton_iface_init (HostIpmiIface *iface)
30230{
30231 iface->received_message = _host_ipmi_on_signal_received_message;
30232}
30233
30234/**
30235 * host_ipmi_skeleton_new:
30236 *
30237 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link>.
30238 *
30239 * Returns: (transfer full) (type HostIpmiSkeleton): The skeleton object.
30240 */
30241HostIpmi *
30242host_ipmi_skeleton_new (void)
30243{
30244 return HOST_IPMI (g_object_new (TYPE_HOST_IPMI_SKELETON, NULL));
30245}
30246
30247/* ------------------------------------------------------------------------
Norman James362a80f2015-09-14 14:04:39 -050030248 * Code for Object, ObjectProxy and ObjectSkeleton
30249 * ------------------------------------------------------------------------
30250 */
30251
30252/**
30253 * SECTION:Object
30254 * @title: Object
30255 * @short_description: Specialized GDBusObject types
30256 *
30257 * This section contains the #Object, #ObjectProxy, and #ObjectSkeleton types which make it easier to work with objects implementing generated types for D-Bus interfaces.
30258 */
30259
30260/**
30261 * Object:
30262 *
30263 * The #Object type is a specialized container of interfaces.
30264 */
30265
30266/**
30267 * ObjectIface:
30268 * @parent_iface: The parent interface.
30269 *
30270 * Virtual table for the #Object interface.
30271 */
30272
30273typedef ObjectIface ObjectInterface;
30274G_DEFINE_INTERFACE_WITH_CODE (Object, object, G_TYPE_OBJECT, g_type_interface_add_prerequisite (g_define_type_id, G_TYPE_DBUS_OBJECT));
30275
30276static void
30277object_default_init (ObjectIface *iface)
30278{
30279 /**
Norman James493996c2015-10-31 17:27:13 -050030280 * Object:object-mapper:
30281 *
30282 * The #ObjectMapper instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Object-Mapper.top_of_page">org.openbmc.Object.Mapper</link>, if any.
30283 *
30284 * Connect to the #GObject::notify signal to get informed of property changes.
30285 */
30286 g_object_interface_install_property (iface, g_param_spec_object ("object-mapper", "object-mapper", "object-mapper", TYPE_OBJECT_MAPPER, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
30287
30288 /**
Norman James5236a8f2015-11-05 20:39:31 -060030289 * Object:hwmon:
30290 *
30291 * 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.
30292 *
30293 * Connect to the #GObject::notify signal to get informed of property changes.
30294 */
30295 g_object_interface_install_property (iface, g_param_spec_object ("hwmon", "hwmon", "hwmon", TYPE_HWMON, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
30296
30297 /**
Norman James362a80f2015-09-14 14:04:39 -050030298 * Object:fan:
30299 *
30300 * 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.
30301 *
30302 * Connect to the #GObject::notify signal to get informed of property changes.
30303 */
30304 g_object_interface_install_property (iface, g_param_spec_object ("fan", "fan", "fan", TYPE_FAN, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
30305
30306 /**
30307 * Object:sensor-value:
30308 *
30309 * 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.
30310 *
30311 * Connect to the #GObject::notify signal to get informed of property changes.
30312 */
30313 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));
30314
30315 /**
30316 * Object:sensor-threshold:
30317 *
30318 * 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.
30319 *
30320 * Connect to the #GObject::notify signal to get informed of property changes.
30321 */
30322 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));
30323
30324 /**
30325 * Object:sensor-i2c:
30326 *
30327 * 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.
30328 *
30329 * Connect to the #GObject::notify signal to get informed of property changes.
30330 */
30331 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));
30332
30333 /**
30334 * Object:sensor-match:
30335 *
30336 * 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.
30337 *
30338 * Connect to the #GObject::notify signal to get informed of property changes.
30339 */
30340 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));
30341
30342 /**
30343 * Object:process:
30344 *
30345 * 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.
30346 *
30347 * Connect to the #GObject::notify signal to get informed of property changes.
30348 */
30349 g_object_interface_install_property (iface, g_param_spec_object ("process", "process", "process", TYPE_PROCESS, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
30350
30351 /**
Norman James18998182015-10-11 21:54:53 -050030352 * Object:shared-resource:
30353 *
30354 * 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.
30355 *
30356 * Connect to the #GObject::notify signal to get informed of property changes.
30357 */
30358 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));
30359
30360 /**
Norman James362a80f2015-09-14 14:04:39 -050030361 * Object:control:
30362 *
30363 * 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.
30364 *
30365 * Connect to the #GObject::notify signal to get informed of property changes.
30366 */
30367 g_object_interface_install_property (iface, g_param_spec_object ("control", "control", "control", TYPE_CONTROL, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
30368
30369 /**
30370 * Object:control-bmc:
30371 *
30372 * 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.
30373 *
30374 * Connect to the #GObject::notify signal to get informed of property changes.
30375 */
30376 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));
30377
30378 /**
30379 * Object:control-host:
30380 *
30381 * 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.
30382 *
30383 * Connect to the #GObject::notify signal to get informed of property changes.
30384 */
30385 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));
30386
30387 /**
30388 * Object:control-power:
30389 *
30390 * 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.
30391 *
30392 * Connect to the #GObject::notify signal to get informed of property changes.
30393 */
30394 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));
30395
30396 /**
30397 * Object:watchdog:
30398 *
30399 * 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.
30400 *
30401 * Connect to the #GObject::notify signal to get informed of property changes.
30402 */
30403 g_object_interface_install_property (iface, g_param_spec_object ("watchdog", "watchdog", "watchdog", TYPE_WATCHDOG, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
30404
30405 /**
30406 * Object:event-log:
30407 *
30408 * 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.
30409 *
30410 * Connect to the #GObject::notify signal to get informed of property changes.
30411 */
30412 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));
30413
30414 /**
30415 * Object:flash:
30416 *
30417 * 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.
30418 *
30419 * Connect to the #GObject::notify signal to get informed of property changes.
30420 */
30421 g_object_interface_install_property (iface, g_param_spec_object ("flash", "flash", "flash", TYPE_FLASH, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
30422
30423 /**
Norman James18998182015-10-11 21:54:53 -050030424 * Object:flash-control:
30425 *
30426 * 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.
30427 *
30428 * Connect to the #GObject::notify signal to get informed of property changes.
30429 */
30430 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));
30431
30432 /**
Norman James362a80f2015-09-14 14:04:39 -050030433 * Object:button:
30434 *
30435 * 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.
30436 *
30437 * Connect to the #GObject::notify signal to get informed of property changes.
30438 */
30439 g_object_interface_install_property (iface, g_param_spec_object ("button", "button", "button", TYPE_BUTTON, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
30440
30441 /**
30442 * Object:led:
30443 *
30444 * 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.
30445 *
30446 * Connect to the #GObject::notify signal to get informed of property changes.
30447 */
30448 g_object_interface_install_property (iface, g_param_spec_object ("led", "led", "led", TYPE_LED, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
30449
Norman Jamesdbcffbd2015-10-06 16:53:06 -050030450 /**
30451 * Object:host-ipmi:
30452 *
30453 * 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.
30454 *
30455 * Connect to the #GObject::notify signal to get informed of property changes.
30456 */
30457 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));
30458
Norman James362a80f2015-09-14 14:04:39 -050030459}
30460
30461/**
Norman James493996c2015-10-31 17:27:13 -050030462 * object_get_object_mapper:
30463 * @object: A #Object.
30464 *
30465 * Gets the #ObjectMapper instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Object-Mapper.top_of_page">org.openbmc.Object.Mapper</link> on @object, if any.
30466 *
30467 * Returns: (transfer full): A #ObjectMapper that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
30468 */
30469ObjectMapper *object_get_object_mapper (Object *object)
30470{
30471 GDBusInterface *ret;
30472 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Object.Mapper");
30473 if (ret == NULL)
30474 return NULL;
30475 return OBJECT_MAPPER (ret);
30476}
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/**
30683 * object_get_watchdog:
30684 * @object: A #Object.
30685 *
30686 * 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.
30687 *
30688 * Returns: (transfer full): A #Watchdog that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
30689 */
30690Watchdog *object_get_watchdog (Object *object)
30691{
30692 GDBusInterface *ret;
30693 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog");
30694 if (ret == NULL)
30695 return NULL;
30696 return WATCHDOG (ret);
30697}
30698
30699/**
30700 * object_get_event_log:
30701 * @object: A #Object.
30702 *
30703 * 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.
30704 *
30705 * Returns: (transfer full): A #EventLog that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
30706 */
30707EventLog *object_get_event_log (Object *object)
30708{
30709 GDBusInterface *ret;
30710 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
30711 if (ret == NULL)
30712 return NULL;
30713 return EVENT_LOG (ret);
30714}
30715
30716/**
30717 * object_get_flash:
30718 * @object: A #Object.
30719 *
30720 * 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.
30721 *
30722 * Returns: (transfer full): A #Flash that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
30723 */
30724Flash *object_get_flash (Object *object)
30725{
30726 GDBusInterface *ret;
30727 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash");
30728 if (ret == NULL)
30729 return NULL;
30730 return FLASH (ret);
30731}
30732
30733/**
Norman James18998182015-10-11 21:54:53 -050030734 * object_get_flash_control:
30735 * @object: A #Object.
30736 *
30737 * 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.
30738 *
30739 * Returns: (transfer full): A #FlashControl that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
30740 */
30741FlashControl *object_get_flash_control (Object *object)
30742{
30743 GDBusInterface *ret;
30744 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.FlashControl");
30745 if (ret == NULL)
30746 return NULL;
30747 return FLASH_CONTROL (ret);
30748}
30749
30750/**
Norman James362a80f2015-09-14 14:04:39 -050030751 * object_get_button:
30752 * @object: A #Object.
30753 *
30754 * 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.
30755 *
30756 * Returns: (transfer full): A #Button that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
30757 */
30758Button *object_get_button (Object *object)
30759{
30760 GDBusInterface *ret;
30761 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button");
30762 if (ret == NULL)
30763 return NULL;
30764 return BUTTON (ret);
30765}
30766
30767/**
30768 * object_get_led:
30769 * @object: A #Object.
30770 *
30771 * 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.
30772 *
30773 * Returns: (transfer full): A #Led that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
30774 */
30775Led *object_get_led (Object *object)
30776{
30777 GDBusInterface *ret;
30778 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led");
30779 if (ret == NULL)
30780 return NULL;
30781 return LED (ret);
30782}
30783
Norman Jamesdbcffbd2015-10-06 16:53:06 -050030784/**
30785 * object_get_host_ipmi:
30786 * @object: A #Object.
30787 *
30788 * 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.
30789 *
30790 * Returns: (transfer full): A #HostIpmi that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
30791 */
30792HostIpmi *object_get_host_ipmi (Object *object)
30793{
30794 GDBusInterface *ret;
30795 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.HostIpmi");
30796 if (ret == NULL)
30797 return NULL;
30798 return HOST_IPMI (ret);
30799}
30800
Norman James362a80f2015-09-14 14:04:39 -050030801
30802/**
Norman James493996c2015-10-31 17:27:13 -050030803 * object_peek_object_mapper: (skip)
30804 * @object: A #Object.
30805 *
30806 * Like object_get_object_mapper() but doesn't increase the reference count on the returned object.
30807 *
30808 * <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>
30809 *
30810 * Returns: (transfer none): A #ObjectMapper or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
30811 */
30812ObjectMapper *object_peek_object_mapper (Object *object)
30813{
30814 GDBusInterface *ret;
30815 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Object.Mapper");
30816 if (ret == NULL)
30817 return NULL;
30818 g_object_unref (ret);
30819 return OBJECT_MAPPER (ret);
30820}
30821
30822/**
Norman James5236a8f2015-11-05 20:39:31 -060030823 * object_peek_hwmon: (skip)
30824 * @object: A #Object.
30825 *
30826 * Like object_get_hwmon() but doesn't increase the reference count on the returned object.
30827 *
30828 * <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>
30829 *
30830 * 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.
30831 */
30832Hwmon *object_peek_hwmon (Object *object)
30833{
30834 GDBusInterface *ret;
30835 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Hwmon");
30836 if (ret == NULL)
30837 return NULL;
30838 g_object_unref (ret);
30839 return HWMON (ret);
30840}
30841
30842/**
Norman James362a80f2015-09-14 14:04:39 -050030843 * object_peek_fan: (skip)
30844 * @object: A #Object.
30845 *
30846 * Like object_get_fan() but doesn't increase the reference count on the returned object.
30847 *
30848 * <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>
30849 *
30850 * 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.
30851 */
30852Fan *object_peek_fan (Object *object)
30853{
30854 GDBusInterface *ret;
30855 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan");
30856 if (ret == NULL)
30857 return NULL;
30858 g_object_unref (ret);
30859 return FAN (ret);
30860}
30861
30862/**
30863 * object_peek_sensor_value: (skip)
30864 * @object: A #Object.
30865 *
30866 * Like object_get_sensor_value() but doesn't increase the reference count on the returned object.
30867 *
30868 * <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>
30869 *
30870 * 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.
30871 */
30872SensorValue *object_peek_sensor_value (Object *object)
30873{
30874 GDBusInterface *ret;
30875 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue");
30876 if (ret == NULL)
30877 return NULL;
30878 g_object_unref (ret);
30879 return SENSOR_VALUE (ret);
30880}
30881
30882/**
30883 * object_peek_sensor_threshold: (skip)
30884 * @object: A #Object.
30885 *
30886 * Like object_get_sensor_threshold() but doesn't increase the reference count on the returned object.
30887 *
30888 * <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>
30889 *
30890 * 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.
30891 */
30892SensorThreshold *object_peek_sensor_threshold (Object *object)
30893{
30894 GDBusInterface *ret;
30895 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold");
30896 if (ret == NULL)
30897 return NULL;
30898 g_object_unref (ret);
30899 return SENSOR_THRESHOLD (ret);
30900}
30901
30902/**
30903 * object_peek_sensor_i2c: (skip)
30904 * @object: A #Object.
30905 *
30906 * Like object_get_sensor_i2c() but doesn't increase the reference count on the returned object.
30907 *
30908 * <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>
30909 *
30910 * 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.
30911 */
30912SensorI2c *object_peek_sensor_i2c (Object *object)
30913{
30914 GDBusInterface *ret;
30915 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
30916 if (ret == NULL)
30917 return NULL;
30918 g_object_unref (ret);
30919 return SENSOR_I2C (ret);
30920}
30921
30922/**
30923 * object_peek_sensor_match: (skip)
30924 * @object: A #Object.
30925 *
30926 * Like object_get_sensor_match() but doesn't increase the reference count on the returned object.
30927 *
30928 * <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>
30929 *
30930 * 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.
30931 */
30932SensorMatch *object_peek_sensor_match (Object *object)
30933{
30934 GDBusInterface *ret;
30935 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch");
30936 if (ret == NULL)
30937 return NULL;
30938 g_object_unref (ret);
30939 return SENSOR_MATCH (ret);
30940}
30941
30942/**
30943 * object_peek_process: (skip)
30944 * @object: A #Object.
30945 *
30946 * Like object_get_process() but doesn't increase the reference count on the returned object.
30947 *
30948 * <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>
30949 *
30950 * 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.
30951 */
30952Process *object_peek_process (Object *object)
30953{
30954 GDBusInterface *ret;
30955 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process");
30956 if (ret == NULL)
30957 return NULL;
30958 g_object_unref (ret);
30959 return PROCESS (ret);
30960}
30961
30962/**
Norman James18998182015-10-11 21:54:53 -050030963 * object_peek_shared_resource: (skip)
30964 * @object: A #Object.
30965 *
30966 * Like object_get_shared_resource() but doesn't increase the reference count on the returned object.
30967 *
30968 * <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>
30969 *
30970 * 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.
30971 */
30972SharedResource *object_peek_shared_resource (Object *object)
30973{
30974 GDBusInterface *ret;
30975 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SharedResource");
30976 if (ret == NULL)
30977 return NULL;
30978 g_object_unref (ret);
30979 return SHARED_RESOURCE (ret);
30980}
30981
30982/**
Norman James362a80f2015-09-14 14:04:39 -050030983 * object_peek_control: (skip)
30984 * @object: A #Object.
30985 *
30986 * Like object_get_control() but doesn't increase the reference count on the returned object.
30987 *
30988 * <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>
30989 *
30990 * 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.
30991 */
30992Control *object_peek_control (Object *object)
30993{
30994 GDBusInterface *ret;
30995 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control");
30996 if (ret == NULL)
30997 return NULL;
30998 g_object_unref (ret);
30999 return CONTROL (ret);
31000}
31001
31002/**
31003 * object_peek_control_bmc: (skip)
31004 * @object: A #Object.
31005 *
31006 * Like object_get_control_bmc() but doesn't increase the reference count on the returned object.
31007 *
31008 * <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>
31009 *
31010 * 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.
31011 */
31012ControlBmc *object_peek_control_bmc (Object *object)
31013{
31014 GDBusInterface *ret;
31015 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc");
31016 if (ret == NULL)
31017 return NULL;
31018 g_object_unref (ret);
31019 return CONTROL_BMC (ret);
31020}
31021
31022/**
31023 * object_peek_control_host: (skip)
31024 * @object: A #Object.
31025 *
31026 * Like object_get_control_host() but doesn't increase the reference count on the returned object.
31027 *
31028 * <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>
31029 *
31030 * 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.
31031 */
31032ControlHost *object_peek_control_host (Object *object)
31033{
31034 GDBusInterface *ret;
31035 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
31036 if (ret == NULL)
31037 return NULL;
31038 g_object_unref (ret);
31039 return CONTROL_HOST (ret);
31040}
31041
31042/**
31043 * object_peek_control_power: (skip)
31044 * @object: A #Object.
31045 *
31046 * Like object_get_control_power() but doesn't increase the reference count on the returned object.
31047 *
31048 * <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>
31049 *
31050 * 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.
31051 */
31052ControlPower *object_peek_control_power (Object *object)
31053{
31054 GDBusInterface *ret;
31055 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power");
31056 if (ret == NULL)
31057 return NULL;
31058 g_object_unref (ret);
31059 return CONTROL_POWER (ret);
31060}
31061
31062/**
31063 * object_peek_watchdog: (skip)
31064 * @object: A #Object.
31065 *
31066 * Like object_get_watchdog() but doesn't increase the reference count on the returned object.
31067 *
31068 * <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>
31069 *
31070 * 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.
31071 */
31072Watchdog *object_peek_watchdog (Object *object)
31073{
31074 GDBusInterface *ret;
31075 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog");
31076 if (ret == NULL)
31077 return NULL;
31078 g_object_unref (ret);
31079 return WATCHDOG (ret);
31080}
31081
31082/**
31083 * object_peek_event_log: (skip)
31084 * @object: A #Object.
31085 *
31086 * Like object_get_event_log() but doesn't increase the reference count on the returned object.
31087 *
31088 * <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>
31089 *
31090 * 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.
31091 */
31092EventLog *object_peek_event_log (Object *object)
31093{
31094 GDBusInterface *ret;
31095 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
31096 if (ret == NULL)
31097 return NULL;
31098 g_object_unref (ret);
31099 return EVENT_LOG (ret);
31100}
31101
31102/**
31103 * object_peek_flash: (skip)
31104 * @object: A #Object.
31105 *
31106 * Like object_get_flash() but doesn't increase the reference count on the returned object.
31107 *
31108 * <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>
31109 *
31110 * 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.
31111 */
31112Flash *object_peek_flash (Object *object)
31113{
31114 GDBusInterface *ret;
31115 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash");
31116 if (ret == NULL)
31117 return NULL;
31118 g_object_unref (ret);
31119 return FLASH (ret);
31120}
31121
31122/**
Norman James18998182015-10-11 21:54:53 -050031123 * object_peek_flash_control: (skip)
31124 * @object: A #Object.
31125 *
31126 * Like object_get_flash_control() but doesn't increase the reference count on the returned object.
31127 *
31128 * <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>
31129 *
31130 * 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.
31131 */
31132FlashControl *object_peek_flash_control (Object *object)
31133{
31134 GDBusInterface *ret;
31135 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.FlashControl");
31136 if (ret == NULL)
31137 return NULL;
31138 g_object_unref (ret);
31139 return FLASH_CONTROL (ret);
31140}
31141
31142/**
Norman James362a80f2015-09-14 14:04:39 -050031143 * object_peek_button: (skip)
31144 * @object: A #Object.
31145 *
31146 * Like object_get_button() but doesn't increase the reference count on the returned object.
31147 *
31148 * <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>
31149 *
31150 * 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.
31151 */
31152Button *object_peek_button (Object *object)
31153{
31154 GDBusInterface *ret;
31155 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button");
31156 if (ret == NULL)
31157 return NULL;
31158 g_object_unref (ret);
31159 return BUTTON (ret);
31160}
31161
31162/**
31163 * object_peek_led: (skip)
31164 * @object: A #Object.
31165 *
31166 * Like object_get_led() but doesn't increase the reference count on the returned object.
31167 *
31168 * <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>
31169 *
31170 * 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.
31171 */
31172Led *object_peek_led (Object *object)
31173{
31174 GDBusInterface *ret;
31175 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led");
31176 if (ret == NULL)
31177 return NULL;
31178 g_object_unref (ret);
31179 return LED (ret);
31180}
31181
Norman Jamesdbcffbd2015-10-06 16:53:06 -050031182/**
31183 * object_peek_host_ipmi: (skip)
31184 * @object: A #Object.
31185 *
31186 * Like object_get_host_ipmi() but doesn't increase the reference count on the returned object.
31187 *
31188 * <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>
31189 *
31190 * 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.
31191 */
31192HostIpmi *object_peek_host_ipmi (Object *object)
31193{
31194 GDBusInterface *ret;
31195 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.HostIpmi");
31196 if (ret == NULL)
31197 return NULL;
31198 g_object_unref (ret);
31199 return HOST_IPMI (ret);
31200}
31201
Norman James362a80f2015-09-14 14:04:39 -050031202
31203static void
31204object_notify (GDBusObject *object, GDBusInterface *interface)
31205{
31206 _ExtendedGDBusInterfaceInfo *info = (_ExtendedGDBusInterfaceInfo *) g_dbus_interface_get_info (interface);
31207 /* info can be NULL if the other end is using a D-Bus interface we don't know
31208 * anything about, for example old generated code in this process talking to
31209 * newer generated code in the other process. */
31210 if (info != NULL)
31211 g_object_notify (G_OBJECT (object), info->hyphen_name);
31212}
31213
31214/**
31215 * ObjectProxy:
31216 *
31217 * The #ObjectProxy structure contains only private data and should only be accessed using the provided API.
31218 */
31219
31220/**
31221 * ObjectProxyClass:
31222 * @parent_class: The parent class.
31223 *
31224 * Class structure for #ObjectProxy.
31225 */
31226
31227static void
31228object_proxy__object_iface_init (ObjectIface *iface G_GNUC_UNUSED)
31229{
31230}
31231
31232static void
31233object_proxy__g_dbus_object_iface_init (GDBusObjectIface *iface)
31234{
31235 iface->interface_added = object_notify;
31236 iface->interface_removed = object_notify;
31237}
31238
31239
31240G_DEFINE_TYPE_WITH_CODE (ObjectProxy, object_proxy, G_TYPE_DBUS_OBJECT_PROXY,
31241 G_IMPLEMENT_INTERFACE (TYPE_OBJECT, object_proxy__object_iface_init)
31242 G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, object_proxy__g_dbus_object_iface_init));
31243
31244static void
31245object_proxy_init (ObjectProxy *object G_GNUC_UNUSED)
31246{
31247}
31248
31249static void
31250object_proxy_set_property (GObject *gobject,
31251 guint prop_id,
31252 const GValue *value G_GNUC_UNUSED,
31253 GParamSpec *pspec)
31254{
31255 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
31256}
31257
31258static void
31259object_proxy_get_property (GObject *gobject,
31260 guint prop_id,
31261 GValue *value,
31262 GParamSpec *pspec)
31263{
31264 ObjectProxy *object = OBJECT_PROXY (gobject);
31265 GDBusInterface *interface;
31266
31267 switch (prop_id)
31268 {
31269 case 1:
Norman James493996c2015-10-31 17:27:13 -050031270 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Object.Mapper");
Norman James362a80f2015-09-14 14:04:39 -050031271 g_value_take_object (value, interface);
31272 break;
31273
Norman Jamesa3e47c42015-10-18 14:43:10 -050031274 case 2:
Norman James5236a8f2015-11-05 20:39:31 -060031275 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Hwmon");
Norman James362a80f2015-09-14 14:04:39 -050031276 g_value_take_object (value, interface);
31277 break;
31278
Norman Jamesa3e47c42015-10-18 14:43:10 -050031279 case 3:
Norman James5236a8f2015-11-05 20:39:31 -060031280 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan");
Norman James362a80f2015-09-14 14:04:39 -050031281 g_value_take_object (value, interface);
31282 break;
31283
Norman Jamesa3e47c42015-10-18 14:43:10 -050031284 case 4:
Norman James5236a8f2015-11-05 20:39:31 -060031285 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue");
Norman James362a80f2015-09-14 14:04:39 -050031286 g_value_take_object (value, interface);
31287 break;
31288
Norman Jamesa3e47c42015-10-18 14:43:10 -050031289 case 5:
Norman James5236a8f2015-11-05 20:39:31 -060031290 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold");
Norman James362a80f2015-09-14 14:04:39 -050031291 g_value_take_object (value, interface);
31292 break;
31293
Norman Jamesa3e47c42015-10-18 14:43:10 -050031294 case 6:
Norman James5236a8f2015-11-05 20:39:31 -060031295 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
Norman James362a80f2015-09-14 14:04:39 -050031296 g_value_take_object (value, interface);
31297 break;
31298
Norman Jamesa3e47c42015-10-18 14:43:10 -050031299 case 7:
Norman James5236a8f2015-11-05 20:39:31 -060031300 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch");
Norman James362a80f2015-09-14 14:04:39 -050031301 g_value_take_object (value, interface);
31302 break;
31303
Norman Jamesa3e47c42015-10-18 14:43:10 -050031304 case 8:
Norman James5236a8f2015-11-05 20:39:31 -060031305 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process");
Norman James362a80f2015-09-14 14:04:39 -050031306 g_value_take_object (value, interface);
31307 break;
31308
Norman Jamesa3e47c42015-10-18 14:43:10 -050031309 case 9:
Norman James5236a8f2015-11-05 20:39:31 -060031310 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SharedResource");
Norman James362a80f2015-09-14 14:04:39 -050031311 g_value_take_object (value, interface);
31312 break;
31313
Norman Jamesa3e47c42015-10-18 14:43:10 -050031314 case 10:
Norman James5236a8f2015-11-05 20:39:31 -060031315 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control");
Norman James362a80f2015-09-14 14:04:39 -050031316 g_value_take_object (value, interface);
31317 break;
31318
Norman Jamesa3e47c42015-10-18 14:43:10 -050031319 case 11:
Norman James5236a8f2015-11-05 20:39:31 -060031320 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc");
Norman James362a80f2015-09-14 14:04:39 -050031321 g_value_take_object (value, interface);
31322 break;
31323
Norman Jamesa3e47c42015-10-18 14:43:10 -050031324 case 12:
Norman James5236a8f2015-11-05 20:39:31 -060031325 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
Norman James362a80f2015-09-14 14:04:39 -050031326 g_value_take_object (value, interface);
31327 break;
31328
Norman Jamesa3e47c42015-10-18 14:43:10 -050031329 case 13:
Norman James5236a8f2015-11-05 20:39:31 -060031330 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power");
Norman James362a80f2015-09-14 14:04:39 -050031331 g_value_take_object (value, interface);
31332 break;
31333
Norman Jamesa3e47c42015-10-18 14:43:10 -050031334 case 14:
Norman James5236a8f2015-11-05 20:39:31 -060031335 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog");
Norman Jamesdfdaca92015-09-27 22:11:15 -050031336 g_value_take_object (value, interface);
31337 break;
31338
Norman Jamesa3e47c42015-10-18 14:43:10 -050031339 case 15:
Norman James5236a8f2015-11-05 20:39:31 -060031340 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
Norman James362a80f2015-09-14 14:04:39 -050031341 g_value_take_object (value, interface);
31342 break;
31343
Norman Jamesa3e47c42015-10-18 14:43:10 -050031344 case 16:
Norman James5236a8f2015-11-05 20:39:31 -060031345 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash");
Norman James18998182015-10-11 21:54:53 -050031346 g_value_take_object (value, interface);
31347 break;
31348
Norman Jamesa3e47c42015-10-18 14:43:10 -050031349 case 17:
Norman James5236a8f2015-11-05 20:39:31 -060031350 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.FlashControl");
Norman James18998182015-10-11 21:54:53 -050031351 g_value_take_object (value, interface);
31352 break;
31353
Norman Jamesa3e47c42015-10-18 14:43:10 -050031354 case 18:
Norman James5236a8f2015-11-05 20:39:31 -060031355 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button");
Norman James493996c2015-10-31 17:27:13 -050031356 g_value_take_object (value, interface);
31357 break;
31358
31359 case 19:
Norman James5236a8f2015-11-05 20:39:31 -060031360 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led");
31361 g_value_take_object (value, interface);
31362 break;
31363
31364 case 20:
Norman Jamesdbcffbd2015-10-06 16:53:06 -050031365 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.HostIpmi");
31366 g_value_take_object (value, interface);
31367 break;
31368
Norman James362a80f2015-09-14 14:04:39 -050031369 default:
31370 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
31371 break;
31372 }
31373}
31374
31375static void
31376object_proxy_class_init (ObjectProxyClass *klass)
31377{
31378 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
31379
31380 gobject_class->set_property = object_proxy_set_property;
31381 gobject_class->get_property = object_proxy_get_property;
31382
Norman James493996c2015-10-31 17:27:13 -050031383 g_object_class_override_property (gobject_class, 1, "object-mapper");
Norman James5236a8f2015-11-05 20:39:31 -060031384 g_object_class_override_property (gobject_class, 2, "hwmon");
31385 g_object_class_override_property (gobject_class, 3, "fan");
31386 g_object_class_override_property (gobject_class, 4, "sensor-value");
31387 g_object_class_override_property (gobject_class, 5, "sensor-threshold");
31388 g_object_class_override_property (gobject_class, 6, "sensor-i2c");
31389 g_object_class_override_property (gobject_class, 7, "sensor-match");
31390 g_object_class_override_property (gobject_class, 8, "process");
31391 g_object_class_override_property (gobject_class, 9, "shared-resource");
31392 g_object_class_override_property (gobject_class, 10, "control");
31393 g_object_class_override_property (gobject_class, 11, "control-bmc");
31394 g_object_class_override_property (gobject_class, 12, "control-host");
31395 g_object_class_override_property (gobject_class, 13, "control-power");
31396 g_object_class_override_property (gobject_class, 14, "watchdog");
31397 g_object_class_override_property (gobject_class, 15, "event-log");
31398 g_object_class_override_property (gobject_class, 16, "flash");
31399 g_object_class_override_property (gobject_class, 17, "flash-control");
31400 g_object_class_override_property (gobject_class, 18, "button");
31401 g_object_class_override_property (gobject_class, 19, "led");
31402 g_object_class_override_property (gobject_class, 20, "host-ipmi");
Norman James362a80f2015-09-14 14:04:39 -050031403}
31404
31405/**
31406 * object_proxy_new:
31407 * @connection: A #GDBusConnection.
31408 * @object_path: An object path.
31409 *
31410 * Creates a new proxy object.
31411 *
31412 * Returns: (transfer full): The proxy object.
31413 */
31414ObjectProxy *
31415object_proxy_new (GDBusConnection *connection,
31416 const gchar *object_path)
31417{
31418 g_return_val_if_fail (G_IS_DBUS_CONNECTION (connection), NULL);
31419 g_return_val_if_fail (g_variant_is_object_path (object_path), NULL);
31420 return OBJECT_PROXY (g_object_new (TYPE_OBJECT_PROXY, "g-connection", connection, "g-object-path", object_path, NULL));
31421}
31422
31423/**
31424 * ObjectSkeleton:
31425 *
31426 * The #ObjectSkeleton structure contains only private data and should only be accessed using the provided API.
31427 */
31428
31429/**
31430 * ObjectSkeletonClass:
31431 * @parent_class: The parent class.
31432 *
31433 * Class structure for #ObjectSkeleton.
31434 */
31435
31436static void
31437object_skeleton__object_iface_init (ObjectIface *iface G_GNUC_UNUSED)
31438{
31439}
31440
31441
31442static void
31443object_skeleton__g_dbus_object_iface_init (GDBusObjectIface *iface)
31444{
31445 iface->interface_added = object_notify;
31446 iface->interface_removed = object_notify;
31447}
31448
31449G_DEFINE_TYPE_WITH_CODE (ObjectSkeleton, object_skeleton, G_TYPE_DBUS_OBJECT_SKELETON,
31450 G_IMPLEMENT_INTERFACE (TYPE_OBJECT, object_skeleton__object_iface_init)
31451 G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, object_skeleton__g_dbus_object_iface_init));
31452
31453static void
31454object_skeleton_init (ObjectSkeleton *object G_GNUC_UNUSED)
31455{
31456}
31457
31458static void
31459object_skeleton_set_property (GObject *gobject,
31460 guint prop_id,
31461 const GValue *value,
31462 GParamSpec *pspec)
31463{
31464 ObjectSkeleton *object = OBJECT_SKELETON (gobject);
31465 GDBusInterfaceSkeleton *interface;
31466
31467 switch (prop_id)
31468 {
31469 case 1:
31470 interface = g_value_get_object (value);
31471 if (interface != NULL)
31472 {
Norman James493996c2015-10-31 17:27:13 -050031473 g_warn_if_fail (IS_OBJECT_MAPPER (interface));
31474 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
31475 }
31476 else
31477 {
31478 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Object.Mapper");
31479 }
31480 break;
31481
31482 case 2:
31483 interface = g_value_get_object (value);
31484 if (interface != NULL)
31485 {
Norman James5236a8f2015-11-05 20:39:31 -060031486 g_warn_if_fail (IS_HWMON (interface));
31487 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
31488 }
31489 else
31490 {
31491 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Hwmon");
31492 }
31493 break;
31494
31495 case 3:
31496 interface = g_value_get_object (value);
31497 if (interface != NULL)
31498 {
Norman James362a80f2015-09-14 14:04:39 -050031499 g_warn_if_fail (IS_FAN (interface));
31500 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
31501 }
31502 else
31503 {
31504 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Fan");
31505 }
31506 break;
31507
Norman James5236a8f2015-11-05 20:39:31 -060031508 case 4:
Norman James362a80f2015-09-14 14:04:39 -050031509 interface = g_value_get_object (value);
31510 if (interface != NULL)
31511 {
31512 g_warn_if_fail (IS_SENSOR_VALUE (interface));
31513 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
31514 }
31515 else
31516 {
31517 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorValue");
31518 }
31519 break;
31520
Norman James5236a8f2015-11-05 20:39:31 -060031521 case 5:
Norman James362a80f2015-09-14 14:04:39 -050031522 interface = g_value_get_object (value);
31523 if (interface != NULL)
31524 {
31525 g_warn_if_fail (IS_SENSOR_THRESHOLD (interface));
31526 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
31527 }
31528 else
31529 {
31530 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorThreshold");
31531 }
31532 break;
31533
Norman James5236a8f2015-11-05 20:39:31 -060031534 case 6:
Norman James362a80f2015-09-14 14:04:39 -050031535 interface = g_value_get_object (value);
31536 if (interface != NULL)
31537 {
31538 g_warn_if_fail (IS_SENSOR_I2C (interface));
31539 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
31540 }
31541 else
31542 {
31543 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorI2c");
31544 }
31545 break;
31546
Norman James5236a8f2015-11-05 20:39:31 -060031547 case 7:
Norman James362a80f2015-09-14 14:04:39 -050031548 interface = g_value_get_object (value);
31549 if (interface != NULL)
31550 {
31551 g_warn_if_fail (IS_SENSOR_MATCH (interface));
31552 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
31553 }
31554 else
31555 {
31556 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorMatch");
31557 }
31558 break;
31559
Norman James5236a8f2015-11-05 20:39:31 -060031560 case 8:
Norman James362a80f2015-09-14 14:04:39 -050031561 interface = g_value_get_object (value);
31562 if (interface != NULL)
31563 {
31564 g_warn_if_fail (IS_PROCESS (interface));
31565 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
31566 }
31567 else
31568 {
31569 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Process");
31570 }
31571 break;
31572
Norman James5236a8f2015-11-05 20:39:31 -060031573 case 9:
Norman James362a80f2015-09-14 14:04:39 -050031574 interface = g_value_get_object (value);
31575 if (interface != NULL)
31576 {
Norman James18998182015-10-11 21:54:53 -050031577 g_warn_if_fail (IS_SHARED_RESOURCE (interface));
31578 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
31579 }
31580 else
31581 {
31582 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SharedResource");
31583 }
31584 break;
31585
Norman James5236a8f2015-11-05 20:39:31 -060031586 case 10:
Norman James18998182015-10-11 21:54:53 -050031587 interface = g_value_get_object (value);
31588 if (interface != NULL)
31589 {
Norman James362a80f2015-09-14 14:04:39 -050031590 g_warn_if_fail (IS_CONTROL (interface));
31591 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
31592 }
31593 else
31594 {
31595 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Control");
31596 }
31597 break;
31598
Norman James5236a8f2015-11-05 20:39:31 -060031599 case 11:
Norman James362a80f2015-09-14 14:04:39 -050031600 interface = g_value_get_object (value);
31601 if (interface != NULL)
31602 {
31603 g_warn_if_fail (IS_CONTROL_BMC (interface));
31604 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
31605 }
31606 else
31607 {
31608 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.control.Bmc");
31609 }
31610 break;
31611
Norman James5236a8f2015-11-05 20:39:31 -060031612 case 12:
Norman James362a80f2015-09-14 14:04:39 -050031613 interface = g_value_get_object (value);
31614 if (interface != NULL)
31615 {
31616 g_warn_if_fail (IS_CONTROL_HOST (interface));
31617 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
31618 }
31619 else
31620 {
31621 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.control.Host");
31622 }
31623 break;
31624
Norman James5236a8f2015-11-05 20:39:31 -060031625 case 13:
Norman James362a80f2015-09-14 14:04:39 -050031626 interface = g_value_get_object (value);
31627 if (interface != NULL)
31628 {
31629 g_warn_if_fail (IS_CONTROL_POWER (interface));
31630 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
31631 }
31632 else
31633 {
31634 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.control.Power");
31635 }
31636 break;
31637
Norman James5236a8f2015-11-05 20:39:31 -060031638 case 14:
Norman James362a80f2015-09-14 14:04:39 -050031639 interface = g_value_get_object (value);
31640 if (interface != NULL)
31641 {
31642 g_warn_if_fail (IS_WATCHDOG (interface));
31643 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
31644 }
31645 else
31646 {
31647 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Watchdog");
31648 }
31649 break;
31650
Norman James5236a8f2015-11-05 20:39:31 -060031651 case 15:
Norman James362a80f2015-09-14 14:04:39 -050031652 interface = g_value_get_object (value);
31653 if (interface != NULL)
31654 {
31655 g_warn_if_fail (IS_EVENT_LOG (interface));
31656 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
31657 }
31658 else
31659 {
31660 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.EventLog");
31661 }
31662 break;
31663
Norman James5236a8f2015-11-05 20:39:31 -060031664 case 16:
Norman James362a80f2015-09-14 14:04:39 -050031665 interface = g_value_get_object (value);
31666 if (interface != NULL)
31667 {
31668 g_warn_if_fail (IS_FLASH (interface));
31669 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
31670 }
31671 else
31672 {
31673 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Flash");
31674 }
31675 break;
31676
Norman James5236a8f2015-11-05 20:39:31 -060031677 case 17:
Norman James18998182015-10-11 21:54:53 -050031678 interface = g_value_get_object (value);
31679 if (interface != NULL)
31680 {
31681 g_warn_if_fail (IS_FLASH_CONTROL (interface));
31682 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
31683 }
31684 else
31685 {
31686 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.FlashControl");
31687 }
31688 break;
31689
Norman James5236a8f2015-11-05 20:39:31 -060031690 case 18:
Norman James362a80f2015-09-14 14:04:39 -050031691 interface = g_value_get_object (value);
31692 if (interface != NULL)
31693 {
31694 g_warn_if_fail (IS_BUTTON (interface));
31695 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
31696 }
31697 else
31698 {
31699 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Button");
31700 }
31701 break;
31702
Norman James5236a8f2015-11-05 20:39:31 -060031703 case 19:
Norman James362a80f2015-09-14 14:04:39 -050031704 interface = g_value_get_object (value);
31705 if (interface != NULL)
31706 {
31707 g_warn_if_fail (IS_LED (interface));
31708 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
31709 }
31710 else
31711 {
31712 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Led");
31713 }
31714 break;
31715
Norman James5236a8f2015-11-05 20:39:31 -060031716 case 20:
Norman Jamesdbcffbd2015-10-06 16:53:06 -050031717 interface = g_value_get_object (value);
31718 if (interface != NULL)
31719 {
31720 g_warn_if_fail (IS_HOST_IPMI (interface));
31721 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
31722 }
31723 else
31724 {
31725 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.HostIpmi");
31726 }
31727 break;
31728
Norman James362a80f2015-09-14 14:04:39 -050031729 default:
31730 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
31731 break;
31732 }
31733}
31734
31735static void
31736object_skeleton_get_property (GObject *gobject,
31737 guint prop_id,
31738 GValue *value,
31739 GParamSpec *pspec)
31740{
31741 ObjectSkeleton *object = OBJECT_SKELETON (gobject);
31742 GDBusInterface *interface;
31743
31744 switch (prop_id)
31745 {
31746 case 1:
Norman James493996c2015-10-31 17:27:13 -050031747 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Object.Mapper");
Norman James362a80f2015-09-14 14:04:39 -050031748 g_value_take_object (value, interface);
31749 break;
31750
Norman Jamesa3e47c42015-10-18 14:43:10 -050031751 case 2:
Norman James5236a8f2015-11-05 20:39:31 -060031752 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Hwmon");
Norman James362a80f2015-09-14 14:04:39 -050031753 g_value_take_object (value, interface);
31754 break;
31755
Norman Jamesa3e47c42015-10-18 14:43:10 -050031756 case 3:
Norman James5236a8f2015-11-05 20:39:31 -060031757 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan");
Norman James362a80f2015-09-14 14:04:39 -050031758 g_value_take_object (value, interface);
31759 break;
31760
Norman Jamesa3e47c42015-10-18 14:43:10 -050031761 case 4:
Norman James5236a8f2015-11-05 20:39:31 -060031762 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue");
Norman James362a80f2015-09-14 14:04:39 -050031763 g_value_take_object (value, interface);
31764 break;
31765
Norman Jamesa3e47c42015-10-18 14:43:10 -050031766 case 5:
Norman James5236a8f2015-11-05 20:39:31 -060031767 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold");
Norman James362a80f2015-09-14 14:04:39 -050031768 g_value_take_object (value, interface);
31769 break;
31770
Norman Jamesa3e47c42015-10-18 14:43:10 -050031771 case 6:
Norman James5236a8f2015-11-05 20:39:31 -060031772 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
Norman James362a80f2015-09-14 14:04:39 -050031773 g_value_take_object (value, interface);
31774 break;
31775
Norman Jamesa3e47c42015-10-18 14:43:10 -050031776 case 7:
Norman James5236a8f2015-11-05 20:39:31 -060031777 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch");
Norman James362a80f2015-09-14 14:04:39 -050031778 g_value_take_object (value, interface);
31779 break;
31780
Norman Jamesa3e47c42015-10-18 14:43:10 -050031781 case 8:
Norman James5236a8f2015-11-05 20:39:31 -060031782 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process");
Norman James362a80f2015-09-14 14:04:39 -050031783 g_value_take_object (value, interface);
31784 break;
31785
Norman Jamesa3e47c42015-10-18 14:43:10 -050031786 case 9:
Norman James5236a8f2015-11-05 20:39:31 -060031787 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SharedResource");
Norman James362a80f2015-09-14 14:04:39 -050031788 g_value_take_object (value, interface);
31789 break;
31790
Norman Jamesa3e47c42015-10-18 14:43:10 -050031791 case 10:
Norman James5236a8f2015-11-05 20:39:31 -060031792 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control");
Norman James362a80f2015-09-14 14:04:39 -050031793 g_value_take_object (value, interface);
31794 break;
31795
Norman Jamesa3e47c42015-10-18 14:43:10 -050031796 case 11:
Norman James5236a8f2015-11-05 20:39:31 -060031797 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc");
Norman James362a80f2015-09-14 14:04:39 -050031798 g_value_take_object (value, interface);
31799 break;
31800
Norman Jamesa3e47c42015-10-18 14:43:10 -050031801 case 12:
Norman James5236a8f2015-11-05 20:39:31 -060031802 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
Norman James362a80f2015-09-14 14:04:39 -050031803 g_value_take_object (value, interface);
31804 break;
31805
Norman Jamesa3e47c42015-10-18 14:43:10 -050031806 case 13:
Norman James5236a8f2015-11-05 20:39:31 -060031807 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power");
Norman James362a80f2015-09-14 14:04:39 -050031808 g_value_take_object (value, interface);
31809 break;
31810
Norman Jamesa3e47c42015-10-18 14:43:10 -050031811 case 14:
Norman James5236a8f2015-11-05 20:39:31 -060031812 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog");
Norman Jamesdfdaca92015-09-27 22:11:15 -050031813 g_value_take_object (value, interface);
31814 break;
31815
Norman Jamesa3e47c42015-10-18 14:43:10 -050031816 case 15:
Norman James5236a8f2015-11-05 20:39:31 -060031817 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
Norman James362a80f2015-09-14 14:04:39 -050031818 g_value_take_object (value, interface);
31819 break;
31820
Norman Jamesa3e47c42015-10-18 14:43:10 -050031821 case 16:
Norman James5236a8f2015-11-05 20:39:31 -060031822 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash");
Norman James18998182015-10-11 21:54:53 -050031823 g_value_take_object (value, interface);
31824 break;
31825
Norman Jamesa3e47c42015-10-18 14:43:10 -050031826 case 17:
Norman James5236a8f2015-11-05 20:39:31 -060031827 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.FlashControl");
Norman James18998182015-10-11 21:54:53 -050031828 g_value_take_object (value, interface);
31829 break;
31830
Norman Jamesa3e47c42015-10-18 14:43:10 -050031831 case 18:
Norman James5236a8f2015-11-05 20:39:31 -060031832 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button");
Norman James493996c2015-10-31 17:27:13 -050031833 g_value_take_object (value, interface);
31834 break;
31835
31836 case 19:
Norman James5236a8f2015-11-05 20:39:31 -060031837 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led");
31838 g_value_take_object (value, interface);
31839 break;
31840
31841 case 20:
Norman Jamesdbcffbd2015-10-06 16:53:06 -050031842 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.HostIpmi");
31843 g_value_take_object (value, interface);
31844 break;
31845
Norman James362a80f2015-09-14 14:04:39 -050031846 default:
31847 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
31848 break;
31849 }
31850}
31851
31852static void
31853object_skeleton_class_init (ObjectSkeletonClass *klass)
31854{
31855 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
31856
31857 gobject_class->set_property = object_skeleton_set_property;
31858 gobject_class->get_property = object_skeleton_get_property;
31859
Norman James493996c2015-10-31 17:27:13 -050031860 g_object_class_override_property (gobject_class, 1, "object-mapper");
Norman James5236a8f2015-11-05 20:39:31 -060031861 g_object_class_override_property (gobject_class, 2, "hwmon");
31862 g_object_class_override_property (gobject_class, 3, "fan");
31863 g_object_class_override_property (gobject_class, 4, "sensor-value");
31864 g_object_class_override_property (gobject_class, 5, "sensor-threshold");
31865 g_object_class_override_property (gobject_class, 6, "sensor-i2c");
31866 g_object_class_override_property (gobject_class, 7, "sensor-match");
31867 g_object_class_override_property (gobject_class, 8, "process");
31868 g_object_class_override_property (gobject_class, 9, "shared-resource");
31869 g_object_class_override_property (gobject_class, 10, "control");
31870 g_object_class_override_property (gobject_class, 11, "control-bmc");
31871 g_object_class_override_property (gobject_class, 12, "control-host");
31872 g_object_class_override_property (gobject_class, 13, "control-power");
31873 g_object_class_override_property (gobject_class, 14, "watchdog");
31874 g_object_class_override_property (gobject_class, 15, "event-log");
31875 g_object_class_override_property (gobject_class, 16, "flash");
31876 g_object_class_override_property (gobject_class, 17, "flash-control");
31877 g_object_class_override_property (gobject_class, 18, "button");
31878 g_object_class_override_property (gobject_class, 19, "led");
31879 g_object_class_override_property (gobject_class, 20, "host-ipmi");
Norman James362a80f2015-09-14 14:04:39 -050031880}
31881
31882/**
31883 * object_skeleton_new:
31884 * @object_path: An object path.
31885 *
31886 * Creates a new skeleton object.
31887 *
31888 * Returns: (transfer full): The skeleton object.
31889 */
31890ObjectSkeleton *
31891object_skeleton_new (const gchar *object_path)
31892{
31893 g_return_val_if_fail (g_variant_is_object_path (object_path), NULL);
31894 return OBJECT_SKELETON (g_object_new (TYPE_OBJECT_SKELETON, "g-object-path", object_path, NULL));
31895}
31896
31897/**
Norman James493996c2015-10-31 17:27:13 -050031898 * object_skeleton_set_object_mapper:
31899 * @object: A #ObjectSkeleton.
31900 * @interface_: (allow-none): A #ObjectMapper or %NULL to clear the interface.
31901 *
31902 * Sets the #ObjectMapper instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Object-Mapper.top_of_page">org.openbmc.Object.Mapper</link> on @object.
31903 */
31904void object_skeleton_set_object_mapper (ObjectSkeleton *object, ObjectMapper *interface_)
31905{
31906 g_object_set (G_OBJECT (object), "object-mapper", interface_, NULL);
31907}
31908
31909/**
Norman James5236a8f2015-11-05 20:39:31 -060031910 * object_skeleton_set_hwmon:
31911 * @object: A #ObjectSkeleton.
31912 * @interface_: (allow-none): A #Hwmon or %NULL to clear the interface.
31913 *
31914 * 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.
31915 */
31916void object_skeleton_set_hwmon (ObjectSkeleton *object, Hwmon *interface_)
31917{
31918 g_object_set (G_OBJECT (object), "hwmon", interface_, NULL);
31919}
31920
31921/**
Norman James362a80f2015-09-14 14:04:39 -050031922 * object_skeleton_set_fan:
31923 * @object: A #ObjectSkeleton.
31924 * @interface_: (allow-none): A #Fan or %NULL to clear the interface.
31925 *
31926 * 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.
31927 */
31928void object_skeleton_set_fan (ObjectSkeleton *object, Fan *interface_)
31929{
31930 g_object_set (G_OBJECT (object), "fan", interface_, NULL);
31931}
31932
31933/**
31934 * object_skeleton_set_sensor_value:
31935 * @object: A #ObjectSkeleton.
31936 * @interface_: (allow-none): A #SensorValue or %NULL to clear the interface.
31937 *
31938 * 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.
31939 */
31940void object_skeleton_set_sensor_value (ObjectSkeleton *object, SensorValue *interface_)
31941{
31942 g_object_set (G_OBJECT (object), "sensor-value", interface_, NULL);
31943}
31944
31945/**
31946 * object_skeleton_set_sensor_threshold:
31947 * @object: A #ObjectSkeleton.
31948 * @interface_: (allow-none): A #SensorThreshold or %NULL to clear the interface.
31949 *
31950 * 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.
31951 */
31952void object_skeleton_set_sensor_threshold (ObjectSkeleton *object, SensorThreshold *interface_)
31953{
31954 g_object_set (G_OBJECT (object), "sensor-threshold", interface_, NULL);
31955}
31956
31957/**
31958 * object_skeleton_set_sensor_i2c:
31959 * @object: A #ObjectSkeleton.
31960 * @interface_: (allow-none): A #SensorI2c or %NULL to clear the interface.
31961 *
31962 * 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.
31963 */
31964void object_skeleton_set_sensor_i2c (ObjectSkeleton *object, SensorI2c *interface_)
31965{
31966 g_object_set (G_OBJECT (object), "sensor-i2c", interface_, NULL);
31967}
31968
31969/**
31970 * object_skeleton_set_sensor_match:
31971 * @object: A #ObjectSkeleton.
31972 * @interface_: (allow-none): A #SensorMatch or %NULL to clear the interface.
31973 *
31974 * 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.
31975 */
31976void object_skeleton_set_sensor_match (ObjectSkeleton *object, SensorMatch *interface_)
31977{
31978 g_object_set (G_OBJECT (object), "sensor-match", interface_, NULL);
31979}
31980
31981/**
31982 * object_skeleton_set_process:
31983 * @object: A #ObjectSkeleton.
31984 * @interface_: (allow-none): A #Process or %NULL to clear the interface.
31985 *
31986 * 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.
31987 */
31988void object_skeleton_set_process (ObjectSkeleton *object, Process *interface_)
31989{
31990 g_object_set (G_OBJECT (object), "process", interface_, NULL);
31991}
31992
31993/**
Norman James18998182015-10-11 21:54:53 -050031994 * object_skeleton_set_shared_resource:
31995 * @object: A #ObjectSkeleton.
31996 * @interface_: (allow-none): A #SharedResource or %NULL to clear the interface.
31997 *
31998 * 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.
31999 */
32000void object_skeleton_set_shared_resource (ObjectSkeleton *object, SharedResource *interface_)
32001{
32002 g_object_set (G_OBJECT (object), "shared-resource", interface_, NULL);
32003}
32004
32005/**
Norman James362a80f2015-09-14 14:04:39 -050032006 * object_skeleton_set_control:
32007 * @object: A #ObjectSkeleton.
32008 * @interface_: (allow-none): A #Control or %NULL to clear the interface.
32009 *
32010 * 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.
32011 */
32012void object_skeleton_set_control (ObjectSkeleton *object, Control *interface_)
32013{
32014 g_object_set (G_OBJECT (object), "control", interface_, NULL);
32015}
32016
32017/**
32018 * object_skeleton_set_control_bmc:
32019 * @object: A #ObjectSkeleton.
32020 * @interface_: (allow-none): A #ControlBmc or %NULL to clear the interface.
32021 *
32022 * 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.
32023 */
32024void object_skeleton_set_control_bmc (ObjectSkeleton *object, ControlBmc *interface_)
32025{
32026 g_object_set (G_OBJECT (object), "control-bmc", interface_, NULL);
32027}
32028
32029/**
32030 * object_skeleton_set_control_host:
32031 * @object: A #ObjectSkeleton.
32032 * @interface_: (allow-none): A #ControlHost or %NULL to clear the interface.
32033 *
32034 * 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.
32035 */
32036void object_skeleton_set_control_host (ObjectSkeleton *object, ControlHost *interface_)
32037{
32038 g_object_set (G_OBJECT (object), "control-host", interface_, NULL);
32039}
32040
32041/**
32042 * object_skeleton_set_control_power:
32043 * @object: A #ObjectSkeleton.
32044 * @interface_: (allow-none): A #ControlPower or %NULL to clear the interface.
32045 *
32046 * 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.
32047 */
32048void object_skeleton_set_control_power (ObjectSkeleton *object, ControlPower *interface_)
32049{
32050 g_object_set (G_OBJECT (object), "control-power", interface_, NULL);
32051}
32052
32053/**
32054 * object_skeleton_set_watchdog:
32055 * @object: A #ObjectSkeleton.
32056 * @interface_: (allow-none): A #Watchdog or %NULL to clear the interface.
32057 *
32058 * 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.
32059 */
32060void object_skeleton_set_watchdog (ObjectSkeleton *object, Watchdog *interface_)
32061{
32062 g_object_set (G_OBJECT (object), "watchdog", interface_, NULL);
32063}
32064
32065/**
32066 * object_skeleton_set_event_log:
32067 * @object: A #ObjectSkeleton.
32068 * @interface_: (allow-none): A #EventLog or %NULL to clear the interface.
32069 *
32070 * 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.
32071 */
32072void object_skeleton_set_event_log (ObjectSkeleton *object, EventLog *interface_)
32073{
32074 g_object_set (G_OBJECT (object), "event-log", interface_, NULL);
32075}
32076
32077/**
32078 * object_skeleton_set_flash:
32079 * @object: A #ObjectSkeleton.
32080 * @interface_: (allow-none): A #Flash or %NULL to clear the interface.
32081 *
32082 * 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.
32083 */
32084void object_skeleton_set_flash (ObjectSkeleton *object, Flash *interface_)
32085{
32086 g_object_set (G_OBJECT (object), "flash", interface_, NULL);
32087}
32088
32089/**
Norman James18998182015-10-11 21:54:53 -050032090 * object_skeleton_set_flash_control:
32091 * @object: A #ObjectSkeleton.
32092 * @interface_: (allow-none): A #FlashControl or %NULL to clear the interface.
32093 *
32094 * 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.
32095 */
32096void object_skeleton_set_flash_control (ObjectSkeleton *object, FlashControl *interface_)
32097{
32098 g_object_set (G_OBJECT (object), "flash-control", interface_, NULL);
32099}
32100
32101/**
Norman James362a80f2015-09-14 14:04:39 -050032102 * object_skeleton_set_button:
32103 * @object: A #ObjectSkeleton.
32104 * @interface_: (allow-none): A #Button or %NULL to clear the interface.
32105 *
32106 * 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.
32107 */
32108void object_skeleton_set_button (ObjectSkeleton *object, Button *interface_)
32109{
32110 g_object_set (G_OBJECT (object), "button", interface_, NULL);
32111}
32112
32113/**
32114 * object_skeleton_set_led:
32115 * @object: A #ObjectSkeleton.
32116 * @interface_: (allow-none): A #Led or %NULL to clear the interface.
32117 *
32118 * 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.
32119 */
32120void object_skeleton_set_led (ObjectSkeleton *object, Led *interface_)
32121{
32122 g_object_set (G_OBJECT (object), "led", interface_, NULL);
32123}
32124
Norman Jamesdbcffbd2015-10-06 16:53:06 -050032125/**
32126 * object_skeleton_set_host_ipmi:
32127 * @object: A #ObjectSkeleton.
32128 * @interface_: (allow-none): A #HostIpmi or %NULL to clear the interface.
32129 *
32130 * 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.
32131 */
32132void object_skeleton_set_host_ipmi (ObjectSkeleton *object, HostIpmi *interface_)
32133{
32134 g_object_set (G_OBJECT (object), "host-ipmi", interface_, NULL);
32135}
32136
Norman James362a80f2015-09-14 14:04:39 -050032137
32138/* ------------------------------------------------------------------------
32139 * Code for ObjectManager client
32140 * ------------------------------------------------------------------------
32141 */
32142
32143/**
32144 * SECTION:ObjectManagerClient
32145 * @title: ObjectManagerClient
32146 * @short_description: Generated GDBusObjectManagerClient type
32147 *
32148 * This section contains a #GDBusObjectManagerClient that uses object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc.
32149 */
32150
32151/**
32152 * ObjectManagerClient:
32153 *
32154 * The #ObjectManagerClient structure contains only private data and should only be accessed using the provided API.
32155 */
32156
32157/**
32158 * ObjectManagerClientClass:
32159 * @parent_class: The parent class.
32160 *
32161 * Class structure for #ObjectManagerClient.
32162 */
32163
32164G_DEFINE_TYPE (ObjectManagerClient, object_manager_client, G_TYPE_DBUS_OBJECT_MANAGER_CLIENT);
32165
32166static void
32167object_manager_client_init (ObjectManagerClient *manager G_GNUC_UNUSED)
32168{
32169}
32170
32171static void
32172object_manager_client_class_init (ObjectManagerClientClass *klass G_GNUC_UNUSED)
32173{
32174}
32175
32176/**
32177 * object_manager_client_get_proxy_type:
32178 * @manager: A #GDBusObjectManagerClient.
32179 * @object_path: The object path of the remote object (unused).
32180 * @interface_name: (allow-none): Interface name of the remote object or %NULL to get the object proxy #GType.
32181 * @user_data: User data (unused).
32182 *
32183 * A #GDBusProxyTypeFunc that maps @interface_name to the generated #GDBusObjectProxy<!-- -->- and #GDBusProxy<!-- -->-derived types.
32184 *
32185 * Returns: A #GDBusProxy<!-- -->-derived #GType if @interface_name is not %NULL, otherwise the #GType for #ObjectProxy.
32186 */
32187GType
32188object_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)
32189{
32190 static gsize once_init_value = 0;
32191 static GHashTable *lookup_hash;
32192 GType ret;
32193
32194 if (interface_name == NULL)
32195 return TYPE_OBJECT_PROXY;
32196 if (g_once_init_enter (&once_init_value))
32197 {
32198 lookup_hash = g_hash_table_new (g_str_hash, g_str_equal);
Norman James493996c2015-10-31 17:27:13 -050032199 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Object.Mapper", GSIZE_TO_POINTER (TYPE_OBJECT_MAPPER_PROXY));
Norman James5236a8f2015-11-05 20:39:31 -060032200 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Hwmon", GSIZE_TO_POINTER (TYPE_HWMON_PROXY));
Norman James362a80f2015-09-14 14:04:39 -050032201 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Fan", GSIZE_TO_POINTER (TYPE_FAN_PROXY));
32202 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorValue", GSIZE_TO_POINTER (TYPE_SENSOR_VALUE_PROXY));
Norman James362a80f2015-09-14 14:04:39 -050032203 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorThreshold", GSIZE_TO_POINTER (TYPE_SENSOR_THRESHOLD_PROXY));
32204 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorI2c", GSIZE_TO_POINTER (TYPE_SENSOR_I2C_PROXY));
32205 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorMatch", GSIZE_TO_POINTER (TYPE_SENSOR_MATCH_PROXY));
32206 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Process", GSIZE_TO_POINTER (TYPE_PROCESS_PROXY));
Norman James18998182015-10-11 21:54:53 -050032207 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SharedResource", GSIZE_TO_POINTER (TYPE_SHARED_RESOURCE_PROXY));
Norman James362a80f2015-09-14 14:04:39 -050032208 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Control", GSIZE_TO_POINTER (TYPE_CONTROL_PROXY));
32209 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.control.Bmc", GSIZE_TO_POINTER (TYPE_CONTROL_BMC_PROXY));
32210 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.control.Host", GSIZE_TO_POINTER (TYPE_CONTROL_HOST_PROXY));
32211 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.control.Power", GSIZE_TO_POINTER (TYPE_CONTROL_POWER_PROXY));
32212 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Watchdog", GSIZE_TO_POINTER (TYPE_WATCHDOG_PROXY));
32213 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.EventLog", GSIZE_TO_POINTER (TYPE_EVENT_LOG_PROXY));
32214 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Flash", GSIZE_TO_POINTER (TYPE_FLASH_PROXY));
Norman James18998182015-10-11 21:54:53 -050032215 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.FlashControl", GSIZE_TO_POINTER (TYPE_FLASH_CONTROL_PROXY));
Norman James362a80f2015-09-14 14:04:39 -050032216 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Button", GSIZE_TO_POINTER (TYPE_BUTTON_PROXY));
32217 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Led", GSIZE_TO_POINTER (TYPE_LED_PROXY));
Norman Jamesdbcffbd2015-10-06 16:53:06 -050032218 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.HostIpmi", GSIZE_TO_POINTER (TYPE_HOST_IPMI_PROXY));
Norman James362a80f2015-09-14 14:04:39 -050032219 g_once_init_leave (&once_init_value, 1);
32220 }
32221 ret = (GType) GPOINTER_TO_SIZE (g_hash_table_lookup (lookup_hash, interface_name));
32222 if (ret == (GType) 0)
32223 ret = G_TYPE_DBUS_PROXY;
32224 return ret;
32225}
32226
32227/**
32228 * object_manager_client_new:
32229 * @connection: A #GDBusConnection.
32230 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
32231 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
32232 * @object_path: An object path.
32233 * @cancellable: (allow-none): A #GCancellable or %NULL.
32234 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
32235 * @user_data: User data to pass to @callback.
32236 *
32237 * Asynchronously creates #GDBusObjectManagerClient using object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new() for more details.
32238 *
32239 * 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.
32240 * You can then call object_manager_client_new_finish() to get the result of the operation.
32241 *
32242 * See object_manager_client_new_sync() for the synchronous, blocking version of this constructor.
32243 */
32244void
32245object_manager_client_new (
32246 GDBusConnection *connection,
32247 GDBusObjectManagerClientFlags flags,
32248 const gchar *name,
32249 const gchar *object_path,
32250 GCancellable *cancellable,
32251 GAsyncReadyCallback callback,
32252 gpointer user_data)
32253{
32254 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);
32255}
32256
32257/**
32258 * object_manager_client_new_finish:
32259 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_manager_client_new().
32260 * @error: Return location for error or %NULL
32261 *
32262 * Finishes an operation started with object_manager_client_new().
32263 *
32264 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
32265 */
32266GDBusObjectManager *
32267object_manager_client_new_finish (
32268 GAsyncResult *res,
32269 GError **error)
32270{
32271 GObject *ret;
32272 GObject *source_object;
32273 source_object = g_async_result_get_source_object (res);
32274 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
32275 g_object_unref (source_object);
32276 if (ret != NULL)
32277 return G_DBUS_OBJECT_MANAGER (ret);
32278 else
32279 return NULL;
32280}
32281
32282/**
32283 * object_manager_client_new_sync:
32284 * @connection: A #GDBusConnection.
32285 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
32286 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
32287 * @object_path: An object path.
32288 * @cancellable: (allow-none): A #GCancellable or %NULL.
32289 * @error: Return location for error or %NULL
32290 *
32291 * Synchronously creates #GDBusObjectManagerClient using object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new_sync() for more details.
32292 *
32293 * The calling thread is blocked until a reply is received.
32294 *
32295 * See object_manager_client_new() for the asynchronous version of this constructor.
32296 *
32297 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
32298 */
32299GDBusObjectManager *
32300object_manager_client_new_sync (
32301 GDBusConnection *connection,
32302 GDBusObjectManagerClientFlags flags,
32303 const gchar *name,
32304 const gchar *object_path,
32305 GCancellable *cancellable,
32306 GError **error)
32307{
32308 GInitable *ret;
32309 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);
32310 if (ret != NULL)
32311 return G_DBUS_OBJECT_MANAGER (ret);
32312 else
32313 return NULL;
32314}
32315
32316
32317/**
32318 * object_manager_client_new_for_bus:
32319 * @bus_type: A #GBusType.
32320 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
32321 * @name: A bus name (well-known or unique).
32322 * @object_path: An object path.
32323 * @cancellable: (allow-none): A #GCancellable or %NULL.
32324 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
32325 * @user_data: User data to pass to @callback.
32326 *
32327 * Like object_manager_client_new() but takes a #GBusType instead of a #GDBusConnection.
32328 *
32329 * 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.
32330 * You can then call object_manager_client_new_for_bus_finish() to get the result of the operation.
32331 *
32332 * See object_manager_client_new_for_bus_sync() for the synchronous, blocking version of this constructor.
32333 */
32334void
32335object_manager_client_new_for_bus (
32336 GBusType bus_type,
32337 GDBusObjectManagerClientFlags flags,
32338 const gchar *name,
32339 const gchar *object_path,
32340 GCancellable *cancellable,
32341 GAsyncReadyCallback callback,
32342 gpointer user_data)
32343{
32344 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);
32345}
32346
32347/**
32348 * object_manager_client_new_for_bus_finish:
32349 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_manager_client_new_for_bus().
32350 * @error: Return location for error or %NULL
32351 *
32352 * Finishes an operation started with object_manager_client_new_for_bus().
32353 *
32354 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
32355 */
32356GDBusObjectManager *
32357object_manager_client_new_for_bus_finish (
32358 GAsyncResult *res,
32359 GError **error)
32360{
32361 GObject *ret;
32362 GObject *source_object;
32363 source_object = g_async_result_get_source_object (res);
32364 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
32365 g_object_unref (source_object);
32366 if (ret != NULL)
32367 return G_DBUS_OBJECT_MANAGER (ret);
32368 else
32369 return NULL;
32370}
32371
32372/**
32373 * object_manager_client_new_for_bus_sync:
32374 * @bus_type: A #GBusType.
32375 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
32376 * @name: A bus name (well-known or unique).
32377 * @object_path: An object path.
32378 * @cancellable: (allow-none): A #GCancellable or %NULL.
32379 * @error: Return location for error or %NULL
32380 *
32381 * Like object_manager_client_new_sync() but takes a #GBusType instead of a #GDBusConnection.
32382 *
32383 * The calling thread is blocked until a reply is received.
32384 *
32385 * See object_manager_client_new_for_bus() for the asynchronous version of this constructor.
32386 *
32387 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
32388 */
32389GDBusObjectManager *
32390object_manager_client_new_for_bus_sync (
32391 GBusType bus_type,
32392 GDBusObjectManagerClientFlags flags,
32393 const gchar *name,
32394 const gchar *object_path,
32395 GCancellable *cancellable,
32396 GError **error)
32397{
32398 GInitable *ret;
32399 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);
32400 if (ret != NULL)
32401 return G_DBUS_OBJECT_MANAGER (ret);
32402 else
32403 return NULL;
32404}
32405
32406