blob: 62b6016c5f3053a42d6f142f44e1466bc93bd53a [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
Norman James74828452015-11-17 13:10:34 -06001014static const _ExtendedGDBusPropertyInfo _hwmon_property_info_scale =
Norman James5236a8f2015-11-05 20:39:31 -06001015{
1016 {
1017 -1,
Norman James74828452015-11-17 13:10:34 -06001018 (gchar *) "scale",
1019 (gchar *) "i",
Norman James5236a8f2015-11-05 20:39:31 -06001020 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
1021 NULL
1022 },
Norman James74828452015-11-17 13:10:34 -06001023 "scale",
Norman James5236a8f2015-11-05 20:39:31 -06001024 FALSE
1025};
1026
1027static const _ExtendedGDBusPropertyInfo * const _hwmon_property_info_pointers[] =
1028{
1029 &_hwmon_property_info_poll_interval,
1030 &_hwmon_property_info_sysfs_path,
Norman James74828452015-11-17 13:10:34 -06001031 &_hwmon_property_info_scale,
Norman James5236a8f2015-11-05 20:39:31 -06001032 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");
Norman James74828452015-11-17 13:10:34 -06001077 g_object_class_override_property (klass, property_id_begin++, "scale");
Norman James5236a8f2015-11-05 20:39:31 -06001078 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.
Norman James74828452015-11-17 13:10:34 -06001093 * @get_scale: Getter for the #Hwmon:scale property.
Norman James5236a8f2015-11-05 20:39:31 -06001094 * @get_sysfs_path: Getter for the #Hwmon:sysfs-path property.
Norman James5236a8f2015-11-05 20:39:31 -06001095 *
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 /**
Norman James74828452015-11-17 13:10:34 -06001125 * Hwmon:scale:
Norman James5236a8f2015-11-05 20:39:31 -06001126 *
Norman James74828452015-11-17 13:10:34 -06001127 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Hwmon.scale">"scale"</link>.
Norman James5236a8f2015-11-05 20:39:31 -06001128 *
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,
Norman James74828452015-11-17 13:10:34 -06001132 g_param_spec_int ("scale", "scale", "scale", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Norman James5236a8f2015-11-05 20:39:31 -06001133}
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/**
Norman James74828452015-11-17 13:10:34 -06001218 * hwmon_get_scale: (skip)
Norman James5236a8f2015-11-05 20:39:31 -06001219 * @object: A #Hwmon.
1220 *
Norman James74828452015-11-17 13:10:34 -06001221 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Hwmon.scale">"scale"</link> D-Bus property.
Norman James5236a8f2015-11-05 20:39:31 -06001222 *
1223 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
1224 *
Norman James74828452015-11-17 13:10:34 -06001225 * Returns: The property value.
Norman James5236a8f2015-11-05 20:39:31 -06001226 */
Norman James74828452015-11-17 13:10:34 -06001227gint
1228hwmon_get_scale (Hwmon *object)
Norman James5236a8f2015-11-05 20:39:31 -06001229{
Norman James74828452015-11-17 13:10:34 -06001230 return HWMON_GET_IFACE (object)->get_scale (object);
Norman James5236a8f2015-11-05 20:39:31 -06001231}
1232
1233/**
Norman James74828452015-11-17 13:10:34 -06001234 * hwmon_set_scale: (skip)
Norman James5236a8f2015-11-05 20:39:31 -06001235 * @object: A #Hwmon.
1236 * @value: The value to set.
1237 *
Norman James74828452015-11-17 13:10:34 -06001238 * Sets the <link linkend="gdbus-property-org-openbmc-Hwmon.scale">"scale"</link> D-Bus property to @value.
Norman James5236a8f2015-11-05 20:39:31 -06001239 *
1240 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
1241 */
1242void
Norman James74828452015-11-17 13:10:34 -06001243hwmon_set_scale (Hwmon *object, gint value)
Norman James5236a8f2015-11-05 20:39:31 -06001244{
Norman James74828452015-11-17 13:10:34 -06001245 g_object_set (G_OBJECT (object), "scale", value, NULL);
Norman James5236a8f2015-11-05 20:39:31 -06001246}
1247
1248/* ------------------------------------------------------------------------ */
1249
1250/**
1251 * HwmonProxy:
1252 *
1253 * The #HwmonProxy structure contains only private data and should only be accessed using the provided API.
1254 */
1255
1256/**
1257 * HwmonProxyClass:
1258 * @parent_class: The parent class.
1259 *
1260 * Class structure for #HwmonProxy.
1261 */
1262
1263struct _HwmonProxyPrivate
1264{
1265 GData *qdata;
1266};
1267
1268static void hwmon_proxy_iface_init (HwmonIface *iface);
1269
1270#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
1271G_DEFINE_TYPE_WITH_CODE (HwmonProxy, hwmon_proxy, G_TYPE_DBUS_PROXY,
1272 G_ADD_PRIVATE (HwmonProxy)
1273 G_IMPLEMENT_INTERFACE (TYPE_HWMON, hwmon_proxy_iface_init));
1274
1275#else
1276G_DEFINE_TYPE_WITH_CODE (HwmonProxy, hwmon_proxy, G_TYPE_DBUS_PROXY,
1277 G_IMPLEMENT_INTERFACE (TYPE_HWMON, hwmon_proxy_iface_init));
1278
1279#endif
1280static void
1281hwmon_proxy_finalize (GObject *object)
1282{
1283 HwmonProxy *proxy = HWMON_PROXY (object);
1284 g_datalist_clear (&proxy->priv->qdata);
1285 G_OBJECT_CLASS (hwmon_proxy_parent_class)->finalize (object);
1286}
1287
1288static void
1289hwmon_proxy_get_property (GObject *object,
1290 guint prop_id,
1291 GValue *value,
1292 GParamSpec *pspec G_GNUC_UNUSED)
1293{
1294 const _ExtendedGDBusPropertyInfo *info;
1295 GVariant *variant;
1296 g_assert (prop_id != 0 && prop_id - 1 < 3);
1297 info = _hwmon_property_info_pointers[prop_id - 1];
1298 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
1299 if (info->use_gvariant)
1300 {
1301 g_value_set_variant (value, variant);
1302 }
1303 else
1304 {
1305 if (variant != NULL)
1306 g_dbus_gvariant_to_gvalue (variant, value);
1307 }
1308 if (variant != NULL)
1309 g_variant_unref (variant);
1310}
1311
1312static void
1313hwmon_proxy_set_property_cb (GDBusProxy *proxy,
1314 GAsyncResult *res,
1315 gpointer user_data)
1316{
1317 const _ExtendedGDBusPropertyInfo *info = user_data;
1318 GError *error;
1319 GVariant *_ret;
1320 error = NULL;
1321 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
1322 if (!_ret)
1323 {
1324 g_warning ("Error setting property '%s' on interface org.openbmc.Hwmon: %s (%s, %d)",
1325 info->parent_struct.name,
1326 error->message, g_quark_to_string (error->domain), error->code);
1327 g_error_free (error);
1328 }
1329 else
1330 {
1331 g_variant_unref (_ret);
1332 }
1333}
1334
1335static void
1336hwmon_proxy_set_property (GObject *object,
1337 guint prop_id,
1338 const GValue *value,
1339 GParamSpec *pspec G_GNUC_UNUSED)
1340{
1341 const _ExtendedGDBusPropertyInfo *info;
1342 GVariant *variant;
1343 g_assert (prop_id != 0 && prop_id - 1 < 3);
1344 info = _hwmon_property_info_pointers[prop_id - 1];
1345 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
1346 g_dbus_proxy_call (G_DBUS_PROXY (object),
1347 "org.freedesktop.DBus.Properties.Set",
1348 g_variant_new ("(ssv)", "org.openbmc.Hwmon", info->parent_struct.name, variant),
1349 G_DBUS_CALL_FLAGS_NONE,
1350 -1,
1351 NULL, (GAsyncReadyCallback) hwmon_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
1352 g_variant_unref (variant);
1353}
1354
1355static void
1356hwmon_proxy_g_signal (GDBusProxy *proxy,
1357 const gchar *sender_name G_GNUC_UNUSED,
1358 const gchar *signal_name,
1359 GVariant *parameters)
1360{
1361 _ExtendedGDBusSignalInfo *info;
1362 GVariantIter iter;
1363 GVariant *child;
1364 GValue *paramv;
1365 guint num_params;
1366 guint n;
1367 guint signal_id;
1368 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_hwmon_interface_info.parent_struct, signal_name);
1369 if (info == NULL)
1370 return;
1371 num_params = g_variant_n_children (parameters);
1372 paramv = g_new0 (GValue, num_params + 1);
1373 g_value_init (&paramv[0], TYPE_HWMON);
1374 g_value_set_object (&paramv[0], proxy);
1375 g_variant_iter_init (&iter, parameters);
1376 n = 1;
1377 while ((child = g_variant_iter_next_value (&iter)) != NULL)
1378 {
1379 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
1380 if (arg_info->use_gvariant)
1381 {
1382 g_value_init (&paramv[n], G_TYPE_VARIANT);
1383 g_value_set_variant (&paramv[n], child);
1384 n++;
1385 }
1386 else
1387 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
1388 g_variant_unref (child);
1389 }
1390 signal_id = g_signal_lookup (info->signal_name, TYPE_HWMON);
1391 g_signal_emitv (paramv, signal_id, 0, NULL);
1392 for (n = 0; n < num_params + 1; n++)
1393 g_value_unset (&paramv[n]);
1394 g_free (paramv);
1395}
1396
1397static void
1398hwmon_proxy_g_properties_changed (GDBusProxy *_proxy,
1399 GVariant *changed_properties,
1400 const gchar *const *invalidated_properties)
1401{
1402 HwmonProxy *proxy = HWMON_PROXY (_proxy);
1403 guint n;
1404 const gchar *key;
1405 GVariantIter *iter;
1406 _ExtendedGDBusPropertyInfo *info;
1407 g_variant_get (changed_properties, "a{sv}", &iter);
1408 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
1409 {
1410 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_hwmon_interface_info.parent_struct, key);
1411 g_datalist_remove_data (&proxy->priv->qdata, key);
1412 if (info != NULL)
1413 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
1414 }
1415 g_variant_iter_free (iter);
1416 for (n = 0; invalidated_properties[n] != NULL; n++)
1417 {
1418 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_hwmon_interface_info.parent_struct, invalidated_properties[n]);
1419 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
1420 if (info != NULL)
1421 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
1422 }
1423}
1424
1425static gint
1426hwmon_proxy_get_poll_interval (Hwmon *object)
1427{
1428 HwmonProxy *proxy = HWMON_PROXY (object);
1429 GVariant *variant;
1430 gint value = 0;
1431 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "poll_interval");
1432 if (variant != NULL)
1433 {
1434 value = g_variant_get_int32 (variant);
1435 g_variant_unref (variant);
1436 }
1437 return value;
1438}
1439
1440static const gchar *
1441hwmon_proxy_get_sysfs_path (Hwmon *object)
1442{
1443 HwmonProxy *proxy = HWMON_PROXY (object);
1444 GVariant *variant;
1445 const gchar *value = NULL;
1446 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "sysfs_path");
1447 if (variant != NULL)
1448 {
1449 value = g_variant_get_string (variant, NULL);
1450 g_variant_unref (variant);
1451 }
1452 return value;
1453}
1454
Norman James74828452015-11-17 13:10:34 -06001455static gint
1456hwmon_proxy_get_scale (Hwmon *object)
Norman James5236a8f2015-11-05 20:39:31 -06001457{
1458 HwmonProxy *proxy = HWMON_PROXY (object);
1459 GVariant *variant;
Norman James74828452015-11-17 13:10:34 -06001460 gint value = 0;
1461 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "scale");
Norman James5236a8f2015-11-05 20:39:31 -06001462 if (variant != NULL)
Norman James74828452015-11-17 13:10:34 -06001463 {
1464 value = g_variant_get_int32 (variant);
1465 g_variant_unref (variant);
1466 }
Norman James5236a8f2015-11-05 20:39:31 -06001467 return value;
1468}
1469
1470static void
1471hwmon_proxy_init (HwmonProxy *proxy)
1472{
1473#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
1474 proxy->priv = hwmon_proxy_get_instance_private (proxy);
1475#else
1476 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_HWMON_PROXY, HwmonProxyPrivate);
1477#endif
1478
1479 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), hwmon_interface_info ());
1480}
1481
1482static void
1483hwmon_proxy_class_init (HwmonProxyClass *klass)
1484{
1485 GObjectClass *gobject_class;
1486 GDBusProxyClass *proxy_class;
1487
1488 gobject_class = G_OBJECT_CLASS (klass);
1489 gobject_class->finalize = hwmon_proxy_finalize;
1490 gobject_class->get_property = hwmon_proxy_get_property;
1491 gobject_class->set_property = hwmon_proxy_set_property;
1492
1493 proxy_class = G_DBUS_PROXY_CLASS (klass);
1494 proxy_class->g_signal = hwmon_proxy_g_signal;
1495 proxy_class->g_properties_changed = hwmon_proxy_g_properties_changed;
1496
1497 hwmon_override_properties (gobject_class, 1);
1498
1499#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
1500 g_type_class_add_private (klass, sizeof (HwmonProxyPrivate));
1501#endif
1502}
1503
1504static void
1505hwmon_proxy_iface_init (HwmonIface *iface)
1506{
1507 iface->get_poll_interval = hwmon_proxy_get_poll_interval;
1508 iface->get_sysfs_path = hwmon_proxy_get_sysfs_path;
Norman James74828452015-11-17 13:10:34 -06001509 iface->get_scale = hwmon_proxy_get_scale;
Norman James5236a8f2015-11-05 20:39:31 -06001510}
1511
1512/**
1513 * hwmon_proxy_new:
1514 * @connection: A #GDBusConnection.
1515 * @flags: Flags from the #GDBusProxyFlags enumeration.
1516 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
1517 * @object_path: An object path.
1518 * @cancellable: (allow-none): A #GCancellable or %NULL.
1519 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
1520 * @user_data: User data to pass to @callback.
1521 *
1522 * 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.
1523 *
1524 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
1525 * You can then call hwmon_proxy_new_finish() to get the result of the operation.
1526 *
1527 * See hwmon_proxy_new_sync() for the synchronous, blocking version of this constructor.
1528 */
1529void
1530hwmon_proxy_new (
1531 GDBusConnection *connection,
1532 GDBusProxyFlags flags,
1533 const gchar *name,
1534 const gchar *object_path,
1535 GCancellable *cancellable,
1536 GAsyncReadyCallback callback,
1537 gpointer user_data)
1538{
1539 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);
1540}
1541
1542/**
1543 * hwmon_proxy_new_finish:
1544 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to hwmon_proxy_new().
1545 * @error: Return location for error or %NULL
1546 *
1547 * Finishes an operation started with hwmon_proxy_new().
1548 *
1549 * Returns: (transfer full) (type HwmonProxy): The constructed proxy object or %NULL if @error is set.
1550 */
1551Hwmon *
1552hwmon_proxy_new_finish (
1553 GAsyncResult *res,
1554 GError **error)
1555{
1556 GObject *ret;
1557 GObject *source_object;
1558 source_object = g_async_result_get_source_object (res);
1559 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
1560 g_object_unref (source_object);
1561 if (ret != NULL)
1562 return HWMON (ret);
1563 else
1564 return NULL;
1565}
1566
1567/**
1568 * hwmon_proxy_new_sync:
1569 * @connection: A #GDBusConnection.
1570 * @flags: Flags from the #GDBusProxyFlags enumeration.
1571 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
1572 * @object_path: An object path.
1573 * @cancellable: (allow-none): A #GCancellable or %NULL.
1574 * @error: Return location for error or %NULL
1575 *
1576 * 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.
1577 *
1578 * The calling thread is blocked until a reply is received.
1579 *
1580 * See hwmon_proxy_new() for the asynchronous version of this constructor.
1581 *
1582 * Returns: (transfer full) (type HwmonProxy): The constructed proxy object or %NULL if @error is set.
1583 */
1584Hwmon *
1585hwmon_proxy_new_sync (
1586 GDBusConnection *connection,
1587 GDBusProxyFlags flags,
1588 const gchar *name,
1589 const gchar *object_path,
1590 GCancellable *cancellable,
1591 GError **error)
1592{
1593 GInitable *ret;
1594 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);
1595 if (ret != NULL)
1596 return HWMON (ret);
1597 else
1598 return NULL;
1599}
1600
1601
1602/**
1603 * hwmon_proxy_new_for_bus:
1604 * @bus_type: A #GBusType.
1605 * @flags: Flags from the #GDBusProxyFlags enumeration.
1606 * @name: A bus name (well-known or unique).
1607 * @object_path: An object path.
1608 * @cancellable: (allow-none): A #GCancellable or %NULL.
1609 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
1610 * @user_data: User data to pass to @callback.
1611 *
1612 * Like hwmon_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
1613 *
1614 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
1615 * You can then call hwmon_proxy_new_for_bus_finish() to get the result of the operation.
1616 *
1617 * See hwmon_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
1618 */
1619void
1620hwmon_proxy_new_for_bus (
1621 GBusType bus_type,
1622 GDBusProxyFlags flags,
1623 const gchar *name,
1624 const gchar *object_path,
1625 GCancellable *cancellable,
1626 GAsyncReadyCallback callback,
1627 gpointer user_data)
1628{
1629 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);
1630}
1631
1632/**
1633 * hwmon_proxy_new_for_bus_finish:
1634 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to hwmon_proxy_new_for_bus().
1635 * @error: Return location for error or %NULL
1636 *
1637 * Finishes an operation started with hwmon_proxy_new_for_bus().
1638 *
1639 * Returns: (transfer full) (type HwmonProxy): The constructed proxy object or %NULL if @error is set.
1640 */
1641Hwmon *
1642hwmon_proxy_new_for_bus_finish (
1643 GAsyncResult *res,
1644 GError **error)
1645{
1646 GObject *ret;
1647 GObject *source_object;
1648 source_object = g_async_result_get_source_object (res);
1649 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
1650 g_object_unref (source_object);
1651 if (ret != NULL)
1652 return HWMON (ret);
1653 else
1654 return NULL;
1655}
1656
1657/**
1658 * hwmon_proxy_new_for_bus_sync:
1659 * @bus_type: A #GBusType.
1660 * @flags: Flags from the #GDBusProxyFlags enumeration.
1661 * @name: A bus name (well-known or unique).
1662 * @object_path: An object path.
1663 * @cancellable: (allow-none): A #GCancellable or %NULL.
1664 * @error: Return location for error or %NULL
1665 *
1666 * Like hwmon_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
1667 *
1668 * The calling thread is blocked until a reply is received.
1669 *
1670 * See hwmon_proxy_new_for_bus() for the asynchronous version of this constructor.
1671 *
1672 * Returns: (transfer full) (type HwmonProxy): The constructed proxy object or %NULL if @error is set.
1673 */
1674Hwmon *
1675hwmon_proxy_new_for_bus_sync (
1676 GBusType bus_type,
1677 GDBusProxyFlags flags,
1678 const gchar *name,
1679 const gchar *object_path,
1680 GCancellable *cancellable,
1681 GError **error)
1682{
1683 GInitable *ret;
1684 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);
1685 if (ret != NULL)
1686 return HWMON (ret);
1687 else
1688 return NULL;
1689}
1690
1691
1692/* ------------------------------------------------------------------------ */
1693
1694/**
1695 * HwmonSkeleton:
1696 *
1697 * The #HwmonSkeleton structure contains only private data and should only be accessed using the provided API.
1698 */
1699
1700/**
1701 * HwmonSkeletonClass:
1702 * @parent_class: The parent class.
1703 *
1704 * Class structure for #HwmonSkeleton.
1705 */
1706
1707struct _HwmonSkeletonPrivate
1708{
1709 GValue *properties;
1710 GList *changed_properties;
1711 GSource *changed_properties_idle_source;
1712 GMainContext *context;
1713 GMutex lock;
1714};
1715
1716static void
1717_hwmon_skeleton_handle_method_call (
1718 GDBusConnection *connection G_GNUC_UNUSED,
1719 const gchar *sender G_GNUC_UNUSED,
1720 const gchar *object_path G_GNUC_UNUSED,
1721 const gchar *interface_name,
1722 const gchar *method_name,
1723 GVariant *parameters,
1724 GDBusMethodInvocation *invocation,
1725 gpointer user_data)
1726{
1727 HwmonSkeleton *skeleton = HWMON_SKELETON (user_data);
1728 _ExtendedGDBusMethodInfo *info;
1729 GVariantIter iter;
1730 GVariant *child;
1731 GValue *paramv;
1732 guint num_params;
1733 guint num_extra;
1734 guint n;
1735 guint signal_id;
1736 GValue return_value = G_VALUE_INIT;
1737 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
1738 g_assert (info != NULL);
1739 num_params = g_variant_n_children (parameters);
1740 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
1741 n = 0;
1742 g_value_init (&paramv[n], TYPE_HWMON);
1743 g_value_set_object (&paramv[n++], skeleton);
1744 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
1745 g_value_set_object (&paramv[n++], invocation);
1746 if (info->pass_fdlist)
1747 {
1748#ifdef G_OS_UNIX
1749 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
1750 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
1751#else
1752 g_assert_not_reached ();
1753#endif
1754 }
1755 g_variant_iter_init (&iter, parameters);
1756 while ((child = g_variant_iter_next_value (&iter)) != NULL)
1757 {
1758 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
1759 if (arg_info->use_gvariant)
1760 {
1761 g_value_init (&paramv[n], G_TYPE_VARIANT);
1762 g_value_set_variant (&paramv[n], child);
1763 n++;
1764 }
1765 else
1766 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
1767 g_variant_unref (child);
1768 }
1769 signal_id = g_signal_lookup (info->signal_name, TYPE_HWMON);
1770 g_value_init (&return_value, G_TYPE_BOOLEAN);
1771 g_signal_emitv (paramv, signal_id, 0, &return_value);
1772 if (!g_value_get_boolean (&return_value))
1773 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);
1774 g_value_unset (&return_value);
1775 for (n = 0; n < num_params + num_extra; n++)
1776 g_value_unset (&paramv[n]);
1777 g_free (paramv);
1778}
1779
1780static GVariant *
1781_hwmon_skeleton_handle_get_property (
1782 GDBusConnection *connection G_GNUC_UNUSED,
1783 const gchar *sender G_GNUC_UNUSED,
1784 const gchar *object_path G_GNUC_UNUSED,
1785 const gchar *interface_name G_GNUC_UNUSED,
1786 const gchar *property_name,
1787 GError **error,
1788 gpointer user_data)
1789{
1790 HwmonSkeleton *skeleton = HWMON_SKELETON (user_data);
1791 GValue value = G_VALUE_INIT;
1792 GParamSpec *pspec;
1793 _ExtendedGDBusPropertyInfo *info;
1794 GVariant *ret;
1795 ret = NULL;
1796 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_hwmon_interface_info.parent_struct, property_name);
1797 g_assert (info != NULL);
1798 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
1799 if (pspec == NULL)
1800 {
1801 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
1802 }
1803 else
1804 {
1805 g_value_init (&value, pspec->value_type);
1806 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
1807 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
1808 g_value_unset (&value);
1809 }
1810 return ret;
1811}
1812
1813static gboolean
1814_hwmon_skeleton_handle_set_property (
1815 GDBusConnection *connection G_GNUC_UNUSED,
1816 const gchar *sender G_GNUC_UNUSED,
1817 const gchar *object_path G_GNUC_UNUSED,
1818 const gchar *interface_name G_GNUC_UNUSED,
1819 const gchar *property_name,
1820 GVariant *variant,
1821 GError **error,
1822 gpointer user_data)
1823{
1824 HwmonSkeleton *skeleton = HWMON_SKELETON (user_data);
1825 GValue value = G_VALUE_INIT;
1826 GParamSpec *pspec;
1827 _ExtendedGDBusPropertyInfo *info;
1828 gboolean ret;
1829 ret = FALSE;
1830 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_hwmon_interface_info.parent_struct, property_name);
1831 g_assert (info != NULL);
1832 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
1833 if (pspec == NULL)
1834 {
1835 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
1836 }
1837 else
1838 {
1839 if (info->use_gvariant)
1840 g_value_set_variant (&value, variant);
1841 else
1842 g_dbus_gvariant_to_gvalue (variant, &value);
1843 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
1844 g_value_unset (&value);
1845 ret = TRUE;
1846 }
1847 return ret;
1848}
1849
1850static const GDBusInterfaceVTable _hwmon_skeleton_vtable =
1851{
1852 _hwmon_skeleton_handle_method_call,
1853 _hwmon_skeleton_handle_get_property,
1854 _hwmon_skeleton_handle_set_property,
1855 {NULL}
1856};
1857
1858static GDBusInterfaceInfo *
1859hwmon_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
1860{
1861 return hwmon_interface_info ();
1862}
1863
1864static GDBusInterfaceVTable *
1865hwmon_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
1866{
1867 return (GDBusInterfaceVTable *) &_hwmon_skeleton_vtable;
1868}
1869
1870static GVariant *
1871hwmon_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
1872{
1873 HwmonSkeleton *skeleton = HWMON_SKELETON (_skeleton);
1874
1875 GVariantBuilder builder;
1876 guint n;
1877 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
1878 if (_hwmon_interface_info.parent_struct.properties == NULL)
1879 goto out;
1880 for (n = 0; _hwmon_interface_info.parent_struct.properties[n] != NULL; n++)
1881 {
1882 GDBusPropertyInfo *info = _hwmon_interface_info.parent_struct.properties[n];
1883 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
1884 {
1885 GVariant *value;
1886 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);
1887 if (value != NULL)
1888 {
1889 g_variant_take_ref (value);
1890 g_variant_builder_add (&builder, "{sv}", info->name, value);
1891 g_variant_unref (value);
1892 }
1893 }
1894 }
1895out:
1896 return g_variant_builder_end (&builder);
1897}
1898
1899static gboolean _hwmon_emit_changed (gpointer user_data);
1900
1901static void
1902hwmon_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
1903{
1904 HwmonSkeleton *skeleton = HWMON_SKELETON (_skeleton);
1905 gboolean emit_changed = FALSE;
1906
1907 g_mutex_lock (&skeleton->priv->lock);
1908 if (skeleton->priv->changed_properties_idle_source != NULL)
1909 {
1910 g_source_destroy (skeleton->priv->changed_properties_idle_source);
1911 skeleton->priv->changed_properties_idle_source = NULL;
1912 emit_changed = TRUE;
1913 }
1914 g_mutex_unlock (&skeleton->priv->lock);
1915
1916 if (emit_changed)
1917 _hwmon_emit_changed (skeleton);
1918}
1919
1920static void hwmon_skeleton_iface_init (HwmonIface *iface);
1921#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
1922G_DEFINE_TYPE_WITH_CODE (HwmonSkeleton, hwmon_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
1923 G_ADD_PRIVATE (HwmonSkeleton)
1924 G_IMPLEMENT_INTERFACE (TYPE_HWMON, hwmon_skeleton_iface_init));
1925
1926#else
1927G_DEFINE_TYPE_WITH_CODE (HwmonSkeleton, hwmon_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
1928 G_IMPLEMENT_INTERFACE (TYPE_HWMON, hwmon_skeleton_iface_init));
1929
1930#endif
1931static void
1932hwmon_skeleton_finalize (GObject *object)
1933{
1934 HwmonSkeleton *skeleton = HWMON_SKELETON (object);
1935 guint n;
1936 for (n = 0; n < 3; n++)
1937 g_value_unset (&skeleton->priv->properties[n]);
1938 g_free (skeleton->priv->properties);
1939 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
1940 if (skeleton->priv->changed_properties_idle_source != NULL)
1941 g_source_destroy (skeleton->priv->changed_properties_idle_source);
1942 g_main_context_unref (skeleton->priv->context);
1943 g_mutex_clear (&skeleton->priv->lock);
1944 G_OBJECT_CLASS (hwmon_skeleton_parent_class)->finalize (object);
1945}
1946
1947static void
1948hwmon_skeleton_get_property (GObject *object,
1949 guint prop_id,
1950 GValue *value,
1951 GParamSpec *pspec G_GNUC_UNUSED)
1952{
1953 HwmonSkeleton *skeleton = HWMON_SKELETON (object);
1954 g_assert (prop_id != 0 && prop_id - 1 < 3);
1955 g_mutex_lock (&skeleton->priv->lock);
1956 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
1957 g_mutex_unlock (&skeleton->priv->lock);
1958}
1959
1960static gboolean
1961_hwmon_emit_changed (gpointer user_data)
1962{
1963 HwmonSkeleton *skeleton = HWMON_SKELETON (user_data);
1964 GList *l;
1965 GVariantBuilder builder;
1966 GVariantBuilder invalidated_builder;
1967 guint num_changes;
1968
1969 g_mutex_lock (&skeleton->priv->lock);
1970 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
1971 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
1972 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
1973 {
1974 ChangedProperty *cp = l->data;
1975 GVariant *variant;
1976 const GValue *cur_value;
1977
1978 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
1979 if (!_g_value_equal (cur_value, &cp->orig_value))
1980 {
1981 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
1982 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
1983 g_variant_unref (variant);
1984 num_changes++;
1985 }
1986 }
1987 if (num_changes > 0)
1988 {
1989 GList *connections, *ll;
1990 GVariant *signal_variant;
1991 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Hwmon",
1992 &builder, &invalidated_builder));
1993 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
1994 for (ll = connections; ll != NULL; ll = ll->next)
1995 {
1996 GDBusConnection *connection = ll->data;
1997
1998 g_dbus_connection_emit_signal (connection,
1999 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
2000 "org.freedesktop.DBus.Properties",
2001 "PropertiesChanged",
2002 signal_variant,
2003 NULL);
2004 }
2005 g_variant_unref (signal_variant);
2006 g_list_free_full (connections, g_object_unref);
2007 }
2008 else
2009 {
2010 g_variant_builder_clear (&builder);
2011 g_variant_builder_clear (&invalidated_builder);
2012 }
2013 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
2014 skeleton->priv->changed_properties = NULL;
2015 skeleton->priv->changed_properties_idle_source = NULL;
2016 g_mutex_unlock (&skeleton->priv->lock);
2017 return FALSE;
2018}
2019
2020static void
2021_hwmon_schedule_emit_changed (HwmonSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
2022{
2023 ChangedProperty *cp;
2024 GList *l;
2025 cp = NULL;
2026 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
2027 {
2028 ChangedProperty *i_cp = l->data;
2029 if (i_cp->info == info)
2030 {
2031 cp = i_cp;
2032 break;
2033 }
2034 }
2035 if (cp == NULL)
2036 {
2037 cp = g_new0 (ChangedProperty, 1);
2038 cp->prop_id = prop_id;
2039 cp->info = info;
2040 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
2041 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
2042 g_value_copy (orig_value, &cp->orig_value);
2043 }
2044}
2045
2046static void
2047hwmon_skeleton_notify (GObject *object,
2048 GParamSpec *pspec G_GNUC_UNUSED)
2049{
2050 HwmonSkeleton *skeleton = HWMON_SKELETON (object);
2051 g_mutex_lock (&skeleton->priv->lock);
2052 if (skeleton->priv->changed_properties != NULL &&
2053 skeleton->priv->changed_properties_idle_source == NULL)
2054 {
2055 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
2056 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
2057 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _hwmon_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
2058 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
2059 g_source_unref (skeleton->priv->changed_properties_idle_source);
2060 }
2061 g_mutex_unlock (&skeleton->priv->lock);
2062}
2063
2064static void
2065hwmon_skeleton_set_property (GObject *object,
2066 guint prop_id,
2067 const GValue *value,
2068 GParamSpec *pspec)
2069{
2070 HwmonSkeleton *skeleton = HWMON_SKELETON (object);
2071 g_assert (prop_id != 0 && prop_id - 1 < 3);
2072 g_mutex_lock (&skeleton->priv->lock);
2073 g_object_freeze_notify (object);
2074 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
2075 {
2076 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
2077 _hwmon_schedule_emit_changed (skeleton, _hwmon_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
2078 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
2079 g_object_notify_by_pspec (object, pspec);
2080 }
2081 g_mutex_unlock (&skeleton->priv->lock);
2082 g_object_thaw_notify (object);
2083}
2084
2085static void
2086hwmon_skeleton_init (HwmonSkeleton *skeleton)
2087{
2088#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
2089 skeleton->priv = hwmon_skeleton_get_instance_private (skeleton);
2090#else
2091 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_HWMON_SKELETON, HwmonSkeletonPrivate);
2092#endif
2093
2094 g_mutex_init (&skeleton->priv->lock);
2095 skeleton->priv->context = g_main_context_ref_thread_default ();
2096 skeleton->priv->properties = g_new0 (GValue, 3);
2097 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
2098 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
Norman James74828452015-11-17 13:10:34 -06002099 g_value_init (&skeleton->priv->properties[2], G_TYPE_INT);
Norman James5236a8f2015-11-05 20:39:31 -06002100}
2101
2102static gint
2103hwmon_skeleton_get_poll_interval (Hwmon *object)
2104{
2105 HwmonSkeleton *skeleton = HWMON_SKELETON (object);
2106 gint value;
2107 g_mutex_lock (&skeleton->priv->lock);
2108 value = g_value_get_int (&(skeleton->priv->properties[0]));
2109 g_mutex_unlock (&skeleton->priv->lock);
2110 return value;
2111}
2112
2113static const gchar *
2114hwmon_skeleton_get_sysfs_path (Hwmon *object)
2115{
2116 HwmonSkeleton *skeleton = HWMON_SKELETON (object);
2117 const gchar *value;
2118 g_mutex_lock (&skeleton->priv->lock);
2119 value = g_value_get_string (&(skeleton->priv->properties[1]));
2120 g_mutex_unlock (&skeleton->priv->lock);
2121 return value;
2122}
2123
Norman James74828452015-11-17 13:10:34 -06002124static gint
2125hwmon_skeleton_get_scale (Hwmon *object)
Norman James5236a8f2015-11-05 20:39:31 -06002126{
2127 HwmonSkeleton *skeleton = HWMON_SKELETON (object);
Norman James74828452015-11-17 13:10:34 -06002128 gint value;
Norman James5236a8f2015-11-05 20:39:31 -06002129 g_mutex_lock (&skeleton->priv->lock);
Norman James74828452015-11-17 13:10:34 -06002130 value = g_value_get_int (&(skeleton->priv->properties[2]));
Norman James5236a8f2015-11-05 20:39:31 -06002131 g_mutex_unlock (&skeleton->priv->lock);
2132 return value;
2133}
2134
2135static void
2136hwmon_skeleton_class_init (HwmonSkeletonClass *klass)
2137{
2138 GObjectClass *gobject_class;
2139 GDBusInterfaceSkeletonClass *skeleton_class;
2140
2141 gobject_class = G_OBJECT_CLASS (klass);
2142 gobject_class->finalize = hwmon_skeleton_finalize;
2143 gobject_class->get_property = hwmon_skeleton_get_property;
2144 gobject_class->set_property = hwmon_skeleton_set_property;
2145 gobject_class->notify = hwmon_skeleton_notify;
2146
2147
2148 hwmon_override_properties (gobject_class, 1);
2149
2150 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
2151 skeleton_class->get_info = hwmon_skeleton_dbus_interface_get_info;
2152 skeleton_class->get_properties = hwmon_skeleton_dbus_interface_get_properties;
2153 skeleton_class->flush = hwmon_skeleton_dbus_interface_flush;
2154 skeleton_class->get_vtable = hwmon_skeleton_dbus_interface_get_vtable;
2155
2156#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
2157 g_type_class_add_private (klass, sizeof (HwmonSkeletonPrivate));
2158#endif
2159}
2160
2161static void
2162hwmon_skeleton_iface_init (HwmonIface *iface)
2163{
2164 iface->get_poll_interval = hwmon_skeleton_get_poll_interval;
2165 iface->get_sysfs_path = hwmon_skeleton_get_sysfs_path;
Norman James74828452015-11-17 13:10:34 -06002166 iface->get_scale = hwmon_skeleton_get_scale;
Norman James5236a8f2015-11-05 20:39:31 -06002167}
2168
2169/**
2170 * hwmon_skeleton_new:
2171 *
2172 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Hwmon.top_of_page">org.openbmc.Hwmon</link>.
2173 *
2174 * Returns: (transfer full) (type HwmonSkeleton): The skeleton object.
2175 */
2176Hwmon *
2177hwmon_skeleton_new (void)
2178{
2179 return HWMON (g_object_new (TYPE_HWMON_SKELETON, NULL));
2180}
2181
2182/* ------------------------------------------------------------------------
Norman James362a80f2015-09-14 14:04:39 -05002183 * Code for interface org.openbmc.Fan
2184 * ------------------------------------------------------------------------
2185 */
2186
2187/**
2188 * SECTION:Fan
2189 * @title: Fan
2190 * @short_description: Generated C code for the org.openbmc.Fan D-Bus interface
2191 *
2192 * 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.
2193 */
2194
2195/* ---- Introspection data for org.openbmc.Fan ---- */
2196
2197static const _ExtendedGDBusArgInfo _fan_method_info_set_cooling_zone_IN_ARG_cooling_zone =
2198{
2199 {
2200 -1,
2201 (gchar *) "cooling_zone",
2202 (gchar *) "i",
2203 NULL
2204 },
2205 FALSE
2206};
2207
2208static const _ExtendedGDBusArgInfo * const _fan_method_info_set_cooling_zone_IN_ARG_pointers[] =
2209{
2210 &_fan_method_info_set_cooling_zone_IN_ARG_cooling_zone,
2211 NULL
2212};
2213
2214static const _ExtendedGDBusMethodInfo _fan_method_info_set_cooling_zone =
2215{
2216 {
2217 -1,
2218 (gchar *) "setCoolingZone",
2219 (GDBusArgInfo **) &_fan_method_info_set_cooling_zone_IN_ARG_pointers,
2220 NULL,
2221 NULL
2222 },
2223 "handle-set-cooling-zone",
2224 FALSE
2225};
2226
2227static const _ExtendedGDBusArgInfo _fan_method_info_get_speed_OUT_ARG_speed =
2228{
2229 {
2230 -1,
2231 (gchar *) "speed",
2232 (gchar *) "i",
2233 NULL
2234 },
2235 FALSE
2236};
2237
2238static const _ExtendedGDBusArgInfo * const _fan_method_info_get_speed_OUT_ARG_pointers[] =
2239{
2240 &_fan_method_info_get_speed_OUT_ARG_speed,
2241 NULL
2242};
2243
2244static const _ExtendedGDBusMethodInfo _fan_method_info_get_speed =
2245{
2246 {
2247 -1,
2248 (gchar *) "getSpeed",
2249 NULL,
2250 (GDBusArgInfo **) &_fan_method_info_get_speed_OUT_ARG_pointers,
2251 NULL
2252 },
2253 "handle-get-speed",
2254 FALSE
2255};
2256
2257static const _ExtendedGDBusArgInfo _fan_method_info_set_speed_IN_ARG_speed =
2258{
2259 {
2260 -1,
2261 (gchar *) "speed",
2262 (gchar *) "i",
2263 NULL
2264 },
2265 FALSE
2266};
2267
2268static const _ExtendedGDBusArgInfo * const _fan_method_info_set_speed_IN_ARG_pointers[] =
2269{
2270 &_fan_method_info_set_speed_IN_ARG_speed,
2271 NULL
2272};
2273
2274static const _ExtendedGDBusMethodInfo _fan_method_info_set_speed =
2275{
2276 {
2277 -1,
2278 (gchar *) "setSpeed",
2279 (GDBusArgInfo **) &_fan_method_info_set_speed_IN_ARG_pointers,
2280 NULL,
2281 NULL
2282 },
2283 "handle-set-speed",
2284 FALSE
2285};
2286
2287static const _ExtendedGDBusMethodInfo * const _fan_method_info_pointers[] =
2288{
2289 &_fan_method_info_set_cooling_zone,
2290 &_fan_method_info_get_speed,
2291 &_fan_method_info_set_speed,
2292 NULL
2293};
2294
2295static const _ExtendedGDBusArgInfo _fan_signal_info_speed_changed_ARG_speed =
2296{
2297 {
2298 -1,
2299 (gchar *) "speed",
2300 (gchar *) "i",
2301 NULL
2302 },
2303 FALSE
2304};
2305
2306static const _ExtendedGDBusArgInfo * const _fan_signal_info_speed_changed_ARG_pointers[] =
2307{
2308 &_fan_signal_info_speed_changed_ARG_speed,
2309 NULL
2310};
2311
2312static const _ExtendedGDBusSignalInfo _fan_signal_info_speed_changed =
2313{
2314 {
2315 -1,
2316 (gchar *) "SpeedChanged",
2317 (GDBusArgInfo **) &_fan_signal_info_speed_changed_ARG_pointers,
2318 NULL
2319 },
2320 "speed-changed"
2321};
2322
2323static const _ExtendedGDBusSignalInfo _fan_signal_info_tach_error =
2324{
2325 {
2326 -1,
2327 (gchar *) "TachError",
2328 NULL,
2329 NULL
2330 },
2331 "tach-error"
2332};
2333
2334static const _ExtendedGDBusSignalInfo * const _fan_signal_info_pointers[] =
2335{
2336 &_fan_signal_info_speed_changed,
2337 &_fan_signal_info_tach_error,
2338 NULL
2339};
2340
2341static const _ExtendedGDBusPropertyInfo _fan_property_info_speed =
2342{
2343 {
2344 -1,
2345 (gchar *) "speed",
2346 (gchar *) "i",
2347 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
2348 NULL
2349 },
2350 "speed",
2351 FALSE
2352};
2353
2354static const _ExtendedGDBusPropertyInfo _fan_property_info_cooling_zone =
2355{
2356 {
2357 -1,
2358 (gchar *) "cooling_zone",
2359 (gchar *) "i",
2360 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
2361 NULL
2362 },
2363 "cooling-zone",
2364 FALSE
2365};
2366
2367static const _ExtendedGDBusPropertyInfo _fan_property_info_pwm_num =
2368{
2369 {
2370 -1,
2371 (gchar *) "pwm_num",
2372 (gchar *) "i",
2373 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
2374 NULL
2375 },
2376 "pwm-num",
2377 FALSE
2378};
2379
2380static const _ExtendedGDBusPropertyInfo * const _fan_property_info_pointers[] =
2381{
2382 &_fan_property_info_speed,
2383 &_fan_property_info_cooling_zone,
2384 &_fan_property_info_pwm_num,
2385 NULL
2386};
2387
2388static const _ExtendedGDBusInterfaceInfo _fan_interface_info =
2389{
2390 {
2391 -1,
2392 (gchar *) "org.openbmc.Fan",
2393 (GDBusMethodInfo **) &_fan_method_info_pointers,
2394 (GDBusSignalInfo **) &_fan_signal_info_pointers,
2395 (GDBusPropertyInfo **) &_fan_property_info_pointers,
2396 NULL
2397 },
2398 "fan",
2399};
2400
2401
2402/**
2403 * fan_interface_info:
2404 *
2405 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link> D-Bus interface.
2406 *
2407 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
2408 */
2409GDBusInterfaceInfo *
2410fan_interface_info (void)
2411{
2412 return (GDBusInterfaceInfo *) &_fan_interface_info.parent_struct;
2413}
2414
2415/**
2416 * fan_override_properties:
2417 * @klass: The class structure for a #GObject<!-- -->-derived class.
2418 * @property_id_begin: The property id to assign to the first overridden property.
2419 *
2420 * Overrides all #GObject properties in the #Fan interface for a concrete class.
2421 * The properties are overridden in the order they are defined.
2422 *
2423 * Returns: The last property id.
2424 */
2425guint
2426fan_override_properties (GObjectClass *klass, guint property_id_begin)
2427{
2428 g_object_class_override_property (klass, property_id_begin++, "speed");
2429 g_object_class_override_property (klass, property_id_begin++, "cooling-zone");
2430 g_object_class_override_property (klass, property_id_begin++, "pwm-num");
2431 return property_id_begin - 1;
2432}
2433
2434
2435
2436/**
2437 * Fan:
2438 *
2439 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link>.
2440 */
2441
2442/**
2443 * FanIface:
2444 * @parent_iface: The parent interface.
2445 * @handle_get_speed: Handler for the #Fan::handle-get-speed signal.
2446 * @handle_set_cooling_zone: Handler for the #Fan::handle-set-cooling-zone signal.
2447 * @handle_set_speed: Handler for the #Fan::handle-set-speed signal.
2448 * @get_cooling_zone: Getter for the #Fan:cooling-zone property.
2449 * @get_pwm_num: Getter for the #Fan:pwm-num property.
2450 * @get_speed: Getter for the #Fan:speed property.
2451 * @speed_changed: Handler for the #Fan::speed-changed signal.
2452 * @tach_error: Handler for the #Fan::tach-error signal.
2453 *
2454 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link>.
2455 */
2456
2457typedef FanIface FanInterface;
2458G_DEFINE_INTERFACE (Fan, fan, G_TYPE_OBJECT);
2459
2460static void
2461fan_default_init (FanIface *iface)
2462{
2463 /* GObject signals for incoming D-Bus method calls: */
2464 /**
2465 * Fan::handle-set-cooling-zone:
2466 * @object: A #Fan.
2467 * @invocation: A #GDBusMethodInvocation.
2468 * @arg_cooling_zone: Argument passed by remote caller.
2469 *
2470 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Fan.setCoolingZone">setCoolingZone()</link> D-Bus method.
2471 *
2472 * 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.
2473 *
2474 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
2475 */
2476 g_signal_new ("handle-set-cooling-zone",
2477 G_TYPE_FROM_INTERFACE (iface),
2478 G_SIGNAL_RUN_LAST,
2479 G_STRUCT_OFFSET (FanIface, handle_set_cooling_zone),
2480 g_signal_accumulator_true_handled,
2481 NULL,
2482 g_cclosure_marshal_generic,
2483 G_TYPE_BOOLEAN,
2484 2,
2485 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT);
2486
2487 /**
2488 * Fan::handle-get-speed:
2489 * @object: A #Fan.
2490 * @invocation: A #GDBusMethodInvocation.
2491 *
2492 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Fan.getSpeed">getSpeed()</link> D-Bus method.
2493 *
2494 * 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.
2495 *
2496 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
2497 */
2498 g_signal_new ("handle-get-speed",
2499 G_TYPE_FROM_INTERFACE (iface),
2500 G_SIGNAL_RUN_LAST,
2501 G_STRUCT_OFFSET (FanIface, handle_get_speed),
2502 g_signal_accumulator_true_handled,
2503 NULL,
2504 g_cclosure_marshal_generic,
2505 G_TYPE_BOOLEAN,
2506 1,
2507 G_TYPE_DBUS_METHOD_INVOCATION);
2508
2509 /**
2510 * Fan::handle-set-speed:
2511 * @object: A #Fan.
2512 * @invocation: A #GDBusMethodInvocation.
2513 * @arg_speed: Argument passed by remote caller.
2514 *
2515 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Fan.setSpeed">setSpeed()</link> D-Bus method.
2516 *
2517 * 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.
2518 *
2519 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
2520 */
2521 g_signal_new ("handle-set-speed",
2522 G_TYPE_FROM_INTERFACE (iface),
2523 G_SIGNAL_RUN_LAST,
2524 G_STRUCT_OFFSET (FanIface, handle_set_speed),
2525 g_signal_accumulator_true_handled,
2526 NULL,
2527 g_cclosure_marshal_generic,
2528 G_TYPE_BOOLEAN,
2529 2,
2530 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT);
2531
2532 /* GObject signals for received D-Bus signals: */
2533 /**
2534 * Fan::speed-changed:
2535 * @object: A #Fan.
2536 * @arg_speed: Argument.
2537 *
2538 * 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.
2539 *
2540 * 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.
2541 */
2542 g_signal_new ("speed-changed",
2543 G_TYPE_FROM_INTERFACE (iface),
2544 G_SIGNAL_RUN_LAST,
2545 G_STRUCT_OFFSET (FanIface, speed_changed),
2546 NULL,
2547 NULL,
2548 g_cclosure_marshal_generic,
2549 G_TYPE_NONE,
2550 1, G_TYPE_INT);
2551
2552 /**
2553 * Fan::tach-error:
2554 * @object: A #Fan.
2555 *
2556 * 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.
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 ("tach-error",
2561 G_TYPE_FROM_INTERFACE (iface),
2562 G_SIGNAL_RUN_LAST,
2563 G_STRUCT_OFFSET (FanIface, tach_error),
2564 NULL,
2565 NULL,
2566 g_cclosure_marshal_generic,
2567 G_TYPE_NONE,
2568 0);
2569
2570 /* GObject properties for D-Bus properties: */
2571 /**
2572 * Fan:speed:
2573 *
2574 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fan.speed">"speed"</link>.
2575 *
2576 * 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.
2577 */
2578 g_object_interface_install_property (iface,
2579 g_param_spec_int ("speed", "speed", "speed", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
2580 /**
2581 * Fan:cooling-zone:
2582 *
2583 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fan.cooling_zone">"cooling_zone"</link>.
2584 *
2585 * 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.
2586 */
2587 g_object_interface_install_property (iface,
2588 g_param_spec_int ("cooling-zone", "cooling_zone", "cooling_zone", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
2589 /**
2590 * Fan:pwm-num:
2591 *
2592 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fan.pwm_num">"pwm_num"</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 ("pwm-num", "pwm_num", "pwm_num", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
2598}
2599
2600/**
2601 * fan_get_speed: (skip)
2602 * @object: A #Fan.
2603 *
2604 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fan.speed">"speed"</link> D-Bus property.
2605 *
2606 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
2607 *
2608 * Returns: The property value.
2609 */
2610gint
2611fan_get_speed (Fan *object)
2612{
2613 return FAN_GET_IFACE (object)->get_speed (object);
2614}
2615
2616/**
2617 * fan_set_speed: (skip)
2618 * @object: A #Fan.
2619 * @value: The value to set.
2620 *
2621 * Sets the <link linkend="gdbus-property-org-openbmc-Fan.speed">"speed"</link> D-Bus property to @value.
2622 *
2623 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
2624 */
2625void
2626fan_set_speed (Fan *object, gint value)
2627{
2628 g_object_set (G_OBJECT (object), "speed", value, NULL);
2629}
2630
2631/**
2632 * fan_get_cooling_zone: (skip)
2633 * @object: A #Fan.
2634 *
2635 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fan.cooling_zone">"cooling_zone"</link> D-Bus property.
2636 *
2637 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
2638 *
2639 * Returns: The property value.
2640 */
2641gint
2642fan_get_cooling_zone (Fan *object)
2643{
2644 return FAN_GET_IFACE (object)->get_cooling_zone (object);
2645}
2646
2647/**
2648 * fan_set_cooling_zone: (skip)
2649 * @object: A #Fan.
2650 * @value: The value to set.
2651 *
2652 * Sets the <link linkend="gdbus-property-org-openbmc-Fan.cooling_zone">"cooling_zone"</link> D-Bus property to @value.
2653 *
2654 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
2655 */
2656void
2657fan_set_cooling_zone (Fan *object, gint value)
2658{
2659 g_object_set (G_OBJECT (object), "cooling-zone", value, NULL);
2660}
2661
2662/**
2663 * fan_get_pwm_num: (skip)
2664 * @object: A #Fan.
2665 *
2666 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fan.pwm_num">"pwm_num"</link> D-Bus property.
2667 *
2668 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
2669 *
2670 * Returns: The property value.
2671 */
2672gint
2673fan_get_pwm_num (Fan *object)
2674{
2675 return FAN_GET_IFACE (object)->get_pwm_num (object);
2676}
2677
2678/**
2679 * fan_set_pwm_num: (skip)
2680 * @object: A #Fan.
2681 * @value: The value to set.
2682 *
2683 * Sets the <link linkend="gdbus-property-org-openbmc-Fan.pwm_num">"pwm_num"</link> D-Bus property to @value.
2684 *
2685 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
2686 */
2687void
2688fan_set_pwm_num (Fan *object, gint value)
2689{
2690 g_object_set (G_OBJECT (object), "pwm-num", value, NULL);
2691}
2692
2693/**
2694 * fan_emit_speed_changed:
2695 * @object: A #Fan.
2696 * @arg_speed: Argument to pass with the signal.
2697 *
2698 * Emits the <link linkend="gdbus-signal-org-openbmc-Fan.SpeedChanged">"SpeedChanged"</link> D-Bus signal.
2699 */
2700void
2701fan_emit_speed_changed (
2702 Fan *object,
2703 gint arg_speed)
2704{
2705 g_signal_emit_by_name (object, "speed-changed", arg_speed);
2706}
2707
2708/**
2709 * fan_emit_tach_error:
2710 * @object: A #Fan.
2711 *
2712 * Emits the <link linkend="gdbus-signal-org-openbmc-Fan.TachError">"TachError"</link> D-Bus signal.
2713 */
2714void
2715fan_emit_tach_error (
2716 Fan *object)
2717{
2718 g_signal_emit_by_name (object, "tach-error");
2719}
2720
2721/**
2722 * fan_call_set_cooling_zone:
2723 * @proxy: A #FanProxy.
2724 * @arg_cooling_zone: Argument to pass with the method invocation.
2725 * @cancellable: (allow-none): A #GCancellable or %NULL.
2726 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
2727 * @user_data: User data to pass to @callback.
2728 *
2729 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Fan.setCoolingZone">setCoolingZone()</link> D-Bus method on @proxy.
2730 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
2731 * You can then call fan_call_set_cooling_zone_finish() to get the result of the operation.
2732 *
2733 * See fan_call_set_cooling_zone_sync() for the synchronous, blocking version of this method.
2734 */
2735void
2736fan_call_set_cooling_zone (
2737 Fan *proxy,
2738 gint arg_cooling_zone,
2739 GCancellable *cancellable,
2740 GAsyncReadyCallback callback,
2741 gpointer user_data)
2742{
2743 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
2744 "setCoolingZone",
2745 g_variant_new ("(i)",
2746 arg_cooling_zone),
2747 G_DBUS_CALL_FLAGS_NONE,
2748 -1,
2749 cancellable,
2750 callback,
2751 user_data);
2752}
2753
2754/**
2755 * fan_call_set_cooling_zone_finish:
2756 * @proxy: A #FanProxy.
2757 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_call_set_cooling_zone().
2758 * @error: Return location for error or %NULL.
2759 *
2760 * Finishes an operation started with fan_call_set_cooling_zone().
2761 *
2762 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
2763 */
2764gboolean
2765fan_call_set_cooling_zone_finish (
2766 Fan *proxy,
2767 GAsyncResult *res,
2768 GError **error)
2769{
2770 GVariant *_ret;
2771 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
2772 if (_ret == NULL)
2773 goto _out;
2774 g_variant_get (_ret,
2775 "()");
2776 g_variant_unref (_ret);
2777_out:
2778 return _ret != NULL;
2779}
2780
2781/**
2782 * fan_call_set_cooling_zone_sync:
2783 * @proxy: A #FanProxy.
2784 * @arg_cooling_zone: Argument to pass with the method invocation.
2785 * @cancellable: (allow-none): A #GCancellable or %NULL.
2786 * @error: Return location for error or %NULL.
2787 *
2788 * 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.
2789 *
2790 * See fan_call_set_cooling_zone() for the asynchronous version of this method.
2791 *
2792 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
2793 */
2794gboolean
2795fan_call_set_cooling_zone_sync (
2796 Fan *proxy,
2797 gint arg_cooling_zone,
2798 GCancellable *cancellable,
2799 GError **error)
2800{
2801 GVariant *_ret;
2802 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
2803 "setCoolingZone",
2804 g_variant_new ("(i)",
2805 arg_cooling_zone),
2806 G_DBUS_CALL_FLAGS_NONE,
2807 -1,
2808 cancellable,
2809 error);
2810 if (_ret == NULL)
2811 goto _out;
2812 g_variant_get (_ret,
2813 "()");
2814 g_variant_unref (_ret);
2815_out:
2816 return _ret != NULL;
2817}
2818
2819/**
2820 * fan_call_get_speed:
2821 * @proxy: A #FanProxy.
2822 * @cancellable: (allow-none): A #GCancellable or %NULL.
2823 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
2824 * @user_data: User data to pass to @callback.
2825 *
2826 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Fan.getSpeed">getSpeed()</link> D-Bus method on @proxy.
2827 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
2828 * You can then call fan_call_get_speed_finish() to get the result of the operation.
2829 *
2830 * See fan_call_get_speed_sync() for the synchronous, blocking version of this method.
2831 */
2832void
2833fan_call_get_speed (
2834 Fan *proxy,
2835 GCancellable *cancellable,
2836 GAsyncReadyCallback callback,
2837 gpointer user_data)
2838{
2839 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
2840 "getSpeed",
2841 g_variant_new ("()"),
2842 G_DBUS_CALL_FLAGS_NONE,
2843 -1,
2844 cancellable,
2845 callback,
2846 user_data);
2847}
2848
2849/**
2850 * fan_call_get_speed_finish:
2851 * @proxy: A #FanProxy.
2852 * @out_speed: (out): Return location for return parameter or %NULL to ignore.
2853 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_call_get_speed().
2854 * @error: Return location for error or %NULL.
2855 *
2856 * Finishes an operation started with fan_call_get_speed().
2857 *
2858 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
2859 */
2860gboolean
2861fan_call_get_speed_finish (
2862 Fan *proxy,
2863 gint *out_speed,
2864 GAsyncResult *res,
2865 GError **error)
2866{
2867 GVariant *_ret;
2868 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
2869 if (_ret == NULL)
2870 goto _out;
2871 g_variant_get (_ret,
2872 "(i)",
2873 out_speed);
2874 g_variant_unref (_ret);
2875_out:
2876 return _ret != NULL;
2877}
2878
2879/**
2880 * fan_call_get_speed_sync:
2881 * @proxy: A #FanProxy.
2882 * @out_speed: (out): Return location for return parameter or %NULL to ignore.
2883 * @cancellable: (allow-none): A #GCancellable or %NULL.
2884 * @error: Return location for error or %NULL.
2885 *
2886 * 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.
2887 *
2888 * See fan_call_get_speed() for the asynchronous version of this method.
2889 *
2890 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
2891 */
2892gboolean
2893fan_call_get_speed_sync (
2894 Fan *proxy,
2895 gint *out_speed,
2896 GCancellable *cancellable,
2897 GError **error)
2898{
2899 GVariant *_ret;
2900 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
2901 "getSpeed",
2902 g_variant_new ("()"),
2903 G_DBUS_CALL_FLAGS_NONE,
2904 -1,
2905 cancellable,
2906 error);
2907 if (_ret == NULL)
2908 goto _out;
2909 g_variant_get (_ret,
2910 "(i)",
2911 out_speed);
2912 g_variant_unref (_ret);
2913_out:
2914 return _ret != NULL;
2915}
2916
2917/**
2918 * fan_call_set_speed:
2919 * @proxy: A #FanProxy.
2920 * @arg_speed: Argument to pass with the method invocation.
2921 * @cancellable: (allow-none): A #GCancellable or %NULL.
2922 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
2923 * @user_data: User data to pass to @callback.
2924 *
2925 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Fan.setSpeed">setSpeed()</link> D-Bus method on @proxy.
2926 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
2927 * You can then call fan_call_set_speed_finish() to get the result of the operation.
2928 *
2929 * See fan_call_set_speed_sync() for the synchronous, blocking version of this method.
2930 */
2931void
2932fan_call_set_speed (
2933 Fan *proxy,
2934 gint arg_speed,
2935 GCancellable *cancellable,
2936 GAsyncReadyCallback callback,
2937 gpointer user_data)
2938{
2939 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
2940 "setSpeed",
2941 g_variant_new ("(i)",
2942 arg_speed),
2943 G_DBUS_CALL_FLAGS_NONE,
2944 -1,
2945 cancellable,
2946 callback,
2947 user_data);
2948}
2949
2950/**
2951 * fan_call_set_speed_finish:
2952 * @proxy: A #FanProxy.
2953 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_call_set_speed().
2954 * @error: Return location for error or %NULL.
2955 *
2956 * Finishes an operation started with fan_call_set_speed().
2957 *
2958 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
2959 */
2960gboolean
2961fan_call_set_speed_finish (
2962 Fan *proxy,
2963 GAsyncResult *res,
2964 GError **error)
2965{
2966 GVariant *_ret;
2967 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
2968 if (_ret == NULL)
2969 goto _out;
2970 g_variant_get (_ret,
2971 "()");
2972 g_variant_unref (_ret);
2973_out:
2974 return _ret != NULL;
2975}
2976
2977/**
2978 * fan_call_set_speed_sync:
2979 * @proxy: A #FanProxy.
2980 * @arg_speed: Argument to pass with the method invocation.
2981 * @cancellable: (allow-none): A #GCancellable or %NULL.
2982 * @error: Return location for error or %NULL.
2983 *
2984 * 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.
2985 *
2986 * See fan_call_set_speed() for the asynchronous version of this method.
2987 *
2988 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
2989 */
2990gboolean
2991fan_call_set_speed_sync (
2992 Fan *proxy,
2993 gint arg_speed,
2994 GCancellable *cancellable,
2995 GError **error)
2996{
2997 GVariant *_ret;
2998 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
2999 "setSpeed",
3000 g_variant_new ("(i)",
3001 arg_speed),
3002 G_DBUS_CALL_FLAGS_NONE,
3003 -1,
3004 cancellable,
3005 error);
3006 if (_ret == NULL)
3007 goto _out;
3008 g_variant_get (_ret,
3009 "()");
3010 g_variant_unref (_ret);
3011_out:
3012 return _ret != NULL;
3013}
3014
3015/**
3016 * fan_complete_set_cooling_zone:
3017 * @object: A #Fan.
3018 * @invocation: (transfer full): A #GDBusMethodInvocation.
3019 *
3020 * 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.
3021 *
3022 * This method will free @invocation, you cannot use it afterwards.
3023 */
3024void
3025fan_complete_set_cooling_zone (
3026 Fan *object,
3027 GDBusMethodInvocation *invocation)
3028{
3029 g_dbus_method_invocation_return_value (invocation,
3030 g_variant_new ("()"));
3031}
3032
3033/**
3034 * fan_complete_get_speed:
3035 * @object: A #Fan.
3036 * @invocation: (transfer full): A #GDBusMethodInvocation.
3037 * @speed: Parameter to return.
3038 *
3039 * 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.
3040 *
3041 * This method will free @invocation, you cannot use it afterwards.
3042 */
3043void
3044fan_complete_get_speed (
3045 Fan *object,
3046 GDBusMethodInvocation *invocation,
3047 gint speed)
3048{
3049 g_dbus_method_invocation_return_value (invocation,
3050 g_variant_new ("(i)",
3051 speed));
3052}
3053
3054/**
3055 * fan_complete_set_speed:
3056 * @object: A #Fan.
3057 * @invocation: (transfer full): A #GDBusMethodInvocation.
3058 *
3059 * 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.
3060 *
3061 * This method will free @invocation, you cannot use it afterwards.
3062 */
3063void
3064fan_complete_set_speed (
3065 Fan *object,
3066 GDBusMethodInvocation *invocation)
3067{
3068 g_dbus_method_invocation_return_value (invocation,
3069 g_variant_new ("()"));
3070}
3071
3072/* ------------------------------------------------------------------------ */
3073
3074/**
3075 * FanProxy:
3076 *
3077 * The #FanProxy structure contains only private data and should only be accessed using the provided API.
3078 */
3079
3080/**
3081 * FanProxyClass:
3082 * @parent_class: The parent class.
3083 *
3084 * Class structure for #FanProxy.
3085 */
3086
3087struct _FanProxyPrivate
3088{
3089 GData *qdata;
3090};
3091
3092static void fan_proxy_iface_init (FanIface *iface);
3093
3094#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
3095G_DEFINE_TYPE_WITH_CODE (FanProxy, fan_proxy, G_TYPE_DBUS_PROXY,
3096 G_ADD_PRIVATE (FanProxy)
3097 G_IMPLEMENT_INTERFACE (TYPE_FAN, fan_proxy_iface_init));
3098
3099#else
3100G_DEFINE_TYPE_WITH_CODE (FanProxy, fan_proxy, G_TYPE_DBUS_PROXY,
3101 G_IMPLEMENT_INTERFACE (TYPE_FAN, fan_proxy_iface_init));
3102
3103#endif
3104static void
3105fan_proxy_finalize (GObject *object)
3106{
3107 FanProxy *proxy = FAN_PROXY (object);
3108 g_datalist_clear (&proxy->priv->qdata);
3109 G_OBJECT_CLASS (fan_proxy_parent_class)->finalize (object);
3110}
3111
3112static void
3113fan_proxy_get_property (GObject *object,
3114 guint prop_id,
3115 GValue *value,
3116 GParamSpec *pspec G_GNUC_UNUSED)
3117{
3118 const _ExtendedGDBusPropertyInfo *info;
3119 GVariant *variant;
3120 g_assert (prop_id != 0 && prop_id - 1 < 3);
3121 info = _fan_property_info_pointers[prop_id - 1];
3122 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
3123 if (info->use_gvariant)
3124 {
3125 g_value_set_variant (value, variant);
3126 }
3127 else
3128 {
3129 if (variant != NULL)
3130 g_dbus_gvariant_to_gvalue (variant, value);
3131 }
3132 if (variant != NULL)
3133 g_variant_unref (variant);
3134}
3135
3136static void
3137fan_proxy_set_property_cb (GDBusProxy *proxy,
3138 GAsyncResult *res,
3139 gpointer user_data)
3140{
3141 const _ExtendedGDBusPropertyInfo *info = user_data;
3142 GError *error;
3143 GVariant *_ret;
3144 error = NULL;
3145 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
3146 if (!_ret)
3147 {
3148 g_warning ("Error setting property '%s' on interface org.openbmc.Fan: %s (%s, %d)",
3149 info->parent_struct.name,
3150 error->message, g_quark_to_string (error->domain), error->code);
3151 g_error_free (error);
3152 }
3153 else
3154 {
3155 g_variant_unref (_ret);
3156 }
3157}
3158
3159static void
3160fan_proxy_set_property (GObject *object,
3161 guint prop_id,
3162 const GValue *value,
3163 GParamSpec *pspec G_GNUC_UNUSED)
3164{
3165 const _ExtendedGDBusPropertyInfo *info;
3166 GVariant *variant;
3167 g_assert (prop_id != 0 && prop_id - 1 < 3);
3168 info = _fan_property_info_pointers[prop_id - 1];
3169 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
3170 g_dbus_proxy_call (G_DBUS_PROXY (object),
3171 "org.freedesktop.DBus.Properties.Set",
3172 g_variant_new ("(ssv)", "org.openbmc.Fan", info->parent_struct.name, variant),
3173 G_DBUS_CALL_FLAGS_NONE,
3174 -1,
3175 NULL, (GAsyncReadyCallback) fan_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
3176 g_variant_unref (variant);
3177}
3178
3179static void
3180fan_proxy_g_signal (GDBusProxy *proxy,
3181 const gchar *sender_name G_GNUC_UNUSED,
3182 const gchar *signal_name,
3183 GVariant *parameters)
3184{
3185 _ExtendedGDBusSignalInfo *info;
3186 GVariantIter iter;
3187 GVariant *child;
3188 GValue *paramv;
3189 guint num_params;
3190 guint n;
3191 guint signal_id;
3192 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, signal_name);
3193 if (info == NULL)
3194 return;
3195 num_params = g_variant_n_children (parameters);
3196 paramv = g_new0 (GValue, num_params + 1);
3197 g_value_init (&paramv[0], TYPE_FAN);
3198 g_value_set_object (&paramv[0], proxy);
3199 g_variant_iter_init (&iter, parameters);
3200 n = 1;
3201 while ((child = g_variant_iter_next_value (&iter)) != NULL)
3202 {
3203 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
3204 if (arg_info->use_gvariant)
3205 {
3206 g_value_init (&paramv[n], G_TYPE_VARIANT);
3207 g_value_set_variant (&paramv[n], child);
3208 n++;
3209 }
3210 else
3211 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
3212 g_variant_unref (child);
3213 }
3214 signal_id = g_signal_lookup (info->signal_name, TYPE_FAN);
3215 g_signal_emitv (paramv, signal_id, 0, NULL);
3216 for (n = 0; n < num_params + 1; n++)
3217 g_value_unset (&paramv[n]);
3218 g_free (paramv);
3219}
3220
3221static void
3222fan_proxy_g_properties_changed (GDBusProxy *_proxy,
3223 GVariant *changed_properties,
3224 const gchar *const *invalidated_properties)
3225{
3226 FanProxy *proxy = FAN_PROXY (_proxy);
3227 guint n;
3228 const gchar *key;
3229 GVariantIter *iter;
3230 _ExtendedGDBusPropertyInfo *info;
3231 g_variant_get (changed_properties, "a{sv}", &iter);
3232 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
3233 {
3234 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, key);
3235 g_datalist_remove_data (&proxy->priv->qdata, key);
3236 if (info != NULL)
3237 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
3238 }
3239 g_variant_iter_free (iter);
3240 for (n = 0; invalidated_properties[n] != NULL; n++)
3241 {
3242 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, invalidated_properties[n]);
3243 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
3244 if (info != NULL)
3245 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
3246 }
3247}
3248
3249static gint
3250fan_proxy_get_speed (Fan *object)
3251{
3252 FanProxy *proxy = FAN_PROXY (object);
3253 GVariant *variant;
3254 gint value = 0;
3255 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "speed");
3256 if (variant != NULL)
3257 {
3258 value = g_variant_get_int32 (variant);
3259 g_variant_unref (variant);
3260 }
3261 return value;
3262}
3263
3264static gint
3265fan_proxy_get_cooling_zone (Fan *object)
3266{
3267 FanProxy *proxy = FAN_PROXY (object);
3268 GVariant *variant;
3269 gint value = 0;
3270 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "cooling_zone");
3271 if (variant != NULL)
3272 {
3273 value = g_variant_get_int32 (variant);
3274 g_variant_unref (variant);
3275 }
3276 return value;
3277}
3278
3279static gint
3280fan_proxy_get_pwm_num (Fan *object)
3281{
3282 FanProxy *proxy = FAN_PROXY (object);
3283 GVariant *variant;
3284 gint value = 0;
3285 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "pwm_num");
3286 if (variant != NULL)
3287 {
3288 value = g_variant_get_int32 (variant);
3289 g_variant_unref (variant);
3290 }
3291 return value;
3292}
3293
3294static void
3295fan_proxy_init (FanProxy *proxy)
3296{
3297#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
3298 proxy->priv = fan_proxy_get_instance_private (proxy);
3299#else
3300 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_FAN_PROXY, FanProxyPrivate);
3301#endif
3302
3303 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), fan_interface_info ());
3304}
3305
3306static void
3307fan_proxy_class_init (FanProxyClass *klass)
3308{
3309 GObjectClass *gobject_class;
3310 GDBusProxyClass *proxy_class;
3311
3312 gobject_class = G_OBJECT_CLASS (klass);
3313 gobject_class->finalize = fan_proxy_finalize;
3314 gobject_class->get_property = fan_proxy_get_property;
3315 gobject_class->set_property = fan_proxy_set_property;
3316
3317 proxy_class = G_DBUS_PROXY_CLASS (klass);
3318 proxy_class->g_signal = fan_proxy_g_signal;
3319 proxy_class->g_properties_changed = fan_proxy_g_properties_changed;
3320
3321 fan_override_properties (gobject_class, 1);
3322
3323#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
3324 g_type_class_add_private (klass, sizeof (FanProxyPrivate));
3325#endif
3326}
3327
3328static void
3329fan_proxy_iface_init (FanIface *iface)
3330{
3331 iface->get_speed = fan_proxy_get_speed;
3332 iface->get_cooling_zone = fan_proxy_get_cooling_zone;
3333 iface->get_pwm_num = fan_proxy_get_pwm_num;
3334}
3335
3336/**
3337 * fan_proxy_new:
3338 * @connection: A #GDBusConnection.
3339 * @flags: Flags from the #GDBusProxyFlags enumeration.
3340 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
3341 * @object_path: An object path.
3342 * @cancellable: (allow-none): A #GCancellable or %NULL.
3343 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
3344 * @user_data: User data to pass to @callback.
3345 *
3346 * 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.
3347 *
3348 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
3349 * You can then call fan_proxy_new_finish() to get the result of the operation.
3350 *
3351 * See fan_proxy_new_sync() for the synchronous, blocking version of this constructor.
3352 */
3353void
3354fan_proxy_new (
3355 GDBusConnection *connection,
3356 GDBusProxyFlags flags,
3357 const gchar *name,
3358 const gchar *object_path,
3359 GCancellable *cancellable,
3360 GAsyncReadyCallback callback,
3361 gpointer user_data)
3362{
3363 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);
3364}
3365
3366/**
3367 * fan_proxy_new_finish:
3368 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_proxy_new().
3369 * @error: Return location for error or %NULL
3370 *
3371 * Finishes an operation started with fan_proxy_new().
3372 *
3373 * Returns: (transfer full) (type FanProxy): The constructed proxy object or %NULL if @error is set.
3374 */
3375Fan *
3376fan_proxy_new_finish (
3377 GAsyncResult *res,
3378 GError **error)
3379{
3380 GObject *ret;
3381 GObject *source_object;
3382 source_object = g_async_result_get_source_object (res);
3383 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
3384 g_object_unref (source_object);
3385 if (ret != NULL)
3386 return FAN (ret);
3387 else
3388 return NULL;
3389}
3390
3391/**
3392 * fan_proxy_new_sync:
3393 * @connection: A #GDBusConnection.
3394 * @flags: Flags from the #GDBusProxyFlags enumeration.
3395 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
3396 * @object_path: An object path.
3397 * @cancellable: (allow-none): A #GCancellable or %NULL.
3398 * @error: Return location for error or %NULL
3399 *
3400 * 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.
3401 *
3402 * The calling thread is blocked until a reply is received.
3403 *
3404 * See fan_proxy_new() for the asynchronous version of this constructor.
3405 *
3406 * Returns: (transfer full) (type FanProxy): The constructed proxy object or %NULL if @error is set.
3407 */
3408Fan *
3409fan_proxy_new_sync (
3410 GDBusConnection *connection,
3411 GDBusProxyFlags flags,
3412 const gchar *name,
3413 const gchar *object_path,
3414 GCancellable *cancellable,
3415 GError **error)
3416{
3417 GInitable *ret;
3418 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);
3419 if (ret != NULL)
3420 return FAN (ret);
3421 else
3422 return NULL;
3423}
3424
3425
3426/**
3427 * fan_proxy_new_for_bus:
3428 * @bus_type: A #GBusType.
3429 * @flags: Flags from the #GDBusProxyFlags enumeration.
3430 * @name: A bus name (well-known or unique).
3431 * @object_path: An object path.
3432 * @cancellable: (allow-none): A #GCancellable or %NULL.
3433 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
3434 * @user_data: User data to pass to @callback.
3435 *
3436 * Like fan_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
3437 *
3438 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
3439 * You can then call fan_proxy_new_for_bus_finish() to get the result of the operation.
3440 *
3441 * See fan_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
3442 */
3443void
3444fan_proxy_new_for_bus (
3445 GBusType bus_type,
3446 GDBusProxyFlags flags,
3447 const gchar *name,
3448 const gchar *object_path,
3449 GCancellable *cancellable,
3450 GAsyncReadyCallback callback,
3451 gpointer user_data)
3452{
3453 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);
3454}
3455
3456/**
3457 * fan_proxy_new_for_bus_finish:
3458 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_proxy_new_for_bus().
3459 * @error: Return location for error or %NULL
3460 *
3461 * Finishes an operation started with fan_proxy_new_for_bus().
3462 *
3463 * Returns: (transfer full) (type FanProxy): The constructed proxy object or %NULL if @error is set.
3464 */
3465Fan *
3466fan_proxy_new_for_bus_finish (
3467 GAsyncResult *res,
3468 GError **error)
3469{
3470 GObject *ret;
3471 GObject *source_object;
3472 source_object = g_async_result_get_source_object (res);
3473 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
3474 g_object_unref (source_object);
3475 if (ret != NULL)
3476 return FAN (ret);
3477 else
3478 return NULL;
3479}
3480
3481/**
3482 * fan_proxy_new_for_bus_sync:
3483 * @bus_type: A #GBusType.
3484 * @flags: Flags from the #GDBusProxyFlags enumeration.
3485 * @name: A bus name (well-known or unique).
3486 * @object_path: An object path.
3487 * @cancellable: (allow-none): A #GCancellable or %NULL.
3488 * @error: Return location for error or %NULL
3489 *
3490 * Like fan_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
3491 *
3492 * The calling thread is blocked until a reply is received.
3493 *
3494 * See fan_proxy_new_for_bus() for the asynchronous version of this constructor.
3495 *
3496 * Returns: (transfer full) (type FanProxy): The constructed proxy object or %NULL if @error is set.
3497 */
3498Fan *
3499fan_proxy_new_for_bus_sync (
3500 GBusType bus_type,
3501 GDBusProxyFlags flags,
3502 const gchar *name,
3503 const gchar *object_path,
3504 GCancellable *cancellable,
3505 GError **error)
3506{
3507 GInitable *ret;
3508 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);
3509 if (ret != NULL)
3510 return FAN (ret);
3511 else
3512 return NULL;
3513}
3514
3515
3516/* ------------------------------------------------------------------------ */
3517
3518/**
3519 * FanSkeleton:
3520 *
3521 * The #FanSkeleton structure contains only private data and should only be accessed using the provided API.
3522 */
3523
3524/**
3525 * FanSkeletonClass:
3526 * @parent_class: The parent class.
3527 *
3528 * Class structure for #FanSkeleton.
3529 */
3530
3531struct _FanSkeletonPrivate
3532{
3533 GValue *properties;
3534 GList *changed_properties;
3535 GSource *changed_properties_idle_source;
3536 GMainContext *context;
3537 GMutex lock;
3538};
3539
3540static void
3541_fan_skeleton_handle_method_call (
3542 GDBusConnection *connection G_GNUC_UNUSED,
3543 const gchar *sender G_GNUC_UNUSED,
3544 const gchar *object_path G_GNUC_UNUSED,
3545 const gchar *interface_name,
3546 const gchar *method_name,
3547 GVariant *parameters,
3548 GDBusMethodInvocation *invocation,
3549 gpointer user_data)
3550{
3551 FanSkeleton *skeleton = FAN_SKELETON (user_data);
3552 _ExtendedGDBusMethodInfo *info;
3553 GVariantIter iter;
3554 GVariant *child;
3555 GValue *paramv;
3556 guint num_params;
3557 guint num_extra;
3558 guint n;
3559 guint signal_id;
3560 GValue return_value = G_VALUE_INIT;
3561 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
3562 g_assert (info != NULL);
3563 num_params = g_variant_n_children (parameters);
3564 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
3565 n = 0;
3566 g_value_init (&paramv[n], TYPE_FAN);
3567 g_value_set_object (&paramv[n++], skeleton);
3568 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
3569 g_value_set_object (&paramv[n++], invocation);
3570 if (info->pass_fdlist)
3571 {
3572#ifdef G_OS_UNIX
3573 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
3574 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
3575#else
3576 g_assert_not_reached ();
3577#endif
3578 }
3579 g_variant_iter_init (&iter, parameters);
3580 while ((child = g_variant_iter_next_value (&iter)) != NULL)
3581 {
3582 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
3583 if (arg_info->use_gvariant)
3584 {
3585 g_value_init (&paramv[n], G_TYPE_VARIANT);
3586 g_value_set_variant (&paramv[n], child);
3587 n++;
3588 }
3589 else
3590 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
3591 g_variant_unref (child);
3592 }
3593 signal_id = g_signal_lookup (info->signal_name, TYPE_FAN);
3594 g_value_init (&return_value, G_TYPE_BOOLEAN);
3595 g_signal_emitv (paramv, signal_id, 0, &return_value);
3596 if (!g_value_get_boolean (&return_value))
3597 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);
3598 g_value_unset (&return_value);
3599 for (n = 0; n < num_params + num_extra; n++)
3600 g_value_unset (&paramv[n]);
3601 g_free (paramv);
3602}
3603
3604static GVariant *
3605_fan_skeleton_handle_get_property (
3606 GDBusConnection *connection G_GNUC_UNUSED,
3607 const gchar *sender G_GNUC_UNUSED,
3608 const gchar *object_path G_GNUC_UNUSED,
3609 const gchar *interface_name G_GNUC_UNUSED,
3610 const gchar *property_name,
3611 GError **error,
3612 gpointer user_data)
3613{
3614 FanSkeleton *skeleton = FAN_SKELETON (user_data);
3615 GValue value = G_VALUE_INIT;
3616 GParamSpec *pspec;
3617 _ExtendedGDBusPropertyInfo *info;
3618 GVariant *ret;
3619 ret = NULL;
3620 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, property_name);
3621 g_assert (info != NULL);
3622 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
3623 if (pspec == NULL)
3624 {
3625 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
3626 }
3627 else
3628 {
3629 g_value_init (&value, pspec->value_type);
3630 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
3631 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
3632 g_value_unset (&value);
3633 }
3634 return ret;
3635}
3636
3637static gboolean
3638_fan_skeleton_handle_set_property (
3639 GDBusConnection *connection G_GNUC_UNUSED,
3640 const gchar *sender G_GNUC_UNUSED,
3641 const gchar *object_path G_GNUC_UNUSED,
3642 const gchar *interface_name G_GNUC_UNUSED,
3643 const gchar *property_name,
3644 GVariant *variant,
3645 GError **error,
3646 gpointer user_data)
3647{
3648 FanSkeleton *skeleton = FAN_SKELETON (user_data);
3649 GValue value = G_VALUE_INIT;
3650 GParamSpec *pspec;
3651 _ExtendedGDBusPropertyInfo *info;
3652 gboolean ret;
3653 ret = FALSE;
3654 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, property_name);
3655 g_assert (info != NULL);
3656 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
3657 if (pspec == NULL)
3658 {
3659 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
3660 }
3661 else
3662 {
3663 if (info->use_gvariant)
3664 g_value_set_variant (&value, variant);
3665 else
3666 g_dbus_gvariant_to_gvalue (variant, &value);
3667 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
3668 g_value_unset (&value);
3669 ret = TRUE;
3670 }
3671 return ret;
3672}
3673
3674static const GDBusInterfaceVTable _fan_skeleton_vtable =
3675{
3676 _fan_skeleton_handle_method_call,
3677 _fan_skeleton_handle_get_property,
3678 _fan_skeleton_handle_set_property,
3679 {NULL}
3680};
3681
3682static GDBusInterfaceInfo *
3683fan_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
3684{
3685 return fan_interface_info ();
3686}
3687
3688static GDBusInterfaceVTable *
3689fan_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
3690{
3691 return (GDBusInterfaceVTable *) &_fan_skeleton_vtable;
3692}
3693
3694static GVariant *
3695fan_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
3696{
3697 FanSkeleton *skeleton = FAN_SKELETON (_skeleton);
3698
3699 GVariantBuilder builder;
3700 guint n;
3701 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
3702 if (_fan_interface_info.parent_struct.properties == NULL)
3703 goto out;
3704 for (n = 0; _fan_interface_info.parent_struct.properties[n] != NULL; n++)
3705 {
3706 GDBusPropertyInfo *info = _fan_interface_info.parent_struct.properties[n];
3707 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
3708 {
3709 GVariant *value;
3710 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);
3711 if (value != NULL)
3712 {
3713 g_variant_take_ref (value);
3714 g_variant_builder_add (&builder, "{sv}", info->name, value);
3715 g_variant_unref (value);
3716 }
3717 }
3718 }
3719out:
3720 return g_variant_builder_end (&builder);
3721}
3722
3723static gboolean _fan_emit_changed (gpointer user_data);
3724
3725static void
3726fan_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
3727{
3728 FanSkeleton *skeleton = FAN_SKELETON (_skeleton);
3729 gboolean emit_changed = FALSE;
3730
3731 g_mutex_lock (&skeleton->priv->lock);
3732 if (skeleton->priv->changed_properties_idle_source != NULL)
3733 {
3734 g_source_destroy (skeleton->priv->changed_properties_idle_source);
3735 skeleton->priv->changed_properties_idle_source = NULL;
3736 emit_changed = TRUE;
3737 }
3738 g_mutex_unlock (&skeleton->priv->lock);
3739
3740 if (emit_changed)
3741 _fan_emit_changed (skeleton);
3742}
3743
3744static void
3745_fan_on_signal_speed_changed (
3746 Fan *object,
3747 gint arg_speed)
3748{
3749 FanSkeleton *skeleton = FAN_SKELETON (object);
3750
3751 GList *connections, *l;
3752 GVariant *signal_variant;
3753 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
3754
3755 signal_variant = g_variant_ref_sink (g_variant_new ("(i)",
3756 arg_speed));
3757 for (l = connections; l != NULL; l = l->next)
3758 {
3759 GDBusConnection *connection = l->data;
3760 g_dbus_connection_emit_signal (connection,
3761 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Fan", "SpeedChanged",
3762 signal_variant, NULL);
3763 }
3764 g_variant_unref (signal_variant);
3765 g_list_free_full (connections, g_object_unref);
3766}
3767
3768static void
3769_fan_on_signal_tach_error (
3770 Fan *object)
3771{
3772 FanSkeleton *skeleton = FAN_SKELETON (object);
3773
3774 GList *connections, *l;
3775 GVariant *signal_variant;
3776 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
3777
3778 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
3779 for (l = connections; l != NULL; l = l->next)
3780 {
3781 GDBusConnection *connection = l->data;
3782 g_dbus_connection_emit_signal (connection,
3783 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Fan", "TachError",
3784 signal_variant, NULL);
3785 }
3786 g_variant_unref (signal_variant);
3787 g_list_free_full (connections, g_object_unref);
3788}
3789
3790static void fan_skeleton_iface_init (FanIface *iface);
3791#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
3792G_DEFINE_TYPE_WITH_CODE (FanSkeleton, fan_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
3793 G_ADD_PRIVATE (FanSkeleton)
3794 G_IMPLEMENT_INTERFACE (TYPE_FAN, fan_skeleton_iface_init));
3795
3796#else
3797G_DEFINE_TYPE_WITH_CODE (FanSkeleton, fan_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
3798 G_IMPLEMENT_INTERFACE (TYPE_FAN, fan_skeleton_iface_init));
3799
3800#endif
3801static void
3802fan_skeleton_finalize (GObject *object)
3803{
3804 FanSkeleton *skeleton = FAN_SKELETON (object);
3805 guint n;
3806 for (n = 0; n < 3; n++)
3807 g_value_unset (&skeleton->priv->properties[n]);
3808 g_free (skeleton->priv->properties);
3809 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
3810 if (skeleton->priv->changed_properties_idle_source != NULL)
3811 g_source_destroy (skeleton->priv->changed_properties_idle_source);
3812 g_main_context_unref (skeleton->priv->context);
3813 g_mutex_clear (&skeleton->priv->lock);
3814 G_OBJECT_CLASS (fan_skeleton_parent_class)->finalize (object);
3815}
3816
3817static void
3818fan_skeleton_get_property (GObject *object,
3819 guint prop_id,
3820 GValue *value,
3821 GParamSpec *pspec G_GNUC_UNUSED)
3822{
3823 FanSkeleton *skeleton = FAN_SKELETON (object);
3824 g_assert (prop_id != 0 && prop_id - 1 < 3);
3825 g_mutex_lock (&skeleton->priv->lock);
3826 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
3827 g_mutex_unlock (&skeleton->priv->lock);
3828}
3829
3830static gboolean
3831_fan_emit_changed (gpointer user_data)
3832{
3833 FanSkeleton *skeleton = FAN_SKELETON (user_data);
3834 GList *l;
3835 GVariantBuilder builder;
3836 GVariantBuilder invalidated_builder;
3837 guint num_changes;
3838
3839 g_mutex_lock (&skeleton->priv->lock);
3840 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
3841 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
3842 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
3843 {
3844 ChangedProperty *cp = l->data;
3845 GVariant *variant;
3846 const GValue *cur_value;
3847
3848 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
3849 if (!_g_value_equal (cur_value, &cp->orig_value))
3850 {
3851 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
3852 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
3853 g_variant_unref (variant);
3854 num_changes++;
3855 }
3856 }
3857 if (num_changes > 0)
3858 {
3859 GList *connections, *ll;
3860 GVariant *signal_variant;
3861 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Fan",
3862 &builder, &invalidated_builder));
3863 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
3864 for (ll = connections; ll != NULL; ll = ll->next)
3865 {
3866 GDBusConnection *connection = ll->data;
3867
3868 g_dbus_connection_emit_signal (connection,
3869 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
3870 "org.freedesktop.DBus.Properties",
3871 "PropertiesChanged",
3872 signal_variant,
3873 NULL);
3874 }
3875 g_variant_unref (signal_variant);
3876 g_list_free_full (connections, g_object_unref);
3877 }
3878 else
3879 {
3880 g_variant_builder_clear (&builder);
3881 g_variant_builder_clear (&invalidated_builder);
3882 }
3883 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
3884 skeleton->priv->changed_properties = NULL;
3885 skeleton->priv->changed_properties_idle_source = NULL;
3886 g_mutex_unlock (&skeleton->priv->lock);
3887 return FALSE;
3888}
3889
3890static void
3891_fan_schedule_emit_changed (FanSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
3892{
3893 ChangedProperty *cp;
3894 GList *l;
3895 cp = NULL;
3896 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
3897 {
3898 ChangedProperty *i_cp = l->data;
3899 if (i_cp->info == info)
3900 {
3901 cp = i_cp;
3902 break;
3903 }
3904 }
3905 if (cp == NULL)
3906 {
3907 cp = g_new0 (ChangedProperty, 1);
3908 cp->prop_id = prop_id;
3909 cp->info = info;
3910 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
3911 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
3912 g_value_copy (orig_value, &cp->orig_value);
3913 }
3914}
3915
3916static void
3917fan_skeleton_notify (GObject *object,
3918 GParamSpec *pspec G_GNUC_UNUSED)
3919{
3920 FanSkeleton *skeleton = FAN_SKELETON (object);
3921 g_mutex_lock (&skeleton->priv->lock);
3922 if (skeleton->priv->changed_properties != NULL &&
3923 skeleton->priv->changed_properties_idle_source == NULL)
3924 {
3925 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
3926 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
3927 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _fan_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
3928 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
3929 g_source_unref (skeleton->priv->changed_properties_idle_source);
3930 }
3931 g_mutex_unlock (&skeleton->priv->lock);
3932}
3933
3934static void
3935fan_skeleton_set_property (GObject *object,
3936 guint prop_id,
3937 const GValue *value,
3938 GParamSpec *pspec)
3939{
3940 FanSkeleton *skeleton = FAN_SKELETON (object);
3941 g_assert (prop_id != 0 && prop_id - 1 < 3);
3942 g_mutex_lock (&skeleton->priv->lock);
3943 g_object_freeze_notify (object);
3944 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
3945 {
3946 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
3947 _fan_schedule_emit_changed (skeleton, _fan_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
3948 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
3949 g_object_notify_by_pspec (object, pspec);
3950 }
3951 g_mutex_unlock (&skeleton->priv->lock);
3952 g_object_thaw_notify (object);
3953}
3954
3955static void
3956fan_skeleton_init (FanSkeleton *skeleton)
3957{
3958#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
3959 skeleton->priv = fan_skeleton_get_instance_private (skeleton);
3960#else
3961 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_FAN_SKELETON, FanSkeletonPrivate);
3962#endif
3963
3964 g_mutex_init (&skeleton->priv->lock);
3965 skeleton->priv->context = g_main_context_ref_thread_default ();
3966 skeleton->priv->properties = g_new0 (GValue, 3);
3967 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
3968 g_value_init (&skeleton->priv->properties[1], G_TYPE_INT);
3969 g_value_init (&skeleton->priv->properties[2], G_TYPE_INT);
3970}
3971
3972static gint
3973fan_skeleton_get_speed (Fan *object)
3974{
3975 FanSkeleton *skeleton = FAN_SKELETON (object);
3976 gint value;
3977 g_mutex_lock (&skeleton->priv->lock);
3978 value = g_value_get_int (&(skeleton->priv->properties[0]));
3979 g_mutex_unlock (&skeleton->priv->lock);
3980 return value;
3981}
3982
3983static gint
3984fan_skeleton_get_cooling_zone (Fan *object)
3985{
3986 FanSkeleton *skeleton = FAN_SKELETON (object);
3987 gint value;
3988 g_mutex_lock (&skeleton->priv->lock);
3989 value = g_value_get_int (&(skeleton->priv->properties[1]));
3990 g_mutex_unlock (&skeleton->priv->lock);
3991 return value;
3992}
3993
3994static gint
3995fan_skeleton_get_pwm_num (Fan *object)
3996{
3997 FanSkeleton *skeleton = FAN_SKELETON (object);
3998 gint value;
3999 g_mutex_lock (&skeleton->priv->lock);
4000 value = g_value_get_int (&(skeleton->priv->properties[2]));
4001 g_mutex_unlock (&skeleton->priv->lock);
4002 return value;
4003}
4004
4005static void
4006fan_skeleton_class_init (FanSkeletonClass *klass)
4007{
4008 GObjectClass *gobject_class;
4009 GDBusInterfaceSkeletonClass *skeleton_class;
4010
4011 gobject_class = G_OBJECT_CLASS (klass);
4012 gobject_class->finalize = fan_skeleton_finalize;
4013 gobject_class->get_property = fan_skeleton_get_property;
4014 gobject_class->set_property = fan_skeleton_set_property;
4015 gobject_class->notify = fan_skeleton_notify;
4016
4017
4018 fan_override_properties (gobject_class, 1);
4019
4020 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
4021 skeleton_class->get_info = fan_skeleton_dbus_interface_get_info;
4022 skeleton_class->get_properties = fan_skeleton_dbus_interface_get_properties;
4023 skeleton_class->flush = fan_skeleton_dbus_interface_flush;
4024 skeleton_class->get_vtable = fan_skeleton_dbus_interface_get_vtable;
4025
4026#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
4027 g_type_class_add_private (klass, sizeof (FanSkeletonPrivate));
4028#endif
4029}
4030
4031static void
4032fan_skeleton_iface_init (FanIface *iface)
4033{
4034 iface->speed_changed = _fan_on_signal_speed_changed;
4035 iface->tach_error = _fan_on_signal_tach_error;
4036 iface->get_speed = fan_skeleton_get_speed;
4037 iface->get_cooling_zone = fan_skeleton_get_cooling_zone;
4038 iface->get_pwm_num = fan_skeleton_get_pwm_num;
4039}
4040
4041/**
4042 * fan_skeleton_new:
4043 *
4044 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link>.
4045 *
4046 * Returns: (transfer full) (type FanSkeleton): The skeleton object.
4047 */
4048Fan *
4049fan_skeleton_new (void)
4050{
4051 return FAN (g_object_new (TYPE_FAN_SKELETON, NULL));
4052}
4053
4054/* ------------------------------------------------------------------------
4055 * Code for interface org.openbmc.SensorValue
4056 * ------------------------------------------------------------------------
4057 */
4058
4059/**
4060 * SECTION:SensorValue
4061 * @title: SensorValue
4062 * @short_description: Generated C code for the org.openbmc.SensorValue D-Bus interface
4063 *
4064 * 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.
4065 */
4066
4067/* ---- Introspection data for org.openbmc.SensorValue ---- */
4068
4069static const _ExtendedGDBusMethodInfo _sensor_value_method_info_init =
4070{
4071 {
4072 -1,
4073 (gchar *) "init",
4074 NULL,
4075 NULL,
4076 NULL
4077 },
4078 "handle-init",
4079 FALSE
4080};
4081
4082static const _ExtendedGDBusArgInfo _sensor_value_method_info_get_value_OUT_ARG_value =
4083{
4084 {
4085 -1,
4086 (gchar *) "value",
4087 (gchar *) "v",
4088 NULL
4089 },
4090 FALSE
4091};
4092
4093static const _ExtendedGDBusArgInfo * const _sensor_value_method_info_get_value_OUT_ARG_pointers[] =
4094{
4095 &_sensor_value_method_info_get_value_OUT_ARG_value,
4096 NULL
4097};
4098
4099static const _ExtendedGDBusMethodInfo _sensor_value_method_info_get_value =
4100{
4101 {
4102 -1,
4103 (gchar *) "getValue",
4104 NULL,
4105 (GDBusArgInfo **) &_sensor_value_method_info_get_value_OUT_ARG_pointers,
4106 NULL
4107 },
4108 "handle-get-value",
4109 FALSE
4110};
4111
Norman James19e45912015-10-04 20:19:41 -05004112static const _ExtendedGDBusArgInfo _sensor_value_method_info_set_value_IN_ARG_value =
4113{
4114 {
4115 -1,
4116 (gchar *) "value",
4117 (gchar *) "v",
4118 NULL
4119 },
4120 FALSE
4121};
4122
4123static const _ExtendedGDBusArgInfo * const _sensor_value_method_info_set_value_IN_ARG_pointers[] =
4124{
4125 &_sensor_value_method_info_set_value_IN_ARG_value,
4126 NULL
4127};
4128
4129static const _ExtendedGDBusMethodInfo _sensor_value_method_info_set_value =
4130{
4131 {
4132 -1,
4133 (gchar *) "setValue",
4134 (GDBusArgInfo **) &_sensor_value_method_info_set_value_IN_ARG_pointers,
4135 NULL,
4136 NULL
4137 },
4138 "handle-set-value",
4139 FALSE
4140};
4141
Norman James362a80f2015-09-14 14:04:39 -05004142static const _ExtendedGDBusMethodInfo * const _sensor_value_method_info_pointers[] =
4143{
4144 &_sensor_value_method_info_init,
4145 &_sensor_value_method_info_get_value,
Norman James19e45912015-10-04 20:19:41 -05004146 &_sensor_value_method_info_set_value,
Norman James362a80f2015-09-14 14:04:39 -05004147 NULL
4148};
4149
4150static const _ExtendedGDBusArgInfo _sensor_value_signal_info_changed_ARG_value =
4151{
4152 {
4153 -1,
4154 (gchar *) "value",
4155 (gchar *) "v",
4156 NULL
4157 },
4158 FALSE
4159};
4160
4161static const _ExtendedGDBusArgInfo _sensor_value_signal_info_changed_ARG_units =
4162{
4163 {
4164 -1,
4165 (gchar *) "units",
4166 (gchar *) "s",
4167 NULL
4168 },
4169 FALSE
4170};
4171
4172static const _ExtendedGDBusArgInfo * const _sensor_value_signal_info_changed_ARG_pointers[] =
4173{
4174 &_sensor_value_signal_info_changed_ARG_value,
4175 &_sensor_value_signal_info_changed_ARG_units,
4176 NULL
4177};
4178
4179static const _ExtendedGDBusSignalInfo _sensor_value_signal_info_changed =
4180{
4181 {
4182 -1,
4183 (gchar *) "Changed",
4184 (GDBusArgInfo **) &_sensor_value_signal_info_changed_ARG_pointers,
4185 NULL
4186 },
4187 "changed"
4188};
4189
Norman James32e74e22015-09-15 21:28:06 -05004190static const _ExtendedGDBusSignalInfo _sensor_value_signal_info_error =
4191{
4192 {
4193 -1,
4194 (gchar *) "Error",
4195 NULL,
4196 NULL
4197 },
4198 "error"
4199};
4200
Norman James362a80f2015-09-14 14:04:39 -05004201static const _ExtendedGDBusArgInfo _sensor_value_signal_info_heartbeat_ARG_bus_name =
4202{
4203 {
4204 -1,
4205 (gchar *) "bus_name",
4206 (gchar *) "s",
4207 NULL
4208 },
4209 FALSE
4210};
4211
4212static const _ExtendedGDBusArgInfo * const _sensor_value_signal_info_heartbeat_ARG_pointers[] =
4213{
4214 &_sensor_value_signal_info_heartbeat_ARG_bus_name,
4215 NULL
4216};
4217
4218static const _ExtendedGDBusSignalInfo _sensor_value_signal_info_heartbeat =
4219{
4220 {
4221 -1,
4222 (gchar *) "Heartbeat",
4223 (GDBusArgInfo **) &_sensor_value_signal_info_heartbeat_ARG_pointers,
4224 NULL
4225 },
4226 "heartbeat"
4227};
4228
4229static const _ExtendedGDBusSignalInfo * const _sensor_value_signal_info_pointers[] =
4230{
4231 &_sensor_value_signal_info_changed,
Norman James32e74e22015-09-15 21:28:06 -05004232 &_sensor_value_signal_info_error,
Norman James362a80f2015-09-14 14:04:39 -05004233 &_sensor_value_signal_info_heartbeat,
4234 NULL
4235};
4236
4237static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_value =
4238{
4239 {
4240 -1,
4241 (gchar *) "value",
4242 (gchar *) "v",
4243 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
4244 NULL
4245 },
4246 "value",
4247 FALSE
4248};
4249
4250static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_units =
4251{
4252 {
4253 -1,
4254 (gchar *) "units",
4255 (gchar *) "s",
4256 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
4257 NULL
4258 },
4259 "units",
4260 FALSE
4261};
4262
4263static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_poll_interval =
4264{
4265 {
4266 -1,
4267 (gchar *) "poll_interval",
4268 (gchar *) "i",
4269 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
4270 NULL
4271 },
4272 "poll-interval",
4273 FALSE
4274};
4275
4276static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_heatbeat =
4277{
4278 {
4279 -1,
4280 (gchar *) "heatbeat",
4281 (gchar *) "i",
4282 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
4283 NULL
4284 },
4285 "heatbeat",
4286 FALSE
4287};
4288
4289static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_settable =
4290{
4291 {
4292 -1,
4293 (gchar *) "settable",
4294 (gchar *) "b",
4295 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
4296 NULL
4297 },
4298 "settable",
4299 FALSE
4300};
4301
Norman James362a80f2015-09-14 14:04:39 -05004302static const _ExtendedGDBusPropertyInfo * const _sensor_value_property_info_pointers[] =
4303{
4304 &_sensor_value_property_info_value,
4305 &_sensor_value_property_info_units,
4306 &_sensor_value_property_info_poll_interval,
4307 &_sensor_value_property_info_heatbeat,
4308 &_sensor_value_property_info_settable,
Norman James362a80f2015-09-14 14:04:39 -05004309 NULL
4310};
4311
4312static const _ExtendedGDBusInterfaceInfo _sensor_value_interface_info =
4313{
4314 {
4315 -1,
4316 (gchar *) "org.openbmc.SensorValue",
4317 (GDBusMethodInfo **) &_sensor_value_method_info_pointers,
4318 (GDBusSignalInfo **) &_sensor_value_signal_info_pointers,
4319 (GDBusPropertyInfo **) &_sensor_value_property_info_pointers,
4320 NULL
4321 },
4322 "sensor-value",
4323};
4324
4325
4326/**
4327 * sensor_value_interface_info:
4328 *
4329 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link> D-Bus interface.
4330 *
4331 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
4332 */
4333GDBusInterfaceInfo *
4334sensor_value_interface_info (void)
4335{
4336 return (GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct;
4337}
4338
4339/**
4340 * sensor_value_override_properties:
4341 * @klass: The class structure for a #GObject<!-- -->-derived class.
4342 * @property_id_begin: The property id to assign to the first overridden property.
4343 *
4344 * Overrides all #GObject properties in the #SensorValue interface for a concrete class.
4345 * The properties are overridden in the order they are defined.
4346 *
4347 * Returns: The last property id.
4348 */
4349guint
4350sensor_value_override_properties (GObjectClass *klass, guint property_id_begin)
4351{
4352 g_object_class_override_property (klass, property_id_begin++, "value");
4353 g_object_class_override_property (klass, property_id_begin++, "units");
4354 g_object_class_override_property (klass, property_id_begin++, "poll-interval");
4355 g_object_class_override_property (klass, property_id_begin++, "heatbeat");
4356 g_object_class_override_property (klass, property_id_begin++, "settable");
Norman James362a80f2015-09-14 14:04:39 -05004357 return property_id_begin - 1;
4358}
4359
4360
4361
4362/**
4363 * SensorValue:
4364 *
4365 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link>.
4366 */
4367
4368/**
4369 * SensorValueIface:
4370 * @parent_iface: The parent interface.
4371 * @handle_get_value: Handler for the #SensorValue::handle-get-value signal.
4372 * @handle_init: Handler for the #SensorValue::handle-init signal.
Norman James19e45912015-10-04 20:19:41 -05004373 * @handle_set_value: Handler for the #SensorValue::handle-set-value signal.
Norman James362a80f2015-09-14 14:04:39 -05004374 * @get_heatbeat: Getter for the #SensorValue:heatbeat property.
Norman James362a80f2015-09-14 14:04:39 -05004375 * @get_poll_interval: Getter for the #SensorValue:poll-interval property.
4376 * @get_settable: Getter for the #SensorValue:settable property.
4377 * @get_units: Getter for the #SensorValue:units property.
4378 * @get_value: Getter for the #SensorValue:value property.
4379 * @changed: Handler for the #SensorValue::changed signal.
Norman James32e74e22015-09-15 21:28:06 -05004380 * @error: Handler for the #SensorValue::error signal.
Norman James362a80f2015-09-14 14:04:39 -05004381 * @heartbeat: Handler for the #SensorValue::heartbeat signal.
4382 *
4383 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link>.
4384 */
4385
4386typedef SensorValueIface SensorValueInterface;
4387G_DEFINE_INTERFACE (SensorValue, sensor_value, G_TYPE_OBJECT);
4388
4389static void
4390sensor_value_default_init (SensorValueIface *iface)
4391{
4392 /* GObject signals for incoming D-Bus method calls: */
4393 /**
4394 * SensorValue::handle-init:
4395 * @object: A #SensorValue.
4396 * @invocation: A #GDBusMethodInvocation.
4397 *
4398 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorValue.init">init()</link> D-Bus method.
4399 *
4400 * 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.
4401 *
4402 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
4403 */
4404 g_signal_new ("handle-init",
4405 G_TYPE_FROM_INTERFACE (iface),
4406 G_SIGNAL_RUN_LAST,
4407 G_STRUCT_OFFSET (SensorValueIface, handle_init),
4408 g_signal_accumulator_true_handled,
4409 NULL,
4410 g_cclosure_marshal_generic,
4411 G_TYPE_BOOLEAN,
4412 1,
4413 G_TYPE_DBUS_METHOD_INVOCATION);
4414
4415 /**
4416 * SensorValue::handle-get-value:
4417 * @object: A #SensorValue.
4418 * @invocation: A #GDBusMethodInvocation.
4419 *
4420 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorValue.getValue">getValue()</link> D-Bus method.
4421 *
4422 * 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.
4423 *
4424 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
4425 */
4426 g_signal_new ("handle-get-value",
4427 G_TYPE_FROM_INTERFACE (iface),
4428 G_SIGNAL_RUN_LAST,
4429 G_STRUCT_OFFSET (SensorValueIface, handle_get_value),
4430 g_signal_accumulator_true_handled,
4431 NULL,
4432 g_cclosure_marshal_generic,
4433 G_TYPE_BOOLEAN,
4434 1,
4435 G_TYPE_DBUS_METHOD_INVOCATION);
4436
Norman James19e45912015-10-04 20:19:41 -05004437 /**
4438 * SensorValue::handle-set-value:
4439 * @object: A #SensorValue.
4440 * @invocation: A #GDBusMethodInvocation.
4441 * @arg_value: Argument passed by remote caller.
4442 *
4443 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorValue.setValue">setValue()</link> D-Bus method.
4444 *
4445 * 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.
4446 *
4447 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
4448 */
4449 g_signal_new ("handle-set-value",
4450 G_TYPE_FROM_INTERFACE (iface),
4451 G_SIGNAL_RUN_LAST,
4452 G_STRUCT_OFFSET (SensorValueIface, handle_set_value),
4453 g_signal_accumulator_true_handled,
4454 NULL,
4455 g_cclosure_marshal_generic,
4456 G_TYPE_BOOLEAN,
4457 2,
4458 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_VARIANT);
4459
Norman James362a80f2015-09-14 14:04:39 -05004460 /* GObject signals for received D-Bus signals: */
4461 /**
4462 * SensorValue::changed:
4463 * @object: A #SensorValue.
4464 * @arg_value: Argument.
4465 * @arg_units: Argument.
4466 *
4467 * 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.
4468 *
4469 * 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.
4470 */
4471 g_signal_new ("changed",
4472 G_TYPE_FROM_INTERFACE (iface),
4473 G_SIGNAL_RUN_LAST,
4474 G_STRUCT_OFFSET (SensorValueIface, changed),
4475 NULL,
4476 NULL,
4477 g_cclosure_marshal_generic,
4478 G_TYPE_NONE,
4479 2, G_TYPE_VARIANT, G_TYPE_STRING);
4480
4481 /**
Norman James32e74e22015-09-15 21:28:06 -05004482 * SensorValue::error:
4483 * @object: A #SensorValue.
4484 *
4485 * 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.
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 ("error",
4490 G_TYPE_FROM_INTERFACE (iface),
4491 G_SIGNAL_RUN_LAST,
4492 G_STRUCT_OFFSET (SensorValueIface, error),
4493 NULL,
4494 NULL,
4495 g_cclosure_marshal_generic,
4496 G_TYPE_NONE,
4497 0);
4498
4499 /**
Norman James362a80f2015-09-14 14:04:39 -05004500 * SensorValue::heartbeat:
4501 * @object: A #SensorValue.
4502 * @arg_bus_name: Argument.
4503 *
4504 * 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.
4505 *
4506 * 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.
4507 */
4508 g_signal_new ("heartbeat",
4509 G_TYPE_FROM_INTERFACE (iface),
4510 G_SIGNAL_RUN_LAST,
4511 G_STRUCT_OFFSET (SensorValueIface, heartbeat),
4512 NULL,
4513 NULL,
4514 g_cclosure_marshal_generic,
4515 G_TYPE_NONE,
4516 1, G_TYPE_STRING);
4517
4518 /* GObject properties for D-Bus properties: */
4519 /**
4520 * SensorValue:value:
4521 *
4522 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link>.
4523 *
4524 * 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.
4525 */
4526 g_object_interface_install_property (iface,
4527 g_param_spec_variant ("value", "value", "value", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
4528 /**
4529 * SensorValue:units:
4530 *
4531 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link>.
4532 *
4533 * 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.
4534 */
4535 g_object_interface_install_property (iface,
4536 g_param_spec_string ("units", "units", "units", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
4537 /**
4538 * SensorValue:poll-interval:
4539 *
4540 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.poll_interval">"poll_interval"</link>.
4541 *
4542 * 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.
4543 */
4544 g_object_interface_install_property (iface,
4545 g_param_spec_int ("poll-interval", "poll_interval", "poll_interval", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
4546 /**
4547 * SensorValue:heatbeat:
4548 *
4549 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.heatbeat">"heatbeat"</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_int ("heatbeat", "heatbeat", "heatbeat", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
4555 /**
4556 * SensorValue:settable:
4557 *
4558 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.settable">"settable"</link>.
4559 *
4560 * 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.
4561 */
4562 g_object_interface_install_property (iface,
4563 g_param_spec_boolean ("settable", "settable", "settable", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Norman James362a80f2015-09-14 14:04:39 -05004564}
4565
4566/**
4567 * sensor_value_get_value: (skip)
4568 * @object: A #SensorValue.
4569 *
4570 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link> D-Bus property.
4571 *
4572 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4573 *
4574 * <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>
4575 *
4576 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
4577 */
4578GVariant *
4579sensor_value_get_value (SensorValue *object)
4580{
4581 return SENSOR_VALUE_GET_IFACE (object)->get_value (object);
4582}
4583
4584/**
4585 * sensor_value_dup_value: (skip)
4586 * @object: A #SensorValue.
4587 *
4588 * Gets a copy 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 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
4593 */
4594GVariant *
4595sensor_value_dup_value (SensorValue *object)
4596{
4597 GVariant *value;
4598 g_object_get (G_OBJECT (object), "value", &value, NULL);
4599 return value;
4600}
4601
4602/**
4603 * sensor_value_set_value: (skip)
4604 * @object: A #SensorValue.
4605 * @value: The value to set.
4606 *
4607 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link> D-Bus property to @value.
4608 *
4609 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
4610 */
4611void
4612sensor_value_set_value (SensorValue *object, GVariant *value)
4613{
4614 g_object_set (G_OBJECT (object), "value", value, NULL);
4615}
4616
4617/**
4618 * sensor_value_get_units: (skip)
4619 * @object: A #SensorValue.
4620 *
4621 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link> D-Bus property.
4622 *
4623 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4624 *
4625 * <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>
4626 *
4627 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
4628 */
4629const gchar *
4630sensor_value_get_units (SensorValue *object)
4631{
4632 return SENSOR_VALUE_GET_IFACE (object)->get_units (object);
4633}
4634
4635/**
4636 * sensor_value_dup_units: (skip)
4637 * @object: A #SensorValue.
4638 *
4639 * Gets a copy 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 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
4644 */
4645gchar *
4646sensor_value_dup_units (SensorValue *object)
4647{
4648 gchar *value;
4649 g_object_get (G_OBJECT (object), "units", &value, NULL);
4650 return value;
4651}
4652
4653/**
4654 * sensor_value_set_units: (skip)
4655 * @object: A #SensorValue.
4656 * @value: The value to set.
4657 *
4658 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link> D-Bus property to @value.
4659 *
4660 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
4661 */
4662void
4663sensor_value_set_units (SensorValue *object, const gchar *value)
4664{
4665 g_object_set (G_OBJECT (object), "units", value, NULL);
4666}
4667
4668/**
4669 * sensor_value_get_poll_interval: (skip)
4670 * @object: A #SensorValue.
4671 *
4672 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.poll_interval">"poll_interval"</link> D-Bus property.
4673 *
4674 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
4675 *
4676 * Returns: The property value.
4677 */
4678gint
4679sensor_value_get_poll_interval (SensorValue *object)
4680{
4681 return SENSOR_VALUE_GET_IFACE (object)->get_poll_interval (object);
4682}
4683
4684/**
4685 * sensor_value_set_poll_interval: (skip)
4686 * @object: A #SensorValue.
4687 * @value: The value to set.
4688 *
4689 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.poll_interval">"poll_interval"</link> D-Bus property to @value.
4690 *
4691 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
4692 */
4693void
4694sensor_value_set_poll_interval (SensorValue *object, gint value)
4695{
4696 g_object_set (G_OBJECT (object), "poll-interval", value, NULL);
4697}
4698
4699/**
4700 * sensor_value_get_heatbeat: (skip)
4701 * @object: A #SensorValue.
4702 *
4703 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.heatbeat">"heatbeat"</link> D-Bus property.
4704 *
4705 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4706 *
4707 * Returns: The property value.
4708 */
4709gint
4710sensor_value_get_heatbeat (SensorValue *object)
4711{
4712 return SENSOR_VALUE_GET_IFACE (object)->get_heatbeat (object);
4713}
4714
4715/**
4716 * sensor_value_set_heatbeat: (skip)
4717 * @object: A #SensorValue.
4718 * @value: The value to set.
4719 *
4720 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.heatbeat">"heatbeat"</link> D-Bus property to @value.
4721 *
4722 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
4723 */
4724void
4725sensor_value_set_heatbeat (SensorValue *object, gint value)
4726{
4727 g_object_set (G_OBJECT (object), "heatbeat", value, NULL);
4728}
4729
4730/**
4731 * sensor_value_get_settable: (skip)
4732 * @object: A #SensorValue.
4733 *
4734 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.settable">"settable"</link> D-Bus property.
4735 *
4736 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4737 *
4738 * Returns: The property value.
4739 */
4740gboolean
4741sensor_value_get_settable (SensorValue *object)
4742{
4743 return SENSOR_VALUE_GET_IFACE (object)->get_settable (object);
4744}
4745
4746/**
4747 * sensor_value_set_settable: (skip)
4748 * @object: A #SensorValue.
4749 * @value: The value to set.
4750 *
4751 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.settable">"settable"</link> D-Bus property to @value.
4752 *
4753 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
4754 */
4755void
4756sensor_value_set_settable (SensorValue *object, gboolean value)
4757{
4758 g_object_set (G_OBJECT (object), "settable", value, NULL);
4759}
4760
4761/**
Norman James362a80f2015-09-14 14:04:39 -05004762 * sensor_value_emit_changed:
4763 * @object: A #SensorValue.
4764 * @arg_value: Argument to pass with the signal.
4765 * @arg_units: Argument to pass with the signal.
4766 *
4767 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorValue.Changed">"Changed"</link> D-Bus signal.
4768 */
4769void
4770sensor_value_emit_changed (
4771 SensorValue *object,
4772 GVariant *arg_value,
4773 const gchar *arg_units)
4774{
4775 g_signal_emit_by_name (object, "changed", arg_value, arg_units);
4776}
4777
4778/**
Norman James32e74e22015-09-15 21:28:06 -05004779 * sensor_value_emit_error:
4780 * @object: A #SensorValue.
4781 *
4782 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorValue.Error">"Error"</link> D-Bus signal.
4783 */
4784void
4785sensor_value_emit_error (
4786 SensorValue *object)
4787{
4788 g_signal_emit_by_name (object, "error");
4789}
4790
4791/**
Norman James362a80f2015-09-14 14:04:39 -05004792 * sensor_value_emit_heartbeat:
4793 * @object: A #SensorValue.
4794 * @arg_bus_name: Argument to pass with the signal.
4795 *
4796 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorValue.Heartbeat">"Heartbeat"</link> D-Bus signal.
4797 */
4798void
4799sensor_value_emit_heartbeat (
4800 SensorValue *object,
4801 const gchar *arg_bus_name)
4802{
4803 g_signal_emit_by_name (object, "heartbeat", arg_bus_name);
4804}
4805
4806/**
4807 * sensor_value_call_init:
4808 * @proxy: A #SensorValueProxy.
4809 * @cancellable: (allow-none): A #GCancellable or %NULL.
4810 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
4811 * @user_data: User data to pass to @callback.
4812 *
4813 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorValue.init">init()</link> D-Bus method on @proxy.
4814 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
4815 * You can then call sensor_value_call_init_finish() to get the result of the operation.
4816 *
4817 * See sensor_value_call_init_sync() for the synchronous, blocking version of this method.
4818 */
4819void
4820sensor_value_call_init (
4821 SensorValue *proxy,
4822 GCancellable *cancellable,
4823 GAsyncReadyCallback callback,
4824 gpointer user_data)
4825{
4826 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
4827 "init",
4828 g_variant_new ("()"),
4829 G_DBUS_CALL_FLAGS_NONE,
4830 -1,
4831 cancellable,
4832 callback,
4833 user_data);
4834}
4835
4836/**
4837 * sensor_value_call_init_finish:
4838 * @proxy: A #SensorValueProxy.
4839 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_call_init().
4840 * @error: Return location for error or %NULL.
4841 *
4842 * Finishes an operation started with sensor_value_call_init().
4843 *
4844 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
4845 */
4846gboolean
4847sensor_value_call_init_finish (
4848 SensorValue *proxy,
4849 GAsyncResult *res,
4850 GError **error)
4851{
4852 GVariant *_ret;
4853 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
4854 if (_ret == NULL)
4855 goto _out;
4856 g_variant_get (_ret,
4857 "()");
4858 g_variant_unref (_ret);
4859_out:
4860 return _ret != NULL;
4861}
4862
4863/**
4864 * sensor_value_call_init_sync:
4865 * @proxy: A #SensorValueProxy.
4866 * @cancellable: (allow-none): A #GCancellable or %NULL.
4867 * @error: Return location for error or %NULL.
4868 *
4869 * 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.
4870 *
4871 * See sensor_value_call_init() for the asynchronous version of this method.
4872 *
4873 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
4874 */
4875gboolean
4876sensor_value_call_init_sync (
4877 SensorValue *proxy,
4878 GCancellable *cancellable,
4879 GError **error)
4880{
4881 GVariant *_ret;
4882 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
4883 "init",
4884 g_variant_new ("()"),
4885 G_DBUS_CALL_FLAGS_NONE,
4886 -1,
4887 cancellable,
4888 error);
4889 if (_ret == NULL)
4890 goto _out;
4891 g_variant_get (_ret,
4892 "()");
4893 g_variant_unref (_ret);
4894_out:
4895 return _ret != NULL;
4896}
4897
4898/**
4899 * sensor_value_call_get_value:
4900 * @proxy: A #SensorValueProxy.
4901 * @cancellable: (allow-none): A #GCancellable or %NULL.
4902 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
4903 * @user_data: User data to pass to @callback.
4904 *
4905 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorValue.getValue">getValue()</link> D-Bus method on @proxy.
4906 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
4907 * You can then call sensor_value_call_get_value_finish() to get the result of the operation.
4908 *
4909 * See sensor_value_call_get_value_sync() for the synchronous, blocking version of this method.
4910 */
4911void
4912sensor_value_call_get_value (
4913 SensorValue *proxy,
4914 GCancellable *cancellable,
4915 GAsyncReadyCallback callback,
4916 gpointer user_data)
4917{
4918 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
4919 "getValue",
4920 g_variant_new ("()"),
4921 G_DBUS_CALL_FLAGS_NONE,
4922 -1,
4923 cancellable,
4924 callback,
4925 user_data);
4926}
4927
4928/**
4929 * sensor_value_call_get_value_finish:
4930 * @proxy: A #SensorValueProxy.
4931 * @out_value: (out): Return location for return parameter or %NULL to ignore.
4932 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_call_get_value().
4933 * @error: Return location for error or %NULL.
4934 *
4935 * Finishes an operation started with sensor_value_call_get_value().
4936 *
4937 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
4938 */
4939gboolean
4940sensor_value_call_get_value_finish (
4941 SensorValue *proxy,
4942 GVariant **out_value,
4943 GAsyncResult *res,
4944 GError **error)
4945{
4946 GVariant *_ret;
4947 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
4948 if (_ret == NULL)
4949 goto _out;
4950 g_variant_get (_ret,
4951 "(@v)",
4952 out_value);
4953 g_variant_unref (_ret);
4954_out:
4955 return _ret != NULL;
4956}
4957
4958/**
4959 * sensor_value_call_get_value_sync:
4960 * @proxy: A #SensorValueProxy.
4961 * @out_value: (out): Return location for return parameter or %NULL to ignore.
4962 * @cancellable: (allow-none): A #GCancellable or %NULL.
4963 * @error: Return location for error or %NULL.
4964 *
4965 * 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.
4966 *
4967 * See sensor_value_call_get_value() for the asynchronous version of this method.
4968 *
4969 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
4970 */
4971gboolean
4972sensor_value_call_get_value_sync (
4973 SensorValue *proxy,
4974 GVariant **out_value,
4975 GCancellable *cancellable,
4976 GError **error)
4977{
4978 GVariant *_ret;
4979 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
4980 "getValue",
4981 g_variant_new ("()"),
4982 G_DBUS_CALL_FLAGS_NONE,
4983 -1,
4984 cancellable,
4985 error);
4986 if (_ret == NULL)
4987 goto _out;
4988 g_variant_get (_ret,
4989 "(@v)",
4990 out_value);
4991 g_variant_unref (_ret);
4992_out:
4993 return _ret != NULL;
4994}
4995
4996/**
Norman James19e45912015-10-04 20:19:41 -05004997 * sensor_value_call_set_value:
4998 * @proxy: A #SensorValueProxy.
4999 * @arg_value: Argument to pass with the method invocation.
5000 * @cancellable: (allow-none): A #GCancellable or %NULL.
5001 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
5002 * @user_data: User data to pass to @callback.
5003 *
5004 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorValue.setValue">setValue()</link> D-Bus method on @proxy.
5005 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
5006 * You can then call sensor_value_call_set_value_finish() to get the result of the operation.
5007 *
5008 * See sensor_value_call_set_value_sync() for the synchronous, blocking version of this method.
5009 */
5010void
5011sensor_value_call_set_value (
5012 SensorValue *proxy,
5013 GVariant *arg_value,
5014 GCancellable *cancellable,
5015 GAsyncReadyCallback callback,
5016 gpointer user_data)
5017{
5018 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
5019 "setValue",
5020 g_variant_new ("(@v)",
5021 arg_value),
5022 G_DBUS_CALL_FLAGS_NONE,
5023 -1,
5024 cancellable,
5025 callback,
5026 user_data);
5027}
5028
5029/**
5030 * sensor_value_call_set_value_finish:
5031 * @proxy: A #SensorValueProxy.
5032 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_call_set_value().
5033 * @error: Return location for error or %NULL.
5034 *
5035 * Finishes an operation started with sensor_value_call_set_value().
5036 *
5037 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
5038 */
5039gboolean
5040sensor_value_call_set_value_finish (
5041 SensorValue *proxy,
5042 GAsyncResult *res,
5043 GError **error)
5044{
5045 GVariant *_ret;
5046 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
5047 if (_ret == NULL)
5048 goto _out;
5049 g_variant_get (_ret,
5050 "()");
5051 g_variant_unref (_ret);
5052_out:
5053 return _ret != NULL;
5054}
5055
5056/**
5057 * sensor_value_call_set_value_sync:
5058 * @proxy: A #SensorValueProxy.
5059 * @arg_value: Argument to pass with the method invocation.
5060 * @cancellable: (allow-none): A #GCancellable or %NULL.
5061 * @error: Return location for error or %NULL.
5062 *
5063 * 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.
5064 *
5065 * See sensor_value_call_set_value() for the asynchronous version of this method.
5066 *
5067 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
5068 */
5069gboolean
5070sensor_value_call_set_value_sync (
5071 SensorValue *proxy,
5072 GVariant *arg_value,
5073 GCancellable *cancellable,
5074 GError **error)
5075{
5076 GVariant *_ret;
5077 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
5078 "setValue",
5079 g_variant_new ("(@v)",
5080 arg_value),
5081 G_DBUS_CALL_FLAGS_NONE,
5082 -1,
5083 cancellable,
5084 error);
5085 if (_ret == NULL)
5086 goto _out;
5087 g_variant_get (_ret,
5088 "()");
5089 g_variant_unref (_ret);
5090_out:
5091 return _ret != NULL;
5092}
5093
5094/**
Norman James362a80f2015-09-14 14:04:39 -05005095 * sensor_value_complete_init:
5096 * @object: A #SensorValue.
5097 * @invocation: (transfer full): A #GDBusMethodInvocation.
5098 *
5099 * 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.
5100 *
5101 * This method will free @invocation, you cannot use it afterwards.
5102 */
5103void
5104sensor_value_complete_init (
5105 SensorValue *object,
5106 GDBusMethodInvocation *invocation)
5107{
5108 g_dbus_method_invocation_return_value (invocation,
5109 g_variant_new ("()"));
5110}
5111
5112/**
5113 * sensor_value_complete_get_value:
5114 * @object: A #SensorValue.
5115 * @invocation: (transfer full): A #GDBusMethodInvocation.
5116 * @value: Parameter to return.
5117 *
5118 * 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.
5119 *
5120 * This method will free @invocation, you cannot use it afterwards.
5121 */
5122void
5123sensor_value_complete_get_value (
5124 SensorValue *object,
5125 GDBusMethodInvocation *invocation,
5126 GVariant *value)
5127{
5128 g_dbus_method_invocation_return_value (invocation,
5129 g_variant_new ("(@v)",
5130 value));
5131}
5132
Norman James19e45912015-10-04 20:19:41 -05005133/**
5134 * sensor_value_complete_set_value:
5135 * @object: A #SensorValue.
5136 * @invocation: (transfer full): A #GDBusMethodInvocation.
5137 *
5138 * 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.
5139 *
5140 * This method will free @invocation, you cannot use it afterwards.
5141 */
5142void
5143sensor_value_complete_set_value (
5144 SensorValue *object,
5145 GDBusMethodInvocation *invocation)
5146{
5147 g_dbus_method_invocation_return_value (invocation,
5148 g_variant_new ("()"));
5149}
5150
Norman James362a80f2015-09-14 14:04:39 -05005151/* ------------------------------------------------------------------------ */
5152
5153/**
5154 * SensorValueProxy:
5155 *
5156 * The #SensorValueProxy structure contains only private data and should only be accessed using the provided API.
5157 */
5158
5159/**
5160 * SensorValueProxyClass:
5161 * @parent_class: The parent class.
5162 *
5163 * Class structure for #SensorValueProxy.
5164 */
5165
5166struct _SensorValueProxyPrivate
5167{
5168 GData *qdata;
5169};
5170
5171static void sensor_value_proxy_iface_init (SensorValueIface *iface);
5172
5173#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
5174G_DEFINE_TYPE_WITH_CODE (SensorValueProxy, sensor_value_proxy, G_TYPE_DBUS_PROXY,
5175 G_ADD_PRIVATE (SensorValueProxy)
5176 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_proxy_iface_init));
5177
5178#else
5179G_DEFINE_TYPE_WITH_CODE (SensorValueProxy, sensor_value_proxy, G_TYPE_DBUS_PROXY,
5180 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_proxy_iface_init));
5181
5182#endif
5183static void
5184sensor_value_proxy_finalize (GObject *object)
5185{
5186 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
5187 g_datalist_clear (&proxy->priv->qdata);
5188 G_OBJECT_CLASS (sensor_value_proxy_parent_class)->finalize (object);
5189}
5190
5191static void
5192sensor_value_proxy_get_property (GObject *object,
5193 guint prop_id,
5194 GValue *value,
5195 GParamSpec *pspec G_GNUC_UNUSED)
5196{
5197 const _ExtendedGDBusPropertyInfo *info;
5198 GVariant *variant;
Norman Jamesdfdaca92015-09-27 22:11:15 -05005199 g_assert (prop_id != 0 && prop_id - 1 < 5);
Norman James362a80f2015-09-14 14:04:39 -05005200 info = _sensor_value_property_info_pointers[prop_id - 1];
5201 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
5202 if (info->use_gvariant)
5203 {
5204 g_value_set_variant (value, variant);
5205 }
5206 else
5207 {
5208 if (variant != NULL)
5209 g_dbus_gvariant_to_gvalue (variant, value);
5210 }
5211 if (variant != NULL)
5212 g_variant_unref (variant);
5213}
5214
5215static void
5216sensor_value_proxy_set_property_cb (GDBusProxy *proxy,
5217 GAsyncResult *res,
5218 gpointer user_data)
5219{
5220 const _ExtendedGDBusPropertyInfo *info = user_data;
5221 GError *error;
5222 GVariant *_ret;
5223 error = NULL;
5224 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
5225 if (!_ret)
5226 {
5227 g_warning ("Error setting property '%s' on interface org.openbmc.SensorValue: %s (%s, %d)",
5228 info->parent_struct.name,
5229 error->message, g_quark_to_string (error->domain), error->code);
5230 g_error_free (error);
5231 }
5232 else
5233 {
5234 g_variant_unref (_ret);
5235 }
5236}
5237
5238static void
5239sensor_value_proxy_set_property (GObject *object,
5240 guint prop_id,
5241 const GValue *value,
5242 GParamSpec *pspec G_GNUC_UNUSED)
5243{
5244 const _ExtendedGDBusPropertyInfo *info;
5245 GVariant *variant;
Norman Jamesdfdaca92015-09-27 22:11:15 -05005246 g_assert (prop_id != 0 && prop_id - 1 < 5);
Norman James362a80f2015-09-14 14:04:39 -05005247 info = _sensor_value_property_info_pointers[prop_id - 1];
5248 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
5249 g_dbus_proxy_call (G_DBUS_PROXY (object),
5250 "org.freedesktop.DBus.Properties.Set",
5251 g_variant_new ("(ssv)", "org.openbmc.SensorValue", info->parent_struct.name, variant),
5252 G_DBUS_CALL_FLAGS_NONE,
5253 -1,
5254 NULL, (GAsyncReadyCallback) sensor_value_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
5255 g_variant_unref (variant);
5256}
5257
5258static void
5259sensor_value_proxy_g_signal (GDBusProxy *proxy,
5260 const gchar *sender_name G_GNUC_UNUSED,
5261 const gchar *signal_name,
5262 GVariant *parameters)
5263{
5264 _ExtendedGDBusSignalInfo *info;
5265 GVariantIter iter;
5266 GVariant *child;
5267 GValue *paramv;
5268 guint num_params;
5269 guint n;
5270 guint signal_id;
5271 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, signal_name);
5272 if (info == NULL)
5273 return;
5274 num_params = g_variant_n_children (parameters);
5275 paramv = g_new0 (GValue, num_params + 1);
5276 g_value_init (&paramv[0], TYPE_SENSOR_VALUE);
5277 g_value_set_object (&paramv[0], proxy);
5278 g_variant_iter_init (&iter, parameters);
5279 n = 1;
5280 while ((child = g_variant_iter_next_value (&iter)) != NULL)
5281 {
5282 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
5283 if (arg_info->use_gvariant)
5284 {
5285 g_value_init (&paramv[n], G_TYPE_VARIANT);
5286 g_value_set_variant (&paramv[n], child);
5287 n++;
5288 }
5289 else
5290 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
5291 g_variant_unref (child);
5292 }
5293 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_VALUE);
5294 g_signal_emitv (paramv, signal_id, 0, NULL);
5295 for (n = 0; n < num_params + 1; n++)
5296 g_value_unset (&paramv[n]);
5297 g_free (paramv);
5298}
5299
5300static void
5301sensor_value_proxy_g_properties_changed (GDBusProxy *_proxy,
5302 GVariant *changed_properties,
5303 const gchar *const *invalidated_properties)
5304{
5305 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (_proxy);
5306 guint n;
5307 const gchar *key;
5308 GVariantIter *iter;
5309 _ExtendedGDBusPropertyInfo *info;
5310 g_variant_get (changed_properties, "a{sv}", &iter);
5311 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
5312 {
5313 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, key);
5314 g_datalist_remove_data (&proxy->priv->qdata, key);
5315 if (info != NULL)
5316 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
5317 }
5318 g_variant_iter_free (iter);
5319 for (n = 0; invalidated_properties[n] != NULL; n++)
5320 {
5321 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, invalidated_properties[n]);
5322 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
5323 if (info != NULL)
5324 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
5325 }
5326}
5327
5328static GVariant *
5329sensor_value_proxy_get_value (SensorValue *object)
5330{
5331 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
5332 GVariant *variant;
5333 GVariant *value = NULL;
5334 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "value");
5335 value = variant;
5336 if (variant != NULL)
5337 g_variant_unref (variant);
5338 return value;
5339}
5340
5341static const gchar *
5342sensor_value_proxy_get_units (SensorValue *object)
5343{
5344 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
5345 GVariant *variant;
5346 const gchar *value = NULL;
5347 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "units");
5348 if (variant != NULL)
5349 {
5350 value = g_variant_get_string (variant, NULL);
5351 g_variant_unref (variant);
5352 }
5353 return value;
5354}
5355
5356static gint
5357sensor_value_proxy_get_poll_interval (SensorValue *object)
5358{
5359 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
5360 GVariant *variant;
5361 gint value = 0;
5362 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "poll_interval");
5363 if (variant != NULL)
5364 {
5365 value = g_variant_get_int32 (variant);
5366 g_variant_unref (variant);
5367 }
5368 return value;
5369}
5370
5371static gint
5372sensor_value_proxy_get_heatbeat (SensorValue *object)
5373{
5374 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
5375 GVariant *variant;
5376 gint value = 0;
5377 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "heatbeat");
5378 if (variant != NULL)
5379 {
5380 value = g_variant_get_int32 (variant);
5381 g_variant_unref (variant);
5382 }
5383 return value;
5384}
5385
5386static gboolean
5387sensor_value_proxy_get_settable (SensorValue *object)
5388{
5389 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
5390 GVariant *variant;
5391 gboolean value = 0;
5392 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "settable");
5393 if (variant != NULL)
5394 {
5395 value = g_variant_get_boolean (variant);
5396 g_variant_unref (variant);
5397 }
5398 return value;
5399}
5400
Norman James362a80f2015-09-14 14:04:39 -05005401static void
5402sensor_value_proxy_init (SensorValueProxy *proxy)
5403{
5404#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
5405 proxy->priv = sensor_value_proxy_get_instance_private (proxy);
5406#else
5407 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_VALUE_PROXY, SensorValueProxyPrivate);
5408#endif
5409
5410 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_value_interface_info ());
5411}
5412
5413static void
5414sensor_value_proxy_class_init (SensorValueProxyClass *klass)
5415{
5416 GObjectClass *gobject_class;
5417 GDBusProxyClass *proxy_class;
5418
5419 gobject_class = G_OBJECT_CLASS (klass);
5420 gobject_class->finalize = sensor_value_proxy_finalize;
5421 gobject_class->get_property = sensor_value_proxy_get_property;
5422 gobject_class->set_property = sensor_value_proxy_set_property;
5423
5424 proxy_class = G_DBUS_PROXY_CLASS (klass);
5425 proxy_class->g_signal = sensor_value_proxy_g_signal;
5426 proxy_class->g_properties_changed = sensor_value_proxy_g_properties_changed;
5427
5428 sensor_value_override_properties (gobject_class, 1);
5429
5430#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
5431 g_type_class_add_private (klass, sizeof (SensorValueProxyPrivate));
5432#endif
5433}
5434
5435static void
5436sensor_value_proxy_iface_init (SensorValueIface *iface)
5437{
5438 iface->get_value = sensor_value_proxy_get_value;
5439 iface->get_units = sensor_value_proxy_get_units;
5440 iface->get_poll_interval = sensor_value_proxy_get_poll_interval;
5441 iface->get_heatbeat = sensor_value_proxy_get_heatbeat;
5442 iface->get_settable = sensor_value_proxy_get_settable;
Norman James362a80f2015-09-14 14:04:39 -05005443}
5444
5445/**
5446 * sensor_value_proxy_new:
5447 * @connection: A #GDBusConnection.
5448 * @flags: Flags from the #GDBusProxyFlags enumeration.
5449 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
5450 * @object_path: An object path.
5451 * @cancellable: (allow-none): A #GCancellable or %NULL.
5452 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
5453 * @user_data: User data to pass to @callback.
5454 *
5455 * 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.
5456 *
5457 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
5458 * You can then call sensor_value_proxy_new_finish() to get the result of the operation.
5459 *
5460 * See sensor_value_proxy_new_sync() for the synchronous, blocking version of this constructor.
5461 */
5462void
5463sensor_value_proxy_new (
5464 GDBusConnection *connection,
5465 GDBusProxyFlags flags,
5466 const gchar *name,
5467 const gchar *object_path,
5468 GCancellable *cancellable,
5469 GAsyncReadyCallback callback,
5470 gpointer user_data)
5471{
5472 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);
5473}
5474
5475/**
5476 * sensor_value_proxy_new_finish:
5477 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_proxy_new().
5478 * @error: Return location for error or %NULL
5479 *
5480 * Finishes an operation started with sensor_value_proxy_new().
5481 *
5482 * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set.
5483 */
5484SensorValue *
5485sensor_value_proxy_new_finish (
5486 GAsyncResult *res,
5487 GError **error)
5488{
5489 GObject *ret;
5490 GObject *source_object;
5491 source_object = g_async_result_get_source_object (res);
5492 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
5493 g_object_unref (source_object);
5494 if (ret != NULL)
5495 return SENSOR_VALUE (ret);
5496 else
5497 return NULL;
5498}
5499
5500/**
5501 * sensor_value_proxy_new_sync:
5502 * @connection: A #GDBusConnection.
5503 * @flags: Flags from the #GDBusProxyFlags enumeration.
5504 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
5505 * @object_path: An object path.
5506 * @cancellable: (allow-none): A #GCancellable or %NULL.
5507 * @error: Return location for error or %NULL
5508 *
5509 * 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.
5510 *
5511 * The calling thread is blocked until a reply is received.
5512 *
5513 * See sensor_value_proxy_new() for the asynchronous version of this constructor.
5514 *
5515 * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set.
5516 */
5517SensorValue *
5518sensor_value_proxy_new_sync (
5519 GDBusConnection *connection,
5520 GDBusProxyFlags flags,
5521 const gchar *name,
5522 const gchar *object_path,
5523 GCancellable *cancellable,
5524 GError **error)
5525{
5526 GInitable *ret;
5527 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);
5528 if (ret != NULL)
5529 return SENSOR_VALUE (ret);
5530 else
5531 return NULL;
5532}
5533
5534
5535/**
5536 * sensor_value_proxy_new_for_bus:
5537 * @bus_type: A #GBusType.
5538 * @flags: Flags from the #GDBusProxyFlags enumeration.
5539 * @name: A bus name (well-known or unique).
5540 * @object_path: An object path.
5541 * @cancellable: (allow-none): A #GCancellable or %NULL.
5542 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
5543 * @user_data: User data to pass to @callback.
5544 *
5545 * Like sensor_value_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
5546 *
5547 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
5548 * You can then call sensor_value_proxy_new_for_bus_finish() to get the result of the operation.
5549 *
5550 * See sensor_value_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
5551 */
5552void
5553sensor_value_proxy_new_for_bus (
5554 GBusType bus_type,
5555 GDBusProxyFlags flags,
5556 const gchar *name,
5557 const gchar *object_path,
5558 GCancellable *cancellable,
5559 GAsyncReadyCallback callback,
5560 gpointer user_data)
5561{
5562 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);
5563}
5564
5565/**
5566 * sensor_value_proxy_new_for_bus_finish:
5567 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_proxy_new_for_bus().
5568 * @error: Return location for error or %NULL
5569 *
5570 * Finishes an operation started with sensor_value_proxy_new_for_bus().
5571 *
5572 * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set.
5573 */
5574SensorValue *
5575sensor_value_proxy_new_for_bus_finish (
5576 GAsyncResult *res,
5577 GError **error)
5578{
5579 GObject *ret;
5580 GObject *source_object;
5581 source_object = g_async_result_get_source_object (res);
5582 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
5583 g_object_unref (source_object);
5584 if (ret != NULL)
5585 return SENSOR_VALUE (ret);
5586 else
5587 return NULL;
5588}
5589
5590/**
5591 * sensor_value_proxy_new_for_bus_sync:
5592 * @bus_type: A #GBusType.
5593 * @flags: Flags from the #GDBusProxyFlags enumeration.
5594 * @name: A bus name (well-known or unique).
5595 * @object_path: An object path.
5596 * @cancellable: (allow-none): A #GCancellable or %NULL.
5597 * @error: Return location for error or %NULL
5598 *
5599 * Like sensor_value_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
5600 *
5601 * The calling thread is blocked until a reply is received.
5602 *
5603 * See sensor_value_proxy_new_for_bus() for the asynchronous version of this constructor.
5604 *
5605 * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set.
5606 */
5607SensorValue *
5608sensor_value_proxy_new_for_bus_sync (
5609 GBusType bus_type,
5610 GDBusProxyFlags flags,
5611 const gchar *name,
5612 const gchar *object_path,
5613 GCancellable *cancellable,
5614 GError **error)
5615{
5616 GInitable *ret;
5617 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);
5618 if (ret != NULL)
5619 return SENSOR_VALUE (ret);
5620 else
5621 return NULL;
5622}
5623
5624
5625/* ------------------------------------------------------------------------ */
5626
5627/**
5628 * SensorValueSkeleton:
5629 *
5630 * The #SensorValueSkeleton structure contains only private data and should only be accessed using the provided API.
5631 */
5632
5633/**
5634 * SensorValueSkeletonClass:
5635 * @parent_class: The parent class.
5636 *
5637 * Class structure for #SensorValueSkeleton.
5638 */
5639
5640struct _SensorValueSkeletonPrivate
5641{
5642 GValue *properties;
5643 GList *changed_properties;
5644 GSource *changed_properties_idle_source;
5645 GMainContext *context;
5646 GMutex lock;
5647};
5648
5649static void
5650_sensor_value_skeleton_handle_method_call (
5651 GDBusConnection *connection G_GNUC_UNUSED,
5652 const gchar *sender G_GNUC_UNUSED,
5653 const gchar *object_path G_GNUC_UNUSED,
5654 const gchar *interface_name,
5655 const gchar *method_name,
5656 GVariant *parameters,
5657 GDBusMethodInvocation *invocation,
5658 gpointer user_data)
5659{
5660 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data);
5661 _ExtendedGDBusMethodInfo *info;
5662 GVariantIter iter;
5663 GVariant *child;
5664 GValue *paramv;
5665 guint num_params;
5666 guint num_extra;
5667 guint n;
5668 guint signal_id;
5669 GValue return_value = G_VALUE_INIT;
5670 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
5671 g_assert (info != NULL);
5672 num_params = g_variant_n_children (parameters);
5673 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
5674 n = 0;
5675 g_value_init (&paramv[n], TYPE_SENSOR_VALUE);
5676 g_value_set_object (&paramv[n++], skeleton);
5677 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
5678 g_value_set_object (&paramv[n++], invocation);
5679 if (info->pass_fdlist)
5680 {
5681#ifdef G_OS_UNIX
5682 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
5683 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
5684#else
5685 g_assert_not_reached ();
5686#endif
5687 }
5688 g_variant_iter_init (&iter, parameters);
5689 while ((child = g_variant_iter_next_value (&iter)) != NULL)
5690 {
5691 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
5692 if (arg_info->use_gvariant)
5693 {
5694 g_value_init (&paramv[n], G_TYPE_VARIANT);
5695 g_value_set_variant (&paramv[n], child);
5696 n++;
5697 }
5698 else
5699 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
5700 g_variant_unref (child);
5701 }
5702 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_VALUE);
5703 g_value_init (&return_value, G_TYPE_BOOLEAN);
5704 g_signal_emitv (paramv, signal_id, 0, &return_value);
5705 if (!g_value_get_boolean (&return_value))
5706 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);
5707 g_value_unset (&return_value);
5708 for (n = 0; n < num_params + num_extra; n++)
5709 g_value_unset (&paramv[n]);
5710 g_free (paramv);
5711}
5712
5713static GVariant *
5714_sensor_value_skeleton_handle_get_property (
5715 GDBusConnection *connection G_GNUC_UNUSED,
5716 const gchar *sender G_GNUC_UNUSED,
5717 const gchar *object_path G_GNUC_UNUSED,
5718 const gchar *interface_name G_GNUC_UNUSED,
5719 const gchar *property_name,
5720 GError **error,
5721 gpointer user_data)
5722{
5723 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data);
5724 GValue value = G_VALUE_INIT;
5725 GParamSpec *pspec;
5726 _ExtendedGDBusPropertyInfo *info;
5727 GVariant *ret;
5728 ret = NULL;
5729 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, property_name);
5730 g_assert (info != NULL);
5731 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
5732 if (pspec == NULL)
5733 {
5734 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
5735 }
5736 else
5737 {
5738 g_value_init (&value, pspec->value_type);
5739 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
5740 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
5741 g_value_unset (&value);
5742 }
5743 return ret;
5744}
5745
5746static gboolean
5747_sensor_value_skeleton_handle_set_property (
5748 GDBusConnection *connection G_GNUC_UNUSED,
5749 const gchar *sender G_GNUC_UNUSED,
5750 const gchar *object_path G_GNUC_UNUSED,
5751 const gchar *interface_name G_GNUC_UNUSED,
5752 const gchar *property_name,
5753 GVariant *variant,
5754 GError **error,
5755 gpointer user_data)
5756{
5757 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data);
5758 GValue value = G_VALUE_INIT;
5759 GParamSpec *pspec;
5760 _ExtendedGDBusPropertyInfo *info;
5761 gboolean ret;
5762 ret = FALSE;
5763 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, property_name);
5764 g_assert (info != NULL);
5765 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
5766 if (pspec == NULL)
5767 {
5768 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
5769 }
5770 else
5771 {
5772 if (info->use_gvariant)
5773 g_value_set_variant (&value, variant);
5774 else
5775 g_dbus_gvariant_to_gvalue (variant, &value);
5776 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
5777 g_value_unset (&value);
5778 ret = TRUE;
5779 }
5780 return ret;
5781}
5782
5783static const GDBusInterfaceVTable _sensor_value_skeleton_vtable =
5784{
5785 _sensor_value_skeleton_handle_method_call,
5786 _sensor_value_skeleton_handle_get_property,
5787 _sensor_value_skeleton_handle_set_property,
5788 {NULL}
5789};
5790
5791static GDBusInterfaceInfo *
5792sensor_value_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
5793{
5794 return sensor_value_interface_info ();
5795}
5796
5797static GDBusInterfaceVTable *
5798sensor_value_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
5799{
5800 return (GDBusInterfaceVTable *) &_sensor_value_skeleton_vtable;
5801}
5802
5803static GVariant *
5804sensor_value_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
5805{
5806 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (_skeleton);
5807
5808 GVariantBuilder builder;
5809 guint n;
5810 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
5811 if (_sensor_value_interface_info.parent_struct.properties == NULL)
5812 goto out;
5813 for (n = 0; _sensor_value_interface_info.parent_struct.properties[n] != NULL; n++)
5814 {
5815 GDBusPropertyInfo *info = _sensor_value_interface_info.parent_struct.properties[n];
5816 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
5817 {
5818 GVariant *value;
5819 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);
5820 if (value != NULL)
5821 {
5822 g_variant_take_ref (value);
5823 g_variant_builder_add (&builder, "{sv}", info->name, value);
5824 g_variant_unref (value);
5825 }
5826 }
5827 }
5828out:
5829 return g_variant_builder_end (&builder);
5830}
5831
5832static gboolean _sensor_value_emit_changed (gpointer user_data);
5833
5834static void
5835sensor_value_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
5836{
5837 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (_skeleton);
5838 gboolean emit_changed = FALSE;
5839
5840 g_mutex_lock (&skeleton->priv->lock);
5841 if (skeleton->priv->changed_properties_idle_source != NULL)
5842 {
5843 g_source_destroy (skeleton->priv->changed_properties_idle_source);
5844 skeleton->priv->changed_properties_idle_source = NULL;
5845 emit_changed = TRUE;
5846 }
5847 g_mutex_unlock (&skeleton->priv->lock);
5848
5849 if (emit_changed)
5850 _sensor_value_emit_changed (skeleton);
5851}
5852
5853static void
5854_sensor_value_on_signal_changed (
5855 SensorValue *object,
5856 GVariant *arg_value,
5857 const gchar *arg_units)
5858{
5859 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5860
5861 GList *connections, *l;
5862 GVariant *signal_variant;
5863 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
5864
5865 signal_variant = g_variant_ref_sink (g_variant_new ("(@vs)",
5866 arg_value,
5867 arg_units));
5868 for (l = connections; l != NULL; l = l->next)
5869 {
5870 GDBusConnection *connection = l->data;
5871 g_dbus_connection_emit_signal (connection,
5872 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorValue", "Changed",
5873 signal_variant, NULL);
5874 }
5875 g_variant_unref (signal_variant);
5876 g_list_free_full (connections, g_object_unref);
5877}
5878
5879static void
Norman James32e74e22015-09-15 21:28:06 -05005880_sensor_value_on_signal_error (
5881 SensorValue *object)
5882{
5883 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5884
5885 GList *connections, *l;
5886 GVariant *signal_variant;
5887 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
5888
5889 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
5890 for (l = connections; l != NULL; l = l->next)
5891 {
5892 GDBusConnection *connection = l->data;
5893 g_dbus_connection_emit_signal (connection,
5894 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorValue", "Error",
5895 signal_variant, NULL);
5896 }
5897 g_variant_unref (signal_variant);
5898 g_list_free_full (connections, g_object_unref);
5899}
5900
5901static void
Norman James362a80f2015-09-14 14:04:39 -05005902_sensor_value_on_signal_heartbeat (
5903 SensorValue *object,
5904 const gchar *arg_bus_name)
5905{
5906 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5907
5908 GList *connections, *l;
5909 GVariant *signal_variant;
5910 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
5911
5912 signal_variant = g_variant_ref_sink (g_variant_new ("(s)",
5913 arg_bus_name));
5914 for (l = connections; l != NULL; l = l->next)
5915 {
5916 GDBusConnection *connection = l->data;
5917 g_dbus_connection_emit_signal (connection,
5918 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorValue", "Heartbeat",
5919 signal_variant, NULL);
5920 }
5921 g_variant_unref (signal_variant);
5922 g_list_free_full (connections, g_object_unref);
5923}
5924
5925static void sensor_value_skeleton_iface_init (SensorValueIface *iface);
5926#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
5927G_DEFINE_TYPE_WITH_CODE (SensorValueSkeleton, sensor_value_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
5928 G_ADD_PRIVATE (SensorValueSkeleton)
5929 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_skeleton_iface_init));
5930
5931#else
5932G_DEFINE_TYPE_WITH_CODE (SensorValueSkeleton, sensor_value_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
5933 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_skeleton_iface_init));
5934
5935#endif
5936static void
5937sensor_value_skeleton_finalize (GObject *object)
5938{
5939 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5940 guint n;
Norman Jamesdfdaca92015-09-27 22:11:15 -05005941 for (n = 0; n < 5; n++)
Norman James362a80f2015-09-14 14:04:39 -05005942 g_value_unset (&skeleton->priv->properties[n]);
5943 g_free (skeleton->priv->properties);
5944 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
5945 if (skeleton->priv->changed_properties_idle_source != NULL)
5946 g_source_destroy (skeleton->priv->changed_properties_idle_source);
5947 g_main_context_unref (skeleton->priv->context);
5948 g_mutex_clear (&skeleton->priv->lock);
5949 G_OBJECT_CLASS (sensor_value_skeleton_parent_class)->finalize (object);
5950}
5951
5952static void
5953sensor_value_skeleton_get_property (GObject *object,
5954 guint prop_id,
5955 GValue *value,
5956 GParamSpec *pspec G_GNUC_UNUSED)
5957{
5958 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
Norman Jamesdfdaca92015-09-27 22:11:15 -05005959 g_assert (prop_id != 0 && prop_id - 1 < 5);
Norman James362a80f2015-09-14 14:04:39 -05005960 g_mutex_lock (&skeleton->priv->lock);
5961 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
5962 g_mutex_unlock (&skeleton->priv->lock);
5963}
5964
5965static gboolean
5966_sensor_value_emit_changed (gpointer user_data)
5967{
5968 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data);
5969 GList *l;
5970 GVariantBuilder builder;
5971 GVariantBuilder invalidated_builder;
5972 guint num_changes;
5973
5974 g_mutex_lock (&skeleton->priv->lock);
5975 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
5976 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
5977 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
5978 {
5979 ChangedProperty *cp = l->data;
5980 GVariant *variant;
5981 const GValue *cur_value;
5982
5983 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
5984 if (!_g_value_equal (cur_value, &cp->orig_value))
5985 {
5986 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
5987 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
5988 g_variant_unref (variant);
5989 num_changes++;
5990 }
5991 }
5992 if (num_changes > 0)
5993 {
5994 GList *connections, *ll;
5995 GVariant *signal_variant;
5996 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorValue",
5997 &builder, &invalidated_builder));
5998 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
5999 for (ll = connections; ll != NULL; ll = ll->next)
6000 {
6001 GDBusConnection *connection = ll->data;
6002
6003 g_dbus_connection_emit_signal (connection,
6004 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
6005 "org.freedesktop.DBus.Properties",
6006 "PropertiesChanged",
6007 signal_variant,
6008 NULL);
6009 }
6010 g_variant_unref (signal_variant);
6011 g_list_free_full (connections, g_object_unref);
6012 }
6013 else
6014 {
6015 g_variant_builder_clear (&builder);
6016 g_variant_builder_clear (&invalidated_builder);
6017 }
6018 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
6019 skeleton->priv->changed_properties = NULL;
6020 skeleton->priv->changed_properties_idle_source = NULL;
6021 g_mutex_unlock (&skeleton->priv->lock);
6022 return FALSE;
6023}
6024
6025static void
6026_sensor_value_schedule_emit_changed (SensorValueSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
6027{
6028 ChangedProperty *cp;
6029 GList *l;
6030 cp = NULL;
6031 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
6032 {
6033 ChangedProperty *i_cp = l->data;
6034 if (i_cp->info == info)
6035 {
6036 cp = i_cp;
6037 break;
6038 }
6039 }
6040 if (cp == NULL)
6041 {
6042 cp = g_new0 (ChangedProperty, 1);
6043 cp->prop_id = prop_id;
6044 cp->info = info;
6045 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
6046 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
6047 g_value_copy (orig_value, &cp->orig_value);
6048 }
6049}
6050
6051static void
6052sensor_value_skeleton_notify (GObject *object,
6053 GParamSpec *pspec G_GNUC_UNUSED)
6054{
6055 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
6056 g_mutex_lock (&skeleton->priv->lock);
6057 if (skeleton->priv->changed_properties != NULL &&
6058 skeleton->priv->changed_properties_idle_source == NULL)
6059 {
6060 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
6061 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
6062 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_value_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
6063 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
6064 g_source_unref (skeleton->priv->changed_properties_idle_source);
6065 }
6066 g_mutex_unlock (&skeleton->priv->lock);
6067}
6068
6069static void
6070sensor_value_skeleton_set_property (GObject *object,
6071 guint prop_id,
6072 const GValue *value,
6073 GParamSpec *pspec)
6074{
6075 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
Norman Jamesdfdaca92015-09-27 22:11:15 -05006076 g_assert (prop_id != 0 && prop_id - 1 < 5);
Norman James362a80f2015-09-14 14:04:39 -05006077 g_mutex_lock (&skeleton->priv->lock);
6078 g_object_freeze_notify (object);
6079 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
6080 {
6081 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
6082 _sensor_value_schedule_emit_changed (skeleton, _sensor_value_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
6083 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
6084 g_object_notify_by_pspec (object, pspec);
6085 }
6086 g_mutex_unlock (&skeleton->priv->lock);
6087 g_object_thaw_notify (object);
6088}
6089
6090static void
6091sensor_value_skeleton_init (SensorValueSkeleton *skeleton)
6092{
6093#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
6094 skeleton->priv = sensor_value_skeleton_get_instance_private (skeleton);
6095#else
6096 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_VALUE_SKELETON, SensorValueSkeletonPrivate);
6097#endif
6098
6099 g_mutex_init (&skeleton->priv->lock);
6100 skeleton->priv->context = g_main_context_ref_thread_default ();
Norman Jamesdfdaca92015-09-27 22:11:15 -05006101 skeleton->priv->properties = g_new0 (GValue, 5);
Norman James362a80f2015-09-14 14:04:39 -05006102 g_value_init (&skeleton->priv->properties[0], G_TYPE_VARIANT);
6103 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
6104 g_value_init (&skeleton->priv->properties[2], G_TYPE_INT);
6105 g_value_init (&skeleton->priv->properties[3], G_TYPE_INT);
6106 g_value_init (&skeleton->priv->properties[4], G_TYPE_BOOLEAN);
Norman James362a80f2015-09-14 14:04:39 -05006107}
6108
6109static GVariant *
6110sensor_value_skeleton_get_value (SensorValue *object)
6111{
6112 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
6113 GVariant *value;
6114 g_mutex_lock (&skeleton->priv->lock);
6115 value = g_value_get_variant (&(skeleton->priv->properties[0]));
6116 g_mutex_unlock (&skeleton->priv->lock);
6117 return value;
6118}
6119
6120static const gchar *
6121sensor_value_skeleton_get_units (SensorValue *object)
6122{
6123 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
6124 const gchar *value;
6125 g_mutex_lock (&skeleton->priv->lock);
6126 value = g_value_get_string (&(skeleton->priv->properties[1]));
6127 g_mutex_unlock (&skeleton->priv->lock);
6128 return value;
6129}
6130
6131static gint
6132sensor_value_skeleton_get_poll_interval (SensorValue *object)
6133{
6134 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
6135 gint value;
6136 g_mutex_lock (&skeleton->priv->lock);
6137 value = g_value_get_int (&(skeleton->priv->properties[2]));
6138 g_mutex_unlock (&skeleton->priv->lock);
6139 return value;
6140}
6141
6142static gint
6143sensor_value_skeleton_get_heatbeat (SensorValue *object)
6144{
6145 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
6146 gint value;
6147 g_mutex_lock (&skeleton->priv->lock);
6148 value = g_value_get_int (&(skeleton->priv->properties[3]));
6149 g_mutex_unlock (&skeleton->priv->lock);
6150 return value;
6151}
6152
6153static gboolean
6154sensor_value_skeleton_get_settable (SensorValue *object)
6155{
6156 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
6157 gboolean value;
6158 g_mutex_lock (&skeleton->priv->lock);
6159 value = g_value_get_boolean (&(skeleton->priv->properties[4]));
6160 g_mutex_unlock (&skeleton->priv->lock);
6161 return value;
6162}
6163
Norman James362a80f2015-09-14 14:04:39 -05006164static void
6165sensor_value_skeleton_class_init (SensorValueSkeletonClass *klass)
6166{
6167 GObjectClass *gobject_class;
6168 GDBusInterfaceSkeletonClass *skeleton_class;
6169
6170 gobject_class = G_OBJECT_CLASS (klass);
6171 gobject_class->finalize = sensor_value_skeleton_finalize;
6172 gobject_class->get_property = sensor_value_skeleton_get_property;
6173 gobject_class->set_property = sensor_value_skeleton_set_property;
6174 gobject_class->notify = sensor_value_skeleton_notify;
6175
6176
6177 sensor_value_override_properties (gobject_class, 1);
6178
6179 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
6180 skeleton_class->get_info = sensor_value_skeleton_dbus_interface_get_info;
6181 skeleton_class->get_properties = sensor_value_skeleton_dbus_interface_get_properties;
6182 skeleton_class->flush = sensor_value_skeleton_dbus_interface_flush;
6183 skeleton_class->get_vtable = sensor_value_skeleton_dbus_interface_get_vtable;
6184
6185#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
6186 g_type_class_add_private (klass, sizeof (SensorValueSkeletonPrivate));
6187#endif
6188}
6189
6190static void
6191sensor_value_skeleton_iface_init (SensorValueIface *iface)
6192{
6193 iface->changed = _sensor_value_on_signal_changed;
Norman James32e74e22015-09-15 21:28:06 -05006194 iface->error = _sensor_value_on_signal_error;
Norman James362a80f2015-09-14 14:04:39 -05006195 iface->heartbeat = _sensor_value_on_signal_heartbeat;
6196 iface->get_value = sensor_value_skeleton_get_value;
6197 iface->get_units = sensor_value_skeleton_get_units;
6198 iface->get_poll_interval = sensor_value_skeleton_get_poll_interval;
6199 iface->get_heatbeat = sensor_value_skeleton_get_heatbeat;
6200 iface->get_settable = sensor_value_skeleton_get_settable;
Norman James362a80f2015-09-14 14:04:39 -05006201}
6202
6203/**
6204 * sensor_value_skeleton_new:
6205 *
6206 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link>.
6207 *
6208 * Returns: (transfer full) (type SensorValueSkeleton): The skeleton object.
6209 */
6210SensorValue *
6211sensor_value_skeleton_new (void)
6212{
6213 return SENSOR_VALUE (g_object_new (TYPE_SENSOR_VALUE_SKELETON, NULL));
6214}
6215
6216/* ------------------------------------------------------------------------
6217 * Code for interface org.openbmc.SensorThreshold
6218 * ------------------------------------------------------------------------
6219 */
6220
6221/**
6222 * SECTION:SensorThreshold
6223 * @title: SensorThreshold
6224 * @short_description: Generated C code for the org.openbmc.SensorThreshold D-Bus interface
6225 *
6226 * 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.
6227 */
6228
6229/* ---- Introspection data for org.openbmc.SensorThreshold ---- */
6230
6231static const _ExtendedGDBusArgInfo _sensor_threshold_method_info_get_state_OUT_ARG_state =
6232{
6233 {
6234 -1,
6235 (gchar *) "state",
6236 (gchar *) "y",
6237 NULL
6238 },
6239 FALSE
6240};
6241
6242static const _ExtendedGDBusArgInfo * const _sensor_threshold_method_info_get_state_OUT_ARG_pointers[] =
6243{
6244 &_sensor_threshold_method_info_get_state_OUT_ARG_state,
6245 NULL
6246};
6247
6248static const _ExtendedGDBusMethodInfo _sensor_threshold_method_info_get_state =
6249{
6250 {
6251 -1,
6252 (gchar *) "getState",
6253 NULL,
6254 (GDBusArgInfo **) &_sensor_threshold_method_info_get_state_OUT_ARG_pointers,
6255 NULL
6256 },
6257 "handle-get-state",
6258 FALSE
6259};
6260
6261static const _ExtendedGDBusMethodInfo * const _sensor_threshold_method_info_pointers[] =
6262{
6263 &_sensor_threshold_method_info_get_state,
6264 NULL
6265};
6266
6267static const _ExtendedGDBusSignalInfo _sensor_threshold_signal_info_warning =
6268{
6269 {
6270 -1,
6271 (gchar *) "Warning",
6272 NULL,
6273 NULL
6274 },
6275 "warning"
6276};
6277
6278static const _ExtendedGDBusSignalInfo _sensor_threshold_signal_info_critical =
6279{
6280 {
6281 -1,
6282 (gchar *) "Critical",
6283 NULL,
6284 NULL
6285 },
6286 "critical"
6287};
6288
6289static const _ExtendedGDBusSignalInfo _sensor_threshold_signal_info_normal =
6290{
6291 {
6292 -1,
6293 (gchar *) "Normal",
6294 NULL,
6295 NULL
6296 },
6297 "normal"
6298};
6299
6300static const _ExtendedGDBusSignalInfo * const _sensor_threshold_signal_info_pointers[] =
6301{
6302 &_sensor_threshold_signal_info_warning,
6303 &_sensor_threshold_signal_info_critical,
6304 &_sensor_threshold_signal_info_normal,
6305 NULL
6306};
6307
6308static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_lower_critical =
6309{
6310 {
6311 -1,
6312 (gchar *) "lower_critical",
6313 (gchar *) "v",
6314 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
6315 NULL
6316 },
6317 "lower-critical",
6318 FALSE
6319};
6320
6321static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_lower_warning =
6322{
6323 {
6324 -1,
6325 (gchar *) "lower_warning",
6326 (gchar *) "v",
6327 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
6328 NULL
6329 },
6330 "lower-warning",
6331 FALSE
6332};
6333
6334static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_upper_warning =
6335{
6336 {
6337 -1,
6338 (gchar *) "upper_warning",
6339 (gchar *) "v",
6340 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
6341 NULL
6342 },
6343 "upper-warning",
6344 FALSE
6345};
6346
6347static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_upper_critical =
6348{
6349 {
6350 -1,
6351 (gchar *) "upper_critical",
6352 (gchar *) "v",
6353 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
6354 NULL
6355 },
6356 "upper-critical",
6357 FALSE
6358};
6359
6360static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_state =
6361{
6362 {
6363 -1,
6364 (gchar *) "state",
6365 (gchar *) "y",
6366 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
6367 NULL
6368 },
6369 "state",
6370 FALSE
6371};
6372
6373static const _ExtendedGDBusPropertyInfo * const _sensor_threshold_property_info_pointers[] =
6374{
6375 &_sensor_threshold_property_info_lower_critical,
6376 &_sensor_threshold_property_info_lower_warning,
6377 &_sensor_threshold_property_info_upper_warning,
6378 &_sensor_threshold_property_info_upper_critical,
6379 &_sensor_threshold_property_info_state,
6380 NULL
6381};
6382
6383static const _ExtendedGDBusInterfaceInfo _sensor_threshold_interface_info =
6384{
6385 {
6386 -1,
6387 (gchar *) "org.openbmc.SensorThreshold",
6388 (GDBusMethodInfo **) &_sensor_threshold_method_info_pointers,
6389 (GDBusSignalInfo **) &_sensor_threshold_signal_info_pointers,
6390 (GDBusPropertyInfo **) &_sensor_threshold_property_info_pointers,
6391 NULL
6392 },
6393 "sensor-threshold",
6394};
6395
6396
6397/**
6398 * sensor_threshold_interface_info:
6399 *
6400 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link> D-Bus interface.
6401 *
6402 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
6403 */
6404GDBusInterfaceInfo *
6405sensor_threshold_interface_info (void)
6406{
6407 return (GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct;
6408}
6409
6410/**
6411 * sensor_threshold_override_properties:
6412 * @klass: The class structure for a #GObject<!-- -->-derived class.
6413 * @property_id_begin: The property id to assign to the first overridden property.
6414 *
6415 * Overrides all #GObject properties in the #SensorThreshold interface for a concrete class.
6416 * The properties are overridden in the order they are defined.
6417 *
6418 * Returns: The last property id.
6419 */
6420guint
6421sensor_threshold_override_properties (GObjectClass *klass, guint property_id_begin)
6422{
6423 g_object_class_override_property (klass, property_id_begin++, "lower-critical");
6424 g_object_class_override_property (klass, property_id_begin++, "lower-warning");
6425 g_object_class_override_property (klass, property_id_begin++, "upper-warning");
6426 g_object_class_override_property (klass, property_id_begin++, "upper-critical");
6427 g_object_class_override_property (klass, property_id_begin++, "state");
6428 return property_id_begin - 1;
6429}
6430
6431
6432
6433/**
6434 * SensorThreshold:
6435 *
6436 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link>.
6437 */
6438
6439/**
6440 * SensorThresholdIface:
6441 * @parent_iface: The parent interface.
6442 * @handle_get_state: Handler for the #SensorThreshold::handle-get-state signal.
6443 * @get_lower_critical: Getter for the #SensorThreshold:lower-critical property.
6444 * @get_lower_warning: Getter for the #SensorThreshold:lower-warning property.
6445 * @get_state: Getter for the #SensorThreshold:state property.
6446 * @get_upper_critical: Getter for the #SensorThreshold:upper-critical property.
6447 * @get_upper_warning: Getter for the #SensorThreshold:upper-warning property.
6448 * @critical: Handler for the #SensorThreshold::critical signal.
6449 * @normal: Handler for the #SensorThreshold::normal signal.
6450 * @warning: Handler for the #SensorThreshold::warning signal.
6451 *
6452 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link>.
6453 */
6454
6455typedef SensorThresholdIface SensorThresholdInterface;
6456G_DEFINE_INTERFACE (SensorThreshold, sensor_threshold, G_TYPE_OBJECT);
6457
6458static void
6459sensor_threshold_default_init (SensorThresholdIface *iface)
6460{
6461 /* GObject signals for incoming D-Bus method calls: */
6462 /**
6463 * SensorThreshold::handle-get-state:
6464 * @object: A #SensorThreshold.
6465 * @invocation: A #GDBusMethodInvocation.
6466 *
6467 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorThreshold.getState">getState()</link> D-Bus method.
6468 *
6469 * 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.
6470 *
6471 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
6472 */
6473 g_signal_new ("handle-get-state",
6474 G_TYPE_FROM_INTERFACE (iface),
6475 G_SIGNAL_RUN_LAST,
6476 G_STRUCT_OFFSET (SensorThresholdIface, handle_get_state),
6477 g_signal_accumulator_true_handled,
6478 NULL,
6479 g_cclosure_marshal_generic,
6480 G_TYPE_BOOLEAN,
6481 1,
6482 G_TYPE_DBUS_METHOD_INVOCATION);
6483
6484 /* GObject signals for received D-Bus signals: */
6485 /**
6486 * SensorThreshold::warning:
6487 * @object: A #SensorThreshold.
6488 *
6489 * 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.
6490 *
6491 * 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.
6492 */
6493 g_signal_new ("warning",
6494 G_TYPE_FROM_INTERFACE (iface),
6495 G_SIGNAL_RUN_LAST,
6496 G_STRUCT_OFFSET (SensorThresholdIface, warning),
6497 NULL,
6498 NULL,
6499 g_cclosure_marshal_generic,
6500 G_TYPE_NONE,
6501 0);
6502
6503 /**
6504 * SensorThreshold::critical:
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.Critical">"Critical"</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 ("critical",
6512 G_TYPE_FROM_INTERFACE (iface),
6513 G_SIGNAL_RUN_LAST,
6514 G_STRUCT_OFFSET (SensorThresholdIface, critical),
6515 NULL,
6516 NULL,
6517 g_cclosure_marshal_generic,
6518 G_TYPE_NONE,
6519 0);
6520
6521 /**
6522 * SensorThreshold::normal:
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.Normal">"Normal"</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 ("normal",
6530 G_TYPE_FROM_INTERFACE (iface),
6531 G_SIGNAL_RUN_LAST,
6532 G_STRUCT_OFFSET (SensorThresholdIface, normal),
6533 NULL,
6534 NULL,
6535 g_cclosure_marshal_generic,
6536 G_TYPE_NONE,
6537 0);
6538
6539 /* GObject properties for D-Bus properties: */
6540 /**
6541 * SensorThreshold:lower-critical:
6542 *
6543 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link>.
6544 *
6545 * 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.
6546 */
6547 g_object_interface_install_property (iface,
6548 g_param_spec_variant ("lower-critical", "lower_critical", "lower_critical", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
6549 /**
6550 * SensorThreshold:lower-warning:
6551 *
6552 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link>.
6553 *
6554 * 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.
6555 */
6556 g_object_interface_install_property (iface,
6557 g_param_spec_variant ("lower-warning", "lower_warning", "lower_warning", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
6558 /**
6559 * SensorThreshold:upper-warning:
6560 *
6561 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</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 ("upper-warning", "upper_warning", "upper_warning", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
6567 /**
6568 * SensorThreshold:upper-critical:
6569 *
6570 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</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 ("upper-critical", "upper_critical", "upper_critical", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
6576 /**
6577 * SensorThreshold:state:
6578 *
6579 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.state">"state"</link>.
6580 *
6581 * 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.
6582 */
6583 g_object_interface_install_property (iface,
6584 g_param_spec_uchar ("state", "state", "state", 0, 255, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
6585}
6586
6587/**
6588 * sensor_threshold_get_lower_critical: (skip)
6589 * @object: A #SensorThreshold.
6590 *
6591 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link> D-Bus property.
6592 *
6593 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6594 *
6595 * <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>
6596 *
6597 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
6598 */
6599GVariant *
6600sensor_threshold_get_lower_critical (SensorThreshold *object)
6601{
6602 return SENSOR_THRESHOLD_GET_IFACE (object)->get_lower_critical (object);
6603}
6604
6605/**
6606 * sensor_threshold_dup_lower_critical: (skip)
6607 * @object: A #SensorThreshold.
6608 *
6609 * Gets a copy 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 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
6614 */
6615GVariant *
6616sensor_threshold_dup_lower_critical (SensorThreshold *object)
6617{
6618 GVariant *value;
6619 g_object_get (G_OBJECT (object), "lower-critical", &value, NULL);
6620 return value;
6621}
6622
6623/**
6624 * sensor_threshold_set_lower_critical: (skip)
6625 * @object: A #SensorThreshold.
6626 * @value: The value to set.
6627 *
6628 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link> D-Bus property to @value.
6629 *
6630 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6631 */
6632void
6633sensor_threshold_set_lower_critical (SensorThreshold *object, GVariant *value)
6634{
6635 g_object_set (G_OBJECT (object), "lower-critical", value, NULL);
6636}
6637
6638/**
6639 * sensor_threshold_get_lower_warning: (skip)
6640 * @object: A #SensorThreshold.
6641 *
6642 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link> D-Bus property.
6643 *
6644 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6645 *
6646 * <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>
6647 *
6648 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
6649 */
6650GVariant *
6651sensor_threshold_get_lower_warning (SensorThreshold *object)
6652{
6653 return SENSOR_THRESHOLD_GET_IFACE (object)->get_lower_warning (object);
6654}
6655
6656/**
6657 * sensor_threshold_dup_lower_warning: (skip)
6658 * @object: A #SensorThreshold.
6659 *
6660 * Gets a copy 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 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
6665 */
6666GVariant *
6667sensor_threshold_dup_lower_warning (SensorThreshold *object)
6668{
6669 GVariant *value;
6670 g_object_get (G_OBJECT (object), "lower-warning", &value, NULL);
6671 return value;
6672}
6673
6674/**
6675 * sensor_threshold_set_lower_warning: (skip)
6676 * @object: A #SensorThreshold.
6677 * @value: The value to set.
6678 *
6679 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link> D-Bus property to @value.
6680 *
6681 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6682 */
6683void
6684sensor_threshold_set_lower_warning (SensorThreshold *object, GVariant *value)
6685{
6686 g_object_set (G_OBJECT (object), "lower-warning", value, NULL);
6687}
6688
6689/**
6690 * sensor_threshold_get_upper_warning: (skip)
6691 * @object: A #SensorThreshold.
6692 *
6693 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link> D-Bus property.
6694 *
6695 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6696 *
6697 * <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>
6698 *
6699 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
6700 */
6701GVariant *
6702sensor_threshold_get_upper_warning (SensorThreshold *object)
6703{
6704 return SENSOR_THRESHOLD_GET_IFACE (object)->get_upper_warning (object);
6705}
6706
6707/**
6708 * sensor_threshold_dup_upper_warning: (skip)
6709 * @object: A #SensorThreshold.
6710 *
6711 * Gets a copy 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 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
6716 */
6717GVariant *
6718sensor_threshold_dup_upper_warning (SensorThreshold *object)
6719{
6720 GVariant *value;
6721 g_object_get (G_OBJECT (object), "upper-warning", &value, NULL);
6722 return value;
6723}
6724
6725/**
6726 * sensor_threshold_set_upper_warning: (skip)
6727 * @object: A #SensorThreshold.
6728 * @value: The value to set.
6729 *
6730 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link> D-Bus property to @value.
6731 *
6732 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6733 */
6734void
6735sensor_threshold_set_upper_warning (SensorThreshold *object, GVariant *value)
6736{
6737 g_object_set (G_OBJECT (object), "upper-warning", value, NULL);
6738}
6739
6740/**
6741 * sensor_threshold_get_upper_critical: (skip)
6742 * @object: A #SensorThreshold.
6743 *
6744 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link> D-Bus property.
6745 *
6746 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6747 *
6748 * <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>
6749 *
6750 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
6751 */
6752GVariant *
6753sensor_threshold_get_upper_critical (SensorThreshold *object)
6754{
6755 return SENSOR_THRESHOLD_GET_IFACE (object)->get_upper_critical (object);
6756}
6757
6758/**
6759 * sensor_threshold_dup_upper_critical: (skip)
6760 * @object: A #SensorThreshold.
6761 *
6762 * Gets a copy 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 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
6767 */
6768GVariant *
6769sensor_threshold_dup_upper_critical (SensorThreshold *object)
6770{
6771 GVariant *value;
6772 g_object_get (G_OBJECT (object), "upper-critical", &value, NULL);
6773 return value;
6774}
6775
6776/**
6777 * sensor_threshold_set_upper_critical: (skip)
6778 * @object: A #SensorThreshold.
6779 * @value: The value to set.
6780 *
6781 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link> D-Bus property to @value.
6782 *
6783 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6784 */
6785void
6786sensor_threshold_set_upper_critical (SensorThreshold *object, GVariant *value)
6787{
6788 g_object_set (G_OBJECT (object), "upper-critical", value, NULL);
6789}
6790
6791/**
6792 * sensor_threshold_get_state: (skip)
6793 * @object: A #SensorThreshold.
6794 *
6795 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.state">"state"</link> D-Bus property.
6796 *
6797 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
6798 *
6799 * Returns: The property value.
6800 */
6801guchar
6802sensor_threshold_get_state (SensorThreshold *object)
6803{
6804 return SENSOR_THRESHOLD_GET_IFACE (object)->get_state (object);
6805}
6806
6807/**
6808 * sensor_threshold_set_state: (skip)
6809 * @object: A #SensorThreshold.
6810 * @value: The value to set.
6811 *
6812 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.state">"state"</link> D-Bus property to @value.
6813 *
6814 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
6815 */
6816void
6817sensor_threshold_set_state (SensorThreshold *object, guchar value)
6818{
6819 g_object_set (G_OBJECT (object), "state", value, NULL);
6820}
6821
6822/**
6823 * sensor_threshold_emit_warning:
6824 * @object: A #SensorThreshold.
6825 *
6826 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorThreshold.Warning">"Warning"</link> D-Bus signal.
6827 */
6828void
6829sensor_threshold_emit_warning (
6830 SensorThreshold *object)
6831{
6832 g_signal_emit_by_name (object, "warning");
6833}
6834
6835/**
6836 * sensor_threshold_emit_critical:
6837 * @object: A #SensorThreshold.
6838 *
6839 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorThreshold.Critical">"Critical"</link> D-Bus signal.
6840 */
6841void
6842sensor_threshold_emit_critical (
6843 SensorThreshold *object)
6844{
6845 g_signal_emit_by_name (object, "critical");
6846}
6847
6848/**
6849 * sensor_threshold_emit_normal:
6850 * @object: A #SensorThreshold.
6851 *
6852 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorThreshold.Normal">"Normal"</link> D-Bus signal.
6853 */
6854void
6855sensor_threshold_emit_normal (
6856 SensorThreshold *object)
6857{
6858 g_signal_emit_by_name (object, "normal");
6859}
6860
6861/**
6862 * sensor_threshold_call_get_state:
6863 * @proxy: A #SensorThresholdProxy.
6864 * @cancellable: (allow-none): A #GCancellable or %NULL.
6865 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
6866 * @user_data: User data to pass to @callback.
6867 *
6868 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorThreshold.getState">getState()</link> D-Bus method on @proxy.
6869 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
6870 * You can then call sensor_threshold_call_get_state_finish() to get the result of the operation.
6871 *
6872 * See sensor_threshold_call_get_state_sync() for the synchronous, blocking version of this method.
6873 */
6874void
6875sensor_threshold_call_get_state (
6876 SensorThreshold *proxy,
6877 GCancellable *cancellable,
6878 GAsyncReadyCallback callback,
6879 gpointer user_data)
6880{
6881 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
6882 "getState",
6883 g_variant_new ("()"),
6884 G_DBUS_CALL_FLAGS_NONE,
6885 -1,
6886 cancellable,
6887 callback,
6888 user_data);
6889}
6890
6891/**
6892 * sensor_threshold_call_get_state_finish:
6893 * @proxy: A #SensorThresholdProxy.
6894 * @out_state: (out): Return location for return parameter or %NULL to ignore.
6895 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_threshold_call_get_state().
6896 * @error: Return location for error or %NULL.
6897 *
6898 * Finishes an operation started with sensor_threshold_call_get_state().
6899 *
6900 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
6901 */
6902gboolean
6903sensor_threshold_call_get_state_finish (
6904 SensorThreshold *proxy,
6905 guchar *out_state,
6906 GAsyncResult *res,
6907 GError **error)
6908{
6909 GVariant *_ret;
6910 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
6911 if (_ret == NULL)
6912 goto _out;
6913 g_variant_get (_ret,
6914 "(y)",
6915 out_state);
6916 g_variant_unref (_ret);
6917_out:
6918 return _ret != NULL;
6919}
6920
6921/**
6922 * sensor_threshold_call_get_state_sync:
6923 * @proxy: A #SensorThresholdProxy.
6924 * @out_state: (out): Return location for return parameter or %NULL to ignore.
6925 * @cancellable: (allow-none): A #GCancellable or %NULL.
6926 * @error: Return location for error or %NULL.
6927 *
6928 * 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.
6929 *
6930 * See sensor_threshold_call_get_state() for the asynchronous version of this method.
6931 *
6932 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
6933 */
6934gboolean
6935sensor_threshold_call_get_state_sync (
6936 SensorThreshold *proxy,
6937 guchar *out_state,
6938 GCancellable *cancellable,
6939 GError **error)
6940{
6941 GVariant *_ret;
6942 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
6943 "getState",
6944 g_variant_new ("()"),
6945 G_DBUS_CALL_FLAGS_NONE,
6946 -1,
6947 cancellable,
6948 error);
6949 if (_ret == NULL)
6950 goto _out;
6951 g_variant_get (_ret,
6952 "(y)",
6953 out_state);
6954 g_variant_unref (_ret);
6955_out:
6956 return _ret != NULL;
6957}
6958
6959/**
6960 * sensor_threshold_complete_get_state:
6961 * @object: A #SensorThreshold.
6962 * @invocation: (transfer full): A #GDBusMethodInvocation.
6963 * @state: Parameter to return.
6964 *
6965 * 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.
6966 *
6967 * This method will free @invocation, you cannot use it afterwards.
6968 */
6969void
6970sensor_threshold_complete_get_state (
6971 SensorThreshold *object,
6972 GDBusMethodInvocation *invocation,
6973 guchar state)
6974{
6975 g_dbus_method_invocation_return_value (invocation,
6976 g_variant_new ("(y)",
6977 state));
6978}
6979
6980/* ------------------------------------------------------------------------ */
6981
6982/**
6983 * SensorThresholdProxy:
6984 *
6985 * The #SensorThresholdProxy structure contains only private data and should only be accessed using the provided API.
6986 */
6987
6988/**
6989 * SensorThresholdProxyClass:
6990 * @parent_class: The parent class.
6991 *
6992 * Class structure for #SensorThresholdProxy.
6993 */
6994
6995struct _SensorThresholdProxyPrivate
6996{
6997 GData *qdata;
6998};
6999
7000static void sensor_threshold_proxy_iface_init (SensorThresholdIface *iface);
7001
7002#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
7003G_DEFINE_TYPE_WITH_CODE (SensorThresholdProxy, sensor_threshold_proxy, G_TYPE_DBUS_PROXY,
7004 G_ADD_PRIVATE (SensorThresholdProxy)
7005 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_proxy_iface_init));
7006
7007#else
7008G_DEFINE_TYPE_WITH_CODE (SensorThresholdProxy, sensor_threshold_proxy, G_TYPE_DBUS_PROXY,
7009 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_proxy_iface_init));
7010
7011#endif
7012static void
7013sensor_threshold_proxy_finalize (GObject *object)
7014{
7015 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
7016 g_datalist_clear (&proxy->priv->qdata);
7017 G_OBJECT_CLASS (sensor_threshold_proxy_parent_class)->finalize (object);
7018}
7019
7020static void
7021sensor_threshold_proxy_get_property (GObject *object,
7022 guint prop_id,
7023 GValue *value,
7024 GParamSpec *pspec G_GNUC_UNUSED)
7025{
7026 const _ExtendedGDBusPropertyInfo *info;
7027 GVariant *variant;
7028 g_assert (prop_id != 0 && prop_id - 1 < 5);
7029 info = _sensor_threshold_property_info_pointers[prop_id - 1];
7030 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
7031 if (info->use_gvariant)
7032 {
7033 g_value_set_variant (value, variant);
7034 }
7035 else
7036 {
7037 if (variant != NULL)
7038 g_dbus_gvariant_to_gvalue (variant, value);
7039 }
7040 if (variant != NULL)
7041 g_variant_unref (variant);
7042}
7043
7044static void
7045sensor_threshold_proxy_set_property_cb (GDBusProxy *proxy,
7046 GAsyncResult *res,
7047 gpointer user_data)
7048{
7049 const _ExtendedGDBusPropertyInfo *info = user_data;
7050 GError *error;
7051 GVariant *_ret;
7052 error = NULL;
7053 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
7054 if (!_ret)
7055 {
7056 g_warning ("Error setting property '%s' on interface org.openbmc.SensorThreshold: %s (%s, %d)",
7057 info->parent_struct.name,
7058 error->message, g_quark_to_string (error->domain), error->code);
7059 g_error_free (error);
7060 }
7061 else
7062 {
7063 g_variant_unref (_ret);
7064 }
7065}
7066
7067static void
7068sensor_threshold_proxy_set_property (GObject *object,
7069 guint prop_id,
7070 const GValue *value,
7071 GParamSpec *pspec G_GNUC_UNUSED)
7072{
7073 const _ExtendedGDBusPropertyInfo *info;
7074 GVariant *variant;
7075 g_assert (prop_id != 0 && prop_id - 1 < 5);
7076 info = _sensor_threshold_property_info_pointers[prop_id - 1];
7077 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
7078 g_dbus_proxy_call (G_DBUS_PROXY (object),
7079 "org.freedesktop.DBus.Properties.Set",
7080 g_variant_new ("(ssv)", "org.openbmc.SensorThreshold", info->parent_struct.name, variant),
7081 G_DBUS_CALL_FLAGS_NONE,
7082 -1,
7083 NULL, (GAsyncReadyCallback) sensor_threshold_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
7084 g_variant_unref (variant);
7085}
7086
7087static void
7088sensor_threshold_proxy_g_signal (GDBusProxy *proxy,
7089 const gchar *sender_name G_GNUC_UNUSED,
7090 const gchar *signal_name,
7091 GVariant *parameters)
7092{
7093 _ExtendedGDBusSignalInfo *info;
7094 GVariantIter iter;
7095 GVariant *child;
7096 GValue *paramv;
7097 guint num_params;
7098 guint n;
7099 guint signal_id;
7100 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, signal_name);
7101 if (info == NULL)
7102 return;
7103 num_params = g_variant_n_children (parameters);
7104 paramv = g_new0 (GValue, num_params + 1);
7105 g_value_init (&paramv[0], TYPE_SENSOR_THRESHOLD);
7106 g_value_set_object (&paramv[0], proxy);
7107 g_variant_iter_init (&iter, parameters);
7108 n = 1;
7109 while ((child = g_variant_iter_next_value (&iter)) != NULL)
7110 {
7111 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
7112 if (arg_info->use_gvariant)
7113 {
7114 g_value_init (&paramv[n], G_TYPE_VARIANT);
7115 g_value_set_variant (&paramv[n], child);
7116 n++;
7117 }
7118 else
7119 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
7120 g_variant_unref (child);
7121 }
7122 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_THRESHOLD);
7123 g_signal_emitv (paramv, signal_id, 0, NULL);
7124 for (n = 0; n < num_params + 1; n++)
7125 g_value_unset (&paramv[n]);
7126 g_free (paramv);
7127}
7128
7129static void
7130sensor_threshold_proxy_g_properties_changed (GDBusProxy *_proxy,
7131 GVariant *changed_properties,
7132 const gchar *const *invalidated_properties)
7133{
7134 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (_proxy);
7135 guint n;
7136 const gchar *key;
7137 GVariantIter *iter;
7138 _ExtendedGDBusPropertyInfo *info;
7139 g_variant_get (changed_properties, "a{sv}", &iter);
7140 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
7141 {
7142 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, key);
7143 g_datalist_remove_data (&proxy->priv->qdata, key);
7144 if (info != NULL)
7145 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
7146 }
7147 g_variant_iter_free (iter);
7148 for (n = 0; invalidated_properties[n] != NULL; n++)
7149 {
7150 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, invalidated_properties[n]);
7151 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
7152 if (info != NULL)
7153 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
7154 }
7155}
7156
7157static GVariant *
7158sensor_threshold_proxy_get_lower_critical (SensorThreshold *object)
7159{
7160 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
7161 GVariant *variant;
7162 GVariant *value = NULL;
7163 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "lower_critical");
7164 value = variant;
7165 if (variant != NULL)
7166 g_variant_unref (variant);
7167 return value;
7168}
7169
7170static GVariant *
7171sensor_threshold_proxy_get_lower_warning (SensorThreshold *object)
7172{
7173 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
7174 GVariant *variant;
7175 GVariant *value = NULL;
7176 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "lower_warning");
7177 value = variant;
7178 if (variant != NULL)
7179 g_variant_unref (variant);
7180 return value;
7181}
7182
7183static GVariant *
7184sensor_threshold_proxy_get_upper_warning (SensorThreshold *object)
7185{
7186 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
7187 GVariant *variant;
7188 GVariant *value = NULL;
7189 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "upper_warning");
7190 value = variant;
7191 if (variant != NULL)
7192 g_variant_unref (variant);
7193 return value;
7194}
7195
7196static GVariant *
7197sensor_threshold_proxy_get_upper_critical (SensorThreshold *object)
7198{
7199 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
7200 GVariant *variant;
7201 GVariant *value = NULL;
7202 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "upper_critical");
7203 value = variant;
7204 if (variant != NULL)
7205 g_variant_unref (variant);
7206 return value;
7207}
7208
7209static guchar
7210sensor_threshold_proxy_get_state (SensorThreshold *object)
7211{
7212 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
7213 GVariant *variant;
7214 guchar value = 0;
7215 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state");
7216 if (variant != NULL)
7217 {
7218 value = g_variant_get_byte (variant);
7219 g_variant_unref (variant);
7220 }
7221 return value;
7222}
7223
7224static void
7225sensor_threshold_proxy_init (SensorThresholdProxy *proxy)
7226{
7227#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
7228 proxy->priv = sensor_threshold_proxy_get_instance_private (proxy);
7229#else
7230 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_THRESHOLD_PROXY, SensorThresholdProxyPrivate);
7231#endif
7232
7233 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_threshold_interface_info ());
7234}
7235
7236static void
7237sensor_threshold_proxy_class_init (SensorThresholdProxyClass *klass)
7238{
7239 GObjectClass *gobject_class;
7240 GDBusProxyClass *proxy_class;
7241
7242 gobject_class = G_OBJECT_CLASS (klass);
7243 gobject_class->finalize = sensor_threshold_proxy_finalize;
7244 gobject_class->get_property = sensor_threshold_proxy_get_property;
7245 gobject_class->set_property = sensor_threshold_proxy_set_property;
7246
7247 proxy_class = G_DBUS_PROXY_CLASS (klass);
7248 proxy_class->g_signal = sensor_threshold_proxy_g_signal;
7249 proxy_class->g_properties_changed = sensor_threshold_proxy_g_properties_changed;
7250
7251 sensor_threshold_override_properties (gobject_class, 1);
7252
7253#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
7254 g_type_class_add_private (klass, sizeof (SensorThresholdProxyPrivate));
7255#endif
7256}
7257
7258static void
7259sensor_threshold_proxy_iface_init (SensorThresholdIface *iface)
7260{
7261 iface->get_lower_critical = sensor_threshold_proxy_get_lower_critical;
7262 iface->get_lower_warning = sensor_threshold_proxy_get_lower_warning;
7263 iface->get_upper_warning = sensor_threshold_proxy_get_upper_warning;
7264 iface->get_upper_critical = sensor_threshold_proxy_get_upper_critical;
7265 iface->get_state = sensor_threshold_proxy_get_state;
7266}
7267
7268/**
7269 * sensor_threshold_proxy_new:
7270 * @connection: A #GDBusConnection.
7271 * @flags: Flags from the #GDBusProxyFlags enumeration.
7272 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
7273 * @object_path: An object path.
7274 * @cancellable: (allow-none): A #GCancellable or %NULL.
7275 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
7276 * @user_data: User data to pass to @callback.
7277 *
7278 * 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.
7279 *
7280 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
7281 * You can then call sensor_threshold_proxy_new_finish() to get the result of the operation.
7282 *
7283 * See sensor_threshold_proxy_new_sync() for the synchronous, blocking version of this constructor.
7284 */
7285void
7286sensor_threshold_proxy_new (
7287 GDBusConnection *connection,
7288 GDBusProxyFlags flags,
7289 const gchar *name,
7290 const gchar *object_path,
7291 GCancellable *cancellable,
7292 GAsyncReadyCallback callback,
7293 gpointer user_data)
7294{
7295 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);
7296}
7297
7298/**
7299 * sensor_threshold_proxy_new_finish:
7300 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_threshold_proxy_new().
7301 * @error: Return location for error or %NULL
7302 *
7303 * Finishes an operation started with sensor_threshold_proxy_new().
7304 *
7305 * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set.
7306 */
7307SensorThreshold *
7308sensor_threshold_proxy_new_finish (
7309 GAsyncResult *res,
7310 GError **error)
7311{
7312 GObject *ret;
7313 GObject *source_object;
7314 source_object = g_async_result_get_source_object (res);
7315 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
7316 g_object_unref (source_object);
7317 if (ret != NULL)
7318 return SENSOR_THRESHOLD (ret);
7319 else
7320 return NULL;
7321}
7322
7323/**
7324 * sensor_threshold_proxy_new_sync:
7325 * @connection: A #GDBusConnection.
7326 * @flags: Flags from the #GDBusProxyFlags enumeration.
7327 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
7328 * @object_path: An object path.
7329 * @cancellable: (allow-none): A #GCancellable or %NULL.
7330 * @error: Return location for error or %NULL
7331 *
7332 * 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.
7333 *
7334 * The calling thread is blocked until a reply is received.
7335 *
7336 * See sensor_threshold_proxy_new() for the asynchronous version of this constructor.
7337 *
7338 * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set.
7339 */
7340SensorThreshold *
7341sensor_threshold_proxy_new_sync (
7342 GDBusConnection *connection,
7343 GDBusProxyFlags flags,
7344 const gchar *name,
7345 const gchar *object_path,
7346 GCancellable *cancellable,
7347 GError **error)
7348{
7349 GInitable *ret;
7350 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);
7351 if (ret != NULL)
7352 return SENSOR_THRESHOLD (ret);
7353 else
7354 return NULL;
7355}
7356
7357
7358/**
7359 * sensor_threshold_proxy_new_for_bus:
7360 * @bus_type: A #GBusType.
7361 * @flags: Flags from the #GDBusProxyFlags enumeration.
7362 * @name: A bus name (well-known or unique).
7363 * @object_path: An object path.
7364 * @cancellable: (allow-none): A #GCancellable or %NULL.
7365 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
7366 * @user_data: User data to pass to @callback.
7367 *
7368 * Like sensor_threshold_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
7369 *
7370 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
7371 * You can then call sensor_threshold_proxy_new_for_bus_finish() to get the result of the operation.
7372 *
7373 * See sensor_threshold_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
7374 */
7375void
7376sensor_threshold_proxy_new_for_bus (
7377 GBusType bus_type,
7378 GDBusProxyFlags flags,
7379 const gchar *name,
7380 const gchar *object_path,
7381 GCancellable *cancellable,
7382 GAsyncReadyCallback callback,
7383 gpointer user_data)
7384{
7385 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);
7386}
7387
7388/**
7389 * sensor_threshold_proxy_new_for_bus_finish:
7390 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_threshold_proxy_new_for_bus().
7391 * @error: Return location for error or %NULL
7392 *
7393 * Finishes an operation started with sensor_threshold_proxy_new_for_bus().
7394 *
7395 * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set.
7396 */
7397SensorThreshold *
7398sensor_threshold_proxy_new_for_bus_finish (
7399 GAsyncResult *res,
7400 GError **error)
7401{
7402 GObject *ret;
7403 GObject *source_object;
7404 source_object = g_async_result_get_source_object (res);
7405 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
7406 g_object_unref (source_object);
7407 if (ret != NULL)
7408 return SENSOR_THRESHOLD (ret);
7409 else
7410 return NULL;
7411}
7412
7413/**
7414 * sensor_threshold_proxy_new_for_bus_sync:
7415 * @bus_type: A #GBusType.
7416 * @flags: Flags from the #GDBusProxyFlags enumeration.
7417 * @name: A bus name (well-known or unique).
7418 * @object_path: An object path.
7419 * @cancellable: (allow-none): A #GCancellable or %NULL.
7420 * @error: Return location for error or %NULL
7421 *
7422 * Like sensor_threshold_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
7423 *
7424 * The calling thread is blocked until a reply is received.
7425 *
7426 * See sensor_threshold_proxy_new_for_bus() for the asynchronous version of this constructor.
7427 *
7428 * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set.
7429 */
7430SensorThreshold *
7431sensor_threshold_proxy_new_for_bus_sync (
7432 GBusType bus_type,
7433 GDBusProxyFlags flags,
7434 const gchar *name,
7435 const gchar *object_path,
7436 GCancellable *cancellable,
7437 GError **error)
7438{
7439 GInitable *ret;
7440 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);
7441 if (ret != NULL)
7442 return SENSOR_THRESHOLD (ret);
7443 else
7444 return NULL;
7445}
7446
7447
7448/* ------------------------------------------------------------------------ */
7449
7450/**
7451 * SensorThresholdSkeleton:
7452 *
7453 * The #SensorThresholdSkeleton structure contains only private data and should only be accessed using the provided API.
7454 */
7455
7456/**
7457 * SensorThresholdSkeletonClass:
7458 * @parent_class: The parent class.
7459 *
7460 * Class structure for #SensorThresholdSkeleton.
7461 */
7462
7463struct _SensorThresholdSkeletonPrivate
7464{
7465 GValue *properties;
7466 GList *changed_properties;
7467 GSource *changed_properties_idle_source;
7468 GMainContext *context;
7469 GMutex lock;
7470};
7471
7472static void
7473_sensor_threshold_skeleton_handle_method_call (
7474 GDBusConnection *connection G_GNUC_UNUSED,
7475 const gchar *sender G_GNUC_UNUSED,
7476 const gchar *object_path G_GNUC_UNUSED,
7477 const gchar *interface_name,
7478 const gchar *method_name,
7479 GVariant *parameters,
7480 GDBusMethodInvocation *invocation,
7481 gpointer user_data)
7482{
7483 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data);
7484 _ExtendedGDBusMethodInfo *info;
7485 GVariantIter iter;
7486 GVariant *child;
7487 GValue *paramv;
7488 guint num_params;
7489 guint num_extra;
7490 guint n;
7491 guint signal_id;
7492 GValue return_value = G_VALUE_INIT;
7493 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
7494 g_assert (info != NULL);
7495 num_params = g_variant_n_children (parameters);
7496 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
7497 n = 0;
7498 g_value_init (&paramv[n], TYPE_SENSOR_THRESHOLD);
7499 g_value_set_object (&paramv[n++], skeleton);
7500 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
7501 g_value_set_object (&paramv[n++], invocation);
7502 if (info->pass_fdlist)
7503 {
7504#ifdef G_OS_UNIX
7505 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
7506 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
7507#else
7508 g_assert_not_reached ();
7509#endif
7510 }
7511 g_variant_iter_init (&iter, parameters);
7512 while ((child = g_variant_iter_next_value (&iter)) != NULL)
7513 {
7514 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
7515 if (arg_info->use_gvariant)
7516 {
7517 g_value_init (&paramv[n], G_TYPE_VARIANT);
7518 g_value_set_variant (&paramv[n], child);
7519 n++;
7520 }
7521 else
7522 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
7523 g_variant_unref (child);
7524 }
7525 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_THRESHOLD);
7526 g_value_init (&return_value, G_TYPE_BOOLEAN);
7527 g_signal_emitv (paramv, signal_id, 0, &return_value);
7528 if (!g_value_get_boolean (&return_value))
7529 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);
7530 g_value_unset (&return_value);
7531 for (n = 0; n < num_params + num_extra; n++)
7532 g_value_unset (&paramv[n]);
7533 g_free (paramv);
7534}
7535
7536static GVariant *
7537_sensor_threshold_skeleton_handle_get_property (
7538 GDBusConnection *connection G_GNUC_UNUSED,
7539 const gchar *sender G_GNUC_UNUSED,
7540 const gchar *object_path G_GNUC_UNUSED,
7541 const gchar *interface_name G_GNUC_UNUSED,
7542 const gchar *property_name,
7543 GError **error,
7544 gpointer user_data)
7545{
7546 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data);
7547 GValue value = G_VALUE_INIT;
7548 GParamSpec *pspec;
7549 _ExtendedGDBusPropertyInfo *info;
7550 GVariant *ret;
7551 ret = NULL;
7552 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, property_name);
7553 g_assert (info != NULL);
7554 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
7555 if (pspec == NULL)
7556 {
7557 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
7558 }
7559 else
7560 {
7561 g_value_init (&value, pspec->value_type);
7562 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
7563 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
7564 g_value_unset (&value);
7565 }
7566 return ret;
7567}
7568
7569static gboolean
7570_sensor_threshold_skeleton_handle_set_property (
7571 GDBusConnection *connection G_GNUC_UNUSED,
7572 const gchar *sender G_GNUC_UNUSED,
7573 const gchar *object_path G_GNUC_UNUSED,
7574 const gchar *interface_name G_GNUC_UNUSED,
7575 const gchar *property_name,
7576 GVariant *variant,
7577 GError **error,
7578 gpointer user_data)
7579{
7580 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data);
7581 GValue value = G_VALUE_INIT;
7582 GParamSpec *pspec;
7583 _ExtendedGDBusPropertyInfo *info;
7584 gboolean ret;
7585 ret = FALSE;
7586 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, property_name);
7587 g_assert (info != NULL);
7588 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
7589 if (pspec == NULL)
7590 {
7591 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
7592 }
7593 else
7594 {
7595 if (info->use_gvariant)
7596 g_value_set_variant (&value, variant);
7597 else
7598 g_dbus_gvariant_to_gvalue (variant, &value);
7599 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
7600 g_value_unset (&value);
7601 ret = TRUE;
7602 }
7603 return ret;
7604}
7605
7606static const GDBusInterfaceVTable _sensor_threshold_skeleton_vtable =
7607{
7608 _sensor_threshold_skeleton_handle_method_call,
7609 _sensor_threshold_skeleton_handle_get_property,
7610 _sensor_threshold_skeleton_handle_set_property,
7611 {NULL}
7612};
7613
7614static GDBusInterfaceInfo *
7615sensor_threshold_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
7616{
7617 return sensor_threshold_interface_info ();
7618}
7619
7620static GDBusInterfaceVTable *
7621sensor_threshold_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
7622{
7623 return (GDBusInterfaceVTable *) &_sensor_threshold_skeleton_vtable;
7624}
7625
7626static GVariant *
7627sensor_threshold_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
7628{
7629 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (_skeleton);
7630
7631 GVariantBuilder builder;
7632 guint n;
7633 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
7634 if (_sensor_threshold_interface_info.parent_struct.properties == NULL)
7635 goto out;
7636 for (n = 0; _sensor_threshold_interface_info.parent_struct.properties[n] != NULL; n++)
7637 {
7638 GDBusPropertyInfo *info = _sensor_threshold_interface_info.parent_struct.properties[n];
7639 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
7640 {
7641 GVariant *value;
7642 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);
7643 if (value != NULL)
7644 {
7645 g_variant_take_ref (value);
7646 g_variant_builder_add (&builder, "{sv}", info->name, value);
7647 g_variant_unref (value);
7648 }
7649 }
7650 }
7651out:
7652 return g_variant_builder_end (&builder);
7653}
7654
7655static gboolean _sensor_threshold_emit_changed (gpointer user_data);
7656
7657static void
7658sensor_threshold_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
7659{
7660 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (_skeleton);
7661 gboolean emit_changed = FALSE;
7662
7663 g_mutex_lock (&skeleton->priv->lock);
7664 if (skeleton->priv->changed_properties_idle_source != NULL)
7665 {
7666 g_source_destroy (skeleton->priv->changed_properties_idle_source);
7667 skeleton->priv->changed_properties_idle_source = NULL;
7668 emit_changed = TRUE;
7669 }
7670 g_mutex_unlock (&skeleton->priv->lock);
7671
7672 if (emit_changed)
7673 _sensor_threshold_emit_changed (skeleton);
7674}
7675
7676static void
7677_sensor_threshold_on_signal_warning (
7678 SensorThreshold *object)
7679{
7680 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7681
7682 GList *connections, *l;
7683 GVariant *signal_variant;
7684 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
7685
7686 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
7687 for (l = connections; l != NULL; l = l->next)
7688 {
7689 GDBusConnection *connection = l->data;
7690 g_dbus_connection_emit_signal (connection,
7691 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorThreshold", "Warning",
7692 signal_variant, NULL);
7693 }
7694 g_variant_unref (signal_variant);
7695 g_list_free_full (connections, g_object_unref);
7696}
7697
7698static void
7699_sensor_threshold_on_signal_critical (
7700 SensorThreshold *object)
7701{
7702 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7703
7704 GList *connections, *l;
7705 GVariant *signal_variant;
7706 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
7707
7708 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
7709 for (l = connections; l != NULL; l = l->next)
7710 {
7711 GDBusConnection *connection = l->data;
7712 g_dbus_connection_emit_signal (connection,
7713 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorThreshold", "Critical",
7714 signal_variant, NULL);
7715 }
7716 g_variant_unref (signal_variant);
7717 g_list_free_full (connections, g_object_unref);
7718}
7719
7720static void
7721_sensor_threshold_on_signal_normal (
7722 SensorThreshold *object)
7723{
7724 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7725
7726 GList *connections, *l;
7727 GVariant *signal_variant;
7728 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
7729
7730 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
7731 for (l = connections; l != NULL; l = l->next)
7732 {
7733 GDBusConnection *connection = l->data;
7734 g_dbus_connection_emit_signal (connection,
7735 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorThreshold", "Normal",
7736 signal_variant, NULL);
7737 }
7738 g_variant_unref (signal_variant);
7739 g_list_free_full (connections, g_object_unref);
7740}
7741
7742static void sensor_threshold_skeleton_iface_init (SensorThresholdIface *iface);
7743#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
7744G_DEFINE_TYPE_WITH_CODE (SensorThresholdSkeleton, sensor_threshold_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
7745 G_ADD_PRIVATE (SensorThresholdSkeleton)
7746 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_skeleton_iface_init));
7747
7748#else
7749G_DEFINE_TYPE_WITH_CODE (SensorThresholdSkeleton, sensor_threshold_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
7750 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_skeleton_iface_init));
7751
7752#endif
7753static void
7754sensor_threshold_skeleton_finalize (GObject *object)
7755{
7756 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7757 guint n;
7758 for (n = 0; n < 5; n++)
7759 g_value_unset (&skeleton->priv->properties[n]);
7760 g_free (skeleton->priv->properties);
7761 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
7762 if (skeleton->priv->changed_properties_idle_source != NULL)
7763 g_source_destroy (skeleton->priv->changed_properties_idle_source);
7764 g_main_context_unref (skeleton->priv->context);
7765 g_mutex_clear (&skeleton->priv->lock);
7766 G_OBJECT_CLASS (sensor_threshold_skeleton_parent_class)->finalize (object);
7767}
7768
7769static void
7770sensor_threshold_skeleton_get_property (GObject *object,
7771 guint prop_id,
7772 GValue *value,
7773 GParamSpec *pspec G_GNUC_UNUSED)
7774{
7775 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7776 g_assert (prop_id != 0 && prop_id - 1 < 5);
7777 g_mutex_lock (&skeleton->priv->lock);
7778 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
7779 g_mutex_unlock (&skeleton->priv->lock);
7780}
7781
7782static gboolean
7783_sensor_threshold_emit_changed (gpointer user_data)
7784{
7785 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data);
7786 GList *l;
7787 GVariantBuilder builder;
7788 GVariantBuilder invalidated_builder;
7789 guint num_changes;
7790
7791 g_mutex_lock (&skeleton->priv->lock);
7792 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
7793 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
7794 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
7795 {
7796 ChangedProperty *cp = l->data;
7797 GVariant *variant;
7798 const GValue *cur_value;
7799
7800 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
7801 if (!_g_value_equal (cur_value, &cp->orig_value))
7802 {
7803 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
7804 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
7805 g_variant_unref (variant);
7806 num_changes++;
7807 }
7808 }
7809 if (num_changes > 0)
7810 {
7811 GList *connections, *ll;
7812 GVariant *signal_variant;
7813 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorThreshold",
7814 &builder, &invalidated_builder));
7815 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
7816 for (ll = connections; ll != NULL; ll = ll->next)
7817 {
7818 GDBusConnection *connection = ll->data;
7819
7820 g_dbus_connection_emit_signal (connection,
7821 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
7822 "org.freedesktop.DBus.Properties",
7823 "PropertiesChanged",
7824 signal_variant,
7825 NULL);
7826 }
7827 g_variant_unref (signal_variant);
7828 g_list_free_full (connections, g_object_unref);
7829 }
7830 else
7831 {
7832 g_variant_builder_clear (&builder);
7833 g_variant_builder_clear (&invalidated_builder);
7834 }
7835 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
7836 skeleton->priv->changed_properties = NULL;
7837 skeleton->priv->changed_properties_idle_source = NULL;
7838 g_mutex_unlock (&skeleton->priv->lock);
7839 return FALSE;
7840}
7841
7842static void
7843_sensor_threshold_schedule_emit_changed (SensorThresholdSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
7844{
7845 ChangedProperty *cp;
7846 GList *l;
7847 cp = NULL;
7848 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
7849 {
7850 ChangedProperty *i_cp = l->data;
7851 if (i_cp->info == info)
7852 {
7853 cp = i_cp;
7854 break;
7855 }
7856 }
7857 if (cp == NULL)
7858 {
7859 cp = g_new0 (ChangedProperty, 1);
7860 cp->prop_id = prop_id;
7861 cp->info = info;
7862 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
7863 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
7864 g_value_copy (orig_value, &cp->orig_value);
7865 }
7866}
7867
7868static void
7869sensor_threshold_skeleton_notify (GObject *object,
7870 GParamSpec *pspec G_GNUC_UNUSED)
7871{
7872 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7873 g_mutex_lock (&skeleton->priv->lock);
7874 if (skeleton->priv->changed_properties != NULL &&
7875 skeleton->priv->changed_properties_idle_source == NULL)
7876 {
7877 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
7878 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
7879 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_threshold_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
7880 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
7881 g_source_unref (skeleton->priv->changed_properties_idle_source);
7882 }
7883 g_mutex_unlock (&skeleton->priv->lock);
7884}
7885
7886static void
7887sensor_threshold_skeleton_set_property (GObject *object,
7888 guint prop_id,
7889 const GValue *value,
7890 GParamSpec *pspec)
7891{
7892 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7893 g_assert (prop_id != 0 && prop_id - 1 < 5);
7894 g_mutex_lock (&skeleton->priv->lock);
7895 g_object_freeze_notify (object);
7896 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
7897 {
7898 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
7899 _sensor_threshold_schedule_emit_changed (skeleton, _sensor_threshold_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
7900 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
7901 g_object_notify_by_pspec (object, pspec);
7902 }
7903 g_mutex_unlock (&skeleton->priv->lock);
7904 g_object_thaw_notify (object);
7905}
7906
7907static void
7908sensor_threshold_skeleton_init (SensorThresholdSkeleton *skeleton)
7909{
7910#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
7911 skeleton->priv = sensor_threshold_skeleton_get_instance_private (skeleton);
7912#else
7913 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_THRESHOLD_SKELETON, SensorThresholdSkeletonPrivate);
7914#endif
7915
7916 g_mutex_init (&skeleton->priv->lock);
7917 skeleton->priv->context = g_main_context_ref_thread_default ();
7918 skeleton->priv->properties = g_new0 (GValue, 5);
7919 g_value_init (&skeleton->priv->properties[0], G_TYPE_VARIANT);
7920 g_value_init (&skeleton->priv->properties[1], G_TYPE_VARIANT);
7921 g_value_init (&skeleton->priv->properties[2], G_TYPE_VARIANT);
7922 g_value_init (&skeleton->priv->properties[3], G_TYPE_VARIANT);
7923 g_value_init (&skeleton->priv->properties[4], G_TYPE_UCHAR);
7924}
7925
7926static GVariant *
7927sensor_threshold_skeleton_get_lower_critical (SensorThreshold *object)
7928{
7929 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7930 GVariant *value;
7931 g_mutex_lock (&skeleton->priv->lock);
7932 value = g_value_get_variant (&(skeleton->priv->properties[0]));
7933 g_mutex_unlock (&skeleton->priv->lock);
7934 return value;
7935}
7936
7937static GVariant *
7938sensor_threshold_skeleton_get_lower_warning (SensorThreshold *object)
7939{
7940 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7941 GVariant *value;
7942 g_mutex_lock (&skeleton->priv->lock);
7943 value = g_value_get_variant (&(skeleton->priv->properties[1]));
7944 g_mutex_unlock (&skeleton->priv->lock);
7945 return value;
7946}
7947
7948static GVariant *
7949sensor_threshold_skeleton_get_upper_warning (SensorThreshold *object)
7950{
7951 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7952 GVariant *value;
7953 g_mutex_lock (&skeleton->priv->lock);
7954 value = g_value_get_variant (&(skeleton->priv->properties[2]));
7955 g_mutex_unlock (&skeleton->priv->lock);
7956 return value;
7957}
7958
7959static GVariant *
7960sensor_threshold_skeleton_get_upper_critical (SensorThreshold *object)
7961{
7962 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7963 GVariant *value;
7964 g_mutex_lock (&skeleton->priv->lock);
7965 value = g_value_get_variant (&(skeleton->priv->properties[3]));
7966 g_mutex_unlock (&skeleton->priv->lock);
7967 return value;
7968}
7969
7970static guchar
7971sensor_threshold_skeleton_get_state (SensorThreshold *object)
7972{
7973 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7974 guchar value;
7975 g_mutex_lock (&skeleton->priv->lock);
7976 value = g_value_get_uchar (&(skeleton->priv->properties[4]));
7977 g_mutex_unlock (&skeleton->priv->lock);
7978 return value;
7979}
7980
7981static void
7982sensor_threshold_skeleton_class_init (SensorThresholdSkeletonClass *klass)
7983{
7984 GObjectClass *gobject_class;
7985 GDBusInterfaceSkeletonClass *skeleton_class;
7986
7987 gobject_class = G_OBJECT_CLASS (klass);
7988 gobject_class->finalize = sensor_threshold_skeleton_finalize;
7989 gobject_class->get_property = sensor_threshold_skeleton_get_property;
7990 gobject_class->set_property = sensor_threshold_skeleton_set_property;
7991 gobject_class->notify = sensor_threshold_skeleton_notify;
7992
7993
7994 sensor_threshold_override_properties (gobject_class, 1);
7995
7996 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
7997 skeleton_class->get_info = sensor_threshold_skeleton_dbus_interface_get_info;
7998 skeleton_class->get_properties = sensor_threshold_skeleton_dbus_interface_get_properties;
7999 skeleton_class->flush = sensor_threshold_skeleton_dbus_interface_flush;
8000 skeleton_class->get_vtable = sensor_threshold_skeleton_dbus_interface_get_vtable;
8001
8002#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
8003 g_type_class_add_private (klass, sizeof (SensorThresholdSkeletonPrivate));
8004#endif
8005}
8006
8007static void
8008sensor_threshold_skeleton_iface_init (SensorThresholdIface *iface)
8009{
8010 iface->warning = _sensor_threshold_on_signal_warning;
8011 iface->critical = _sensor_threshold_on_signal_critical;
8012 iface->normal = _sensor_threshold_on_signal_normal;
8013 iface->get_lower_critical = sensor_threshold_skeleton_get_lower_critical;
8014 iface->get_lower_warning = sensor_threshold_skeleton_get_lower_warning;
8015 iface->get_upper_warning = sensor_threshold_skeleton_get_upper_warning;
8016 iface->get_upper_critical = sensor_threshold_skeleton_get_upper_critical;
8017 iface->get_state = sensor_threshold_skeleton_get_state;
8018}
8019
8020/**
8021 * sensor_threshold_skeleton_new:
8022 *
8023 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link>.
8024 *
8025 * Returns: (transfer full) (type SensorThresholdSkeleton): The skeleton object.
8026 */
8027SensorThreshold *
8028sensor_threshold_skeleton_new (void)
8029{
8030 return SENSOR_THRESHOLD (g_object_new (TYPE_SENSOR_THRESHOLD_SKELETON, NULL));
8031}
8032
8033/* ------------------------------------------------------------------------
8034 * Code for interface org.openbmc.SensorI2c
8035 * ------------------------------------------------------------------------
8036 */
8037
8038/**
8039 * SECTION:SensorI2c
8040 * @title: SensorI2c
8041 * @short_description: Generated C code for the org.openbmc.SensorI2c D-Bus interface
8042 *
8043 * 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.
8044 */
8045
8046/* ---- Introspection data for org.openbmc.SensorI2c ---- */
8047
8048static const _ExtendedGDBusPropertyInfo _sensor_i2c_property_info_dev_path =
8049{
8050 {
8051 -1,
8052 (gchar *) "dev_path",
8053 (gchar *) "s",
8054 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
8055 NULL
8056 },
8057 "dev-path",
8058 FALSE
8059};
8060
8061static const _ExtendedGDBusPropertyInfo _sensor_i2c_property_info_address =
8062{
8063 {
8064 -1,
8065 (gchar *) "address",
8066 (gchar *) "s",
8067 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
8068 NULL
8069 },
8070 "address",
8071 FALSE
8072};
8073
8074static const _ExtendedGDBusPropertyInfo * const _sensor_i2c_property_info_pointers[] =
8075{
8076 &_sensor_i2c_property_info_dev_path,
8077 &_sensor_i2c_property_info_address,
8078 NULL
8079};
8080
8081static const _ExtendedGDBusInterfaceInfo _sensor_i2c_interface_info =
8082{
8083 {
8084 -1,
8085 (gchar *) "org.openbmc.SensorI2c",
8086 NULL,
8087 NULL,
8088 (GDBusPropertyInfo **) &_sensor_i2c_property_info_pointers,
8089 NULL
8090 },
8091 "sensor-i2c",
8092};
8093
8094
8095/**
8096 * sensor_i2c_interface_info:
8097 *
8098 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link> D-Bus interface.
8099 *
8100 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
8101 */
8102GDBusInterfaceInfo *
8103sensor_i2c_interface_info (void)
8104{
8105 return (GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct;
8106}
8107
8108/**
8109 * sensor_i2c_override_properties:
8110 * @klass: The class structure for a #GObject<!-- -->-derived class.
8111 * @property_id_begin: The property id to assign to the first overridden property.
8112 *
8113 * Overrides all #GObject properties in the #SensorI2c interface for a concrete class.
8114 * The properties are overridden in the order they are defined.
8115 *
8116 * Returns: The last property id.
8117 */
8118guint
8119sensor_i2c_override_properties (GObjectClass *klass, guint property_id_begin)
8120{
8121 g_object_class_override_property (klass, property_id_begin++, "dev-path");
8122 g_object_class_override_property (klass, property_id_begin++, "address");
8123 return property_id_begin - 1;
8124}
8125
8126
8127
8128/**
8129 * SensorI2c:
8130 *
8131 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>.
8132 */
8133
8134/**
8135 * SensorI2cIface:
8136 * @parent_iface: The parent interface.
8137 * @get_address: Getter for the #SensorI2c:address property.
8138 * @get_dev_path: Getter for the #SensorI2c:dev-path property.
8139 *
8140 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>.
8141 */
8142
8143typedef SensorI2cIface SensorI2cInterface;
8144G_DEFINE_INTERFACE (SensorI2c, sensor_i2c, G_TYPE_OBJECT);
8145
8146static void
8147sensor_i2c_default_init (SensorI2cIface *iface)
8148{
8149 /* GObject properties for D-Bus properties: */
8150 /**
8151 * SensorI2c:dev-path:
8152 *
8153 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link>.
8154 *
8155 * 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.
8156 */
8157 g_object_interface_install_property (iface,
8158 g_param_spec_string ("dev-path", "dev_path", "dev_path", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
8159 /**
8160 * SensorI2c:address:
8161 *
8162 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link>.
8163 *
8164 * 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.
8165 */
8166 g_object_interface_install_property (iface,
8167 g_param_spec_string ("address", "address", "address", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
8168}
8169
8170/**
8171 * sensor_i2c_get_dev_path: (skip)
8172 * @object: A #SensorI2c.
8173 *
8174 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link> D-Bus property.
8175 *
8176 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
8177 *
8178 * <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>
8179 *
8180 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
8181 */
8182const gchar *
8183sensor_i2c_get_dev_path (SensorI2c *object)
8184{
8185 return SENSOR_I2C_GET_IFACE (object)->get_dev_path (object);
8186}
8187
8188/**
8189 * sensor_i2c_dup_dev_path: (skip)
8190 * @object: A #SensorI2c.
8191 *
8192 * Gets a copy 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 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
8197 */
8198gchar *
8199sensor_i2c_dup_dev_path (SensorI2c *object)
8200{
8201 gchar *value;
8202 g_object_get (G_OBJECT (object), "dev-path", &value, NULL);
8203 return value;
8204}
8205
8206/**
8207 * sensor_i2c_set_dev_path: (skip)
8208 * @object: A #SensorI2c.
8209 * @value: The value to set.
8210 *
8211 * Sets the <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link> D-Bus property to @value.
8212 *
8213 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
8214 */
8215void
8216sensor_i2c_set_dev_path (SensorI2c *object, const gchar *value)
8217{
8218 g_object_set (G_OBJECT (object), "dev-path", value, NULL);
8219}
8220
8221/**
8222 * sensor_i2c_get_address: (skip)
8223 * @object: A #SensorI2c.
8224 *
8225 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link> D-Bus property.
8226 *
8227 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
8228 *
8229 * <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>
8230 *
8231 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
8232 */
8233const gchar *
8234sensor_i2c_get_address (SensorI2c *object)
8235{
8236 return SENSOR_I2C_GET_IFACE (object)->get_address (object);
8237}
8238
8239/**
8240 * sensor_i2c_dup_address: (skip)
8241 * @object: A #SensorI2c.
8242 *
8243 * Gets a copy 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 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
8248 */
8249gchar *
8250sensor_i2c_dup_address (SensorI2c *object)
8251{
8252 gchar *value;
8253 g_object_get (G_OBJECT (object), "address", &value, NULL);
8254 return value;
8255}
8256
8257/**
8258 * sensor_i2c_set_address: (skip)
8259 * @object: A #SensorI2c.
8260 * @value: The value to set.
8261 *
8262 * Sets the <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link> D-Bus property to @value.
8263 *
8264 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
8265 */
8266void
8267sensor_i2c_set_address (SensorI2c *object, const gchar *value)
8268{
8269 g_object_set (G_OBJECT (object), "address", value, NULL);
8270}
8271
8272/* ------------------------------------------------------------------------ */
8273
8274/**
8275 * SensorI2cProxy:
8276 *
8277 * The #SensorI2cProxy structure contains only private data and should only be accessed using the provided API.
8278 */
8279
8280/**
8281 * SensorI2cProxyClass:
8282 * @parent_class: The parent class.
8283 *
8284 * Class structure for #SensorI2cProxy.
8285 */
8286
8287struct _SensorI2cProxyPrivate
8288{
8289 GData *qdata;
8290};
8291
8292static void sensor_i2c_proxy_iface_init (SensorI2cIface *iface);
8293
8294#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
8295G_DEFINE_TYPE_WITH_CODE (SensorI2cProxy, sensor_i2c_proxy, G_TYPE_DBUS_PROXY,
8296 G_ADD_PRIVATE (SensorI2cProxy)
8297 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_proxy_iface_init));
8298
8299#else
8300G_DEFINE_TYPE_WITH_CODE (SensorI2cProxy, sensor_i2c_proxy, G_TYPE_DBUS_PROXY,
8301 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_proxy_iface_init));
8302
8303#endif
8304static void
8305sensor_i2c_proxy_finalize (GObject *object)
8306{
8307 SensorI2cProxy *proxy = SENSOR_I2C_PROXY (object);
8308 g_datalist_clear (&proxy->priv->qdata);
8309 G_OBJECT_CLASS (sensor_i2c_proxy_parent_class)->finalize (object);
8310}
8311
8312static void
8313sensor_i2c_proxy_get_property (GObject *object,
8314 guint prop_id,
8315 GValue *value,
8316 GParamSpec *pspec G_GNUC_UNUSED)
8317{
8318 const _ExtendedGDBusPropertyInfo *info;
8319 GVariant *variant;
8320 g_assert (prop_id != 0 && prop_id - 1 < 2);
8321 info = _sensor_i2c_property_info_pointers[prop_id - 1];
8322 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
8323 if (info->use_gvariant)
8324 {
8325 g_value_set_variant (value, variant);
8326 }
8327 else
8328 {
8329 if (variant != NULL)
8330 g_dbus_gvariant_to_gvalue (variant, value);
8331 }
8332 if (variant != NULL)
8333 g_variant_unref (variant);
8334}
8335
8336static void
8337sensor_i2c_proxy_set_property_cb (GDBusProxy *proxy,
8338 GAsyncResult *res,
8339 gpointer user_data)
8340{
8341 const _ExtendedGDBusPropertyInfo *info = user_data;
8342 GError *error;
8343 GVariant *_ret;
8344 error = NULL;
8345 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
8346 if (!_ret)
8347 {
8348 g_warning ("Error setting property '%s' on interface org.openbmc.SensorI2c: %s (%s, %d)",
8349 info->parent_struct.name,
8350 error->message, g_quark_to_string (error->domain), error->code);
8351 g_error_free (error);
8352 }
8353 else
8354 {
8355 g_variant_unref (_ret);
8356 }
8357}
8358
8359static void
8360sensor_i2c_proxy_set_property (GObject *object,
8361 guint prop_id,
8362 const GValue *value,
8363 GParamSpec *pspec G_GNUC_UNUSED)
8364{
8365 const _ExtendedGDBusPropertyInfo *info;
8366 GVariant *variant;
8367 g_assert (prop_id != 0 && prop_id - 1 < 2);
8368 info = _sensor_i2c_property_info_pointers[prop_id - 1];
8369 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
8370 g_dbus_proxy_call (G_DBUS_PROXY (object),
8371 "org.freedesktop.DBus.Properties.Set",
8372 g_variant_new ("(ssv)", "org.openbmc.SensorI2c", info->parent_struct.name, variant),
8373 G_DBUS_CALL_FLAGS_NONE,
8374 -1,
8375 NULL, (GAsyncReadyCallback) sensor_i2c_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
8376 g_variant_unref (variant);
8377}
8378
8379static void
8380sensor_i2c_proxy_g_signal (GDBusProxy *proxy,
8381 const gchar *sender_name G_GNUC_UNUSED,
8382 const gchar *signal_name,
8383 GVariant *parameters)
8384{
8385 _ExtendedGDBusSignalInfo *info;
8386 GVariantIter iter;
8387 GVariant *child;
8388 GValue *paramv;
8389 guint num_params;
8390 guint n;
8391 guint signal_id;
8392 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, signal_name);
8393 if (info == NULL)
8394 return;
8395 num_params = g_variant_n_children (parameters);
8396 paramv = g_new0 (GValue, num_params + 1);
8397 g_value_init (&paramv[0], TYPE_SENSOR_I2C);
8398 g_value_set_object (&paramv[0], proxy);
8399 g_variant_iter_init (&iter, parameters);
8400 n = 1;
8401 while ((child = g_variant_iter_next_value (&iter)) != NULL)
8402 {
8403 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
8404 if (arg_info->use_gvariant)
8405 {
8406 g_value_init (&paramv[n], G_TYPE_VARIANT);
8407 g_value_set_variant (&paramv[n], child);
8408 n++;
8409 }
8410 else
8411 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
8412 g_variant_unref (child);
8413 }
8414 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_I2C);
8415 g_signal_emitv (paramv, signal_id, 0, NULL);
8416 for (n = 0; n < num_params + 1; n++)
8417 g_value_unset (&paramv[n]);
8418 g_free (paramv);
8419}
8420
8421static void
8422sensor_i2c_proxy_g_properties_changed (GDBusProxy *_proxy,
8423 GVariant *changed_properties,
8424 const gchar *const *invalidated_properties)
8425{
8426 SensorI2cProxy *proxy = SENSOR_I2C_PROXY (_proxy);
8427 guint n;
8428 const gchar *key;
8429 GVariantIter *iter;
8430 _ExtendedGDBusPropertyInfo *info;
8431 g_variant_get (changed_properties, "a{sv}", &iter);
8432 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
8433 {
8434 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, key);
8435 g_datalist_remove_data (&proxy->priv->qdata, key);
8436 if (info != NULL)
8437 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
8438 }
8439 g_variant_iter_free (iter);
8440 for (n = 0; invalidated_properties[n] != NULL; n++)
8441 {
8442 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, invalidated_properties[n]);
8443 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
8444 if (info != NULL)
8445 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
8446 }
8447}
8448
8449static const gchar *
8450sensor_i2c_proxy_get_dev_path (SensorI2c *object)
8451{
8452 SensorI2cProxy *proxy = SENSOR_I2C_PROXY (object);
8453 GVariant *variant;
8454 const gchar *value = NULL;
8455 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "dev_path");
8456 if (variant != NULL)
8457 {
8458 value = g_variant_get_string (variant, NULL);
8459 g_variant_unref (variant);
8460 }
8461 return value;
8462}
8463
8464static const gchar *
8465sensor_i2c_proxy_get_address (SensorI2c *object)
8466{
8467 SensorI2cProxy *proxy = SENSOR_I2C_PROXY (object);
8468 GVariant *variant;
8469 const gchar *value = NULL;
8470 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "address");
8471 if (variant != NULL)
8472 {
8473 value = g_variant_get_string (variant, NULL);
8474 g_variant_unref (variant);
8475 }
8476 return value;
8477}
8478
8479static void
8480sensor_i2c_proxy_init (SensorI2cProxy *proxy)
8481{
8482#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
8483 proxy->priv = sensor_i2c_proxy_get_instance_private (proxy);
8484#else
8485 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_I2C_PROXY, SensorI2cProxyPrivate);
8486#endif
8487
8488 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_i2c_interface_info ());
8489}
8490
8491static void
8492sensor_i2c_proxy_class_init (SensorI2cProxyClass *klass)
8493{
8494 GObjectClass *gobject_class;
8495 GDBusProxyClass *proxy_class;
8496
8497 gobject_class = G_OBJECT_CLASS (klass);
8498 gobject_class->finalize = sensor_i2c_proxy_finalize;
8499 gobject_class->get_property = sensor_i2c_proxy_get_property;
8500 gobject_class->set_property = sensor_i2c_proxy_set_property;
8501
8502 proxy_class = G_DBUS_PROXY_CLASS (klass);
8503 proxy_class->g_signal = sensor_i2c_proxy_g_signal;
8504 proxy_class->g_properties_changed = sensor_i2c_proxy_g_properties_changed;
8505
8506 sensor_i2c_override_properties (gobject_class, 1);
8507
8508#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
8509 g_type_class_add_private (klass, sizeof (SensorI2cProxyPrivate));
8510#endif
8511}
8512
8513static void
8514sensor_i2c_proxy_iface_init (SensorI2cIface *iface)
8515{
8516 iface->get_dev_path = sensor_i2c_proxy_get_dev_path;
8517 iface->get_address = sensor_i2c_proxy_get_address;
8518}
8519
8520/**
8521 * sensor_i2c_proxy_new:
8522 * @connection: A #GDBusConnection.
8523 * @flags: Flags from the #GDBusProxyFlags enumeration.
8524 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
8525 * @object_path: An object path.
8526 * @cancellable: (allow-none): A #GCancellable or %NULL.
8527 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
8528 * @user_data: User data to pass to @callback.
8529 *
8530 * 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.
8531 *
8532 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
8533 * You can then call sensor_i2c_proxy_new_finish() to get the result of the operation.
8534 *
8535 * See sensor_i2c_proxy_new_sync() for the synchronous, blocking version of this constructor.
8536 */
8537void
8538sensor_i2c_proxy_new (
8539 GDBusConnection *connection,
8540 GDBusProxyFlags flags,
8541 const gchar *name,
8542 const gchar *object_path,
8543 GCancellable *cancellable,
8544 GAsyncReadyCallback callback,
8545 gpointer user_data)
8546{
8547 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);
8548}
8549
8550/**
8551 * sensor_i2c_proxy_new_finish:
8552 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_i2c_proxy_new().
8553 * @error: Return location for error or %NULL
8554 *
8555 * Finishes an operation started with sensor_i2c_proxy_new().
8556 *
8557 * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set.
8558 */
8559SensorI2c *
8560sensor_i2c_proxy_new_finish (
8561 GAsyncResult *res,
8562 GError **error)
8563{
8564 GObject *ret;
8565 GObject *source_object;
8566 source_object = g_async_result_get_source_object (res);
8567 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
8568 g_object_unref (source_object);
8569 if (ret != NULL)
8570 return SENSOR_I2C (ret);
8571 else
8572 return NULL;
8573}
8574
8575/**
8576 * sensor_i2c_proxy_new_sync:
8577 * @connection: A #GDBusConnection.
8578 * @flags: Flags from the #GDBusProxyFlags enumeration.
8579 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
8580 * @object_path: An object path.
8581 * @cancellable: (allow-none): A #GCancellable or %NULL.
8582 * @error: Return location for error or %NULL
8583 *
8584 * 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.
8585 *
8586 * The calling thread is blocked until a reply is received.
8587 *
8588 * See sensor_i2c_proxy_new() for the asynchronous version of this constructor.
8589 *
8590 * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set.
8591 */
8592SensorI2c *
8593sensor_i2c_proxy_new_sync (
8594 GDBusConnection *connection,
8595 GDBusProxyFlags flags,
8596 const gchar *name,
8597 const gchar *object_path,
8598 GCancellable *cancellable,
8599 GError **error)
8600{
8601 GInitable *ret;
8602 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);
8603 if (ret != NULL)
8604 return SENSOR_I2C (ret);
8605 else
8606 return NULL;
8607}
8608
8609
8610/**
8611 * sensor_i2c_proxy_new_for_bus:
8612 * @bus_type: A #GBusType.
8613 * @flags: Flags from the #GDBusProxyFlags enumeration.
8614 * @name: A bus name (well-known or unique).
8615 * @object_path: An object path.
8616 * @cancellable: (allow-none): A #GCancellable or %NULL.
8617 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
8618 * @user_data: User data to pass to @callback.
8619 *
8620 * Like sensor_i2c_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
8621 *
8622 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
8623 * You can then call sensor_i2c_proxy_new_for_bus_finish() to get the result of the operation.
8624 *
8625 * See sensor_i2c_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
8626 */
8627void
8628sensor_i2c_proxy_new_for_bus (
8629 GBusType bus_type,
8630 GDBusProxyFlags flags,
8631 const gchar *name,
8632 const gchar *object_path,
8633 GCancellable *cancellable,
8634 GAsyncReadyCallback callback,
8635 gpointer user_data)
8636{
8637 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);
8638}
8639
8640/**
8641 * sensor_i2c_proxy_new_for_bus_finish:
8642 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_i2c_proxy_new_for_bus().
8643 * @error: Return location for error or %NULL
8644 *
8645 * Finishes an operation started with sensor_i2c_proxy_new_for_bus().
8646 *
8647 * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set.
8648 */
8649SensorI2c *
8650sensor_i2c_proxy_new_for_bus_finish (
8651 GAsyncResult *res,
8652 GError **error)
8653{
8654 GObject *ret;
8655 GObject *source_object;
8656 source_object = g_async_result_get_source_object (res);
8657 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
8658 g_object_unref (source_object);
8659 if (ret != NULL)
8660 return SENSOR_I2C (ret);
8661 else
8662 return NULL;
8663}
8664
8665/**
8666 * sensor_i2c_proxy_new_for_bus_sync:
8667 * @bus_type: A #GBusType.
8668 * @flags: Flags from the #GDBusProxyFlags enumeration.
8669 * @name: A bus name (well-known or unique).
8670 * @object_path: An object path.
8671 * @cancellable: (allow-none): A #GCancellable or %NULL.
8672 * @error: Return location for error or %NULL
8673 *
8674 * Like sensor_i2c_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
8675 *
8676 * The calling thread is blocked until a reply is received.
8677 *
8678 * See sensor_i2c_proxy_new_for_bus() for the asynchronous version of this constructor.
8679 *
8680 * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set.
8681 */
8682SensorI2c *
8683sensor_i2c_proxy_new_for_bus_sync (
8684 GBusType bus_type,
8685 GDBusProxyFlags flags,
8686 const gchar *name,
8687 const gchar *object_path,
8688 GCancellable *cancellable,
8689 GError **error)
8690{
8691 GInitable *ret;
8692 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);
8693 if (ret != NULL)
8694 return SENSOR_I2C (ret);
8695 else
8696 return NULL;
8697}
8698
8699
8700/* ------------------------------------------------------------------------ */
8701
8702/**
8703 * SensorI2cSkeleton:
8704 *
8705 * The #SensorI2cSkeleton structure contains only private data and should only be accessed using the provided API.
8706 */
8707
8708/**
8709 * SensorI2cSkeletonClass:
8710 * @parent_class: The parent class.
8711 *
8712 * Class structure for #SensorI2cSkeleton.
8713 */
8714
8715struct _SensorI2cSkeletonPrivate
8716{
8717 GValue *properties;
8718 GList *changed_properties;
8719 GSource *changed_properties_idle_source;
8720 GMainContext *context;
8721 GMutex lock;
8722};
8723
8724static void
8725_sensor_i2c_skeleton_handle_method_call (
8726 GDBusConnection *connection G_GNUC_UNUSED,
8727 const gchar *sender G_GNUC_UNUSED,
8728 const gchar *object_path G_GNUC_UNUSED,
8729 const gchar *interface_name,
8730 const gchar *method_name,
8731 GVariant *parameters,
8732 GDBusMethodInvocation *invocation,
8733 gpointer user_data)
8734{
8735 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data);
8736 _ExtendedGDBusMethodInfo *info;
8737 GVariantIter iter;
8738 GVariant *child;
8739 GValue *paramv;
8740 guint num_params;
8741 guint num_extra;
8742 guint n;
8743 guint signal_id;
8744 GValue return_value = G_VALUE_INIT;
8745 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
8746 g_assert (info != NULL);
8747 num_params = g_variant_n_children (parameters);
8748 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
8749 n = 0;
8750 g_value_init (&paramv[n], TYPE_SENSOR_I2C);
8751 g_value_set_object (&paramv[n++], skeleton);
8752 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
8753 g_value_set_object (&paramv[n++], invocation);
8754 if (info->pass_fdlist)
8755 {
8756#ifdef G_OS_UNIX
8757 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
8758 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
8759#else
8760 g_assert_not_reached ();
8761#endif
8762 }
8763 g_variant_iter_init (&iter, parameters);
8764 while ((child = g_variant_iter_next_value (&iter)) != NULL)
8765 {
8766 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
8767 if (arg_info->use_gvariant)
8768 {
8769 g_value_init (&paramv[n], G_TYPE_VARIANT);
8770 g_value_set_variant (&paramv[n], child);
8771 n++;
8772 }
8773 else
8774 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
8775 g_variant_unref (child);
8776 }
8777 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_I2C);
8778 g_value_init (&return_value, G_TYPE_BOOLEAN);
8779 g_signal_emitv (paramv, signal_id, 0, &return_value);
8780 if (!g_value_get_boolean (&return_value))
8781 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);
8782 g_value_unset (&return_value);
8783 for (n = 0; n < num_params + num_extra; n++)
8784 g_value_unset (&paramv[n]);
8785 g_free (paramv);
8786}
8787
8788static GVariant *
8789_sensor_i2c_skeleton_handle_get_property (
8790 GDBusConnection *connection G_GNUC_UNUSED,
8791 const gchar *sender G_GNUC_UNUSED,
8792 const gchar *object_path G_GNUC_UNUSED,
8793 const gchar *interface_name G_GNUC_UNUSED,
8794 const gchar *property_name,
8795 GError **error,
8796 gpointer user_data)
8797{
8798 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data);
8799 GValue value = G_VALUE_INIT;
8800 GParamSpec *pspec;
8801 _ExtendedGDBusPropertyInfo *info;
8802 GVariant *ret;
8803 ret = NULL;
8804 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, property_name);
8805 g_assert (info != NULL);
8806 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
8807 if (pspec == NULL)
8808 {
8809 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
8810 }
8811 else
8812 {
8813 g_value_init (&value, pspec->value_type);
8814 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
8815 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
8816 g_value_unset (&value);
8817 }
8818 return ret;
8819}
8820
8821static gboolean
8822_sensor_i2c_skeleton_handle_set_property (
8823 GDBusConnection *connection G_GNUC_UNUSED,
8824 const gchar *sender G_GNUC_UNUSED,
8825 const gchar *object_path G_GNUC_UNUSED,
8826 const gchar *interface_name G_GNUC_UNUSED,
8827 const gchar *property_name,
8828 GVariant *variant,
8829 GError **error,
8830 gpointer user_data)
8831{
8832 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data);
8833 GValue value = G_VALUE_INIT;
8834 GParamSpec *pspec;
8835 _ExtendedGDBusPropertyInfo *info;
8836 gboolean ret;
8837 ret = FALSE;
8838 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, property_name);
8839 g_assert (info != NULL);
8840 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
8841 if (pspec == NULL)
8842 {
8843 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
8844 }
8845 else
8846 {
8847 if (info->use_gvariant)
8848 g_value_set_variant (&value, variant);
8849 else
8850 g_dbus_gvariant_to_gvalue (variant, &value);
8851 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
8852 g_value_unset (&value);
8853 ret = TRUE;
8854 }
8855 return ret;
8856}
8857
8858static const GDBusInterfaceVTable _sensor_i2c_skeleton_vtable =
8859{
8860 _sensor_i2c_skeleton_handle_method_call,
8861 _sensor_i2c_skeleton_handle_get_property,
8862 _sensor_i2c_skeleton_handle_set_property,
8863 {NULL}
8864};
8865
8866static GDBusInterfaceInfo *
8867sensor_i2c_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
8868{
8869 return sensor_i2c_interface_info ();
8870}
8871
8872static GDBusInterfaceVTable *
8873sensor_i2c_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
8874{
8875 return (GDBusInterfaceVTable *) &_sensor_i2c_skeleton_vtable;
8876}
8877
8878static GVariant *
8879sensor_i2c_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
8880{
8881 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (_skeleton);
8882
8883 GVariantBuilder builder;
8884 guint n;
8885 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
8886 if (_sensor_i2c_interface_info.parent_struct.properties == NULL)
8887 goto out;
8888 for (n = 0; _sensor_i2c_interface_info.parent_struct.properties[n] != NULL; n++)
8889 {
8890 GDBusPropertyInfo *info = _sensor_i2c_interface_info.parent_struct.properties[n];
8891 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
8892 {
8893 GVariant *value;
8894 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);
8895 if (value != NULL)
8896 {
8897 g_variant_take_ref (value);
8898 g_variant_builder_add (&builder, "{sv}", info->name, value);
8899 g_variant_unref (value);
8900 }
8901 }
8902 }
8903out:
8904 return g_variant_builder_end (&builder);
8905}
8906
8907static gboolean _sensor_i2c_emit_changed (gpointer user_data);
8908
8909static void
8910sensor_i2c_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
8911{
8912 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (_skeleton);
8913 gboolean emit_changed = FALSE;
8914
8915 g_mutex_lock (&skeleton->priv->lock);
8916 if (skeleton->priv->changed_properties_idle_source != NULL)
8917 {
8918 g_source_destroy (skeleton->priv->changed_properties_idle_source);
8919 skeleton->priv->changed_properties_idle_source = NULL;
8920 emit_changed = TRUE;
8921 }
8922 g_mutex_unlock (&skeleton->priv->lock);
8923
8924 if (emit_changed)
8925 _sensor_i2c_emit_changed (skeleton);
8926}
8927
8928static void sensor_i2c_skeleton_iface_init (SensorI2cIface *iface);
8929#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
8930G_DEFINE_TYPE_WITH_CODE (SensorI2cSkeleton, sensor_i2c_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
8931 G_ADD_PRIVATE (SensorI2cSkeleton)
8932 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_skeleton_iface_init));
8933
8934#else
8935G_DEFINE_TYPE_WITH_CODE (SensorI2cSkeleton, sensor_i2c_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
8936 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_skeleton_iface_init));
8937
8938#endif
8939static void
8940sensor_i2c_skeleton_finalize (GObject *object)
8941{
8942 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
8943 guint n;
8944 for (n = 0; n < 2; n++)
8945 g_value_unset (&skeleton->priv->properties[n]);
8946 g_free (skeleton->priv->properties);
8947 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
8948 if (skeleton->priv->changed_properties_idle_source != NULL)
8949 g_source_destroy (skeleton->priv->changed_properties_idle_source);
8950 g_main_context_unref (skeleton->priv->context);
8951 g_mutex_clear (&skeleton->priv->lock);
8952 G_OBJECT_CLASS (sensor_i2c_skeleton_parent_class)->finalize (object);
8953}
8954
8955static void
8956sensor_i2c_skeleton_get_property (GObject *object,
8957 guint prop_id,
8958 GValue *value,
8959 GParamSpec *pspec G_GNUC_UNUSED)
8960{
8961 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
8962 g_assert (prop_id != 0 && prop_id - 1 < 2);
8963 g_mutex_lock (&skeleton->priv->lock);
8964 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
8965 g_mutex_unlock (&skeleton->priv->lock);
8966}
8967
8968static gboolean
8969_sensor_i2c_emit_changed (gpointer user_data)
8970{
8971 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data);
8972 GList *l;
8973 GVariantBuilder builder;
8974 GVariantBuilder invalidated_builder;
8975 guint num_changes;
8976
8977 g_mutex_lock (&skeleton->priv->lock);
8978 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
8979 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
8980 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
8981 {
8982 ChangedProperty *cp = l->data;
8983 GVariant *variant;
8984 const GValue *cur_value;
8985
8986 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
8987 if (!_g_value_equal (cur_value, &cp->orig_value))
8988 {
8989 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
8990 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
8991 g_variant_unref (variant);
8992 num_changes++;
8993 }
8994 }
8995 if (num_changes > 0)
8996 {
8997 GList *connections, *ll;
8998 GVariant *signal_variant;
8999 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorI2c",
9000 &builder, &invalidated_builder));
9001 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
9002 for (ll = connections; ll != NULL; ll = ll->next)
9003 {
9004 GDBusConnection *connection = ll->data;
9005
9006 g_dbus_connection_emit_signal (connection,
9007 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
9008 "org.freedesktop.DBus.Properties",
9009 "PropertiesChanged",
9010 signal_variant,
9011 NULL);
9012 }
9013 g_variant_unref (signal_variant);
9014 g_list_free_full (connections, g_object_unref);
9015 }
9016 else
9017 {
9018 g_variant_builder_clear (&builder);
9019 g_variant_builder_clear (&invalidated_builder);
9020 }
9021 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
9022 skeleton->priv->changed_properties = NULL;
9023 skeleton->priv->changed_properties_idle_source = NULL;
9024 g_mutex_unlock (&skeleton->priv->lock);
9025 return FALSE;
9026}
9027
9028static void
9029_sensor_i2c_schedule_emit_changed (SensorI2cSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
9030{
9031 ChangedProperty *cp;
9032 GList *l;
9033 cp = NULL;
9034 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
9035 {
9036 ChangedProperty *i_cp = l->data;
9037 if (i_cp->info == info)
9038 {
9039 cp = i_cp;
9040 break;
9041 }
9042 }
9043 if (cp == NULL)
9044 {
9045 cp = g_new0 (ChangedProperty, 1);
9046 cp->prop_id = prop_id;
9047 cp->info = info;
9048 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
9049 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
9050 g_value_copy (orig_value, &cp->orig_value);
9051 }
9052}
9053
9054static void
9055sensor_i2c_skeleton_notify (GObject *object,
9056 GParamSpec *pspec G_GNUC_UNUSED)
9057{
9058 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
9059 g_mutex_lock (&skeleton->priv->lock);
9060 if (skeleton->priv->changed_properties != NULL &&
9061 skeleton->priv->changed_properties_idle_source == NULL)
9062 {
9063 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
9064 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
9065 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_i2c_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
9066 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
9067 g_source_unref (skeleton->priv->changed_properties_idle_source);
9068 }
9069 g_mutex_unlock (&skeleton->priv->lock);
9070}
9071
9072static void
9073sensor_i2c_skeleton_set_property (GObject *object,
9074 guint prop_id,
9075 const GValue *value,
9076 GParamSpec *pspec)
9077{
9078 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
9079 g_assert (prop_id != 0 && prop_id - 1 < 2);
9080 g_mutex_lock (&skeleton->priv->lock);
9081 g_object_freeze_notify (object);
9082 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
9083 {
9084 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
9085 _sensor_i2c_schedule_emit_changed (skeleton, _sensor_i2c_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
9086 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
9087 g_object_notify_by_pspec (object, pspec);
9088 }
9089 g_mutex_unlock (&skeleton->priv->lock);
9090 g_object_thaw_notify (object);
9091}
9092
9093static void
9094sensor_i2c_skeleton_init (SensorI2cSkeleton *skeleton)
9095{
9096#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
9097 skeleton->priv = sensor_i2c_skeleton_get_instance_private (skeleton);
9098#else
9099 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_I2C_SKELETON, SensorI2cSkeletonPrivate);
9100#endif
9101
9102 g_mutex_init (&skeleton->priv->lock);
9103 skeleton->priv->context = g_main_context_ref_thread_default ();
9104 skeleton->priv->properties = g_new0 (GValue, 2);
9105 g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING);
9106 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
9107}
9108
9109static const gchar *
9110sensor_i2c_skeleton_get_dev_path (SensorI2c *object)
9111{
9112 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
9113 const gchar *value;
9114 g_mutex_lock (&skeleton->priv->lock);
9115 value = g_value_get_string (&(skeleton->priv->properties[0]));
9116 g_mutex_unlock (&skeleton->priv->lock);
9117 return value;
9118}
9119
9120static const gchar *
9121sensor_i2c_skeleton_get_address (SensorI2c *object)
9122{
9123 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
9124 const gchar *value;
9125 g_mutex_lock (&skeleton->priv->lock);
9126 value = g_value_get_string (&(skeleton->priv->properties[1]));
9127 g_mutex_unlock (&skeleton->priv->lock);
9128 return value;
9129}
9130
9131static void
9132sensor_i2c_skeleton_class_init (SensorI2cSkeletonClass *klass)
9133{
9134 GObjectClass *gobject_class;
9135 GDBusInterfaceSkeletonClass *skeleton_class;
9136
9137 gobject_class = G_OBJECT_CLASS (klass);
9138 gobject_class->finalize = sensor_i2c_skeleton_finalize;
9139 gobject_class->get_property = sensor_i2c_skeleton_get_property;
9140 gobject_class->set_property = sensor_i2c_skeleton_set_property;
9141 gobject_class->notify = sensor_i2c_skeleton_notify;
9142
9143
9144 sensor_i2c_override_properties (gobject_class, 1);
9145
9146 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
9147 skeleton_class->get_info = sensor_i2c_skeleton_dbus_interface_get_info;
9148 skeleton_class->get_properties = sensor_i2c_skeleton_dbus_interface_get_properties;
9149 skeleton_class->flush = sensor_i2c_skeleton_dbus_interface_flush;
9150 skeleton_class->get_vtable = sensor_i2c_skeleton_dbus_interface_get_vtable;
9151
9152#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
9153 g_type_class_add_private (klass, sizeof (SensorI2cSkeletonPrivate));
9154#endif
9155}
9156
9157static void
9158sensor_i2c_skeleton_iface_init (SensorI2cIface *iface)
9159{
9160 iface->get_dev_path = sensor_i2c_skeleton_get_dev_path;
9161 iface->get_address = sensor_i2c_skeleton_get_address;
9162}
9163
9164/**
9165 * sensor_i2c_skeleton_new:
9166 *
9167 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>.
9168 *
9169 * Returns: (transfer full) (type SensorI2cSkeleton): The skeleton object.
9170 */
9171SensorI2c *
9172sensor_i2c_skeleton_new (void)
9173{
9174 return SENSOR_I2C (g_object_new (TYPE_SENSOR_I2C_SKELETON, NULL));
9175}
9176
9177/* ------------------------------------------------------------------------
9178 * Code for interface org.openbmc.SensorMatch
9179 * ------------------------------------------------------------------------
9180 */
9181
9182/**
9183 * SECTION:SensorMatch
9184 * @title: SensorMatch
9185 * @short_description: Generated C code for the org.openbmc.SensorMatch D-Bus interface
9186 *
9187 * 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.
9188 */
9189
9190/* ---- Introspection data for org.openbmc.SensorMatch ---- */
9191
9192static const _ExtendedGDBusArgInfo _sensor_match_signal_info_sensor_match_ARG_state =
9193{
9194 {
9195 -1,
9196 (gchar *) "state",
9197 (gchar *) "y",
9198 NULL
9199 },
9200 FALSE
9201};
9202
9203static const _ExtendedGDBusArgInfo * const _sensor_match_signal_info_sensor_match_ARG_pointers[] =
9204{
9205 &_sensor_match_signal_info_sensor_match_ARG_state,
9206 NULL
9207};
9208
9209static const _ExtendedGDBusSignalInfo _sensor_match_signal_info_sensor_match =
9210{
9211 {
9212 -1,
9213 (gchar *) "SensorMatch",
9214 (GDBusArgInfo **) &_sensor_match_signal_info_sensor_match_ARG_pointers,
9215 NULL
9216 },
9217 "sensor-match"
9218};
9219
9220static const _ExtendedGDBusSignalInfo * const _sensor_match_signal_info_pointers[] =
9221{
9222 &_sensor_match_signal_info_sensor_match,
9223 NULL
9224};
9225
9226static const _ExtendedGDBusPropertyInfo _sensor_match_property_info_match_value =
9227{
9228 {
9229 -1,
9230 (gchar *) "match_value",
9231 (gchar *) "v",
9232 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
9233 NULL
9234 },
9235 "match-value",
9236 FALSE
9237};
9238
9239static const _ExtendedGDBusPropertyInfo _sensor_match_property_info_state =
9240{
9241 {
9242 -1,
9243 (gchar *) "state",
9244 (gchar *) "y",
9245 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
9246 NULL
9247 },
9248 "state",
9249 FALSE
9250};
9251
9252static const _ExtendedGDBusPropertyInfo * const _sensor_match_property_info_pointers[] =
9253{
9254 &_sensor_match_property_info_match_value,
9255 &_sensor_match_property_info_state,
9256 NULL
9257};
9258
9259static const _ExtendedGDBusInterfaceInfo _sensor_match_interface_info =
9260{
9261 {
9262 -1,
9263 (gchar *) "org.openbmc.SensorMatch",
9264 NULL,
9265 (GDBusSignalInfo **) &_sensor_match_signal_info_pointers,
9266 (GDBusPropertyInfo **) &_sensor_match_property_info_pointers,
9267 NULL
9268 },
9269 "sensor-match",
9270};
9271
9272
9273/**
9274 * sensor_match_interface_info:
9275 *
9276 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link> D-Bus interface.
9277 *
9278 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
9279 */
9280GDBusInterfaceInfo *
9281sensor_match_interface_info (void)
9282{
9283 return (GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct;
9284}
9285
9286/**
9287 * sensor_match_override_properties:
9288 * @klass: The class structure for a #GObject<!-- -->-derived class.
9289 * @property_id_begin: The property id to assign to the first overridden property.
9290 *
9291 * Overrides all #GObject properties in the #SensorMatch interface for a concrete class.
9292 * The properties are overridden in the order they are defined.
9293 *
9294 * Returns: The last property id.
9295 */
9296guint
9297sensor_match_override_properties (GObjectClass *klass, guint property_id_begin)
9298{
9299 g_object_class_override_property (klass, property_id_begin++, "match-value");
9300 g_object_class_override_property (klass, property_id_begin++, "state");
9301 return property_id_begin - 1;
9302}
9303
9304
9305
9306/**
9307 * SensorMatch:
9308 *
9309 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>.
9310 */
9311
9312/**
9313 * SensorMatchIface:
9314 * @parent_iface: The parent interface.
9315 * @get_match_value: Getter for the #SensorMatch:match-value property.
9316 * @get_state: Getter for the #SensorMatch:state property.
9317 * @sensor_match: Handler for the #SensorMatch::sensor-match signal.
9318 *
9319 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>.
9320 */
9321
9322typedef SensorMatchIface SensorMatchInterface;
9323G_DEFINE_INTERFACE (SensorMatch, sensor_match, G_TYPE_OBJECT);
9324
9325static void
9326sensor_match_default_init (SensorMatchIface *iface)
9327{
9328 /* GObject signals for received D-Bus signals: */
9329 /**
9330 * SensorMatch::sensor-match:
9331 * @object: A #SensorMatch.
9332 * @arg_state: Argument.
9333 *
9334 * 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.
9335 *
9336 * 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.
9337 */
9338 g_signal_new ("sensor-match",
9339 G_TYPE_FROM_INTERFACE (iface),
9340 G_SIGNAL_RUN_LAST,
9341 G_STRUCT_OFFSET (SensorMatchIface, sensor_match),
9342 NULL,
9343 NULL,
9344 g_cclosure_marshal_generic,
9345 G_TYPE_NONE,
9346 1, G_TYPE_UCHAR);
9347
9348 /* GObject properties for D-Bus properties: */
9349 /**
9350 * SensorMatch:match-value:
9351 *
9352 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link>.
9353 *
9354 * 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.
9355 */
9356 g_object_interface_install_property (iface,
9357 g_param_spec_variant ("match-value", "match_value", "match_value", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
9358 /**
9359 * SensorMatch:state:
9360 *
9361 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorMatch.state">"state"</link>.
9362 *
9363 * 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.
9364 */
9365 g_object_interface_install_property (iface,
9366 g_param_spec_uchar ("state", "state", "state", 0, 255, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
9367}
9368
9369/**
9370 * sensor_match_get_match_value: (skip)
9371 * @object: A #SensorMatch.
9372 *
9373 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link> D-Bus property.
9374 *
9375 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
9376 *
9377 * <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>
9378 *
9379 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
9380 */
9381GVariant *
9382sensor_match_get_match_value (SensorMatch *object)
9383{
9384 return SENSOR_MATCH_GET_IFACE (object)->get_match_value (object);
9385}
9386
9387/**
9388 * sensor_match_dup_match_value: (skip)
9389 * @object: A #SensorMatch.
9390 *
9391 * Gets a copy 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 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
9396 */
9397GVariant *
9398sensor_match_dup_match_value (SensorMatch *object)
9399{
9400 GVariant *value;
9401 g_object_get (G_OBJECT (object), "match-value", &value, NULL);
9402 return value;
9403}
9404
9405/**
9406 * sensor_match_set_match_value: (skip)
9407 * @object: A #SensorMatch.
9408 * @value: The value to set.
9409 *
9410 * Sets the <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link> D-Bus property to @value.
9411 *
9412 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
9413 */
9414void
9415sensor_match_set_match_value (SensorMatch *object, GVariant *value)
9416{
9417 g_object_set (G_OBJECT (object), "match-value", value, NULL);
9418}
9419
9420/**
9421 * sensor_match_get_state: (skip)
9422 * @object: A #SensorMatch.
9423 *
9424 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorMatch.state">"state"</link> D-Bus property.
9425 *
9426 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
9427 *
9428 * Returns: The property value.
9429 */
9430guchar
9431sensor_match_get_state (SensorMatch *object)
9432{
9433 return SENSOR_MATCH_GET_IFACE (object)->get_state (object);
9434}
9435
9436/**
9437 * sensor_match_set_state: (skip)
9438 * @object: A #SensorMatch.
9439 * @value: The value to set.
9440 *
9441 * Sets the <link linkend="gdbus-property-org-openbmc-SensorMatch.state">"state"</link> D-Bus property to @value.
9442 *
9443 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
9444 */
9445void
9446sensor_match_set_state (SensorMatch *object, guchar value)
9447{
9448 g_object_set (G_OBJECT (object), "state", value, NULL);
9449}
9450
9451/**
9452 * sensor_match_emit_sensor_match:
9453 * @object: A #SensorMatch.
9454 * @arg_state: Argument to pass with the signal.
9455 *
9456 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorMatch.SensorMatch">"SensorMatch"</link> D-Bus signal.
9457 */
9458void
9459sensor_match_emit_sensor_match (
9460 SensorMatch *object,
9461 guchar arg_state)
9462{
9463 g_signal_emit_by_name (object, "sensor-match", arg_state);
9464}
9465
9466/* ------------------------------------------------------------------------ */
9467
9468/**
9469 * SensorMatchProxy:
9470 *
9471 * The #SensorMatchProxy structure contains only private data and should only be accessed using the provided API.
9472 */
9473
9474/**
9475 * SensorMatchProxyClass:
9476 * @parent_class: The parent class.
9477 *
9478 * Class structure for #SensorMatchProxy.
9479 */
9480
9481struct _SensorMatchProxyPrivate
9482{
9483 GData *qdata;
9484};
9485
9486static void sensor_match_proxy_iface_init (SensorMatchIface *iface);
9487
9488#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
9489G_DEFINE_TYPE_WITH_CODE (SensorMatchProxy, sensor_match_proxy, G_TYPE_DBUS_PROXY,
9490 G_ADD_PRIVATE (SensorMatchProxy)
9491 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_proxy_iface_init));
9492
9493#else
9494G_DEFINE_TYPE_WITH_CODE (SensorMatchProxy, sensor_match_proxy, G_TYPE_DBUS_PROXY,
9495 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_proxy_iface_init));
9496
9497#endif
9498static void
9499sensor_match_proxy_finalize (GObject *object)
9500{
9501 SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (object);
9502 g_datalist_clear (&proxy->priv->qdata);
9503 G_OBJECT_CLASS (sensor_match_proxy_parent_class)->finalize (object);
9504}
9505
9506static void
9507sensor_match_proxy_get_property (GObject *object,
9508 guint prop_id,
9509 GValue *value,
9510 GParamSpec *pspec G_GNUC_UNUSED)
9511{
9512 const _ExtendedGDBusPropertyInfo *info;
9513 GVariant *variant;
9514 g_assert (prop_id != 0 && prop_id - 1 < 2);
9515 info = _sensor_match_property_info_pointers[prop_id - 1];
9516 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
9517 if (info->use_gvariant)
9518 {
9519 g_value_set_variant (value, variant);
9520 }
9521 else
9522 {
9523 if (variant != NULL)
9524 g_dbus_gvariant_to_gvalue (variant, value);
9525 }
9526 if (variant != NULL)
9527 g_variant_unref (variant);
9528}
9529
9530static void
9531sensor_match_proxy_set_property_cb (GDBusProxy *proxy,
9532 GAsyncResult *res,
9533 gpointer user_data)
9534{
9535 const _ExtendedGDBusPropertyInfo *info = user_data;
9536 GError *error;
9537 GVariant *_ret;
9538 error = NULL;
9539 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
9540 if (!_ret)
9541 {
9542 g_warning ("Error setting property '%s' on interface org.openbmc.SensorMatch: %s (%s, %d)",
9543 info->parent_struct.name,
9544 error->message, g_quark_to_string (error->domain), error->code);
9545 g_error_free (error);
9546 }
9547 else
9548 {
9549 g_variant_unref (_ret);
9550 }
9551}
9552
9553static void
9554sensor_match_proxy_set_property (GObject *object,
9555 guint prop_id,
9556 const GValue *value,
9557 GParamSpec *pspec G_GNUC_UNUSED)
9558{
9559 const _ExtendedGDBusPropertyInfo *info;
9560 GVariant *variant;
9561 g_assert (prop_id != 0 && prop_id - 1 < 2);
9562 info = _sensor_match_property_info_pointers[prop_id - 1];
9563 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
9564 g_dbus_proxy_call (G_DBUS_PROXY (object),
9565 "org.freedesktop.DBus.Properties.Set",
9566 g_variant_new ("(ssv)", "org.openbmc.SensorMatch", info->parent_struct.name, variant),
9567 G_DBUS_CALL_FLAGS_NONE,
9568 -1,
9569 NULL, (GAsyncReadyCallback) sensor_match_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
9570 g_variant_unref (variant);
9571}
9572
9573static void
9574sensor_match_proxy_g_signal (GDBusProxy *proxy,
9575 const gchar *sender_name G_GNUC_UNUSED,
9576 const gchar *signal_name,
9577 GVariant *parameters)
9578{
9579 _ExtendedGDBusSignalInfo *info;
9580 GVariantIter iter;
9581 GVariant *child;
9582 GValue *paramv;
9583 guint num_params;
9584 guint n;
9585 guint signal_id;
9586 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, signal_name);
9587 if (info == NULL)
9588 return;
9589 num_params = g_variant_n_children (parameters);
9590 paramv = g_new0 (GValue, num_params + 1);
9591 g_value_init (&paramv[0], TYPE_SENSOR_MATCH);
9592 g_value_set_object (&paramv[0], proxy);
9593 g_variant_iter_init (&iter, parameters);
9594 n = 1;
9595 while ((child = g_variant_iter_next_value (&iter)) != NULL)
9596 {
9597 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
9598 if (arg_info->use_gvariant)
9599 {
9600 g_value_init (&paramv[n], G_TYPE_VARIANT);
9601 g_value_set_variant (&paramv[n], child);
9602 n++;
9603 }
9604 else
9605 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
9606 g_variant_unref (child);
9607 }
9608 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_MATCH);
9609 g_signal_emitv (paramv, signal_id, 0, NULL);
9610 for (n = 0; n < num_params + 1; n++)
9611 g_value_unset (&paramv[n]);
9612 g_free (paramv);
9613}
9614
9615static void
9616sensor_match_proxy_g_properties_changed (GDBusProxy *_proxy,
9617 GVariant *changed_properties,
9618 const gchar *const *invalidated_properties)
9619{
9620 SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (_proxy);
9621 guint n;
9622 const gchar *key;
9623 GVariantIter *iter;
9624 _ExtendedGDBusPropertyInfo *info;
9625 g_variant_get (changed_properties, "a{sv}", &iter);
9626 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
9627 {
9628 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, key);
9629 g_datalist_remove_data (&proxy->priv->qdata, key);
9630 if (info != NULL)
9631 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
9632 }
9633 g_variant_iter_free (iter);
9634 for (n = 0; invalidated_properties[n] != NULL; n++)
9635 {
9636 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, invalidated_properties[n]);
9637 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
9638 if (info != NULL)
9639 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
9640 }
9641}
9642
9643static GVariant *
9644sensor_match_proxy_get_match_value (SensorMatch *object)
9645{
9646 SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (object);
9647 GVariant *variant;
9648 GVariant *value = NULL;
9649 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "match_value");
9650 value = variant;
9651 if (variant != NULL)
9652 g_variant_unref (variant);
9653 return value;
9654}
9655
9656static guchar
9657sensor_match_proxy_get_state (SensorMatch *object)
9658{
9659 SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (object);
9660 GVariant *variant;
9661 guchar value = 0;
9662 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state");
9663 if (variant != NULL)
9664 {
9665 value = g_variant_get_byte (variant);
9666 g_variant_unref (variant);
9667 }
9668 return value;
9669}
9670
9671static void
9672sensor_match_proxy_init (SensorMatchProxy *proxy)
9673{
9674#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
9675 proxy->priv = sensor_match_proxy_get_instance_private (proxy);
9676#else
9677 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_MATCH_PROXY, SensorMatchProxyPrivate);
9678#endif
9679
9680 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_match_interface_info ());
9681}
9682
9683static void
9684sensor_match_proxy_class_init (SensorMatchProxyClass *klass)
9685{
9686 GObjectClass *gobject_class;
9687 GDBusProxyClass *proxy_class;
9688
9689 gobject_class = G_OBJECT_CLASS (klass);
9690 gobject_class->finalize = sensor_match_proxy_finalize;
9691 gobject_class->get_property = sensor_match_proxy_get_property;
9692 gobject_class->set_property = sensor_match_proxy_set_property;
9693
9694 proxy_class = G_DBUS_PROXY_CLASS (klass);
9695 proxy_class->g_signal = sensor_match_proxy_g_signal;
9696 proxy_class->g_properties_changed = sensor_match_proxy_g_properties_changed;
9697
9698 sensor_match_override_properties (gobject_class, 1);
9699
9700#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
9701 g_type_class_add_private (klass, sizeof (SensorMatchProxyPrivate));
9702#endif
9703}
9704
9705static void
9706sensor_match_proxy_iface_init (SensorMatchIface *iface)
9707{
9708 iface->get_match_value = sensor_match_proxy_get_match_value;
9709 iface->get_state = sensor_match_proxy_get_state;
9710}
9711
9712/**
9713 * sensor_match_proxy_new:
9714 * @connection: A #GDBusConnection.
9715 * @flags: Flags from the #GDBusProxyFlags enumeration.
9716 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
9717 * @object_path: An object path.
9718 * @cancellable: (allow-none): A #GCancellable or %NULL.
9719 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
9720 * @user_data: User data to pass to @callback.
9721 *
9722 * 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.
9723 *
9724 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
9725 * You can then call sensor_match_proxy_new_finish() to get the result of the operation.
9726 *
9727 * See sensor_match_proxy_new_sync() for the synchronous, blocking version of this constructor.
9728 */
9729void
9730sensor_match_proxy_new (
9731 GDBusConnection *connection,
9732 GDBusProxyFlags flags,
9733 const gchar *name,
9734 const gchar *object_path,
9735 GCancellable *cancellable,
9736 GAsyncReadyCallback callback,
9737 gpointer user_data)
9738{
9739 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);
9740}
9741
9742/**
9743 * sensor_match_proxy_new_finish:
9744 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_match_proxy_new().
9745 * @error: Return location for error or %NULL
9746 *
9747 * Finishes an operation started with sensor_match_proxy_new().
9748 *
9749 * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set.
9750 */
9751SensorMatch *
9752sensor_match_proxy_new_finish (
9753 GAsyncResult *res,
9754 GError **error)
9755{
9756 GObject *ret;
9757 GObject *source_object;
9758 source_object = g_async_result_get_source_object (res);
9759 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
9760 g_object_unref (source_object);
9761 if (ret != NULL)
9762 return SENSOR_MATCH (ret);
9763 else
9764 return NULL;
9765}
9766
9767/**
9768 * sensor_match_proxy_new_sync:
9769 * @connection: A #GDBusConnection.
9770 * @flags: Flags from the #GDBusProxyFlags enumeration.
9771 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
9772 * @object_path: An object path.
9773 * @cancellable: (allow-none): A #GCancellable or %NULL.
9774 * @error: Return location for error or %NULL
9775 *
9776 * 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.
9777 *
9778 * The calling thread is blocked until a reply is received.
9779 *
9780 * See sensor_match_proxy_new() for the asynchronous version of this constructor.
9781 *
9782 * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set.
9783 */
9784SensorMatch *
9785sensor_match_proxy_new_sync (
9786 GDBusConnection *connection,
9787 GDBusProxyFlags flags,
9788 const gchar *name,
9789 const gchar *object_path,
9790 GCancellable *cancellable,
9791 GError **error)
9792{
9793 GInitable *ret;
9794 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);
9795 if (ret != NULL)
9796 return SENSOR_MATCH (ret);
9797 else
9798 return NULL;
9799}
9800
9801
9802/**
9803 * sensor_match_proxy_new_for_bus:
9804 * @bus_type: A #GBusType.
9805 * @flags: Flags from the #GDBusProxyFlags enumeration.
9806 * @name: A bus name (well-known or unique).
9807 * @object_path: An object path.
9808 * @cancellable: (allow-none): A #GCancellable or %NULL.
9809 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
9810 * @user_data: User data to pass to @callback.
9811 *
9812 * Like sensor_match_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
9813 *
9814 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
9815 * You can then call sensor_match_proxy_new_for_bus_finish() to get the result of the operation.
9816 *
9817 * See sensor_match_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
9818 */
9819void
9820sensor_match_proxy_new_for_bus (
9821 GBusType bus_type,
9822 GDBusProxyFlags flags,
9823 const gchar *name,
9824 const gchar *object_path,
9825 GCancellable *cancellable,
9826 GAsyncReadyCallback callback,
9827 gpointer user_data)
9828{
9829 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);
9830}
9831
9832/**
9833 * sensor_match_proxy_new_for_bus_finish:
9834 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_match_proxy_new_for_bus().
9835 * @error: Return location for error or %NULL
9836 *
9837 * Finishes an operation started with sensor_match_proxy_new_for_bus().
9838 *
9839 * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set.
9840 */
9841SensorMatch *
9842sensor_match_proxy_new_for_bus_finish (
9843 GAsyncResult *res,
9844 GError **error)
9845{
9846 GObject *ret;
9847 GObject *source_object;
9848 source_object = g_async_result_get_source_object (res);
9849 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
9850 g_object_unref (source_object);
9851 if (ret != NULL)
9852 return SENSOR_MATCH (ret);
9853 else
9854 return NULL;
9855}
9856
9857/**
9858 * sensor_match_proxy_new_for_bus_sync:
9859 * @bus_type: A #GBusType.
9860 * @flags: Flags from the #GDBusProxyFlags enumeration.
9861 * @name: A bus name (well-known or unique).
9862 * @object_path: An object path.
9863 * @cancellable: (allow-none): A #GCancellable or %NULL.
9864 * @error: Return location for error or %NULL
9865 *
9866 * Like sensor_match_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
9867 *
9868 * The calling thread is blocked until a reply is received.
9869 *
9870 * See sensor_match_proxy_new_for_bus() for the asynchronous version of this constructor.
9871 *
9872 * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set.
9873 */
9874SensorMatch *
9875sensor_match_proxy_new_for_bus_sync (
9876 GBusType bus_type,
9877 GDBusProxyFlags flags,
9878 const gchar *name,
9879 const gchar *object_path,
9880 GCancellable *cancellable,
9881 GError **error)
9882{
9883 GInitable *ret;
9884 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);
9885 if (ret != NULL)
9886 return SENSOR_MATCH (ret);
9887 else
9888 return NULL;
9889}
9890
9891
9892/* ------------------------------------------------------------------------ */
9893
9894/**
9895 * SensorMatchSkeleton:
9896 *
9897 * The #SensorMatchSkeleton structure contains only private data and should only be accessed using the provided API.
9898 */
9899
9900/**
9901 * SensorMatchSkeletonClass:
9902 * @parent_class: The parent class.
9903 *
9904 * Class structure for #SensorMatchSkeleton.
9905 */
9906
9907struct _SensorMatchSkeletonPrivate
9908{
9909 GValue *properties;
9910 GList *changed_properties;
9911 GSource *changed_properties_idle_source;
9912 GMainContext *context;
9913 GMutex lock;
9914};
9915
9916static void
9917_sensor_match_skeleton_handle_method_call (
9918 GDBusConnection *connection G_GNUC_UNUSED,
9919 const gchar *sender G_GNUC_UNUSED,
9920 const gchar *object_path G_GNUC_UNUSED,
9921 const gchar *interface_name,
9922 const gchar *method_name,
9923 GVariant *parameters,
9924 GDBusMethodInvocation *invocation,
9925 gpointer user_data)
9926{
9927 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data);
9928 _ExtendedGDBusMethodInfo *info;
9929 GVariantIter iter;
9930 GVariant *child;
9931 GValue *paramv;
9932 guint num_params;
9933 guint num_extra;
9934 guint n;
9935 guint signal_id;
9936 GValue return_value = G_VALUE_INIT;
9937 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
9938 g_assert (info != NULL);
9939 num_params = g_variant_n_children (parameters);
9940 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
9941 n = 0;
9942 g_value_init (&paramv[n], TYPE_SENSOR_MATCH);
9943 g_value_set_object (&paramv[n++], skeleton);
9944 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
9945 g_value_set_object (&paramv[n++], invocation);
9946 if (info->pass_fdlist)
9947 {
9948#ifdef G_OS_UNIX
9949 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
9950 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
9951#else
9952 g_assert_not_reached ();
9953#endif
9954 }
9955 g_variant_iter_init (&iter, parameters);
9956 while ((child = g_variant_iter_next_value (&iter)) != NULL)
9957 {
9958 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
9959 if (arg_info->use_gvariant)
9960 {
9961 g_value_init (&paramv[n], G_TYPE_VARIANT);
9962 g_value_set_variant (&paramv[n], child);
9963 n++;
9964 }
9965 else
9966 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
9967 g_variant_unref (child);
9968 }
9969 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_MATCH);
9970 g_value_init (&return_value, G_TYPE_BOOLEAN);
9971 g_signal_emitv (paramv, signal_id, 0, &return_value);
9972 if (!g_value_get_boolean (&return_value))
9973 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);
9974 g_value_unset (&return_value);
9975 for (n = 0; n < num_params + num_extra; n++)
9976 g_value_unset (&paramv[n]);
9977 g_free (paramv);
9978}
9979
9980static GVariant *
9981_sensor_match_skeleton_handle_get_property (
9982 GDBusConnection *connection G_GNUC_UNUSED,
9983 const gchar *sender G_GNUC_UNUSED,
9984 const gchar *object_path G_GNUC_UNUSED,
9985 const gchar *interface_name G_GNUC_UNUSED,
9986 const gchar *property_name,
9987 GError **error,
9988 gpointer user_data)
9989{
9990 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data);
9991 GValue value = G_VALUE_INIT;
9992 GParamSpec *pspec;
9993 _ExtendedGDBusPropertyInfo *info;
9994 GVariant *ret;
9995 ret = NULL;
9996 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, property_name);
9997 g_assert (info != NULL);
9998 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
9999 if (pspec == NULL)
10000 {
10001 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
10002 }
10003 else
10004 {
10005 g_value_init (&value, pspec->value_type);
10006 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
10007 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
10008 g_value_unset (&value);
10009 }
10010 return ret;
10011}
10012
10013static gboolean
10014_sensor_match_skeleton_handle_set_property (
10015 GDBusConnection *connection G_GNUC_UNUSED,
10016 const gchar *sender G_GNUC_UNUSED,
10017 const gchar *object_path G_GNUC_UNUSED,
10018 const gchar *interface_name G_GNUC_UNUSED,
10019 const gchar *property_name,
10020 GVariant *variant,
10021 GError **error,
10022 gpointer user_data)
10023{
10024 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data);
10025 GValue value = G_VALUE_INIT;
10026 GParamSpec *pspec;
10027 _ExtendedGDBusPropertyInfo *info;
10028 gboolean ret;
10029 ret = FALSE;
10030 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, property_name);
10031 g_assert (info != NULL);
10032 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
10033 if (pspec == NULL)
10034 {
10035 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
10036 }
10037 else
10038 {
10039 if (info->use_gvariant)
10040 g_value_set_variant (&value, variant);
10041 else
10042 g_dbus_gvariant_to_gvalue (variant, &value);
10043 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
10044 g_value_unset (&value);
10045 ret = TRUE;
10046 }
10047 return ret;
10048}
10049
10050static const GDBusInterfaceVTable _sensor_match_skeleton_vtable =
10051{
10052 _sensor_match_skeleton_handle_method_call,
10053 _sensor_match_skeleton_handle_get_property,
10054 _sensor_match_skeleton_handle_set_property,
10055 {NULL}
10056};
10057
10058static GDBusInterfaceInfo *
10059sensor_match_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
10060{
10061 return sensor_match_interface_info ();
10062}
10063
10064static GDBusInterfaceVTable *
10065sensor_match_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
10066{
10067 return (GDBusInterfaceVTable *) &_sensor_match_skeleton_vtable;
10068}
10069
10070static GVariant *
10071sensor_match_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
10072{
10073 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (_skeleton);
10074
10075 GVariantBuilder builder;
10076 guint n;
10077 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
10078 if (_sensor_match_interface_info.parent_struct.properties == NULL)
10079 goto out;
10080 for (n = 0; _sensor_match_interface_info.parent_struct.properties[n] != NULL; n++)
10081 {
10082 GDBusPropertyInfo *info = _sensor_match_interface_info.parent_struct.properties[n];
10083 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
10084 {
10085 GVariant *value;
10086 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);
10087 if (value != NULL)
10088 {
10089 g_variant_take_ref (value);
10090 g_variant_builder_add (&builder, "{sv}", info->name, value);
10091 g_variant_unref (value);
10092 }
10093 }
10094 }
10095out:
10096 return g_variant_builder_end (&builder);
10097}
10098
10099static gboolean _sensor_match_emit_changed (gpointer user_data);
10100
10101static void
10102sensor_match_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
10103{
10104 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (_skeleton);
10105 gboolean emit_changed = FALSE;
10106
10107 g_mutex_lock (&skeleton->priv->lock);
10108 if (skeleton->priv->changed_properties_idle_source != NULL)
10109 {
10110 g_source_destroy (skeleton->priv->changed_properties_idle_source);
10111 skeleton->priv->changed_properties_idle_source = NULL;
10112 emit_changed = TRUE;
10113 }
10114 g_mutex_unlock (&skeleton->priv->lock);
10115
10116 if (emit_changed)
10117 _sensor_match_emit_changed (skeleton);
10118}
10119
10120static void
10121_sensor_match_on_signal_sensor_match (
10122 SensorMatch *object,
10123 guchar arg_state)
10124{
10125 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
10126
10127 GList *connections, *l;
10128 GVariant *signal_variant;
10129 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
10130
10131 signal_variant = g_variant_ref_sink (g_variant_new ("(y)",
10132 arg_state));
10133 for (l = connections; l != NULL; l = l->next)
10134 {
10135 GDBusConnection *connection = l->data;
10136 g_dbus_connection_emit_signal (connection,
10137 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorMatch", "SensorMatch",
10138 signal_variant, NULL);
10139 }
10140 g_variant_unref (signal_variant);
10141 g_list_free_full (connections, g_object_unref);
10142}
10143
10144static void sensor_match_skeleton_iface_init (SensorMatchIface *iface);
10145#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
10146G_DEFINE_TYPE_WITH_CODE (SensorMatchSkeleton, sensor_match_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
10147 G_ADD_PRIVATE (SensorMatchSkeleton)
10148 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_skeleton_iface_init));
10149
10150#else
10151G_DEFINE_TYPE_WITH_CODE (SensorMatchSkeleton, sensor_match_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
10152 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_skeleton_iface_init));
10153
10154#endif
10155static void
10156sensor_match_skeleton_finalize (GObject *object)
10157{
10158 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
10159 guint n;
10160 for (n = 0; n < 2; n++)
10161 g_value_unset (&skeleton->priv->properties[n]);
10162 g_free (skeleton->priv->properties);
10163 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
10164 if (skeleton->priv->changed_properties_idle_source != NULL)
10165 g_source_destroy (skeleton->priv->changed_properties_idle_source);
10166 g_main_context_unref (skeleton->priv->context);
10167 g_mutex_clear (&skeleton->priv->lock);
10168 G_OBJECT_CLASS (sensor_match_skeleton_parent_class)->finalize (object);
10169}
10170
10171static void
10172sensor_match_skeleton_get_property (GObject *object,
10173 guint prop_id,
10174 GValue *value,
10175 GParamSpec *pspec G_GNUC_UNUSED)
10176{
10177 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
10178 g_assert (prop_id != 0 && prop_id - 1 < 2);
10179 g_mutex_lock (&skeleton->priv->lock);
10180 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
10181 g_mutex_unlock (&skeleton->priv->lock);
10182}
10183
10184static gboolean
10185_sensor_match_emit_changed (gpointer user_data)
10186{
10187 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data);
10188 GList *l;
10189 GVariantBuilder builder;
10190 GVariantBuilder invalidated_builder;
10191 guint num_changes;
10192
10193 g_mutex_lock (&skeleton->priv->lock);
10194 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
10195 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
10196 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
10197 {
10198 ChangedProperty *cp = l->data;
10199 GVariant *variant;
10200 const GValue *cur_value;
10201
10202 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
10203 if (!_g_value_equal (cur_value, &cp->orig_value))
10204 {
10205 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
10206 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
10207 g_variant_unref (variant);
10208 num_changes++;
10209 }
10210 }
10211 if (num_changes > 0)
10212 {
10213 GList *connections, *ll;
10214 GVariant *signal_variant;
10215 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorMatch",
10216 &builder, &invalidated_builder));
10217 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
10218 for (ll = connections; ll != NULL; ll = ll->next)
10219 {
10220 GDBusConnection *connection = ll->data;
10221
10222 g_dbus_connection_emit_signal (connection,
10223 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
10224 "org.freedesktop.DBus.Properties",
10225 "PropertiesChanged",
10226 signal_variant,
10227 NULL);
10228 }
10229 g_variant_unref (signal_variant);
10230 g_list_free_full (connections, g_object_unref);
10231 }
10232 else
10233 {
10234 g_variant_builder_clear (&builder);
10235 g_variant_builder_clear (&invalidated_builder);
10236 }
10237 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
10238 skeleton->priv->changed_properties = NULL;
10239 skeleton->priv->changed_properties_idle_source = NULL;
10240 g_mutex_unlock (&skeleton->priv->lock);
10241 return FALSE;
10242}
10243
10244static void
10245_sensor_match_schedule_emit_changed (SensorMatchSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
10246{
10247 ChangedProperty *cp;
10248 GList *l;
10249 cp = NULL;
10250 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
10251 {
10252 ChangedProperty *i_cp = l->data;
10253 if (i_cp->info == info)
10254 {
10255 cp = i_cp;
10256 break;
10257 }
10258 }
10259 if (cp == NULL)
10260 {
10261 cp = g_new0 (ChangedProperty, 1);
10262 cp->prop_id = prop_id;
10263 cp->info = info;
10264 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
10265 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
10266 g_value_copy (orig_value, &cp->orig_value);
10267 }
10268}
10269
10270static void
10271sensor_match_skeleton_notify (GObject *object,
10272 GParamSpec *pspec G_GNUC_UNUSED)
10273{
10274 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
10275 g_mutex_lock (&skeleton->priv->lock);
10276 if (skeleton->priv->changed_properties != NULL &&
10277 skeleton->priv->changed_properties_idle_source == NULL)
10278 {
10279 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
10280 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
10281 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_match_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
10282 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
10283 g_source_unref (skeleton->priv->changed_properties_idle_source);
10284 }
10285 g_mutex_unlock (&skeleton->priv->lock);
10286}
10287
10288static void
10289sensor_match_skeleton_set_property (GObject *object,
10290 guint prop_id,
10291 const GValue *value,
10292 GParamSpec *pspec)
10293{
10294 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
10295 g_assert (prop_id != 0 && prop_id - 1 < 2);
10296 g_mutex_lock (&skeleton->priv->lock);
10297 g_object_freeze_notify (object);
10298 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
10299 {
10300 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
10301 _sensor_match_schedule_emit_changed (skeleton, _sensor_match_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
10302 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
10303 g_object_notify_by_pspec (object, pspec);
10304 }
10305 g_mutex_unlock (&skeleton->priv->lock);
10306 g_object_thaw_notify (object);
10307}
10308
10309static void
10310sensor_match_skeleton_init (SensorMatchSkeleton *skeleton)
10311{
10312#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
10313 skeleton->priv = sensor_match_skeleton_get_instance_private (skeleton);
10314#else
10315 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_MATCH_SKELETON, SensorMatchSkeletonPrivate);
10316#endif
10317
10318 g_mutex_init (&skeleton->priv->lock);
10319 skeleton->priv->context = g_main_context_ref_thread_default ();
10320 skeleton->priv->properties = g_new0 (GValue, 2);
10321 g_value_init (&skeleton->priv->properties[0], G_TYPE_VARIANT);
10322 g_value_init (&skeleton->priv->properties[1], G_TYPE_UCHAR);
10323}
10324
10325static GVariant *
10326sensor_match_skeleton_get_match_value (SensorMatch *object)
10327{
10328 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
10329 GVariant *value;
10330 g_mutex_lock (&skeleton->priv->lock);
10331 value = g_value_get_variant (&(skeleton->priv->properties[0]));
10332 g_mutex_unlock (&skeleton->priv->lock);
10333 return value;
10334}
10335
10336static guchar
10337sensor_match_skeleton_get_state (SensorMatch *object)
10338{
10339 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
10340 guchar value;
10341 g_mutex_lock (&skeleton->priv->lock);
10342 value = g_value_get_uchar (&(skeleton->priv->properties[1]));
10343 g_mutex_unlock (&skeleton->priv->lock);
10344 return value;
10345}
10346
10347static void
10348sensor_match_skeleton_class_init (SensorMatchSkeletonClass *klass)
10349{
10350 GObjectClass *gobject_class;
10351 GDBusInterfaceSkeletonClass *skeleton_class;
10352
10353 gobject_class = G_OBJECT_CLASS (klass);
10354 gobject_class->finalize = sensor_match_skeleton_finalize;
10355 gobject_class->get_property = sensor_match_skeleton_get_property;
10356 gobject_class->set_property = sensor_match_skeleton_set_property;
10357 gobject_class->notify = sensor_match_skeleton_notify;
10358
10359
10360 sensor_match_override_properties (gobject_class, 1);
10361
10362 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
10363 skeleton_class->get_info = sensor_match_skeleton_dbus_interface_get_info;
10364 skeleton_class->get_properties = sensor_match_skeleton_dbus_interface_get_properties;
10365 skeleton_class->flush = sensor_match_skeleton_dbus_interface_flush;
10366 skeleton_class->get_vtable = sensor_match_skeleton_dbus_interface_get_vtable;
10367
10368#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
10369 g_type_class_add_private (klass, sizeof (SensorMatchSkeletonPrivate));
10370#endif
10371}
10372
10373static void
10374sensor_match_skeleton_iface_init (SensorMatchIface *iface)
10375{
10376 iface->sensor_match = _sensor_match_on_signal_sensor_match;
10377 iface->get_match_value = sensor_match_skeleton_get_match_value;
10378 iface->get_state = sensor_match_skeleton_get_state;
10379}
10380
10381/**
10382 * sensor_match_skeleton_new:
10383 *
10384 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>.
10385 *
10386 * Returns: (transfer full) (type SensorMatchSkeleton): The skeleton object.
10387 */
10388SensorMatch *
10389sensor_match_skeleton_new (void)
10390{
10391 return SENSOR_MATCH (g_object_new (TYPE_SENSOR_MATCH_SKELETON, NULL));
10392}
10393
10394/* ------------------------------------------------------------------------
10395 * Code for interface org.openbmc.Process
10396 * ------------------------------------------------------------------------
10397 */
10398
10399/**
10400 * SECTION:Process
10401 * @title: Process
10402 * @short_description: Generated C code for the org.openbmc.Process D-Bus interface
10403 *
10404 * 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.
10405 */
10406
10407/* ---- Introspection data for org.openbmc.Process ---- */
10408
10409static const _ExtendedGDBusMethodInfo _process_method_info_stop =
10410{
10411 {
10412 -1,
10413 (gchar *) "stop",
10414 NULL,
10415 NULL,
10416 NULL
10417 },
10418 "handle-stop",
10419 FALSE
10420};
10421
10422static const _ExtendedGDBusMethodInfo * const _process_method_info_pointers[] =
10423{
10424 &_process_method_info_stop,
10425 NULL
10426};
10427
10428static const _ExtendedGDBusInterfaceInfo _process_interface_info =
10429{
10430 {
10431 -1,
10432 (gchar *) "org.openbmc.Process",
10433 (GDBusMethodInfo **) &_process_method_info_pointers,
10434 NULL,
10435 NULL,
10436 NULL
10437 },
10438 "process",
10439};
10440
10441
10442/**
10443 * process_interface_info:
10444 *
10445 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link> D-Bus interface.
10446 *
10447 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
10448 */
10449GDBusInterfaceInfo *
10450process_interface_info (void)
10451{
10452 return (GDBusInterfaceInfo *) &_process_interface_info.parent_struct;
10453}
10454
10455/**
10456 * process_override_properties:
10457 * @klass: The class structure for a #GObject<!-- -->-derived class.
10458 * @property_id_begin: The property id to assign to the first overridden property.
10459 *
10460 * Overrides all #GObject properties in the #Process interface for a concrete class.
10461 * The properties are overridden in the order they are defined.
10462 *
10463 * Returns: The last property id.
10464 */
10465guint
10466process_override_properties (GObjectClass *klass, guint property_id_begin)
10467{
10468 return property_id_begin - 1;
10469}
10470
10471
10472
10473/**
10474 * Process:
10475 *
10476 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link>.
10477 */
10478
10479/**
10480 * ProcessIface:
10481 * @parent_iface: The parent interface.
10482 * @handle_stop: Handler for the #Process::handle-stop signal.
10483 *
10484 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link>.
10485 */
10486
10487typedef ProcessIface ProcessInterface;
10488G_DEFINE_INTERFACE (Process, process, G_TYPE_OBJECT);
10489
10490static void
10491process_default_init (ProcessIface *iface)
10492{
10493 /* GObject signals for incoming D-Bus method calls: */
10494 /**
10495 * Process::handle-stop:
10496 * @object: A #Process.
10497 * @invocation: A #GDBusMethodInvocation.
10498 *
10499 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Process.stop">stop()</link> D-Bus method.
10500 *
10501 * 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.
10502 *
10503 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
10504 */
10505 g_signal_new ("handle-stop",
10506 G_TYPE_FROM_INTERFACE (iface),
10507 G_SIGNAL_RUN_LAST,
10508 G_STRUCT_OFFSET (ProcessIface, handle_stop),
10509 g_signal_accumulator_true_handled,
10510 NULL,
10511 g_cclosure_marshal_generic,
10512 G_TYPE_BOOLEAN,
10513 1,
10514 G_TYPE_DBUS_METHOD_INVOCATION);
10515
10516}
10517
10518/**
10519 * process_call_stop:
10520 * @proxy: A #ProcessProxy.
10521 * @cancellable: (allow-none): A #GCancellable or %NULL.
10522 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
10523 * @user_data: User data to pass to @callback.
10524 *
10525 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Process.stop">stop()</link> D-Bus method on @proxy.
10526 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
10527 * You can then call process_call_stop_finish() to get the result of the operation.
10528 *
10529 * See process_call_stop_sync() for the synchronous, blocking version of this method.
10530 */
10531void
10532process_call_stop (
10533 Process *proxy,
10534 GCancellable *cancellable,
10535 GAsyncReadyCallback callback,
10536 gpointer user_data)
10537{
10538 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
10539 "stop",
10540 g_variant_new ("()"),
10541 G_DBUS_CALL_FLAGS_NONE,
10542 -1,
10543 cancellable,
10544 callback,
10545 user_data);
10546}
10547
10548/**
10549 * process_call_stop_finish:
10550 * @proxy: A #ProcessProxy.
10551 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to process_call_stop().
10552 * @error: Return location for error or %NULL.
10553 *
10554 * Finishes an operation started with process_call_stop().
10555 *
10556 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
10557 */
10558gboolean
10559process_call_stop_finish (
10560 Process *proxy,
10561 GAsyncResult *res,
10562 GError **error)
10563{
10564 GVariant *_ret;
10565 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
10566 if (_ret == NULL)
10567 goto _out;
10568 g_variant_get (_ret,
10569 "()");
10570 g_variant_unref (_ret);
10571_out:
10572 return _ret != NULL;
10573}
10574
10575/**
10576 * process_call_stop_sync:
10577 * @proxy: A #ProcessProxy.
10578 * @cancellable: (allow-none): A #GCancellable or %NULL.
10579 * @error: Return location for error or %NULL.
10580 *
10581 * 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.
10582 *
10583 * See process_call_stop() for the asynchronous version of this method.
10584 *
10585 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
10586 */
10587gboolean
10588process_call_stop_sync (
10589 Process *proxy,
10590 GCancellable *cancellable,
10591 GError **error)
10592{
10593 GVariant *_ret;
10594 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
10595 "stop",
10596 g_variant_new ("()"),
10597 G_DBUS_CALL_FLAGS_NONE,
10598 -1,
10599 cancellable,
10600 error);
10601 if (_ret == NULL)
10602 goto _out;
10603 g_variant_get (_ret,
10604 "()");
10605 g_variant_unref (_ret);
10606_out:
10607 return _ret != NULL;
10608}
10609
10610/**
10611 * process_complete_stop:
10612 * @object: A #Process.
10613 * @invocation: (transfer full): A #GDBusMethodInvocation.
10614 *
10615 * 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.
10616 *
10617 * This method will free @invocation, you cannot use it afterwards.
10618 */
10619void
10620process_complete_stop (
10621 Process *object,
10622 GDBusMethodInvocation *invocation)
10623{
10624 g_dbus_method_invocation_return_value (invocation,
10625 g_variant_new ("()"));
10626}
10627
10628/* ------------------------------------------------------------------------ */
10629
10630/**
10631 * ProcessProxy:
10632 *
10633 * The #ProcessProxy structure contains only private data and should only be accessed using the provided API.
10634 */
10635
10636/**
10637 * ProcessProxyClass:
10638 * @parent_class: The parent class.
10639 *
10640 * Class structure for #ProcessProxy.
10641 */
10642
10643struct _ProcessProxyPrivate
10644{
10645 GData *qdata;
10646};
10647
10648static void process_proxy_iface_init (ProcessIface *iface);
10649
10650#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
10651G_DEFINE_TYPE_WITH_CODE (ProcessProxy, process_proxy, G_TYPE_DBUS_PROXY,
10652 G_ADD_PRIVATE (ProcessProxy)
10653 G_IMPLEMENT_INTERFACE (TYPE_PROCESS, process_proxy_iface_init));
10654
10655#else
10656G_DEFINE_TYPE_WITH_CODE (ProcessProxy, process_proxy, G_TYPE_DBUS_PROXY,
10657 G_IMPLEMENT_INTERFACE (TYPE_PROCESS, process_proxy_iface_init));
10658
10659#endif
10660static void
10661process_proxy_finalize (GObject *object)
10662{
10663 ProcessProxy *proxy = PROCESS_PROXY (object);
10664 g_datalist_clear (&proxy->priv->qdata);
10665 G_OBJECT_CLASS (process_proxy_parent_class)->finalize (object);
10666}
10667
10668static void
10669process_proxy_get_property (GObject *object,
10670 guint prop_id,
10671 GValue *value,
10672 GParamSpec *pspec G_GNUC_UNUSED)
10673{
10674}
10675
10676static void
10677process_proxy_set_property (GObject *object,
10678 guint prop_id,
10679 const GValue *value,
10680 GParamSpec *pspec G_GNUC_UNUSED)
10681{
10682}
10683
10684static void
10685process_proxy_g_signal (GDBusProxy *proxy,
10686 const gchar *sender_name G_GNUC_UNUSED,
10687 const gchar *signal_name,
10688 GVariant *parameters)
10689{
10690 _ExtendedGDBusSignalInfo *info;
10691 GVariantIter iter;
10692 GVariant *child;
10693 GValue *paramv;
10694 guint num_params;
10695 guint n;
10696 guint signal_id;
10697 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, signal_name);
10698 if (info == NULL)
10699 return;
10700 num_params = g_variant_n_children (parameters);
10701 paramv = g_new0 (GValue, num_params + 1);
10702 g_value_init (&paramv[0], TYPE_PROCESS);
10703 g_value_set_object (&paramv[0], proxy);
10704 g_variant_iter_init (&iter, parameters);
10705 n = 1;
10706 while ((child = g_variant_iter_next_value (&iter)) != NULL)
10707 {
10708 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
10709 if (arg_info->use_gvariant)
10710 {
10711 g_value_init (&paramv[n], G_TYPE_VARIANT);
10712 g_value_set_variant (&paramv[n], child);
10713 n++;
10714 }
10715 else
10716 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
10717 g_variant_unref (child);
10718 }
10719 signal_id = g_signal_lookup (info->signal_name, TYPE_PROCESS);
10720 g_signal_emitv (paramv, signal_id, 0, NULL);
10721 for (n = 0; n < num_params + 1; n++)
10722 g_value_unset (&paramv[n]);
10723 g_free (paramv);
10724}
10725
10726static void
10727process_proxy_g_properties_changed (GDBusProxy *_proxy,
10728 GVariant *changed_properties,
10729 const gchar *const *invalidated_properties)
10730{
10731 ProcessProxy *proxy = PROCESS_PROXY (_proxy);
10732 guint n;
10733 const gchar *key;
10734 GVariantIter *iter;
10735 _ExtendedGDBusPropertyInfo *info;
10736 g_variant_get (changed_properties, "a{sv}", &iter);
10737 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
10738 {
10739 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, key);
10740 g_datalist_remove_data (&proxy->priv->qdata, key);
10741 if (info != NULL)
10742 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
10743 }
10744 g_variant_iter_free (iter);
10745 for (n = 0; invalidated_properties[n] != NULL; n++)
10746 {
10747 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, invalidated_properties[n]);
10748 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
10749 if (info != NULL)
10750 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
10751 }
10752}
10753
10754static void
10755process_proxy_init (ProcessProxy *proxy)
10756{
10757#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
10758 proxy->priv = process_proxy_get_instance_private (proxy);
10759#else
10760 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_PROCESS_PROXY, ProcessProxyPrivate);
10761#endif
10762
10763 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), process_interface_info ());
10764}
10765
10766static void
10767process_proxy_class_init (ProcessProxyClass *klass)
10768{
10769 GObjectClass *gobject_class;
10770 GDBusProxyClass *proxy_class;
10771
10772 gobject_class = G_OBJECT_CLASS (klass);
10773 gobject_class->finalize = process_proxy_finalize;
10774 gobject_class->get_property = process_proxy_get_property;
10775 gobject_class->set_property = process_proxy_set_property;
10776
10777 proxy_class = G_DBUS_PROXY_CLASS (klass);
10778 proxy_class->g_signal = process_proxy_g_signal;
10779 proxy_class->g_properties_changed = process_proxy_g_properties_changed;
10780
10781#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
10782 g_type_class_add_private (klass, sizeof (ProcessProxyPrivate));
10783#endif
10784}
10785
10786static void
10787process_proxy_iface_init (ProcessIface *iface)
10788{
10789}
10790
10791/**
10792 * process_proxy_new:
10793 * @connection: A #GDBusConnection.
10794 * @flags: Flags from the #GDBusProxyFlags enumeration.
10795 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
10796 * @object_path: An object path.
10797 * @cancellable: (allow-none): A #GCancellable or %NULL.
10798 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
10799 * @user_data: User data to pass to @callback.
10800 *
10801 * 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.
10802 *
10803 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
10804 * You can then call process_proxy_new_finish() to get the result of the operation.
10805 *
10806 * See process_proxy_new_sync() for the synchronous, blocking version of this constructor.
10807 */
10808void
10809process_proxy_new (
10810 GDBusConnection *connection,
10811 GDBusProxyFlags flags,
10812 const gchar *name,
10813 const gchar *object_path,
10814 GCancellable *cancellable,
10815 GAsyncReadyCallback callback,
10816 gpointer user_data)
10817{
10818 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);
10819}
10820
10821/**
10822 * process_proxy_new_finish:
10823 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to process_proxy_new().
10824 * @error: Return location for error or %NULL
10825 *
10826 * Finishes an operation started with process_proxy_new().
10827 *
10828 * Returns: (transfer full) (type ProcessProxy): The constructed proxy object or %NULL if @error is set.
10829 */
10830Process *
10831process_proxy_new_finish (
10832 GAsyncResult *res,
10833 GError **error)
10834{
10835 GObject *ret;
10836 GObject *source_object;
10837 source_object = g_async_result_get_source_object (res);
10838 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
10839 g_object_unref (source_object);
10840 if (ret != NULL)
10841 return PROCESS (ret);
10842 else
10843 return NULL;
10844}
10845
10846/**
10847 * process_proxy_new_sync:
10848 * @connection: A #GDBusConnection.
10849 * @flags: Flags from the #GDBusProxyFlags enumeration.
10850 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
10851 * @object_path: An object path.
10852 * @cancellable: (allow-none): A #GCancellable or %NULL.
10853 * @error: Return location for error or %NULL
10854 *
10855 * 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.
10856 *
10857 * The calling thread is blocked until a reply is received.
10858 *
10859 * See process_proxy_new() for the asynchronous version of this constructor.
10860 *
10861 * Returns: (transfer full) (type ProcessProxy): The constructed proxy object or %NULL if @error is set.
10862 */
10863Process *
10864process_proxy_new_sync (
10865 GDBusConnection *connection,
10866 GDBusProxyFlags flags,
10867 const gchar *name,
10868 const gchar *object_path,
10869 GCancellable *cancellable,
10870 GError **error)
10871{
10872 GInitable *ret;
10873 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);
10874 if (ret != NULL)
10875 return PROCESS (ret);
10876 else
10877 return NULL;
10878}
10879
10880
10881/**
10882 * process_proxy_new_for_bus:
10883 * @bus_type: A #GBusType.
10884 * @flags: Flags from the #GDBusProxyFlags enumeration.
10885 * @name: A bus name (well-known or unique).
10886 * @object_path: An object path.
10887 * @cancellable: (allow-none): A #GCancellable or %NULL.
10888 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
10889 * @user_data: User data to pass to @callback.
10890 *
10891 * Like process_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
10892 *
10893 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
10894 * You can then call process_proxy_new_for_bus_finish() to get the result of the operation.
10895 *
10896 * See process_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
10897 */
10898void
10899process_proxy_new_for_bus (
10900 GBusType bus_type,
10901 GDBusProxyFlags flags,
10902 const gchar *name,
10903 const gchar *object_path,
10904 GCancellable *cancellable,
10905 GAsyncReadyCallback callback,
10906 gpointer user_data)
10907{
10908 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);
10909}
10910
10911/**
10912 * process_proxy_new_for_bus_finish:
10913 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to process_proxy_new_for_bus().
10914 * @error: Return location for error or %NULL
10915 *
10916 * Finishes an operation started with process_proxy_new_for_bus().
10917 *
10918 * Returns: (transfer full) (type ProcessProxy): The constructed proxy object or %NULL if @error is set.
10919 */
10920Process *
10921process_proxy_new_for_bus_finish (
10922 GAsyncResult *res,
10923 GError **error)
10924{
10925 GObject *ret;
10926 GObject *source_object;
10927 source_object = g_async_result_get_source_object (res);
10928 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
10929 g_object_unref (source_object);
10930 if (ret != NULL)
10931 return PROCESS (ret);
10932 else
10933 return NULL;
10934}
10935
10936/**
10937 * process_proxy_new_for_bus_sync:
10938 * @bus_type: A #GBusType.
10939 * @flags: Flags from the #GDBusProxyFlags enumeration.
10940 * @name: A bus name (well-known or unique).
10941 * @object_path: An object path.
10942 * @cancellable: (allow-none): A #GCancellable or %NULL.
10943 * @error: Return location for error or %NULL
10944 *
10945 * Like process_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
10946 *
10947 * The calling thread is blocked until a reply is received.
10948 *
10949 * See process_proxy_new_for_bus() for the asynchronous version of this constructor.
10950 *
10951 * Returns: (transfer full) (type ProcessProxy): The constructed proxy object or %NULL if @error is set.
10952 */
10953Process *
10954process_proxy_new_for_bus_sync (
10955 GBusType bus_type,
10956 GDBusProxyFlags flags,
10957 const gchar *name,
10958 const gchar *object_path,
10959 GCancellable *cancellable,
10960 GError **error)
10961{
10962 GInitable *ret;
10963 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);
10964 if (ret != NULL)
10965 return PROCESS (ret);
10966 else
10967 return NULL;
10968}
10969
10970
10971/* ------------------------------------------------------------------------ */
10972
10973/**
10974 * ProcessSkeleton:
10975 *
10976 * The #ProcessSkeleton structure contains only private data and should only be accessed using the provided API.
10977 */
10978
10979/**
10980 * ProcessSkeletonClass:
10981 * @parent_class: The parent class.
10982 *
10983 * Class structure for #ProcessSkeleton.
10984 */
10985
10986struct _ProcessSkeletonPrivate
10987{
10988 GValue *properties;
10989 GList *changed_properties;
10990 GSource *changed_properties_idle_source;
10991 GMainContext *context;
10992 GMutex lock;
10993};
10994
10995static void
10996_process_skeleton_handle_method_call (
10997 GDBusConnection *connection G_GNUC_UNUSED,
10998 const gchar *sender G_GNUC_UNUSED,
10999 const gchar *object_path G_GNUC_UNUSED,
11000 const gchar *interface_name,
11001 const gchar *method_name,
11002 GVariant *parameters,
11003 GDBusMethodInvocation *invocation,
11004 gpointer user_data)
11005{
11006 ProcessSkeleton *skeleton = PROCESS_SKELETON (user_data);
11007 _ExtendedGDBusMethodInfo *info;
11008 GVariantIter iter;
11009 GVariant *child;
11010 GValue *paramv;
11011 guint num_params;
11012 guint num_extra;
11013 guint n;
11014 guint signal_id;
11015 GValue return_value = G_VALUE_INIT;
11016 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
11017 g_assert (info != NULL);
11018 num_params = g_variant_n_children (parameters);
11019 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
11020 n = 0;
11021 g_value_init (&paramv[n], TYPE_PROCESS);
11022 g_value_set_object (&paramv[n++], skeleton);
11023 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
11024 g_value_set_object (&paramv[n++], invocation);
11025 if (info->pass_fdlist)
11026 {
11027#ifdef G_OS_UNIX
11028 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
11029 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
11030#else
11031 g_assert_not_reached ();
11032#endif
11033 }
11034 g_variant_iter_init (&iter, parameters);
11035 while ((child = g_variant_iter_next_value (&iter)) != NULL)
11036 {
11037 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
11038 if (arg_info->use_gvariant)
11039 {
11040 g_value_init (&paramv[n], G_TYPE_VARIANT);
11041 g_value_set_variant (&paramv[n], child);
11042 n++;
11043 }
11044 else
11045 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
11046 g_variant_unref (child);
11047 }
11048 signal_id = g_signal_lookup (info->signal_name, TYPE_PROCESS);
11049 g_value_init (&return_value, G_TYPE_BOOLEAN);
11050 g_signal_emitv (paramv, signal_id, 0, &return_value);
11051 if (!g_value_get_boolean (&return_value))
11052 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);
11053 g_value_unset (&return_value);
11054 for (n = 0; n < num_params + num_extra; n++)
11055 g_value_unset (&paramv[n]);
11056 g_free (paramv);
11057}
11058
11059static GVariant *
11060_process_skeleton_handle_get_property (
11061 GDBusConnection *connection G_GNUC_UNUSED,
11062 const gchar *sender G_GNUC_UNUSED,
11063 const gchar *object_path G_GNUC_UNUSED,
11064 const gchar *interface_name G_GNUC_UNUSED,
11065 const gchar *property_name,
11066 GError **error,
11067 gpointer user_data)
11068{
11069 ProcessSkeleton *skeleton = PROCESS_SKELETON (user_data);
11070 GValue value = G_VALUE_INIT;
11071 GParamSpec *pspec;
11072 _ExtendedGDBusPropertyInfo *info;
11073 GVariant *ret;
11074 ret = NULL;
11075 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, property_name);
11076 g_assert (info != NULL);
11077 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
11078 if (pspec == NULL)
11079 {
11080 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
11081 }
11082 else
11083 {
11084 g_value_init (&value, pspec->value_type);
11085 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
11086 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
11087 g_value_unset (&value);
11088 }
11089 return ret;
11090}
11091
11092static gboolean
11093_process_skeleton_handle_set_property (
11094 GDBusConnection *connection G_GNUC_UNUSED,
11095 const gchar *sender G_GNUC_UNUSED,
11096 const gchar *object_path G_GNUC_UNUSED,
11097 const gchar *interface_name G_GNUC_UNUSED,
11098 const gchar *property_name,
11099 GVariant *variant,
11100 GError **error,
11101 gpointer user_data)
11102{
11103 ProcessSkeleton *skeleton = PROCESS_SKELETON (user_data);
11104 GValue value = G_VALUE_INIT;
11105 GParamSpec *pspec;
11106 _ExtendedGDBusPropertyInfo *info;
11107 gboolean ret;
11108 ret = FALSE;
11109 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, property_name);
11110 g_assert (info != NULL);
11111 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
11112 if (pspec == NULL)
11113 {
11114 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
11115 }
11116 else
11117 {
11118 if (info->use_gvariant)
11119 g_value_set_variant (&value, variant);
11120 else
11121 g_dbus_gvariant_to_gvalue (variant, &value);
11122 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
11123 g_value_unset (&value);
11124 ret = TRUE;
11125 }
11126 return ret;
11127}
11128
11129static const GDBusInterfaceVTable _process_skeleton_vtable =
11130{
11131 _process_skeleton_handle_method_call,
11132 _process_skeleton_handle_get_property,
11133 _process_skeleton_handle_set_property,
11134 {NULL}
11135};
11136
11137static GDBusInterfaceInfo *
11138process_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
11139{
11140 return process_interface_info ();
11141}
11142
11143static GDBusInterfaceVTable *
11144process_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
11145{
11146 return (GDBusInterfaceVTable *) &_process_skeleton_vtable;
11147}
11148
11149static GVariant *
11150process_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
11151{
11152 ProcessSkeleton *skeleton = PROCESS_SKELETON (_skeleton);
11153
11154 GVariantBuilder builder;
11155 guint n;
11156 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
11157 if (_process_interface_info.parent_struct.properties == NULL)
11158 goto out;
11159 for (n = 0; _process_interface_info.parent_struct.properties[n] != NULL; n++)
11160 {
11161 GDBusPropertyInfo *info = _process_interface_info.parent_struct.properties[n];
11162 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
11163 {
11164 GVariant *value;
11165 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);
11166 if (value != NULL)
11167 {
11168 g_variant_take_ref (value);
11169 g_variant_builder_add (&builder, "{sv}", info->name, value);
11170 g_variant_unref (value);
11171 }
11172 }
11173 }
11174out:
11175 return g_variant_builder_end (&builder);
11176}
11177
11178static void
11179process_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
11180{
11181}
11182
11183static void process_skeleton_iface_init (ProcessIface *iface);
11184#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
11185G_DEFINE_TYPE_WITH_CODE (ProcessSkeleton, process_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
11186 G_ADD_PRIVATE (ProcessSkeleton)
11187 G_IMPLEMENT_INTERFACE (TYPE_PROCESS, process_skeleton_iface_init));
11188
11189#else
11190G_DEFINE_TYPE_WITH_CODE (ProcessSkeleton, process_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
11191 G_IMPLEMENT_INTERFACE (TYPE_PROCESS, process_skeleton_iface_init));
11192
11193#endif
11194static void
11195process_skeleton_finalize (GObject *object)
11196{
11197 ProcessSkeleton *skeleton = PROCESS_SKELETON (object);
11198 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
11199 if (skeleton->priv->changed_properties_idle_source != NULL)
11200 g_source_destroy (skeleton->priv->changed_properties_idle_source);
11201 g_main_context_unref (skeleton->priv->context);
11202 g_mutex_clear (&skeleton->priv->lock);
11203 G_OBJECT_CLASS (process_skeleton_parent_class)->finalize (object);
11204}
11205
11206static void
11207process_skeleton_init (ProcessSkeleton *skeleton)
11208{
11209#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
11210 skeleton->priv = process_skeleton_get_instance_private (skeleton);
11211#else
11212 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_PROCESS_SKELETON, ProcessSkeletonPrivate);
11213#endif
11214
11215 g_mutex_init (&skeleton->priv->lock);
11216 skeleton->priv->context = g_main_context_ref_thread_default ();
11217}
11218
11219static void
11220process_skeleton_class_init (ProcessSkeletonClass *klass)
11221{
11222 GObjectClass *gobject_class;
11223 GDBusInterfaceSkeletonClass *skeleton_class;
11224
11225 gobject_class = G_OBJECT_CLASS (klass);
11226 gobject_class->finalize = process_skeleton_finalize;
11227
11228 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
11229 skeleton_class->get_info = process_skeleton_dbus_interface_get_info;
11230 skeleton_class->get_properties = process_skeleton_dbus_interface_get_properties;
11231 skeleton_class->flush = process_skeleton_dbus_interface_flush;
11232 skeleton_class->get_vtable = process_skeleton_dbus_interface_get_vtable;
11233
11234#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
11235 g_type_class_add_private (klass, sizeof (ProcessSkeletonPrivate));
11236#endif
11237}
11238
11239static void
11240process_skeleton_iface_init (ProcessIface *iface)
11241{
11242}
11243
11244/**
11245 * process_skeleton_new:
11246 *
11247 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link>.
11248 *
11249 * Returns: (transfer full) (type ProcessSkeleton): The skeleton object.
11250 */
11251Process *
11252process_skeleton_new (void)
11253{
11254 return PROCESS (g_object_new (TYPE_PROCESS_SKELETON, NULL));
11255}
11256
11257/* ------------------------------------------------------------------------
Norman James18998182015-10-11 21:54:53 -050011258 * Code for interface org.openbmc.SharedResource
11259 * ------------------------------------------------------------------------
11260 */
11261
11262/**
11263 * SECTION:SharedResource
11264 * @title: SharedResource
11265 * @short_description: Generated C code for the org.openbmc.SharedResource D-Bus interface
11266 *
11267 * 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.
11268 */
11269
11270/* ---- Introspection data for org.openbmc.SharedResource ---- */
11271
11272static const _ExtendedGDBusArgInfo _shared_resource_method_info_lock_IN_ARG_name =
11273{
11274 {
11275 -1,
11276 (gchar *) "name",
11277 (gchar *) "s",
11278 NULL
11279 },
11280 FALSE
11281};
11282
11283static const _ExtendedGDBusArgInfo * const _shared_resource_method_info_lock_IN_ARG_pointers[] =
11284{
11285 &_shared_resource_method_info_lock_IN_ARG_name,
11286 NULL
11287};
11288
11289static const _ExtendedGDBusMethodInfo _shared_resource_method_info_lock =
11290{
11291 {
11292 -1,
11293 (gchar *) "lock",
11294 (GDBusArgInfo **) &_shared_resource_method_info_lock_IN_ARG_pointers,
11295 NULL,
11296 NULL
11297 },
11298 "handle-lock",
11299 FALSE
11300};
11301
11302static const _ExtendedGDBusMethodInfo _shared_resource_method_info_unlock =
11303{
11304 {
11305 -1,
11306 (gchar *) "unlock",
11307 NULL,
11308 NULL,
11309 NULL
11310 },
11311 "handle-unlock",
11312 FALSE
11313};
11314
11315static const _ExtendedGDBusArgInfo _shared_resource_method_info_is_locked_OUT_ARG_lock =
11316{
11317 {
11318 -1,
11319 (gchar *) "lock",
11320 (gchar *) "b",
11321 NULL
11322 },
11323 FALSE
11324};
11325
11326static const _ExtendedGDBusArgInfo _shared_resource_method_info_is_locked_OUT_ARG_name =
11327{
11328 {
11329 -1,
11330 (gchar *) "name",
11331 (gchar *) "s",
11332 NULL
11333 },
11334 FALSE
11335};
11336
11337static const _ExtendedGDBusArgInfo * const _shared_resource_method_info_is_locked_OUT_ARG_pointers[] =
11338{
11339 &_shared_resource_method_info_is_locked_OUT_ARG_lock,
11340 &_shared_resource_method_info_is_locked_OUT_ARG_name,
11341 NULL
11342};
11343
11344static const _ExtendedGDBusMethodInfo _shared_resource_method_info_is_locked =
11345{
11346 {
11347 -1,
11348 (gchar *) "isLocked",
11349 NULL,
11350 (GDBusArgInfo **) &_shared_resource_method_info_is_locked_OUT_ARG_pointers,
11351 NULL
11352 },
11353 "handle-is-locked",
11354 FALSE
11355};
11356
11357static const _ExtendedGDBusMethodInfo * const _shared_resource_method_info_pointers[] =
11358{
11359 &_shared_resource_method_info_lock,
11360 &_shared_resource_method_info_unlock,
11361 &_shared_resource_method_info_is_locked,
11362 NULL
11363};
11364
11365static const _ExtendedGDBusPropertyInfo _shared_resource_property_info_lock =
11366{
11367 {
11368 -1,
11369 (gchar *) "lock",
11370 (gchar *) "b",
11371 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
11372 NULL
11373 },
11374 "lock",
11375 FALSE
11376};
11377
11378static const _ExtendedGDBusPropertyInfo _shared_resource_property_info_name =
11379{
11380 {
11381 -1,
11382 (gchar *) "name",
11383 (gchar *) "s",
11384 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
11385 NULL
11386 },
11387 "name",
11388 FALSE
11389};
11390
11391static const _ExtendedGDBusPropertyInfo * const _shared_resource_property_info_pointers[] =
11392{
11393 &_shared_resource_property_info_lock,
11394 &_shared_resource_property_info_name,
11395 NULL
11396};
11397
11398static const _ExtendedGDBusInterfaceInfo _shared_resource_interface_info =
11399{
11400 {
11401 -1,
11402 (gchar *) "org.openbmc.SharedResource",
11403 (GDBusMethodInfo **) &_shared_resource_method_info_pointers,
11404 NULL,
11405 (GDBusPropertyInfo **) &_shared_resource_property_info_pointers,
11406 NULL
11407 },
11408 "shared-resource",
11409};
11410
11411
11412/**
11413 * shared_resource_interface_info:
11414 *
11415 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link> D-Bus interface.
11416 *
11417 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
11418 */
11419GDBusInterfaceInfo *
11420shared_resource_interface_info (void)
11421{
11422 return (GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct;
11423}
11424
11425/**
11426 * shared_resource_override_properties:
11427 * @klass: The class structure for a #GObject<!-- -->-derived class.
11428 * @property_id_begin: The property id to assign to the first overridden property.
11429 *
11430 * Overrides all #GObject properties in the #SharedResource interface for a concrete class.
11431 * The properties are overridden in the order they are defined.
11432 *
11433 * Returns: The last property id.
11434 */
11435guint
11436shared_resource_override_properties (GObjectClass *klass, guint property_id_begin)
11437{
11438 g_object_class_override_property (klass, property_id_begin++, "lock");
11439 g_object_class_override_property (klass, property_id_begin++, "name");
11440 return property_id_begin - 1;
11441}
11442
11443
11444
11445/**
11446 * SharedResource:
11447 *
11448 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link>.
11449 */
11450
11451/**
11452 * SharedResourceIface:
11453 * @parent_iface: The parent interface.
11454 * @handle_is_locked: Handler for the #SharedResource::handle-is-locked signal.
11455 * @handle_lock: Handler for the #SharedResource::handle-lock signal.
11456 * @handle_unlock: Handler for the #SharedResource::handle-unlock signal.
11457 * @get_lock: Getter for the #SharedResource:lock property.
11458 * @get_name: Getter for the #SharedResource:name property.
11459 *
11460 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link>.
11461 */
11462
11463typedef SharedResourceIface SharedResourceInterface;
11464G_DEFINE_INTERFACE (SharedResource, shared_resource, G_TYPE_OBJECT);
11465
11466static void
11467shared_resource_default_init (SharedResourceIface *iface)
11468{
11469 /* GObject signals for incoming D-Bus method calls: */
11470 /**
11471 * SharedResource::handle-lock:
11472 * @object: A #SharedResource.
11473 * @invocation: A #GDBusMethodInvocation.
11474 * @arg_name: Argument passed by remote caller.
11475 *
11476 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SharedResource.lock">lock()</link> D-Bus method.
11477 *
11478 * 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.
11479 *
11480 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
11481 */
11482 g_signal_new ("handle-lock",
11483 G_TYPE_FROM_INTERFACE (iface),
11484 G_SIGNAL_RUN_LAST,
11485 G_STRUCT_OFFSET (SharedResourceIface, handle_lock),
11486 g_signal_accumulator_true_handled,
11487 NULL,
11488 g_cclosure_marshal_generic,
11489 G_TYPE_BOOLEAN,
11490 2,
11491 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING);
11492
11493 /**
11494 * SharedResource::handle-unlock:
11495 * @object: A #SharedResource.
11496 * @invocation: A #GDBusMethodInvocation.
11497 *
11498 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SharedResource.unlock">unlock()</link> D-Bus method.
11499 *
11500 * 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.
11501 *
11502 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
11503 */
11504 g_signal_new ("handle-unlock",
11505 G_TYPE_FROM_INTERFACE (iface),
11506 G_SIGNAL_RUN_LAST,
11507 G_STRUCT_OFFSET (SharedResourceIface, handle_unlock),
11508 g_signal_accumulator_true_handled,
11509 NULL,
11510 g_cclosure_marshal_generic,
11511 G_TYPE_BOOLEAN,
11512 1,
11513 G_TYPE_DBUS_METHOD_INVOCATION);
11514
11515 /**
11516 * SharedResource::handle-is-locked:
11517 * @object: A #SharedResource.
11518 * @invocation: A #GDBusMethodInvocation.
11519 *
11520 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SharedResource.isLocked">isLocked()</link> D-Bus method.
11521 *
11522 * 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.
11523 *
11524 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
11525 */
11526 g_signal_new ("handle-is-locked",
11527 G_TYPE_FROM_INTERFACE (iface),
11528 G_SIGNAL_RUN_LAST,
11529 G_STRUCT_OFFSET (SharedResourceIface, handle_is_locked),
11530 g_signal_accumulator_true_handled,
11531 NULL,
11532 g_cclosure_marshal_generic,
11533 G_TYPE_BOOLEAN,
11534 1,
11535 G_TYPE_DBUS_METHOD_INVOCATION);
11536
11537 /* GObject properties for D-Bus properties: */
11538 /**
11539 * SharedResource:lock:
11540 *
11541 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SharedResource.lock">"lock"</link>.
11542 *
11543 * 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.
11544 */
11545 g_object_interface_install_property (iface,
11546 g_param_spec_boolean ("lock", "lock", "lock", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
11547 /**
11548 * SharedResource:name:
11549 *
11550 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SharedResource.name">"name"</link>.
11551 *
11552 * 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.
11553 */
11554 g_object_interface_install_property (iface,
11555 g_param_spec_string ("name", "name", "name", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
11556}
11557
11558/**
11559 * shared_resource_get_lock: (skip)
11560 * @object: A #SharedResource.
11561 *
11562 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SharedResource.lock">"lock"</link> D-Bus property.
11563 *
11564 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
11565 *
11566 * Returns: The property value.
11567 */
11568gboolean
11569shared_resource_get_lock (SharedResource *object)
11570{
11571 return SHARED_RESOURCE_GET_IFACE (object)->get_lock (object);
11572}
11573
11574/**
11575 * shared_resource_set_lock: (skip)
11576 * @object: A #SharedResource.
11577 * @value: The value to set.
11578 *
11579 * Sets the <link linkend="gdbus-property-org-openbmc-SharedResource.lock">"lock"</link> D-Bus property to @value.
11580 *
11581 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
11582 */
11583void
11584shared_resource_set_lock (SharedResource *object, gboolean value)
11585{
11586 g_object_set (G_OBJECT (object), "lock", value, NULL);
11587}
11588
11589/**
11590 * shared_resource_get_name: (skip)
11591 * @object: A #SharedResource.
11592 *
11593 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SharedResource.name">"name"</link> D-Bus property.
11594 *
11595 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
11596 *
11597 * <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>
11598 *
11599 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
11600 */
11601const gchar *
11602shared_resource_get_name (SharedResource *object)
11603{
11604 return SHARED_RESOURCE_GET_IFACE (object)->get_name (object);
11605}
11606
11607/**
11608 * shared_resource_dup_name: (skip)
11609 * @object: A #SharedResource.
11610 *
11611 * Gets a copy 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 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
11616 */
11617gchar *
11618shared_resource_dup_name (SharedResource *object)
11619{
11620 gchar *value;
11621 g_object_get (G_OBJECT (object), "name", &value, NULL);
11622 return value;
11623}
11624
11625/**
11626 * shared_resource_set_name: (skip)
11627 * @object: A #SharedResource.
11628 * @value: The value to set.
11629 *
11630 * Sets the <link linkend="gdbus-property-org-openbmc-SharedResource.name">"name"</link> D-Bus property to @value.
11631 *
11632 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
11633 */
11634void
11635shared_resource_set_name (SharedResource *object, const gchar *value)
11636{
11637 g_object_set (G_OBJECT (object), "name", value, NULL);
11638}
11639
11640/**
11641 * shared_resource_call_lock:
11642 * @proxy: A #SharedResourceProxy.
11643 * @arg_name: Argument to pass with the method invocation.
11644 * @cancellable: (allow-none): A #GCancellable or %NULL.
11645 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
11646 * @user_data: User data to pass to @callback.
11647 *
11648 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SharedResource.lock">lock()</link> D-Bus method on @proxy.
11649 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
11650 * You can then call shared_resource_call_lock_finish() to get the result of the operation.
11651 *
11652 * See shared_resource_call_lock_sync() for the synchronous, blocking version of this method.
11653 */
11654void
11655shared_resource_call_lock (
11656 SharedResource *proxy,
11657 const gchar *arg_name,
11658 GCancellable *cancellable,
11659 GAsyncReadyCallback callback,
11660 gpointer user_data)
11661{
11662 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
11663 "lock",
11664 g_variant_new ("(s)",
11665 arg_name),
11666 G_DBUS_CALL_FLAGS_NONE,
11667 -1,
11668 cancellable,
11669 callback,
11670 user_data);
11671}
11672
11673/**
11674 * shared_resource_call_lock_finish:
11675 * @proxy: A #SharedResourceProxy.
11676 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to shared_resource_call_lock().
11677 * @error: Return location for error or %NULL.
11678 *
11679 * Finishes an operation started with shared_resource_call_lock().
11680 *
11681 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
11682 */
11683gboolean
11684shared_resource_call_lock_finish (
11685 SharedResource *proxy,
11686 GAsyncResult *res,
11687 GError **error)
11688{
11689 GVariant *_ret;
11690 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
11691 if (_ret == NULL)
11692 goto _out;
11693 g_variant_get (_ret,
11694 "()");
11695 g_variant_unref (_ret);
11696_out:
11697 return _ret != NULL;
11698}
11699
11700/**
11701 * shared_resource_call_lock_sync:
11702 * @proxy: A #SharedResourceProxy.
11703 * @arg_name: Argument to pass with the method invocation.
11704 * @cancellable: (allow-none): A #GCancellable or %NULL.
11705 * @error: Return location for error or %NULL.
11706 *
11707 * 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.
11708 *
11709 * See shared_resource_call_lock() for the asynchronous version of this method.
11710 *
11711 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
11712 */
11713gboolean
11714shared_resource_call_lock_sync (
11715 SharedResource *proxy,
11716 const gchar *arg_name,
11717 GCancellable *cancellable,
11718 GError **error)
11719{
11720 GVariant *_ret;
11721 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
11722 "lock",
11723 g_variant_new ("(s)",
11724 arg_name),
11725 G_DBUS_CALL_FLAGS_NONE,
11726 -1,
11727 cancellable,
11728 error);
11729 if (_ret == NULL)
11730 goto _out;
11731 g_variant_get (_ret,
11732 "()");
11733 g_variant_unref (_ret);
11734_out:
11735 return _ret != NULL;
11736}
11737
11738/**
11739 * shared_resource_call_unlock:
11740 * @proxy: A #SharedResourceProxy.
11741 * @cancellable: (allow-none): A #GCancellable or %NULL.
11742 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
11743 * @user_data: User data to pass to @callback.
11744 *
11745 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SharedResource.unlock">unlock()</link> D-Bus method on @proxy.
11746 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
11747 * You can then call shared_resource_call_unlock_finish() to get the result of the operation.
11748 *
11749 * See shared_resource_call_unlock_sync() for the synchronous, blocking version of this method.
11750 */
11751void
11752shared_resource_call_unlock (
11753 SharedResource *proxy,
11754 GCancellable *cancellable,
11755 GAsyncReadyCallback callback,
11756 gpointer user_data)
11757{
11758 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
11759 "unlock",
11760 g_variant_new ("()"),
11761 G_DBUS_CALL_FLAGS_NONE,
11762 -1,
11763 cancellable,
11764 callback,
11765 user_data);
11766}
11767
11768/**
11769 * shared_resource_call_unlock_finish:
11770 * @proxy: A #SharedResourceProxy.
11771 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to shared_resource_call_unlock().
11772 * @error: Return location for error or %NULL.
11773 *
11774 * Finishes an operation started with shared_resource_call_unlock().
11775 *
11776 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
11777 */
11778gboolean
11779shared_resource_call_unlock_finish (
11780 SharedResource *proxy,
11781 GAsyncResult *res,
11782 GError **error)
11783{
11784 GVariant *_ret;
11785 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
11786 if (_ret == NULL)
11787 goto _out;
11788 g_variant_get (_ret,
11789 "()");
11790 g_variant_unref (_ret);
11791_out:
11792 return _ret != NULL;
11793}
11794
11795/**
11796 * shared_resource_call_unlock_sync:
11797 * @proxy: A #SharedResourceProxy.
11798 * @cancellable: (allow-none): A #GCancellable or %NULL.
11799 * @error: Return location for error or %NULL.
11800 *
11801 * 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.
11802 *
11803 * See shared_resource_call_unlock() for the asynchronous version of this method.
11804 *
11805 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
11806 */
11807gboolean
11808shared_resource_call_unlock_sync (
11809 SharedResource *proxy,
11810 GCancellable *cancellable,
11811 GError **error)
11812{
11813 GVariant *_ret;
11814 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
11815 "unlock",
11816 g_variant_new ("()"),
11817 G_DBUS_CALL_FLAGS_NONE,
11818 -1,
11819 cancellable,
11820 error);
11821 if (_ret == NULL)
11822 goto _out;
11823 g_variant_get (_ret,
11824 "()");
11825 g_variant_unref (_ret);
11826_out:
11827 return _ret != NULL;
11828}
11829
11830/**
11831 * shared_resource_call_is_locked:
11832 * @proxy: A #SharedResourceProxy.
11833 * @cancellable: (allow-none): A #GCancellable or %NULL.
11834 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
11835 * @user_data: User data to pass to @callback.
11836 *
11837 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SharedResource.isLocked">isLocked()</link> D-Bus method on @proxy.
11838 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
11839 * You can then call shared_resource_call_is_locked_finish() to get the result of the operation.
11840 *
11841 * See shared_resource_call_is_locked_sync() for the synchronous, blocking version of this method.
11842 */
11843void
11844shared_resource_call_is_locked (
11845 SharedResource *proxy,
11846 GCancellable *cancellable,
11847 GAsyncReadyCallback callback,
11848 gpointer user_data)
11849{
11850 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
11851 "isLocked",
11852 g_variant_new ("()"),
11853 G_DBUS_CALL_FLAGS_NONE,
11854 -1,
11855 cancellable,
11856 callback,
11857 user_data);
11858}
11859
11860/**
11861 * shared_resource_call_is_locked_finish:
11862 * @proxy: A #SharedResourceProxy.
11863 * @out_lock: (out): Return location for return parameter or %NULL to ignore.
11864 * @out_name: (out): Return location for return parameter or %NULL to ignore.
11865 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to shared_resource_call_is_locked().
11866 * @error: Return location for error or %NULL.
11867 *
11868 * Finishes an operation started with shared_resource_call_is_locked().
11869 *
11870 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
11871 */
11872gboolean
11873shared_resource_call_is_locked_finish (
11874 SharedResource *proxy,
11875 gboolean *out_lock,
11876 gchar **out_name,
11877 GAsyncResult *res,
11878 GError **error)
11879{
11880 GVariant *_ret;
11881 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
11882 if (_ret == NULL)
11883 goto _out;
11884 g_variant_get (_ret,
11885 "(bs)",
11886 out_lock,
11887 out_name);
11888 g_variant_unref (_ret);
11889_out:
11890 return _ret != NULL;
11891}
11892
11893/**
11894 * shared_resource_call_is_locked_sync:
11895 * @proxy: A #SharedResourceProxy.
11896 * @out_lock: (out): Return location for return parameter or %NULL to ignore.
11897 * @out_name: (out): Return location for return parameter or %NULL to ignore.
11898 * @cancellable: (allow-none): A #GCancellable or %NULL.
11899 * @error: Return location for error or %NULL.
11900 *
11901 * 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.
11902 *
11903 * See shared_resource_call_is_locked() for the asynchronous version of this method.
11904 *
11905 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
11906 */
11907gboolean
11908shared_resource_call_is_locked_sync (
11909 SharedResource *proxy,
11910 gboolean *out_lock,
11911 gchar **out_name,
11912 GCancellable *cancellable,
11913 GError **error)
11914{
11915 GVariant *_ret;
11916 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
11917 "isLocked",
11918 g_variant_new ("()"),
11919 G_DBUS_CALL_FLAGS_NONE,
11920 -1,
11921 cancellable,
11922 error);
11923 if (_ret == NULL)
11924 goto _out;
11925 g_variant_get (_ret,
11926 "(bs)",
11927 out_lock,
11928 out_name);
11929 g_variant_unref (_ret);
11930_out:
11931 return _ret != NULL;
11932}
11933
11934/**
11935 * shared_resource_complete_lock:
11936 * @object: A #SharedResource.
11937 * @invocation: (transfer full): A #GDBusMethodInvocation.
11938 *
11939 * 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.
11940 *
11941 * This method will free @invocation, you cannot use it afterwards.
11942 */
11943void
11944shared_resource_complete_lock (
11945 SharedResource *object,
11946 GDBusMethodInvocation *invocation)
11947{
11948 g_dbus_method_invocation_return_value (invocation,
11949 g_variant_new ("()"));
11950}
11951
11952/**
11953 * shared_resource_complete_unlock:
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.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.
11958 *
11959 * This method will free @invocation, you cannot use it afterwards.
11960 */
11961void
11962shared_resource_complete_unlock (
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_is_locked:
11972 * @object: A #SharedResource.
11973 * @invocation: (transfer full): A #GDBusMethodInvocation.
11974 * @lock: Parameter to return.
11975 * @name: Parameter to return.
11976 *
11977 * 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.
11978 *
11979 * This method will free @invocation, you cannot use it afterwards.
11980 */
11981void
11982shared_resource_complete_is_locked (
11983 SharedResource *object,
11984 GDBusMethodInvocation *invocation,
11985 gboolean lock,
11986 const gchar *name)
11987{
11988 g_dbus_method_invocation_return_value (invocation,
11989 g_variant_new ("(bs)",
11990 lock,
11991 name));
11992}
11993
11994/* ------------------------------------------------------------------------ */
11995
11996/**
11997 * SharedResourceProxy:
11998 *
11999 * The #SharedResourceProxy structure contains only private data and should only be accessed using the provided API.
12000 */
12001
12002/**
12003 * SharedResourceProxyClass:
12004 * @parent_class: The parent class.
12005 *
12006 * Class structure for #SharedResourceProxy.
12007 */
12008
12009struct _SharedResourceProxyPrivate
12010{
12011 GData *qdata;
12012};
12013
12014static void shared_resource_proxy_iface_init (SharedResourceIface *iface);
12015
12016#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
12017G_DEFINE_TYPE_WITH_CODE (SharedResourceProxy, shared_resource_proxy, G_TYPE_DBUS_PROXY,
12018 G_ADD_PRIVATE (SharedResourceProxy)
12019 G_IMPLEMENT_INTERFACE (TYPE_SHARED_RESOURCE, shared_resource_proxy_iface_init));
12020
12021#else
12022G_DEFINE_TYPE_WITH_CODE (SharedResourceProxy, shared_resource_proxy, G_TYPE_DBUS_PROXY,
12023 G_IMPLEMENT_INTERFACE (TYPE_SHARED_RESOURCE, shared_resource_proxy_iface_init));
12024
12025#endif
12026static void
12027shared_resource_proxy_finalize (GObject *object)
12028{
12029 SharedResourceProxy *proxy = SHARED_RESOURCE_PROXY (object);
12030 g_datalist_clear (&proxy->priv->qdata);
12031 G_OBJECT_CLASS (shared_resource_proxy_parent_class)->finalize (object);
12032}
12033
12034static void
12035shared_resource_proxy_get_property (GObject *object,
12036 guint prop_id,
12037 GValue *value,
12038 GParamSpec *pspec G_GNUC_UNUSED)
12039{
12040 const _ExtendedGDBusPropertyInfo *info;
12041 GVariant *variant;
12042 g_assert (prop_id != 0 && prop_id - 1 < 2);
12043 info = _shared_resource_property_info_pointers[prop_id - 1];
12044 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
12045 if (info->use_gvariant)
12046 {
12047 g_value_set_variant (value, variant);
12048 }
12049 else
12050 {
12051 if (variant != NULL)
12052 g_dbus_gvariant_to_gvalue (variant, value);
12053 }
12054 if (variant != NULL)
12055 g_variant_unref (variant);
12056}
12057
12058static void
12059shared_resource_proxy_set_property_cb (GDBusProxy *proxy,
12060 GAsyncResult *res,
12061 gpointer user_data)
12062{
12063 const _ExtendedGDBusPropertyInfo *info = user_data;
12064 GError *error;
12065 GVariant *_ret;
12066 error = NULL;
12067 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
12068 if (!_ret)
12069 {
12070 g_warning ("Error setting property '%s' on interface org.openbmc.SharedResource: %s (%s, %d)",
12071 info->parent_struct.name,
12072 error->message, g_quark_to_string (error->domain), error->code);
12073 g_error_free (error);
12074 }
12075 else
12076 {
12077 g_variant_unref (_ret);
12078 }
12079}
12080
12081static void
12082shared_resource_proxy_set_property (GObject *object,
12083 guint prop_id,
12084 const GValue *value,
12085 GParamSpec *pspec G_GNUC_UNUSED)
12086{
12087 const _ExtendedGDBusPropertyInfo *info;
12088 GVariant *variant;
12089 g_assert (prop_id != 0 && prop_id - 1 < 2);
12090 info = _shared_resource_property_info_pointers[prop_id - 1];
12091 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
12092 g_dbus_proxy_call (G_DBUS_PROXY (object),
12093 "org.freedesktop.DBus.Properties.Set",
12094 g_variant_new ("(ssv)", "org.openbmc.SharedResource", info->parent_struct.name, variant),
12095 G_DBUS_CALL_FLAGS_NONE,
12096 -1,
12097 NULL, (GAsyncReadyCallback) shared_resource_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
12098 g_variant_unref (variant);
12099}
12100
12101static void
12102shared_resource_proxy_g_signal (GDBusProxy *proxy,
12103 const gchar *sender_name G_GNUC_UNUSED,
12104 const gchar *signal_name,
12105 GVariant *parameters)
12106{
12107 _ExtendedGDBusSignalInfo *info;
12108 GVariantIter iter;
12109 GVariant *child;
12110 GValue *paramv;
12111 guint num_params;
12112 guint n;
12113 guint signal_id;
12114 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct, signal_name);
12115 if (info == NULL)
12116 return;
12117 num_params = g_variant_n_children (parameters);
12118 paramv = g_new0 (GValue, num_params + 1);
12119 g_value_init (&paramv[0], TYPE_SHARED_RESOURCE);
12120 g_value_set_object (&paramv[0], proxy);
12121 g_variant_iter_init (&iter, parameters);
12122 n = 1;
12123 while ((child = g_variant_iter_next_value (&iter)) != NULL)
12124 {
12125 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
12126 if (arg_info->use_gvariant)
12127 {
12128 g_value_init (&paramv[n], G_TYPE_VARIANT);
12129 g_value_set_variant (&paramv[n], child);
12130 n++;
12131 }
12132 else
12133 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
12134 g_variant_unref (child);
12135 }
12136 signal_id = g_signal_lookup (info->signal_name, TYPE_SHARED_RESOURCE);
12137 g_signal_emitv (paramv, signal_id, 0, NULL);
12138 for (n = 0; n < num_params + 1; n++)
12139 g_value_unset (&paramv[n]);
12140 g_free (paramv);
12141}
12142
12143static void
12144shared_resource_proxy_g_properties_changed (GDBusProxy *_proxy,
12145 GVariant *changed_properties,
12146 const gchar *const *invalidated_properties)
12147{
12148 SharedResourceProxy *proxy = SHARED_RESOURCE_PROXY (_proxy);
12149 guint n;
12150 const gchar *key;
12151 GVariantIter *iter;
12152 _ExtendedGDBusPropertyInfo *info;
12153 g_variant_get (changed_properties, "a{sv}", &iter);
12154 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
12155 {
12156 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct, key);
12157 g_datalist_remove_data (&proxy->priv->qdata, key);
12158 if (info != NULL)
12159 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
12160 }
12161 g_variant_iter_free (iter);
12162 for (n = 0; invalidated_properties[n] != NULL; n++)
12163 {
12164 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct, invalidated_properties[n]);
12165 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
12166 if (info != NULL)
12167 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
12168 }
12169}
12170
12171static gboolean
12172shared_resource_proxy_get_lock (SharedResource *object)
12173{
12174 SharedResourceProxy *proxy = SHARED_RESOURCE_PROXY (object);
12175 GVariant *variant;
12176 gboolean value = 0;
12177 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "lock");
12178 if (variant != NULL)
12179 {
12180 value = g_variant_get_boolean (variant);
12181 g_variant_unref (variant);
12182 }
12183 return value;
12184}
12185
12186static const gchar *
12187shared_resource_proxy_get_name (SharedResource *object)
12188{
12189 SharedResourceProxy *proxy = SHARED_RESOURCE_PROXY (object);
12190 GVariant *variant;
12191 const gchar *value = NULL;
12192 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "name");
12193 if (variant != NULL)
12194 {
12195 value = g_variant_get_string (variant, NULL);
12196 g_variant_unref (variant);
12197 }
12198 return value;
12199}
12200
12201static void
12202shared_resource_proxy_init (SharedResourceProxy *proxy)
12203{
12204#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
12205 proxy->priv = shared_resource_proxy_get_instance_private (proxy);
12206#else
12207 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SHARED_RESOURCE_PROXY, SharedResourceProxyPrivate);
12208#endif
12209
12210 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), shared_resource_interface_info ());
12211}
12212
12213static void
12214shared_resource_proxy_class_init (SharedResourceProxyClass *klass)
12215{
12216 GObjectClass *gobject_class;
12217 GDBusProxyClass *proxy_class;
12218
12219 gobject_class = G_OBJECT_CLASS (klass);
12220 gobject_class->finalize = shared_resource_proxy_finalize;
12221 gobject_class->get_property = shared_resource_proxy_get_property;
12222 gobject_class->set_property = shared_resource_proxy_set_property;
12223
12224 proxy_class = G_DBUS_PROXY_CLASS (klass);
12225 proxy_class->g_signal = shared_resource_proxy_g_signal;
12226 proxy_class->g_properties_changed = shared_resource_proxy_g_properties_changed;
12227
12228 shared_resource_override_properties (gobject_class, 1);
12229
12230#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
12231 g_type_class_add_private (klass, sizeof (SharedResourceProxyPrivate));
12232#endif
12233}
12234
12235static void
12236shared_resource_proxy_iface_init (SharedResourceIface *iface)
12237{
12238 iface->get_lock = shared_resource_proxy_get_lock;
12239 iface->get_name = shared_resource_proxy_get_name;
12240}
12241
12242/**
12243 * shared_resource_proxy_new:
12244 * @connection: A #GDBusConnection.
12245 * @flags: Flags from the #GDBusProxyFlags enumeration.
12246 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
12247 * @object_path: An object path.
12248 * @cancellable: (allow-none): A #GCancellable or %NULL.
12249 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
12250 * @user_data: User data to pass to @callback.
12251 *
12252 * 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.
12253 *
12254 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
12255 * You can then call shared_resource_proxy_new_finish() to get the result of the operation.
12256 *
12257 * See shared_resource_proxy_new_sync() for the synchronous, blocking version of this constructor.
12258 */
12259void
12260shared_resource_proxy_new (
12261 GDBusConnection *connection,
12262 GDBusProxyFlags flags,
12263 const gchar *name,
12264 const gchar *object_path,
12265 GCancellable *cancellable,
12266 GAsyncReadyCallback callback,
12267 gpointer user_data)
12268{
12269 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);
12270}
12271
12272/**
12273 * shared_resource_proxy_new_finish:
12274 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to shared_resource_proxy_new().
12275 * @error: Return location for error or %NULL
12276 *
12277 * Finishes an operation started with shared_resource_proxy_new().
12278 *
12279 * Returns: (transfer full) (type SharedResourceProxy): The constructed proxy object or %NULL if @error is set.
12280 */
12281SharedResource *
12282shared_resource_proxy_new_finish (
12283 GAsyncResult *res,
12284 GError **error)
12285{
12286 GObject *ret;
12287 GObject *source_object;
12288 source_object = g_async_result_get_source_object (res);
12289 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
12290 g_object_unref (source_object);
12291 if (ret != NULL)
12292 return SHARED_RESOURCE (ret);
12293 else
12294 return NULL;
12295}
12296
12297/**
12298 * shared_resource_proxy_new_sync:
12299 * @connection: A #GDBusConnection.
12300 * @flags: Flags from the #GDBusProxyFlags enumeration.
12301 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
12302 * @object_path: An object path.
12303 * @cancellable: (allow-none): A #GCancellable or %NULL.
12304 * @error: Return location for error or %NULL
12305 *
12306 * 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.
12307 *
12308 * The calling thread is blocked until a reply is received.
12309 *
12310 * See shared_resource_proxy_new() for the asynchronous version of this constructor.
12311 *
12312 * Returns: (transfer full) (type SharedResourceProxy): The constructed proxy object or %NULL if @error is set.
12313 */
12314SharedResource *
12315shared_resource_proxy_new_sync (
12316 GDBusConnection *connection,
12317 GDBusProxyFlags flags,
12318 const gchar *name,
12319 const gchar *object_path,
12320 GCancellable *cancellable,
12321 GError **error)
12322{
12323 GInitable *ret;
12324 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);
12325 if (ret != NULL)
12326 return SHARED_RESOURCE (ret);
12327 else
12328 return NULL;
12329}
12330
12331
12332/**
12333 * shared_resource_proxy_new_for_bus:
12334 * @bus_type: A #GBusType.
12335 * @flags: Flags from the #GDBusProxyFlags enumeration.
12336 * @name: A bus name (well-known or unique).
12337 * @object_path: An object path.
12338 * @cancellable: (allow-none): A #GCancellable or %NULL.
12339 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
12340 * @user_data: User data to pass to @callback.
12341 *
12342 * Like shared_resource_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
12343 *
12344 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
12345 * You can then call shared_resource_proxy_new_for_bus_finish() to get the result of the operation.
12346 *
12347 * See shared_resource_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
12348 */
12349void
12350shared_resource_proxy_new_for_bus (
12351 GBusType bus_type,
12352 GDBusProxyFlags flags,
12353 const gchar *name,
12354 const gchar *object_path,
12355 GCancellable *cancellable,
12356 GAsyncReadyCallback callback,
12357 gpointer user_data)
12358{
12359 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);
12360}
12361
12362/**
12363 * shared_resource_proxy_new_for_bus_finish:
12364 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to shared_resource_proxy_new_for_bus().
12365 * @error: Return location for error or %NULL
12366 *
12367 * Finishes an operation started with shared_resource_proxy_new_for_bus().
12368 *
12369 * Returns: (transfer full) (type SharedResourceProxy): The constructed proxy object or %NULL if @error is set.
12370 */
12371SharedResource *
12372shared_resource_proxy_new_for_bus_finish (
12373 GAsyncResult *res,
12374 GError **error)
12375{
12376 GObject *ret;
12377 GObject *source_object;
12378 source_object = g_async_result_get_source_object (res);
12379 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
12380 g_object_unref (source_object);
12381 if (ret != NULL)
12382 return SHARED_RESOURCE (ret);
12383 else
12384 return NULL;
12385}
12386
12387/**
12388 * shared_resource_proxy_new_for_bus_sync:
12389 * @bus_type: A #GBusType.
12390 * @flags: Flags from the #GDBusProxyFlags enumeration.
12391 * @name: A bus name (well-known or unique).
12392 * @object_path: An object path.
12393 * @cancellable: (allow-none): A #GCancellable or %NULL.
12394 * @error: Return location for error or %NULL
12395 *
12396 * Like shared_resource_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
12397 *
12398 * The calling thread is blocked until a reply is received.
12399 *
12400 * See shared_resource_proxy_new_for_bus() for the asynchronous version of this constructor.
12401 *
12402 * Returns: (transfer full) (type SharedResourceProxy): The constructed proxy object or %NULL if @error is set.
12403 */
12404SharedResource *
12405shared_resource_proxy_new_for_bus_sync (
12406 GBusType bus_type,
12407 GDBusProxyFlags flags,
12408 const gchar *name,
12409 const gchar *object_path,
12410 GCancellable *cancellable,
12411 GError **error)
12412{
12413 GInitable *ret;
12414 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);
12415 if (ret != NULL)
12416 return SHARED_RESOURCE (ret);
12417 else
12418 return NULL;
12419}
12420
12421
12422/* ------------------------------------------------------------------------ */
12423
12424/**
12425 * SharedResourceSkeleton:
12426 *
12427 * The #SharedResourceSkeleton structure contains only private data and should only be accessed using the provided API.
12428 */
12429
12430/**
12431 * SharedResourceSkeletonClass:
12432 * @parent_class: The parent class.
12433 *
12434 * Class structure for #SharedResourceSkeleton.
12435 */
12436
12437struct _SharedResourceSkeletonPrivate
12438{
12439 GValue *properties;
12440 GList *changed_properties;
12441 GSource *changed_properties_idle_source;
12442 GMainContext *context;
12443 GMutex lock;
12444};
12445
12446static void
12447_shared_resource_skeleton_handle_method_call (
12448 GDBusConnection *connection G_GNUC_UNUSED,
12449 const gchar *sender G_GNUC_UNUSED,
12450 const gchar *object_path G_GNUC_UNUSED,
12451 const gchar *interface_name,
12452 const gchar *method_name,
12453 GVariant *parameters,
12454 GDBusMethodInvocation *invocation,
12455 gpointer user_data)
12456{
12457 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (user_data);
12458 _ExtendedGDBusMethodInfo *info;
12459 GVariantIter iter;
12460 GVariant *child;
12461 GValue *paramv;
12462 guint num_params;
12463 guint num_extra;
12464 guint n;
12465 guint signal_id;
12466 GValue return_value = G_VALUE_INIT;
12467 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
12468 g_assert (info != NULL);
12469 num_params = g_variant_n_children (parameters);
12470 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
12471 n = 0;
12472 g_value_init (&paramv[n], TYPE_SHARED_RESOURCE);
12473 g_value_set_object (&paramv[n++], skeleton);
12474 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
12475 g_value_set_object (&paramv[n++], invocation);
12476 if (info->pass_fdlist)
12477 {
12478#ifdef G_OS_UNIX
12479 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
12480 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
12481#else
12482 g_assert_not_reached ();
12483#endif
12484 }
12485 g_variant_iter_init (&iter, parameters);
12486 while ((child = g_variant_iter_next_value (&iter)) != NULL)
12487 {
12488 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
12489 if (arg_info->use_gvariant)
12490 {
12491 g_value_init (&paramv[n], G_TYPE_VARIANT);
12492 g_value_set_variant (&paramv[n], child);
12493 n++;
12494 }
12495 else
12496 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
12497 g_variant_unref (child);
12498 }
12499 signal_id = g_signal_lookup (info->signal_name, TYPE_SHARED_RESOURCE);
12500 g_value_init (&return_value, G_TYPE_BOOLEAN);
12501 g_signal_emitv (paramv, signal_id, 0, &return_value);
12502 if (!g_value_get_boolean (&return_value))
12503 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);
12504 g_value_unset (&return_value);
12505 for (n = 0; n < num_params + num_extra; n++)
12506 g_value_unset (&paramv[n]);
12507 g_free (paramv);
12508}
12509
12510static GVariant *
12511_shared_resource_skeleton_handle_get_property (
12512 GDBusConnection *connection G_GNUC_UNUSED,
12513 const gchar *sender G_GNUC_UNUSED,
12514 const gchar *object_path G_GNUC_UNUSED,
12515 const gchar *interface_name G_GNUC_UNUSED,
12516 const gchar *property_name,
12517 GError **error,
12518 gpointer user_data)
12519{
12520 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (user_data);
12521 GValue value = G_VALUE_INIT;
12522 GParamSpec *pspec;
12523 _ExtendedGDBusPropertyInfo *info;
12524 GVariant *ret;
12525 ret = NULL;
12526 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct, property_name);
12527 g_assert (info != NULL);
12528 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
12529 if (pspec == NULL)
12530 {
12531 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
12532 }
12533 else
12534 {
12535 g_value_init (&value, pspec->value_type);
12536 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
12537 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
12538 g_value_unset (&value);
12539 }
12540 return ret;
12541}
12542
12543static gboolean
12544_shared_resource_skeleton_handle_set_property (
12545 GDBusConnection *connection G_GNUC_UNUSED,
12546 const gchar *sender G_GNUC_UNUSED,
12547 const gchar *object_path G_GNUC_UNUSED,
12548 const gchar *interface_name G_GNUC_UNUSED,
12549 const gchar *property_name,
12550 GVariant *variant,
12551 GError **error,
12552 gpointer user_data)
12553{
12554 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (user_data);
12555 GValue value = G_VALUE_INIT;
12556 GParamSpec *pspec;
12557 _ExtendedGDBusPropertyInfo *info;
12558 gboolean ret;
12559 ret = FALSE;
12560 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct, property_name);
12561 g_assert (info != NULL);
12562 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
12563 if (pspec == NULL)
12564 {
12565 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
12566 }
12567 else
12568 {
12569 if (info->use_gvariant)
12570 g_value_set_variant (&value, variant);
12571 else
12572 g_dbus_gvariant_to_gvalue (variant, &value);
12573 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
12574 g_value_unset (&value);
12575 ret = TRUE;
12576 }
12577 return ret;
12578}
12579
12580static const GDBusInterfaceVTable _shared_resource_skeleton_vtable =
12581{
12582 _shared_resource_skeleton_handle_method_call,
12583 _shared_resource_skeleton_handle_get_property,
12584 _shared_resource_skeleton_handle_set_property,
12585 {NULL}
12586};
12587
12588static GDBusInterfaceInfo *
12589shared_resource_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
12590{
12591 return shared_resource_interface_info ();
12592}
12593
12594static GDBusInterfaceVTable *
12595shared_resource_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
12596{
12597 return (GDBusInterfaceVTable *) &_shared_resource_skeleton_vtable;
12598}
12599
12600static GVariant *
12601shared_resource_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
12602{
12603 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (_skeleton);
12604
12605 GVariantBuilder builder;
12606 guint n;
12607 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
12608 if (_shared_resource_interface_info.parent_struct.properties == NULL)
12609 goto out;
12610 for (n = 0; _shared_resource_interface_info.parent_struct.properties[n] != NULL; n++)
12611 {
12612 GDBusPropertyInfo *info = _shared_resource_interface_info.parent_struct.properties[n];
12613 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
12614 {
12615 GVariant *value;
12616 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);
12617 if (value != NULL)
12618 {
12619 g_variant_take_ref (value);
12620 g_variant_builder_add (&builder, "{sv}", info->name, value);
12621 g_variant_unref (value);
12622 }
12623 }
12624 }
12625out:
12626 return g_variant_builder_end (&builder);
12627}
12628
12629static gboolean _shared_resource_emit_changed (gpointer user_data);
12630
12631static void
12632shared_resource_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
12633{
12634 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (_skeleton);
12635 gboolean emit_changed = FALSE;
12636
12637 g_mutex_lock (&skeleton->priv->lock);
12638 if (skeleton->priv->changed_properties_idle_source != NULL)
12639 {
12640 g_source_destroy (skeleton->priv->changed_properties_idle_source);
12641 skeleton->priv->changed_properties_idle_source = NULL;
12642 emit_changed = TRUE;
12643 }
12644 g_mutex_unlock (&skeleton->priv->lock);
12645
12646 if (emit_changed)
12647 _shared_resource_emit_changed (skeleton);
12648}
12649
12650static void shared_resource_skeleton_iface_init (SharedResourceIface *iface);
12651#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
12652G_DEFINE_TYPE_WITH_CODE (SharedResourceSkeleton, shared_resource_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
12653 G_ADD_PRIVATE (SharedResourceSkeleton)
12654 G_IMPLEMENT_INTERFACE (TYPE_SHARED_RESOURCE, shared_resource_skeleton_iface_init));
12655
12656#else
12657G_DEFINE_TYPE_WITH_CODE (SharedResourceSkeleton, shared_resource_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
12658 G_IMPLEMENT_INTERFACE (TYPE_SHARED_RESOURCE, shared_resource_skeleton_iface_init));
12659
12660#endif
12661static void
12662shared_resource_skeleton_finalize (GObject *object)
12663{
12664 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object);
12665 guint n;
12666 for (n = 0; n < 2; n++)
12667 g_value_unset (&skeleton->priv->properties[n]);
12668 g_free (skeleton->priv->properties);
12669 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
12670 if (skeleton->priv->changed_properties_idle_source != NULL)
12671 g_source_destroy (skeleton->priv->changed_properties_idle_source);
12672 g_main_context_unref (skeleton->priv->context);
12673 g_mutex_clear (&skeleton->priv->lock);
12674 G_OBJECT_CLASS (shared_resource_skeleton_parent_class)->finalize (object);
12675}
12676
12677static void
12678shared_resource_skeleton_get_property (GObject *object,
12679 guint prop_id,
12680 GValue *value,
12681 GParamSpec *pspec G_GNUC_UNUSED)
12682{
12683 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object);
12684 g_assert (prop_id != 0 && prop_id - 1 < 2);
12685 g_mutex_lock (&skeleton->priv->lock);
12686 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
12687 g_mutex_unlock (&skeleton->priv->lock);
12688}
12689
12690static gboolean
12691_shared_resource_emit_changed (gpointer user_data)
12692{
12693 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (user_data);
12694 GList *l;
12695 GVariantBuilder builder;
12696 GVariantBuilder invalidated_builder;
12697 guint num_changes;
12698
12699 g_mutex_lock (&skeleton->priv->lock);
12700 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
12701 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
12702 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
12703 {
12704 ChangedProperty *cp = l->data;
12705 GVariant *variant;
12706 const GValue *cur_value;
12707
12708 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
12709 if (!_g_value_equal (cur_value, &cp->orig_value))
12710 {
12711 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
12712 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
12713 g_variant_unref (variant);
12714 num_changes++;
12715 }
12716 }
12717 if (num_changes > 0)
12718 {
12719 GList *connections, *ll;
12720 GVariant *signal_variant;
12721 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SharedResource",
12722 &builder, &invalidated_builder));
12723 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
12724 for (ll = connections; ll != NULL; ll = ll->next)
12725 {
12726 GDBusConnection *connection = ll->data;
12727
12728 g_dbus_connection_emit_signal (connection,
12729 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
12730 "org.freedesktop.DBus.Properties",
12731 "PropertiesChanged",
12732 signal_variant,
12733 NULL);
12734 }
12735 g_variant_unref (signal_variant);
12736 g_list_free_full (connections, g_object_unref);
12737 }
12738 else
12739 {
12740 g_variant_builder_clear (&builder);
12741 g_variant_builder_clear (&invalidated_builder);
12742 }
12743 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
12744 skeleton->priv->changed_properties = NULL;
12745 skeleton->priv->changed_properties_idle_source = NULL;
12746 g_mutex_unlock (&skeleton->priv->lock);
12747 return FALSE;
12748}
12749
12750static void
12751_shared_resource_schedule_emit_changed (SharedResourceSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
12752{
12753 ChangedProperty *cp;
12754 GList *l;
12755 cp = NULL;
12756 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
12757 {
12758 ChangedProperty *i_cp = l->data;
12759 if (i_cp->info == info)
12760 {
12761 cp = i_cp;
12762 break;
12763 }
12764 }
12765 if (cp == NULL)
12766 {
12767 cp = g_new0 (ChangedProperty, 1);
12768 cp->prop_id = prop_id;
12769 cp->info = info;
12770 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
12771 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
12772 g_value_copy (orig_value, &cp->orig_value);
12773 }
12774}
12775
12776static void
12777shared_resource_skeleton_notify (GObject *object,
12778 GParamSpec *pspec G_GNUC_UNUSED)
12779{
12780 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object);
12781 g_mutex_lock (&skeleton->priv->lock);
12782 if (skeleton->priv->changed_properties != NULL &&
12783 skeleton->priv->changed_properties_idle_source == NULL)
12784 {
12785 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
12786 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
12787 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _shared_resource_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
12788 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
12789 g_source_unref (skeleton->priv->changed_properties_idle_source);
12790 }
12791 g_mutex_unlock (&skeleton->priv->lock);
12792}
12793
12794static void
12795shared_resource_skeleton_set_property (GObject *object,
12796 guint prop_id,
12797 const GValue *value,
12798 GParamSpec *pspec)
12799{
12800 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object);
12801 g_assert (prop_id != 0 && prop_id - 1 < 2);
12802 g_mutex_lock (&skeleton->priv->lock);
12803 g_object_freeze_notify (object);
12804 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
12805 {
12806 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
12807 _shared_resource_schedule_emit_changed (skeleton, _shared_resource_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
12808 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
12809 g_object_notify_by_pspec (object, pspec);
12810 }
12811 g_mutex_unlock (&skeleton->priv->lock);
12812 g_object_thaw_notify (object);
12813}
12814
12815static void
12816shared_resource_skeleton_init (SharedResourceSkeleton *skeleton)
12817{
12818#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
12819 skeleton->priv = shared_resource_skeleton_get_instance_private (skeleton);
12820#else
12821 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SHARED_RESOURCE_SKELETON, SharedResourceSkeletonPrivate);
12822#endif
12823
12824 g_mutex_init (&skeleton->priv->lock);
12825 skeleton->priv->context = g_main_context_ref_thread_default ();
12826 skeleton->priv->properties = g_new0 (GValue, 2);
12827 g_value_init (&skeleton->priv->properties[0], G_TYPE_BOOLEAN);
12828 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
12829}
12830
12831static gboolean
12832shared_resource_skeleton_get_lock (SharedResource *object)
12833{
12834 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object);
12835 gboolean value;
12836 g_mutex_lock (&skeleton->priv->lock);
12837 value = g_value_get_boolean (&(skeleton->priv->properties[0]));
12838 g_mutex_unlock (&skeleton->priv->lock);
12839 return value;
12840}
12841
12842static const gchar *
12843shared_resource_skeleton_get_name (SharedResource *object)
12844{
12845 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object);
12846 const gchar *value;
12847 g_mutex_lock (&skeleton->priv->lock);
12848 value = g_value_get_string (&(skeleton->priv->properties[1]));
12849 g_mutex_unlock (&skeleton->priv->lock);
12850 return value;
12851}
12852
12853static void
12854shared_resource_skeleton_class_init (SharedResourceSkeletonClass *klass)
12855{
12856 GObjectClass *gobject_class;
12857 GDBusInterfaceSkeletonClass *skeleton_class;
12858
12859 gobject_class = G_OBJECT_CLASS (klass);
12860 gobject_class->finalize = shared_resource_skeleton_finalize;
12861 gobject_class->get_property = shared_resource_skeleton_get_property;
12862 gobject_class->set_property = shared_resource_skeleton_set_property;
12863 gobject_class->notify = shared_resource_skeleton_notify;
12864
12865
12866 shared_resource_override_properties (gobject_class, 1);
12867
12868 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
12869 skeleton_class->get_info = shared_resource_skeleton_dbus_interface_get_info;
12870 skeleton_class->get_properties = shared_resource_skeleton_dbus_interface_get_properties;
12871 skeleton_class->flush = shared_resource_skeleton_dbus_interface_flush;
12872 skeleton_class->get_vtable = shared_resource_skeleton_dbus_interface_get_vtable;
12873
12874#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
12875 g_type_class_add_private (klass, sizeof (SharedResourceSkeletonPrivate));
12876#endif
12877}
12878
12879static void
12880shared_resource_skeleton_iface_init (SharedResourceIface *iface)
12881{
12882 iface->get_lock = shared_resource_skeleton_get_lock;
12883 iface->get_name = shared_resource_skeleton_get_name;
12884}
12885
12886/**
12887 * shared_resource_skeleton_new:
12888 *
12889 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link>.
12890 *
12891 * Returns: (transfer full) (type SharedResourceSkeleton): The skeleton object.
12892 */
12893SharedResource *
12894shared_resource_skeleton_new (void)
12895{
12896 return SHARED_RESOURCE (g_object_new (TYPE_SHARED_RESOURCE_SKELETON, NULL));
12897}
12898
12899/* ------------------------------------------------------------------------
Norman James362a80f2015-09-14 14:04:39 -050012900 * Code for interface org.openbmc.Control
12901 * ------------------------------------------------------------------------
12902 */
12903
12904/**
12905 * SECTION:Control
12906 * @title: Control
12907 * @short_description: Generated C code for the org.openbmc.Control D-Bus interface
12908 *
12909 * 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.
12910 */
12911
12912/* ---- Introspection data for org.openbmc.Control ---- */
12913
12914static const _ExtendedGDBusMethodInfo _control_method_info_init =
12915{
12916 {
12917 -1,
12918 (gchar *) "init",
12919 NULL,
12920 NULL,
12921 NULL
12922 },
12923 "handle-init",
12924 FALSE
12925};
12926
12927static const _ExtendedGDBusMethodInfo * const _control_method_info_pointers[] =
12928{
12929 &_control_method_info_init,
12930 NULL
12931};
12932
12933static const _ExtendedGDBusArgInfo _control_signal_info_heartbeat_ARG_bus_name =
12934{
12935 {
12936 -1,
12937 (gchar *) "bus_name",
12938 (gchar *) "s",
12939 NULL
12940 },
12941 FALSE
12942};
12943
12944static const _ExtendedGDBusArgInfo * const _control_signal_info_heartbeat_ARG_pointers[] =
12945{
12946 &_control_signal_info_heartbeat_ARG_bus_name,
12947 NULL
12948};
12949
12950static const _ExtendedGDBusSignalInfo _control_signal_info_heartbeat =
12951{
12952 {
12953 -1,
12954 (gchar *) "Heartbeat",
12955 (GDBusArgInfo **) &_control_signal_info_heartbeat_ARG_pointers,
12956 NULL
12957 },
12958 "heartbeat"
12959};
12960
12961static const _ExtendedGDBusArgInfo _control_signal_info_goto_system_state_ARG_state_name =
12962{
12963 {
12964 -1,
12965 (gchar *) "state_name",
12966 (gchar *) "s",
12967 NULL
12968 },
12969 FALSE
12970};
12971
12972static const _ExtendedGDBusArgInfo * const _control_signal_info_goto_system_state_ARG_pointers[] =
12973{
12974 &_control_signal_info_goto_system_state_ARG_state_name,
12975 NULL
12976};
12977
12978static const _ExtendedGDBusSignalInfo _control_signal_info_goto_system_state =
12979{
12980 {
12981 -1,
12982 (gchar *) "GotoSystemState",
12983 (GDBusArgInfo **) &_control_signal_info_goto_system_state_ARG_pointers,
12984 NULL
12985 },
12986 "goto-system-state"
12987};
12988
Norman Jamesa3e47c42015-10-18 14:43:10 -050012989static const _ExtendedGDBusSignalInfo _control_signal_info_started =
12990{
12991 {
12992 -1,
12993 (gchar *) "Started",
12994 NULL,
12995 NULL
12996 },
12997 "started"
12998};
12999
Norman James362a80f2015-09-14 14:04:39 -050013000static const _ExtendedGDBusSignalInfo * const _control_signal_info_pointers[] =
13001{
13002 &_control_signal_info_heartbeat,
13003 &_control_signal_info_goto_system_state,
Norman Jamesa3e47c42015-10-18 14:43:10 -050013004 &_control_signal_info_started,
Norman James362a80f2015-09-14 14:04:39 -050013005 NULL
13006};
13007
13008static const _ExtendedGDBusPropertyInfo _control_property_info_poll_interval =
13009{
13010 {
13011 -1,
13012 (gchar *) "poll_interval",
13013 (gchar *) "i",
13014 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
13015 NULL
13016 },
13017 "poll-interval",
13018 FALSE
13019};
13020
13021static const _ExtendedGDBusPropertyInfo _control_property_info_heatbeat =
13022{
13023 {
13024 -1,
13025 (gchar *) "heatbeat",
13026 (gchar *) "i",
13027 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
13028 NULL
13029 },
13030 "heatbeat",
13031 FALSE
13032};
13033
13034static const _ExtendedGDBusPropertyInfo * const _control_property_info_pointers[] =
13035{
13036 &_control_property_info_poll_interval,
13037 &_control_property_info_heatbeat,
13038 NULL
13039};
13040
13041static const _ExtendedGDBusInterfaceInfo _control_interface_info =
13042{
13043 {
13044 -1,
13045 (gchar *) "org.openbmc.Control",
13046 (GDBusMethodInfo **) &_control_method_info_pointers,
13047 (GDBusSignalInfo **) &_control_signal_info_pointers,
13048 (GDBusPropertyInfo **) &_control_property_info_pointers,
13049 NULL
13050 },
13051 "control",
13052};
13053
13054
13055/**
13056 * control_interface_info:
13057 *
13058 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link> D-Bus interface.
13059 *
13060 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
13061 */
13062GDBusInterfaceInfo *
13063control_interface_info (void)
13064{
13065 return (GDBusInterfaceInfo *) &_control_interface_info.parent_struct;
13066}
13067
13068/**
13069 * control_override_properties:
13070 * @klass: The class structure for a #GObject<!-- -->-derived class.
13071 * @property_id_begin: The property id to assign to the first overridden property.
13072 *
13073 * Overrides all #GObject properties in the #Control interface for a concrete class.
13074 * The properties are overridden in the order they are defined.
13075 *
13076 * Returns: The last property id.
13077 */
13078guint
13079control_override_properties (GObjectClass *klass, guint property_id_begin)
13080{
13081 g_object_class_override_property (klass, property_id_begin++, "poll-interval");
13082 g_object_class_override_property (klass, property_id_begin++, "heatbeat");
13083 return property_id_begin - 1;
13084}
13085
13086
13087
13088/**
13089 * Control:
13090 *
13091 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link>.
13092 */
13093
13094/**
13095 * ControlIface:
13096 * @parent_iface: The parent interface.
13097 * @handle_init: Handler for the #Control::handle-init signal.
13098 * @get_heatbeat: Getter for the #Control:heatbeat property.
13099 * @get_poll_interval: Getter for the #Control:poll-interval property.
13100 * @goto_system_state: Handler for the #Control::goto-system-state signal.
13101 * @heartbeat: Handler for the #Control::heartbeat signal.
Norman Jamesa3e47c42015-10-18 14:43:10 -050013102 * @started: Handler for the #Control::started signal.
Norman James362a80f2015-09-14 14:04:39 -050013103 *
13104 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link>.
13105 */
13106
13107typedef ControlIface ControlInterface;
13108G_DEFINE_INTERFACE (Control, control, G_TYPE_OBJECT);
13109
13110static void
13111control_default_init (ControlIface *iface)
13112{
13113 /* GObject signals for incoming D-Bus method calls: */
13114 /**
13115 * Control::handle-init:
13116 * @object: A #Control.
13117 * @invocation: A #GDBusMethodInvocation.
13118 *
13119 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Control.init">init()</link> D-Bus method.
13120 *
13121 * 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.
13122 *
13123 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
13124 */
13125 g_signal_new ("handle-init",
13126 G_TYPE_FROM_INTERFACE (iface),
13127 G_SIGNAL_RUN_LAST,
13128 G_STRUCT_OFFSET (ControlIface, handle_init),
13129 g_signal_accumulator_true_handled,
13130 NULL,
13131 g_cclosure_marshal_generic,
13132 G_TYPE_BOOLEAN,
13133 1,
13134 G_TYPE_DBUS_METHOD_INVOCATION);
13135
13136 /* GObject signals for received D-Bus signals: */
13137 /**
13138 * Control::heartbeat:
13139 * @object: A #Control.
13140 * @arg_bus_name: Argument.
13141 *
13142 * 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.
13143 *
13144 * 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.
13145 */
13146 g_signal_new ("heartbeat",
13147 G_TYPE_FROM_INTERFACE (iface),
13148 G_SIGNAL_RUN_LAST,
13149 G_STRUCT_OFFSET (ControlIface, heartbeat),
13150 NULL,
13151 NULL,
13152 g_cclosure_marshal_generic,
13153 G_TYPE_NONE,
13154 1, G_TYPE_STRING);
13155
13156 /**
13157 * Control::goto-system-state:
13158 * @object: A #Control.
13159 * @arg_state_name: Argument.
13160 *
13161 * 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.
13162 *
13163 * 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.
13164 */
13165 g_signal_new ("goto-system-state",
13166 G_TYPE_FROM_INTERFACE (iface),
13167 G_SIGNAL_RUN_LAST,
13168 G_STRUCT_OFFSET (ControlIface, goto_system_state),
13169 NULL,
13170 NULL,
13171 g_cclosure_marshal_generic,
13172 G_TYPE_NONE,
13173 1, G_TYPE_STRING);
13174
Norman Jamesa3e47c42015-10-18 14:43:10 -050013175 /**
13176 * Control::started:
13177 * @object: A #Control.
13178 *
13179 * 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.
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 ("started",
13184 G_TYPE_FROM_INTERFACE (iface),
13185 G_SIGNAL_RUN_LAST,
13186 G_STRUCT_OFFSET (ControlIface, started),
13187 NULL,
13188 NULL,
13189 g_cclosure_marshal_generic,
13190 G_TYPE_NONE,
13191 0);
13192
Norman James362a80f2015-09-14 14:04:39 -050013193 /* GObject properties for D-Bus properties: */
13194 /**
13195 * Control:poll-interval:
13196 *
13197 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Control.poll_interval">"poll_interval"</link>.
13198 *
13199 * 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.
13200 */
13201 g_object_interface_install_property (iface,
13202 g_param_spec_int ("poll-interval", "poll_interval", "poll_interval", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
13203 /**
13204 * Control:heatbeat:
13205 *
13206 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Control.heatbeat">"heatbeat"</link>.
13207 *
13208 * 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.
13209 */
13210 g_object_interface_install_property (iface,
13211 g_param_spec_int ("heatbeat", "heatbeat", "heatbeat", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
13212}
13213
13214/**
13215 * control_get_poll_interval: (skip)
13216 * @object: A #Control.
13217 *
13218 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Control.poll_interval">"poll_interval"</link> D-Bus property.
13219 *
13220 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
13221 *
13222 * Returns: The property value.
13223 */
13224gint
13225control_get_poll_interval (Control *object)
13226{
13227 return CONTROL_GET_IFACE (object)->get_poll_interval (object);
13228}
13229
13230/**
13231 * control_set_poll_interval: (skip)
13232 * @object: A #Control.
13233 * @value: The value to set.
13234 *
13235 * Sets the <link linkend="gdbus-property-org-openbmc-Control.poll_interval">"poll_interval"</link> D-Bus property to @value.
13236 *
13237 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
13238 */
13239void
13240control_set_poll_interval (Control *object, gint value)
13241{
13242 g_object_set (G_OBJECT (object), "poll-interval", value, NULL);
13243}
13244
13245/**
13246 * control_get_heatbeat: (skip)
13247 * @object: A #Control.
13248 *
13249 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Control.heatbeat">"heatbeat"</link> D-Bus property.
13250 *
13251 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
13252 *
13253 * Returns: The property value.
13254 */
13255gint
13256control_get_heatbeat (Control *object)
13257{
13258 return CONTROL_GET_IFACE (object)->get_heatbeat (object);
13259}
13260
13261/**
13262 * control_set_heatbeat: (skip)
13263 * @object: A #Control.
13264 * @value: The value to set.
13265 *
13266 * Sets the <link linkend="gdbus-property-org-openbmc-Control.heatbeat">"heatbeat"</link> D-Bus property to @value.
13267 *
13268 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
13269 */
13270void
13271control_set_heatbeat (Control *object, gint value)
13272{
13273 g_object_set (G_OBJECT (object), "heatbeat", value, NULL);
13274}
13275
13276/**
13277 * control_emit_heartbeat:
13278 * @object: A #Control.
13279 * @arg_bus_name: Argument to pass with the signal.
13280 *
13281 * Emits the <link linkend="gdbus-signal-org-openbmc-Control.Heartbeat">"Heartbeat"</link> D-Bus signal.
13282 */
13283void
13284control_emit_heartbeat (
13285 Control *object,
13286 const gchar *arg_bus_name)
13287{
13288 g_signal_emit_by_name (object, "heartbeat", arg_bus_name);
13289}
13290
13291/**
13292 * control_emit_goto_system_state:
13293 * @object: A #Control.
13294 * @arg_state_name: Argument to pass with the signal.
13295 *
13296 * Emits the <link linkend="gdbus-signal-org-openbmc-Control.GotoSystemState">"GotoSystemState"</link> D-Bus signal.
13297 */
13298void
13299control_emit_goto_system_state (
13300 Control *object,
13301 const gchar *arg_state_name)
13302{
13303 g_signal_emit_by_name (object, "goto-system-state", arg_state_name);
13304}
13305
13306/**
Norman Jamesa3e47c42015-10-18 14:43:10 -050013307 * control_emit_started:
13308 * @object: A #Control.
13309 *
13310 * Emits the <link linkend="gdbus-signal-org-openbmc-Control.Started">"Started"</link> D-Bus signal.
13311 */
13312void
13313control_emit_started (
13314 Control *object)
13315{
13316 g_signal_emit_by_name (object, "started");
13317}
13318
13319/**
Norman James362a80f2015-09-14 14:04:39 -050013320 * control_call_init:
13321 * @proxy: A #ControlProxy.
13322 * @cancellable: (allow-none): A #GCancellable or %NULL.
13323 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
13324 * @user_data: User data to pass to @callback.
13325 *
13326 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Control.init">init()</link> D-Bus method on @proxy.
13327 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
13328 * You can then call control_call_init_finish() to get the result of the operation.
13329 *
13330 * See control_call_init_sync() for the synchronous, blocking version of this method.
13331 */
13332void
13333control_call_init (
13334 Control *proxy,
13335 GCancellable *cancellable,
13336 GAsyncReadyCallback callback,
13337 gpointer user_data)
13338{
13339 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
13340 "init",
13341 g_variant_new ("()"),
13342 G_DBUS_CALL_FLAGS_NONE,
13343 -1,
13344 cancellable,
13345 callback,
13346 user_data);
13347}
13348
13349/**
13350 * control_call_init_finish:
13351 * @proxy: A #ControlProxy.
13352 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_call_init().
13353 * @error: Return location for error or %NULL.
13354 *
13355 * Finishes an operation started with control_call_init().
13356 *
13357 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
13358 */
13359gboolean
13360control_call_init_finish (
13361 Control *proxy,
13362 GAsyncResult *res,
13363 GError **error)
13364{
13365 GVariant *_ret;
13366 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
13367 if (_ret == NULL)
13368 goto _out;
13369 g_variant_get (_ret,
13370 "()");
13371 g_variant_unref (_ret);
13372_out:
13373 return _ret != NULL;
13374}
13375
13376/**
13377 * control_call_init_sync:
13378 * @proxy: A #ControlProxy.
13379 * @cancellable: (allow-none): A #GCancellable or %NULL.
13380 * @error: Return location for error or %NULL.
13381 *
13382 * 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.
13383 *
13384 * See control_call_init() for the asynchronous version of this method.
13385 *
13386 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
13387 */
13388gboolean
13389control_call_init_sync (
13390 Control *proxy,
13391 GCancellable *cancellable,
13392 GError **error)
13393{
13394 GVariant *_ret;
13395 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
13396 "init",
13397 g_variant_new ("()"),
13398 G_DBUS_CALL_FLAGS_NONE,
13399 -1,
13400 cancellable,
13401 error);
13402 if (_ret == NULL)
13403 goto _out;
13404 g_variant_get (_ret,
13405 "()");
13406 g_variant_unref (_ret);
13407_out:
13408 return _ret != NULL;
13409}
13410
13411/**
13412 * control_complete_init:
13413 * @object: A #Control.
13414 * @invocation: (transfer full): A #GDBusMethodInvocation.
13415 *
13416 * 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.
13417 *
13418 * This method will free @invocation, you cannot use it afterwards.
13419 */
13420void
13421control_complete_init (
13422 Control *object,
13423 GDBusMethodInvocation *invocation)
13424{
13425 g_dbus_method_invocation_return_value (invocation,
13426 g_variant_new ("()"));
13427}
13428
13429/* ------------------------------------------------------------------------ */
13430
13431/**
13432 * ControlProxy:
13433 *
13434 * The #ControlProxy structure contains only private data and should only be accessed using the provided API.
13435 */
13436
13437/**
13438 * ControlProxyClass:
13439 * @parent_class: The parent class.
13440 *
13441 * Class structure for #ControlProxy.
13442 */
13443
13444struct _ControlProxyPrivate
13445{
13446 GData *qdata;
13447};
13448
13449static void control_proxy_iface_init (ControlIface *iface);
13450
13451#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
13452G_DEFINE_TYPE_WITH_CODE (ControlProxy, control_proxy, G_TYPE_DBUS_PROXY,
13453 G_ADD_PRIVATE (ControlProxy)
13454 G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_proxy_iface_init));
13455
13456#else
13457G_DEFINE_TYPE_WITH_CODE (ControlProxy, control_proxy, G_TYPE_DBUS_PROXY,
13458 G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_proxy_iface_init));
13459
13460#endif
13461static void
13462control_proxy_finalize (GObject *object)
13463{
13464 ControlProxy *proxy = CONTROL_PROXY (object);
13465 g_datalist_clear (&proxy->priv->qdata);
13466 G_OBJECT_CLASS (control_proxy_parent_class)->finalize (object);
13467}
13468
13469static void
13470control_proxy_get_property (GObject *object,
13471 guint prop_id,
13472 GValue *value,
13473 GParamSpec *pspec G_GNUC_UNUSED)
13474{
13475 const _ExtendedGDBusPropertyInfo *info;
13476 GVariant *variant;
13477 g_assert (prop_id != 0 && prop_id - 1 < 2);
13478 info = _control_property_info_pointers[prop_id - 1];
13479 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
13480 if (info->use_gvariant)
13481 {
13482 g_value_set_variant (value, variant);
13483 }
13484 else
13485 {
13486 if (variant != NULL)
13487 g_dbus_gvariant_to_gvalue (variant, value);
13488 }
13489 if (variant != NULL)
13490 g_variant_unref (variant);
13491}
13492
13493static void
13494control_proxy_set_property_cb (GDBusProxy *proxy,
13495 GAsyncResult *res,
13496 gpointer user_data)
13497{
13498 const _ExtendedGDBusPropertyInfo *info = user_data;
13499 GError *error;
13500 GVariant *_ret;
13501 error = NULL;
13502 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
13503 if (!_ret)
13504 {
13505 g_warning ("Error setting property '%s' on interface org.openbmc.Control: %s (%s, %d)",
13506 info->parent_struct.name,
13507 error->message, g_quark_to_string (error->domain), error->code);
13508 g_error_free (error);
13509 }
13510 else
13511 {
13512 g_variant_unref (_ret);
13513 }
13514}
13515
13516static void
13517control_proxy_set_property (GObject *object,
13518 guint prop_id,
13519 const GValue *value,
13520 GParamSpec *pspec G_GNUC_UNUSED)
13521{
13522 const _ExtendedGDBusPropertyInfo *info;
13523 GVariant *variant;
13524 g_assert (prop_id != 0 && prop_id - 1 < 2);
13525 info = _control_property_info_pointers[prop_id - 1];
13526 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
13527 g_dbus_proxy_call (G_DBUS_PROXY (object),
13528 "org.freedesktop.DBus.Properties.Set",
13529 g_variant_new ("(ssv)", "org.openbmc.Control", info->parent_struct.name, variant),
13530 G_DBUS_CALL_FLAGS_NONE,
13531 -1,
13532 NULL, (GAsyncReadyCallback) control_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
13533 g_variant_unref (variant);
13534}
13535
13536static void
13537control_proxy_g_signal (GDBusProxy *proxy,
13538 const gchar *sender_name G_GNUC_UNUSED,
13539 const gchar *signal_name,
13540 GVariant *parameters)
13541{
13542 _ExtendedGDBusSignalInfo *info;
13543 GVariantIter iter;
13544 GVariant *child;
13545 GValue *paramv;
13546 guint num_params;
13547 guint n;
13548 guint signal_id;
13549 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, signal_name);
13550 if (info == NULL)
13551 return;
13552 num_params = g_variant_n_children (parameters);
13553 paramv = g_new0 (GValue, num_params + 1);
13554 g_value_init (&paramv[0], TYPE_CONTROL);
13555 g_value_set_object (&paramv[0], proxy);
13556 g_variant_iter_init (&iter, parameters);
13557 n = 1;
13558 while ((child = g_variant_iter_next_value (&iter)) != NULL)
13559 {
13560 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
13561 if (arg_info->use_gvariant)
13562 {
13563 g_value_init (&paramv[n], G_TYPE_VARIANT);
13564 g_value_set_variant (&paramv[n], child);
13565 n++;
13566 }
13567 else
13568 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
13569 g_variant_unref (child);
13570 }
13571 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL);
13572 g_signal_emitv (paramv, signal_id, 0, NULL);
13573 for (n = 0; n < num_params + 1; n++)
13574 g_value_unset (&paramv[n]);
13575 g_free (paramv);
13576}
13577
13578static void
13579control_proxy_g_properties_changed (GDBusProxy *_proxy,
13580 GVariant *changed_properties,
13581 const gchar *const *invalidated_properties)
13582{
13583 ControlProxy *proxy = CONTROL_PROXY (_proxy);
13584 guint n;
13585 const gchar *key;
13586 GVariantIter *iter;
13587 _ExtendedGDBusPropertyInfo *info;
13588 g_variant_get (changed_properties, "a{sv}", &iter);
13589 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
13590 {
13591 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, key);
13592 g_datalist_remove_data (&proxy->priv->qdata, key);
13593 if (info != NULL)
13594 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
13595 }
13596 g_variant_iter_free (iter);
13597 for (n = 0; invalidated_properties[n] != NULL; n++)
13598 {
13599 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, invalidated_properties[n]);
13600 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
13601 if (info != NULL)
13602 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
13603 }
13604}
13605
13606static gint
13607control_proxy_get_poll_interval (Control *object)
13608{
13609 ControlProxy *proxy = CONTROL_PROXY (object);
13610 GVariant *variant;
13611 gint value = 0;
13612 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "poll_interval");
13613 if (variant != NULL)
13614 {
13615 value = g_variant_get_int32 (variant);
13616 g_variant_unref (variant);
13617 }
13618 return value;
13619}
13620
13621static gint
13622control_proxy_get_heatbeat (Control *object)
13623{
13624 ControlProxy *proxy = CONTROL_PROXY (object);
13625 GVariant *variant;
13626 gint value = 0;
13627 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "heatbeat");
13628 if (variant != NULL)
13629 {
13630 value = g_variant_get_int32 (variant);
13631 g_variant_unref (variant);
13632 }
13633 return value;
13634}
13635
13636static void
13637control_proxy_init (ControlProxy *proxy)
13638{
13639#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
13640 proxy->priv = control_proxy_get_instance_private (proxy);
13641#else
13642 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_PROXY, ControlProxyPrivate);
13643#endif
13644
13645 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_interface_info ());
13646}
13647
13648static void
13649control_proxy_class_init (ControlProxyClass *klass)
13650{
13651 GObjectClass *gobject_class;
13652 GDBusProxyClass *proxy_class;
13653
13654 gobject_class = G_OBJECT_CLASS (klass);
13655 gobject_class->finalize = control_proxy_finalize;
13656 gobject_class->get_property = control_proxy_get_property;
13657 gobject_class->set_property = control_proxy_set_property;
13658
13659 proxy_class = G_DBUS_PROXY_CLASS (klass);
13660 proxy_class->g_signal = control_proxy_g_signal;
13661 proxy_class->g_properties_changed = control_proxy_g_properties_changed;
13662
13663 control_override_properties (gobject_class, 1);
13664
13665#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
13666 g_type_class_add_private (klass, sizeof (ControlProxyPrivate));
13667#endif
13668}
13669
13670static void
13671control_proxy_iface_init (ControlIface *iface)
13672{
13673 iface->get_poll_interval = control_proxy_get_poll_interval;
13674 iface->get_heatbeat = control_proxy_get_heatbeat;
13675}
13676
13677/**
13678 * control_proxy_new:
13679 * @connection: A #GDBusConnection.
13680 * @flags: Flags from the #GDBusProxyFlags enumeration.
13681 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
13682 * @object_path: An object path.
13683 * @cancellable: (allow-none): A #GCancellable or %NULL.
13684 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
13685 * @user_data: User data to pass to @callback.
13686 *
13687 * 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.
13688 *
13689 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
13690 * You can then call control_proxy_new_finish() to get the result of the operation.
13691 *
13692 * See control_proxy_new_sync() for the synchronous, blocking version of this constructor.
13693 */
13694void
13695control_proxy_new (
13696 GDBusConnection *connection,
13697 GDBusProxyFlags flags,
13698 const gchar *name,
13699 const gchar *object_path,
13700 GCancellable *cancellable,
13701 GAsyncReadyCallback callback,
13702 gpointer user_data)
13703{
13704 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);
13705}
13706
13707/**
13708 * control_proxy_new_finish:
13709 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_proxy_new().
13710 * @error: Return location for error or %NULL
13711 *
13712 * Finishes an operation started with control_proxy_new().
13713 *
13714 * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set.
13715 */
13716Control *
13717control_proxy_new_finish (
13718 GAsyncResult *res,
13719 GError **error)
13720{
13721 GObject *ret;
13722 GObject *source_object;
13723 source_object = g_async_result_get_source_object (res);
13724 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
13725 g_object_unref (source_object);
13726 if (ret != NULL)
13727 return CONTROL (ret);
13728 else
13729 return NULL;
13730}
13731
13732/**
13733 * control_proxy_new_sync:
13734 * @connection: A #GDBusConnection.
13735 * @flags: Flags from the #GDBusProxyFlags enumeration.
13736 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
13737 * @object_path: An object path.
13738 * @cancellable: (allow-none): A #GCancellable or %NULL.
13739 * @error: Return location for error or %NULL
13740 *
13741 * 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.
13742 *
13743 * The calling thread is blocked until a reply is received.
13744 *
13745 * See control_proxy_new() for the asynchronous version of this constructor.
13746 *
13747 * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set.
13748 */
13749Control *
13750control_proxy_new_sync (
13751 GDBusConnection *connection,
13752 GDBusProxyFlags flags,
13753 const gchar *name,
13754 const gchar *object_path,
13755 GCancellable *cancellable,
13756 GError **error)
13757{
13758 GInitable *ret;
13759 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);
13760 if (ret != NULL)
13761 return CONTROL (ret);
13762 else
13763 return NULL;
13764}
13765
13766
13767/**
13768 * control_proxy_new_for_bus:
13769 * @bus_type: A #GBusType.
13770 * @flags: Flags from the #GDBusProxyFlags enumeration.
13771 * @name: A bus name (well-known or unique).
13772 * @object_path: An object path.
13773 * @cancellable: (allow-none): A #GCancellable or %NULL.
13774 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
13775 * @user_data: User data to pass to @callback.
13776 *
13777 * Like control_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
13778 *
13779 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
13780 * You can then call control_proxy_new_for_bus_finish() to get the result of the operation.
13781 *
13782 * See control_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
13783 */
13784void
13785control_proxy_new_for_bus (
13786 GBusType bus_type,
13787 GDBusProxyFlags flags,
13788 const gchar *name,
13789 const gchar *object_path,
13790 GCancellable *cancellable,
13791 GAsyncReadyCallback callback,
13792 gpointer user_data)
13793{
13794 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);
13795}
13796
13797/**
13798 * control_proxy_new_for_bus_finish:
13799 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_proxy_new_for_bus().
13800 * @error: Return location for error or %NULL
13801 *
13802 * Finishes an operation started with control_proxy_new_for_bus().
13803 *
13804 * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set.
13805 */
13806Control *
13807control_proxy_new_for_bus_finish (
13808 GAsyncResult *res,
13809 GError **error)
13810{
13811 GObject *ret;
13812 GObject *source_object;
13813 source_object = g_async_result_get_source_object (res);
13814 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
13815 g_object_unref (source_object);
13816 if (ret != NULL)
13817 return CONTROL (ret);
13818 else
13819 return NULL;
13820}
13821
13822/**
13823 * control_proxy_new_for_bus_sync:
13824 * @bus_type: A #GBusType.
13825 * @flags: Flags from the #GDBusProxyFlags enumeration.
13826 * @name: A bus name (well-known or unique).
13827 * @object_path: An object path.
13828 * @cancellable: (allow-none): A #GCancellable or %NULL.
13829 * @error: Return location for error or %NULL
13830 *
13831 * Like control_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
13832 *
13833 * The calling thread is blocked until a reply is received.
13834 *
13835 * See control_proxy_new_for_bus() for the asynchronous version of this constructor.
13836 *
13837 * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set.
13838 */
13839Control *
13840control_proxy_new_for_bus_sync (
13841 GBusType bus_type,
13842 GDBusProxyFlags flags,
13843 const gchar *name,
13844 const gchar *object_path,
13845 GCancellable *cancellable,
13846 GError **error)
13847{
13848 GInitable *ret;
13849 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);
13850 if (ret != NULL)
13851 return CONTROL (ret);
13852 else
13853 return NULL;
13854}
13855
13856
13857/* ------------------------------------------------------------------------ */
13858
13859/**
13860 * ControlSkeleton:
13861 *
13862 * The #ControlSkeleton structure contains only private data and should only be accessed using the provided API.
13863 */
13864
13865/**
13866 * ControlSkeletonClass:
13867 * @parent_class: The parent class.
13868 *
13869 * Class structure for #ControlSkeleton.
13870 */
13871
13872struct _ControlSkeletonPrivate
13873{
13874 GValue *properties;
13875 GList *changed_properties;
13876 GSource *changed_properties_idle_source;
13877 GMainContext *context;
13878 GMutex lock;
13879};
13880
13881static void
13882_control_skeleton_handle_method_call (
13883 GDBusConnection *connection G_GNUC_UNUSED,
13884 const gchar *sender G_GNUC_UNUSED,
13885 const gchar *object_path G_GNUC_UNUSED,
13886 const gchar *interface_name,
13887 const gchar *method_name,
13888 GVariant *parameters,
13889 GDBusMethodInvocation *invocation,
13890 gpointer user_data)
13891{
13892 ControlSkeleton *skeleton = CONTROL_SKELETON (user_data);
13893 _ExtendedGDBusMethodInfo *info;
13894 GVariantIter iter;
13895 GVariant *child;
13896 GValue *paramv;
13897 guint num_params;
13898 guint num_extra;
13899 guint n;
13900 guint signal_id;
13901 GValue return_value = G_VALUE_INIT;
13902 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
13903 g_assert (info != NULL);
13904 num_params = g_variant_n_children (parameters);
13905 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
13906 n = 0;
13907 g_value_init (&paramv[n], TYPE_CONTROL);
13908 g_value_set_object (&paramv[n++], skeleton);
13909 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
13910 g_value_set_object (&paramv[n++], invocation);
13911 if (info->pass_fdlist)
13912 {
13913#ifdef G_OS_UNIX
13914 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
13915 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
13916#else
13917 g_assert_not_reached ();
13918#endif
13919 }
13920 g_variant_iter_init (&iter, parameters);
13921 while ((child = g_variant_iter_next_value (&iter)) != NULL)
13922 {
13923 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
13924 if (arg_info->use_gvariant)
13925 {
13926 g_value_init (&paramv[n], G_TYPE_VARIANT);
13927 g_value_set_variant (&paramv[n], child);
13928 n++;
13929 }
13930 else
13931 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
13932 g_variant_unref (child);
13933 }
13934 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL);
13935 g_value_init (&return_value, G_TYPE_BOOLEAN);
13936 g_signal_emitv (paramv, signal_id, 0, &return_value);
13937 if (!g_value_get_boolean (&return_value))
13938 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);
13939 g_value_unset (&return_value);
13940 for (n = 0; n < num_params + num_extra; n++)
13941 g_value_unset (&paramv[n]);
13942 g_free (paramv);
13943}
13944
13945static GVariant *
13946_control_skeleton_handle_get_property (
13947 GDBusConnection *connection G_GNUC_UNUSED,
13948 const gchar *sender G_GNUC_UNUSED,
13949 const gchar *object_path G_GNUC_UNUSED,
13950 const gchar *interface_name G_GNUC_UNUSED,
13951 const gchar *property_name,
13952 GError **error,
13953 gpointer user_data)
13954{
13955 ControlSkeleton *skeleton = CONTROL_SKELETON (user_data);
13956 GValue value = G_VALUE_INIT;
13957 GParamSpec *pspec;
13958 _ExtendedGDBusPropertyInfo *info;
13959 GVariant *ret;
13960 ret = NULL;
13961 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, property_name);
13962 g_assert (info != NULL);
13963 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
13964 if (pspec == NULL)
13965 {
13966 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
13967 }
13968 else
13969 {
13970 g_value_init (&value, pspec->value_type);
13971 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
13972 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
13973 g_value_unset (&value);
13974 }
13975 return ret;
13976}
13977
13978static gboolean
13979_control_skeleton_handle_set_property (
13980 GDBusConnection *connection G_GNUC_UNUSED,
13981 const gchar *sender G_GNUC_UNUSED,
13982 const gchar *object_path G_GNUC_UNUSED,
13983 const gchar *interface_name G_GNUC_UNUSED,
13984 const gchar *property_name,
13985 GVariant *variant,
13986 GError **error,
13987 gpointer user_data)
13988{
13989 ControlSkeleton *skeleton = CONTROL_SKELETON (user_data);
13990 GValue value = G_VALUE_INIT;
13991 GParamSpec *pspec;
13992 _ExtendedGDBusPropertyInfo *info;
13993 gboolean ret;
13994 ret = FALSE;
13995 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, property_name);
13996 g_assert (info != NULL);
13997 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
13998 if (pspec == NULL)
13999 {
14000 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
14001 }
14002 else
14003 {
14004 if (info->use_gvariant)
14005 g_value_set_variant (&value, variant);
14006 else
14007 g_dbus_gvariant_to_gvalue (variant, &value);
14008 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
14009 g_value_unset (&value);
14010 ret = TRUE;
14011 }
14012 return ret;
14013}
14014
14015static const GDBusInterfaceVTable _control_skeleton_vtable =
14016{
14017 _control_skeleton_handle_method_call,
14018 _control_skeleton_handle_get_property,
14019 _control_skeleton_handle_set_property,
14020 {NULL}
14021};
14022
14023static GDBusInterfaceInfo *
14024control_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
14025{
14026 return control_interface_info ();
14027}
14028
14029static GDBusInterfaceVTable *
14030control_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
14031{
14032 return (GDBusInterfaceVTable *) &_control_skeleton_vtable;
14033}
14034
14035static GVariant *
14036control_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
14037{
14038 ControlSkeleton *skeleton = CONTROL_SKELETON (_skeleton);
14039
14040 GVariantBuilder builder;
14041 guint n;
14042 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
14043 if (_control_interface_info.parent_struct.properties == NULL)
14044 goto out;
14045 for (n = 0; _control_interface_info.parent_struct.properties[n] != NULL; n++)
14046 {
14047 GDBusPropertyInfo *info = _control_interface_info.parent_struct.properties[n];
14048 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
14049 {
14050 GVariant *value;
14051 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);
14052 if (value != NULL)
14053 {
14054 g_variant_take_ref (value);
14055 g_variant_builder_add (&builder, "{sv}", info->name, value);
14056 g_variant_unref (value);
14057 }
14058 }
14059 }
14060out:
14061 return g_variant_builder_end (&builder);
14062}
14063
14064static gboolean _control_emit_changed (gpointer user_data);
14065
14066static void
14067control_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
14068{
14069 ControlSkeleton *skeleton = CONTROL_SKELETON (_skeleton);
14070 gboolean emit_changed = FALSE;
14071
14072 g_mutex_lock (&skeleton->priv->lock);
14073 if (skeleton->priv->changed_properties_idle_source != NULL)
14074 {
14075 g_source_destroy (skeleton->priv->changed_properties_idle_source);
14076 skeleton->priv->changed_properties_idle_source = NULL;
14077 emit_changed = TRUE;
14078 }
14079 g_mutex_unlock (&skeleton->priv->lock);
14080
14081 if (emit_changed)
14082 _control_emit_changed (skeleton);
14083}
14084
14085static void
14086_control_on_signal_heartbeat (
14087 Control *object,
14088 const gchar *arg_bus_name)
14089{
14090 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
14091
14092 GList *connections, *l;
14093 GVariant *signal_variant;
14094 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
14095
14096 signal_variant = g_variant_ref_sink (g_variant_new ("(s)",
14097 arg_bus_name));
14098 for (l = connections; l != NULL; l = l->next)
14099 {
14100 GDBusConnection *connection = l->data;
14101 g_dbus_connection_emit_signal (connection,
14102 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Control", "Heartbeat",
14103 signal_variant, NULL);
14104 }
14105 g_variant_unref (signal_variant);
14106 g_list_free_full (connections, g_object_unref);
14107}
14108
14109static void
14110_control_on_signal_goto_system_state (
14111 Control *object,
14112 const gchar *arg_state_name)
14113{
14114 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
14115
14116 GList *connections, *l;
14117 GVariant *signal_variant;
14118 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
14119
14120 signal_variant = g_variant_ref_sink (g_variant_new ("(s)",
14121 arg_state_name));
14122 for (l = connections; l != NULL; l = l->next)
14123 {
14124 GDBusConnection *connection = l->data;
14125 g_dbus_connection_emit_signal (connection,
14126 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Control", "GotoSystemState",
14127 signal_variant, NULL);
14128 }
14129 g_variant_unref (signal_variant);
14130 g_list_free_full (connections, g_object_unref);
14131}
14132
Norman Jamesa3e47c42015-10-18 14:43:10 -050014133static void
14134_control_on_signal_started (
14135 Control *object)
14136{
14137 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
14138
14139 GList *connections, *l;
14140 GVariant *signal_variant;
14141 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
14142
14143 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
14144 for (l = connections; l != NULL; l = l->next)
14145 {
14146 GDBusConnection *connection = l->data;
14147 g_dbus_connection_emit_signal (connection,
14148 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Control", "Started",
14149 signal_variant, NULL);
14150 }
14151 g_variant_unref (signal_variant);
14152 g_list_free_full (connections, g_object_unref);
14153}
14154
Norman James362a80f2015-09-14 14:04:39 -050014155static void control_skeleton_iface_init (ControlIface *iface);
14156#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
14157G_DEFINE_TYPE_WITH_CODE (ControlSkeleton, control_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
14158 G_ADD_PRIVATE (ControlSkeleton)
14159 G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_skeleton_iface_init));
14160
14161#else
14162G_DEFINE_TYPE_WITH_CODE (ControlSkeleton, control_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
14163 G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_skeleton_iface_init));
14164
14165#endif
14166static void
14167control_skeleton_finalize (GObject *object)
14168{
14169 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
14170 guint n;
14171 for (n = 0; n < 2; n++)
14172 g_value_unset (&skeleton->priv->properties[n]);
14173 g_free (skeleton->priv->properties);
14174 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
14175 if (skeleton->priv->changed_properties_idle_source != NULL)
14176 g_source_destroy (skeleton->priv->changed_properties_idle_source);
14177 g_main_context_unref (skeleton->priv->context);
14178 g_mutex_clear (&skeleton->priv->lock);
14179 G_OBJECT_CLASS (control_skeleton_parent_class)->finalize (object);
14180}
14181
14182static void
14183control_skeleton_get_property (GObject *object,
14184 guint prop_id,
14185 GValue *value,
14186 GParamSpec *pspec G_GNUC_UNUSED)
14187{
14188 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
14189 g_assert (prop_id != 0 && prop_id - 1 < 2);
14190 g_mutex_lock (&skeleton->priv->lock);
14191 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
14192 g_mutex_unlock (&skeleton->priv->lock);
14193}
14194
14195static gboolean
14196_control_emit_changed (gpointer user_data)
14197{
14198 ControlSkeleton *skeleton = CONTROL_SKELETON (user_data);
14199 GList *l;
14200 GVariantBuilder builder;
14201 GVariantBuilder invalidated_builder;
14202 guint num_changes;
14203
14204 g_mutex_lock (&skeleton->priv->lock);
14205 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
14206 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
14207 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
14208 {
14209 ChangedProperty *cp = l->data;
14210 GVariant *variant;
14211 const GValue *cur_value;
14212
14213 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
14214 if (!_g_value_equal (cur_value, &cp->orig_value))
14215 {
14216 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
14217 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
14218 g_variant_unref (variant);
14219 num_changes++;
14220 }
14221 }
14222 if (num_changes > 0)
14223 {
14224 GList *connections, *ll;
14225 GVariant *signal_variant;
14226 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Control",
14227 &builder, &invalidated_builder));
14228 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
14229 for (ll = connections; ll != NULL; ll = ll->next)
14230 {
14231 GDBusConnection *connection = ll->data;
14232
14233 g_dbus_connection_emit_signal (connection,
14234 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
14235 "org.freedesktop.DBus.Properties",
14236 "PropertiesChanged",
14237 signal_variant,
14238 NULL);
14239 }
14240 g_variant_unref (signal_variant);
14241 g_list_free_full (connections, g_object_unref);
14242 }
14243 else
14244 {
14245 g_variant_builder_clear (&builder);
14246 g_variant_builder_clear (&invalidated_builder);
14247 }
14248 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
14249 skeleton->priv->changed_properties = NULL;
14250 skeleton->priv->changed_properties_idle_source = NULL;
14251 g_mutex_unlock (&skeleton->priv->lock);
14252 return FALSE;
14253}
14254
14255static void
14256_control_schedule_emit_changed (ControlSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
14257{
14258 ChangedProperty *cp;
14259 GList *l;
14260 cp = NULL;
14261 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
14262 {
14263 ChangedProperty *i_cp = l->data;
14264 if (i_cp->info == info)
14265 {
14266 cp = i_cp;
14267 break;
14268 }
14269 }
14270 if (cp == NULL)
14271 {
14272 cp = g_new0 (ChangedProperty, 1);
14273 cp->prop_id = prop_id;
14274 cp->info = info;
14275 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
14276 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
14277 g_value_copy (orig_value, &cp->orig_value);
14278 }
14279}
14280
14281static void
14282control_skeleton_notify (GObject *object,
14283 GParamSpec *pspec G_GNUC_UNUSED)
14284{
14285 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
14286 g_mutex_lock (&skeleton->priv->lock);
14287 if (skeleton->priv->changed_properties != NULL &&
14288 skeleton->priv->changed_properties_idle_source == NULL)
14289 {
14290 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
14291 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
14292 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _control_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
14293 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
14294 g_source_unref (skeleton->priv->changed_properties_idle_source);
14295 }
14296 g_mutex_unlock (&skeleton->priv->lock);
14297}
14298
14299static void
14300control_skeleton_set_property (GObject *object,
14301 guint prop_id,
14302 const GValue *value,
14303 GParamSpec *pspec)
14304{
14305 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
14306 g_assert (prop_id != 0 && prop_id - 1 < 2);
14307 g_mutex_lock (&skeleton->priv->lock);
14308 g_object_freeze_notify (object);
14309 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
14310 {
14311 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
14312 _control_schedule_emit_changed (skeleton, _control_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
14313 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
14314 g_object_notify_by_pspec (object, pspec);
14315 }
14316 g_mutex_unlock (&skeleton->priv->lock);
14317 g_object_thaw_notify (object);
14318}
14319
14320static void
14321control_skeleton_init (ControlSkeleton *skeleton)
14322{
14323#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
14324 skeleton->priv = control_skeleton_get_instance_private (skeleton);
14325#else
14326 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_SKELETON, ControlSkeletonPrivate);
14327#endif
14328
14329 g_mutex_init (&skeleton->priv->lock);
14330 skeleton->priv->context = g_main_context_ref_thread_default ();
14331 skeleton->priv->properties = g_new0 (GValue, 2);
14332 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
14333 g_value_init (&skeleton->priv->properties[1], G_TYPE_INT);
14334}
14335
14336static gint
14337control_skeleton_get_poll_interval (Control *object)
14338{
14339 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
14340 gint value;
14341 g_mutex_lock (&skeleton->priv->lock);
14342 value = g_value_get_int (&(skeleton->priv->properties[0]));
14343 g_mutex_unlock (&skeleton->priv->lock);
14344 return value;
14345}
14346
14347static gint
14348control_skeleton_get_heatbeat (Control *object)
14349{
14350 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
14351 gint value;
14352 g_mutex_lock (&skeleton->priv->lock);
14353 value = g_value_get_int (&(skeleton->priv->properties[1]));
14354 g_mutex_unlock (&skeleton->priv->lock);
14355 return value;
14356}
14357
14358static void
14359control_skeleton_class_init (ControlSkeletonClass *klass)
14360{
14361 GObjectClass *gobject_class;
14362 GDBusInterfaceSkeletonClass *skeleton_class;
14363
14364 gobject_class = G_OBJECT_CLASS (klass);
14365 gobject_class->finalize = control_skeleton_finalize;
14366 gobject_class->get_property = control_skeleton_get_property;
14367 gobject_class->set_property = control_skeleton_set_property;
14368 gobject_class->notify = control_skeleton_notify;
14369
14370
14371 control_override_properties (gobject_class, 1);
14372
14373 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
14374 skeleton_class->get_info = control_skeleton_dbus_interface_get_info;
14375 skeleton_class->get_properties = control_skeleton_dbus_interface_get_properties;
14376 skeleton_class->flush = control_skeleton_dbus_interface_flush;
14377 skeleton_class->get_vtable = control_skeleton_dbus_interface_get_vtable;
14378
14379#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
14380 g_type_class_add_private (klass, sizeof (ControlSkeletonPrivate));
14381#endif
14382}
14383
14384static void
14385control_skeleton_iface_init (ControlIface *iface)
14386{
14387 iface->heartbeat = _control_on_signal_heartbeat;
14388 iface->goto_system_state = _control_on_signal_goto_system_state;
Norman Jamesa3e47c42015-10-18 14:43:10 -050014389 iface->started = _control_on_signal_started;
Norman James362a80f2015-09-14 14:04:39 -050014390 iface->get_poll_interval = control_skeleton_get_poll_interval;
14391 iface->get_heatbeat = control_skeleton_get_heatbeat;
14392}
14393
14394/**
14395 * control_skeleton_new:
14396 *
14397 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link>.
14398 *
14399 * Returns: (transfer full) (type ControlSkeleton): The skeleton object.
14400 */
14401Control *
14402control_skeleton_new (void)
14403{
14404 return CONTROL (g_object_new (TYPE_CONTROL_SKELETON, NULL));
14405}
14406
14407/* ------------------------------------------------------------------------
14408 * Code for interface org.openbmc.control.Bmc
14409 * ------------------------------------------------------------------------
14410 */
14411
14412/**
14413 * SECTION:ControlBmc
14414 * @title: ControlBmc
14415 * @short_description: Generated C code for the org.openbmc.control.Bmc D-Bus interface
14416 *
14417 * 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.
14418 */
14419
14420/* ---- Introspection data for org.openbmc.control.Bmc ---- */
14421
Williamf784d752016-01-19 12:28:49 +080014422static const _ExtendedGDBusMethodInfo _control_bmc_method_info_warm_reset =
Norman James362a80f2015-09-14 14:04:39 -050014423{
14424 {
14425 -1,
Williamf784d752016-01-19 12:28:49 +080014426 (gchar *) "warmReset",
Norman James362a80f2015-09-14 14:04:39 -050014427 NULL,
14428 NULL,
14429 NULL
14430 },
Williamf784d752016-01-19 12:28:49 +080014431 "handle-warm-reset",
Norman James362a80f2015-09-14 14:04:39 -050014432 FALSE
14433};
14434
14435static const _ExtendedGDBusMethodInfo * const _control_bmc_method_info_pointers[] =
14436{
Williamf784d752016-01-19 12:28:49 +080014437 &_control_bmc_method_info_warm_reset,
Norman James362a80f2015-09-14 14:04:39 -050014438 NULL
14439};
14440
14441static const _ExtendedGDBusInterfaceInfo _control_bmc_interface_info =
14442{
14443 {
14444 -1,
14445 (gchar *) "org.openbmc.control.Bmc",
14446 (GDBusMethodInfo **) &_control_bmc_method_info_pointers,
14447 NULL,
14448 NULL,
14449 NULL
14450 },
14451 "control-bmc",
14452};
14453
14454
14455/**
14456 * control_bmc_interface_info:
14457 *
14458 * 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.
14459 *
14460 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
14461 */
14462GDBusInterfaceInfo *
14463control_bmc_interface_info (void)
14464{
14465 return (GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct;
14466}
14467
14468/**
14469 * control_bmc_override_properties:
14470 * @klass: The class structure for a #GObject<!-- -->-derived class.
14471 * @property_id_begin: The property id to assign to the first overridden property.
14472 *
14473 * Overrides all #GObject properties in the #ControlBmc interface for a concrete class.
14474 * The properties are overridden in the order they are defined.
14475 *
14476 * Returns: The last property id.
14477 */
14478guint
14479control_bmc_override_properties (GObjectClass *klass, guint property_id_begin)
14480{
14481 return property_id_begin - 1;
14482}
14483
14484
14485
14486/**
14487 * ControlBmc:
14488 *
14489 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Bmc.top_of_page">org.openbmc.control.Bmc</link>.
14490 */
14491
14492/**
14493 * ControlBmcIface:
14494 * @parent_iface: The parent interface.
Williamf784d752016-01-19 12:28:49 +080014495 * @handle_warm_reset: Handler for the #ControlBmc::handle-warm-reset signal.
Norman James362a80f2015-09-14 14:04:39 -050014496 *
14497 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Bmc.top_of_page">org.openbmc.control.Bmc</link>.
14498 */
14499
14500typedef ControlBmcIface ControlBmcInterface;
14501G_DEFINE_INTERFACE (ControlBmc, control_bmc, G_TYPE_OBJECT);
14502
14503static void
14504control_bmc_default_init (ControlBmcIface *iface)
14505{
14506 /* GObject signals for incoming D-Bus method calls: */
14507 /**
Williamf784d752016-01-19 12:28:49 +080014508 * ControlBmc::handle-warm-reset:
Norman James362a80f2015-09-14 14:04:39 -050014509 * @object: A #ControlBmc.
14510 * @invocation: A #GDBusMethodInvocation.
14511 *
Williamf784d752016-01-19 12:28:49 +080014512 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Bmc.warmReset">warmReset()</link> D-Bus method.
Norman James362a80f2015-09-14 14:04:39 -050014513 *
Williamf784d752016-01-19 12:28:49 +080014514 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call control_bmc_complete_warm_reset() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
Norman James362a80f2015-09-14 14:04:39 -050014515 *
14516 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
14517 */
Williamf784d752016-01-19 12:28:49 +080014518 g_signal_new ("handle-warm-reset",
Norman James362a80f2015-09-14 14:04:39 -050014519 G_TYPE_FROM_INTERFACE (iface),
14520 G_SIGNAL_RUN_LAST,
Williamf784d752016-01-19 12:28:49 +080014521 G_STRUCT_OFFSET (ControlBmcIface, handle_warm_reset),
Norman James362a80f2015-09-14 14:04:39 -050014522 g_signal_accumulator_true_handled,
14523 NULL,
14524 g_cclosure_marshal_generic,
14525 G_TYPE_BOOLEAN,
14526 1,
14527 G_TYPE_DBUS_METHOD_INVOCATION);
14528
14529}
14530
14531/**
Williamf784d752016-01-19 12:28:49 +080014532 * control_bmc_call_warm_reset:
Norman James362a80f2015-09-14 14:04:39 -050014533 * @proxy: A #ControlBmcProxy.
14534 * @cancellable: (allow-none): A #GCancellable or %NULL.
14535 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
14536 * @user_data: User data to pass to @callback.
14537 *
Williamf784d752016-01-19 12:28:49 +080014538 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Bmc.warmReset">warmReset()</link> D-Bus method on @proxy.
Norman James362a80f2015-09-14 14:04:39 -050014539 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
Williamf784d752016-01-19 12:28:49 +080014540 * You can then call control_bmc_call_warm_reset_finish() to get the result of the operation.
Norman James362a80f2015-09-14 14:04:39 -050014541 *
Williamf784d752016-01-19 12:28:49 +080014542 * See control_bmc_call_warm_reset_sync() for the synchronous, blocking version of this method.
Norman James362a80f2015-09-14 14:04:39 -050014543 */
14544void
Williamf784d752016-01-19 12:28:49 +080014545control_bmc_call_warm_reset (
Norman James362a80f2015-09-14 14:04:39 -050014546 ControlBmc *proxy,
14547 GCancellable *cancellable,
14548 GAsyncReadyCallback callback,
14549 gpointer user_data)
14550{
14551 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
Williamf784d752016-01-19 12:28:49 +080014552 "warmReset",
Norman James362a80f2015-09-14 14:04:39 -050014553 g_variant_new ("()"),
14554 G_DBUS_CALL_FLAGS_NONE,
14555 -1,
14556 cancellable,
14557 callback,
14558 user_data);
14559}
14560
14561/**
Williamf784d752016-01-19 12:28:49 +080014562 * control_bmc_call_warm_reset_finish:
Norman James362a80f2015-09-14 14:04:39 -050014563 * @proxy: A #ControlBmcProxy.
Williamf784d752016-01-19 12:28:49 +080014564 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_bmc_call_warm_reset().
Norman James362a80f2015-09-14 14:04:39 -050014565 * @error: Return location for error or %NULL.
14566 *
Williamf784d752016-01-19 12:28:49 +080014567 * Finishes an operation started with control_bmc_call_warm_reset().
Norman James362a80f2015-09-14 14:04:39 -050014568 *
14569 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
14570 */
14571gboolean
Williamf784d752016-01-19 12:28:49 +080014572control_bmc_call_warm_reset_finish (
Norman James362a80f2015-09-14 14:04:39 -050014573 ControlBmc *proxy,
14574 GAsyncResult *res,
14575 GError **error)
14576{
14577 GVariant *_ret;
14578 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
14579 if (_ret == NULL)
14580 goto _out;
14581 g_variant_get (_ret,
14582 "()");
14583 g_variant_unref (_ret);
14584_out:
14585 return _ret != NULL;
14586}
14587
14588/**
Williamf784d752016-01-19 12:28:49 +080014589 * control_bmc_call_warm_reset_sync:
Norman James362a80f2015-09-14 14:04:39 -050014590 * @proxy: A #ControlBmcProxy.
14591 * @cancellable: (allow-none): A #GCancellable or %NULL.
14592 * @error: Return location for error or %NULL.
14593 *
Williamf784d752016-01-19 12:28:49 +080014594 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Bmc.warmReset">warmReset()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
Norman James362a80f2015-09-14 14:04:39 -050014595 *
Williamf784d752016-01-19 12:28:49 +080014596 * See control_bmc_call_warm_reset() for the asynchronous version of this method.
Norman James362a80f2015-09-14 14:04:39 -050014597 *
14598 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
14599 */
14600gboolean
Williamf784d752016-01-19 12:28:49 +080014601control_bmc_call_warm_reset_sync (
Norman James362a80f2015-09-14 14:04:39 -050014602 ControlBmc *proxy,
14603 GCancellable *cancellable,
14604 GError **error)
14605{
14606 GVariant *_ret;
14607 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
Williamf784d752016-01-19 12:28:49 +080014608 "warmReset",
Norman James362a80f2015-09-14 14:04:39 -050014609 g_variant_new ("()"),
14610 G_DBUS_CALL_FLAGS_NONE,
14611 -1,
14612 cancellable,
14613 error);
14614 if (_ret == NULL)
14615 goto _out;
14616 g_variant_get (_ret,
14617 "()");
14618 g_variant_unref (_ret);
14619_out:
14620 return _ret != NULL;
14621}
14622
14623/**
Williamf784d752016-01-19 12:28:49 +080014624 * control_bmc_complete_warm_reset:
Norman James362a80f2015-09-14 14:04:39 -050014625 * @object: A #ControlBmc.
14626 * @invocation: (transfer full): A #GDBusMethodInvocation.
14627 *
Williamf784d752016-01-19 12:28:49 +080014628 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-control-Bmc.warmReset">warmReset()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
Norman James362a80f2015-09-14 14:04:39 -050014629 *
14630 * This method will free @invocation, you cannot use it afterwards.
14631 */
14632void
Williamf784d752016-01-19 12:28:49 +080014633control_bmc_complete_warm_reset (
Norman James362a80f2015-09-14 14:04:39 -050014634 ControlBmc *object,
14635 GDBusMethodInvocation *invocation)
14636{
14637 g_dbus_method_invocation_return_value (invocation,
14638 g_variant_new ("()"));
14639}
14640
14641/* ------------------------------------------------------------------------ */
14642
14643/**
14644 * ControlBmcProxy:
14645 *
14646 * The #ControlBmcProxy structure contains only private data and should only be accessed using the provided API.
14647 */
14648
14649/**
14650 * ControlBmcProxyClass:
14651 * @parent_class: The parent class.
14652 *
14653 * Class structure for #ControlBmcProxy.
14654 */
14655
14656struct _ControlBmcProxyPrivate
14657{
14658 GData *qdata;
14659};
14660
14661static void control_bmc_proxy_iface_init (ControlBmcIface *iface);
14662
14663#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
14664G_DEFINE_TYPE_WITH_CODE (ControlBmcProxy, control_bmc_proxy, G_TYPE_DBUS_PROXY,
14665 G_ADD_PRIVATE (ControlBmcProxy)
14666 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_BMC, control_bmc_proxy_iface_init));
14667
14668#else
14669G_DEFINE_TYPE_WITH_CODE (ControlBmcProxy, control_bmc_proxy, G_TYPE_DBUS_PROXY,
14670 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_BMC, control_bmc_proxy_iface_init));
14671
14672#endif
14673static void
14674control_bmc_proxy_finalize (GObject *object)
14675{
14676 ControlBmcProxy *proxy = CONTROL_BMC_PROXY (object);
14677 g_datalist_clear (&proxy->priv->qdata);
14678 G_OBJECT_CLASS (control_bmc_proxy_parent_class)->finalize (object);
14679}
14680
14681static void
14682control_bmc_proxy_get_property (GObject *object,
14683 guint prop_id,
14684 GValue *value,
14685 GParamSpec *pspec G_GNUC_UNUSED)
14686{
14687}
14688
14689static void
14690control_bmc_proxy_set_property (GObject *object,
14691 guint prop_id,
14692 const GValue *value,
14693 GParamSpec *pspec G_GNUC_UNUSED)
14694{
14695}
14696
14697static void
14698control_bmc_proxy_g_signal (GDBusProxy *proxy,
14699 const gchar *sender_name G_GNUC_UNUSED,
14700 const gchar *signal_name,
14701 GVariant *parameters)
14702{
14703 _ExtendedGDBusSignalInfo *info;
14704 GVariantIter iter;
14705 GVariant *child;
14706 GValue *paramv;
14707 guint num_params;
14708 guint n;
14709 guint signal_id;
14710 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, signal_name);
14711 if (info == NULL)
14712 return;
14713 num_params = g_variant_n_children (parameters);
14714 paramv = g_new0 (GValue, num_params + 1);
14715 g_value_init (&paramv[0], TYPE_CONTROL_BMC);
14716 g_value_set_object (&paramv[0], proxy);
14717 g_variant_iter_init (&iter, parameters);
14718 n = 1;
14719 while ((child = g_variant_iter_next_value (&iter)) != NULL)
14720 {
14721 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
14722 if (arg_info->use_gvariant)
14723 {
14724 g_value_init (&paramv[n], G_TYPE_VARIANT);
14725 g_value_set_variant (&paramv[n], child);
14726 n++;
14727 }
14728 else
14729 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
14730 g_variant_unref (child);
14731 }
14732 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_BMC);
14733 g_signal_emitv (paramv, signal_id, 0, NULL);
14734 for (n = 0; n < num_params + 1; n++)
14735 g_value_unset (&paramv[n]);
14736 g_free (paramv);
14737}
14738
14739static void
14740control_bmc_proxy_g_properties_changed (GDBusProxy *_proxy,
14741 GVariant *changed_properties,
14742 const gchar *const *invalidated_properties)
14743{
14744 ControlBmcProxy *proxy = CONTROL_BMC_PROXY (_proxy);
14745 guint n;
14746 const gchar *key;
14747 GVariantIter *iter;
14748 _ExtendedGDBusPropertyInfo *info;
14749 g_variant_get (changed_properties, "a{sv}", &iter);
14750 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
14751 {
14752 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, key);
14753 g_datalist_remove_data (&proxy->priv->qdata, key);
14754 if (info != NULL)
14755 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
14756 }
14757 g_variant_iter_free (iter);
14758 for (n = 0; invalidated_properties[n] != NULL; n++)
14759 {
14760 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, invalidated_properties[n]);
14761 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
14762 if (info != NULL)
14763 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
14764 }
14765}
14766
14767static void
14768control_bmc_proxy_init (ControlBmcProxy *proxy)
14769{
14770#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
14771 proxy->priv = control_bmc_proxy_get_instance_private (proxy);
14772#else
14773 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_BMC_PROXY, ControlBmcProxyPrivate);
14774#endif
14775
14776 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_bmc_interface_info ());
14777}
14778
14779static void
14780control_bmc_proxy_class_init (ControlBmcProxyClass *klass)
14781{
14782 GObjectClass *gobject_class;
14783 GDBusProxyClass *proxy_class;
14784
14785 gobject_class = G_OBJECT_CLASS (klass);
14786 gobject_class->finalize = control_bmc_proxy_finalize;
14787 gobject_class->get_property = control_bmc_proxy_get_property;
14788 gobject_class->set_property = control_bmc_proxy_set_property;
14789
14790 proxy_class = G_DBUS_PROXY_CLASS (klass);
14791 proxy_class->g_signal = control_bmc_proxy_g_signal;
14792 proxy_class->g_properties_changed = control_bmc_proxy_g_properties_changed;
14793
14794#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
14795 g_type_class_add_private (klass, sizeof (ControlBmcProxyPrivate));
14796#endif
14797}
14798
14799static void
14800control_bmc_proxy_iface_init (ControlBmcIface *iface)
14801{
14802}
14803
14804/**
14805 * control_bmc_proxy_new:
14806 * @connection: A #GDBusConnection.
14807 * @flags: Flags from the #GDBusProxyFlags enumeration.
14808 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
14809 * @object_path: An object path.
14810 * @cancellable: (allow-none): A #GCancellable or %NULL.
14811 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
14812 * @user_data: User data to pass to @callback.
14813 *
14814 * 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.
14815 *
14816 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
14817 * You can then call control_bmc_proxy_new_finish() to get the result of the operation.
14818 *
14819 * See control_bmc_proxy_new_sync() for the synchronous, blocking version of this constructor.
14820 */
14821void
14822control_bmc_proxy_new (
14823 GDBusConnection *connection,
14824 GDBusProxyFlags flags,
14825 const gchar *name,
14826 const gchar *object_path,
14827 GCancellable *cancellable,
14828 GAsyncReadyCallback callback,
14829 gpointer user_data)
14830{
14831 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);
14832}
14833
14834/**
14835 * control_bmc_proxy_new_finish:
14836 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_bmc_proxy_new().
14837 * @error: Return location for error or %NULL
14838 *
14839 * Finishes an operation started with control_bmc_proxy_new().
14840 *
14841 * Returns: (transfer full) (type ControlBmcProxy): The constructed proxy object or %NULL if @error is set.
14842 */
14843ControlBmc *
14844control_bmc_proxy_new_finish (
14845 GAsyncResult *res,
14846 GError **error)
14847{
14848 GObject *ret;
14849 GObject *source_object;
14850 source_object = g_async_result_get_source_object (res);
14851 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
14852 g_object_unref (source_object);
14853 if (ret != NULL)
14854 return CONTROL_BMC (ret);
14855 else
14856 return NULL;
14857}
14858
14859/**
14860 * control_bmc_proxy_new_sync:
14861 * @connection: A #GDBusConnection.
14862 * @flags: Flags from the #GDBusProxyFlags enumeration.
14863 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
14864 * @object_path: An object path.
14865 * @cancellable: (allow-none): A #GCancellable or %NULL.
14866 * @error: Return location for error or %NULL
14867 *
14868 * 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.
14869 *
14870 * The calling thread is blocked until a reply is received.
14871 *
14872 * See control_bmc_proxy_new() for the asynchronous version of this constructor.
14873 *
14874 * Returns: (transfer full) (type ControlBmcProxy): The constructed proxy object or %NULL if @error is set.
14875 */
14876ControlBmc *
14877control_bmc_proxy_new_sync (
14878 GDBusConnection *connection,
14879 GDBusProxyFlags flags,
14880 const gchar *name,
14881 const gchar *object_path,
14882 GCancellable *cancellable,
14883 GError **error)
14884{
14885 GInitable *ret;
14886 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);
14887 if (ret != NULL)
14888 return CONTROL_BMC (ret);
14889 else
14890 return NULL;
14891}
14892
14893
14894/**
14895 * control_bmc_proxy_new_for_bus:
14896 * @bus_type: A #GBusType.
14897 * @flags: Flags from the #GDBusProxyFlags enumeration.
14898 * @name: A bus name (well-known or unique).
14899 * @object_path: An object path.
14900 * @cancellable: (allow-none): A #GCancellable or %NULL.
14901 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
14902 * @user_data: User data to pass to @callback.
14903 *
14904 * Like control_bmc_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
14905 *
14906 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
14907 * You can then call control_bmc_proxy_new_for_bus_finish() to get the result of the operation.
14908 *
14909 * See control_bmc_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
14910 */
14911void
14912control_bmc_proxy_new_for_bus (
14913 GBusType bus_type,
14914 GDBusProxyFlags flags,
14915 const gchar *name,
14916 const gchar *object_path,
14917 GCancellable *cancellable,
14918 GAsyncReadyCallback callback,
14919 gpointer user_data)
14920{
14921 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);
14922}
14923
14924/**
14925 * control_bmc_proxy_new_for_bus_finish:
14926 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_bmc_proxy_new_for_bus().
14927 * @error: Return location for error or %NULL
14928 *
14929 * Finishes an operation started with control_bmc_proxy_new_for_bus().
14930 *
14931 * Returns: (transfer full) (type ControlBmcProxy): The constructed proxy object or %NULL if @error is set.
14932 */
14933ControlBmc *
14934control_bmc_proxy_new_for_bus_finish (
14935 GAsyncResult *res,
14936 GError **error)
14937{
14938 GObject *ret;
14939 GObject *source_object;
14940 source_object = g_async_result_get_source_object (res);
14941 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
14942 g_object_unref (source_object);
14943 if (ret != NULL)
14944 return CONTROL_BMC (ret);
14945 else
14946 return NULL;
14947}
14948
14949/**
14950 * control_bmc_proxy_new_for_bus_sync:
14951 * @bus_type: A #GBusType.
14952 * @flags: Flags from the #GDBusProxyFlags enumeration.
14953 * @name: A bus name (well-known or unique).
14954 * @object_path: An object path.
14955 * @cancellable: (allow-none): A #GCancellable or %NULL.
14956 * @error: Return location for error or %NULL
14957 *
14958 * Like control_bmc_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
14959 *
14960 * The calling thread is blocked until a reply is received.
14961 *
14962 * See control_bmc_proxy_new_for_bus() for the asynchronous version of this constructor.
14963 *
14964 * Returns: (transfer full) (type ControlBmcProxy): The constructed proxy object or %NULL if @error is set.
14965 */
14966ControlBmc *
14967control_bmc_proxy_new_for_bus_sync (
14968 GBusType bus_type,
14969 GDBusProxyFlags flags,
14970 const gchar *name,
14971 const gchar *object_path,
14972 GCancellable *cancellable,
14973 GError **error)
14974{
14975 GInitable *ret;
14976 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);
14977 if (ret != NULL)
14978 return CONTROL_BMC (ret);
14979 else
14980 return NULL;
14981}
14982
14983
14984/* ------------------------------------------------------------------------ */
14985
14986/**
14987 * ControlBmcSkeleton:
14988 *
14989 * The #ControlBmcSkeleton structure contains only private data and should only be accessed using the provided API.
14990 */
14991
14992/**
14993 * ControlBmcSkeletonClass:
14994 * @parent_class: The parent class.
14995 *
14996 * Class structure for #ControlBmcSkeleton.
14997 */
14998
14999struct _ControlBmcSkeletonPrivate
15000{
15001 GValue *properties;
15002 GList *changed_properties;
15003 GSource *changed_properties_idle_source;
15004 GMainContext *context;
15005 GMutex lock;
15006};
15007
15008static void
15009_control_bmc_skeleton_handle_method_call (
15010 GDBusConnection *connection G_GNUC_UNUSED,
15011 const gchar *sender G_GNUC_UNUSED,
15012 const gchar *object_path G_GNUC_UNUSED,
15013 const gchar *interface_name,
15014 const gchar *method_name,
15015 GVariant *parameters,
15016 GDBusMethodInvocation *invocation,
15017 gpointer user_data)
15018{
15019 ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (user_data);
15020 _ExtendedGDBusMethodInfo *info;
15021 GVariantIter iter;
15022 GVariant *child;
15023 GValue *paramv;
15024 guint num_params;
15025 guint num_extra;
15026 guint n;
15027 guint signal_id;
15028 GValue return_value = G_VALUE_INIT;
15029 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
15030 g_assert (info != NULL);
15031 num_params = g_variant_n_children (parameters);
15032 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
15033 n = 0;
15034 g_value_init (&paramv[n], TYPE_CONTROL_BMC);
15035 g_value_set_object (&paramv[n++], skeleton);
15036 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
15037 g_value_set_object (&paramv[n++], invocation);
15038 if (info->pass_fdlist)
15039 {
15040#ifdef G_OS_UNIX
15041 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
15042 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
15043#else
15044 g_assert_not_reached ();
15045#endif
15046 }
15047 g_variant_iter_init (&iter, parameters);
15048 while ((child = g_variant_iter_next_value (&iter)) != NULL)
15049 {
15050 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
15051 if (arg_info->use_gvariant)
15052 {
15053 g_value_init (&paramv[n], G_TYPE_VARIANT);
15054 g_value_set_variant (&paramv[n], child);
15055 n++;
15056 }
15057 else
15058 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
15059 g_variant_unref (child);
15060 }
15061 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_BMC);
15062 g_value_init (&return_value, G_TYPE_BOOLEAN);
15063 g_signal_emitv (paramv, signal_id, 0, &return_value);
15064 if (!g_value_get_boolean (&return_value))
15065 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);
15066 g_value_unset (&return_value);
15067 for (n = 0; n < num_params + num_extra; n++)
15068 g_value_unset (&paramv[n]);
15069 g_free (paramv);
15070}
15071
15072static GVariant *
15073_control_bmc_skeleton_handle_get_property (
15074 GDBusConnection *connection G_GNUC_UNUSED,
15075 const gchar *sender G_GNUC_UNUSED,
15076 const gchar *object_path G_GNUC_UNUSED,
15077 const gchar *interface_name G_GNUC_UNUSED,
15078 const gchar *property_name,
15079 GError **error,
15080 gpointer user_data)
15081{
15082 ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (user_data);
15083 GValue value = G_VALUE_INIT;
15084 GParamSpec *pspec;
15085 _ExtendedGDBusPropertyInfo *info;
15086 GVariant *ret;
15087 ret = NULL;
15088 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, property_name);
15089 g_assert (info != NULL);
15090 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
15091 if (pspec == NULL)
15092 {
15093 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
15094 }
15095 else
15096 {
15097 g_value_init (&value, pspec->value_type);
15098 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
15099 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
15100 g_value_unset (&value);
15101 }
15102 return ret;
15103}
15104
15105static gboolean
15106_control_bmc_skeleton_handle_set_property (
15107 GDBusConnection *connection G_GNUC_UNUSED,
15108 const gchar *sender G_GNUC_UNUSED,
15109 const gchar *object_path G_GNUC_UNUSED,
15110 const gchar *interface_name G_GNUC_UNUSED,
15111 const gchar *property_name,
15112 GVariant *variant,
15113 GError **error,
15114 gpointer user_data)
15115{
15116 ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (user_data);
15117 GValue value = G_VALUE_INIT;
15118 GParamSpec *pspec;
15119 _ExtendedGDBusPropertyInfo *info;
15120 gboolean ret;
15121 ret = FALSE;
15122 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, property_name);
15123 g_assert (info != NULL);
15124 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
15125 if (pspec == NULL)
15126 {
15127 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
15128 }
15129 else
15130 {
15131 if (info->use_gvariant)
15132 g_value_set_variant (&value, variant);
15133 else
15134 g_dbus_gvariant_to_gvalue (variant, &value);
15135 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
15136 g_value_unset (&value);
15137 ret = TRUE;
15138 }
15139 return ret;
15140}
15141
15142static const GDBusInterfaceVTable _control_bmc_skeleton_vtable =
15143{
15144 _control_bmc_skeleton_handle_method_call,
15145 _control_bmc_skeleton_handle_get_property,
15146 _control_bmc_skeleton_handle_set_property,
15147 {NULL}
15148};
15149
15150static GDBusInterfaceInfo *
15151control_bmc_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
15152{
15153 return control_bmc_interface_info ();
15154}
15155
15156static GDBusInterfaceVTable *
15157control_bmc_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
15158{
15159 return (GDBusInterfaceVTable *) &_control_bmc_skeleton_vtable;
15160}
15161
15162static GVariant *
15163control_bmc_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
15164{
15165 ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (_skeleton);
15166
15167 GVariantBuilder builder;
15168 guint n;
15169 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
15170 if (_control_bmc_interface_info.parent_struct.properties == NULL)
15171 goto out;
15172 for (n = 0; _control_bmc_interface_info.parent_struct.properties[n] != NULL; n++)
15173 {
15174 GDBusPropertyInfo *info = _control_bmc_interface_info.parent_struct.properties[n];
15175 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
15176 {
15177 GVariant *value;
15178 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);
15179 if (value != NULL)
15180 {
15181 g_variant_take_ref (value);
15182 g_variant_builder_add (&builder, "{sv}", info->name, value);
15183 g_variant_unref (value);
15184 }
15185 }
15186 }
15187out:
15188 return g_variant_builder_end (&builder);
15189}
15190
15191static void
15192control_bmc_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
15193{
15194}
15195
15196static void control_bmc_skeleton_iface_init (ControlBmcIface *iface);
15197#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
15198G_DEFINE_TYPE_WITH_CODE (ControlBmcSkeleton, control_bmc_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
15199 G_ADD_PRIVATE (ControlBmcSkeleton)
15200 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_BMC, control_bmc_skeleton_iface_init));
15201
15202#else
15203G_DEFINE_TYPE_WITH_CODE (ControlBmcSkeleton, control_bmc_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
15204 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_BMC, control_bmc_skeleton_iface_init));
15205
15206#endif
15207static void
15208control_bmc_skeleton_finalize (GObject *object)
15209{
15210 ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (object);
15211 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
15212 if (skeleton->priv->changed_properties_idle_source != NULL)
15213 g_source_destroy (skeleton->priv->changed_properties_idle_source);
15214 g_main_context_unref (skeleton->priv->context);
15215 g_mutex_clear (&skeleton->priv->lock);
15216 G_OBJECT_CLASS (control_bmc_skeleton_parent_class)->finalize (object);
15217}
15218
15219static void
15220control_bmc_skeleton_init (ControlBmcSkeleton *skeleton)
15221{
15222#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
15223 skeleton->priv = control_bmc_skeleton_get_instance_private (skeleton);
15224#else
15225 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_BMC_SKELETON, ControlBmcSkeletonPrivate);
15226#endif
15227
15228 g_mutex_init (&skeleton->priv->lock);
15229 skeleton->priv->context = g_main_context_ref_thread_default ();
15230}
15231
15232static void
15233control_bmc_skeleton_class_init (ControlBmcSkeletonClass *klass)
15234{
15235 GObjectClass *gobject_class;
15236 GDBusInterfaceSkeletonClass *skeleton_class;
15237
15238 gobject_class = G_OBJECT_CLASS (klass);
15239 gobject_class->finalize = control_bmc_skeleton_finalize;
15240
15241 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
15242 skeleton_class->get_info = control_bmc_skeleton_dbus_interface_get_info;
15243 skeleton_class->get_properties = control_bmc_skeleton_dbus_interface_get_properties;
15244 skeleton_class->flush = control_bmc_skeleton_dbus_interface_flush;
15245 skeleton_class->get_vtable = control_bmc_skeleton_dbus_interface_get_vtable;
15246
15247#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
15248 g_type_class_add_private (klass, sizeof (ControlBmcSkeletonPrivate));
15249#endif
15250}
15251
15252static void
15253control_bmc_skeleton_iface_init (ControlBmcIface *iface)
15254{
15255}
15256
15257/**
15258 * control_bmc_skeleton_new:
15259 *
15260 * 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>.
15261 *
15262 * Returns: (transfer full) (type ControlBmcSkeleton): The skeleton object.
15263 */
15264ControlBmc *
15265control_bmc_skeleton_new (void)
15266{
15267 return CONTROL_BMC (g_object_new (TYPE_CONTROL_BMC_SKELETON, NULL));
15268}
15269
15270/* ------------------------------------------------------------------------
15271 * Code for interface org.openbmc.control.Host
15272 * ------------------------------------------------------------------------
15273 */
15274
15275/**
15276 * SECTION:ControlHost
15277 * @title: ControlHost
15278 * @short_description: Generated C code for the org.openbmc.control.Host D-Bus interface
15279 *
15280 * 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.
15281 */
15282
15283/* ---- Introspection data for org.openbmc.control.Host ---- */
15284
15285static const _ExtendedGDBusMethodInfo _control_host_method_info_boot =
15286{
15287 {
15288 -1,
15289 (gchar *) "boot",
15290 NULL,
15291 NULL,
15292 NULL
15293 },
15294 "handle-boot",
15295 FALSE
15296};
15297
15298static const _ExtendedGDBusMethodInfo _control_host_method_info_shutdown =
15299{
15300 {
15301 -1,
15302 (gchar *) "shutdown",
15303 NULL,
15304 NULL,
15305 NULL
15306 },
15307 "handle-shutdown",
15308 FALSE
15309};
15310
15311static const _ExtendedGDBusMethodInfo _control_host_method_info_reboot =
15312{
15313 {
15314 -1,
15315 (gchar *) "reboot",
15316 NULL,
15317 NULL,
15318 NULL
15319 },
15320 "handle-reboot",
15321 FALSE
15322};
15323
15324static const _ExtendedGDBusMethodInfo * const _control_host_method_info_pointers[] =
15325{
15326 &_control_host_method_info_boot,
15327 &_control_host_method_info_shutdown,
15328 &_control_host_method_info_reboot,
15329 NULL
15330};
15331
15332static const _ExtendedGDBusSignalInfo _control_host_signal_info_booted =
15333{
15334 {
15335 -1,
15336 (gchar *) "Booted",
15337 NULL,
15338 NULL
15339 },
15340 "booted"
15341};
15342
15343static const _ExtendedGDBusSignalInfo * const _control_host_signal_info_pointers[] =
15344{
15345 &_control_host_signal_info_booted,
15346 NULL
15347};
15348
Norman James493996c2015-10-31 17:27:13 -050015349static const _ExtendedGDBusPropertyInfo _control_host_property_info_debug_mode =
15350{
15351 {
15352 -1,
15353 (gchar *) "debug_mode",
15354 (gchar *) "i",
15355 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
15356 NULL
15357 },
15358 "debug-mode",
15359 FALSE
15360};
15361
15362static const _ExtendedGDBusPropertyInfo _control_host_property_info_flash_side =
15363{
15364 {
15365 -1,
15366 (gchar *) "flash_side",
15367 (gchar *) "s",
15368 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
15369 NULL
15370 },
15371 "flash-side",
15372 FALSE
15373};
15374
15375static const _ExtendedGDBusPropertyInfo * const _control_host_property_info_pointers[] =
15376{
15377 &_control_host_property_info_debug_mode,
15378 &_control_host_property_info_flash_side,
15379 NULL
15380};
15381
Norman James362a80f2015-09-14 14:04:39 -050015382static const _ExtendedGDBusInterfaceInfo _control_host_interface_info =
15383{
15384 {
15385 -1,
15386 (gchar *) "org.openbmc.control.Host",
15387 (GDBusMethodInfo **) &_control_host_method_info_pointers,
15388 (GDBusSignalInfo **) &_control_host_signal_info_pointers,
Norman James493996c2015-10-31 17:27:13 -050015389 (GDBusPropertyInfo **) &_control_host_property_info_pointers,
Norman James362a80f2015-09-14 14:04:39 -050015390 NULL
15391 },
15392 "control-host",
15393};
15394
15395
15396/**
15397 * control_host_interface_info:
15398 *
15399 * 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.
15400 *
15401 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
15402 */
15403GDBusInterfaceInfo *
15404control_host_interface_info (void)
15405{
15406 return (GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct;
15407}
15408
15409/**
15410 * control_host_override_properties:
15411 * @klass: The class structure for a #GObject<!-- -->-derived class.
15412 * @property_id_begin: The property id to assign to the first overridden property.
15413 *
15414 * Overrides all #GObject properties in the #ControlHost interface for a concrete class.
15415 * The properties are overridden in the order they are defined.
15416 *
15417 * Returns: The last property id.
15418 */
15419guint
15420control_host_override_properties (GObjectClass *klass, guint property_id_begin)
15421{
Norman James493996c2015-10-31 17:27:13 -050015422 g_object_class_override_property (klass, property_id_begin++, "debug-mode");
15423 g_object_class_override_property (klass, property_id_begin++, "flash-side");
Norman James362a80f2015-09-14 14:04:39 -050015424 return property_id_begin - 1;
15425}
15426
15427
15428
15429/**
15430 * ControlHost:
15431 *
15432 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link>.
15433 */
15434
15435/**
15436 * ControlHostIface:
15437 * @parent_iface: The parent interface.
15438 * @handle_boot: Handler for the #ControlHost::handle-boot signal.
15439 * @handle_reboot: Handler for the #ControlHost::handle-reboot signal.
15440 * @handle_shutdown: Handler for the #ControlHost::handle-shutdown signal.
Norman James493996c2015-10-31 17:27:13 -050015441 * @get_debug_mode: Getter for the #ControlHost:debug-mode property.
15442 * @get_flash_side: Getter for the #ControlHost:flash-side property.
Norman James362a80f2015-09-14 14:04:39 -050015443 * @booted: Handler for the #ControlHost::booted signal.
15444 *
15445 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link>.
15446 */
15447
15448typedef ControlHostIface ControlHostInterface;
15449G_DEFINE_INTERFACE (ControlHost, control_host, G_TYPE_OBJECT);
15450
15451static void
15452control_host_default_init (ControlHostIface *iface)
15453{
15454 /* GObject signals for incoming D-Bus method calls: */
15455 /**
15456 * ControlHost::handle-boot:
15457 * @object: A #ControlHost.
15458 * @invocation: A #GDBusMethodInvocation.
15459 *
15460 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Host.boot">boot()</link> D-Bus method.
15461 *
15462 * 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.
15463 *
15464 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
15465 */
15466 g_signal_new ("handle-boot",
15467 G_TYPE_FROM_INTERFACE (iface),
15468 G_SIGNAL_RUN_LAST,
15469 G_STRUCT_OFFSET (ControlHostIface, handle_boot),
15470 g_signal_accumulator_true_handled,
15471 NULL,
15472 g_cclosure_marshal_generic,
15473 G_TYPE_BOOLEAN,
15474 1,
15475 G_TYPE_DBUS_METHOD_INVOCATION);
15476
15477 /**
15478 * ControlHost::handle-shutdown:
15479 * @object: A #ControlHost.
15480 * @invocation: A #GDBusMethodInvocation.
15481 *
15482 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Host.shutdown">shutdown()</link> D-Bus method.
15483 *
15484 * 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.
15485 *
15486 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
15487 */
15488 g_signal_new ("handle-shutdown",
15489 G_TYPE_FROM_INTERFACE (iface),
15490 G_SIGNAL_RUN_LAST,
15491 G_STRUCT_OFFSET (ControlHostIface, handle_shutdown),
15492 g_signal_accumulator_true_handled,
15493 NULL,
15494 g_cclosure_marshal_generic,
15495 G_TYPE_BOOLEAN,
15496 1,
15497 G_TYPE_DBUS_METHOD_INVOCATION);
15498
15499 /**
15500 * ControlHost::handle-reboot:
15501 * @object: A #ControlHost.
15502 * @invocation: A #GDBusMethodInvocation.
15503 *
15504 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Host.reboot">reboot()</link> D-Bus method.
15505 *
15506 * 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.
15507 *
15508 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
15509 */
15510 g_signal_new ("handle-reboot",
15511 G_TYPE_FROM_INTERFACE (iface),
15512 G_SIGNAL_RUN_LAST,
15513 G_STRUCT_OFFSET (ControlHostIface, handle_reboot),
15514 g_signal_accumulator_true_handled,
15515 NULL,
15516 g_cclosure_marshal_generic,
15517 G_TYPE_BOOLEAN,
15518 1,
15519 G_TYPE_DBUS_METHOD_INVOCATION);
15520
15521 /* GObject signals for received D-Bus signals: */
15522 /**
15523 * ControlHost::booted:
15524 * @object: A #ControlHost.
15525 *
15526 * 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.
15527 *
15528 * 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.
15529 */
15530 g_signal_new ("booted",
15531 G_TYPE_FROM_INTERFACE (iface),
15532 G_SIGNAL_RUN_LAST,
15533 G_STRUCT_OFFSET (ControlHostIface, booted),
15534 NULL,
15535 NULL,
15536 g_cclosure_marshal_generic,
15537 G_TYPE_NONE,
15538 0);
15539
Norman James493996c2015-10-31 17:27:13 -050015540 /* GObject properties for D-Bus properties: */
15541 /**
15542 * ControlHost:debug-mode:
15543 *
15544 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-control-Host.debug_mode">"debug_mode"</link>.
15545 *
15546 * 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.
15547 */
15548 g_object_interface_install_property (iface,
15549 g_param_spec_int ("debug-mode", "debug_mode", "debug_mode", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
15550 /**
15551 * ControlHost:flash-side:
15552 *
15553 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-control-Host.flash_side">"flash_side"</link>.
15554 *
15555 * 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.
15556 */
15557 g_object_interface_install_property (iface,
15558 g_param_spec_string ("flash-side", "flash_side", "flash_side", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
15559}
15560
15561/**
15562 * control_host_get_debug_mode: (skip)
15563 * @object: A #ControlHost.
15564 *
15565 * Gets the value of the <link linkend="gdbus-property-org-openbmc-control-Host.debug_mode">"debug_mode"</link> D-Bus property.
15566 *
15567 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
15568 *
15569 * Returns: The property value.
15570 */
15571gint
15572control_host_get_debug_mode (ControlHost *object)
15573{
15574 return CONTROL_HOST_GET_IFACE (object)->get_debug_mode (object);
15575}
15576
15577/**
15578 * control_host_set_debug_mode: (skip)
15579 * @object: A #ControlHost.
15580 * @value: The value to set.
15581 *
15582 * Sets the <link linkend="gdbus-property-org-openbmc-control-Host.debug_mode">"debug_mode"</link> D-Bus property to @value.
15583 *
15584 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
15585 */
15586void
15587control_host_set_debug_mode (ControlHost *object, gint value)
15588{
15589 g_object_set (G_OBJECT (object), "debug-mode", value, NULL);
15590}
15591
15592/**
15593 * control_host_get_flash_side: (skip)
15594 * @object: A #ControlHost.
15595 *
15596 * Gets the value of the <link linkend="gdbus-property-org-openbmc-control-Host.flash_side">"flash_side"</link> D-Bus property.
15597 *
15598 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
15599 *
15600 * <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>
15601 *
15602 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
15603 */
15604const gchar *
15605control_host_get_flash_side (ControlHost *object)
15606{
15607 return CONTROL_HOST_GET_IFACE (object)->get_flash_side (object);
15608}
15609
15610/**
15611 * control_host_dup_flash_side: (skip)
15612 * @object: A #ControlHost.
15613 *
15614 * Gets a copy 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 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
15619 */
15620gchar *
15621control_host_dup_flash_side (ControlHost *object)
15622{
15623 gchar *value;
15624 g_object_get (G_OBJECT (object), "flash-side", &value, NULL);
15625 return value;
15626}
15627
15628/**
15629 * control_host_set_flash_side: (skip)
15630 * @object: A #ControlHost.
15631 * @value: The value to set.
15632 *
15633 * Sets the <link linkend="gdbus-property-org-openbmc-control-Host.flash_side">"flash_side"</link> D-Bus property to @value.
15634 *
15635 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
15636 */
15637void
15638control_host_set_flash_side (ControlHost *object, const gchar *value)
15639{
15640 g_object_set (G_OBJECT (object), "flash-side", value, NULL);
Norman James362a80f2015-09-14 14:04:39 -050015641}
15642
15643/**
15644 * control_host_emit_booted:
15645 * @object: A #ControlHost.
15646 *
15647 * Emits the <link linkend="gdbus-signal-org-openbmc-control-Host.Booted">"Booted"</link> D-Bus signal.
15648 */
15649void
15650control_host_emit_booted (
15651 ControlHost *object)
15652{
15653 g_signal_emit_by_name (object, "booted");
15654}
15655
15656/**
15657 * control_host_call_boot:
15658 * @proxy: A #ControlHostProxy.
15659 * @cancellable: (allow-none): A #GCancellable or %NULL.
15660 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
15661 * @user_data: User data to pass to @callback.
15662 *
15663 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Host.boot">boot()</link> D-Bus method on @proxy.
15664 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
15665 * You can then call control_host_call_boot_finish() to get the result of the operation.
15666 *
15667 * See control_host_call_boot_sync() for the synchronous, blocking version of this method.
15668 */
15669void
15670control_host_call_boot (
15671 ControlHost *proxy,
15672 GCancellable *cancellable,
15673 GAsyncReadyCallback callback,
15674 gpointer user_data)
15675{
15676 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
15677 "boot",
15678 g_variant_new ("()"),
15679 G_DBUS_CALL_FLAGS_NONE,
15680 -1,
15681 cancellable,
15682 callback,
15683 user_data);
15684}
15685
15686/**
15687 * control_host_call_boot_finish:
15688 * @proxy: A #ControlHostProxy.
15689 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_call_boot().
15690 * @error: Return location for error or %NULL.
15691 *
15692 * Finishes an operation started with control_host_call_boot().
15693 *
15694 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
15695 */
15696gboolean
15697control_host_call_boot_finish (
15698 ControlHost *proxy,
15699 GAsyncResult *res,
15700 GError **error)
15701{
15702 GVariant *_ret;
15703 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
15704 if (_ret == NULL)
15705 goto _out;
15706 g_variant_get (_ret,
15707 "()");
15708 g_variant_unref (_ret);
15709_out:
15710 return _ret != NULL;
15711}
15712
15713/**
15714 * control_host_call_boot_sync:
15715 * @proxy: A #ControlHostProxy.
15716 * @cancellable: (allow-none): A #GCancellable or %NULL.
15717 * @error: Return location for error or %NULL.
15718 *
15719 * 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.
15720 *
15721 * See control_host_call_boot() for the asynchronous version of this method.
15722 *
15723 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
15724 */
15725gboolean
15726control_host_call_boot_sync (
15727 ControlHost *proxy,
15728 GCancellable *cancellable,
15729 GError **error)
15730{
15731 GVariant *_ret;
15732 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
15733 "boot",
15734 g_variant_new ("()"),
15735 G_DBUS_CALL_FLAGS_NONE,
15736 -1,
15737 cancellable,
15738 error);
15739 if (_ret == NULL)
15740 goto _out;
15741 g_variant_get (_ret,
15742 "()");
15743 g_variant_unref (_ret);
15744_out:
15745 return _ret != NULL;
15746}
15747
15748/**
15749 * control_host_call_shutdown:
15750 * @proxy: A #ControlHostProxy.
15751 * @cancellable: (allow-none): A #GCancellable or %NULL.
15752 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
15753 * @user_data: User data to pass to @callback.
15754 *
15755 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Host.shutdown">shutdown()</link> D-Bus method on @proxy.
15756 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
15757 * You can then call control_host_call_shutdown_finish() to get the result of the operation.
15758 *
15759 * See control_host_call_shutdown_sync() for the synchronous, blocking version of this method.
15760 */
15761void
15762control_host_call_shutdown (
15763 ControlHost *proxy,
15764 GCancellable *cancellable,
15765 GAsyncReadyCallback callback,
15766 gpointer user_data)
15767{
15768 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
15769 "shutdown",
15770 g_variant_new ("()"),
15771 G_DBUS_CALL_FLAGS_NONE,
15772 -1,
15773 cancellable,
15774 callback,
15775 user_data);
15776}
15777
15778/**
15779 * control_host_call_shutdown_finish:
15780 * @proxy: A #ControlHostProxy.
15781 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_call_shutdown().
15782 * @error: Return location for error or %NULL.
15783 *
15784 * Finishes an operation started with control_host_call_shutdown().
15785 *
15786 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
15787 */
15788gboolean
15789control_host_call_shutdown_finish (
15790 ControlHost *proxy,
15791 GAsyncResult *res,
15792 GError **error)
15793{
15794 GVariant *_ret;
15795 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
15796 if (_ret == NULL)
15797 goto _out;
15798 g_variant_get (_ret,
15799 "()");
15800 g_variant_unref (_ret);
15801_out:
15802 return _ret != NULL;
15803}
15804
15805/**
15806 * control_host_call_shutdown_sync:
15807 * @proxy: A #ControlHostProxy.
15808 * @cancellable: (allow-none): A #GCancellable or %NULL.
15809 * @error: Return location for error or %NULL.
15810 *
15811 * 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.
15812 *
15813 * See control_host_call_shutdown() for the asynchronous version of this method.
15814 *
15815 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
15816 */
15817gboolean
15818control_host_call_shutdown_sync (
15819 ControlHost *proxy,
15820 GCancellable *cancellable,
15821 GError **error)
15822{
15823 GVariant *_ret;
15824 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
15825 "shutdown",
15826 g_variant_new ("()"),
15827 G_DBUS_CALL_FLAGS_NONE,
15828 -1,
15829 cancellable,
15830 error);
15831 if (_ret == NULL)
15832 goto _out;
15833 g_variant_get (_ret,
15834 "()");
15835 g_variant_unref (_ret);
15836_out:
15837 return _ret != NULL;
15838}
15839
15840/**
15841 * control_host_call_reboot:
15842 * @proxy: A #ControlHostProxy.
15843 * @cancellable: (allow-none): A #GCancellable or %NULL.
15844 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
15845 * @user_data: User data to pass to @callback.
15846 *
15847 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Host.reboot">reboot()</link> D-Bus method on @proxy.
15848 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
15849 * You can then call control_host_call_reboot_finish() to get the result of the operation.
15850 *
15851 * See control_host_call_reboot_sync() for the synchronous, blocking version of this method.
15852 */
15853void
15854control_host_call_reboot (
15855 ControlHost *proxy,
15856 GCancellable *cancellable,
15857 GAsyncReadyCallback callback,
15858 gpointer user_data)
15859{
15860 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
15861 "reboot",
15862 g_variant_new ("()"),
15863 G_DBUS_CALL_FLAGS_NONE,
15864 -1,
15865 cancellable,
15866 callback,
15867 user_data);
15868}
15869
15870/**
15871 * control_host_call_reboot_finish:
15872 * @proxy: A #ControlHostProxy.
15873 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_call_reboot().
15874 * @error: Return location for error or %NULL.
15875 *
15876 * Finishes an operation started with control_host_call_reboot().
15877 *
15878 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
15879 */
15880gboolean
15881control_host_call_reboot_finish (
15882 ControlHost *proxy,
15883 GAsyncResult *res,
15884 GError **error)
15885{
15886 GVariant *_ret;
15887 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
15888 if (_ret == NULL)
15889 goto _out;
15890 g_variant_get (_ret,
15891 "()");
15892 g_variant_unref (_ret);
15893_out:
15894 return _ret != NULL;
15895}
15896
15897/**
15898 * control_host_call_reboot_sync:
15899 * @proxy: A #ControlHostProxy.
15900 * @cancellable: (allow-none): A #GCancellable or %NULL.
15901 * @error: Return location for error or %NULL.
15902 *
15903 * 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.
15904 *
15905 * See control_host_call_reboot() for the asynchronous version of this method.
15906 *
15907 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
15908 */
15909gboolean
15910control_host_call_reboot_sync (
15911 ControlHost *proxy,
15912 GCancellable *cancellable,
15913 GError **error)
15914{
15915 GVariant *_ret;
15916 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
15917 "reboot",
15918 g_variant_new ("()"),
15919 G_DBUS_CALL_FLAGS_NONE,
15920 -1,
15921 cancellable,
15922 error);
15923 if (_ret == NULL)
15924 goto _out;
15925 g_variant_get (_ret,
15926 "()");
15927 g_variant_unref (_ret);
15928_out:
15929 return _ret != NULL;
15930}
15931
15932/**
15933 * control_host_complete_boot:
15934 * @object: A #ControlHost.
15935 * @invocation: (transfer full): A #GDBusMethodInvocation.
15936 *
15937 * 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.
15938 *
15939 * This method will free @invocation, you cannot use it afterwards.
15940 */
15941void
15942control_host_complete_boot (
15943 ControlHost *object,
15944 GDBusMethodInvocation *invocation)
15945{
15946 g_dbus_method_invocation_return_value (invocation,
15947 g_variant_new ("()"));
15948}
15949
15950/**
15951 * control_host_complete_shutdown:
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.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.
15956 *
15957 * This method will free @invocation, you cannot use it afterwards.
15958 */
15959void
15960control_host_complete_shutdown (
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_reboot:
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.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.
15974 *
15975 * This method will free @invocation, you cannot use it afterwards.
15976 */
15977void
15978control_host_complete_reboot (
15979 ControlHost *object,
15980 GDBusMethodInvocation *invocation)
15981{
15982 g_dbus_method_invocation_return_value (invocation,
15983 g_variant_new ("()"));
15984}
15985
15986/* ------------------------------------------------------------------------ */
15987
15988/**
15989 * ControlHostProxy:
15990 *
15991 * The #ControlHostProxy structure contains only private data and should only be accessed using the provided API.
15992 */
15993
15994/**
15995 * ControlHostProxyClass:
15996 * @parent_class: The parent class.
15997 *
15998 * Class structure for #ControlHostProxy.
15999 */
16000
16001struct _ControlHostProxyPrivate
16002{
16003 GData *qdata;
16004};
16005
16006static void control_host_proxy_iface_init (ControlHostIface *iface);
16007
16008#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
16009G_DEFINE_TYPE_WITH_CODE (ControlHostProxy, control_host_proxy, G_TYPE_DBUS_PROXY,
16010 G_ADD_PRIVATE (ControlHostProxy)
16011 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_proxy_iface_init));
16012
16013#else
16014G_DEFINE_TYPE_WITH_CODE (ControlHostProxy, control_host_proxy, G_TYPE_DBUS_PROXY,
16015 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_proxy_iface_init));
16016
16017#endif
16018static void
16019control_host_proxy_finalize (GObject *object)
16020{
16021 ControlHostProxy *proxy = CONTROL_HOST_PROXY (object);
16022 g_datalist_clear (&proxy->priv->qdata);
16023 G_OBJECT_CLASS (control_host_proxy_parent_class)->finalize (object);
16024}
16025
16026static void
16027control_host_proxy_get_property (GObject *object,
16028 guint prop_id,
16029 GValue *value,
16030 GParamSpec *pspec G_GNUC_UNUSED)
16031{
Norman James493996c2015-10-31 17:27:13 -050016032 const _ExtendedGDBusPropertyInfo *info;
16033 GVariant *variant;
16034 g_assert (prop_id != 0 && prop_id - 1 < 2);
16035 info = _control_host_property_info_pointers[prop_id - 1];
16036 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
16037 if (info->use_gvariant)
16038 {
16039 g_value_set_variant (value, variant);
16040 }
16041 else
16042 {
16043 if (variant != NULL)
16044 g_dbus_gvariant_to_gvalue (variant, value);
16045 }
16046 if (variant != NULL)
16047 g_variant_unref (variant);
16048}
16049
16050static void
16051control_host_proxy_set_property_cb (GDBusProxy *proxy,
16052 GAsyncResult *res,
16053 gpointer user_data)
16054{
16055 const _ExtendedGDBusPropertyInfo *info = user_data;
16056 GError *error;
16057 GVariant *_ret;
16058 error = NULL;
16059 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
16060 if (!_ret)
16061 {
16062 g_warning ("Error setting property '%s' on interface org.openbmc.control.Host: %s (%s, %d)",
16063 info->parent_struct.name,
16064 error->message, g_quark_to_string (error->domain), error->code);
16065 g_error_free (error);
16066 }
16067 else
16068 {
16069 g_variant_unref (_ret);
16070 }
Norman James362a80f2015-09-14 14:04:39 -050016071}
16072
16073static void
16074control_host_proxy_set_property (GObject *object,
16075 guint prop_id,
16076 const GValue *value,
16077 GParamSpec *pspec G_GNUC_UNUSED)
16078{
Norman James493996c2015-10-31 17:27:13 -050016079 const _ExtendedGDBusPropertyInfo *info;
16080 GVariant *variant;
16081 g_assert (prop_id != 0 && prop_id - 1 < 2);
16082 info = _control_host_property_info_pointers[prop_id - 1];
16083 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
16084 g_dbus_proxy_call (G_DBUS_PROXY (object),
16085 "org.freedesktop.DBus.Properties.Set",
16086 g_variant_new ("(ssv)", "org.openbmc.control.Host", info->parent_struct.name, variant),
16087 G_DBUS_CALL_FLAGS_NONE,
16088 -1,
16089 NULL, (GAsyncReadyCallback) control_host_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
16090 g_variant_unref (variant);
Norman James362a80f2015-09-14 14:04:39 -050016091}
16092
16093static void
16094control_host_proxy_g_signal (GDBusProxy *proxy,
16095 const gchar *sender_name G_GNUC_UNUSED,
16096 const gchar *signal_name,
16097 GVariant *parameters)
16098{
16099 _ExtendedGDBusSignalInfo *info;
16100 GVariantIter iter;
16101 GVariant *child;
16102 GValue *paramv;
16103 guint num_params;
16104 guint n;
16105 guint signal_id;
16106 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, signal_name);
16107 if (info == NULL)
16108 return;
16109 num_params = g_variant_n_children (parameters);
16110 paramv = g_new0 (GValue, num_params + 1);
16111 g_value_init (&paramv[0], TYPE_CONTROL_HOST);
16112 g_value_set_object (&paramv[0], proxy);
16113 g_variant_iter_init (&iter, parameters);
16114 n = 1;
16115 while ((child = g_variant_iter_next_value (&iter)) != NULL)
16116 {
16117 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
16118 if (arg_info->use_gvariant)
16119 {
16120 g_value_init (&paramv[n], G_TYPE_VARIANT);
16121 g_value_set_variant (&paramv[n], child);
16122 n++;
16123 }
16124 else
16125 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
16126 g_variant_unref (child);
16127 }
16128 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_HOST);
16129 g_signal_emitv (paramv, signal_id, 0, NULL);
16130 for (n = 0; n < num_params + 1; n++)
16131 g_value_unset (&paramv[n]);
16132 g_free (paramv);
16133}
16134
16135static void
16136control_host_proxy_g_properties_changed (GDBusProxy *_proxy,
16137 GVariant *changed_properties,
16138 const gchar *const *invalidated_properties)
16139{
16140 ControlHostProxy *proxy = CONTROL_HOST_PROXY (_proxy);
16141 guint n;
16142 const gchar *key;
16143 GVariantIter *iter;
16144 _ExtendedGDBusPropertyInfo *info;
16145 g_variant_get (changed_properties, "a{sv}", &iter);
16146 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
16147 {
16148 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, key);
16149 g_datalist_remove_data (&proxy->priv->qdata, key);
16150 if (info != NULL)
16151 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
16152 }
16153 g_variant_iter_free (iter);
16154 for (n = 0; invalidated_properties[n] != NULL; n++)
16155 {
16156 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, invalidated_properties[n]);
16157 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
16158 if (info != NULL)
16159 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
16160 }
16161}
16162
Norman James493996c2015-10-31 17:27:13 -050016163static gint
16164control_host_proxy_get_debug_mode (ControlHost *object)
16165{
16166 ControlHostProxy *proxy = CONTROL_HOST_PROXY (object);
16167 GVariant *variant;
16168 gint value = 0;
16169 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "debug_mode");
16170 if (variant != NULL)
16171 {
16172 value = g_variant_get_int32 (variant);
16173 g_variant_unref (variant);
16174 }
16175 return value;
16176}
16177
16178static const gchar *
16179control_host_proxy_get_flash_side (ControlHost *object)
16180{
16181 ControlHostProxy *proxy = CONTROL_HOST_PROXY (object);
16182 GVariant *variant;
16183 const gchar *value = NULL;
16184 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "flash_side");
16185 if (variant != NULL)
16186 {
16187 value = g_variant_get_string (variant, NULL);
16188 g_variant_unref (variant);
16189 }
16190 return value;
16191}
16192
Norman James362a80f2015-09-14 14:04:39 -050016193static void
16194control_host_proxy_init (ControlHostProxy *proxy)
16195{
16196#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
16197 proxy->priv = control_host_proxy_get_instance_private (proxy);
16198#else
16199 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_HOST_PROXY, ControlHostProxyPrivate);
16200#endif
16201
16202 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_host_interface_info ());
16203}
16204
16205static void
16206control_host_proxy_class_init (ControlHostProxyClass *klass)
16207{
16208 GObjectClass *gobject_class;
16209 GDBusProxyClass *proxy_class;
16210
16211 gobject_class = G_OBJECT_CLASS (klass);
16212 gobject_class->finalize = control_host_proxy_finalize;
16213 gobject_class->get_property = control_host_proxy_get_property;
16214 gobject_class->set_property = control_host_proxy_set_property;
16215
16216 proxy_class = G_DBUS_PROXY_CLASS (klass);
16217 proxy_class->g_signal = control_host_proxy_g_signal;
16218 proxy_class->g_properties_changed = control_host_proxy_g_properties_changed;
16219
Norman James493996c2015-10-31 17:27:13 -050016220 control_host_override_properties (gobject_class, 1);
16221
Norman James362a80f2015-09-14 14:04:39 -050016222#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
16223 g_type_class_add_private (klass, sizeof (ControlHostProxyPrivate));
16224#endif
16225}
16226
16227static void
16228control_host_proxy_iface_init (ControlHostIface *iface)
16229{
Norman James493996c2015-10-31 17:27:13 -050016230 iface->get_debug_mode = control_host_proxy_get_debug_mode;
16231 iface->get_flash_side = control_host_proxy_get_flash_side;
Norman James362a80f2015-09-14 14:04:39 -050016232}
16233
16234/**
16235 * control_host_proxy_new:
16236 * @connection: A #GDBusConnection.
16237 * @flags: Flags from the #GDBusProxyFlags enumeration.
16238 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
16239 * @object_path: An object path.
16240 * @cancellable: (allow-none): A #GCancellable or %NULL.
16241 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
16242 * @user_data: User data to pass to @callback.
16243 *
16244 * 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.
16245 *
16246 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
16247 * You can then call control_host_proxy_new_finish() to get the result of the operation.
16248 *
16249 * See control_host_proxy_new_sync() for the synchronous, blocking version of this constructor.
16250 */
16251void
16252control_host_proxy_new (
16253 GDBusConnection *connection,
16254 GDBusProxyFlags flags,
16255 const gchar *name,
16256 const gchar *object_path,
16257 GCancellable *cancellable,
16258 GAsyncReadyCallback callback,
16259 gpointer user_data)
16260{
16261 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);
16262}
16263
16264/**
16265 * control_host_proxy_new_finish:
16266 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_proxy_new().
16267 * @error: Return location for error or %NULL
16268 *
16269 * Finishes an operation started with control_host_proxy_new().
16270 *
16271 * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set.
16272 */
16273ControlHost *
16274control_host_proxy_new_finish (
16275 GAsyncResult *res,
16276 GError **error)
16277{
16278 GObject *ret;
16279 GObject *source_object;
16280 source_object = g_async_result_get_source_object (res);
16281 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
16282 g_object_unref (source_object);
16283 if (ret != NULL)
16284 return CONTROL_HOST (ret);
16285 else
16286 return NULL;
16287}
16288
16289/**
16290 * control_host_proxy_new_sync:
16291 * @connection: A #GDBusConnection.
16292 * @flags: Flags from the #GDBusProxyFlags enumeration.
16293 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
16294 * @object_path: An object path.
16295 * @cancellable: (allow-none): A #GCancellable or %NULL.
16296 * @error: Return location for error or %NULL
16297 *
16298 * 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.
16299 *
16300 * The calling thread is blocked until a reply is received.
16301 *
16302 * See control_host_proxy_new() for the asynchronous version of this constructor.
16303 *
16304 * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set.
16305 */
16306ControlHost *
16307control_host_proxy_new_sync (
16308 GDBusConnection *connection,
16309 GDBusProxyFlags flags,
16310 const gchar *name,
16311 const gchar *object_path,
16312 GCancellable *cancellable,
16313 GError **error)
16314{
16315 GInitable *ret;
16316 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);
16317 if (ret != NULL)
16318 return CONTROL_HOST (ret);
16319 else
16320 return NULL;
16321}
16322
16323
16324/**
16325 * control_host_proxy_new_for_bus:
16326 * @bus_type: A #GBusType.
16327 * @flags: Flags from the #GDBusProxyFlags enumeration.
16328 * @name: A bus name (well-known or unique).
16329 * @object_path: An object path.
16330 * @cancellable: (allow-none): A #GCancellable or %NULL.
16331 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
16332 * @user_data: User data to pass to @callback.
16333 *
16334 * Like control_host_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
16335 *
16336 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
16337 * You can then call control_host_proxy_new_for_bus_finish() to get the result of the operation.
16338 *
16339 * See control_host_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
16340 */
16341void
16342control_host_proxy_new_for_bus (
16343 GBusType bus_type,
16344 GDBusProxyFlags flags,
16345 const gchar *name,
16346 const gchar *object_path,
16347 GCancellable *cancellable,
16348 GAsyncReadyCallback callback,
16349 gpointer user_data)
16350{
16351 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);
16352}
16353
16354/**
16355 * control_host_proxy_new_for_bus_finish:
16356 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_proxy_new_for_bus().
16357 * @error: Return location for error or %NULL
16358 *
16359 * Finishes an operation started with control_host_proxy_new_for_bus().
16360 *
16361 * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set.
16362 */
16363ControlHost *
16364control_host_proxy_new_for_bus_finish (
16365 GAsyncResult *res,
16366 GError **error)
16367{
16368 GObject *ret;
16369 GObject *source_object;
16370 source_object = g_async_result_get_source_object (res);
16371 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
16372 g_object_unref (source_object);
16373 if (ret != NULL)
16374 return CONTROL_HOST (ret);
16375 else
16376 return NULL;
16377}
16378
16379/**
16380 * control_host_proxy_new_for_bus_sync:
16381 * @bus_type: A #GBusType.
16382 * @flags: Flags from the #GDBusProxyFlags enumeration.
16383 * @name: A bus name (well-known or unique).
16384 * @object_path: An object path.
16385 * @cancellable: (allow-none): A #GCancellable or %NULL.
16386 * @error: Return location for error or %NULL
16387 *
16388 * Like control_host_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
16389 *
16390 * The calling thread is blocked until a reply is received.
16391 *
16392 * See control_host_proxy_new_for_bus() for the asynchronous version of this constructor.
16393 *
16394 * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set.
16395 */
16396ControlHost *
16397control_host_proxy_new_for_bus_sync (
16398 GBusType bus_type,
16399 GDBusProxyFlags flags,
16400 const gchar *name,
16401 const gchar *object_path,
16402 GCancellable *cancellable,
16403 GError **error)
16404{
16405 GInitable *ret;
16406 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);
16407 if (ret != NULL)
16408 return CONTROL_HOST (ret);
16409 else
16410 return NULL;
16411}
16412
16413
16414/* ------------------------------------------------------------------------ */
16415
16416/**
16417 * ControlHostSkeleton:
16418 *
16419 * The #ControlHostSkeleton structure contains only private data and should only be accessed using the provided API.
16420 */
16421
16422/**
16423 * ControlHostSkeletonClass:
16424 * @parent_class: The parent class.
16425 *
16426 * Class structure for #ControlHostSkeleton.
16427 */
16428
16429struct _ControlHostSkeletonPrivate
16430{
16431 GValue *properties;
16432 GList *changed_properties;
16433 GSource *changed_properties_idle_source;
16434 GMainContext *context;
16435 GMutex lock;
16436};
16437
16438static void
16439_control_host_skeleton_handle_method_call (
16440 GDBusConnection *connection G_GNUC_UNUSED,
16441 const gchar *sender G_GNUC_UNUSED,
16442 const gchar *object_path G_GNUC_UNUSED,
16443 const gchar *interface_name,
16444 const gchar *method_name,
16445 GVariant *parameters,
16446 GDBusMethodInvocation *invocation,
16447 gpointer user_data)
16448{
16449 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (user_data);
16450 _ExtendedGDBusMethodInfo *info;
16451 GVariantIter iter;
16452 GVariant *child;
16453 GValue *paramv;
16454 guint num_params;
16455 guint num_extra;
16456 guint n;
16457 guint signal_id;
16458 GValue return_value = G_VALUE_INIT;
16459 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
16460 g_assert (info != NULL);
16461 num_params = g_variant_n_children (parameters);
16462 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
16463 n = 0;
16464 g_value_init (&paramv[n], TYPE_CONTROL_HOST);
16465 g_value_set_object (&paramv[n++], skeleton);
16466 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
16467 g_value_set_object (&paramv[n++], invocation);
16468 if (info->pass_fdlist)
16469 {
16470#ifdef G_OS_UNIX
16471 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
16472 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
16473#else
16474 g_assert_not_reached ();
16475#endif
16476 }
16477 g_variant_iter_init (&iter, parameters);
16478 while ((child = g_variant_iter_next_value (&iter)) != NULL)
16479 {
16480 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
16481 if (arg_info->use_gvariant)
16482 {
16483 g_value_init (&paramv[n], G_TYPE_VARIANT);
16484 g_value_set_variant (&paramv[n], child);
16485 n++;
16486 }
16487 else
16488 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
16489 g_variant_unref (child);
16490 }
16491 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_HOST);
16492 g_value_init (&return_value, G_TYPE_BOOLEAN);
16493 g_signal_emitv (paramv, signal_id, 0, &return_value);
16494 if (!g_value_get_boolean (&return_value))
16495 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);
16496 g_value_unset (&return_value);
16497 for (n = 0; n < num_params + num_extra; n++)
16498 g_value_unset (&paramv[n]);
16499 g_free (paramv);
16500}
16501
16502static GVariant *
16503_control_host_skeleton_handle_get_property (
16504 GDBusConnection *connection G_GNUC_UNUSED,
16505 const gchar *sender G_GNUC_UNUSED,
16506 const gchar *object_path G_GNUC_UNUSED,
16507 const gchar *interface_name G_GNUC_UNUSED,
16508 const gchar *property_name,
16509 GError **error,
16510 gpointer user_data)
16511{
16512 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (user_data);
16513 GValue value = G_VALUE_INIT;
16514 GParamSpec *pspec;
16515 _ExtendedGDBusPropertyInfo *info;
16516 GVariant *ret;
16517 ret = NULL;
16518 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, property_name);
16519 g_assert (info != NULL);
16520 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
16521 if (pspec == NULL)
16522 {
16523 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
16524 }
16525 else
16526 {
16527 g_value_init (&value, pspec->value_type);
16528 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
16529 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
16530 g_value_unset (&value);
16531 }
16532 return ret;
16533}
16534
16535static gboolean
16536_control_host_skeleton_handle_set_property (
16537 GDBusConnection *connection G_GNUC_UNUSED,
16538 const gchar *sender G_GNUC_UNUSED,
16539 const gchar *object_path G_GNUC_UNUSED,
16540 const gchar *interface_name G_GNUC_UNUSED,
16541 const gchar *property_name,
16542 GVariant *variant,
16543 GError **error,
16544 gpointer user_data)
16545{
16546 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (user_data);
16547 GValue value = G_VALUE_INIT;
16548 GParamSpec *pspec;
16549 _ExtendedGDBusPropertyInfo *info;
16550 gboolean ret;
16551 ret = FALSE;
16552 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, property_name);
16553 g_assert (info != NULL);
16554 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
16555 if (pspec == NULL)
16556 {
16557 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
16558 }
16559 else
16560 {
16561 if (info->use_gvariant)
16562 g_value_set_variant (&value, variant);
16563 else
16564 g_dbus_gvariant_to_gvalue (variant, &value);
16565 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
16566 g_value_unset (&value);
16567 ret = TRUE;
16568 }
16569 return ret;
16570}
16571
16572static const GDBusInterfaceVTable _control_host_skeleton_vtable =
16573{
16574 _control_host_skeleton_handle_method_call,
16575 _control_host_skeleton_handle_get_property,
16576 _control_host_skeleton_handle_set_property,
16577 {NULL}
16578};
16579
16580static GDBusInterfaceInfo *
16581control_host_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
16582{
16583 return control_host_interface_info ();
16584}
16585
16586static GDBusInterfaceVTable *
16587control_host_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
16588{
16589 return (GDBusInterfaceVTable *) &_control_host_skeleton_vtable;
16590}
16591
16592static GVariant *
16593control_host_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
16594{
16595 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (_skeleton);
16596
16597 GVariantBuilder builder;
16598 guint n;
16599 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
16600 if (_control_host_interface_info.parent_struct.properties == NULL)
16601 goto out;
16602 for (n = 0; _control_host_interface_info.parent_struct.properties[n] != NULL; n++)
16603 {
16604 GDBusPropertyInfo *info = _control_host_interface_info.parent_struct.properties[n];
16605 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
16606 {
16607 GVariant *value;
16608 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);
16609 if (value != NULL)
16610 {
16611 g_variant_take_ref (value);
16612 g_variant_builder_add (&builder, "{sv}", info->name, value);
16613 g_variant_unref (value);
16614 }
16615 }
16616 }
16617out:
16618 return g_variant_builder_end (&builder);
16619}
16620
Norman James493996c2015-10-31 17:27:13 -050016621static gboolean _control_host_emit_changed (gpointer user_data);
16622
Norman James362a80f2015-09-14 14:04:39 -050016623static void
16624control_host_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
16625{
Norman James493996c2015-10-31 17:27:13 -050016626 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (_skeleton);
16627 gboolean emit_changed = FALSE;
16628
16629 g_mutex_lock (&skeleton->priv->lock);
16630 if (skeleton->priv->changed_properties_idle_source != NULL)
16631 {
16632 g_source_destroy (skeleton->priv->changed_properties_idle_source);
16633 skeleton->priv->changed_properties_idle_source = NULL;
16634 emit_changed = TRUE;
16635 }
16636 g_mutex_unlock (&skeleton->priv->lock);
16637
16638 if (emit_changed)
16639 _control_host_emit_changed (skeleton);
Norman James362a80f2015-09-14 14:04:39 -050016640}
16641
16642static void
16643_control_host_on_signal_booted (
16644 ControlHost *object)
16645{
16646 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object);
16647
16648 GList *connections, *l;
16649 GVariant *signal_variant;
16650 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
16651
16652 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
16653 for (l = connections; l != NULL; l = l->next)
16654 {
16655 GDBusConnection *connection = l->data;
16656 g_dbus_connection_emit_signal (connection,
16657 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.control.Host", "Booted",
16658 signal_variant, NULL);
16659 }
16660 g_variant_unref (signal_variant);
16661 g_list_free_full (connections, g_object_unref);
16662}
16663
16664static void control_host_skeleton_iface_init (ControlHostIface *iface);
16665#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
16666G_DEFINE_TYPE_WITH_CODE (ControlHostSkeleton, control_host_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
16667 G_ADD_PRIVATE (ControlHostSkeleton)
16668 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_skeleton_iface_init));
16669
16670#else
16671G_DEFINE_TYPE_WITH_CODE (ControlHostSkeleton, control_host_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
16672 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_skeleton_iface_init));
16673
16674#endif
16675static void
16676control_host_skeleton_finalize (GObject *object)
16677{
16678 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object);
Norman James493996c2015-10-31 17:27:13 -050016679 guint n;
16680 for (n = 0; n < 2; n++)
16681 g_value_unset (&skeleton->priv->properties[n]);
16682 g_free (skeleton->priv->properties);
Norman James362a80f2015-09-14 14:04:39 -050016683 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
16684 if (skeleton->priv->changed_properties_idle_source != NULL)
16685 g_source_destroy (skeleton->priv->changed_properties_idle_source);
16686 g_main_context_unref (skeleton->priv->context);
16687 g_mutex_clear (&skeleton->priv->lock);
16688 G_OBJECT_CLASS (control_host_skeleton_parent_class)->finalize (object);
16689}
16690
16691static void
Norman James493996c2015-10-31 17:27:13 -050016692control_host_skeleton_get_property (GObject *object,
16693 guint prop_id,
16694 GValue *value,
16695 GParamSpec *pspec G_GNUC_UNUSED)
16696{
16697 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object);
16698 g_assert (prop_id != 0 && prop_id - 1 < 2);
16699 g_mutex_lock (&skeleton->priv->lock);
16700 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
16701 g_mutex_unlock (&skeleton->priv->lock);
16702}
16703
16704static gboolean
16705_control_host_emit_changed (gpointer user_data)
16706{
16707 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (user_data);
16708 GList *l;
16709 GVariantBuilder builder;
16710 GVariantBuilder invalidated_builder;
16711 guint num_changes;
16712
16713 g_mutex_lock (&skeleton->priv->lock);
16714 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
16715 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
16716 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
16717 {
16718 ChangedProperty *cp = l->data;
16719 GVariant *variant;
16720 const GValue *cur_value;
16721
16722 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
16723 if (!_g_value_equal (cur_value, &cp->orig_value))
16724 {
16725 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
16726 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
16727 g_variant_unref (variant);
16728 num_changes++;
16729 }
16730 }
16731 if (num_changes > 0)
16732 {
16733 GList *connections, *ll;
16734 GVariant *signal_variant;
16735 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.control.Host",
16736 &builder, &invalidated_builder));
16737 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
16738 for (ll = connections; ll != NULL; ll = ll->next)
16739 {
16740 GDBusConnection *connection = ll->data;
16741
16742 g_dbus_connection_emit_signal (connection,
16743 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
16744 "org.freedesktop.DBus.Properties",
16745 "PropertiesChanged",
16746 signal_variant,
16747 NULL);
16748 }
16749 g_variant_unref (signal_variant);
16750 g_list_free_full (connections, g_object_unref);
16751 }
16752 else
16753 {
16754 g_variant_builder_clear (&builder);
16755 g_variant_builder_clear (&invalidated_builder);
16756 }
16757 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
16758 skeleton->priv->changed_properties = NULL;
16759 skeleton->priv->changed_properties_idle_source = NULL;
16760 g_mutex_unlock (&skeleton->priv->lock);
16761 return FALSE;
16762}
16763
16764static void
16765_control_host_schedule_emit_changed (ControlHostSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
16766{
16767 ChangedProperty *cp;
16768 GList *l;
16769 cp = NULL;
16770 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
16771 {
16772 ChangedProperty *i_cp = l->data;
16773 if (i_cp->info == info)
16774 {
16775 cp = i_cp;
16776 break;
16777 }
16778 }
16779 if (cp == NULL)
16780 {
16781 cp = g_new0 (ChangedProperty, 1);
16782 cp->prop_id = prop_id;
16783 cp->info = info;
16784 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
16785 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
16786 g_value_copy (orig_value, &cp->orig_value);
16787 }
16788}
16789
16790static void
16791control_host_skeleton_notify (GObject *object,
16792 GParamSpec *pspec G_GNUC_UNUSED)
16793{
16794 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object);
16795 g_mutex_lock (&skeleton->priv->lock);
16796 if (skeleton->priv->changed_properties != NULL &&
16797 skeleton->priv->changed_properties_idle_source == NULL)
16798 {
16799 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
16800 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
16801 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _control_host_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
16802 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
16803 g_source_unref (skeleton->priv->changed_properties_idle_source);
16804 }
16805 g_mutex_unlock (&skeleton->priv->lock);
16806}
16807
16808static void
16809control_host_skeleton_set_property (GObject *object,
16810 guint prop_id,
16811 const GValue *value,
16812 GParamSpec *pspec)
16813{
16814 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object);
16815 g_assert (prop_id != 0 && prop_id - 1 < 2);
16816 g_mutex_lock (&skeleton->priv->lock);
16817 g_object_freeze_notify (object);
16818 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
16819 {
16820 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
16821 _control_host_schedule_emit_changed (skeleton, _control_host_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
16822 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
16823 g_object_notify_by_pspec (object, pspec);
16824 }
16825 g_mutex_unlock (&skeleton->priv->lock);
16826 g_object_thaw_notify (object);
16827}
16828
16829static void
Norman James362a80f2015-09-14 14:04:39 -050016830control_host_skeleton_init (ControlHostSkeleton *skeleton)
16831{
16832#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
16833 skeleton->priv = control_host_skeleton_get_instance_private (skeleton);
16834#else
16835 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_HOST_SKELETON, ControlHostSkeletonPrivate);
16836#endif
16837
16838 g_mutex_init (&skeleton->priv->lock);
16839 skeleton->priv->context = g_main_context_ref_thread_default ();
Norman James493996c2015-10-31 17:27:13 -050016840 skeleton->priv->properties = g_new0 (GValue, 2);
16841 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
16842 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
16843}
16844
16845static gint
16846control_host_skeleton_get_debug_mode (ControlHost *object)
16847{
16848 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object);
16849 gint value;
16850 g_mutex_lock (&skeleton->priv->lock);
16851 value = g_value_get_int (&(skeleton->priv->properties[0]));
16852 g_mutex_unlock (&skeleton->priv->lock);
16853 return value;
16854}
16855
16856static const gchar *
16857control_host_skeleton_get_flash_side (ControlHost *object)
16858{
16859 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object);
16860 const gchar *value;
16861 g_mutex_lock (&skeleton->priv->lock);
16862 value = g_value_get_string (&(skeleton->priv->properties[1]));
16863 g_mutex_unlock (&skeleton->priv->lock);
16864 return value;
Norman James362a80f2015-09-14 14:04:39 -050016865}
16866
16867static void
16868control_host_skeleton_class_init (ControlHostSkeletonClass *klass)
16869{
16870 GObjectClass *gobject_class;
16871 GDBusInterfaceSkeletonClass *skeleton_class;
16872
16873 gobject_class = G_OBJECT_CLASS (klass);
16874 gobject_class->finalize = control_host_skeleton_finalize;
Norman James493996c2015-10-31 17:27:13 -050016875 gobject_class->get_property = control_host_skeleton_get_property;
16876 gobject_class->set_property = control_host_skeleton_set_property;
16877 gobject_class->notify = control_host_skeleton_notify;
16878
16879
16880 control_host_override_properties (gobject_class, 1);
Norman James362a80f2015-09-14 14:04:39 -050016881
16882 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
16883 skeleton_class->get_info = control_host_skeleton_dbus_interface_get_info;
16884 skeleton_class->get_properties = control_host_skeleton_dbus_interface_get_properties;
16885 skeleton_class->flush = control_host_skeleton_dbus_interface_flush;
16886 skeleton_class->get_vtable = control_host_skeleton_dbus_interface_get_vtable;
16887
16888#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
16889 g_type_class_add_private (klass, sizeof (ControlHostSkeletonPrivate));
16890#endif
16891}
16892
16893static void
16894control_host_skeleton_iface_init (ControlHostIface *iface)
16895{
16896 iface->booted = _control_host_on_signal_booted;
Norman James493996c2015-10-31 17:27:13 -050016897 iface->get_debug_mode = control_host_skeleton_get_debug_mode;
16898 iface->get_flash_side = control_host_skeleton_get_flash_side;
Norman James362a80f2015-09-14 14:04:39 -050016899}
16900
16901/**
16902 * control_host_skeleton_new:
16903 *
16904 * 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>.
16905 *
16906 * Returns: (transfer full) (type ControlHostSkeleton): The skeleton object.
16907 */
16908ControlHost *
16909control_host_skeleton_new (void)
16910{
16911 return CONTROL_HOST (g_object_new (TYPE_CONTROL_HOST_SKELETON, NULL));
16912}
16913
16914/* ------------------------------------------------------------------------
16915 * Code for interface org.openbmc.control.Power
16916 * ------------------------------------------------------------------------
16917 */
16918
16919/**
16920 * SECTION:ControlPower
16921 * @title: ControlPower
16922 * @short_description: Generated C code for the org.openbmc.control.Power D-Bus interface
16923 *
16924 * 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.
16925 */
16926
16927/* ---- Introspection data for org.openbmc.control.Power ---- */
16928
16929static const _ExtendedGDBusArgInfo _control_power_method_info_set_power_state_IN_ARG_state =
16930{
16931 {
16932 -1,
16933 (gchar *) "state",
16934 (gchar *) "i",
16935 NULL
16936 },
16937 FALSE
16938};
16939
16940static const _ExtendedGDBusArgInfo * const _control_power_method_info_set_power_state_IN_ARG_pointers[] =
16941{
16942 &_control_power_method_info_set_power_state_IN_ARG_state,
16943 NULL
16944};
16945
16946static const _ExtendedGDBusMethodInfo _control_power_method_info_set_power_state =
16947{
16948 {
16949 -1,
16950 (gchar *) "setPowerState",
16951 (GDBusArgInfo **) &_control_power_method_info_set_power_state_IN_ARG_pointers,
16952 NULL,
16953 NULL
16954 },
16955 "handle-set-power-state",
16956 FALSE
16957};
16958
16959static const _ExtendedGDBusArgInfo _control_power_method_info_get_power_state_OUT_ARG_state =
16960{
16961 {
16962 -1,
16963 (gchar *) "state",
16964 (gchar *) "i",
16965 NULL
16966 },
16967 FALSE
16968};
16969
16970static const _ExtendedGDBusArgInfo * const _control_power_method_info_get_power_state_OUT_ARG_pointers[] =
16971{
16972 &_control_power_method_info_get_power_state_OUT_ARG_state,
16973 NULL
16974};
16975
16976static const _ExtendedGDBusMethodInfo _control_power_method_info_get_power_state =
16977{
16978 {
16979 -1,
16980 (gchar *) "getPowerState",
16981 NULL,
16982 (GDBusArgInfo **) &_control_power_method_info_get_power_state_OUT_ARG_pointers,
16983 NULL
16984 },
16985 "handle-get-power-state",
16986 FALSE
16987};
16988
16989static const _ExtendedGDBusMethodInfo * const _control_power_method_info_pointers[] =
16990{
16991 &_control_power_method_info_set_power_state,
16992 &_control_power_method_info_get_power_state,
16993 NULL
16994};
16995
16996static const _ExtendedGDBusSignalInfo _control_power_signal_info_power_good =
16997{
16998 {
16999 -1,
17000 (gchar *) "PowerGood",
17001 NULL,
17002 NULL
17003 },
17004 "power-good"
17005};
17006
17007static const _ExtendedGDBusSignalInfo _control_power_signal_info_power_lost =
17008{
17009 {
17010 -1,
17011 (gchar *) "PowerLost",
17012 NULL,
17013 NULL
17014 },
17015 "power-lost"
17016};
17017
17018static const _ExtendedGDBusSignalInfo * const _control_power_signal_info_pointers[] =
17019{
17020 &_control_power_signal_info_power_good,
17021 &_control_power_signal_info_power_lost,
17022 NULL
17023};
17024
17025static const _ExtendedGDBusPropertyInfo _control_power_property_info_pgood =
17026{
17027 {
17028 -1,
17029 (gchar *) "pgood",
17030 (gchar *) "i",
17031 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
17032 NULL
17033 },
17034 "pgood",
17035 FALSE
17036};
17037
17038static const _ExtendedGDBusPropertyInfo _control_power_property_info_state =
17039{
17040 {
17041 -1,
17042 (gchar *) "state",
17043 (gchar *) "i",
17044 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
17045 NULL
17046 },
17047 "state",
17048 FALSE
17049};
17050
Norman James32e74e22015-09-15 21:28:06 -050017051static const _ExtendedGDBusPropertyInfo _control_power_property_info_pgood_timeout =
17052{
17053 {
17054 -1,
17055 (gchar *) "pgood_timeout",
17056 (gchar *) "i",
17057 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
17058 NULL
17059 },
17060 "pgood-timeout",
17061 FALSE
17062};
17063
Norman James362a80f2015-09-14 14:04:39 -050017064static const _ExtendedGDBusPropertyInfo * const _control_power_property_info_pointers[] =
17065{
17066 &_control_power_property_info_pgood,
17067 &_control_power_property_info_state,
Norman James32e74e22015-09-15 21:28:06 -050017068 &_control_power_property_info_pgood_timeout,
Norman James362a80f2015-09-14 14:04:39 -050017069 NULL
17070};
17071
17072static const _ExtendedGDBusInterfaceInfo _control_power_interface_info =
17073{
17074 {
17075 -1,
17076 (gchar *) "org.openbmc.control.Power",
17077 (GDBusMethodInfo **) &_control_power_method_info_pointers,
17078 (GDBusSignalInfo **) &_control_power_signal_info_pointers,
17079 (GDBusPropertyInfo **) &_control_power_property_info_pointers,
17080 NULL
17081 },
17082 "control-power",
17083};
17084
17085
17086/**
17087 * control_power_interface_info:
17088 *
17089 * 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.
17090 *
17091 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
17092 */
17093GDBusInterfaceInfo *
17094control_power_interface_info (void)
17095{
17096 return (GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct;
17097}
17098
17099/**
17100 * control_power_override_properties:
17101 * @klass: The class structure for a #GObject<!-- -->-derived class.
17102 * @property_id_begin: The property id to assign to the first overridden property.
17103 *
17104 * Overrides all #GObject properties in the #ControlPower interface for a concrete class.
17105 * The properties are overridden in the order they are defined.
17106 *
17107 * Returns: The last property id.
17108 */
17109guint
17110control_power_override_properties (GObjectClass *klass, guint property_id_begin)
17111{
17112 g_object_class_override_property (klass, property_id_begin++, "pgood");
17113 g_object_class_override_property (klass, property_id_begin++, "state");
Norman James32e74e22015-09-15 21:28:06 -050017114 g_object_class_override_property (klass, property_id_begin++, "pgood-timeout");
Norman James362a80f2015-09-14 14:04:39 -050017115 return property_id_begin - 1;
17116}
17117
17118
17119
17120/**
17121 * ControlPower:
17122 *
17123 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Power.top_of_page">org.openbmc.control.Power</link>.
17124 */
17125
17126/**
17127 * ControlPowerIface:
17128 * @parent_iface: The parent interface.
17129 * @handle_get_power_state: Handler for the #ControlPower::handle-get-power-state signal.
17130 * @handle_set_power_state: Handler for the #ControlPower::handle-set-power-state signal.
17131 * @get_pgood: Getter for the #ControlPower:pgood property.
Norman James32e74e22015-09-15 21:28:06 -050017132 * @get_pgood_timeout: Getter for the #ControlPower:pgood-timeout property.
Norman James362a80f2015-09-14 14:04:39 -050017133 * @get_state: Getter for the #ControlPower:state property.
17134 * @power_good: Handler for the #ControlPower::power-good signal.
17135 * @power_lost: Handler for the #ControlPower::power-lost signal.
17136 *
17137 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Power.top_of_page">org.openbmc.control.Power</link>.
17138 */
17139
17140typedef ControlPowerIface ControlPowerInterface;
17141G_DEFINE_INTERFACE (ControlPower, control_power, G_TYPE_OBJECT);
17142
17143static void
17144control_power_default_init (ControlPowerIface *iface)
17145{
17146 /* GObject signals for incoming D-Bus method calls: */
17147 /**
17148 * ControlPower::handle-set-power-state:
17149 * @object: A #ControlPower.
17150 * @invocation: A #GDBusMethodInvocation.
17151 * @arg_state: Argument passed by remote caller.
17152 *
17153 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Power.setPowerState">setPowerState()</link> D-Bus method.
17154 *
17155 * 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.
17156 *
17157 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
17158 */
17159 g_signal_new ("handle-set-power-state",
17160 G_TYPE_FROM_INTERFACE (iface),
17161 G_SIGNAL_RUN_LAST,
17162 G_STRUCT_OFFSET (ControlPowerIface, handle_set_power_state),
17163 g_signal_accumulator_true_handled,
17164 NULL,
17165 g_cclosure_marshal_generic,
17166 G_TYPE_BOOLEAN,
17167 2,
17168 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT);
17169
17170 /**
17171 * ControlPower::handle-get-power-state:
17172 * @object: A #ControlPower.
17173 * @invocation: A #GDBusMethodInvocation.
17174 *
17175 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Power.getPowerState">getPowerState()</link> D-Bus method.
17176 *
17177 * 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.
17178 *
17179 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
17180 */
17181 g_signal_new ("handle-get-power-state",
17182 G_TYPE_FROM_INTERFACE (iface),
17183 G_SIGNAL_RUN_LAST,
17184 G_STRUCT_OFFSET (ControlPowerIface, handle_get_power_state),
17185 g_signal_accumulator_true_handled,
17186 NULL,
17187 g_cclosure_marshal_generic,
17188 G_TYPE_BOOLEAN,
17189 1,
17190 G_TYPE_DBUS_METHOD_INVOCATION);
17191
17192 /* GObject signals for received D-Bus signals: */
17193 /**
17194 * ControlPower::power-good:
17195 * @object: A #ControlPower.
17196 *
17197 * 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.
17198 *
17199 * 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.
17200 */
17201 g_signal_new ("power-good",
17202 G_TYPE_FROM_INTERFACE (iface),
17203 G_SIGNAL_RUN_LAST,
17204 G_STRUCT_OFFSET (ControlPowerIface, power_good),
17205 NULL,
17206 NULL,
17207 g_cclosure_marshal_generic,
17208 G_TYPE_NONE,
17209 0);
17210
17211 /**
17212 * ControlPower::power-lost:
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.PowerLost">"PowerLost"</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-lost",
17220 G_TYPE_FROM_INTERFACE (iface),
17221 G_SIGNAL_RUN_LAST,
17222 G_STRUCT_OFFSET (ControlPowerIface, power_lost),
17223 NULL,
17224 NULL,
17225 g_cclosure_marshal_generic,
17226 G_TYPE_NONE,
17227 0);
17228
17229 /* GObject properties for D-Bus properties: */
17230 /**
17231 * ControlPower:pgood:
17232 *
17233 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-control-Power.pgood">"pgood"</link>.
17234 *
17235 * 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.
17236 */
17237 g_object_interface_install_property (iface,
17238 g_param_spec_int ("pgood", "pgood", "pgood", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
17239 /**
17240 * ControlPower:state:
17241 *
17242 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-control-Power.state">"state"</link>.
17243 *
17244 * 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.
17245 */
17246 g_object_interface_install_property (iface,
17247 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 -050017248 /**
17249 * ControlPower:pgood-timeout:
17250 *
17251 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-control-Power.pgood_timeout">"pgood_timeout"</link>.
17252 *
17253 * 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.
17254 */
17255 g_object_interface_install_property (iface,
17256 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 -050017257}
17258
17259/**
17260 * control_power_get_pgood: (skip)
17261 * @object: A #ControlPower.
17262 *
17263 * Gets the value of the <link linkend="gdbus-property-org-openbmc-control-Power.pgood">"pgood"</link> D-Bus property.
17264 *
17265 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
17266 *
17267 * Returns: The property value.
17268 */
17269gint
17270control_power_get_pgood (ControlPower *object)
17271{
17272 return CONTROL_POWER_GET_IFACE (object)->get_pgood (object);
17273}
17274
17275/**
17276 * control_power_set_pgood: (skip)
17277 * @object: A #ControlPower.
17278 * @value: The value to set.
17279 *
17280 * Sets the <link linkend="gdbus-property-org-openbmc-control-Power.pgood">"pgood"</link> D-Bus property to @value.
17281 *
17282 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
17283 */
17284void
17285control_power_set_pgood (ControlPower *object, gint value)
17286{
17287 g_object_set (G_OBJECT (object), "pgood", value, NULL);
17288}
17289
17290/**
17291 * control_power_get_state: (skip)
17292 * @object: A #ControlPower.
17293 *
17294 * Gets the value of the <link linkend="gdbus-property-org-openbmc-control-Power.state">"state"</link> D-Bus property.
17295 *
17296 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
17297 *
17298 * Returns: The property value.
17299 */
17300gint
17301control_power_get_state (ControlPower *object)
17302{
17303 return CONTROL_POWER_GET_IFACE (object)->get_state (object);
17304}
17305
17306/**
17307 * control_power_set_state: (skip)
17308 * @object: A #ControlPower.
17309 * @value: The value to set.
17310 *
17311 * Sets the <link linkend="gdbus-property-org-openbmc-control-Power.state">"state"</link> D-Bus property to @value.
17312 *
17313 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
17314 */
17315void
17316control_power_set_state (ControlPower *object, gint value)
17317{
17318 g_object_set (G_OBJECT (object), "state", value, NULL);
17319}
17320
17321/**
Norman James32e74e22015-09-15 21:28:06 -050017322 * control_power_get_pgood_timeout: (skip)
17323 * @object: A #ControlPower.
17324 *
17325 * Gets the value of the <link linkend="gdbus-property-org-openbmc-control-Power.pgood_timeout">"pgood_timeout"</link> D-Bus property.
17326 *
17327 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
17328 *
17329 * Returns: The property value.
17330 */
17331gint
17332control_power_get_pgood_timeout (ControlPower *object)
17333{
17334 return CONTROL_POWER_GET_IFACE (object)->get_pgood_timeout (object);
17335}
17336
17337/**
17338 * control_power_set_pgood_timeout: (skip)
17339 * @object: A #ControlPower.
17340 * @value: The value to set.
17341 *
17342 * Sets the <link linkend="gdbus-property-org-openbmc-control-Power.pgood_timeout">"pgood_timeout"</link> D-Bus property to @value.
17343 *
17344 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
17345 */
17346void
17347control_power_set_pgood_timeout (ControlPower *object, gint value)
17348{
17349 g_object_set (G_OBJECT (object), "pgood-timeout", value, NULL);
17350}
17351
17352/**
Norman James362a80f2015-09-14 14:04:39 -050017353 * control_power_emit_power_good:
17354 * @object: A #ControlPower.
17355 *
17356 * Emits the <link linkend="gdbus-signal-org-openbmc-control-Power.PowerGood">"PowerGood"</link> D-Bus signal.
17357 */
17358void
17359control_power_emit_power_good (
17360 ControlPower *object)
17361{
17362 g_signal_emit_by_name (object, "power-good");
17363}
17364
17365/**
17366 * control_power_emit_power_lost:
17367 * @object: A #ControlPower.
17368 *
17369 * Emits the <link linkend="gdbus-signal-org-openbmc-control-Power.PowerLost">"PowerLost"</link> D-Bus signal.
17370 */
17371void
17372control_power_emit_power_lost (
17373 ControlPower *object)
17374{
17375 g_signal_emit_by_name (object, "power-lost");
17376}
17377
17378/**
17379 * control_power_call_set_power_state:
17380 * @proxy: A #ControlPowerProxy.
17381 * @arg_state: Argument to pass with the method invocation.
17382 * @cancellable: (allow-none): A #GCancellable or %NULL.
17383 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
17384 * @user_data: User data to pass to @callback.
17385 *
17386 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Power.setPowerState">setPowerState()</link> D-Bus method on @proxy.
17387 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
17388 * You can then call control_power_call_set_power_state_finish() to get the result of the operation.
17389 *
17390 * See control_power_call_set_power_state_sync() for the synchronous, blocking version of this method.
17391 */
17392void
17393control_power_call_set_power_state (
17394 ControlPower *proxy,
17395 gint arg_state,
17396 GCancellable *cancellable,
17397 GAsyncReadyCallback callback,
17398 gpointer user_data)
17399{
17400 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
17401 "setPowerState",
17402 g_variant_new ("(i)",
17403 arg_state),
17404 G_DBUS_CALL_FLAGS_NONE,
17405 -1,
17406 cancellable,
17407 callback,
17408 user_data);
17409}
17410
17411/**
17412 * control_power_call_set_power_state_finish:
17413 * @proxy: A #ControlPowerProxy.
17414 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_call_set_power_state().
17415 * @error: Return location for error or %NULL.
17416 *
17417 * Finishes an operation started with control_power_call_set_power_state().
17418 *
17419 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
17420 */
17421gboolean
17422control_power_call_set_power_state_finish (
17423 ControlPower *proxy,
17424 GAsyncResult *res,
17425 GError **error)
17426{
17427 GVariant *_ret;
17428 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
17429 if (_ret == NULL)
17430 goto _out;
17431 g_variant_get (_ret,
17432 "()");
17433 g_variant_unref (_ret);
17434_out:
17435 return _ret != NULL;
17436}
17437
17438/**
17439 * control_power_call_set_power_state_sync:
17440 * @proxy: A #ControlPowerProxy.
17441 * @arg_state: Argument to pass with the method invocation.
17442 * @cancellable: (allow-none): A #GCancellable or %NULL.
17443 * @error: Return location for error or %NULL.
17444 *
17445 * 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.
17446 *
17447 * See control_power_call_set_power_state() for the asynchronous version of this method.
17448 *
17449 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
17450 */
17451gboolean
17452control_power_call_set_power_state_sync (
17453 ControlPower *proxy,
17454 gint arg_state,
17455 GCancellable *cancellable,
17456 GError **error)
17457{
17458 GVariant *_ret;
17459 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
17460 "setPowerState",
17461 g_variant_new ("(i)",
17462 arg_state),
17463 G_DBUS_CALL_FLAGS_NONE,
17464 -1,
17465 cancellable,
17466 error);
17467 if (_ret == NULL)
17468 goto _out;
17469 g_variant_get (_ret,
17470 "()");
17471 g_variant_unref (_ret);
17472_out:
17473 return _ret != NULL;
17474}
17475
17476/**
17477 * control_power_call_get_power_state:
17478 * @proxy: A #ControlPowerProxy.
17479 * @cancellable: (allow-none): A #GCancellable or %NULL.
17480 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
17481 * @user_data: User data to pass to @callback.
17482 *
17483 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Power.getPowerState">getPowerState()</link> D-Bus method on @proxy.
17484 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
17485 * You can then call control_power_call_get_power_state_finish() to get the result of the operation.
17486 *
17487 * See control_power_call_get_power_state_sync() for the synchronous, blocking version of this method.
17488 */
17489void
17490control_power_call_get_power_state (
17491 ControlPower *proxy,
17492 GCancellable *cancellable,
17493 GAsyncReadyCallback callback,
17494 gpointer user_data)
17495{
17496 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
17497 "getPowerState",
17498 g_variant_new ("()"),
17499 G_DBUS_CALL_FLAGS_NONE,
17500 -1,
17501 cancellable,
17502 callback,
17503 user_data);
17504}
17505
17506/**
17507 * control_power_call_get_power_state_finish:
17508 * @proxy: A #ControlPowerProxy.
17509 * @out_state: (out): Return location for return parameter or %NULL to ignore.
17510 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_call_get_power_state().
17511 * @error: Return location for error or %NULL.
17512 *
17513 * Finishes an operation started with control_power_call_get_power_state().
17514 *
17515 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
17516 */
17517gboolean
17518control_power_call_get_power_state_finish (
17519 ControlPower *proxy,
17520 gint *out_state,
17521 GAsyncResult *res,
17522 GError **error)
17523{
17524 GVariant *_ret;
17525 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
17526 if (_ret == NULL)
17527 goto _out;
17528 g_variant_get (_ret,
17529 "(i)",
17530 out_state);
17531 g_variant_unref (_ret);
17532_out:
17533 return _ret != NULL;
17534}
17535
17536/**
17537 * control_power_call_get_power_state_sync:
17538 * @proxy: A #ControlPowerProxy.
17539 * @out_state: (out): Return location for return parameter or %NULL to ignore.
17540 * @cancellable: (allow-none): A #GCancellable or %NULL.
17541 * @error: Return location for error or %NULL.
17542 *
17543 * 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.
17544 *
17545 * See control_power_call_get_power_state() for the asynchronous version of this method.
17546 *
17547 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
17548 */
17549gboolean
17550control_power_call_get_power_state_sync (
17551 ControlPower *proxy,
17552 gint *out_state,
17553 GCancellable *cancellable,
17554 GError **error)
17555{
17556 GVariant *_ret;
17557 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
17558 "getPowerState",
17559 g_variant_new ("()"),
17560 G_DBUS_CALL_FLAGS_NONE,
17561 -1,
17562 cancellable,
17563 error);
17564 if (_ret == NULL)
17565 goto _out;
17566 g_variant_get (_ret,
17567 "(i)",
17568 out_state);
17569 g_variant_unref (_ret);
17570_out:
17571 return _ret != NULL;
17572}
17573
17574/**
17575 * control_power_complete_set_power_state:
17576 * @object: A #ControlPower.
17577 * @invocation: (transfer full): A #GDBusMethodInvocation.
17578 *
17579 * 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.
17580 *
17581 * This method will free @invocation, you cannot use it afterwards.
17582 */
17583void
17584control_power_complete_set_power_state (
17585 ControlPower *object,
17586 GDBusMethodInvocation *invocation)
17587{
17588 g_dbus_method_invocation_return_value (invocation,
17589 g_variant_new ("()"));
17590}
17591
17592/**
17593 * control_power_complete_get_power_state:
17594 * @object: A #ControlPower.
17595 * @invocation: (transfer full): A #GDBusMethodInvocation.
17596 * @state: Parameter to return.
17597 *
17598 * 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.
17599 *
17600 * This method will free @invocation, you cannot use it afterwards.
17601 */
17602void
17603control_power_complete_get_power_state (
17604 ControlPower *object,
17605 GDBusMethodInvocation *invocation,
17606 gint state)
17607{
17608 g_dbus_method_invocation_return_value (invocation,
17609 g_variant_new ("(i)",
17610 state));
17611}
17612
17613/* ------------------------------------------------------------------------ */
17614
17615/**
17616 * ControlPowerProxy:
17617 *
17618 * The #ControlPowerProxy structure contains only private data and should only be accessed using the provided API.
17619 */
17620
17621/**
17622 * ControlPowerProxyClass:
17623 * @parent_class: The parent class.
17624 *
17625 * Class structure for #ControlPowerProxy.
17626 */
17627
17628struct _ControlPowerProxyPrivate
17629{
17630 GData *qdata;
17631};
17632
17633static void control_power_proxy_iface_init (ControlPowerIface *iface);
17634
17635#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
17636G_DEFINE_TYPE_WITH_CODE (ControlPowerProxy, control_power_proxy, G_TYPE_DBUS_PROXY,
17637 G_ADD_PRIVATE (ControlPowerProxy)
17638 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_proxy_iface_init));
17639
17640#else
17641G_DEFINE_TYPE_WITH_CODE (ControlPowerProxy, control_power_proxy, G_TYPE_DBUS_PROXY,
17642 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_proxy_iface_init));
17643
17644#endif
17645static void
17646control_power_proxy_finalize (GObject *object)
17647{
17648 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (object);
17649 g_datalist_clear (&proxy->priv->qdata);
17650 G_OBJECT_CLASS (control_power_proxy_parent_class)->finalize (object);
17651}
17652
17653static void
17654control_power_proxy_get_property (GObject *object,
17655 guint prop_id,
17656 GValue *value,
17657 GParamSpec *pspec G_GNUC_UNUSED)
17658{
17659 const _ExtendedGDBusPropertyInfo *info;
17660 GVariant *variant;
Norman James32e74e22015-09-15 21:28:06 -050017661 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -050017662 info = _control_power_property_info_pointers[prop_id - 1];
17663 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
17664 if (info->use_gvariant)
17665 {
17666 g_value_set_variant (value, variant);
17667 }
17668 else
17669 {
17670 if (variant != NULL)
17671 g_dbus_gvariant_to_gvalue (variant, value);
17672 }
17673 if (variant != NULL)
17674 g_variant_unref (variant);
17675}
17676
17677static void
17678control_power_proxy_set_property_cb (GDBusProxy *proxy,
17679 GAsyncResult *res,
17680 gpointer user_data)
17681{
17682 const _ExtendedGDBusPropertyInfo *info = user_data;
17683 GError *error;
17684 GVariant *_ret;
17685 error = NULL;
17686 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
17687 if (!_ret)
17688 {
17689 g_warning ("Error setting property '%s' on interface org.openbmc.control.Power: %s (%s, %d)",
17690 info->parent_struct.name,
17691 error->message, g_quark_to_string (error->domain), error->code);
17692 g_error_free (error);
17693 }
17694 else
17695 {
17696 g_variant_unref (_ret);
17697 }
17698}
17699
17700static void
17701control_power_proxy_set_property (GObject *object,
17702 guint prop_id,
17703 const GValue *value,
17704 GParamSpec *pspec G_GNUC_UNUSED)
17705{
17706 const _ExtendedGDBusPropertyInfo *info;
17707 GVariant *variant;
Norman James32e74e22015-09-15 21:28:06 -050017708 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -050017709 info = _control_power_property_info_pointers[prop_id - 1];
17710 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
17711 g_dbus_proxy_call (G_DBUS_PROXY (object),
17712 "org.freedesktop.DBus.Properties.Set",
17713 g_variant_new ("(ssv)", "org.openbmc.control.Power", info->parent_struct.name, variant),
17714 G_DBUS_CALL_FLAGS_NONE,
17715 -1,
17716 NULL, (GAsyncReadyCallback) control_power_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
17717 g_variant_unref (variant);
17718}
17719
17720static void
17721control_power_proxy_g_signal (GDBusProxy *proxy,
17722 const gchar *sender_name G_GNUC_UNUSED,
17723 const gchar *signal_name,
17724 GVariant *parameters)
17725{
17726 _ExtendedGDBusSignalInfo *info;
17727 GVariantIter iter;
17728 GVariant *child;
17729 GValue *paramv;
17730 guint num_params;
17731 guint n;
17732 guint signal_id;
17733 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, signal_name);
17734 if (info == NULL)
17735 return;
17736 num_params = g_variant_n_children (parameters);
17737 paramv = g_new0 (GValue, num_params + 1);
17738 g_value_init (&paramv[0], TYPE_CONTROL_POWER);
17739 g_value_set_object (&paramv[0], proxy);
17740 g_variant_iter_init (&iter, parameters);
17741 n = 1;
17742 while ((child = g_variant_iter_next_value (&iter)) != NULL)
17743 {
17744 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
17745 if (arg_info->use_gvariant)
17746 {
17747 g_value_init (&paramv[n], G_TYPE_VARIANT);
17748 g_value_set_variant (&paramv[n], child);
17749 n++;
17750 }
17751 else
17752 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
17753 g_variant_unref (child);
17754 }
17755 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_POWER);
17756 g_signal_emitv (paramv, signal_id, 0, NULL);
17757 for (n = 0; n < num_params + 1; n++)
17758 g_value_unset (&paramv[n]);
17759 g_free (paramv);
17760}
17761
17762static void
17763control_power_proxy_g_properties_changed (GDBusProxy *_proxy,
17764 GVariant *changed_properties,
17765 const gchar *const *invalidated_properties)
17766{
17767 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (_proxy);
17768 guint n;
17769 const gchar *key;
17770 GVariantIter *iter;
17771 _ExtendedGDBusPropertyInfo *info;
17772 g_variant_get (changed_properties, "a{sv}", &iter);
17773 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
17774 {
17775 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, key);
17776 g_datalist_remove_data (&proxy->priv->qdata, key);
17777 if (info != NULL)
17778 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
17779 }
17780 g_variant_iter_free (iter);
17781 for (n = 0; invalidated_properties[n] != NULL; n++)
17782 {
17783 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, invalidated_properties[n]);
17784 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
17785 if (info != NULL)
17786 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
17787 }
17788}
17789
17790static gint
17791control_power_proxy_get_pgood (ControlPower *object)
17792{
17793 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (object);
17794 GVariant *variant;
17795 gint value = 0;
17796 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "pgood");
17797 if (variant != NULL)
17798 {
17799 value = g_variant_get_int32 (variant);
17800 g_variant_unref (variant);
17801 }
17802 return value;
17803}
17804
17805static gint
17806control_power_proxy_get_state (ControlPower *object)
17807{
17808 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (object);
17809 GVariant *variant;
17810 gint value = 0;
17811 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state");
17812 if (variant != NULL)
17813 {
17814 value = g_variant_get_int32 (variant);
17815 g_variant_unref (variant);
17816 }
17817 return value;
17818}
17819
Norman James32e74e22015-09-15 21:28:06 -050017820static gint
17821control_power_proxy_get_pgood_timeout (ControlPower *object)
17822{
17823 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (object);
17824 GVariant *variant;
17825 gint value = 0;
17826 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "pgood_timeout");
17827 if (variant != NULL)
17828 {
17829 value = g_variant_get_int32 (variant);
17830 g_variant_unref (variant);
17831 }
17832 return value;
17833}
17834
Norman James362a80f2015-09-14 14:04:39 -050017835static void
17836control_power_proxy_init (ControlPowerProxy *proxy)
17837{
17838#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
17839 proxy->priv = control_power_proxy_get_instance_private (proxy);
17840#else
17841 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_POWER_PROXY, ControlPowerProxyPrivate);
17842#endif
17843
17844 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_power_interface_info ());
17845}
17846
17847static void
17848control_power_proxy_class_init (ControlPowerProxyClass *klass)
17849{
17850 GObjectClass *gobject_class;
17851 GDBusProxyClass *proxy_class;
17852
17853 gobject_class = G_OBJECT_CLASS (klass);
17854 gobject_class->finalize = control_power_proxy_finalize;
17855 gobject_class->get_property = control_power_proxy_get_property;
17856 gobject_class->set_property = control_power_proxy_set_property;
17857
17858 proxy_class = G_DBUS_PROXY_CLASS (klass);
17859 proxy_class->g_signal = control_power_proxy_g_signal;
17860 proxy_class->g_properties_changed = control_power_proxy_g_properties_changed;
17861
17862 control_power_override_properties (gobject_class, 1);
17863
17864#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
17865 g_type_class_add_private (klass, sizeof (ControlPowerProxyPrivate));
17866#endif
17867}
17868
17869static void
17870control_power_proxy_iface_init (ControlPowerIface *iface)
17871{
17872 iface->get_pgood = control_power_proxy_get_pgood;
17873 iface->get_state = control_power_proxy_get_state;
Norman James32e74e22015-09-15 21:28:06 -050017874 iface->get_pgood_timeout = control_power_proxy_get_pgood_timeout;
Norman James362a80f2015-09-14 14:04:39 -050017875}
17876
17877/**
17878 * control_power_proxy_new:
17879 * @connection: A #GDBusConnection.
17880 * @flags: Flags from the #GDBusProxyFlags enumeration.
17881 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
17882 * @object_path: An object path.
17883 * @cancellable: (allow-none): A #GCancellable or %NULL.
17884 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
17885 * @user_data: User data to pass to @callback.
17886 *
17887 * 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.
17888 *
17889 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
17890 * You can then call control_power_proxy_new_finish() to get the result of the operation.
17891 *
17892 * See control_power_proxy_new_sync() for the synchronous, blocking version of this constructor.
17893 */
17894void
17895control_power_proxy_new (
17896 GDBusConnection *connection,
17897 GDBusProxyFlags flags,
17898 const gchar *name,
17899 const gchar *object_path,
17900 GCancellable *cancellable,
17901 GAsyncReadyCallback callback,
17902 gpointer user_data)
17903{
17904 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);
17905}
17906
17907/**
17908 * control_power_proxy_new_finish:
17909 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_proxy_new().
17910 * @error: Return location for error or %NULL
17911 *
17912 * Finishes an operation started with control_power_proxy_new().
17913 *
17914 * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set.
17915 */
17916ControlPower *
17917control_power_proxy_new_finish (
17918 GAsyncResult *res,
17919 GError **error)
17920{
17921 GObject *ret;
17922 GObject *source_object;
17923 source_object = g_async_result_get_source_object (res);
17924 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
17925 g_object_unref (source_object);
17926 if (ret != NULL)
17927 return CONTROL_POWER (ret);
17928 else
17929 return NULL;
17930}
17931
17932/**
17933 * control_power_proxy_new_sync:
17934 * @connection: A #GDBusConnection.
17935 * @flags: Flags from the #GDBusProxyFlags enumeration.
17936 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
17937 * @object_path: An object path.
17938 * @cancellable: (allow-none): A #GCancellable or %NULL.
17939 * @error: Return location for error or %NULL
17940 *
17941 * 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.
17942 *
17943 * The calling thread is blocked until a reply is received.
17944 *
17945 * See control_power_proxy_new() for the asynchronous version of this constructor.
17946 *
17947 * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set.
17948 */
17949ControlPower *
17950control_power_proxy_new_sync (
17951 GDBusConnection *connection,
17952 GDBusProxyFlags flags,
17953 const gchar *name,
17954 const gchar *object_path,
17955 GCancellable *cancellable,
17956 GError **error)
17957{
17958 GInitable *ret;
17959 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);
17960 if (ret != NULL)
17961 return CONTROL_POWER (ret);
17962 else
17963 return NULL;
17964}
17965
17966
17967/**
17968 * control_power_proxy_new_for_bus:
17969 * @bus_type: A #GBusType.
17970 * @flags: Flags from the #GDBusProxyFlags enumeration.
17971 * @name: A bus name (well-known or unique).
17972 * @object_path: An object path.
17973 * @cancellable: (allow-none): A #GCancellable or %NULL.
17974 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
17975 * @user_data: User data to pass to @callback.
17976 *
17977 * Like control_power_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
17978 *
17979 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
17980 * You can then call control_power_proxy_new_for_bus_finish() to get the result of the operation.
17981 *
17982 * See control_power_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
17983 */
17984void
17985control_power_proxy_new_for_bus (
17986 GBusType bus_type,
17987 GDBusProxyFlags flags,
17988 const gchar *name,
17989 const gchar *object_path,
17990 GCancellable *cancellable,
17991 GAsyncReadyCallback callback,
17992 gpointer user_data)
17993{
17994 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);
17995}
17996
17997/**
17998 * control_power_proxy_new_for_bus_finish:
17999 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_proxy_new_for_bus().
18000 * @error: Return location for error or %NULL
18001 *
18002 * Finishes an operation started with control_power_proxy_new_for_bus().
18003 *
18004 * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set.
18005 */
18006ControlPower *
18007control_power_proxy_new_for_bus_finish (
18008 GAsyncResult *res,
18009 GError **error)
18010{
18011 GObject *ret;
18012 GObject *source_object;
18013 source_object = g_async_result_get_source_object (res);
18014 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
18015 g_object_unref (source_object);
18016 if (ret != NULL)
18017 return CONTROL_POWER (ret);
18018 else
18019 return NULL;
18020}
18021
18022/**
18023 * control_power_proxy_new_for_bus_sync:
18024 * @bus_type: A #GBusType.
18025 * @flags: Flags from the #GDBusProxyFlags enumeration.
18026 * @name: A bus name (well-known or unique).
18027 * @object_path: An object path.
18028 * @cancellable: (allow-none): A #GCancellable or %NULL.
18029 * @error: Return location for error or %NULL
18030 *
18031 * Like control_power_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
18032 *
18033 * The calling thread is blocked until a reply is received.
18034 *
18035 * See control_power_proxy_new_for_bus() for the asynchronous version of this constructor.
18036 *
18037 * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set.
18038 */
18039ControlPower *
18040control_power_proxy_new_for_bus_sync (
18041 GBusType bus_type,
18042 GDBusProxyFlags flags,
18043 const gchar *name,
18044 const gchar *object_path,
18045 GCancellable *cancellable,
18046 GError **error)
18047{
18048 GInitable *ret;
18049 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);
18050 if (ret != NULL)
18051 return CONTROL_POWER (ret);
18052 else
18053 return NULL;
18054}
18055
18056
18057/* ------------------------------------------------------------------------ */
18058
18059/**
18060 * ControlPowerSkeleton:
18061 *
18062 * The #ControlPowerSkeleton structure contains only private data and should only be accessed using the provided API.
18063 */
18064
18065/**
18066 * ControlPowerSkeletonClass:
18067 * @parent_class: The parent class.
18068 *
18069 * Class structure for #ControlPowerSkeleton.
18070 */
18071
18072struct _ControlPowerSkeletonPrivate
18073{
18074 GValue *properties;
18075 GList *changed_properties;
18076 GSource *changed_properties_idle_source;
18077 GMainContext *context;
18078 GMutex lock;
18079};
18080
18081static void
18082_control_power_skeleton_handle_method_call (
18083 GDBusConnection *connection G_GNUC_UNUSED,
18084 const gchar *sender G_GNUC_UNUSED,
18085 const gchar *object_path G_GNUC_UNUSED,
18086 const gchar *interface_name,
18087 const gchar *method_name,
18088 GVariant *parameters,
18089 GDBusMethodInvocation *invocation,
18090 gpointer user_data)
18091{
18092 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data);
18093 _ExtendedGDBusMethodInfo *info;
18094 GVariantIter iter;
18095 GVariant *child;
18096 GValue *paramv;
18097 guint num_params;
18098 guint num_extra;
18099 guint n;
18100 guint signal_id;
18101 GValue return_value = G_VALUE_INIT;
18102 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
18103 g_assert (info != NULL);
18104 num_params = g_variant_n_children (parameters);
18105 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
18106 n = 0;
18107 g_value_init (&paramv[n], TYPE_CONTROL_POWER);
18108 g_value_set_object (&paramv[n++], skeleton);
18109 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
18110 g_value_set_object (&paramv[n++], invocation);
18111 if (info->pass_fdlist)
18112 {
18113#ifdef G_OS_UNIX
18114 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
18115 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
18116#else
18117 g_assert_not_reached ();
18118#endif
18119 }
18120 g_variant_iter_init (&iter, parameters);
18121 while ((child = g_variant_iter_next_value (&iter)) != NULL)
18122 {
18123 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
18124 if (arg_info->use_gvariant)
18125 {
18126 g_value_init (&paramv[n], G_TYPE_VARIANT);
18127 g_value_set_variant (&paramv[n], child);
18128 n++;
18129 }
18130 else
18131 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
18132 g_variant_unref (child);
18133 }
18134 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_POWER);
18135 g_value_init (&return_value, G_TYPE_BOOLEAN);
18136 g_signal_emitv (paramv, signal_id, 0, &return_value);
18137 if (!g_value_get_boolean (&return_value))
18138 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);
18139 g_value_unset (&return_value);
18140 for (n = 0; n < num_params + num_extra; n++)
18141 g_value_unset (&paramv[n]);
18142 g_free (paramv);
18143}
18144
18145static GVariant *
18146_control_power_skeleton_handle_get_property (
18147 GDBusConnection *connection G_GNUC_UNUSED,
18148 const gchar *sender G_GNUC_UNUSED,
18149 const gchar *object_path G_GNUC_UNUSED,
18150 const gchar *interface_name G_GNUC_UNUSED,
18151 const gchar *property_name,
18152 GError **error,
18153 gpointer user_data)
18154{
18155 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data);
18156 GValue value = G_VALUE_INIT;
18157 GParamSpec *pspec;
18158 _ExtendedGDBusPropertyInfo *info;
18159 GVariant *ret;
18160 ret = NULL;
18161 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, property_name);
18162 g_assert (info != NULL);
18163 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
18164 if (pspec == NULL)
18165 {
18166 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
18167 }
18168 else
18169 {
18170 g_value_init (&value, pspec->value_type);
18171 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
18172 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
18173 g_value_unset (&value);
18174 }
18175 return ret;
18176}
18177
18178static gboolean
18179_control_power_skeleton_handle_set_property (
18180 GDBusConnection *connection G_GNUC_UNUSED,
18181 const gchar *sender G_GNUC_UNUSED,
18182 const gchar *object_path G_GNUC_UNUSED,
18183 const gchar *interface_name G_GNUC_UNUSED,
18184 const gchar *property_name,
18185 GVariant *variant,
18186 GError **error,
18187 gpointer user_data)
18188{
18189 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data);
18190 GValue value = G_VALUE_INIT;
18191 GParamSpec *pspec;
18192 _ExtendedGDBusPropertyInfo *info;
18193 gboolean ret;
18194 ret = FALSE;
18195 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, property_name);
18196 g_assert (info != NULL);
18197 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
18198 if (pspec == NULL)
18199 {
18200 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
18201 }
18202 else
18203 {
18204 if (info->use_gvariant)
18205 g_value_set_variant (&value, variant);
18206 else
18207 g_dbus_gvariant_to_gvalue (variant, &value);
18208 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
18209 g_value_unset (&value);
18210 ret = TRUE;
18211 }
18212 return ret;
18213}
18214
18215static const GDBusInterfaceVTable _control_power_skeleton_vtable =
18216{
18217 _control_power_skeleton_handle_method_call,
18218 _control_power_skeleton_handle_get_property,
18219 _control_power_skeleton_handle_set_property,
18220 {NULL}
18221};
18222
18223static GDBusInterfaceInfo *
18224control_power_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
18225{
18226 return control_power_interface_info ();
18227}
18228
18229static GDBusInterfaceVTable *
18230control_power_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
18231{
18232 return (GDBusInterfaceVTable *) &_control_power_skeleton_vtable;
18233}
18234
18235static GVariant *
18236control_power_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
18237{
18238 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (_skeleton);
18239
18240 GVariantBuilder builder;
18241 guint n;
18242 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
18243 if (_control_power_interface_info.parent_struct.properties == NULL)
18244 goto out;
18245 for (n = 0; _control_power_interface_info.parent_struct.properties[n] != NULL; n++)
18246 {
18247 GDBusPropertyInfo *info = _control_power_interface_info.parent_struct.properties[n];
18248 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
18249 {
18250 GVariant *value;
18251 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);
18252 if (value != NULL)
18253 {
18254 g_variant_take_ref (value);
18255 g_variant_builder_add (&builder, "{sv}", info->name, value);
18256 g_variant_unref (value);
18257 }
18258 }
18259 }
18260out:
18261 return g_variant_builder_end (&builder);
18262}
18263
18264static gboolean _control_power_emit_changed (gpointer user_data);
18265
18266static void
18267control_power_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
18268{
18269 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (_skeleton);
18270 gboolean emit_changed = FALSE;
18271
18272 g_mutex_lock (&skeleton->priv->lock);
18273 if (skeleton->priv->changed_properties_idle_source != NULL)
18274 {
18275 g_source_destroy (skeleton->priv->changed_properties_idle_source);
18276 skeleton->priv->changed_properties_idle_source = NULL;
18277 emit_changed = TRUE;
18278 }
18279 g_mutex_unlock (&skeleton->priv->lock);
18280
18281 if (emit_changed)
18282 _control_power_emit_changed (skeleton);
18283}
18284
18285static void
18286_control_power_on_signal_power_good (
18287 ControlPower *object)
18288{
18289 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
18290
18291 GList *connections, *l;
18292 GVariant *signal_variant;
18293 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
18294
18295 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
18296 for (l = connections; l != NULL; l = l->next)
18297 {
18298 GDBusConnection *connection = l->data;
18299 g_dbus_connection_emit_signal (connection,
18300 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.control.Power", "PowerGood",
18301 signal_variant, NULL);
18302 }
18303 g_variant_unref (signal_variant);
18304 g_list_free_full (connections, g_object_unref);
18305}
18306
18307static void
18308_control_power_on_signal_power_lost (
18309 ControlPower *object)
18310{
18311 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
18312
18313 GList *connections, *l;
18314 GVariant *signal_variant;
18315 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
18316
18317 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
18318 for (l = connections; l != NULL; l = l->next)
18319 {
18320 GDBusConnection *connection = l->data;
18321 g_dbus_connection_emit_signal (connection,
18322 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.control.Power", "PowerLost",
18323 signal_variant, NULL);
18324 }
18325 g_variant_unref (signal_variant);
18326 g_list_free_full (connections, g_object_unref);
18327}
18328
18329static void control_power_skeleton_iface_init (ControlPowerIface *iface);
18330#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
18331G_DEFINE_TYPE_WITH_CODE (ControlPowerSkeleton, control_power_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
18332 G_ADD_PRIVATE (ControlPowerSkeleton)
18333 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_skeleton_iface_init));
18334
18335#else
18336G_DEFINE_TYPE_WITH_CODE (ControlPowerSkeleton, control_power_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
18337 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_skeleton_iface_init));
18338
18339#endif
18340static void
18341control_power_skeleton_finalize (GObject *object)
18342{
18343 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
18344 guint n;
Norman James32e74e22015-09-15 21:28:06 -050018345 for (n = 0; n < 3; n++)
Norman James362a80f2015-09-14 14:04:39 -050018346 g_value_unset (&skeleton->priv->properties[n]);
18347 g_free (skeleton->priv->properties);
18348 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
18349 if (skeleton->priv->changed_properties_idle_source != NULL)
18350 g_source_destroy (skeleton->priv->changed_properties_idle_source);
18351 g_main_context_unref (skeleton->priv->context);
18352 g_mutex_clear (&skeleton->priv->lock);
18353 G_OBJECT_CLASS (control_power_skeleton_parent_class)->finalize (object);
18354}
18355
18356static void
18357control_power_skeleton_get_property (GObject *object,
18358 guint prop_id,
18359 GValue *value,
18360 GParamSpec *pspec G_GNUC_UNUSED)
18361{
18362 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
Norman James32e74e22015-09-15 21:28:06 -050018363 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -050018364 g_mutex_lock (&skeleton->priv->lock);
18365 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
18366 g_mutex_unlock (&skeleton->priv->lock);
18367}
18368
18369static gboolean
18370_control_power_emit_changed (gpointer user_data)
18371{
18372 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data);
18373 GList *l;
18374 GVariantBuilder builder;
18375 GVariantBuilder invalidated_builder;
18376 guint num_changes;
18377
18378 g_mutex_lock (&skeleton->priv->lock);
18379 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
18380 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
18381 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
18382 {
18383 ChangedProperty *cp = l->data;
18384 GVariant *variant;
18385 const GValue *cur_value;
18386
18387 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
18388 if (!_g_value_equal (cur_value, &cp->orig_value))
18389 {
18390 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
18391 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
18392 g_variant_unref (variant);
18393 num_changes++;
18394 }
18395 }
18396 if (num_changes > 0)
18397 {
18398 GList *connections, *ll;
18399 GVariant *signal_variant;
18400 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.control.Power",
18401 &builder, &invalidated_builder));
18402 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
18403 for (ll = connections; ll != NULL; ll = ll->next)
18404 {
18405 GDBusConnection *connection = ll->data;
18406
18407 g_dbus_connection_emit_signal (connection,
18408 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
18409 "org.freedesktop.DBus.Properties",
18410 "PropertiesChanged",
18411 signal_variant,
18412 NULL);
18413 }
18414 g_variant_unref (signal_variant);
18415 g_list_free_full (connections, g_object_unref);
18416 }
18417 else
18418 {
18419 g_variant_builder_clear (&builder);
18420 g_variant_builder_clear (&invalidated_builder);
18421 }
18422 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
18423 skeleton->priv->changed_properties = NULL;
18424 skeleton->priv->changed_properties_idle_source = NULL;
18425 g_mutex_unlock (&skeleton->priv->lock);
18426 return FALSE;
18427}
18428
18429static void
18430_control_power_schedule_emit_changed (ControlPowerSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
18431{
18432 ChangedProperty *cp;
18433 GList *l;
18434 cp = NULL;
18435 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
18436 {
18437 ChangedProperty *i_cp = l->data;
18438 if (i_cp->info == info)
18439 {
18440 cp = i_cp;
18441 break;
18442 }
18443 }
18444 if (cp == NULL)
18445 {
18446 cp = g_new0 (ChangedProperty, 1);
18447 cp->prop_id = prop_id;
18448 cp->info = info;
18449 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
18450 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
18451 g_value_copy (orig_value, &cp->orig_value);
18452 }
18453}
18454
18455static void
18456control_power_skeleton_notify (GObject *object,
18457 GParamSpec *pspec G_GNUC_UNUSED)
18458{
18459 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
18460 g_mutex_lock (&skeleton->priv->lock);
18461 if (skeleton->priv->changed_properties != NULL &&
18462 skeleton->priv->changed_properties_idle_source == NULL)
18463 {
18464 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
18465 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
18466 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _control_power_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
18467 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
18468 g_source_unref (skeleton->priv->changed_properties_idle_source);
18469 }
18470 g_mutex_unlock (&skeleton->priv->lock);
18471}
18472
18473static void
18474control_power_skeleton_set_property (GObject *object,
18475 guint prop_id,
18476 const GValue *value,
18477 GParamSpec *pspec)
18478{
18479 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
Norman James32e74e22015-09-15 21:28:06 -050018480 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -050018481 g_mutex_lock (&skeleton->priv->lock);
18482 g_object_freeze_notify (object);
18483 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
18484 {
18485 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
18486 _control_power_schedule_emit_changed (skeleton, _control_power_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
18487 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
18488 g_object_notify_by_pspec (object, pspec);
18489 }
18490 g_mutex_unlock (&skeleton->priv->lock);
18491 g_object_thaw_notify (object);
18492}
18493
18494static void
18495control_power_skeleton_init (ControlPowerSkeleton *skeleton)
18496{
18497#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
18498 skeleton->priv = control_power_skeleton_get_instance_private (skeleton);
18499#else
18500 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_POWER_SKELETON, ControlPowerSkeletonPrivate);
18501#endif
18502
18503 g_mutex_init (&skeleton->priv->lock);
18504 skeleton->priv->context = g_main_context_ref_thread_default ();
Norman James32e74e22015-09-15 21:28:06 -050018505 skeleton->priv->properties = g_new0 (GValue, 3);
Norman James362a80f2015-09-14 14:04:39 -050018506 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
18507 g_value_init (&skeleton->priv->properties[1], G_TYPE_INT);
Norman James32e74e22015-09-15 21:28:06 -050018508 g_value_init (&skeleton->priv->properties[2], G_TYPE_INT);
Norman James362a80f2015-09-14 14:04:39 -050018509}
18510
18511static gint
18512control_power_skeleton_get_pgood (ControlPower *object)
18513{
18514 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
18515 gint value;
18516 g_mutex_lock (&skeleton->priv->lock);
18517 value = g_value_get_int (&(skeleton->priv->properties[0]));
18518 g_mutex_unlock (&skeleton->priv->lock);
18519 return value;
18520}
18521
18522static gint
18523control_power_skeleton_get_state (ControlPower *object)
18524{
18525 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
18526 gint value;
18527 g_mutex_lock (&skeleton->priv->lock);
18528 value = g_value_get_int (&(skeleton->priv->properties[1]));
18529 g_mutex_unlock (&skeleton->priv->lock);
18530 return value;
18531}
18532
Norman James32e74e22015-09-15 21:28:06 -050018533static gint
18534control_power_skeleton_get_pgood_timeout (ControlPower *object)
18535{
18536 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
18537 gint value;
18538 g_mutex_lock (&skeleton->priv->lock);
18539 value = g_value_get_int (&(skeleton->priv->properties[2]));
18540 g_mutex_unlock (&skeleton->priv->lock);
18541 return value;
18542}
18543
Norman James362a80f2015-09-14 14:04:39 -050018544static void
18545control_power_skeleton_class_init (ControlPowerSkeletonClass *klass)
18546{
18547 GObjectClass *gobject_class;
18548 GDBusInterfaceSkeletonClass *skeleton_class;
18549
18550 gobject_class = G_OBJECT_CLASS (klass);
18551 gobject_class->finalize = control_power_skeleton_finalize;
18552 gobject_class->get_property = control_power_skeleton_get_property;
18553 gobject_class->set_property = control_power_skeleton_set_property;
18554 gobject_class->notify = control_power_skeleton_notify;
18555
18556
18557 control_power_override_properties (gobject_class, 1);
18558
18559 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
18560 skeleton_class->get_info = control_power_skeleton_dbus_interface_get_info;
18561 skeleton_class->get_properties = control_power_skeleton_dbus_interface_get_properties;
18562 skeleton_class->flush = control_power_skeleton_dbus_interface_flush;
18563 skeleton_class->get_vtable = control_power_skeleton_dbus_interface_get_vtable;
18564
18565#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
18566 g_type_class_add_private (klass, sizeof (ControlPowerSkeletonPrivate));
18567#endif
18568}
18569
18570static void
18571control_power_skeleton_iface_init (ControlPowerIface *iface)
18572{
18573 iface->power_good = _control_power_on_signal_power_good;
18574 iface->power_lost = _control_power_on_signal_power_lost;
18575 iface->get_pgood = control_power_skeleton_get_pgood;
18576 iface->get_state = control_power_skeleton_get_state;
Norman James32e74e22015-09-15 21:28:06 -050018577 iface->get_pgood_timeout = control_power_skeleton_get_pgood_timeout;
Norman James362a80f2015-09-14 14:04:39 -050018578}
18579
18580/**
18581 * control_power_skeleton_new:
18582 *
18583 * 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>.
18584 *
18585 * Returns: (transfer full) (type ControlPowerSkeleton): The skeleton object.
18586 */
18587ControlPower *
18588control_power_skeleton_new (void)
18589{
18590 return CONTROL_POWER (g_object_new (TYPE_CONTROL_POWER_SKELETON, NULL));
18591}
18592
18593/* ------------------------------------------------------------------------
18594 * Code for interface org.openbmc.Watchdog
18595 * ------------------------------------------------------------------------
18596 */
18597
18598/**
18599 * SECTION:Watchdog
18600 * @title: Watchdog
18601 * @short_description: Generated C code for the org.openbmc.Watchdog D-Bus interface
18602 *
18603 * 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.
18604 */
18605
18606/* ---- Introspection data for org.openbmc.Watchdog ---- */
18607
18608static const _ExtendedGDBusMethodInfo _watchdog_method_info_start =
18609{
18610 {
18611 -1,
18612 (gchar *) "start",
18613 NULL,
18614 NULL,
18615 NULL
18616 },
18617 "handle-start",
18618 FALSE
18619};
18620
18621static const _ExtendedGDBusMethodInfo _watchdog_method_info_poke =
18622{
18623 {
18624 -1,
18625 (gchar *) "poke",
18626 NULL,
18627 NULL,
18628 NULL
18629 },
18630 "handle-poke",
18631 FALSE
18632};
18633
18634static const _ExtendedGDBusMethodInfo _watchdog_method_info_stop =
18635{
18636 {
18637 -1,
18638 (gchar *) "stop",
18639 NULL,
18640 NULL,
18641 NULL
18642 },
18643 "handle-stop",
18644 FALSE
18645};
18646
Adriana Kobylak2cb27752015-10-19 16:23:14 -050018647static const _ExtendedGDBusArgInfo _watchdog_method_info_set_IN_ARG_interval =
18648{
18649 {
18650 -1,
18651 (gchar *) "interval",
18652 (gchar *) "i",
18653 NULL
18654 },
18655 FALSE
18656};
18657
18658static const _ExtendedGDBusArgInfo * const _watchdog_method_info_set_IN_ARG_pointers[] =
18659{
18660 &_watchdog_method_info_set_IN_ARG_interval,
18661 NULL
18662};
18663
18664static const _ExtendedGDBusMethodInfo _watchdog_method_info_set =
18665{
18666 {
18667 -1,
18668 (gchar *) "set",
18669 (GDBusArgInfo **) &_watchdog_method_info_set_IN_ARG_pointers,
18670 NULL,
18671 NULL
18672 },
18673 "handle-set",
18674 FALSE
18675};
18676
Norman James362a80f2015-09-14 14:04:39 -050018677static const _ExtendedGDBusMethodInfo * const _watchdog_method_info_pointers[] =
18678{
18679 &_watchdog_method_info_start,
18680 &_watchdog_method_info_poke,
18681 &_watchdog_method_info_stop,
Adriana Kobylak2cb27752015-10-19 16:23:14 -050018682 &_watchdog_method_info_set,
Norman James362a80f2015-09-14 14:04:39 -050018683 NULL
18684};
18685
18686static const _ExtendedGDBusSignalInfo _watchdog_signal_info_watchdog_error =
18687{
18688 {
18689 -1,
18690 (gchar *) "WatchdogError",
18691 NULL,
18692 NULL
18693 },
18694 "watchdog-error"
18695};
18696
18697static const _ExtendedGDBusSignalInfo * const _watchdog_signal_info_pointers[] =
18698{
18699 &_watchdog_signal_info_watchdog_error,
18700 NULL
18701};
18702
18703static const _ExtendedGDBusPropertyInfo _watchdog_property_info_watchdog =
18704{
18705 {
18706 -1,
18707 (gchar *) "watchdog",
18708 (gchar *) "i",
18709 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
18710 NULL
18711 },
18712 "watchdog",
18713 FALSE
18714};
18715
18716static const _ExtendedGDBusPropertyInfo _watchdog_property_info_poll_interval =
18717{
18718 {
18719 -1,
18720 (gchar *) "poll_interval",
18721 (gchar *) "i",
18722 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
18723 NULL
18724 },
18725 "poll-interval",
18726 FALSE
18727};
18728
18729static const _ExtendedGDBusPropertyInfo * const _watchdog_property_info_pointers[] =
18730{
18731 &_watchdog_property_info_watchdog,
18732 &_watchdog_property_info_poll_interval,
18733 NULL
18734};
18735
18736static const _ExtendedGDBusInterfaceInfo _watchdog_interface_info =
18737{
18738 {
18739 -1,
18740 (gchar *) "org.openbmc.Watchdog",
18741 (GDBusMethodInfo **) &_watchdog_method_info_pointers,
18742 (GDBusSignalInfo **) &_watchdog_signal_info_pointers,
18743 (GDBusPropertyInfo **) &_watchdog_property_info_pointers,
18744 NULL
18745 },
18746 "watchdog",
18747};
18748
18749
18750/**
18751 * watchdog_interface_info:
18752 *
18753 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link> D-Bus interface.
18754 *
18755 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
18756 */
18757GDBusInterfaceInfo *
18758watchdog_interface_info (void)
18759{
18760 return (GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct;
18761}
18762
18763/**
18764 * watchdog_override_properties:
18765 * @klass: The class structure for a #GObject<!-- -->-derived class.
18766 * @property_id_begin: The property id to assign to the first overridden property.
18767 *
18768 * Overrides all #GObject properties in the #Watchdog interface for a concrete class.
18769 * The properties are overridden in the order they are defined.
18770 *
18771 * Returns: The last property id.
18772 */
18773guint
18774watchdog_override_properties (GObjectClass *klass, guint property_id_begin)
18775{
18776 g_object_class_override_property (klass, property_id_begin++, "watchdog");
18777 g_object_class_override_property (klass, property_id_begin++, "poll-interval");
18778 return property_id_begin - 1;
18779}
18780
18781
18782
18783/**
18784 * Watchdog:
18785 *
18786 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link>.
18787 */
18788
18789/**
18790 * WatchdogIface:
18791 * @parent_iface: The parent interface.
18792 * @handle_poke: Handler for the #Watchdog::handle-poke signal.
Adriana Kobylak2cb27752015-10-19 16:23:14 -050018793 * @handle_set: Handler for the #Watchdog::handle-set signal.
Norman James362a80f2015-09-14 14:04:39 -050018794 * @handle_start: Handler for the #Watchdog::handle-start signal.
18795 * @handle_stop: Handler for the #Watchdog::handle-stop signal.
18796 * @get_poll_interval: Getter for the #Watchdog:poll-interval property.
18797 * @get_watchdog: Getter for the #Watchdog:watchdog property.
18798 * @watchdog_error: Handler for the #Watchdog::watchdog-error signal.
18799 *
18800 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link>.
18801 */
18802
18803typedef WatchdogIface WatchdogInterface;
18804G_DEFINE_INTERFACE (Watchdog, watchdog, G_TYPE_OBJECT);
18805
18806static void
18807watchdog_default_init (WatchdogIface *iface)
18808{
18809 /* GObject signals for incoming D-Bus method calls: */
18810 /**
18811 * Watchdog::handle-start:
18812 * @object: A #Watchdog.
18813 * @invocation: A #GDBusMethodInvocation.
18814 *
18815 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Watchdog.start">start()</link> D-Bus method.
18816 *
18817 * 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.
18818 *
18819 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
18820 */
18821 g_signal_new ("handle-start",
18822 G_TYPE_FROM_INTERFACE (iface),
18823 G_SIGNAL_RUN_LAST,
18824 G_STRUCT_OFFSET (WatchdogIface, handle_start),
18825 g_signal_accumulator_true_handled,
18826 NULL,
18827 g_cclosure_marshal_generic,
18828 G_TYPE_BOOLEAN,
18829 1,
18830 G_TYPE_DBUS_METHOD_INVOCATION);
18831
18832 /**
18833 * Watchdog::handle-poke:
18834 * @object: A #Watchdog.
18835 * @invocation: A #GDBusMethodInvocation.
18836 *
18837 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Watchdog.poke">poke()</link> D-Bus method.
18838 *
18839 * 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.
18840 *
18841 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
18842 */
18843 g_signal_new ("handle-poke",
18844 G_TYPE_FROM_INTERFACE (iface),
18845 G_SIGNAL_RUN_LAST,
18846 G_STRUCT_OFFSET (WatchdogIface, handle_poke),
18847 g_signal_accumulator_true_handled,
18848 NULL,
18849 g_cclosure_marshal_generic,
18850 G_TYPE_BOOLEAN,
18851 1,
18852 G_TYPE_DBUS_METHOD_INVOCATION);
18853
18854 /**
18855 * Watchdog::handle-stop:
18856 * @object: A #Watchdog.
18857 * @invocation: A #GDBusMethodInvocation.
18858 *
18859 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Watchdog.stop">stop()</link> D-Bus method.
18860 *
18861 * 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.
18862 *
18863 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
18864 */
18865 g_signal_new ("handle-stop",
18866 G_TYPE_FROM_INTERFACE (iface),
18867 G_SIGNAL_RUN_LAST,
18868 G_STRUCT_OFFSET (WatchdogIface, handle_stop),
18869 g_signal_accumulator_true_handled,
18870 NULL,
18871 g_cclosure_marshal_generic,
18872 G_TYPE_BOOLEAN,
18873 1,
18874 G_TYPE_DBUS_METHOD_INVOCATION);
18875
Adriana Kobylak2cb27752015-10-19 16:23:14 -050018876 /**
18877 * Watchdog::handle-set:
18878 * @object: A #Watchdog.
18879 * @invocation: A #GDBusMethodInvocation.
18880 * @arg_interval: Argument passed by remote caller.
18881 *
18882 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Watchdog.set">set()</link> D-Bus method.
18883 *
18884 * 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.
18885 *
18886 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
18887 */
18888 g_signal_new ("handle-set",
18889 G_TYPE_FROM_INTERFACE (iface),
18890 G_SIGNAL_RUN_LAST,
18891 G_STRUCT_OFFSET (WatchdogIface, handle_set),
18892 g_signal_accumulator_true_handled,
18893 NULL,
18894 g_cclosure_marshal_generic,
18895 G_TYPE_BOOLEAN,
18896 2,
18897 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT);
18898
Norman James362a80f2015-09-14 14:04:39 -050018899 /* GObject signals for received D-Bus signals: */
18900 /**
18901 * Watchdog::watchdog-error:
18902 * @object: A #Watchdog.
18903 *
18904 * 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.
18905 *
18906 * 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.
18907 */
18908 g_signal_new ("watchdog-error",
18909 G_TYPE_FROM_INTERFACE (iface),
18910 G_SIGNAL_RUN_LAST,
18911 G_STRUCT_OFFSET (WatchdogIface, watchdog_error),
18912 NULL,
18913 NULL,
18914 g_cclosure_marshal_generic,
18915 G_TYPE_NONE,
18916 0);
18917
18918 /* GObject properties for D-Bus properties: */
18919 /**
18920 * Watchdog:watchdog:
18921 *
18922 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Watchdog.watchdog">"watchdog"</link>.
18923 *
18924 * 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.
18925 */
18926 g_object_interface_install_property (iface,
18927 g_param_spec_int ("watchdog", "watchdog", "watchdog", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
18928 /**
18929 * Watchdog:poll-interval:
18930 *
18931 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Watchdog.poll_interval">"poll_interval"</link>.
18932 *
18933 * 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.
18934 */
18935 g_object_interface_install_property (iface,
18936 g_param_spec_int ("poll-interval", "poll_interval", "poll_interval", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
18937}
18938
18939/**
18940 * watchdog_get_watchdog: (skip)
18941 * @object: A #Watchdog.
18942 *
18943 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Watchdog.watchdog">"watchdog"</link> D-Bus property.
18944 *
18945 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
18946 *
18947 * Returns: The property value.
18948 */
18949gint
18950watchdog_get_watchdog (Watchdog *object)
18951{
18952 return WATCHDOG_GET_IFACE (object)->get_watchdog (object);
18953}
18954
18955/**
18956 * watchdog_set_watchdog: (skip)
18957 * @object: A #Watchdog.
18958 * @value: The value to set.
18959 *
18960 * Sets the <link linkend="gdbus-property-org-openbmc-Watchdog.watchdog">"watchdog"</link> D-Bus property to @value.
18961 *
18962 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
18963 */
18964void
18965watchdog_set_watchdog (Watchdog *object, gint value)
18966{
18967 g_object_set (G_OBJECT (object), "watchdog", value, NULL);
18968}
18969
18970/**
18971 * watchdog_get_poll_interval: (skip)
18972 * @object: A #Watchdog.
18973 *
18974 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Watchdog.poll_interval">"poll_interval"</link> D-Bus property.
18975 *
18976 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
18977 *
18978 * Returns: The property value.
18979 */
18980gint
18981watchdog_get_poll_interval (Watchdog *object)
18982{
18983 return WATCHDOG_GET_IFACE (object)->get_poll_interval (object);
18984}
18985
18986/**
18987 * watchdog_set_poll_interval: (skip)
18988 * @object: A #Watchdog.
18989 * @value: The value to set.
18990 *
18991 * Sets the <link linkend="gdbus-property-org-openbmc-Watchdog.poll_interval">"poll_interval"</link> D-Bus property to @value.
18992 *
18993 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
18994 */
18995void
18996watchdog_set_poll_interval (Watchdog *object, gint value)
18997{
18998 g_object_set (G_OBJECT (object), "poll-interval", value, NULL);
18999}
19000
19001/**
19002 * watchdog_emit_watchdog_error:
19003 * @object: A #Watchdog.
19004 *
19005 * Emits the <link linkend="gdbus-signal-org-openbmc-Watchdog.WatchdogError">"WatchdogError"</link> D-Bus signal.
19006 */
19007void
19008watchdog_emit_watchdog_error (
19009 Watchdog *object)
19010{
19011 g_signal_emit_by_name (object, "watchdog-error");
19012}
19013
19014/**
19015 * watchdog_call_start:
19016 * @proxy: A #WatchdogProxy.
19017 * @cancellable: (allow-none): A #GCancellable or %NULL.
19018 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
19019 * @user_data: User data to pass to @callback.
19020 *
19021 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.start">start()</link> D-Bus method on @proxy.
19022 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
19023 * You can then call watchdog_call_start_finish() to get the result of the operation.
19024 *
19025 * See watchdog_call_start_sync() for the synchronous, blocking version of this method.
19026 */
19027void
19028watchdog_call_start (
19029 Watchdog *proxy,
19030 GCancellable *cancellable,
19031 GAsyncReadyCallback callback,
19032 gpointer user_data)
19033{
19034 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
19035 "start",
19036 g_variant_new ("()"),
19037 G_DBUS_CALL_FLAGS_NONE,
19038 -1,
19039 cancellable,
19040 callback,
19041 user_data);
19042}
19043
19044/**
19045 * watchdog_call_start_finish:
19046 * @proxy: A #WatchdogProxy.
19047 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_call_start().
19048 * @error: Return location for error or %NULL.
19049 *
19050 * Finishes an operation started with watchdog_call_start().
19051 *
19052 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19053 */
19054gboolean
19055watchdog_call_start_finish (
19056 Watchdog *proxy,
19057 GAsyncResult *res,
19058 GError **error)
19059{
19060 GVariant *_ret;
19061 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
19062 if (_ret == NULL)
19063 goto _out;
19064 g_variant_get (_ret,
19065 "()");
19066 g_variant_unref (_ret);
19067_out:
19068 return _ret != NULL;
19069}
19070
19071/**
19072 * watchdog_call_start_sync:
19073 * @proxy: A #WatchdogProxy.
19074 * @cancellable: (allow-none): A #GCancellable or %NULL.
19075 * @error: Return location for error or %NULL.
19076 *
19077 * 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.
19078 *
19079 * See watchdog_call_start() for the asynchronous version of this method.
19080 *
19081 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19082 */
19083gboolean
19084watchdog_call_start_sync (
19085 Watchdog *proxy,
19086 GCancellable *cancellable,
19087 GError **error)
19088{
19089 GVariant *_ret;
19090 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
19091 "start",
19092 g_variant_new ("()"),
19093 G_DBUS_CALL_FLAGS_NONE,
19094 -1,
19095 cancellable,
19096 error);
19097 if (_ret == NULL)
19098 goto _out;
19099 g_variant_get (_ret,
19100 "()");
19101 g_variant_unref (_ret);
19102_out:
19103 return _ret != NULL;
19104}
19105
19106/**
19107 * watchdog_call_poke:
19108 * @proxy: A #WatchdogProxy.
19109 * @cancellable: (allow-none): A #GCancellable or %NULL.
19110 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
19111 * @user_data: User data to pass to @callback.
19112 *
19113 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.poke">poke()</link> D-Bus method on @proxy.
19114 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
19115 * You can then call watchdog_call_poke_finish() to get the result of the operation.
19116 *
19117 * See watchdog_call_poke_sync() for the synchronous, blocking version of this method.
19118 */
19119void
19120watchdog_call_poke (
19121 Watchdog *proxy,
19122 GCancellable *cancellable,
19123 GAsyncReadyCallback callback,
19124 gpointer user_data)
19125{
19126 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
19127 "poke",
19128 g_variant_new ("()"),
19129 G_DBUS_CALL_FLAGS_NONE,
19130 -1,
19131 cancellable,
19132 callback,
19133 user_data);
19134}
19135
19136/**
19137 * watchdog_call_poke_finish:
19138 * @proxy: A #WatchdogProxy.
19139 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_call_poke().
19140 * @error: Return location for error or %NULL.
19141 *
19142 * Finishes an operation started with watchdog_call_poke().
19143 *
19144 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19145 */
19146gboolean
19147watchdog_call_poke_finish (
19148 Watchdog *proxy,
19149 GAsyncResult *res,
19150 GError **error)
19151{
19152 GVariant *_ret;
19153 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
19154 if (_ret == NULL)
19155 goto _out;
19156 g_variant_get (_ret,
19157 "()");
19158 g_variant_unref (_ret);
19159_out:
19160 return _ret != NULL;
19161}
19162
19163/**
19164 * watchdog_call_poke_sync:
19165 * @proxy: A #WatchdogProxy.
19166 * @cancellable: (allow-none): A #GCancellable or %NULL.
19167 * @error: Return location for error or %NULL.
19168 *
19169 * 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.
19170 *
19171 * See watchdog_call_poke() for the asynchronous version of this method.
19172 *
19173 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19174 */
19175gboolean
19176watchdog_call_poke_sync (
19177 Watchdog *proxy,
19178 GCancellable *cancellable,
19179 GError **error)
19180{
19181 GVariant *_ret;
19182 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
19183 "poke",
19184 g_variant_new ("()"),
19185 G_DBUS_CALL_FLAGS_NONE,
19186 -1,
19187 cancellable,
19188 error);
19189 if (_ret == NULL)
19190 goto _out;
19191 g_variant_get (_ret,
19192 "()");
19193 g_variant_unref (_ret);
19194_out:
19195 return _ret != NULL;
19196}
19197
19198/**
19199 * watchdog_call_stop:
19200 * @proxy: A #WatchdogProxy.
19201 * @cancellable: (allow-none): A #GCancellable or %NULL.
19202 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
19203 * @user_data: User data to pass to @callback.
19204 *
19205 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.stop">stop()</link> D-Bus method on @proxy.
19206 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
19207 * You can then call watchdog_call_stop_finish() to get the result of the operation.
19208 *
19209 * See watchdog_call_stop_sync() for the synchronous, blocking version of this method.
19210 */
19211void
19212watchdog_call_stop (
19213 Watchdog *proxy,
19214 GCancellable *cancellable,
19215 GAsyncReadyCallback callback,
19216 gpointer user_data)
19217{
19218 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
19219 "stop",
19220 g_variant_new ("()"),
19221 G_DBUS_CALL_FLAGS_NONE,
19222 -1,
19223 cancellable,
19224 callback,
19225 user_data);
19226}
19227
19228/**
19229 * watchdog_call_stop_finish:
19230 * @proxy: A #WatchdogProxy.
19231 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_call_stop().
19232 * @error: Return location for error or %NULL.
19233 *
19234 * Finishes an operation started with watchdog_call_stop().
19235 *
19236 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19237 */
19238gboolean
19239watchdog_call_stop_finish (
19240 Watchdog *proxy,
19241 GAsyncResult *res,
19242 GError **error)
19243{
19244 GVariant *_ret;
19245 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
19246 if (_ret == NULL)
19247 goto _out;
19248 g_variant_get (_ret,
19249 "()");
19250 g_variant_unref (_ret);
19251_out:
19252 return _ret != NULL;
19253}
19254
19255/**
19256 * watchdog_call_stop_sync:
19257 * @proxy: A #WatchdogProxy.
19258 * @cancellable: (allow-none): A #GCancellable or %NULL.
19259 * @error: Return location for error or %NULL.
19260 *
19261 * 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.
19262 *
19263 * See watchdog_call_stop() for the asynchronous version of this method.
19264 *
19265 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19266 */
19267gboolean
19268watchdog_call_stop_sync (
19269 Watchdog *proxy,
19270 GCancellable *cancellable,
19271 GError **error)
19272{
19273 GVariant *_ret;
19274 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
19275 "stop",
19276 g_variant_new ("()"),
19277 G_DBUS_CALL_FLAGS_NONE,
19278 -1,
19279 cancellable,
19280 error);
19281 if (_ret == NULL)
19282 goto _out;
19283 g_variant_get (_ret,
19284 "()");
19285 g_variant_unref (_ret);
19286_out:
19287 return _ret != NULL;
19288}
19289
19290/**
Adriana Kobylak2cb27752015-10-19 16:23:14 -050019291 * watchdog_call_set:
19292 * @proxy: A #WatchdogProxy.
19293 * @arg_interval: Argument to pass with the method invocation.
19294 * @cancellable: (allow-none): A #GCancellable or %NULL.
19295 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
19296 * @user_data: User data to pass to @callback.
19297 *
19298 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.set">set()</link> D-Bus method on @proxy.
19299 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
19300 * You can then call watchdog_call_set_finish() to get the result of the operation.
19301 *
19302 * See watchdog_call_set_sync() for the synchronous, blocking version of this method.
19303 */
19304void
19305watchdog_call_set (
19306 Watchdog *proxy,
19307 gint arg_interval,
19308 GCancellable *cancellable,
19309 GAsyncReadyCallback callback,
19310 gpointer user_data)
19311{
19312 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
19313 "set",
19314 g_variant_new ("(i)",
19315 arg_interval),
19316 G_DBUS_CALL_FLAGS_NONE,
19317 -1,
19318 cancellable,
19319 callback,
19320 user_data);
19321}
19322
19323/**
19324 * watchdog_call_set_finish:
19325 * @proxy: A #WatchdogProxy.
19326 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_call_set().
19327 * @error: Return location for error or %NULL.
19328 *
19329 * Finishes an operation started with watchdog_call_set().
19330 *
19331 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19332 */
19333gboolean
19334watchdog_call_set_finish (
19335 Watchdog *proxy,
19336 GAsyncResult *res,
19337 GError **error)
19338{
19339 GVariant *_ret;
19340 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
19341 if (_ret == NULL)
19342 goto _out;
19343 g_variant_get (_ret,
19344 "()");
19345 g_variant_unref (_ret);
19346_out:
19347 return _ret != NULL;
19348}
19349
19350/**
19351 * watchdog_call_set_sync:
19352 * @proxy: A #WatchdogProxy.
19353 * @arg_interval: Argument to pass with the method invocation.
19354 * @cancellable: (allow-none): A #GCancellable or %NULL.
19355 * @error: Return location for error or %NULL.
19356 *
19357 * 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.
19358 *
19359 * See watchdog_call_set() for the asynchronous version of this method.
19360 *
19361 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19362 */
19363gboolean
19364watchdog_call_set_sync (
19365 Watchdog *proxy,
19366 gint arg_interval,
19367 GCancellable *cancellable,
19368 GError **error)
19369{
19370 GVariant *_ret;
19371 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
19372 "set",
19373 g_variant_new ("(i)",
19374 arg_interval),
19375 G_DBUS_CALL_FLAGS_NONE,
19376 -1,
19377 cancellable,
19378 error);
19379 if (_ret == NULL)
19380 goto _out;
19381 g_variant_get (_ret,
19382 "()");
19383 g_variant_unref (_ret);
19384_out:
19385 return _ret != NULL;
19386}
19387
19388/**
Norman James362a80f2015-09-14 14:04:39 -050019389 * watchdog_complete_start:
19390 * @object: A #Watchdog.
19391 * @invocation: (transfer full): A #GDBusMethodInvocation.
19392 *
19393 * 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.
19394 *
19395 * This method will free @invocation, you cannot use it afterwards.
19396 */
19397void
19398watchdog_complete_start (
19399 Watchdog *object,
19400 GDBusMethodInvocation *invocation)
19401{
19402 g_dbus_method_invocation_return_value (invocation,
19403 g_variant_new ("()"));
19404}
19405
19406/**
19407 * watchdog_complete_poke:
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.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.
19412 *
19413 * This method will free @invocation, you cannot use it afterwards.
19414 */
19415void
19416watchdog_complete_poke (
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_stop:
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.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.
19430 *
19431 * This method will free @invocation, you cannot use it afterwards.
19432 */
19433void
19434watchdog_complete_stop (
19435 Watchdog *object,
19436 GDBusMethodInvocation *invocation)
19437{
19438 g_dbus_method_invocation_return_value (invocation,
19439 g_variant_new ("()"));
19440}
19441
Adriana Kobylak2cb27752015-10-19 16:23:14 -050019442/**
19443 * watchdog_complete_set:
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.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.
19448 *
19449 * This method will free @invocation, you cannot use it afterwards.
19450 */
19451void
19452watchdog_complete_set (
19453 Watchdog *object,
19454 GDBusMethodInvocation *invocation)
19455{
19456 g_dbus_method_invocation_return_value (invocation,
19457 g_variant_new ("()"));
19458}
19459
Norman James362a80f2015-09-14 14:04:39 -050019460/* ------------------------------------------------------------------------ */
19461
19462/**
19463 * WatchdogProxy:
19464 *
19465 * The #WatchdogProxy structure contains only private data and should only be accessed using the provided API.
19466 */
19467
19468/**
19469 * WatchdogProxyClass:
19470 * @parent_class: The parent class.
19471 *
19472 * Class structure for #WatchdogProxy.
19473 */
19474
19475struct _WatchdogProxyPrivate
19476{
19477 GData *qdata;
19478};
19479
19480static void watchdog_proxy_iface_init (WatchdogIface *iface);
19481
19482#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
19483G_DEFINE_TYPE_WITH_CODE (WatchdogProxy, watchdog_proxy, G_TYPE_DBUS_PROXY,
19484 G_ADD_PRIVATE (WatchdogProxy)
19485 G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_proxy_iface_init));
19486
19487#else
19488G_DEFINE_TYPE_WITH_CODE (WatchdogProxy, watchdog_proxy, G_TYPE_DBUS_PROXY,
19489 G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_proxy_iface_init));
19490
19491#endif
19492static void
19493watchdog_proxy_finalize (GObject *object)
19494{
19495 WatchdogProxy *proxy = WATCHDOG_PROXY (object);
19496 g_datalist_clear (&proxy->priv->qdata);
19497 G_OBJECT_CLASS (watchdog_proxy_parent_class)->finalize (object);
19498}
19499
19500static void
19501watchdog_proxy_get_property (GObject *object,
19502 guint prop_id,
19503 GValue *value,
19504 GParamSpec *pspec G_GNUC_UNUSED)
19505{
19506 const _ExtendedGDBusPropertyInfo *info;
19507 GVariant *variant;
19508 g_assert (prop_id != 0 && prop_id - 1 < 2);
19509 info = _watchdog_property_info_pointers[prop_id - 1];
19510 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
19511 if (info->use_gvariant)
19512 {
19513 g_value_set_variant (value, variant);
19514 }
19515 else
19516 {
19517 if (variant != NULL)
19518 g_dbus_gvariant_to_gvalue (variant, value);
19519 }
19520 if (variant != NULL)
19521 g_variant_unref (variant);
19522}
19523
19524static void
19525watchdog_proxy_set_property_cb (GDBusProxy *proxy,
19526 GAsyncResult *res,
19527 gpointer user_data)
19528{
19529 const _ExtendedGDBusPropertyInfo *info = user_data;
19530 GError *error;
19531 GVariant *_ret;
19532 error = NULL;
19533 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
19534 if (!_ret)
19535 {
19536 g_warning ("Error setting property '%s' on interface org.openbmc.Watchdog: %s (%s, %d)",
19537 info->parent_struct.name,
19538 error->message, g_quark_to_string (error->domain), error->code);
19539 g_error_free (error);
19540 }
19541 else
19542 {
19543 g_variant_unref (_ret);
19544 }
19545}
19546
19547static void
19548watchdog_proxy_set_property (GObject *object,
19549 guint prop_id,
19550 const GValue *value,
19551 GParamSpec *pspec G_GNUC_UNUSED)
19552{
19553 const _ExtendedGDBusPropertyInfo *info;
19554 GVariant *variant;
19555 g_assert (prop_id != 0 && prop_id - 1 < 2);
19556 info = _watchdog_property_info_pointers[prop_id - 1];
19557 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
19558 g_dbus_proxy_call (G_DBUS_PROXY (object),
19559 "org.freedesktop.DBus.Properties.Set",
19560 g_variant_new ("(ssv)", "org.openbmc.Watchdog", info->parent_struct.name, variant),
19561 G_DBUS_CALL_FLAGS_NONE,
19562 -1,
19563 NULL, (GAsyncReadyCallback) watchdog_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
19564 g_variant_unref (variant);
19565}
19566
19567static void
19568watchdog_proxy_g_signal (GDBusProxy *proxy,
19569 const gchar *sender_name G_GNUC_UNUSED,
19570 const gchar *signal_name,
19571 GVariant *parameters)
19572{
19573 _ExtendedGDBusSignalInfo *info;
19574 GVariantIter iter;
19575 GVariant *child;
19576 GValue *paramv;
19577 guint num_params;
19578 guint n;
19579 guint signal_id;
19580 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, signal_name);
19581 if (info == NULL)
19582 return;
19583 num_params = g_variant_n_children (parameters);
19584 paramv = g_new0 (GValue, num_params + 1);
19585 g_value_init (&paramv[0], TYPE_WATCHDOG);
19586 g_value_set_object (&paramv[0], proxy);
19587 g_variant_iter_init (&iter, parameters);
19588 n = 1;
19589 while ((child = g_variant_iter_next_value (&iter)) != NULL)
19590 {
19591 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
19592 if (arg_info->use_gvariant)
19593 {
19594 g_value_init (&paramv[n], G_TYPE_VARIANT);
19595 g_value_set_variant (&paramv[n], child);
19596 n++;
19597 }
19598 else
19599 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
19600 g_variant_unref (child);
19601 }
19602 signal_id = g_signal_lookup (info->signal_name, TYPE_WATCHDOG);
19603 g_signal_emitv (paramv, signal_id, 0, NULL);
19604 for (n = 0; n < num_params + 1; n++)
19605 g_value_unset (&paramv[n]);
19606 g_free (paramv);
19607}
19608
19609static void
19610watchdog_proxy_g_properties_changed (GDBusProxy *_proxy,
19611 GVariant *changed_properties,
19612 const gchar *const *invalidated_properties)
19613{
19614 WatchdogProxy *proxy = WATCHDOG_PROXY (_proxy);
19615 guint n;
19616 const gchar *key;
19617 GVariantIter *iter;
19618 _ExtendedGDBusPropertyInfo *info;
19619 g_variant_get (changed_properties, "a{sv}", &iter);
19620 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
19621 {
19622 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, key);
19623 g_datalist_remove_data (&proxy->priv->qdata, key);
19624 if (info != NULL)
19625 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
19626 }
19627 g_variant_iter_free (iter);
19628 for (n = 0; invalidated_properties[n] != NULL; n++)
19629 {
19630 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, invalidated_properties[n]);
19631 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
19632 if (info != NULL)
19633 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
19634 }
19635}
19636
19637static gint
19638watchdog_proxy_get_watchdog (Watchdog *object)
19639{
19640 WatchdogProxy *proxy = WATCHDOG_PROXY (object);
19641 GVariant *variant;
19642 gint value = 0;
19643 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "watchdog");
19644 if (variant != NULL)
19645 {
19646 value = g_variant_get_int32 (variant);
19647 g_variant_unref (variant);
19648 }
19649 return value;
19650}
19651
19652static gint
19653watchdog_proxy_get_poll_interval (Watchdog *object)
19654{
19655 WatchdogProxy *proxy = WATCHDOG_PROXY (object);
19656 GVariant *variant;
19657 gint value = 0;
19658 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "poll_interval");
19659 if (variant != NULL)
19660 {
19661 value = g_variant_get_int32 (variant);
19662 g_variant_unref (variant);
19663 }
19664 return value;
19665}
19666
19667static void
19668watchdog_proxy_init (WatchdogProxy *proxy)
19669{
19670#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
19671 proxy->priv = watchdog_proxy_get_instance_private (proxy);
19672#else
19673 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_WATCHDOG_PROXY, WatchdogProxyPrivate);
19674#endif
19675
19676 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), watchdog_interface_info ());
19677}
19678
19679static void
19680watchdog_proxy_class_init (WatchdogProxyClass *klass)
19681{
19682 GObjectClass *gobject_class;
19683 GDBusProxyClass *proxy_class;
19684
19685 gobject_class = G_OBJECT_CLASS (klass);
19686 gobject_class->finalize = watchdog_proxy_finalize;
19687 gobject_class->get_property = watchdog_proxy_get_property;
19688 gobject_class->set_property = watchdog_proxy_set_property;
19689
19690 proxy_class = G_DBUS_PROXY_CLASS (klass);
19691 proxy_class->g_signal = watchdog_proxy_g_signal;
19692 proxy_class->g_properties_changed = watchdog_proxy_g_properties_changed;
19693
19694 watchdog_override_properties (gobject_class, 1);
19695
19696#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
19697 g_type_class_add_private (klass, sizeof (WatchdogProxyPrivate));
19698#endif
19699}
19700
19701static void
19702watchdog_proxy_iface_init (WatchdogIface *iface)
19703{
19704 iface->get_watchdog = watchdog_proxy_get_watchdog;
19705 iface->get_poll_interval = watchdog_proxy_get_poll_interval;
19706}
19707
19708/**
19709 * watchdog_proxy_new:
19710 * @connection: A #GDBusConnection.
19711 * @flags: Flags from the #GDBusProxyFlags enumeration.
19712 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
19713 * @object_path: An object path.
19714 * @cancellable: (allow-none): A #GCancellable or %NULL.
19715 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
19716 * @user_data: User data to pass to @callback.
19717 *
19718 * 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.
19719 *
19720 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
19721 * You can then call watchdog_proxy_new_finish() to get the result of the operation.
19722 *
19723 * See watchdog_proxy_new_sync() for the synchronous, blocking version of this constructor.
19724 */
19725void
19726watchdog_proxy_new (
19727 GDBusConnection *connection,
19728 GDBusProxyFlags flags,
19729 const gchar *name,
19730 const gchar *object_path,
19731 GCancellable *cancellable,
19732 GAsyncReadyCallback callback,
19733 gpointer user_data)
19734{
19735 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);
19736}
19737
19738/**
19739 * watchdog_proxy_new_finish:
19740 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_proxy_new().
19741 * @error: Return location for error or %NULL
19742 *
19743 * Finishes an operation started with watchdog_proxy_new().
19744 *
19745 * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set.
19746 */
19747Watchdog *
19748watchdog_proxy_new_finish (
19749 GAsyncResult *res,
19750 GError **error)
19751{
19752 GObject *ret;
19753 GObject *source_object;
19754 source_object = g_async_result_get_source_object (res);
19755 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
19756 g_object_unref (source_object);
19757 if (ret != NULL)
19758 return WATCHDOG (ret);
19759 else
19760 return NULL;
19761}
19762
19763/**
19764 * watchdog_proxy_new_sync:
19765 * @connection: A #GDBusConnection.
19766 * @flags: Flags from the #GDBusProxyFlags enumeration.
19767 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
19768 * @object_path: An object path.
19769 * @cancellable: (allow-none): A #GCancellable or %NULL.
19770 * @error: Return location for error or %NULL
19771 *
19772 * 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.
19773 *
19774 * The calling thread is blocked until a reply is received.
19775 *
19776 * See watchdog_proxy_new() for the asynchronous version of this constructor.
19777 *
19778 * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set.
19779 */
19780Watchdog *
19781watchdog_proxy_new_sync (
19782 GDBusConnection *connection,
19783 GDBusProxyFlags flags,
19784 const gchar *name,
19785 const gchar *object_path,
19786 GCancellable *cancellable,
19787 GError **error)
19788{
19789 GInitable *ret;
19790 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);
19791 if (ret != NULL)
19792 return WATCHDOG (ret);
19793 else
19794 return NULL;
19795}
19796
19797
19798/**
19799 * watchdog_proxy_new_for_bus:
19800 * @bus_type: A #GBusType.
19801 * @flags: Flags from the #GDBusProxyFlags enumeration.
19802 * @name: A bus name (well-known or unique).
19803 * @object_path: An object path.
19804 * @cancellable: (allow-none): A #GCancellable or %NULL.
19805 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
19806 * @user_data: User data to pass to @callback.
19807 *
19808 * Like watchdog_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
19809 *
19810 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
19811 * You can then call watchdog_proxy_new_for_bus_finish() to get the result of the operation.
19812 *
19813 * See watchdog_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
19814 */
19815void
19816watchdog_proxy_new_for_bus (
19817 GBusType bus_type,
19818 GDBusProxyFlags flags,
19819 const gchar *name,
19820 const gchar *object_path,
19821 GCancellable *cancellable,
19822 GAsyncReadyCallback callback,
19823 gpointer user_data)
19824{
19825 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);
19826}
19827
19828/**
19829 * watchdog_proxy_new_for_bus_finish:
19830 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_proxy_new_for_bus().
19831 * @error: Return location for error or %NULL
19832 *
19833 * Finishes an operation started with watchdog_proxy_new_for_bus().
19834 *
19835 * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set.
19836 */
19837Watchdog *
19838watchdog_proxy_new_for_bus_finish (
19839 GAsyncResult *res,
19840 GError **error)
19841{
19842 GObject *ret;
19843 GObject *source_object;
19844 source_object = g_async_result_get_source_object (res);
19845 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
19846 g_object_unref (source_object);
19847 if (ret != NULL)
19848 return WATCHDOG (ret);
19849 else
19850 return NULL;
19851}
19852
19853/**
19854 * watchdog_proxy_new_for_bus_sync:
19855 * @bus_type: A #GBusType.
19856 * @flags: Flags from the #GDBusProxyFlags enumeration.
19857 * @name: A bus name (well-known or unique).
19858 * @object_path: An object path.
19859 * @cancellable: (allow-none): A #GCancellable or %NULL.
19860 * @error: Return location for error or %NULL
19861 *
19862 * Like watchdog_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
19863 *
19864 * The calling thread is blocked until a reply is received.
19865 *
19866 * See watchdog_proxy_new_for_bus() for the asynchronous version of this constructor.
19867 *
19868 * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set.
19869 */
19870Watchdog *
19871watchdog_proxy_new_for_bus_sync (
19872 GBusType bus_type,
19873 GDBusProxyFlags flags,
19874 const gchar *name,
19875 const gchar *object_path,
19876 GCancellable *cancellable,
19877 GError **error)
19878{
19879 GInitable *ret;
19880 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);
19881 if (ret != NULL)
19882 return WATCHDOG (ret);
19883 else
19884 return NULL;
19885}
19886
19887
19888/* ------------------------------------------------------------------------ */
19889
19890/**
19891 * WatchdogSkeleton:
19892 *
19893 * The #WatchdogSkeleton structure contains only private data and should only be accessed using the provided API.
19894 */
19895
19896/**
19897 * WatchdogSkeletonClass:
19898 * @parent_class: The parent class.
19899 *
19900 * Class structure for #WatchdogSkeleton.
19901 */
19902
19903struct _WatchdogSkeletonPrivate
19904{
19905 GValue *properties;
19906 GList *changed_properties;
19907 GSource *changed_properties_idle_source;
19908 GMainContext *context;
19909 GMutex lock;
19910};
19911
19912static void
19913_watchdog_skeleton_handle_method_call (
19914 GDBusConnection *connection G_GNUC_UNUSED,
19915 const gchar *sender G_GNUC_UNUSED,
19916 const gchar *object_path G_GNUC_UNUSED,
19917 const gchar *interface_name,
19918 const gchar *method_name,
19919 GVariant *parameters,
19920 GDBusMethodInvocation *invocation,
19921 gpointer user_data)
19922{
19923 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data);
19924 _ExtendedGDBusMethodInfo *info;
19925 GVariantIter iter;
19926 GVariant *child;
19927 GValue *paramv;
19928 guint num_params;
19929 guint num_extra;
19930 guint n;
19931 guint signal_id;
19932 GValue return_value = G_VALUE_INIT;
19933 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
19934 g_assert (info != NULL);
19935 num_params = g_variant_n_children (parameters);
19936 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
19937 n = 0;
19938 g_value_init (&paramv[n], TYPE_WATCHDOG);
19939 g_value_set_object (&paramv[n++], skeleton);
19940 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
19941 g_value_set_object (&paramv[n++], invocation);
19942 if (info->pass_fdlist)
19943 {
19944#ifdef G_OS_UNIX
19945 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
19946 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
19947#else
19948 g_assert_not_reached ();
19949#endif
19950 }
19951 g_variant_iter_init (&iter, parameters);
19952 while ((child = g_variant_iter_next_value (&iter)) != NULL)
19953 {
19954 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
19955 if (arg_info->use_gvariant)
19956 {
19957 g_value_init (&paramv[n], G_TYPE_VARIANT);
19958 g_value_set_variant (&paramv[n], child);
19959 n++;
19960 }
19961 else
19962 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
19963 g_variant_unref (child);
19964 }
19965 signal_id = g_signal_lookup (info->signal_name, TYPE_WATCHDOG);
19966 g_value_init (&return_value, G_TYPE_BOOLEAN);
19967 g_signal_emitv (paramv, signal_id, 0, &return_value);
19968 if (!g_value_get_boolean (&return_value))
19969 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);
19970 g_value_unset (&return_value);
19971 for (n = 0; n < num_params + num_extra; n++)
19972 g_value_unset (&paramv[n]);
19973 g_free (paramv);
19974}
19975
19976static GVariant *
19977_watchdog_skeleton_handle_get_property (
19978 GDBusConnection *connection G_GNUC_UNUSED,
19979 const gchar *sender G_GNUC_UNUSED,
19980 const gchar *object_path G_GNUC_UNUSED,
19981 const gchar *interface_name G_GNUC_UNUSED,
19982 const gchar *property_name,
19983 GError **error,
19984 gpointer user_data)
19985{
19986 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data);
19987 GValue value = G_VALUE_INIT;
19988 GParamSpec *pspec;
19989 _ExtendedGDBusPropertyInfo *info;
19990 GVariant *ret;
19991 ret = NULL;
19992 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, property_name);
19993 g_assert (info != NULL);
19994 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
19995 if (pspec == NULL)
19996 {
19997 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
19998 }
19999 else
20000 {
20001 g_value_init (&value, pspec->value_type);
20002 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
20003 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
20004 g_value_unset (&value);
20005 }
20006 return ret;
20007}
20008
20009static gboolean
20010_watchdog_skeleton_handle_set_property (
20011 GDBusConnection *connection G_GNUC_UNUSED,
20012 const gchar *sender G_GNUC_UNUSED,
20013 const gchar *object_path G_GNUC_UNUSED,
20014 const gchar *interface_name G_GNUC_UNUSED,
20015 const gchar *property_name,
20016 GVariant *variant,
20017 GError **error,
20018 gpointer user_data)
20019{
20020 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data);
20021 GValue value = G_VALUE_INIT;
20022 GParamSpec *pspec;
20023 _ExtendedGDBusPropertyInfo *info;
20024 gboolean ret;
20025 ret = FALSE;
20026 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, property_name);
20027 g_assert (info != NULL);
20028 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
20029 if (pspec == NULL)
20030 {
20031 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
20032 }
20033 else
20034 {
20035 if (info->use_gvariant)
20036 g_value_set_variant (&value, variant);
20037 else
20038 g_dbus_gvariant_to_gvalue (variant, &value);
20039 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
20040 g_value_unset (&value);
20041 ret = TRUE;
20042 }
20043 return ret;
20044}
20045
20046static const GDBusInterfaceVTable _watchdog_skeleton_vtable =
20047{
20048 _watchdog_skeleton_handle_method_call,
20049 _watchdog_skeleton_handle_get_property,
20050 _watchdog_skeleton_handle_set_property,
20051 {NULL}
20052};
20053
20054static GDBusInterfaceInfo *
20055watchdog_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
20056{
20057 return watchdog_interface_info ();
20058}
20059
20060static GDBusInterfaceVTable *
20061watchdog_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
20062{
20063 return (GDBusInterfaceVTable *) &_watchdog_skeleton_vtable;
20064}
20065
20066static GVariant *
20067watchdog_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
20068{
20069 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (_skeleton);
20070
20071 GVariantBuilder builder;
20072 guint n;
20073 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
20074 if (_watchdog_interface_info.parent_struct.properties == NULL)
20075 goto out;
20076 for (n = 0; _watchdog_interface_info.parent_struct.properties[n] != NULL; n++)
20077 {
20078 GDBusPropertyInfo *info = _watchdog_interface_info.parent_struct.properties[n];
20079 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
20080 {
20081 GVariant *value;
20082 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);
20083 if (value != NULL)
20084 {
20085 g_variant_take_ref (value);
20086 g_variant_builder_add (&builder, "{sv}", info->name, value);
20087 g_variant_unref (value);
20088 }
20089 }
20090 }
20091out:
20092 return g_variant_builder_end (&builder);
20093}
20094
20095static gboolean _watchdog_emit_changed (gpointer user_data);
20096
20097static void
20098watchdog_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
20099{
20100 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (_skeleton);
20101 gboolean emit_changed = FALSE;
20102
20103 g_mutex_lock (&skeleton->priv->lock);
20104 if (skeleton->priv->changed_properties_idle_source != NULL)
20105 {
20106 g_source_destroy (skeleton->priv->changed_properties_idle_source);
20107 skeleton->priv->changed_properties_idle_source = NULL;
20108 emit_changed = TRUE;
20109 }
20110 g_mutex_unlock (&skeleton->priv->lock);
20111
20112 if (emit_changed)
20113 _watchdog_emit_changed (skeleton);
20114}
20115
20116static void
20117_watchdog_on_signal_watchdog_error (
20118 Watchdog *object)
20119{
20120 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
20121
20122 GList *connections, *l;
20123 GVariant *signal_variant;
20124 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
20125
20126 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
20127 for (l = connections; l != NULL; l = l->next)
20128 {
20129 GDBusConnection *connection = l->data;
20130 g_dbus_connection_emit_signal (connection,
20131 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Watchdog", "WatchdogError",
20132 signal_variant, NULL);
20133 }
20134 g_variant_unref (signal_variant);
20135 g_list_free_full (connections, g_object_unref);
20136}
20137
20138static void watchdog_skeleton_iface_init (WatchdogIface *iface);
20139#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
20140G_DEFINE_TYPE_WITH_CODE (WatchdogSkeleton, watchdog_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
20141 G_ADD_PRIVATE (WatchdogSkeleton)
20142 G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_skeleton_iface_init));
20143
20144#else
20145G_DEFINE_TYPE_WITH_CODE (WatchdogSkeleton, watchdog_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
20146 G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_skeleton_iface_init));
20147
20148#endif
20149static void
20150watchdog_skeleton_finalize (GObject *object)
20151{
20152 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
20153 guint n;
20154 for (n = 0; n < 2; n++)
20155 g_value_unset (&skeleton->priv->properties[n]);
20156 g_free (skeleton->priv->properties);
20157 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
20158 if (skeleton->priv->changed_properties_idle_source != NULL)
20159 g_source_destroy (skeleton->priv->changed_properties_idle_source);
20160 g_main_context_unref (skeleton->priv->context);
20161 g_mutex_clear (&skeleton->priv->lock);
20162 G_OBJECT_CLASS (watchdog_skeleton_parent_class)->finalize (object);
20163}
20164
20165static void
20166watchdog_skeleton_get_property (GObject *object,
20167 guint prop_id,
20168 GValue *value,
20169 GParamSpec *pspec G_GNUC_UNUSED)
20170{
20171 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
20172 g_assert (prop_id != 0 && prop_id - 1 < 2);
20173 g_mutex_lock (&skeleton->priv->lock);
20174 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
20175 g_mutex_unlock (&skeleton->priv->lock);
20176}
20177
20178static gboolean
20179_watchdog_emit_changed (gpointer user_data)
20180{
20181 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data);
20182 GList *l;
20183 GVariantBuilder builder;
20184 GVariantBuilder invalidated_builder;
20185 guint num_changes;
20186
20187 g_mutex_lock (&skeleton->priv->lock);
20188 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
20189 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
20190 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
20191 {
20192 ChangedProperty *cp = l->data;
20193 GVariant *variant;
20194 const GValue *cur_value;
20195
20196 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
20197 if (!_g_value_equal (cur_value, &cp->orig_value))
20198 {
20199 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
20200 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
20201 g_variant_unref (variant);
20202 num_changes++;
20203 }
20204 }
20205 if (num_changes > 0)
20206 {
20207 GList *connections, *ll;
20208 GVariant *signal_variant;
20209 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Watchdog",
20210 &builder, &invalidated_builder));
20211 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
20212 for (ll = connections; ll != NULL; ll = ll->next)
20213 {
20214 GDBusConnection *connection = ll->data;
20215
20216 g_dbus_connection_emit_signal (connection,
20217 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
20218 "org.freedesktop.DBus.Properties",
20219 "PropertiesChanged",
20220 signal_variant,
20221 NULL);
20222 }
20223 g_variant_unref (signal_variant);
20224 g_list_free_full (connections, g_object_unref);
20225 }
20226 else
20227 {
20228 g_variant_builder_clear (&builder);
20229 g_variant_builder_clear (&invalidated_builder);
20230 }
20231 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
20232 skeleton->priv->changed_properties = NULL;
20233 skeleton->priv->changed_properties_idle_source = NULL;
20234 g_mutex_unlock (&skeleton->priv->lock);
20235 return FALSE;
20236}
20237
20238static void
20239_watchdog_schedule_emit_changed (WatchdogSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
20240{
20241 ChangedProperty *cp;
20242 GList *l;
20243 cp = NULL;
20244 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
20245 {
20246 ChangedProperty *i_cp = l->data;
20247 if (i_cp->info == info)
20248 {
20249 cp = i_cp;
20250 break;
20251 }
20252 }
20253 if (cp == NULL)
20254 {
20255 cp = g_new0 (ChangedProperty, 1);
20256 cp->prop_id = prop_id;
20257 cp->info = info;
20258 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
20259 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
20260 g_value_copy (orig_value, &cp->orig_value);
20261 }
20262}
20263
20264static void
20265watchdog_skeleton_notify (GObject *object,
20266 GParamSpec *pspec G_GNUC_UNUSED)
20267{
20268 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
20269 g_mutex_lock (&skeleton->priv->lock);
20270 if (skeleton->priv->changed_properties != NULL &&
20271 skeleton->priv->changed_properties_idle_source == NULL)
20272 {
20273 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
20274 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
20275 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _watchdog_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
20276 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
20277 g_source_unref (skeleton->priv->changed_properties_idle_source);
20278 }
20279 g_mutex_unlock (&skeleton->priv->lock);
20280}
20281
20282static void
20283watchdog_skeleton_set_property (GObject *object,
20284 guint prop_id,
20285 const GValue *value,
20286 GParamSpec *pspec)
20287{
20288 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
20289 g_assert (prop_id != 0 && prop_id - 1 < 2);
20290 g_mutex_lock (&skeleton->priv->lock);
20291 g_object_freeze_notify (object);
20292 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
20293 {
20294 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
20295 _watchdog_schedule_emit_changed (skeleton, _watchdog_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
20296 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
20297 g_object_notify_by_pspec (object, pspec);
20298 }
20299 g_mutex_unlock (&skeleton->priv->lock);
20300 g_object_thaw_notify (object);
20301}
20302
20303static void
20304watchdog_skeleton_init (WatchdogSkeleton *skeleton)
20305{
20306#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
20307 skeleton->priv = watchdog_skeleton_get_instance_private (skeleton);
20308#else
20309 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_WATCHDOG_SKELETON, WatchdogSkeletonPrivate);
20310#endif
20311
20312 g_mutex_init (&skeleton->priv->lock);
20313 skeleton->priv->context = g_main_context_ref_thread_default ();
20314 skeleton->priv->properties = g_new0 (GValue, 2);
20315 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
20316 g_value_init (&skeleton->priv->properties[1], G_TYPE_INT);
20317}
20318
20319static gint
20320watchdog_skeleton_get_watchdog (Watchdog *object)
20321{
20322 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
20323 gint value;
20324 g_mutex_lock (&skeleton->priv->lock);
20325 value = g_value_get_int (&(skeleton->priv->properties[0]));
20326 g_mutex_unlock (&skeleton->priv->lock);
20327 return value;
20328}
20329
20330static gint
20331watchdog_skeleton_get_poll_interval (Watchdog *object)
20332{
20333 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
20334 gint value;
20335 g_mutex_lock (&skeleton->priv->lock);
20336 value = g_value_get_int (&(skeleton->priv->properties[1]));
20337 g_mutex_unlock (&skeleton->priv->lock);
20338 return value;
20339}
20340
20341static void
20342watchdog_skeleton_class_init (WatchdogSkeletonClass *klass)
20343{
20344 GObjectClass *gobject_class;
20345 GDBusInterfaceSkeletonClass *skeleton_class;
20346
20347 gobject_class = G_OBJECT_CLASS (klass);
20348 gobject_class->finalize = watchdog_skeleton_finalize;
20349 gobject_class->get_property = watchdog_skeleton_get_property;
20350 gobject_class->set_property = watchdog_skeleton_set_property;
20351 gobject_class->notify = watchdog_skeleton_notify;
20352
20353
20354 watchdog_override_properties (gobject_class, 1);
20355
20356 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
20357 skeleton_class->get_info = watchdog_skeleton_dbus_interface_get_info;
20358 skeleton_class->get_properties = watchdog_skeleton_dbus_interface_get_properties;
20359 skeleton_class->flush = watchdog_skeleton_dbus_interface_flush;
20360 skeleton_class->get_vtable = watchdog_skeleton_dbus_interface_get_vtable;
20361
20362#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
20363 g_type_class_add_private (klass, sizeof (WatchdogSkeletonPrivate));
20364#endif
20365}
20366
20367static void
20368watchdog_skeleton_iface_init (WatchdogIface *iface)
20369{
20370 iface->watchdog_error = _watchdog_on_signal_watchdog_error;
20371 iface->get_watchdog = watchdog_skeleton_get_watchdog;
20372 iface->get_poll_interval = watchdog_skeleton_get_poll_interval;
20373}
20374
20375/**
20376 * watchdog_skeleton_new:
20377 *
20378 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link>.
20379 *
20380 * Returns: (transfer full) (type WatchdogSkeleton): The skeleton object.
20381 */
20382Watchdog *
20383watchdog_skeleton_new (void)
20384{
20385 return WATCHDOG (g_object_new (TYPE_WATCHDOG_SKELETON, NULL));
20386}
20387
20388/* ------------------------------------------------------------------------
20389 * Code for interface org.openbmc.EventLog
20390 * ------------------------------------------------------------------------
20391 */
20392
20393/**
20394 * SECTION:EventLog
20395 * @title: EventLog
20396 * @short_description: Generated C code for the org.openbmc.EventLog D-Bus interface
20397 *
20398 * 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.
20399 */
20400
20401/* ---- Introspection data for org.openbmc.EventLog ---- */
20402
Norman James2d1ee892015-09-16 23:13:45 -050020403static const _ExtendedGDBusArgInfo _event_log_method_info_get_event_log_OUT_ARG_log =
20404{
20405 {
20406 -1,
20407 (gchar *) "log",
20408 (gchar *) "a(s)",
20409 NULL
20410 },
20411 FALSE
20412};
20413
20414static const _ExtendedGDBusArgInfo * const _event_log_method_info_get_event_log_OUT_ARG_pointers[] =
20415{
20416 &_event_log_method_info_get_event_log_OUT_ARG_log,
20417 NULL
20418};
20419
20420static const _ExtendedGDBusMethodInfo _event_log_method_info_get_event_log =
20421{
20422 {
20423 -1,
20424 (gchar *) "getEventLog",
20425 NULL,
20426 (GDBusArgInfo **) &_event_log_method_info_get_event_log_OUT_ARG_pointers,
20427 NULL
20428 },
20429 "handle-get-event-log",
20430 FALSE
20431};
20432
20433static const _ExtendedGDBusMethodInfo * const _event_log_method_info_pointers[] =
20434{
20435 &_event_log_method_info_get_event_log,
20436 NULL
20437};
20438
Norman James8abb50c2015-09-16 10:58:16 -050020439static const _ExtendedGDBusArgInfo _event_log_signal_info_event_log_ARG_priority =
Norman James362a80f2015-09-14 14:04:39 -050020440{
20441 {
20442 -1,
Norman James8abb50c2015-09-16 10:58:16 -050020443 (gchar *) "priority",
20444 (gchar *) "i",
Norman James362a80f2015-09-14 14:04:39 -050020445 NULL
20446 },
20447 FALSE
20448};
20449
Norman James362a80f2015-09-14 14:04:39 -050020450static const _ExtendedGDBusArgInfo _event_log_signal_info_event_log_ARG_message =
20451{
20452 {
20453 -1,
20454 (gchar *) "message",
Norman James32e74e22015-09-15 21:28:06 -050020455 (gchar *) "s",
Norman James362a80f2015-09-14 14:04:39 -050020456 NULL
20457 },
20458 FALSE
20459};
20460
Norman James88872672015-09-21 16:51:35 -050020461static const _ExtendedGDBusArgInfo _event_log_signal_info_event_log_ARG_rc =
20462{
20463 {
20464 -1,
20465 (gchar *) "rc",
20466 (gchar *) "i",
20467 NULL
20468 },
20469 FALSE
20470};
20471
Norman James362a80f2015-09-14 14:04:39 -050020472static const _ExtendedGDBusArgInfo * const _event_log_signal_info_event_log_ARG_pointers[] =
20473{
Norman James8abb50c2015-09-16 10:58:16 -050020474 &_event_log_signal_info_event_log_ARG_priority,
Norman James362a80f2015-09-14 14:04:39 -050020475 &_event_log_signal_info_event_log_ARG_message,
Norman James88872672015-09-21 16:51:35 -050020476 &_event_log_signal_info_event_log_ARG_rc,
Norman James362a80f2015-09-14 14:04:39 -050020477 NULL
20478};
20479
20480static const _ExtendedGDBusSignalInfo _event_log_signal_info_event_log =
20481{
20482 {
20483 -1,
20484 (gchar *) "EventLog",
20485 (GDBusArgInfo **) &_event_log_signal_info_event_log_ARG_pointers,
20486 NULL
20487 },
20488 "event-log"
20489};
20490
20491static const _ExtendedGDBusSignalInfo * const _event_log_signal_info_pointers[] =
20492{
20493 &_event_log_signal_info_event_log,
20494 NULL
20495};
20496
Norman James362a80f2015-09-14 14:04:39 -050020497static const _ExtendedGDBusInterfaceInfo _event_log_interface_info =
20498{
20499 {
20500 -1,
20501 (gchar *) "org.openbmc.EventLog",
Norman James2d1ee892015-09-16 23:13:45 -050020502 (GDBusMethodInfo **) &_event_log_method_info_pointers,
Norman James362a80f2015-09-14 14:04:39 -050020503 (GDBusSignalInfo **) &_event_log_signal_info_pointers,
Norman James32e74e22015-09-15 21:28:06 -050020504 NULL,
Norman James362a80f2015-09-14 14:04:39 -050020505 NULL
20506 },
20507 "event-log",
20508};
20509
20510
20511/**
20512 * event_log_interface_info:
20513 *
20514 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link> D-Bus interface.
20515 *
20516 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
20517 */
20518GDBusInterfaceInfo *
20519event_log_interface_info (void)
20520{
20521 return (GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct;
20522}
20523
20524/**
20525 * event_log_override_properties:
20526 * @klass: The class structure for a #GObject<!-- -->-derived class.
20527 * @property_id_begin: The property id to assign to the first overridden property.
20528 *
20529 * Overrides all #GObject properties in the #EventLog interface for a concrete class.
20530 * The properties are overridden in the order they are defined.
20531 *
20532 * Returns: The last property id.
20533 */
20534guint
20535event_log_override_properties (GObjectClass *klass, guint property_id_begin)
20536{
Norman James362a80f2015-09-14 14:04:39 -050020537 return property_id_begin - 1;
20538}
20539
20540
20541
20542/**
20543 * EventLog:
20544 *
20545 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>.
20546 */
20547
20548/**
20549 * EventLogIface:
20550 * @parent_iface: The parent interface.
Norman James2d1ee892015-09-16 23:13:45 -050020551 * @handle_get_event_log: Handler for the #EventLog::handle-get-event-log signal.
Norman James362a80f2015-09-14 14:04:39 -050020552 * @event_log: Handler for the #EventLog::event-log signal.
20553 *
20554 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>.
20555 */
20556
20557typedef EventLogIface EventLogInterface;
20558G_DEFINE_INTERFACE (EventLog, event_log, G_TYPE_OBJECT);
20559
20560static void
20561event_log_default_init (EventLogIface *iface)
20562{
Norman James2d1ee892015-09-16 23:13:45 -050020563 /* GObject signals for incoming D-Bus method calls: */
20564 /**
20565 * EventLog::handle-get-event-log:
20566 * @object: A #EventLog.
20567 * @invocation: A #GDBusMethodInvocation.
20568 *
20569 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-EventLog.getEventLog">getEventLog()</link> D-Bus method.
20570 *
20571 * 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.
20572 *
20573 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
20574 */
20575 g_signal_new ("handle-get-event-log",
20576 G_TYPE_FROM_INTERFACE (iface),
20577 G_SIGNAL_RUN_LAST,
20578 G_STRUCT_OFFSET (EventLogIface, handle_get_event_log),
20579 g_signal_accumulator_true_handled,
20580 NULL,
20581 g_cclosure_marshal_generic,
20582 G_TYPE_BOOLEAN,
20583 1,
20584 G_TYPE_DBUS_METHOD_INVOCATION);
20585
Norman James362a80f2015-09-14 14:04:39 -050020586 /* GObject signals for received D-Bus signals: */
20587 /**
20588 * EventLog::event-log:
20589 * @object: A #EventLog.
Norman James8abb50c2015-09-16 10:58:16 -050020590 * @arg_priority: Argument.
Norman James362a80f2015-09-14 14:04:39 -050020591 * @arg_message: Argument.
Norman James88872672015-09-21 16:51:35 -050020592 * @arg_rc: Argument.
Norman James362a80f2015-09-14 14:04:39 -050020593 *
20594 * 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.
20595 *
20596 * 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.
20597 */
20598 g_signal_new ("event-log",
20599 G_TYPE_FROM_INTERFACE (iface),
20600 G_SIGNAL_RUN_LAST,
20601 G_STRUCT_OFFSET (EventLogIface, event_log),
20602 NULL,
20603 NULL,
20604 g_cclosure_marshal_generic,
20605 G_TYPE_NONE,
Norman James88872672015-09-21 16:51:35 -050020606 3, G_TYPE_INT, G_TYPE_STRING, G_TYPE_INT);
Norman James362a80f2015-09-14 14:04:39 -050020607
Norman James362a80f2015-09-14 14:04:39 -050020608}
20609
20610/**
20611 * event_log_emit_event_log:
20612 * @object: A #EventLog.
Norman James8abb50c2015-09-16 10:58:16 -050020613 * @arg_priority: Argument to pass with the signal.
Norman James362a80f2015-09-14 14:04:39 -050020614 * @arg_message: Argument to pass with the signal.
Norman James88872672015-09-21 16:51:35 -050020615 * @arg_rc: Argument to pass with the signal.
Norman James362a80f2015-09-14 14:04:39 -050020616 *
20617 * Emits the <link linkend="gdbus-signal-org-openbmc-EventLog.EventLog">"EventLog"</link> D-Bus signal.
20618 */
20619void
20620event_log_emit_event_log (
20621 EventLog *object,
Norman James8abb50c2015-09-16 10:58:16 -050020622 gint arg_priority,
Norman James88872672015-09-21 16:51:35 -050020623 const gchar *arg_message,
20624 gint arg_rc)
Norman James362a80f2015-09-14 14:04:39 -050020625{
Norman James88872672015-09-21 16:51:35 -050020626 g_signal_emit_by_name (object, "event-log", arg_priority, arg_message, arg_rc);
Norman James362a80f2015-09-14 14:04:39 -050020627}
20628
Norman James2d1ee892015-09-16 23:13:45 -050020629/**
20630 * event_log_call_get_event_log:
20631 * @proxy: A #EventLogProxy.
20632 * @cancellable: (allow-none): A #GCancellable or %NULL.
20633 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
20634 * @user_data: User data to pass to @callback.
20635 *
20636 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-EventLog.getEventLog">getEventLog()</link> D-Bus method on @proxy.
20637 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
20638 * You can then call event_log_call_get_event_log_finish() to get the result of the operation.
20639 *
20640 * See event_log_call_get_event_log_sync() for the synchronous, blocking version of this method.
20641 */
20642void
20643event_log_call_get_event_log (
20644 EventLog *proxy,
20645 GCancellable *cancellable,
20646 GAsyncReadyCallback callback,
20647 gpointer user_data)
20648{
20649 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
20650 "getEventLog",
20651 g_variant_new ("()"),
20652 G_DBUS_CALL_FLAGS_NONE,
20653 -1,
20654 cancellable,
20655 callback,
20656 user_data);
20657}
20658
20659/**
20660 * event_log_call_get_event_log_finish:
20661 * @proxy: A #EventLogProxy.
20662 * @out_log: (out): Return location for return parameter or %NULL to ignore.
20663 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to event_log_call_get_event_log().
20664 * @error: Return location for error or %NULL.
20665 *
20666 * Finishes an operation started with event_log_call_get_event_log().
20667 *
20668 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
20669 */
20670gboolean
20671event_log_call_get_event_log_finish (
20672 EventLog *proxy,
20673 GVariant **out_log,
20674 GAsyncResult *res,
20675 GError **error)
20676{
20677 GVariant *_ret;
20678 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
20679 if (_ret == NULL)
20680 goto _out;
20681 g_variant_get (_ret,
20682 "(@a(s))",
20683 out_log);
20684 g_variant_unref (_ret);
20685_out:
20686 return _ret != NULL;
20687}
20688
20689/**
20690 * event_log_call_get_event_log_sync:
20691 * @proxy: A #EventLogProxy.
20692 * @out_log: (out): Return location for return parameter or %NULL to ignore.
20693 * @cancellable: (allow-none): A #GCancellable or %NULL.
20694 * @error: Return location for error or %NULL.
20695 *
20696 * 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.
20697 *
20698 * See event_log_call_get_event_log() for the asynchronous version of this method.
20699 *
20700 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
20701 */
20702gboolean
20703event_log_call_get_event_log_sync (
20704 EventLog *proxy,
20705 GVariant **out_log,
20706 GCancellable *cancellable,
20707 GError **error)
20708{
20709 GVariant *_ret;
20710 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
20711 "getEventLog",
20712 g_variant_new ("()"),
20713 G_DBUS_CALL_FLAGS_NONE,
20714 -1,
20715 cancellable,
20716 error);
20717 if (_ret == NULL)
20718 goto _out;
20719 g_variant_get (_ret,
20720 "(@a(s))",
20721 out_log);
20722 g_variant_unref (_ret);
20723_out:
20724 return _ret != NULL;
20725}
20726
20727/**
20728 * event_log_complete_get_event_log:
20729 * @object: A #EventLog.
20730 * @invocation: (transfer full): A #GDBusMethodInvocation.
20731 * @log: Parameter to return.
20732 *
20733 * 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.
20734 *
20735 * This method will free @invocation, you cannot use it afterwards.
20736 */
20737void
20738event_log_complete_get_event_log (
20739 EventLog *object,
20740 GDBusMethodInvocation *invocation,
20741 GVariant *log)
20742{
20743 g_dbus_method_invocation_return_value (invocation,
20744 g_variant_new ("(@a(s))",
20745 log));
20746}
20747
Norman James362a80f2015-09-14 14:04:39 -050020748/* ------------------------------------------------------------------------ */
20749
20750/**
20751 * EventLogProxy:
20752 *
20753 * The #EventLogProxy structure contains only private data and should only be accessed using the provided API.
20754 */
20755
20756/**
20757 * EventLogProxyClass:
20758 * @parent_class: The parent class.
20759 *
20760 * Class structure for #EventLogProxy.
20761 */
20762
20763struct _EventLogProxyPrivate
20764{
20765 GData *qdata;
20766};
20767
20768static void event_log_proxy_iface_init (EventLogIface *iface);
20769
20770#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
20771G_DEFINE_TYPE_WITH_CODE (EventLogProxy, event_log_proxy, G_TYPE_DBUS_PROXY,
20772 G_ADD_PRIVATE (EventLogProxy)
20773 G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_proxy_iface_init));
20774
20775#else
20776G_DEFINE_TYPE_WITH_CODE (EventLogProxy, event_log_proxy, G_TYPE_DBUS_PROXY,
20777 G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_proxy_iface_init));
20778
20779#endif
20780static void
20781event_log_proxy_finalize (GObject *object)
20782{
20783 EventLogProxy *proxy = EVENT_LOG_PROXY (object);
20784 g_datalist_clear (&proxy->priv->qdata);
20785 G_OBJECT_CLASS (event_log_proxy_parent_class)->finalize (object);
20786}
20787
20788static void
20789event_log_proxy_get_property (GObject *object,
20790 guint prop_id,
20791 GValue *value,
20792 GParamSpec *pspec G_GNUC_UNUSED)
20793{
Norman James362a80f2015-09-14 14:04:39 -050020794}
20795
20796static void
20797event_log_proxy_set_property (GObject *object,
20798 guint prop_id,
20799 const GValue *value,
20800 GParamSpec *pspec G_GNUC_UNUSED)
20801{
Norman James362a80f2015-09-14 14:04:39 -050020802}
20803
20804static void
20805event_log_proxy_g_signal (GDBusProxy *proxy,
20806 const gchar *sender_name G_GNUC_UNUSED,
20807 const gchar *signal_name,
20808 GVariant *parameters)
20809{
20810 _ExtendedGDBusSignalInfo *info;
20811 GVariantIter iter;
20812 GVariant *child;
20813 GValue *paramv;
20814 guint num_params;
20815 guint n;
20816 guint signal_id;
20817 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, signal_name);
20818 if (info == NULL)
20819 return;
20820 num_params = g_variant_n_children (parameters);
20821 paramv = g_new0 (GValue, num_params + 1);
20822 g_value_init (&paramv[0], TYPE_EVENT_LOG);
20823 g_value_set_object (&paramv[0], proxy);
20824 g_variant_iter_init (&iter, parameters);
20825 n = 1;
20826 while ((child = g_variant_iter_next_value (&iter)) != NULL)
20827 {
20828 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
20829 if (arg_info->use_gvariant)
20830 {
20831 g_value_init (&paramv[n], G_TYPE_VARIANT);
20832 g_value_set_variant (&paramv[n], child);
20833 n++;
20834 }
20835 else
20836 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
20837 g_variant_unref (child);
20838 }
20839 signal_id = g_signal_lookup (info->signal_name, TYPE_EVENT_LOG);
20840 g_signal_emitv (paramv, signal_id, 0, NULL);
20841 for (n = 0; n < num_params + 1; n++)
20842 g_value_unset (&paramv[n]);
20843 g_free (paramv);
20844}
20845
20846static void
20847event_log_proxy_g_properties_changed (GDBusProxy *_proxy,
20848 GVariant *changed_properties,
20849 const gchar *const *invalidated_properties)
20850{
20851 EventLogProxy *proxy = EVENT_LOG_PROXY (_proxy);
20852 guint n;
20853 const gchar *key;
20854 GVariantIter *iter;
20855 _ExtendedGDBusPropertyInfo *info;
20856 g_variant_get (changed_properties, "a{sv}", &iter);
20857 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
20858 {
20859 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, key);
20860 g_datalist_remove_data (&proxy->priv->qdata, key);
20861 if (info != NULL)
20862 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
20863 }
20864 g_variant_iter_free (iter);
20865 for (n = 0; invalidated_properties[n] != NULL; n++)
20866 {
20867 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, invalidated_properties[n]);
20868 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
20869 if (info != NULL)
20870 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
20871 }
20872}
20873
Norman James362a80f2015-09-14 14:04:39 -050020874static void
20875event_log_proxy_init (EventLogProxy *proxy)
20876{
20877#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
20878 proxy->priv = event_log_proxy_get_instance_private (proxy);
20879#else
20880 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_EVENT_LOG_PROXY, EventLogProxyPrivate);
20881#endif
20882
20883 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), event_log_interface_info ());
20884}
20885
20886static void
20887event_log_proxy_class_init (EventLogProxyClass *klass)
20888{
20889 GObjectClass *gobject_class;
20890 GDBusProxyClass *proxy_class;
20891
20892 gobject_class = G_OBJECT_CLASS (klass);
20893 gobject_class->finalize = event_log_proxy_finalize;
20894 gobject_class->get_property = event_log_proxy_get_property;
20895 gobject_class->set_property = event_log_proxy_set_property;
20896
20897 proxy_class = G_DBUS_PROXY_CLASS (klass);
20898 proxy_class->g_signal = event_log_proxy_g_signal;
20899 proxy_class->g_properties_changed = event_log_proxy_g_properties_changed;
20900
Norman James362a80f2015-09-14 14:04:39 -050020901#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
20902 g_type_class_add_private (klass, sizeof (EventLogProxyPrivate));
20903#endif
20904}
20905
20906static void
20907event_log_proxy_iface_init (EventLogIface *iface)
20908{
Norman James362a80f2015-09-14 14:04:39 -050020909}
20910
20911/**
20912 * event_log_proxy_new:
20913 * @connection: A #GDBusConnection.
20914 * @flags: Flags from the #GDBusProxyFlags enumeration.
20915 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
20916 * @object_path: An object path.
20917 * @cancellable: (allow-none): A #GCancellable or %NULL.
20918 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
20919 * @user_data: User data to pass to @callback.
20920 *
20921 * 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.
20922 *
20923 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
20924 * You can then call event_log_proxy_new_finish() to get the result of the operation.
20925 *
20926 * See event_log_proxy_new_sync() for the synchronous, blocking version of this constructor.
20927 */
20928void
20929event_log_proxy_new (
20930 GDBusConnection *connection,
20931 GDBusProxyFlags flags,
20932 const gchar *name,
20933 const gchar *object_path,
20934 GCancellable *cancellable,
20935 GAsyncReadyCallback callback,
20936 gpointer user_data)
20937{
20938 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);
20939}
20940
20941/**
20942 * event_log_proxy_new_finish:
20943 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to event_log_proxy_new().
20944 * @error: Return location for error or %NULL
20945 *
20946 * Finishes an operation started with event_log_proxy_new().
20947 *
20948 * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set.
20949 */
20950EventLog *
20951event_log_proxy_new_finish (
20952 GAsyncResult *res,
20953 GError **error)
20954{
20955 GObject *ret;
20956 GObject *source_object;
20957 source_object = g_async_result_get_source_object (res);
20958 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
20959 g_object_unref (source_object);
20960 if (ret != NULL)
20961 return EVENT_LOG (ret);
20962 else
20963 return NULL;
20964}
20965
20966/**
20967 * event_log_proxy_new_sync:
20968 * @connection: A #GDBusConnection.
20969 * @flags: Flags from the #GDBusProxyFlags enumeration.
20970 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
20971 * @object_path: An object path.
20972 * @cancellable: (allow-none): A #GCancellable or %NULL.
20973 * @error: Return location for error or %NULL
20974 *
20975 * 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.
20976 *
20977 * The calling thread is blocked until a reply is received.
20978 *
20979 * See event_log_proxy_new() for the asynchronous version of this constructor.
20980 *
20981 * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set.
20982 */
20983EventLog *
20984event_log_proxy_new_sync (
20985 GDBusConnection *connection,
20986 GDBusProxyFlags flags,
20987 const gchar *name,
20988 const gchar *object_path,
20989 GCancellable *cancellable,
20990 GError **error)
20991{
20992 GInitable *ret;
20993 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);
20994 if (ret != NULL)
20995 return EVENT_LOG (ret);
20996 else
20997 return NULL;
20998}
20999
21000
21001/**
21002 * event_log_proxy_new_for_bus:
21003 * @bus_type: A #GBusType.
21004 * @flags: Flags from the #GDBusProxyFlags enumeration.
21005 * @name: A bus name (well-known or unique).
21006 * @object_path: An object path.
21007 * @cancellable: (allow-none): A #GCancellable or %NULL.
21008 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
21009 * @user_data: User data to pass to @callback.
21010 *
21011 * Like event_log_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
21012 *
21013 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
21014 * You can then call event_log_proxy_new_for_bus_finish() to get the result of the operation.
21015 *
21016 * See event_log_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
21017 */
21018void
21019event_log_proxy_new_for_bus (
21020 GBusType bus_type,
21021 GDBusProxyFlags flags,
21022 const gchar *name,
21023 const gchar *object_path,
21024 GCancellable *cancellable,
21025 GAsyncReadyCallback callback,
21026 gpointer user_data)
21027{
21028 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);
21029}
21030
21031/**
21032 * event_log_proxy_new_for_bus_finish:
21033 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to event_log_proxy_new_for_bus().
21034 * @error: Return location for error or %NULL
21035 *
21036 * Finishes an operation started with event_log_proxy_new_for_bus().
21037 *
21038 * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set.
21039 */
21040EventLog *
21041event_log_proxy_new_for_bus_finish (
21042 GAsyncResult *res,
21043 GError **error)
21044{
21045 GObject *ret;
21046 GObject *source_object;
21047 source_object = g_async_result_get_source_object (res);
21048 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
21049 g_object_unref (source_object);
21050 if (ret != NULL)
21051 return EVENT_LOG (ret);
21052 else
21053 return NULL;
21054}
21055
21056/**
21057 * event_log_proxy_new_for_bus_sync:
21058 * @bus_type: A #GBusType.
21059 * @flags: Flags from the #GDBusProxyFlags enumeration.
21060 * @name: A bus name (well-known or unique).
21061 * @object_path: An object path.
21062 * @cancellable: (allow-none): A #GCancellable or %NULL.
21063 * @error: Return location for error or %NULL
21064 *
21065 * Like event_log_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
21066 *
21067 * The calling thread is blocked until a reply is received.
21068 *
21069 * See event_log_proxy_new_for_bus() for the asynchronous version of this constructor.
21070 *
21071 * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set.
21072 */
21073EventLog *
21074event_log_proxy_new_for_bus_sync (
21075 GBusType bus_type,
21076 GDBusProxyFlags flags,
21077 const gchar *name,
21078 const gchar *object_path,
21079 GCancellable *cancellable,
21080 GError **error)
21081{
21082 GInitable *ret;
21083 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);
21084 if (ret != NULL)
21085 return EVENT_LOG (ret);
21086 else
21087 return NULL;
21088}
21089
21090
21091/* ------------------------------------------------------------------------ */
21092
21093/**
21094 * EventLogSkeleton:
21095 *
21096 * The #EventLogSkeleton structure contains only private data and should only be accessed using the provided API.
21097 */
21098
21099/**
21100 * EventLogSkeletonClass:
21101 * @parent_class: The parent class.
21102 *
21103 * Class structure for #EventLogSkeleton.
21104 */
21105
21106struct _EventLogSkeletonPrivate
21107{
21108 GValue *properties;
21109 GList *changed_properties;
21110 GSource *changed_properties_idle_source;
21111 GMainContext *context;
21112 GMutex lock;
21113};
21114
21115static void
21116_event_log_skeleton_handle_method_call (
21117 GDBusConnection *connection G_GNUC_UNUSED,
21118 const gchar *sender G_GNUC_UNUSED,
21119 const gchar *object_path G_GNUC_UNUSED,
21120 const gchar *interface_name,
21121 const gchar *method_name,
21122 GVariant *parameters,
21123 GDBusMethodInvocation *invocation,
21124 gpointer user_data)
21125{
21126 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (user_data);
21127 _ExtendedGDBusMethodInfo *info;
21128 GVariantIter iter;
21129 GVariant *child;
21130 GValue *paramv;
21131 guint num_params;
21132 guint num_extra;
21133 guint n;
21134 guint signal_id;
21135 GValue return_value = G_VALUE_INIT;
21136 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
21137 g_assert (info != NULL);
21138 num_params = g_variant_n_children (parameters);
21139 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
21140 n = 0;
21141 g_value_init (&paramv[n], TYPE_EVENT_LOG);
21142 g_value_set_object (&paramv[n++], skeleton);
21143 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
21144 g_value_set_object (&paramv[n++], invocation);
21145 if (info->pass_fdlist)
21146 {
21147#ifdef G_OS_UNIX
21148 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
21149 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
21150#else
21151 g_assert_not_reached ();
21152#endif
21153 }
21154 g_variant_iter_init (&iter, parameters);
21155 while ((child = g_variant_iter_next_value (&iter)) != NULL)
21156 {
21157 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
21158 if (arg_info->use_gvariant)
21159 {
21160 g_value_init (&paramv[n], G_TYPE_VARIANT);
21161 g_value_set_variant (&paramv[n], child);
21162 n++;
21163 }
21164 else
21165 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
21166 g_variant_unref (child);
21167 }
21168 signal_id = g_signal_lookup (info->signal_name, TYPE_EVENT_LOG);
21169 g_value_init (&return_value, G_TYPE_BOOLEAN);
21170 g_signal_emitv (paramv, signal_id, 0, &return_value);
21171 if (!g_value_get_boolean (&return_value))
21172 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);
21173 g_value_unset (&return_value);
21174 for (n = 0; n < num_params + num_extra; n++)
21175 g_value_unset (&paramv[n]);
21176 g_free (paramv);
21177}
21178
21179static GVariant *
21180_event_log_skeleton_handle_get_property (
21181 GDBusConnection *connection G_GNUC_UNUSED,
21182 const gchar *sender G_GNUC_UNUSED,
21183 const gchar *object_path G_GNUC_UNUSED,
21184 const gchar *interface_name G_GNUC_UNUSED,
21185 const gchar *property_name,
21186 GError **error,
21187 gpointer user_data)
21188{
21189 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (user_data);
21190 GValue value = G_VALUE_INIT;
21191 GParamSpec *pspec;
21192 _ExtendedGDBusPropertyInfo *info;
21193 GVariant *ret;
21194 ret = NULL;
21195 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, property_name);
21196 g_assert (info != NULL);
21197 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
21198 if (pspec == NULL)
21199 {
21200 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
21201 }
21202 else
21203 {
21204 g_value_init (&value, pspec->value_type);
21205 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
21206 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
21207 g_value_unset (&value);
21208 }
21209 return ret;
21210}
21211
21212static gboolean
21213_event_log_skeleton_handle_set_property (
21214 GDBusConnection *connection G_GNUC_UNUSED,
21215 const gchar *sender G_GNUC_UNUSED,
21216 const gchar *object_path G_GNUC_UNUSED,
21217 const gchar *interface_name G_GNUC_UNUSED,
21218 const gchar *property_name,
21219 GVariant *variant,
21220 GError **error,
21221 gpointer user_data)
21222{
21223 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (user_data);
21224 GValue value = G_VALUE_INIT;
21225 GParamSpec *pspec;
21226 _ExtendedGDBusPropertyInfo *info;
21227 gboolean ret;
21228 ret = FALSE;
21229 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, property_name);
21230 g_assert (info != NULL);
21231 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
21232 if (pspec == NULL)
21233 {
21234 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
21235 }
21236 else
21237 {
21238 if (info->use_gvariant)
21239 g_value_set_variant (&value, variant);
21240 else
21241 g_dbus_gvariant_to_gvalue (variant, &value);
21242 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
21243 g_value_unset (&value);
21244 ret = TRUE;
21245 }
21246 return ret;
21247}
21248
21249static const GDBusInterfaceVTable _event_log_skeleton_vtable =
21250{
21251 _event_log_skeleton_handle_method_call,
21252 _event_log_skeleton_handle_get_property,
21253 _event_log_skeleton_handle_set_property,
21254 {NULL}
21255};
21256
21257static GDBusInterfaceInfo *
21258event_log_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
21259{
21260 return event_log_interface_info ();
21261}
21262
21263static GDBusInterfaceVTable *
21264event_log_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
21265{
21266 return (GDBusInterfaceVTable *) &_event_log_skeleton_vtable;
21267}
21268
21269static GVariant *
21270event_log_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
21271{
21272 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (_skeleton);
21273
21274 GVariantBuilder builder;
21275 guint n;
21276 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
21277 if (_event_log_interface_info.parent_struct.properties == NULL)
21278 goto out;
21279 for (n = 0; _event_log_interface_info.parent_struct.properties[n] != NULL; n++)
21280 {
21281 GDBusPropertyInfo *info = _event_log_interface_info.parent_struct.properties[n];
21282 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
21283 {
21284 GVariant *value;
21285 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);
21286 if (value != NULL)
21287 {
21288 g_variant_take_ref (value);
21289 g_variant_builder_add (&builder, "{sv}", info->name, value);
21290 g_variant_unref (value);
21291 }
21292 }
21293 }
21294out:
21295 return g_variant_builder_end (&builder);
21296}
21297
Norman James362a80f2015-09-14 14:04:39 -050021298static void
21299event_log_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
21300{
Norman James362a80f2015-09-14 14:04:39 -050021301}
21302
21303static void
21304_event_log_on_signal_event_log (
21305 EventLog *object,
Norman James8abb50c2015-09-16 10:58:16 -050021306 gint arg_priority,
Norman James88872672015-09-21 16:51:35 -050021307 const gchar *arg_message,
21308 gint arg_rc)
Norman James362a80f2015-09-14 14:04:39 -050021309{
21310 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (object);
21311
21312 GList *connections, *l;
21313 GVariant *signal_variant;
21314 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
21315
Norman James88872672015-09-21 16:51:35 -050021316 signal_variant = g_variant_ref_sink (g_variant_new ("(isi)",
Norman James8abb50c2015-09-16 10:58:16 -050021317 arg_priority,
Norman James88872672015-09-21 16:51:35 -050021318 arg_message,
21319 arg_rc));
Norman James362a80f2015-09-14 14:04:39 -050021320 for (l = connections; l != NULL; l = l->next)
21321 {
21322 GDBusConnection *connection = l->data;
21323 g_dbus_connection_emit_signal (connection,
21324 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.EventLog", "EventLog",
21325 signal_variant, NULL);
21326 }
21327 g_variant_unref (signal_variant);
21328 g_list_free_full (connections, g_object_unref);
21329}
21330
21331static void event_log_skeleton_iface_init (EventLogIface *iface);
21332#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
21333G_DEFINE_TYPE_WITH_CODE (EventLogSkeleton, event_log_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
21334 G_ADD_PRIVATE (EventLogSkeleton)
21335 G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_skeleton_iface_init));
21336
21337#else
21338G_DEFINE_TYPE_WITH_CODE (EventLogSkeleton, event_log_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
21339 G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_skeleton_iface_init));
21340
21341#endif
21342static void
21343event_log_skeleton_finalize (GObject *object)
21344{
21345 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (object);
Norman James362a80f2015-09-14 14:04:39 -050021346 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
21347 if (skeleton->priv->changed_properties_idle_source != NULL)
21348 g_source_destroy (skeleton->priv->changed_properties_idle_source);
21349 g_main_context_unref (skeleton->priv->context);
21350 g_mutex_clear (&skeleton->priv->lock);
21351 G_OBJECT_CLASS (event_log_skeleton_parent_class)->finalize (object);
21352}
21353
21354static void
Norman James362a80f2015-09-14 14:04:39 -050021355event_log_skeleton_init (EventLogSkeleton *skeleton)
21356{
21357#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
21358 skeleton->priv = event_log_skeleton_get_instance_private (skeleton);
21359#else
21360 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_EVENT_LOG_SKELETON, EventLogSkeletonPrivate);
21361#endif
21362
21363 g_mutex_init (&skeleton->priv->lock);
21364 skeleton->priv->context = g_main_context_ref_thread_default ();
Norman James362a80f2015-09-14 14:04:39 -050021365}
21366
21367static void
21368event_log_skeleton_class_init (EventLogSkeletonClass *klass)
21369{
21370 GObjectClass *gobject_class;
21371 GDBusInterfaceSkeletonClass *skeleton_class;
21372
21373 gobject_class = G_OBJECT_CLASS (klass);
21374 gobject_class->finalize = event_log_skeleton_finalize;
Norman James362a80f2015-09-14 14:04:39 -050021375
21376 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
21377 skeleton_class->get_info = event_log_skeleton_dbus_interface_get_info;
21378 skeleton_class->get_properties = event_log_skeleton_dbus_interface_get_properties;
21379 skeleton_class->flush = event_log_skeleton_dbus_interface_flush;
21380 skeleton_class->get_vtable = event_log_skeleton_dbus_interface_get_vtable;
21381
21382#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
21383 g_type_class_add_private (klass, sizeof (EventLogSkeletonPrivate));
21384#endif
21385}
21386
21387static void
21388event_log_skeleton_iface_init (EventLogIface *iface)
21389{
21390 iface->event_log = _event_log_on_signal_event_log;
Norman James362a80f2015-09-14 14:04:39 -050021391}
21392
21393/**
21394 * event_log_skeleton_new:
21395 *
21396 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>.
21397 *
21398 * Returns: (transfer full) (type EventLogSkeleton): The skeleton object.
21399 */
21400EventLog *
21401event_log_skeleton_new (void)
21402{
21403 return EVENT_LOG (g_object_new (TYPE_EVENT_LOG_SKELETON, NULL));
21404}
21405
21406/* ------------------------------------------------------------------------
21407 * Code for interface org.openbmc.Flash
21408 * ------------------------------------------------------------------------
21409 */
21410
21411/**
21412 * SECTION:Flash
21413 * @title: Flash
21414 * @short_description: Generated C code for the org.openbmc.Flash D-Bus interface
21415 *
21416 * 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.
21417 */
21418
21419/* ---- Introspection data for org.openbmc.Flash ---- */
21420
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021421static const _ExtendedGDBusArgInfo _flash_method_info_update_IN_ARG_filename =
Norman James362a80f2015-09-14 14:04:39 -050021422{
21423 {
21424 -1,
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021425 (gchar *) "filename",
Norman James362a80f2015-09-14 14:04:39 -050021426 (gchar *) "s",
21427 NULL
21428 },
21429 FALSE
21430};
21431
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021432static const _ExtendedGDBusArgInfo * const _flash_method_info_update_IN_ARG_pointers[] =
Norman James362a80f2015-09-14 14:04:39 -050021433{
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021434 &_flash_method_info_update_IN_ARG_filename,
Norman James362a80f2015-09-14 14:04:39 -050021435 NULL
21436};
21437
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021438static const _ExtendedGDBusMethodInfo _flash_method_info_update =
Norman James362a80f2015-09-14 14:04:39 -050021439{
21440 {
21441 -1,
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021442 (gchar *) "update",
21443 (GDBusArgInfo **) &_flash_method_info_update_IN_ARG_pointers,
Norman James362a80f2015-09-14 14:04:39 -050021444 NULL,
21445 NULL
21446 },
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021447 "handle-update",
Norman James362a80f2015-09-14 14:04:39 -050021448 FALSE
21449};
21450
Norman James166acf42015-10-22 07:11:51 -050021451static const _ExtendedGDBusArgInfo _flash_method_info_error_IN_ARG_message =
21452{
21453 {
21454 -1,
21455 (gchar *) "message",
21456 (gchar *) "s",
21457 NULL
21458 },
21459 FALSE
21460};
21461
21462static const _ExtendedGDBusArgInfo * const _flash_method_info_error_IN_ARG_pointers[] =
21463{
21464 &_flash_method_info_error_IN_ARG_message,
21465 NULL
21466};
21467
21468static const _ExtendedGDBusMethodInfo _flash_method_info_error =
21469{
21470 {
21471 -1,
21472 (gchar *) "error",
21473 (GDBusArgInfo **) &_flash_method_info_error_IN_ARG_pointers,
21474 NULL,
21475 NULL
21476 },
21477 "handle-error",
21478 FALSE
21479};
21480
21481static const _ExtendedGDBusMethodInfo _flash_method_info_done =
21482{
21483 {
21484 -1,
21485 (gchar *) "done",
21486 NULL,
21487 NULL,
21488 NULL
21489 },
21490 "handle-done",
21491 FALSE
21492};
21493
Norman Jamesf066e872015-10-07 15:29:51 -050021494static const _ExtendedGDBusArgInfo _flash_method_info_update_via_tftp_IN_ARG_url =
21495{
21496 {
21497 -1,
21498 (gchar *) "url",
21499 (gchar *) "s",
21500 NULL
21501 },
21502 FALSE
21503};
21504
21505static const _ExtendedGDBusArgInfo _flash_method_info_update_via_tftp_IN_ARG_filename =
21506{
21507 {
21508 -1,
21509 (gchar *) "filename",
21510 (gchar *) "s",
21511 NULL
21512 },
21513 FALSE
21514};
21515
21516static const _ExtendedGDBusArgInfo * const _flash_method_info_update_via_tftp_IN_ARG_pointers[] =
21517{
21518 &_flash_method_info_update_via_tftp_IN_ARG_url,
21519 &_flash_method_info_update_via_tftp_IN_ARG_filename,
21520 NULL
21521};
21522
21523static const _ExtendedGDBusMethodInfo _flash_method_info_update_via_tftp =
21524{
21525 {
21526 -1,
21527 (gchar *) "updateViaTftp",
21528 (GDBusArgInfo **) &_flash_method_info_update_via_tftp_IN_ARG_pointers,
21529 NULL,
21530 NULL
21531 },
21532 "handle-update-via-tftp",
21533 FALSE
21534};
21535
Norman James362a80f2015-09-14 14:04:39 -050021536static const _ExtendedGDBusMethodInfo _flash_method_info_init =
21537{
21538 {
21539 -1,
21540 (gchar *) "init",
21541 NULL,
21542 NULL,
21543 NULL
21544 },
21545 "handle-init",
21546 FALSE
21547};
21548
21549static const _ExtendedGDBusMethodInfo * const _flash_method_info_pointers[] =
21550{
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021551 &_flash_method_info_update,
Norman James166acf42015-10-22 07:11:51 -050021552 &_flash_method_info_error,
21553 &_flash_method_info_done,
Norman Jamesf066e872015-10-07 15:29:51 -050021554 &_flash_method_info_update_via_tftp,
Norman James362a80f2015-09-14 14:04:39 -050021555 &_flash_method_info_init,
21556 NULL
21557};
21558
21559static const _ExtendedGDBusSignalInfo _flash_signal_info_updated =
21560{
21561 {
21562 -1,
21563 (gchar *) "Updated",
21564 NULL,
21565 NULL
21566 },
21567 "updated"
21568};
21569
Norman Jamesf066e872015-10-07 15:29:51 -050021570static const _ExtendedGDBusArgInfo _flash_signal_info_download_ARG_url =
21571{
21572 {
21573 -1,
21574 (gchar *) "url",
21575 (gchar *) "s",
21576 NULL
21577 },
21578 FALSE
21579};
21580
21581static const _ExtendedGDBusArgInfo _flash_signal_info_download_ARG_filename =
21582{
21583 {
21584 -1,
21585 (gchar *) "filename",
21586 (gchar *) "s",
21587 NULL
21588 },
21589 FALSE
21590};
21591
21592static const _ExtendedGDBusArgInfo * const _flash_signal_info_download_ARG_pointers[] =
21593{
21594 &_flash_signal_info_download_ARG_url,
21595 &_flash_signal_info_download_ARG_filename,
21596 NULL
21597};
21598
21599static const _ExtendedGDBusSignalInfo _flash_signal_info_download =
21600{
21601 {
21602 -1,
21603 (gchar *) "Download",
21604 (GDBusArgInfo **) &_flash_signal_info_download_ARG_pointers,
21605 NULL
21606 },
21607 "download"
21608};
21609
Norman James362a80f2015-09-14 14:04:39 -050021610static const _ExtendedGDBusSignalInfo * const _flash_signal_info_pointers[] =
21611{
21612 &_flash_signal_info_updated,
Norman Jamesf066e872015-10-07 15:29:51 -050021613 &_flash_signal_info_download,
Norman James362a80f2015-09-14 14:04:39 -050021614 NULL
21615};
21616
Norman James18998182015-10-11 21:54:53 -050021617static const _ExtendedGDBusPropertyInfo _flash_property_info_filename =
21618{
21619 {
21620 -1,
21621 (gchar *) "filename",
21622 (gchar *) "s",
21623 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
21624 NULL
21625 },
21626 "filename",
21627 FALSE
21628};
21629
21630static const _ExtendedGDBusPropertyInfo _flash_property_info_flasher_path =
21631{
21632 {
21633 -1,
21634 (gchar *) "flasher_path",
21635 (gchar *) "s",
21636 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
21637 NULL
21638 },
21639 "flasher-path",
21640 FALSE
21641};
21642
21643static const _ExtendedGDBusPropertyInfo _flash_property_info_flasher_name =
21644{
21645 {
21646 -1,
21647 (gchar *) "flasher_name",
21648 (gchar *) "s",
21649 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
21650 NULL
21651 },
21652 "flasher-name",
21653 FALSE
21654};
21655
21656static const _ExtendedGDBusPropertyInfo _flash_property_info_flasher_instance =
21657{
21658 {
21659 -1,
21660 (gchar *) "flasher_instance",
21661 (gchar *) "s",
21662 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
21663 NULL
21664 },
21665 "flasher-instance",
21666 FALSE
21667};
21668
Norman James166acf42015-10-22 07:11:51 -050021669static const _ExtendedGDBusPropertyInfo _flash_property_info_status =
21670{
21671 {
21672 -1,
21673 (gchar *) "status",
21674 (gchar *) "s",
21675 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
21676 NULL
21677 },
21678 "status",
21679 FALSE
21680};
21681
Norman James18998182015-10-11 21:54:53 -050021682static const _ExtendedGDBusPropertyInfo * const _flash_property_info_pointers[] =
21683{
21684 &_flash_property_info_filename,
21685 &_flash_property_info_flasher_path,
21686 &_flash_property_info_flasher_name,
21687 &_flash_property_info_flasher_instance,
Norman James166acf42015-10-22 07:11:51 -050021688 &_flash_property_info_status,
Norman James18998182015-10-11 21:54:53 -050021689 NULL
21690};
21691
Norman James362a80f2015-09-14 14:04:39 -050021692static const _ExtendedGDBusInterfaceInfo _flash_interface_info =
21693{
21694 {
21695 -1,
21696 (gchar *) "org.openbmc.Flash",
21697 (GDBusMethodInfo **) &_flash_method_info_pointers,
21698 (GDBusSignalInfo **) &_flash_signal_info_pointers,
Norman James18998182015-10-11 21:54:53 -050021699 (GDBusPropertyInfo **) &_flash_property_info_pointers,
Norman James362a80f2015-09-14 14:04:39 -050021700 NULL
21701 },
21702 "flash",
21703};
21704
21705
21706/**
21707 * flash_interface_info:
21708 *
21709 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link> D-Bus interface.
21710 *
21711 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
21712 */
21713GDBusInterfaceInfo *
21714flash_interface_info (void)
21715{
21716 return (GDBusInterfaceInfo *) &_flash_interface_info.parent_struct;
21717}
21718
21719/**
21720 * flash_override_properties:
21721 * @klass: The class structure for a #GObject<!-- -->-derived class.
21722 * @property_id_begin: The property id to assign to the first overridden property.
21723 *
21724 * Overrides all #GObject properties in the #Flash interface for a concrete class.
21725 * The properties are overridden in the order they are defined.
21726 *
21727 * Returns: The last property id.
21728 */
21729guint
21730flash_override_properties (GObjectClass *klass, guint property_id_begin)
21731{
Norman James18998182015-10-11 21:54:53 -050021732 g_object_class_override_property (klass, property_id_begin++, "filename");
21733 g_object_class_override_property (klass, property_id_begin++, "flasher-path");
21734 g_object_class_override_property (klass, property_id_begin++, "flasher-name");
21735 g_object_class_override_property (klass, property_id_begin++, "flasher-instance");
Norman James166acf42015-10-22 07:11:51 -050021736 g_object_class_override_property (klass, property_id_begin++, "status");
Norman James362a80f2015-09-14 14:04:39 -050021737 return property_id_begin - 1;
21738}
21739
21740
21741
21742/**
21743 * Flash:
21744 *
21745 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>.
21746 */
21747
21748/**
21749 * FlashIface:
21750 * @parent_iface: The parent interface.
Norman James166acf42015-10-22 07:11:51 -050021751 * @handle_done: Handler for the #Flash::handle-done signal.
21752 * @handle_error: Handler for the #Flash::handle-error signal.
Norman James362a80f2015-09-14 14:04:39 -050021753 * @handle_init: Handler for the #Flash::handle-init signal.
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021754 * @handle_update: Handler for the #Flash::handle-update signal.
Norman Jamesf066e872015-10-07 15:29:51 -050021755 * @handle_update_via_tftp: Handler for the #Flash::handle-update-via-tftp signal.
Norman James18998182015-10-11 21:54:53 -050021756 * @get_filename: Getter for the #Flash:filename property.
21757 * @get_flasher_instance: Getter for the #Flash:flasher-instance property.
21758 * @get_flasher_name: Getter for the #Flash:flasher-name property.
21759 * @get_flasher_path: Getter for the #Flash:flasher-path property.
Norman James166acf42015-10-22 07:11:51 -050021760 * @get_status: Getter for the #Flash:status property.
Norman Jamesf066e872015-10-07 15:29:51 -050021761 * @download: Handler for the #Flash::download signal.
Norman James362a80f2015-09-14 14:04:39 -050021762 * @updated: Handler for the #Flash::updated signal.
21763 *
21764 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>.
21765 */
21766
21767typedef FlashIface FlashInterface;
21768G_DEFINE_INTERFACE (Flash, flash, G_TYPE_OBJECT);
21769
21770static void
21771flash_default_init (FlashIface *iface)
21772{
21773 /* GObject signals for incoming D-Bus method calls: */
21774 /**
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021775 * Flash::handle-update:
Norman James362a80f2015-09-14 14:04:39 -050021776 * @object: A #Flash.
21777 * @invocation: A #GDBusMethodInvocation.
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021778 * @arg_filename: Argument passed by remote caller.
Norman James362a80f2015-09-14 14:04:39 -050021779 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021780 * 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 -050021781 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021782 * 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 -050021783 *
21784 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
21785 */
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021786 g_signal_new ("handle-update",
Norman James362a80f2015-09-14 14:04:39 -050021787 G_TYPE_FROM_INTERFACE (iface),
21788 G_SIGNAL_RUN_LAST,
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021789 G_STRUCT_OFFSET (FlashIface, handle_update),
Norman James362a80f2015-09-14 14:04:39 -050021790 g_signal_accumulator_true_handled,
21791 NULL,
21792 g_cclosure_marshal_generic,
21793 G_TYPE_BOOLEAN,
21794 2,
21795 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING);
21796
21797 /**
Norman James166acf42015-10-22 07:11:51 -050021798 * Flash::handle-error:
21799 * @object: A #Flash.
21800 * @invocation: A #GDBusMethodInvocation.
21801 * @arg_message: Argument passed by remote caller.
21802 *
21803 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.error">error()</link> D-Bus method.
21804 *
21805 * 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.
21806 *
21807 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
21808 */
21809 g_signal_new ("handle-error",
21810 G_TYPE_FROM_INTERFACE (iface),
21811 G_SIGNAL_RUN_LAST,
21812 G_STRUCT_OFFSET (FlashIface, handle_error),
21813 g_signal_accumulator_true_handled,
21814 NULL,
21815 g_cclosure_marshal_generic,
21816 G_TYPE_BOOLEAN,
21817 2,
21818 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING);
21819
21820 /**
21821 * Flash::handle-done:
21822 * @object: A #Flash.
21823 * @invocation: A #GDBusMethodInvocation.
21824 *
21825 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.done">done()</link> D-Bus method.
21826 *
21827 * 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.
21828 *
21829 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
21830 */
21831 g_signal_new ("handle-done",
21832 G_TYPE_FROM_INTERFACE (iface),
21833 G_SIGNAL_RUN_LAST,
21834 G_STRUCT_OFFSET (FlashIface, handle_done),
21835 g_signal_accumulator_true_handled,
21836 NULL,
21837 g_cclosure_marshal_generic,
21838 G_TYPE_BOOLEAN,
21839 1,
21840 G_TYPE_DBUS_METHOD_INVOCATION);
21841
21842 /**
Norman Jamesf066e872015-10-07 15:29:51 -050021843 * Flash::handle-update-via-tftp:
21844 * @object: A #Flash.
21845 * @invocation: A #GDBusMethodInvocation.
21846 * @arg_url: Argument passed by remote caller.
21847 * @arg_filename: Argument passed by remote caller.
21848 *
21849 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.updateViaTftp">updateViaTftp()</link> D-Bus method.
21850 *
21851 * 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.
21852 *
21853 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
21854 */
21855 g_signal_new ("handle-update-via-tftp",
21856 G_TYPE_FROM_INTERFACE (iface),
21857 G_SIGNAL_RUN_LAST,
21858 G_STRUCT_OFFSET (FlashIface, handle_update_via_tftp),
21859 g_signal_accumulator_true_handled,
21860 NULL,
21861 g_cclosure_marshal_generic,
21862 G_TYPE_BOOLEAN,
21863 3,
21864 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_STRING);
21865
21866 /**
Norman James362a80f2015-09-14 14:04:39 -050021867 * Flash::handle-init:
21868 * @object: A #Flash.
21869 * @invocation: A #GDBusMethodInvocation.
21870 *
21871 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.init">init()</link> D-Bus method.
21872 *
21873 * 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.
21874 *
21875 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
21876 */
21877 g_signal_new ("handle-init",
21878 G_TYPE_FROM_INTERFACE (iface),
21879 G_SIGNAL_RUN_LAST,
21880 G_STRUCT_OFFSET (FlashIface, handle_init),
21881 g_signal_accumulator_true_handled,
21882 NULL,
21883 g_cclosure_marshal_generic,
21884 G_TYPE_BOOLEAN,
21885 1,
21886 G_TYPE_DBUS_METHOD_INVOCATION);
21887
21888 /* GObject signals for received D-Bus signals: */
21889 /**
21890 * Flash::updated:
21891 * @object: A #Flash.
21892 *
21893 * 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.
21894 *
21895 * 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.
21896 */
21897 g_signal_new ("updated",
21898 G_TYPE_FROM_INTERFACE (iface),
21899 G_SIGNAL_RUN_LAST,
21900 G_STRUCT_OFFSET (FlashIface, updated),
21901 NULL,
21902 NULL,
21903 g_cclosure_marshal_generic,
21904 G_TYPE_NONE,
21905 0);
21906
Norman Jamesf066e872015-10-07 15:29:51 -050021907 /**
21908 * Flash::download:
21909 * @object: A #Flash.
21910 * @arg_url: Argument.
21911 * @arg_filename: Argument.
21912 *
21913 * 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.
21914 *
21915 * 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.
21916 */
21917 g_signal_new ("download",
21918 G_TYPE_FROM_INTERFACE (iface),
21919 G_SIGNAL_RUN_LAST,
21920 G_STRUCT_OFFSET (FlashIface, download),
21921 NULL,
21922 NULL,
21923 g_cclosure_marshal_generic,
21924 G_TYPE_NONE,
21925 2, G_TYPE_STRING, G_TYPE_STRING);
21926
Norman James18998182015-10-11 21:54:53 -050021927 /* GObject properties for D-Bus properties: */
21928 /**
21929 * Flash:filename:
21930 *
21931 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Flash.filename">"filename"</link>.
21932 *
21933 * 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.
21934 */
21935 g_object_interface_install_property (iface,
21936 g_param_spec_string ("filename", "filename", "filename", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
21937 /**
21938 * Flash:flasher-path:
21939 *
21940 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Flash.flasher_path">"flasher_path"</link>.
21941 *
21942 * 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.
21943 */
21944 g_object_interface_install_property (iface,
21945 g_param_spec_string ("flasher-path", "flasher_path", "flasher_path", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
21946 /**
21947 * Flash:flasher-name:
21948 *
21949 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Flash.flasher_name">"flasher_name"</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 ("flasher-name", "flasher_name", "flasher_name", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
21955 /**
21956 * Flash:flasher-instance:
21957 *
21958 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Flash.flasher_instance">"flasher_instance"</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-instance", "flasher_instance", "flasher_instance", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Norman James166acf42015-10-22 07:11:51 -050021964 /**
21965 * Flash:status:
21966 *
21967 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Flash.status">"status"</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 ("status", "status", "status", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Norman James18998182015-10-11 21:54:53 -050021973}
21974
21975/**
21976 * flash_get_filename: (skip)
21977 * @object: A #Flash.
21978 *
21979 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Flash.filename">"filename"</link> D-Bus property.
21980 *
21981 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
21982 *
21983 * <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>
21984 *
21985 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
21986 */
21987const gchar *
21988flash_get_filename (Flash *object)
21989{
21990 return FLASH_GET_IFACE (object)->get_filename (object);
21991}
21992
21993/**
21994 * flash_dup_filename: (skip)
21995 * @object: A #Flash.
21996 *
21997 * Gets a copy 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 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
22002 */
22003gchar *
22004flash_dup_filename (Flash *object)
22005{
22006 gchar *value;
22007 g_object_get (G_OBJECT (object), "filename", &value, NULL);
22008 return value;
22009}
22010
22011/**
22012 * flash_set_filename: (skip)
22013 * @object: A #Flash.
22014 * @value: The value to set.
22015 *
22016 * Sets the <link linkend="gdbus-property-org-openbmc-Flash.filename">"filename"</link> D-Bus property to @value.
22017 *
22018 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
22019 */
22020void
22021flash_set_filename (Flash *object, const gchar *value)
22022{
22023 g_object_set (G_OBJECT (object), "filename", value, NULL);
22024}
22025
22026/**
22027 * flash_get_flasher_path: (skip)
22028 * @object: A #Flash.
22029 *
22030 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_path">"flasher_path"</link> D-Bus property.
22031 *
22032 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
22033 *
22034 * <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>
22035 *
22036 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
22037 */
22038const gchar *
22039flash_get_flasher_path (Flash *object)
22040{
22041 return FLASH_GET_IFACE (object)->get_flasher_path (object);
22042}
22043
22044/**
22045 * flash_dup_flasher_path: (skip)
22046 * @object: A #Flash.
22047 *
22048 * Gets a copy 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 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
22053 */
22054gchar *
22055flash_dup_flasher_path (Flash *object)
22056{
22057 gchar *value;
22058 g_object_get (G_OBJECT (object), "flasher-path", &value, NULL);
22059 return value;
22060}
22061
22062/**
22063 * flash_set_flasher_path: (skip)
22064 * @object: A #Flash.
22065 * @value: The value to set.
22066 *
22067 * Sets the <link linkend="gdbus-property-org-openbmc-Flash.flasher_path">"flasher_path"</link> D-Bus property to @value.
22068 *
22069 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
22070 */
22071void
22072flash_set_flasher_path (Flash *object, const gchar *value)
22073{
22074 g_object_set (G_OBJECT (object), "flasher-path", value, NULL);
22075}
22076
22077/**
22078 * flash_get_flasher_name: (skip)
22079 * @object: A #Flash.
22080 *
22081 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_name">"flasher_name"</link> D-Bus property.
22082 *
22083 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
22084 *
22085 * <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>
22086 *
22087 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
22088 */
22089const gchar *
22090flash_get_flasher_name (Flash *object)
22091{
22092 return FLASH_GET_IFACE (object)->get_flasher_name (object);
22093}
22094
22095/**
22096 * flash_dup_flasher_name: (skip)
22097 * @object: A #Flash.
22098 *
22099 * Gets a copy 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 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
22104 */
22105gchar *
22106flash_dup_flasher_name (Flash *object)
22107{
22108 gchar *value;
22109 g_object_get (G_OBJECT (object), "flasher-name", &value, NULL);
22110 return value;
22111}
22112
22113/**
22114 * flash_set_flasher_name: (skip)
22115 * @object: A #Flash.
22116 * @value: The value to set.
22117 *
22118 * Sets the <link linkend="gdbus-property-org-openbmc-Flash.flasher_name">"flasher_name"</link> D-Bus property to @value.
22119 *
22120 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
22121 */
22122void
22123flash_set_flasher_name (Flash *object, const gchar *value)
22124{
22125 g_object_set (G_OBJECT (object), "flasher-name", value, NULL);
22126}
22127
22128/**
22129 * flash_get_flasher_instance: (skip)
22130 * @object: A #Flash.
22131 *
22132 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_instance">"flasher_instance"</link> D-Bus property.
22133 *
22134 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
22135 *
22136 * <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>
22137 *
22138 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
22139 */
22140const gchar *
22141flash_get_flasher_instance (Flash *object)
22142{
22143 return FLASH_GET_IFACE (object)->get_flasher_instance (object);
22144}
22145
22146/**
22147 * flash_dup_flasher_instance: (skip)
22148 * @object: A #Flash.
22149 *
22150 * Gets a copy 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 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
22155 */
22156gchar *
22157flash_dup_flasher_instance (Flash *object)
22158{
22159 gchar *value;
22160 g_object_get (G_OBJECT (object), "flasher-instance", &value, NULL);
22161 return value;
22162}
22163
22164/**
22165 * flash_set_flasher_instance: (skip)
22166 * @object: A #Flash.
22167 * @value: The value to set.
22168 *
22169 * Sets the <link linkend="gdbus-property-org-openbmc-Flash.flasher_instance">"flasher_instance"</link> D-Bus property to @value.
22170 *
22171 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
22172 */
22173void
22174flash_set_flasher_instance (Flash *object, const gchar *value)
22175{
22176 g_object_set (G_OBJECT (object), "flasher-instance", value, NULL);
Norman James362a80f2015-09-14 14:04:39 -050022177}
22178
22179/**
Norman James166acf42015-10-22 07:11:51 -050022180 * flash_get_status: (skip)
22181 * @object: A #Flash.
22182 *
22183 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Flash.status">"status"</link> D-Bus property.
22184 *
22185 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
22186 *
22187 * <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>
22188 *
22189 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
22190 */
22191const gchar *
22192flash_get_status (Flash *object)
22193{
22194 return FLASH_GET_IFACE (object)->get_status (object);
22195}
22196
22197/**
22198 * flash_dup_status: (skip)
22199 * @object: A #Flash.
22200 *
22201 * Gets a copy 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 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
22206 */
22207gchar *
22208flash_dup_status (Flash *object)
22209{
22210 gchar *value;
22211 g_object_get (G_OBJECT (object), "status", &value, NULL);
22212 return value;
22213}
22214
22215/**
22216 * flash_set_status: (skip)
22217 * @object: A #Flash.
22218 * @value: The value to set.
22219 *
22220 * Sets the <link linkend="gdbus-property-org-openbmc-Flash.status">"status"</link> D-Bus property to @value.
22221 *
22222 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
22223 */
22224void
22225flash_set_status (Flash *object, const gchar *value)
22226{
22227 g_object_set (G_OBJECT (object), "status", value, NULL);
22228}
22229
22230/**
Norman James362a80f2015-09-14 14:04:39 -050022231 * flash_emit_updated:
22232 * @object: A #Flash.
22233 *
22234 * Emits the <link linkend="gdbus-signal-org-openbmc-Flash.Updated">"Updated"</link> D-Bus signal.
22235 */
22236void
22237flash_emit_updated (
22238 Flash *object)
22239{
22240 g_signal_emit_by_name (object, "updated");
22241}
22242
22243/**
Norman Jamesf066e872015-10-07 15:29:51 -050022244 * flash_emit_download:
22245 * @object: A #Flash.
22246 * @arg_url: Argument to pass with the signal.
22247 * @arg_filename: Argument to pass with the signal.
22248 *
22249 * Emits the <link linkend="gdbus-signal-org-openbmc-Flash.Download">"Download"</link> D-Bus signal.
22250 */
22251void
22252flash_emit_download (
22253 Flash *object,
22254 const gchar *arg_url,
22255 const gchar *arg_filename)
22256{
22257 g_signal_emit_by_name (object, "download", arg_url, arg_filename);
22258}
22259
22260/**
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022261 * flash_call_update:
Norman James362a80f2015-09-14 14:04:39 -050022262 * @proxy: A #FlashProxy.
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022263 * @arg_filename: Argument to pass with the method invocation.
Norman James362a80f2015-09-14 14:04:39 -050022264 * @cancellable: (allow-none): A #GCancellable or %NULL.
22265 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
22266 * @user_data: User data to pass to @callback.
22267 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022268 * 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 -050022269 * When the operation is finished, @callback will be invoked 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 -050022270 * You can then call flash_call_update_finish() to get the result of the operation.
Norman James362a80f2015-09-14 14:04:39 -050022271 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022272 * See flash_call_update_sync() for the synchronous, blocking version of this method.
Norman James362a80f2015-09-14 14:04:39 -050022273 */
22274void
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022275flash_call_update (
Norman James362a80f2015-09-14 14:04:39 -050022276 Flash *proxy,
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022277 const gchar *arg_filename,
Norman James362a80f2015-09-14 14:04:39 -050022278 GCancellable *cancellable,
22279 GAsyncReadyCallback callback,
22280 gpointer user_data)
22281{
22282 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022283 "update",
Norman James362a80f2015-09-14 14:04:39 -050022284 g_variant_new ("(s)",
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022285 arg_filename),
Norman James362a80f2015-09-14 14:04:39 -050022286 G_DBUS_CALL_FLAGS_NONE,
22287 -1,
22288 cancellable,
22289 callback,
22290 user_data);
22291}
22292
22293/**
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022294 * flash_call_update_finish:
Norman James362a80f2015-09-14 14:04:39 -050022295 * @proxy: A #FlashProxy.
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022296 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_update().
Norman James362a80f2015-09-14 14:04:39 -050022297 * @error: Return location for error or %NULL.
22298 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022299 * Finishes an operation started with flash_call_update().
Norman James362a80f2015-09-14 14:04:39 -050022300 *
22301 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
22302 */
22303gboolean
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022304flash_call_update_finish (
Norman James362a80f2015-09-14 14:04:39 -050022305 Flash *proxy,
22306 GAsyncResult *res,
22307 GError **error)
22308{
22309 GVariant *_ret;
22310 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
22311 if (_ret == NULL)
22312 goto _out;
22313 g_variant_get (_ret,
22314 "()");
22315 g_variant_unref (_ret);
22316_out:
22317 return _ret != NULL;
22318}
22319
22320/**
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022321 * flash_call_update_sync:
Norman James362a80f2015-09-14 14:04:39 -050022322 * @proxy: A #FlashProxy.
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022323 * @arg_filename: Argument to pass with the method invocation.
Norman James362a80f2015-09-14 14:04:39 -050022324 * @cancellable: (allow-none): A #GCancellable or %NULL.
22325 * @error: Return location for error or %NULL.
22326 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022327 * 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 -050022328 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022329 * See flash_call_update() for the asynchronous version of this method.
Norman James362a80f2015-09-14 14:04:39 -050022330 *
22331 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
22332 */
22333gboolean
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022334flash_call_update_sync (
Norman James362a80f2015-09-14 14:04:39 -050022335 Flash *proxy,
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022336 const gchar *arg_filename,
Norman James362a80f2015-09-14 14:04:39 -050022337 GCancellable *cancellable,
22338 GError **error)
22339{
22340 GVariant *_ret;
22341 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022342 "update",
Norman James362a80f2015-09-14 14:04:39 -050022343 g_variant_new ("(s)",
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022344 arg_filename),
Norman James362a80f2015-09-14 14:04:39 -050022345 G_DBUS_CALL_FLAGS_NONE,
22346 -1,
22347 cancellable,
22348 error);
22349 if (_ret == NULL)
22350 goto _out;
22351 g_variant_get (_ret,
22352 "()");
22353 g_variant_unref (_ret);
22354_out:
22355 return _ret != NULL;
22356}
22357
22358/**
Norman James166acf42015-10-22 07:11:51 -050022359 * flash_call_error:
22360 * @proxy: A #FlashProxy.
22361 * @arg_message: Argument to pass with the method invocation.
22362 * @cancellable: (allow-none): A #GCancellable or %NULL.
22363 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
22364 * @user_data: User data to pass to @callback.
22365 *
22366 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.error">error()</link> D-Bus method on @proxy.
22367 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
22368 * You can then call flash_call_error_finish() to get the result of the operation.
22369 *
22370 * See flash_call_error_sync() for the synchronous, blocking version of this method.
22371 */
22372void
22373flash_call_error (
22374 Flash *proxy,
22375 const gchar *arg_message,
22376 GCancellable *cancellable,
22377 GAsyncReadyCallback callback,
22378 gpointer user_data)
22379{
22380 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
22381 "error",
22382 g_variant_new ("(s)",
22383 arg_message),
22384 G_DBUS_CALL_FLAGS_NONE,
22385 -1,
22386 cancellable,
22387 callback,
22388 user_data);
22389}
22390
22391/**
22392 * flash_call_error_finish:
22393 * @proxy: A #FlashProxy.
22394 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_error().
22395 * @error: Return location for error or %NULL.
22396 *
22397 * Finishes an operation started with flash_call_error().
22398 *
22399 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
22400 */
22401gboolean
22402flash_call_error_finish (
22403 Flash *proxy,
22404 GAsyncResult *res,
22405 GError **error)
22406{
22407 GVariant *_ret;
22408 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
22409 if (_ret == NULL)
22410 goto _out;
22411 g_variant_get (_ret,
22412 "()");
22413 g_variant_unref (_ret);
22414_out:
22415 return _ret != NULL;
22416}
22417
22418/**
22419 * flash_call_error_sync:
22420 * @proxy: A #FlashProxy.
22421 * @arg_message: Argument to pass with the method invocation.
22422 * @cancellable: (allow-none): A #GCancellable or %NULL.
22423 * @error: Return location for error or %NULL.
22424 *
22425 * 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.
22426 *
22427 * See flash_call_error() for the asynchronous version of this method.
22428 *
22429 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
22430 */
22431gboolean
22432flash_call_error_sync (
22433 Flash *proxy,
22434 const gchar *arg_message,
22435 GCancellable *cancellable,
22436 GError **error)
22437{
22438 GVariant *_ret;
22439 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
22440 "error",
22441 g_variant_new ("(s)",
22442 arg_message),
22443 G_DBUS_CALL_FLAGS_NONE,
22444 -1,
22445 cancellable,
22446 error);
22447 if (_ret == NULL)
22448 goto _out;
22449 g_variant_get (_ret,
22450 "()");
22451 g_variant_unref (_ret);
22452_out:
22453 return _ret != NULL;
22454}
22455
22456/**
22457 * flash_call_done:
22458 * @proxy: A #FlashProxy.
22459 * @cancellable: (allow-none): A #GCancellable or %NULL.
22460 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
22461 * @user_data: User data to pass to @callback.
22462 *
22463 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.done">done()</link> D-Bus method on @proxy.
22464 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
22465 * You can then call flash_call_done_finish() to get the result of the operation.
22466 *
22467 * See flash_call_done_sync() for the synchronous, blocking version of this method.
22468 */
22469void
22470flash_call_done (
22471 Flash *proxy,
22472 GCancellable *cancellable,
22473 GAsyncReadyCallback callback,
22474 gpointer user_data)
22475{
22476 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
22477 "done",
22478 g_variant_new ("()"),
22479 G_DBUS_CALL_FLAGS_NONE,
22480 -1,
22481 cancellable,
22482 callback,
22483 user_data);
22484}
22485
22486/**
22487 * flash_call_done_finish:
22488 * @proxy: A #FlashProxy.
22489 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_done().
22490 * @error: Return location for error or %NULL.
22491 *
22492 * Finishes an operation started with flash_call_done().
22493 *
22494 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
22495 */
22496gboolean
22497flash_call_done_finish (
22498 Flash *proxy,
22499 GAsyncResult *res,
22500 GError **error)
22501{
22502 GVariant *_ret;
22503 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
22504 if (_ret == NULL)
22505 goto _out;
22506 g_variant_get (_ret,
22507 "()");
22508 g_variant_unref (_ret);
22509_out:
22510 return _ret != NULL;
22511}
22512
22513/**
22514 * flash_call_done_sync:
22515 * @proxy: A #FlashProxy.
22516 * @cancellable: (allow-none): A #GCancellable or %NULL.
22517 * @error: Return location for error or %NULL.
22518 *
22519 * 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.
22520 *
22521 * See flash_call_done() for the asynchronous version of this method.
22522 *
22523 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
22524 */
22525gboolean
22526flash_call_done_sync (
22527 Flash *proxy,
22528 GCancellable *cancellable,
22529 GError **error)
22530{
22531 GVariant *_ret;
22532 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
22533 "done",
22534 g_variant_new ("()"),
22535 G_DBUS_CALL_FLAGS_NONE,
22536 -1,
22537 cancellable,
22538 error);
22539 if (_ret == NULL)
22540 goto _out;
22541 g_variant_get (_ret,
22542 "()");
22543 g_variant_unref (_ret);
22544_out:
22545 return _ret != NULL;
22546}
22547
22548/**
Norman Jamesf066e872015-10-07 15:29:51 -050022549 * flash_call_update_via_tftp:
22550 * @proxy: A #FlashProxy.
22551 * @arg_url: Argument to pass with the method invocation.
22552 * @arg_filename: Argument to pass with the method invocation.
22553 * @cancellable: (allow-none): A #GCancellable or %NULL.
22554 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
22555 * @user_data: User data to pass to @callback.
22556 *
22557 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.updateViaTftp">updateViaTftp()</link> D-Bus method on @proxy.
22558 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
22559 * You can then call flash_call_update_via_tftp_finish() to get the result of the operation.
22560 *
22561 * See flash_call_update_via_tftp_sync() for the synchronous, blocking version of this method.
22562 */
22563void
22564flash_call_update_via_tftp (
22565 Flash *proxy,
22566 const gchar *arg_url,
22567 const gchar *arg_filename,
22568 GCancellable *cancellable,
22569 GAsyncReadyCallback callback,
22570 gpointer user_data)
22571{
22572 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
22573 "updateViaTftp",
22574 g_variant_new ("(ss)",
22575 arg_url,
22576 arg_filename),
22577 G_DBUS_CALL_FLAGS_NONE,
22578 -1,
22579 cancellable,
22580 callback,
22581 user_data);
22582}
22583
22584/**
22585 * flash_call_update_via_tftp_finish:
22586 * @proxy: A #FlashProxy.
22587 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_update_via_tftp().
22588 * @error: Return location for error or %NULL.
22589 *
22590 * Finishes an operation started with flash_call_update_via_tftp().
22591 *
22592 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
22593 */
22594gboolean
22595flash_call_update_via_tftp_finish (
22596 Flash *proxy,
22597 GAsyncResult *res,
22598 GError **error)
22599{
22600 GVariant *_ret;
22601 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
22602 if (_ret == NULL)
22603 goto _out;
22604 g_variant_get (_ret,
22605 "()");
22606 g_variant_unref (_ret);
22607_out:
22608 return _ret != NULL;
22609}
22610
22611/**
22612 * flash_call_update_via_tftp_sync:
22613 * @proxy: A #FlashProxy.
22614 * @arg_url: Argument to pass with the method invocation.
22615 * @arg_filename: Argument to pass with the method invocation.
22616 * @cancellable: (allow-none): A #GCancellable or %NULL.
22617 * @error: Return location for error or %NULL.
22618 *
22619 * 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.
22620 *
22621 * See flash_call_update_via_tftp() for the asynchronous version of this method.
22622 *
22623 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
22624 */
22625gboolean
22626flash_call_update_via_tftp_sync (
22627 Flash *proxy,
22628 const gchar *arg_url,
22629 const gchar *arg_filename,
22630 GCancellable *cancellable,
22631 GError **error)
22632{
22633 GVariant *_ret;
22634 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
22635 "updateViaTftp",
22636 g_variant_new ("(ss)",
22637 arg_url,
22638 arg_filename),
22639 G_DBUS_CALL_FLAGS_NONE,
22640 -1,
22641 cancellable,
22642 error);
22643 if (_ret == NULL)
22644 goto _out;
22645 g_variant_get (_ret,
22646 "()");
22647 g_variant_unref (_ret);
22648_out:
22649 return _ret != NULL;
22650}
22651
22652/**
Norman James362a80f2015-09-14 14:04:39 -050022653 * flash_call_init:
22654 * @proxy: A #FlashProxy.
22655 * @cancellable: (allow-none): A #GCancellable or %NULL.
22656 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
22657 * @user_data: User data to pass to @callback.
22658 *
22659 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.init">init()</link> D-Bus method on @proxy.
22660 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
22661 * You can then call flash_call_init_finish() to get the result of the operation.
22662 *
22663 * See flash_call_init_sync() for the synchronous, blocking version of this method.
22664 */
22665void
22666flash_call_init (
22667 Flash *proxy,
22668 GCancellable *cancellable,
22669 GAsyncReadyCallback callback,
22670 gpointer user_data)
22671{
22672 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
22673 "init",
22674 g_variant_new ("()"),
22675 G_DBUS_CALL_FLAGS_NONE,
22676 -1,
22677 cancellable,
22678 callback,
22679 user_data);
22680}
22681
22682/**
22683 * flash_call_init_finish:
22684 * @proxy: A #FlashProxy.
22685 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_init().
22686 * @error: Return location for error or %NULL.
22687 *
22688 * Finishes an operation started with flash_call_init().
22689 *
22690 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
22691 */
22692gboolean
22693flash_call_init_finish (
22694 Flash *proxy,
22695 GAsyncResult *res,
22696 GError **error)
22697{
22698 GVariant *_ret;
22699 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
22700 if (_ret == NULL)
22701 goto _out;
22702 g_variant_get (_ret,
22703 "()");
22704 g_variant_unref (_ret);
22705_out:
22706 return _ret != NULL;
22707}
22708
22709/**
22710 * flash_call_init_sync:
22711 * @proxy: A #FlashProxy.
22712 * @cancellable: (allow-none): A #GCancellable or %NULL.
22713 * @error: Return location for error or %NULL.
22714 *
22715 * 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.
22716 *
22717 * See flash_call_init() for the asynchronous version of this method.
22718 *
22719 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
22720 */
22721gboolean
22722flash_call_init_sync (
22723 Flash *proxy,
22724 GCancellable *cancellable,
22725 GError **error)
22726{
22727 GVariant *_ret;
22728 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
22729 "init",
22730 g_variant_new ("()"),
22731 G_DBUS_CALL_FLAGS_NONE,
22732 -1,
22733 cancellable,
22734 error);
22735 if (_ret == NULL)
22736 goto _out;
22737 g_variant_get (_ret,
22738 "()");
22739 g_variant_unref (_ret);
22740_out:
22741 return _ret != NULL;
22742}
22743
22744/**
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022745 * flash_complete_update:
Norman James362a80f2015-09-14 14:04:39 -050022746 * @object: A #Flash.
22747 * @invocation: (transfer full): A #GDBusMethodInvocation.
22748 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022749 * 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 -050022750 *
22751 * This method will free @invocation, you cannot use it afterwards.
22752 */
22753void
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022754flash_complete_update (
Norman James362a80f2015-09-14 14:04:39 -050022755 Flash *object,
22756 GDBusMethodInvocation *invocation)
22757{
22758 g_dbus_method_invocation_return_value (invocation,
22759 g_variant_new ("()"));
22760}
22761
22762/**
Norman James166acf42015-10-22 07:11:51 -050022763 * flash_complete_error:
22764 * @object: A #Flash.
22765 * @invocation: (transfer full): A #GDBusMethodInvocation.
22766 *
22767 * 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.
22768 *
22769 * This method will free @invocation, you cannot use it afterwards.
22770 */
22771void
22772flash_complete_error (
22773 Flash *object,
22774 GDBusMethodInvocation *invocation)
22775{
22776 g_dbus_method_invocation_return_value (invocation,
22777 g_variant_new ("()"));
22778}
22779
22780/**
22781 * flash_complete_done:
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.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.
22786 *
22787 * This method will free @invocation, you cannot use it afterwards.
22788 */
22789void
22790flash_complete_done (
22791 Flash *object,
22792 GDBusMethodInvocation *invocation)
22793{
22794 g_dbus_method_invocation_return_value (invocation,
22795 g_variant_new ("()"));
22796}
22797
22798/**
Norman Jamesf066e872015-10-07 15:29:51 -050022799 * flash_complete_update_via_tftp:
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.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.
22804 *
22805 * This method will free @invocation, you cannot use it afterwards.
22806 */
22807void
22808flash_complete_update_via_tftp (
22809 Flash *object,
22810 GDBusMethodInvocation *invocation)
22811{
22812 g_dbus_method_invocation_return_value (invocation,
22813 g_variant_new ("()"));
22814}
22815
22816/**
Norman James362a80f2015-09-14 14:04:39 -050022817 * flash_complete_init:
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.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.
22822 *
22823 * This method will free @invocation, you cannot use it afterwards.
22824 */
22825void
22826flash_complete_init (
22827 Flash *object,
22828 GDBusMethodInvocation *invocation)
22829{
22830 g_dbus_method_invocation_return_value (invocation,
22831 g_variant_new ("()"));
22832}
22833
22834/* ------------------------------------------------------------------------ */
22835
22836/**
22837 * FlashProxy:
22838 *
22839 * The #FlashProxy structure contains only private data and should only be accessed using the provided API.
22840 */
22841
22842/**
22843 * FlashProxyClass:
22844 * @parent_class: The parent class.
22845 *
22846 * Class structure for #FlashProxy.
22847 */
22848
22849struct _FlashProxyPrivate
22850{
22851 GData *qdata;
22852};
22853
22854static void flash_proxy_iface_init (FlashIface *iface);
22855
22856#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
22857G_DEFINE_TYPE_WITH_CODE (FlashProxy, flash_proxy, G_TYPE_DBUS_PROXY,
22858 G_ADD_PRIVATE (FlashProxy)
22859 G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_proxy_iface_init));
22860
22861#else
22862G_DEFINE_TYPE_WITH_CODE (FlashProxy, flash_proxy, G_TYPE_DBUS_PROXY,
22863 G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_proxy_iface_init));
22864
22865#endif
22866static void
22867flash_proxy_finalize (GObject *object)
22868{
22869 FlashProxy *proxy = FLASH_PROXY (object);
22870 g_datalist_clear (&proxy->priv->qdata);
22871 G_OBJECT_CLASS (flash_proxy_parent_class)->finalize (object);
22872}
22873
22874static void
22875flash_proxy_get_property (GObject *object,
22876 guint prop_id,
22877 GValue *value,
22878 GParamSpec *pspec G_GNUC_UNUSED)
22879{
Norman James18998182015-10-11 21:54:53 -050022880 const _ExtendedGDBusPropertyInfo *info;
22881 GVariant *variant;
Norman James166acf42015-10-22 07:11:51 -050022882 g_assert (prop_id != 0 && prop_id - 1 < 5);
Norman James18998182015-10-11 21:54:53 -050022883 info = _flash_property_info_pointers[prop_id - 1];
22884 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
22885 if (info->use_gvariant)
22886 {
22887 g_value_set_variant (value, variant);
22888 }
22889 else
22890 {
22891 if (variant != NULL)
22892 g_dbus_gvariant_to_gvalue (variant, value);
22893 }
22894 if (variant != NULL)
22895 g_variant_unref (variant);
22896}
22897
22898static void
22899flash_proxy_set_property_cb (GDBusProxy *proxy,
22900 GAsyncResult *res,
22901 gpointer user_data)
22902{
22903 const _ExtendedGDBusPropertyInfo *info = user_data;
22904 GError *error;
22905 GVariant *_ret;
22906 error = NULL;
22907 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
22908 if (!_ret)
22909 {
22910 g_warning ("Error setting property '%s' on interface org.openbmc.Flash: %s (%s, %d)",
22911 info->parent_struct.name,
22912 error->message, g_quark_to_string (error->domain), error->code);
22913 g_error_free (error);
22914 }
22915 else
22916 {
22917 g_variant_unref (_ret);
22918 }
Norman James362a80f2015-09-14 14:04:39 -050022919}
22920
22921static void
22922flash_proxy_set_property (GObject *object,
22923 guint prop_id,
22924 const GValue *value,
22925 GParamSpec *pspec G_GNUC_UNUSED)
22926{
Norman James18998182015-10-11 21:54:53 -050022927 const _ExtendedGDBusPropertyInfo *info;
22928 GVariant *variant;
Norman James166acf42015-10-22 07:11:51 -050022929 g_assert (prop_id != 0 && prop_id - 1 < 5);
Norman James18998182015-10-11 21:54:53 -050022930 info = _flash_property_info_pointers[prop_id - 1];
22931 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
22932 g_dbus_proxy_call (G_DBUS_PROXY (object),
22933 "org.freedesktop.DBus.Properties.Set",
22934 g_variant_new ("(ssv)", "org.openbmc.Flash", info->parent_struct.name, variant),
22935 G_DBUS_CALL_FLAGS_NONE,
22936 -1,
22937 NULL, (GAsyncReadyCallback) flash_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
22938 g_variant_unref (variant);
Norman James362a80f2015-09-14 14:04:39 -050022939}
22940
22941static void
22942flash_proxy_g_signal (GDBusProxy *proxy,
22943 const gchar *sender_name G_GNUC_UNUSED,
22944 const gchar *signal_name,
22945 GVariant *parameters)
22946{
22947 _ExtendedGDBusSignalInfo *info;
22948 GVariantIter iter;
22949 GVariant *child;
22950 GValue *paramv;
22951 guint num_params;
22952 guint n;
22953 guint signal_id;
22954 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, signal_name);
22955 if (info == NULL)
22956 return;
22957 num_params = g_variant_n_children (parameters);
22958 paramv = g_new0 (GValue, num_params + 1);
22959 g_value_init (&paramv[0], TYPE_FLASH);
22960 g_value_set_object (&paramv[0], proxy);
22961 g_variant_iter_init (&iter, parameters);
22962 n = 1;
22963 while ((child = g_variant_iter_next_value (&iter)) != NULL)
22964 {
22965 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
22966 if (arg_info->use_gvariant)
22967 {
22968 g_value_init (&paramv[n], G_TYPE_VARIANT);
22969 g_value_set_variant (&paramv[n], child);
22970 n++;
22971 }
22972 else
22973 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
22974 g_variant_unref (child);
22975 }
22976 signal_id = g_signal_lookup (info->signal_name, TYPE_FLASH);
22977 g_signal_emitv (paramv, signal_id, 0, NULL);
22978 for (n = 0; n < num_params + 1; n++)
22979 g_value_unset (&paramv[n]);
22980 g_free (paramv);
22981}
22982
22983static void
22984flash_proxy_g_properties_changed (GDBusProxy *_proxy,
22985 GVariant *changed_properties,
22986 const gchar *const *invalidated_properties)
22987{
22988 FlashProxy *proxy = FLASH_PROXY (_proxy);
22989 guint n;
22990 const gchar *key;
22991 GVariantIter *iter;
22992 _ExtendedGDBusPropertyInfo *info;
22993 g_variant_get (changed_properties, "a{sv}", &iter);
22994 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
22995 {
22996 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, key);
22997 g_datalist_remove_data (&proxy->priv->qdata, key);
22998 if (info != NULL)
22999 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
23000 }
23001 g_variant_iter_free (iter);
23002 for (n = 0; invalidated_properties[n] != NULL; n++)
23003 {
23004 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, invalidated_properties[n]);
23005 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
23006 if (info != NULL)
23007 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
23008 }
23009}
23010
Norman James18998182015-10-11 21:54:53 -050023011static const gchar *
23012flash_proxy_get_filename (Flash *object)
23013{
23014 FlashProxy *proxy = FLASH_PROXY (object);
23015 GVariant *variant;
23016 const gchar *value = NULL;
23017 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "filename");
23018 if (variant != NULL)
23019 {
23020 value = g_variant_get_string (variant, NULL);
23021 g_variant_unref (variant);
23022 }
23023 return value;
23024}
23025
23026static const gchar *
23027flash_proxy_get_flasher_path (Flash *object)
23028{
23029 FlashProxy *proxy = FLASH_PROXY (object);
23030 GVariant *variant;
23031 const gchar *value = NULL;
23032 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "flasher_path");
23033 if (variant != NULL)
23034 {
23035 value = g_variant_get_string (variant, NULL);
23036 g_variant_unref (variant);
23037 }
23038 return value;
23039}
23040
23041static const gchar *
23042flash_proxy_get_flasher_name (Flash *object)
23043{
23044 FlashProxy *proxy = FLASH_PROXY (object);
23045 GVariant *variant;
23046 const gchar *value = NULL;
23047 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "flasher_name");
23048 if (variant != NULL)
23049 {
23050 value = g_variant_get_string (variant, NULL);
23051 g_variant_unref (variant);
23052 }
23053 return value;
23054}
23055
23056static const gchar *
23057flash_proxy_get_flasher_instance (Flash *object)
23058{
23059 FlashProxy *proxy = FLASH_PROXY (object);
23060 GVariant *variant;
23061 const gchar *value = NULL;
23062 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "flasher_instance");
23063 if (variant != NULL)
23064 {
23065 value = g_variant_get_string (variant, NULL);
23066 g_variant_unref (variant);
23067 }
23068 return value;
23069}
23070
Norman James166acf42015-10-22 07:11:51 -050023071static const gchar *
23072flash_proxy_get_status (Flash *object)
23073{
23074 FlashProxy *proxy = FLASH_PROXY (object);
23075 GVariant *variant;
23076 const gchar *value = NULL;
23077 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "status");
23078 if (variant != NULL)
23079 {
23080 value = g_variant_get_string (variant, NULL);
23081 g_variant_unref (variant);
23082 }
23083 return value;
23084}
23085
Norman James362a80f2015-09-14 14:04:39 -050023086static void
23087flash_proxy_init (FlashProxy *proxy)
23088{
23089#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
23090 proxy->priv = flash_proxy_get_instance_private (proxy);
23091#else
23092 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_FLASH_PROXY, FlashProxyPrivate);
23093#endif
23094
23095 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), flash_interface_info ());
23096}
23097
23098static void
23099flash_proxy_class_init (FlashProxyClass *klass)
23100{
23101 GObjectClass *gobject_class;
23102 GDBusProxyClass *proxy_class;
23103
23104 gobject_class = G_OBJECT_CLASS (klass);
23105 gobject_class->finalize = flash_proxy_finalize;
23106 gobject_class->get_property = flash_proxy_get_property;
23107 gobject_class->set_property = flash_proxy_set_property;
23108
23109 proxy_class = G_DBUS_PROXY_CLASS (klass);
23110 proxy_class->g_signal = flash_proxy_g_signal;
23111 proxy_class->g_properties_changed = flash_proxy_g_properties_changed;
23112
Norman James18998182015-10-11 21:54:53 -050023113 flash_override_properties (gobject_class, 1);
23114
Norman James362a80f2015-09-14 14:04:39 -050023115#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
23116 g_type_class_add_private (klass, sizeof (FlashProxyPrivate));
23117#endif
23118}
23119
23120static void
23121flash_proxy_iface_init (FlashIface *iface)
23122{
Norman James18998182015-10-11 21:54:53 -050023123 iface->get_filename = flash_proxy_get_filename;
23124 iface->get_flasher_path = flash_proxy_get_flasher_path;
23125 iface->get_flasher_name = flash_proxy_get_flasher_name;
23126 iface->get_flasher_instance = flash_proxy_get_flasher_instance;
Norman James166acf42015-10-22 07:11:51 -050023127 iface->get_status = flash_proxy_get_status;
Norman James362a80f2015-09-14 14:04:39 -050023128}
23129
23130/**
23131 * flash_proxy_new:
23132 * @connection: A #GDBusConnection.
23133 * @flags: Flags from the #GDBusProxyFlags enumeration.
23134 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
23135 * @object_path: An object path.
23136 * @cancellable: (allow-none): A #GCancellable or %NULL.
23137 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
23138 * @user_data: User data to pass to @callback.
23139 *
23140 * 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.
23141 *
23142 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
23143 * You can then call flash_proxy_new_finish() to get the result of the operation.
23144 *
23145 * See flash_proxy_new_sync() for the synchronous, blocking version of this constructor.
23146 */
23147void
23148flash_proxy_new (
23149 GDBusConnection *connection,
23150 GDBusProxyFlags flags,
23151 const gchar *name,
23152 const gchar *object_path,
23153 GCancellable *cancellable,
23154 GAsyncReadyCallback callback,
23155 gpointer user_data)
23156{
23157 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);
23158}
23159
23160/**
23161 * flash_proxy_new_finish:
23162 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_proxy_new().
23163 * @error: Return location for error or %NULL
23164 *
23165 * Finishes an operation started with flash_proxy_new().
23166 *
23167 * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set.
23168 */
23169Flash *
23170flash_proxy_new_finish (
23171 GAsyncResult *res,
23172 GError **error)
23173{
23174 GObject *ret;
23175 GObject *source_object;
23176 source_object = g_async_result_get_source_object (res);
23177 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
23178 g_object_unref (source_object);
23179 if (ret != NULL)
23180 return FLASH (ret);
23181 else
23182 return NULL;
23183}
23184
23185/**
23186 * flash_proxy_new_sync:
23187 * @connection: A #GDBusConnection.
23188 * @flags: Flags from the #GDBusProxyFlags enumeration.
23189 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
23190 * @object_path: An object path.
23191 * @cancellable: (allow-none): A #GCancellable or %NULL.
23192 * @error: Return location for error or %NULL
23193 *
23194 * 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.
23195 *
23196 * The calling thread is blocked until a reply is received.
23197 *
23198 * See flash_proxy_new() for the asynchronous version of this constructor.
23199 *
23200 * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set.
23201 */
23202Flash *
23203flash_proxy_new_sync (
23204 GDBusConnection *connection,
23205 GDBusProxyFlags flags,
23206 const gchar *name,
23207 const gchar *object_path,
23208 GCancellable *cancellable,
23209 GError **error)
23210{
23211 GInitable *ret;
23212 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);
23213 if (ret != NULL)
23214 return FLASH (ret);
23215 else
23216 return NULL;
23217}
23218
23219
23220/**
23221 * flash_proxy_new_for_bus:
23222 * @bus_type: A #GBusType.
23223 * @flags: Flags from the #GDBusProxyFlags enumeration.
23224 * @name: A bus name (well-known or unique).
23225 * @object_path: An object path.
23226 * @cancellable: (allow-none): A #GCancellable or %NULL.
23227 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
23228 * @user_data: User data to pass to @callback.
23229 *
23230 * Like flash_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
23231 *
23232 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
23233 * You can then call flash_proxy_new_for_bus_finish() to get the result of the operation.
23234 *
23235 * See flash_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
23236 */
23237void
23238flash_proxy_new_for_bus (
23239 GBusType bus_type,
23240 GDBusProxyFlags flags,
23241 const gchar *name,
23242 const gchar *object_path,
23243 GCancellable *cancellable,
23244 GAsyncReadyCallback callback,
23245 gpointer user_data)
23246{
23247 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);
23248}
23249
23250/**
23251 * flash_proxy_new_for_bus_finish:
23252 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_proxy_new_for_bus().
23253 * @error: Return location for error or %NULL
23254 *
23255 * Finishes an operation started with flash_proxy_new_for_bus().
23256 *
23257 * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set.
23258 */
23259Flash *
23260flash_proxy_new_for_bus_finish (
23261 GAsyncResult *res,
23262 GError **error)
23263{
23264 GObject *ret;
23265 GObject *source_object;
23266 source_object = g_async_result_get_source_object (res);
23267 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
23268 g_object_unref (source_object);
23269 if (ret != NULL)
23270 return FLASH (ret);
23271 else
23272 return NULL;
23273}
23274
23275/**
23276 * flash_proxy_new_for_bus_sync:
23277 * @bus_type: A #GBusType.
23278 * @flags: Flags from the #GDBusProxyFlags enumeration.
23279 * @name: A bus name (well-known or unique).
23280 * @object_path: An object path.
23281 * @cancellable: (allow-none): A #GCancellable or %NULL.
23282 * @error: Return location for error or %NULL
23283 *
23284 * Like flash_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
23285 *
23286 * The calling thread is blocked until a reply is received.
23287 *
23288 * See flash_proxy_new_for_bus() for the asynchronous version of this constructor.
23289 *
23290 * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set.
23291 */
23292Flash *
23293flash_proxy_new_for_bus_sync (
23294 GBusType bus_type,
23295 GDBusProxyFlags flags,
23296 const gchar *name,
23297 const gchar *object_path,
23298 GCancellable *cancellable,
23299 GError **error)
23300{
23301 GInitable *ret;
23302 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);
23303 if (ret != NULL)
23304 return FLASH (ret);
23305 else
23306 return NULL;
23307}
23308
23309
23310/* ------------------------------------------------------------------------ */
23311
23312/**
23313 * FlashSkeleton:
23314 *
23315 * The #FlashSkeleton structure contains only private data and should only be accessed using the provided API.
23316 */
23317
23318/**
23319 * FlashSkeletonClass:
23320 * @parent_class: The parent class.
23321 *
23322 * Class structure for #FlashSkeleton.
23323 */
23324
23325struct _FlashSkeletonPrivate
23326{
23327 GValue *properties;
23328 GList *changed_properties;
23329 GSource *changed_properties_idle_source;
23330 GMainContext *context;
23331 GMutex lock;
23332};
23333
23334static void
23335_flash_skeleton_handle_method_call (
23336 GDBusConnection *connection G_GNUC_UNUSED,
23337 const gchar *sender G_GNUC_UNUSED,
23338 const gchar *object_path G_GNUC_UNUSED,
23339 const gchar *interface_name,
23340 const gchar *method_name,
23341 GVariant *parameters,
23342 GDBusMethodInvocation *invocation,
23343 gpointer user_data)
23344{
23345 FlashSkeleton *skeleton = FLASH_SKELETON (user_data);
23346 _ExtendedGDBusMethodInfo *info;
23347 GVariantIter iter;
23348 GVariant *child;
23349 GValue *paramv;
23350 guint num_params;
23351 guint num_extra;
23352 guint n;
23353 guint signal_id;
23354 GValue return_value = G_VALUE_INIT;
23355 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
23356 g_assert (info != NULL);
23357 num_params = g_variant_n_children (parameters);
23358 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
23359 n = 0;
23360 g_value_init (&paramv[n], TYPE_FLASH);
23361 g_value_set_object (&paramv[n++], skeleton);
23362 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
23363 g_value_set_object (&paramv[n++], invocation);
23364 if (info->pass_fdlist)
23365 {
23366#ifdef G_OS_UNIX
23367 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
23368 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
23369#else
23370 g_assert_not_reached ();
23371#endif
23372 }
23373 g_variant_iter_init (&iter, parameters);
23374 while ((child = g_variant_iter_next_value (&iter)) != NULL)
23375 {
23376 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
23377 if (arg_info->use_gvariant)
23378 {
23379 g_value_init (&paramv[n], G_TYPE_VARIANT);
23380 g_value_set_variant (&paramv[n], child);
23381 n++;
23382 }
23383 else
23384 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
23385 g_variant_unref (child);
23386 }
23387 signal_id = g_signal_lookup (info->signal_name, TYPE_FLASH);
23388 g_value_init (&return_value, G_TYPE_BOOLEAN);
23389 g_signal_emitv (paramv, signal_id, 0, &return_value);
23390 if (!g_value_get_boolean (&return_value))
23391 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);
23392 g_value_unset (&return_value);
23393 for (n = 0; n < num_params + num_extra; n++)
23394 g_value_unset (&paramv[n]);
23395 g_free (paramv);
23396}
23397
23398static GVariant *
23399_flash_skeleton_handle_get_property (
23400 GDBusConnection *connection G_GNUC_UNUSED,
23401 const gchar *sender G_GNUC_UNUSED,
23402 const gchar *object_path G_GNUC_UNUSED,
23403 const gchar *interface_name G_GNUC_UNUSED,
23404 const gchar *property_name,
23405 GError **error,
23406 gpointer user_data)
23407{
23408 FlashSkeleton *skeleton = FLASH_SKELETON (user_data);
23409 GValue value = G_VALUE_INIT;
23410 GParamSpec *pspec;
23411 _ExtendedGDBusPropertyInfo *info;
23412 GVariant *ret;
23413 ret = NULL;
23414 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, property_name);
23415 g_assert (info != NULL);
23416 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
23417 if (pspec == NULL)
23418 {
23419 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
23420 }
23421 else
23422 {
23423 g_value_init (&value, pspec->value_type);
23424 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
23425 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
23426 g_value_unset (&value);
23427 }
23428 return ret;
23429}
23430
23431static gboolean
23432_flash_skeleton_handle_set_property (
23433 GDBusConnection *connection G_GNUC_UNUSED,
23434 const gchar *sender G_GNUC_UNUSED,
23435 const gchar *object_path G_GNUC_UNUSED,
23436 const gchar *interface_name G_GNUC_UNUSED,
23437 const gchar *property_name,
23438 GVariant *variant,
23439 GError **error,
23440 gpointer user_data)
23441{
23442 FlashSkeleton *skeleton = FLASH_SKELETON (user_data);
23443 GValue value = G_VALUE_INIT;
23444 GParamSpec *pspec;
23445 _ExtendedGDBusPropertyInfo *info;
23446 gboolean ret;
23447 ret = FALSE;
23448 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, property_name);
23449 g_assert (info != NULL);
23450 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
23451 if (pspec == NULL)
23452 {
23453 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
23454 }
23455 else
23456 {
23457 if (info->use_gvariant)
23458 g_value_set_variant (&value, variant);
23459 else
23460 g_dbus_gvariant_to_gvalue (variant, &value);
23461 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
23462 g_value_unset (&value);
23463 ret = TRUE;
23464 }
23465 return ret;
23466}
23467
23468static const GDBusInterfaceVTable _flash_skeleton_vtable =
23469{
23470 _flash_skeleton_handle_method_call,
23471 _flash_skeleton_handle_get_property,
23472 _flash_skeleton_handle_set_property,
23473 {NULL}
23474};
23475
23476static GDBusInterfaceInfo *
23477flash_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
23478{
23479 return flash_interface_info ();
23480}
23481
23482static GDBusInterfaceVTable *
23483flash_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
23484{
23485 return (GDBusInterfaceVTable *) &_flash_skeleton_vtable;
23486}
23487
23488static GVariant *
23489flash_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
23490{
23491 FlashSkeleton *skeleton = FLASH_SKELETON (_skeleton);
23492
23493 GVariantBuilder builder;
23494 guint n;
23495 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
23496 if (_flash_interface_info.parent_struct.properties == NULL)
23497 goto out;
23498 for (n = 0; _flash_interface_info.parent_struct.properties[n] != NULL; n++)
23499 {
23500 GDBusPropertyInfo *info = _flash_interface_info.parent_struct.properties[n];
23501 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
23502 {
23503 GVariant *value;
23504 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);
23505 if (value != NULL)
23506 {
23507 g_variant_take_ref (value);
23508 g_variant_builder_add (&builder, "{sv}", info->name, value);
23509 g_variant_unref (value);
23510 }
23511 }
23512 }
23513out:
23514 return g_variant_builder_end (&builder);
23515}
23516
Norman James18998182015-10-11 21:54:53 -050023517static gboolean _flash_emit_changed (gpointer user_data);
23518
Norman James362a80f2015-09-14 14:04:39 -050023519static void
23520flash_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
23521{
Norman James18998182015-10-11 21:54:53 -050023522 FlashSkeleton *skeleton = FLASH_SKELETON (_skeleton);
23523 gboolean emit_changed = FALSE;
23524
23525 g_mutex_lock (&skeleton->priv->lock);
23526 if (skeleton->priv->changed_properties_idle_source != NULL)
23527 {
23528 g_source_destroy (skeleton->priv->changed_properties_idle_source);
23529 skeleton->priv->changed_properties_idle_source = NULL;
23530 emit_changed = TRUE;
23531 }
23532 g_mutex_unlock (&skeleton->priv->lock);
23533
23534 if (emit_changed)
23535 _flash_emit_changed (skeleton);
Norman James362a80f2015-09-14 14:04:39 -050023536}
23537
23538static void
23539_flash_on_signal_updated (
23540 Flash *object)
23541{
23542 FlashSkeleton *skeleton = FLASH_SKELETON (object);
23543
23544 GList *connections, *l;
23545 GVariant *signal_variant;
23546 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
23547
23548 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
23549 for (l = connections; l != NULL; l = l->next)
23550 {
23551 GDBusConnection *connection = l->data;
23552 g_dbus_connection_emit_signal (connection,
23553 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Flash", "Updated",
23554 signal_variant, NULL);
23555 }
23556 g_variant_unref (signal_variant);
23557 g_list_free_full (connections, g_object_unref);
23558}
23559
Norman Jamesf066e872015-10-07 15:29:51 -050023560static void
23561_flash_on_signal_download (
23562 Flash *object,
23563 const gchar *arg_url,
23564 const gchar *arg_filename)
23565{
23566 FlashSkeleton *skeleton = FLASH_SKELETON (object);
23567
23568 GList *connections, *l;
23569 GVariant *signal_variant;
23570 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
23571
23572 signal_variant = g_variant_ref_sink (g_variant_new ("(ss)",
23573 arg_url,
23574 arg_filename));
23575 for (l = connections; l != NULL; l = l->next)
23576 {
23577 GDBusConnection *connection = l->data;
23578 g_dbus_connection_emit_signal (connection,
23579 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Flash", "Download",
23580 signal_variant, NULL);
23581 }
23582 g_variant_unref (signal_variant);
23583 g_list_free_full (connections, g_object_unref);
23584}
23585
Norman James362a80f2015-09-14 14:04:39 -050023586static void flash_skeleton_iface_init (FlashIface *iface);
23587#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
23588G_DEFINE_TYPE_WITH_CODE (FlashSkeleton, flash_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
23589 G_ADD_PRIVATE (FlashSkeleton)
23590 G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_skeleton_iface_init));
23591
23592#else
23593G_DEFINE_TYPE_WITH_CODE (FlashSkeleton, flash_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
23594 G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_skeleton_iface_init));
23595
23596#endif
23597static void
23598flash_skeleton_finalize (GObject *object)
23599{
23600 FlashSkeleton *skeleton = FLASH_SKELETON (object);
Norman James18998182015-10-11 21:54:53 -050023601 guint n;
Norman James166acf42015-10-22 07:11:51 -050023602 for (n = 0; n < 5; n++)
Norman James18998182015-10-11 21:54:53 -050023603 g_value_unset (&skeleton->priv->properties[n]);
23604 g_free (skeleton->priv->properties);
Norman James362a80f2015-09-14 14:04:39 -050023605 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
23606 if (skeleton->priv->changed_properties_idle_source != NULL)
23607 g_source_destroy (skeleton->priv->changed_properties_idle_source);
23608 g_main_context_unref (skeleton->priv->context);
23609 g_mutex_clear (&skeleton->priv->lock);
23610 G_OBJECT_CLASS (flash_skeleton_parent_class)->finalize (object);
23611}
23612
23613static void
Norman James18998182015-10-11 21:54:53 -050023614flash_skeleton_get_property (GObject *object,
23615 guint prop_id,
23616 GValue *value,
23617 GParamSpec *pspec G_GNUC_UNUSED)
23618{
23619 FlashSkeleton *skeleton = FLASH_SKELETON (object);
Norman James166acf42015-10-22 07:11:51 -050023620 g_assert (prop_id != 0 && prop_id - 1 < 5);
Norman James18998182015-10-11 21:54:53 -050023621 g_mutex_lock (&skeleton->priv->lock);
23622 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
23623 g_mutex_unlock (&skeleton->priv->lock);
23624}
23625
23626static gboolean
23627_flash_emit_changed (gpointer user_data)
23628{
23629 FlashSkeleton *skeleton = FLASH_SKELETON (user_data);
23630 GList *l;
23631 GVariantBuilder builder;
23632 GVariantBuilder invalidated_builder;
23633 guint num_changes;
23634
23635 g_mutex_lock (&skeleton->priv->lock);
23636 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
23637 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
23638 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
23639 {
23640 ChangedProperty *cp = l->data;
23641 GVariant *variant;
23642 const GValue *cur_value;
23643
23644 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
23645 if (!_g_value_equal (cur_value, &cp->orig_value))
23646 {
23647 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
23648 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
23649 g_variant_unref (variant);
23650 num_changes++;
23651 }
23652 }
23653 if (num_changes > 0)
23654 {
23655 GList *connections, *ll;
23656 GVariant *signal_variant;
23657 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Flash",
23658 &builder, &invalidated_builder));
23659 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
23660 for (ll = connections; ll != NULL; ll = ll->next)
23661 {
23662 GDBusConnection *connection = ll->data;
23663
23664 g_dbus_connection_emit_signal (connection,
23665 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
23666 "org.freedesktop.DBus.Properties",
23667 "PropertiesChanged",
23668 signal_variant,
23669 NULL);
23670 }
23671 g_variant_unref (signal_variant);
23672 g_list_free_full (connections, g_object_unref);
23673 }
23674 else
23675 {
23676 g_variant_builder_clear (&builder);
23677 g_variant_builder_clear (&invalidated_builder);
23678 }
23679 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
23680 skeleton->priv->changed_properties = NULL;
23681 skeleton->priv->changed_properties_idle_source = NULL;
23682 g_mutex_unlock (&skeleton->priv->lock);
23683 return FALSE;
23684}
23685
23686static void
23687_flash_schedule_emit_changed (FlashSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
23688{
23689 ChangedProperty *cp;
23690 GList *l;
23691 cp = NULL;
23692 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
23693 {
23694 ChangedProperty *i_cp = l->data;
23695 if (i_cp->info == info)
23696 {
23697 cp = i_cp;
23698 break;
23699 }
23700 }
23701 if (cp == NULL)
23702 {
23703 cp = g_new0 (ChangedProperty, 1);
23704 cp->prop_id = prop_id;
23705 cp->info = info;
23706 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
23707 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
23708 g_value_copy (orig_value, &cp->orig_value);
23709 }
23710}
23711
23712static void
23713flash_skeleton_notify (GObject *object,
23714 GParamSpec *pspec G_GNUC_UNUSED)
23715{
23716 FlashSkeleton *skeleton = FLASH_SKELETON (object);
23717 g_mutex_lock (&skeleton->priv->lock);
23718 if (skeleton->priv->changed_properties != NULL &&
23719 skeleton->priv->changed_properties_idle_source == NULL)
23720 {
23721 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
23722 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
23723 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _flash_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
23724 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
23725 g_source_unref (skeleton->priv->changed_properties_idle_source);
23726 }
23727 g_mutex_unlock (&skeleton->priv->lock);
23728}
23729
23730static void
23731flash_skeleton_set_property (GObject *object,
23732 guint prop_id,
23733 const GValue *value,
23734 GParamSpec *pspec)
23735{
23736 FlashSkeleton *skeleton = FLASH_SKELETON (object);
Norman James166acf42015-10-22 07:11:51 -050023737 g_assert (prop_id != 0 && prop_id - 1 < 5);
Norman James18998182015-10-11 21:54:53 -050023738 g_mutex_lock (&skeleton->priv->lock);
23739 g_object_freeze_notify (object);
23740 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
23741 {
23742 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
23743 _flash_schedule_emit_changed (skeleton, _flash_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
23744 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
23745 g_object_notify_by_pspec (object, pspec);
23746 }
23747 g_mutex_unlock (&skeleton->priv->lock);
23748 g_object_thaw_notify (object);
23749}
23750
23751static void
Norman James362a80f2015-09-14 14:04:39 -050023752flash_skeleton_init (FlashSkeleton *skeleton)
23753{
23754#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
23755 skeleton->priv = flash_skeleton_get_instance_private (skeleton);
23756#else
23757 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_FLASH_SKELETON, FlashSkeletonPrivate);
23758#endif
23759
23760 g_mutex_init (&skeleton->priv->lock);
23761 skeleton->priv->context = g_main_context_ref_thread_default ();
Norman James166acf42015-10-22 07:11:51 -050023762 skeleton->priv->properties = g_new0 (GValue, 5);
Norman James18998182015-10-11 21:54:53 -050023763 g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING);
23764 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
23765 g_value_init (&skeleton->priv->properties[2], G_TYPE_STRING);
23766 g_value_init (&skeleton->priv->properties[3], G_TYPE_STRING);
Norman James166acf42015-10-22 07:11:51 -050023767 g_value_init (&skeleton->priv->properties[4], G_TYPE_STRING);
Norman James18998182015-10-11 21:54:53 -050023768}
23769
23770static const gchar *
23771flash_skeleton_get_filename (Flash *object)
23772{
23773 FlashSkeleton *skeleton = FLASH_SKELETON (object);
23774 const gchar *value;
23775 g_mutex_lock (&skeleton->priv->lock);
23776 value = g_value_get_string (&(skeleton->priv->properties[0]));
23777 g_mutex_unlock (&skeleton->priv->lock);
23778 return value;
23779}
23780
23781static const gchar *
23782flash_skeleton_get_flasher_path (Flash *object)
23783{
23784 FlashSkeleton *skeleton = FLASH_SKELETON (object);
23785 const gchar *value;
23786 g_mutex_lock (&skeleton->priv->lock);
23787 value = g_value_get_string (&(skeleton->priv->properties[1]));
23788 g_mutex_unlock (&skeleton->priv->lock);
23789 return value;
23790}
23791
23792static const gchar *
23793flash_skeleton_get_flasher_name (Flash *object)
23794{
23795 FlashSkeleton *skeleton = FLASH_SKELETON (object);
23796 const gchar *value;
23797 g_mutex_lock (&skeleton->priv->lock);
23798 value = g_value_get_string (&(skeleton->priv->properties[2]));
23799 g_mutex_unlock (&skeleton->priv->lock);
23800 return value;
23801}
23802
23803static const gchar *
23804flash_skeleton_get_flasher_instance (Flash *object)
23805{
23806 FlashSkeleton *skeleton = FLASH_SKELETON (object);
23807 const gchar *value;
23808 g_mutex_lock (&skeleton->priv->lock);
23809 value = g_value_get_string (&(skeleton->priv->properties[3]));
23810 g_mutex_unlock (&skeleton->priv->lock);
23811 return value;
Norman James362a80f2015-09-14 14:04:39 -050023812}
23813
Norman James166acf42015-10-22 07:11:51 -050023814static const gchar *
23815flash_skeleton_get_status (Flash *object)
23816{
23817 FlashSkeleton *skeleton = FLASH_SKELETON (object);
23818 const gchar *value;
23819 g_mutex_lock (&skeleton->priv->lock);
23820 value = g_value_get_string (&(skeleton->priv->properties[4]));
23821 g_mutex_unlock (&skeleton->priv->lock);
23822 return value;
23823}
23824
Norman James362a80f2015-09-14 14:04:39 -050023825static void
23826flash_skeleton_class_init (FlashSkeletonClass *klass)
23827{
23828 GObjectClass *gobject_class;
23829 GDBusInterfaceSkeletonClass *skeleton_class;
23830
23831 gobject_class = G_OBJECT_CLASS (klass);
23832 gobject_class->finalize = flash_skeleton_finalize;
Norman James18998182015-10-11 21:54:53 -050023833 gobject_class->get_property = flash_skeleton_get_property;
23834 gobject_class->set_property = flash_skeleton_set_property;
23835 gobject_class->notify = flash_skeleton_notify;
23836
23837
23838 flash_override_properties (gobject_class, 1);
Norman James362a80f2015-09-14 14:04:39 -050023839
23840 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
23841 skeleton_class->get_info = flash_skeleton_dbus_interface_get_info;
23842 skeleton_class->get_properties = flash_skeleton_dbus_interface_get_properties;
23843 skeleton_class->flush = flash_skeleton_dbus_interface_flush;
23844 skeleton_class->get_vtable = flash_skeleton_dbus_interface_get_vtable;
23845
23846#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
23847 g_type_class_add_private (klass, sizeof (FlashSkeletonPrivate));
23848#endif
23849}
23850
23851static void
23852flash_skeleton_iface_init (FlashIface *iface)
23853{
23854 iface->updated = _flash_on_signal_updated;
Norman Jamesf066e872015-10-07 15:29:51 -050023855 iface->download = _flash_on_signal_download;
Norman James18998182015-10-11 21:54:53 -050023856 iface->get_filename = flash_skeleton_get_filename;
23857 iface->get_flasher_path = flash_skeleton_get_flasher_path;
23858 iface->get_flasher_name = flash_skeleton_get_flasher_name;
23859 iface->get_flasher_instance = flash_skeleton_get_flasher_instance;
Norman James166acf42015-10-22 07:11:51 -050023860 iface->get_status = flash_skeleton_get_status;
Norman James362a80f2015-09-14 14:04:39 -050023861}
23862
23863/**
23864 * flash_skeleton_new:
23865 *
23866 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>.
23867 *
23868 * Returns: (transfer full) (type FlashSkeleton): The skeleton object.
23869 */
23870Flash *
23871flash_skeleton_new (void)
23872{
23873 return FLASH (g_object_new (TYPE_FLASH_SKELETON, NULL));
23874}
23875
23876/* ------------------------------------------------------------------------
Norman James18998182015-10-11 21:54:53 -050023877 * Code for interface org.openbmc.FlashControl
23878 * ------------------------------------------------------------------------
23879 */
23880
23881/**
23882 * SECTION:FlashControl
23883 * @title: FlashControl
23884 * @short_description: Generated C code for the org.openbmc.FlashControl D-Bus interface
23885 *
23886 * 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.
23887 */
23888
23889/* ---- Introspection data for org.openbmc.FlashControl ---- */
23890
23891static const _ExtendedGDBusArgInfo _flash_control_method_info_flash_IN_ARG_type =
23892{
23893 {
23894 -1,
23895 (gchar *) "type",
23896 (gchar *) "s",
23897 NULL
23898 },
23899 FALSE
23900};
23901
23902static const _ExtendedGDBusArgInfo _flash_control_method_info_flash_IN_ARG_filename =
23903{
23904 {
23905 -1,
23906 (gchar *) "filename",
23907 (gchar *) "s",
23908 NULL
23909 },
23910 FALSE
23911};
23912
23913static const _ExtendedGDBusArgInfo * const _flash_control_method_info_flash_IN_ARG_pointers[] =
23914{
23915 &_flash_control_method_info_flash_IN_ARG_type,
23916 &_flash_control_method_info_flash_IN_ARG_filename,
23917 NULL
23918};
23919
23920static const _ExtendedGDBusMethodInfo _flash_control_method_info_flash =
23921{
23922 {
23923 -1,
23924 (gchar *) "flash",
23925 (GDBusArgInfo **) &_flash_control_method_info_flash_IN_ARG_pointers,
23926 NULL,
23927 NULL
23928 },
23929 "handle-flash",
23930 FALSE
23931};
23932
23933static const _ExtendedGDBusMethodInfo * const _flash_control_method_info_pointers[] =
23934{
23935 &_flash_control_method_info_flash,
23936 NULL
23937};
23938
23939static const _ExtendedGDBusArgInfo _flash_control_signal_info_done_ARG_filename =
23940{
23941 {
23942 -1,
23943 (gchar *) "filename",
23944 (gchar *) "s",
23945 NULL
23946 },
23947 FALSE
23948};
23949
23950static const _ExtendedGDBusArgInfo * const _flash_control_signal_info_done_ARG_pointers[] =
23951{
23952 &_flash_control_signal_info_done_ARG_filename,
23953 NULL
23954};
23955
23956static const _ExtendedGDBusSignalInfo _flash_control_signal_info_done =
23957{
23958 {
23959 -1,
23960 (gchar *) "Done",
23961 (GDBusArgInfo **) &_flash_control_signal_info_done_ARG_pointers,
23962 NULL
23963 },
23964 "done"
23965};
23966
23967static const _ExtendedGDBusArgInfo _flash_control_signal_info_error_ARG_filename =
23968{
23969 {
23970 -1,
23971 (gchar *) "filename",
23972 (gchar *) "s",
23973 NULL
23974 },
23975 FALSE
23976};
23977
23978static const _ExtendedGDBusArgInfo * const _flash_control_signal_info_error_ARG_pointers[] =
23979{
23980 &_flash_control_signal_info_error_ARG_filename,
23981 NULL
23982};
23983
23984static const _ExtendedGDBusSignalInfo _flash_control_signal_info_error =
23985{
23986 {
23987 -1,
23988 (gchar *) "Error",
23989 (GDBusArgInfo **) &_flash_control_signal_info_error_ARG_pointers,
23990 NULL
23991 },
23992 "error"
23993};
23994
23995static const _ExtendedGDBusArgInfo _flash_control_signal_info_progress_ARG_filename =
23996{
23997 {
23998 -1,
23999 (gchar *) "filename",
24000 (gchar *) "s",
24001 NULL
24002 },
24003 FALSE
24004};
24005
24006static const _ExtendedGDBusArgInfo _flash_control_signal_info_progress_ARG_progress =
24007{
24008 {
24009 -1,
24010 (gchar *) "progress",
24011 (gchar *) "y",
24012 NULL
24013 },
24014 FALSE
24015};
24016
24017static const _ExtendedGDBusArgInfo * const _flash_control_signal_info_progress_ARG_pointers[] =
24018{
24019 &_flash_control_signal_info_progress_ARG_filename,
24020 &_flash_control_signal_info_progress_ARG_progress,
24021 NULL
24022};
24023
24024static const _ExtendedGDBusSignalInfo _flash_control_signal_info_progress =
24025{
24026 {
24027 -1,
24028 (gchar *) "Progress",
24029 (GDBusArgInfo **) &_flash_control_signal_info_progress_ARG_pointers,
24030 NULL
24031 },
24032 "progress"
24033};
24034
24035static const _ExtendedGDBusSignalInfo * const _flash_control_signal_info_pointers[] =
24036{
24037 &_flash_control_signal_info_done,
24038 &_flash_control_signal_info_error,
24039 &_flash_control_signal_info_progress,
24040 NULL
24041};
24042
24043static const _ExtendedGDBusPropertyInfo _flash_control_property_info_filename =
24044{
24045 {
24046 -1,
24047 (gchar *) "filename",
24048 (gchar *) "s",
24049 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
24050 NULL
24051 },
24052 "filename",
24053 FALSE
24054};
24055
24056static const _ExtendedGDBusPropertyInfo _flash_control_property_info_type_ =
24057{
24058 {
24059 -1,
24060 (gchar *) "type",
24061 (gchar *) "s",
24062 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
24063 NULL
24064 },
24065 "type",
24066 FALSE
24067};
24068
24069static const _ExtendedGDBusPropertyInfo * const _flash_control_property_info_pointers[] =
24070{
24071 &_flash_control_property_info_filename,
24072 &_flash_control_property_info_type_,
24073 NULL
24074};
24075
24076static const _ExtendedGDBusInterfaceInfo _flash_control_interface_info =
24077{
24078 {
24079 -1,
24080 (gchar *) "org.openbmc.FlashControl",
24081 (GDBusMethodInfo **) &_flash_control_method_info_pointers,
24082 (GDBusSignalInfo **) &_flash_control_signal_info_pointers,
24083 (GDBusPropertyInfo **) &_flash_control_property_info_pointers,
24084 NULL
24085 },
24086 "flash-control",
24087};
24088
24089
24090/**
24091 * flash_control_interface_info:
24092 *
24093 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link> D-Bus interface.
24094 *
24095 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
24096 */
24097GDBusInterfaceInfo *
24098flash_control_interface_info (void)
24099{
24100 return (GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct;
24101}
24102
24103/**
24104 * flash_control_override_properties:
24105 * @klass: The class structure for a #GObject<!-- -->-derived class.
24106 * @property_id_begin: The property id to assign to the first overridden property.
24107 *
24108 * Overrides all #GObject properties in the #FlashControl interface for a concrete class.
24109 * The properties are overridden in the order they are defined.
24110 *
24111 * Returns: The last property id.
24112 */
24113guint
24114flash_control_override_properties (GObjectClass *klass, guint property_id_begin)
24115{
24116 g_object_class_override_property (klass, property_id_begin++, "filename");
24117 g_object_class_override_property (klass, property_id_begin++, "type");
24118 return property_id_begin - 1;
24119}
24120
24121
24122
24123/**
24124 * FlashControl:
24125 *
24126 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link>.
24127 */
24128
24129/**
24130 * FlashControlIface:
24131 * @parent_iface: The parent interface.
24132 * @handle_flash: Handler for the #FlashControl::handle-flash signal.
24133 * @get_filename: Getter for the #FlashControl:filename property.
24134 * @get_type_: Getter for the #FlashControl:type property.
24135 * @done: Handler for the #FlashControl::done signal.
24136 * @error: Handler for the #FlashControl::error signal.
24137 * @progress: Handler for the #FlashControl::progress signal.
24138 *
24139 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link>.
24140 */
24141
24142typedef FlashControlIface FlashControlInterface;
24143G_DEFINE_INTERFACE (FlashControl, flash_control, G_TYPE_OBJECT);
24144
24145static void
24146flash_control_default_init (FlashControlIface *iface)
24147{
24148 /* GObject signals for incoming D-Bus method calls: */
24149 /**
24150 * FlashControl::handle-flash:
24151 * @object: A #FlashControl.
24152 * @invocation: A #GDBusMethodInvocation.
24153 * @arg_type: Argument passed by remote caller.
24154 * @arg_filename: Argument passed by remote caller.
24155 *
24156 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-FlashControl.flash">flash()</link> D-Bus method.
24157 *
24158 * 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.
24159 *
24160 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
24161 */
24162 g_signal_new ("handle-flash",
24163 G_TYPE_FROM_INTERFACE (iface),
24164 G_SIGNAL_RUN_LAST,
24165 G_STRUCT_OFFSET (FlashControlIface, handle_flash),
24166 g_signal_accumulator_true_handled,
24167 NULL,
24168 g_cclosure_marshal_generic,
24169 G_TYPE_BOOLEAN,
24170 3,
24171 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_STRING);
24172
24173 /* GObject signals for received D-Bus signals: */
24174 /**
24175 * FlashControl::done:
24176 * @object: A #FlashControl.
24177 * @arg_filename: Argument.
24178 *
24179 * 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.
24180 *
24181 * 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.
24182 */
24183 g_signal_new ("done",
24184 G_TYPE_FROM_INTERFACE (iface),
24185 G_SIGNAL_RUN_LAST,
24186 G_STRUCT_OFFSET (FlashControlIface, done),
24187 NULL,
24188 NULL,
24189 g_cclosure_marshal_generic,
24190 G_TYPE_NONE,
24191 1, G_TYPE_STRING);
24192
24193 /**
24194 * FlashControl::error:
24195 * @object: A #FlashControl.
24196 * @arg_filename: Argument.
24197 *
24198 * 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.
24199 *
24200 * 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.
24201 */
24202 g_signal_new ("error",
24203 G_TYPE_FROM_INTERFACE (iface),
24204 G_SIGNAL_RUN_LAST,
24205 G_STRUCT_OFFSET (FlashControlIface, error),
24206 NULL,
24207 NULL,
24208 g_cclosure_marshal_generic,
24209 G_TYPE_NONE,
24210 1, G_TYPE_STRING);
24211
24212 /**
24213 * FlashControl::progress:
24214 * @object: A #FlashControl.
24215 * @arg_filename: Argument.
24216 * @arg_progress: Argument.
24217 *
24218 * 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.
24219 *
24220 * 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.
24221 */
24222 g_signal_new ("progress",
24223 G_TYPE_FROM_INTERFACE (iface),
24224 G_SIGNAL_RUN_LAST,
24225 G_STRUCT_OFFSET (FlashControlIface, progress),
24226 NULL,
24227 NULL,
24228 g_cclosure_marshal_generic,
24229 G_TYPE_NONE,
24230 2, G_TYPE_STRING, G_TYPE_UCHAR);
24231
24232 /* GObject properties for D-Bus properties: */
24233 /**
24234 * FlashControl:filename:
24235 *
24236 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-FlashControl.filename">"filename"</link>.
24237 *
24238 * 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.
24239 */
24240 g_object_interface_install_property (iface,
24241 g_param_spec_string ("filename", "filename", "filename", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
24242 /**
24243 * FlashControl:type:
24244 *
24245 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-FlashControl.type">"type"</link>.
24246 *
24247 * 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.
24248 */
24249 g_object_interface_install_property (iface,
24250 g_param_spec_string ("type", "type", "type", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
24251}
24252
24253/**
24254 * flash_control_get_filename: (skip)
24255 * @object: A #FlashControl.
24256 *
24257 * Gets the value of the <link linkend="gdbus-property-org-openbmc-FlashControl.filename">"filename"</link> D-Bus property.
24258 *
24259 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
24260 *
24261 * <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>
24262 *
24263 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
24264 */
24265const gchar *
24266flash_control_get_filename (FlashControl *object)
24267{
24268 return FLASH_CONTROL_GET_IFACE (object)->get_filename (object);
24269}
24270
24271/**
24272 * flash_control_dup_filename: (skip)
24273 * @object: A #FlashControl.
24274 *
24275 * Gets a copy 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 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
24280 */
24281gchar *
24282flash_control_dup_filename (FlashControl *object)
24283{
24284 gchar *value;
24285 g_object_get (G_OBJECT (object), "filename", &value, NULL);
24286 return value;
24287}
24288
24289/**
24290 * flash_control_set_filename: (skip)
24291 * @object: A #FlashControl.
24292 * @value: The value to set.
24293 *
24294 * Sets the <link linkend="gdbus-property-org-openbmc-FlashControl.filename">"filename"</link> D-Bus property to @value.
24295 *
24296 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
24297 */
24298void
24299flash_control_set_filename (FlashControl *object, const gchar *value)
24300{
24301 g_object_set (G_OBJECT (object), "filename", value, NULL);
24302}
24303
24304/**
24305 * flash_control_get_type_: (skip)
24306 * @object: A #FlashControl.
24307 *
24308 * Gets the value of the <link linkend="gdbus-property-org-openbmc-FlashControl.type">"type"</link> D-Bus property.
24309 *
24310 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
24311 *
24312 * <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>
24313 *
24314 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
24315 */
24316const gchar *
24317flash_control_get_type_ (FlashControl *object)
24318{
24319 return FLASH_CONTROL_GET_IFACE (object)->get_type_ (object);
24320}
24321
24322/**
24323 * flash_control_dup_type_: (skip)
24324 * @object: A #FlashControl.
24325 *
24326 * Gets a copy 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 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
24331 */
24332gchar *
24333flash_control_dup_type_ (FlashControl *object)
24334{
24335 gchar *value;
24336 g_object_get (G_OBJECT (object), "type", &value, NULL);
24337 return value;
24338}
24339
24340/**
24341 * flash_control_set_type_: (skip)
24342 * @object: A #FlashControl.
24343 * @value: The value to set.
24344 *
24345 * Sets the <link linkend="gdbus-property-org-openbmc-FlashControl.type">"type"</link> D-Bus property to @value.
24346 *
24347 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
24348 */
24349void
24350flash_control_set_type_ (FlashControl *object, const gchar *value)
24351{
24352 g_object_set (G_OBJECT (object), "type", value, NULL);
24353}
24354
24355/**
24356 * flash_control_emit_done:
24357 * @object: A #FlashControl.
24358 * @arg_filename: Argument to pass with the signal.
24359 *
24360 * Emits the <link linkend="gdbus-signal-org-openbmc-FlashControl.Done">"Done"</link> D-Bus signal.
24361 */
24362void
24363flash_control_emit_done (
24364 FlashControl *object,
24365 const gchar *arg_filename)
24366{
24367 g_signal_emit_by_name (object, "done", arg_filename);
24368}
24369
24370/**
24371 * flash_control_emit_error:
24372 * @object: A #FlashControl.
24373 * @arg_filename: Argument to pass with the signal.
24374 *
24375 * Emits the <link linkend="gdbus-signal-org-openbmc-FlashControl.Error">"Error"</link> D-Bus signal.
24376 */
24377void
24378flash_control_emit_error (
24379 FlashControl *object,
24380 const gchar *arg_filename)
24381{
24382 g_signal_emit_by_name (object, "error", arg_filename);
24383}
24384
24385/**
24386 * flash_control_emit_progress:
24387 * @object: A #FlashControl.
24388 * @arg_filename: Argument to pass with the signal.
24389 * @arg_progress: Argument to pass with the signal.
24390 *
24391 * Emits the <link linkend="gdbus-signal-org-openbmc-FlashControl.Progress">"Progress"</link> D-Bus signal.
24392 */
24393void
24394flash_control_emit_progress (
24395 FlashControl *object,
24396 const gchar *arg_filename,
24397 guchar arg_progress)
24398{
24399 g_signal_emit_by_name (object, "progress", arg_filename, arg_progress);
24400}
24401
24402/**
24403 * flash_control_call_flash:
24404 * @proxy: A #FlashControlProxy.
24405 * @arg_type: Argument to pass with the method invocation.
24406 * @arg_filename: Argument to pass with the method invocation.
24407 * @cancellable: (allow-none): A #GCancellable or %NULL.
24408 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
24409 * @user_data: User data to pass to @callback.
24410 *
24411 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-FlashControl.flash">flash()</link> D-Bus method on @proxy.
24412 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
24413 * You can then call flash_control_call_flash_finish() to get the result of the operation.
24414 *
24415 * See flash_control_call_flash_sync() for the synchronous, blocking version of this method.
24416 */
24417void
24418flash_control_call_flash (
24419 FlashControl *proxy,
24420 const gchar *arg_type,
24421 const gchar *arg_filename,
24422 GCancellable *cancellable,
24423 GAsyncReadyCallback callback,
24424 gpointer user_data)
24425{
24426 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
24427 "flash",
24428 g_variant_new ("(ss)",
24429 arg_type,
24430 arg_filename),
24431 G_DBUS_CALL_FLAGS_NONE,
24432 -1,
24433 cancellable,
24434 callback,
24435 user_data);
24436}
24437
24438/**
24439 * flash_control_call_flash_finish:
24440 * @proxy: A #FlashControlProxy.
24441 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_control_call_flash().
24442 * @error: Return location for error or %NULL.
24443 *
24444 * Finishes an operation started with flash_control_call_flash().
24445 *
24446 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
24447 */
24448gboolean
24449flash_control_call_flash_finish (
24450 FlashControl *proxy,
24451 GAsyncResult *res,
24452 GError **error)
24453{
24454 GVariant *_ret;
24455 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
24456 if (_ret == NULL)
24457 goto _out;
24458 g_variant_get (_ret,
24459 "()");
24460 g_variant_unref (_ret);
24461_out:
24462 return _ret != NULL;
24463}
24464
24465/**
24466 * flash_control_call_flash_sync:
24467 * @proxy: A #FlashControlProxy.
24468 * @arg_type: Argument to pass with the method invocation.
24469 * @arg_filename: Argument to pass with the method invocation.
24470 * @cancellable: (allow-none): A #GCancellable or %NULL.
24471 * @error: Return location for error or %NULL.
24472 *
24473 * 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.
24474 *
24475 * See flash_control_call_flash() for the asynchronous version of this method.
24476 *
24477 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
24478 */
24479gboolean
24480flash_control_call_flash_sync (
24481 FlashControl *proxy,
24482 const gchar *arg_type,
24483 const gchar *arg_filename,
24484 GCancellable *cancellable,
24485 GError **error)
24486{
24487 GVariant *_ret;
24488 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
24489 "flash",
24490 g_variant_new ("(ss)",
24491 arg_type,
24492 arg_filename),
24493 G_DBUS_CALL_FLAGS_NONE,
24494 -1,
24495 cancellable,
24496 error);
24497 if (_ret == NULL)
24498 goto _out;
24499 g_variant_get (_ret,
24500 "()");
24501 g_variant_unref (_ret);
24502_out:
24503 return _ret != NULL;
24504}
24505
24506/**
24507 * flash_control_complete_flash:
24508 * @object: A #FlashControl.
24509 * @invocation: (transfer full): A #GDBusMethodInvocation.
24510 *
24511 * 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.
24512 *
24513 * This method will free @invocation, you cannot use it afterwards.
24514 */
24515void
24516flash_control_complete_flash (
24517 FlashControl *object,
24518 GDBusMethodInvocation *invocation)
24519{
24520 g_dbus_method_invocation_return_value (invocation,
24521 g_variant_new ("()"));
24522}
24523
24524/* ------------------------------------------------------------------------ */
24525
24526/**
24527 * FlashControlProxy:
24528 *
24529 * The #FlashControlProxy structure contains only private data and should only be accessed using the provided API.
24530 */
24531
24532/**
24533 * FlashControlProxyClass:
24534 * @parent_class: The parent class.
24535 *
24536 * Class structure for #FlashControlProxy.
24537 */
24538
24539struct _FlashControlProxyPrivate
24540{
24541 GData *qdata;
24542};
24543
24544static void flash_control_proxy_iface_init (FlashControlIface *iface);
24545
24546#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
24547G_DEFINE_TYPE_WITH_CODE (FlashControlProxy, flash_control_proxy, G_TYPE_DBUS_PROXY,
24548 G_ADD_PRIVATE (FlashControlProxy)
24549 G_IMPLEMENT_INTERFACE (TYPE_FLASH_CONTROL, flash_control_proxy_iface_init));
24550
24551#else
24552G_DEFINE_TYPE_WITH_CODE (FlashControlProxy, flash_control_proxy, G_TYPE_DBUS_PROXY,
24553 G_IMPLEMENT_INTERFACE (TYPE_FLASH_CONTROL, flash_control_proxy_iface_init));
24554
24555#endif
24556static void
24557flash_control_proxy_finalize (GObject *object)
24558{
24559 FlashControlProxy *proxy = FLASH_CONTROL_PROXY (object);
24560 g_datalist_clear (&proxy->priv->qdata);
24561 G_OBJECT_CLASS (flash_control_proxy_parent_class)->finalize (object);
24562}
24563
24564static void
24565flash_control_proxy_get_property (GObject *object,
24566 guint prop_id,
24567 GValue *value,
24568 GParamSpec *pspec G_GNUC_UNUSED)
24569{
24570 const _ExtendedGDBusPropertyInfo *info;
24571 GVariant *variant;
24572 g_assert (prop_id != 0 && prop_id - 1 < 2);
24573 info = _flash_control_property_info_pointers[prop_id - 1];
24574 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
24575 if (info->use_gvariant)
24576 {
24577 g_value_set_variant (value, variant);
24578 }
24579 else
24580 {
24581 if (variant != NULL)
24582 g_dbus_gvariant_to_gvalue (variant, value);
24583 }
24584 if (variant != NULL)
24585 g_variant_unref (variant);
24586}
24587
24588static void
24589flash_control_proxy_set_property_cb (GDBusProxy *proxy,
24590 GAsyncResult *res,
24591 gpointer user_data)
24592{
24593 const _ExtendedGDBusPropertyInfo *info = user_data;
24594 GError *error;
24595 GVariant *_ret;
24596 error = NULL;
24597 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
24598 if (!_ret)
24599 {
24600 g_warning ("Error setting property '%s' on interface org.openbmc.FlashControl: %s (%s, %d)",
24601 info->parent_struct.name,
24602 error->message, g_quark_to_string (error->domain), error->code);
24603 g_error_free (error);
24604 }
24605 else
24606 {
24607 g_variant_unref (_ret);
24608 }
24609}
24610
24611static void
24612flash_control_proxy_set_property (GObject *object,
24613 guint prop_id,
24614 const GValue *value,
24615 GParamSpec *pspec G_GNUC_UNUSED)
24616{
24617 const _ExtendedGDBusPropertyInfo *info;
24618 GVariant *variant;
24619 g_assert (prop_id != 0 && prop_id - 1 < 2);
24620 info = _flash_control_property_info_pointers[prop_id - 1];
24621 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
24622 g_dbus_proxy_call (G_DBUS_PROXY (object),
24623 "org.freedesktop.DBus.Properties.Set",
24624 g_variant_new ("(ssv)", "org.openbmc.FlashControl", info->parent_struct.name, variant),
24625 G_DBUS_CALL_FLAGS_NONE,
24626 -1,
24627 NULL, (GAsyncReadyCallback) flash_control_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
24628 g_variant_unref (variant);
24629}
24630
24631static void
24632flash_control_proxy_g_signal (GDBusProxy *proxy,
24633 const gchar *sender_name G_GNUC_UNUSED,
24634 const gchar *signal_name,
24635 GVariant *parameters)
24636{
24637 _ExtendedGDBusSignalInfo *info;
24638 GVariantIter iter;
24639 GVariant *child;
24640 GValue *paramv;
24641 guint num_params;
24642 guint n;
24643 guint signal_id;
24644 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct, signal_name);
24645 if (info == NULL)
24646 return;
24647 num_params = g_variant_n_children (parameters);
24648 paramv = g_new0 (GValue, num_params + 1);
24649 g_value_init (&paramv[0], TYPE_FLASH_CONTROL);
24650 g_value_set_object (&paramv[0], proxy);
24651 g_variant_iter_init (&iter, parameters);
24652 n = 1;
24653 while ((child = g_variant_iter_next_value (&iter)) != NULL)
24654 {
24655 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
24656 if (arg_info->use_gvariant)
24657 {
24658 g_value_init (&paramv[n], G_TYPE_VARIANT);
24659 g_value_set_variant (&paramv[n], child);
24660 n++;
24661 }
24662 else
24663 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
24664 g_variant_unref (child);
24665 }
24666 signal_id = g_signal_lookup (info->signal_name, TYPE_FLASH_CONTROL);
24667 g_signal_emitv (paramv, signal_id, 0, NULL);
24668 for (n = 0; n < num_params + 1; n++)
24669 g_value_unset (&paramv[n]);
24670 g_free (paramv);
24671}
24672
24673static void
24674flash_control_proxy_g_properties_changed (GDBusProxy *_proxy,
24675 GVariant *changed_properties,
24676 const gchar *const *invalidated_properties)
24677{
24678 FlashControlProxy *proxy = FLASH_CONTROL_PROXY (_proxy);
24679 guint n;
24680 const gchar *key;
24681 GVariantIter *iter;
24682 _ExtendedGDBusPropertyInfo *info;
24683 g_variant_get (changed_properties, "a{sv}", &iter);
24684 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
24685 {
24686 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct, key);
24687 g_datalist_remove_data (&proxy->priv->qdata, key);
24688 if (info != NULL)
24689 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
24690 }
24691 g_variant_iter_free (iter);
24692 for (n = 0; invalidated_properties[n] != NULL; n++)
24693 {
24694 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct, invalidated_properties[n]);
24695 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
24696 if (info != NULL)
24697 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
24698 }
24699}
24700
24701static const gchar *
24702flash_control_proxy_get_filename (FlashControl *object)
24703{
24704 FlashControlProxy *proxy = FLASH_CONTROL_PROXY (object);
24705 GVariant *variant;
24706 const gchar *value = NULL;
24707 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "filename");
24708 if (variant != NULL)
24709 {
24710 value = g_variant_get_string (variant, NULL);
24711 g_variant_unref (variant);
24712 }
24713 return value;
24714}
24715
24716static const gchar *
24717flash_control_proxy_get_type_ (FlashControl *object)
24718{
24719 FlashControlProxy *proxy = FLASH_CONTROL_PROXY (object);
24720 GVariant *variant;
24721 const gchar *value = NULL;
24722 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "type");
24723 if (variant != NULL)
24724 {
24725 value = g_variant_get_string (variant, NULL);
24726 g_variant_unref (variant);
24727 }
24728 return value;
24729}
24730
24731static void
24732flash_control_proxy_init (FlashControlProxy *proxy)
24733{
24734#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
24735 proxy->priv = flash_control_proxy_get_instance_private (proxy);
24736#else
24737 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_FLASH_CONTROL_PROXY, FlashControlProxyPrivate);
24738#endif
24739
24740 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), flash_control_interface_info ());
24741}
24742
24743static void
24744flash_control_proxy_class_init (FlashControlProxyClass *klass)
24745{
24746 GObjectClass *gobject_class;
24747 GDBusProxyClass *proxy_class;
24748
24749 gobject_class = G_OBJECT_CLASS (klass);
24750 gobject_class->finalize = flash_control_proxy_finalize;
24751 gobject_class->get_property = flash_control_proxy_get_property;
24752 gobject_class->set_property = flash_control_proxy_set_property;
24753
24754 proxy_class = G_DBUS_PROXY_CLASS (klass);
24755 proxy_class->g_signal = flash_control_proxy_g_signal;
24756 proxy_class->g_properties_changed = flash_control_proxy_g_properties_changed;
24757
24758 flash_control_override_properties (gobject_class, 1);
24759
24760#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
24761 g_type_class_add_private (klass, sizeof (FlashControlProxyPrivate));
24762#endif
24763}
24764
24765static void
24766flash_control_proxy_iface_init (FlashControlIface *iface)
24767{
24768 iface->get_filename = flash_control_proxy_get_filename;
24769 iface->get_type_ = flash_control_proxy_get_type_;
24770}
24771
24772/**
24773 * flash_control_proxy_new:
24774 * @connection: A #GDBusConnection.
24775 * @flags: Flags from the #GDBusProxyFlags enumeration.
24776 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
24777 * @object_path: An object path.
24778 * @cancellable: (allow-none): A #GCancellable or %NULL.
24779 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
24780 * @user_data: User data to pass to @callback.
24781 *
24782 * 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.
24783 *
24784 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
24785 * You can then call flash_control_proxy_new_finish() to get the result of the operation.
24786 *
24787 * See flash_control_proxy_new_sync() for the synchronous, blocking version of this constructor.
24788 */
24789void
24790flash_control_proxy_new (
24791 GDBusConnection *connection,
24792 GDBusProxyFlags flags,
24793 const gchar *name,
24794 const gchar *object_path,
24795 GCancellable *cancellable,
24796 GAsyncReadyCallback callback,
24797 gpointer user_data)
24798{
24799 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);
24800}
24801
24802/**
24803 * flash_control_proxy_new_finish:
24804 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_control_proxy_new().
24805 * @error: Return location for error or %NULL
24806 *
24807 * Finishes an operation started with flash_control_proxy_new().
24808 *
24809 * Returns: (transfer full) (type FlashControlProxy): The constructed proxy object or %NULL if @error is set.
24810 */
24811FlashControl *
24812flash_control_proxy_new_finish (
24813 GAsyncResult *res,
24814 GError **error)
24815{
24816 GObject *ret;
24817 GObject *source_object;
24818 source_object = g_async_result_get_source_object (res);
24819 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
24820 g_object_unref (source_object);
24821 if (ret != NULL)
24822 return FLASH_CONTROL (ret);
24823 else
24824 return NULL;
24825}
24826
24827/**
24828 * flash_control_proxy_new_sync:
24829 * @connection: A #GDBusConnection.
24830 * @flags: Flags from the #GDBusProxyFlags enumeration.
24831 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
24832 * @object_path: An object path.
24833 * @cancellable: (allow-none): A #GCancellable or %NULL.
24834 * @error: Return location for error or %NULL
24835 *
24836 * 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.
24837 *
24838 * The calling thread is blocked until a reply is received.
24839 *
24840 * See flash_control_proxy_new() for the asynchronous version of this constructor.
24841 *
24842 * Returns: (transfer full) (type FlashControlProxy): The constructed proxy object or %NULL if @error is set.
24843 */
24844FlashControl *
24845flash_control_proxy_new_sync (
24846 GDBusConnection *connection,
24847 GDBusProxyFlags flags,
24848 const gchar *name,
24849 const gchar *object_path,
24850 GCancellable *cancellable,
24851 GError **error)
24852{
24853 GInitable *ret;
24854 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);
24855 if (ret != NULL)
24856 return FLASH_CONTROL (ret);
24857 else
24858 return NULL;
24859}
24860
24861
24862/**
24863 * flash_control_proxy_new_for_bus:
24864 * @bus_type: A #GBusType.
24865 * @flags: Flags from the #GDBusProxyFlags enumeration.
24866 * @name: A bus name (well-known or unique).
24867 * @object_path: An object path.
24868 * @cancellable: (allow-none): A #GCancellable or %NULL.
24869 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
24870 * @user_data: User data to pass to @callback.
24871 *
24872 * Like flash_control_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
24873 *
24874 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
24875 * You can then call flash_control_proxy_new_for_bus_finish() to get the result of the operation.
24876 *
24877 * See flash_control_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
24878 */
24879void
24880flash_control_proxy_new_for_bus (
24881 GBusType bus_type,
24882 GDBusProxyFlags flags,
24883 const gchar *name,
24884 const gchar *object_path,
24885 GCancellable *cancellable,
24886 GAsyncReadyCallback callback,
24887 gpointer user_data)
24888{
24889 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);
24890}
24891
24892/**
24893 * flash_control_proxy_new_for_bus_finish:
24894 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_control_proxy_new_for_bus().
24895 * @error: Return location for error or %NULL
24896 *
24897 * Finishes an operation started with flash_control_proxy_new_for_bus().
24898 *
24899 * Returns: (transfer full) (type FlashControlProxy): The constructed proxy object or %NULL if @error is set.
24900 */
24901FlashControl *
24902flash_control_proxy_new_for_bus_finish (
24903 GAsyncResult *res,
24904 GError **error)
24905{
24906 GObject *ret;
24907 GObject *source_object;
24908 source_object = g_async_result_get_source_object (res);
24909 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
24910 g_object_unref (source_object);
24911 if (ret != NULL)
24912 return FLASH_CONTROL (ret);
24913 else
24914 return NULL;
24915}
24916
24917/**
24918 * flash_control_proxy_new_for_bus_sync:
24919 * @bus_type: A #GBusType.
24920 * @flags: Flags from the #GDBusProxyFlags enumeration.
24921 * @name: A bus name (well-known or unique).
24922 * @object_path: An object path.
24923 * @cancellable: (allow-none): A #GCancellable or %NULL.
24924 * @error: Return location for error or %NULL
24925 *
24926 * Like flash_control_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
24927 *
24928 * The calling thread is blocked until a reply is received.
24929 *
24930 * See flash_control_proxy_new_for_bus() for the asynchronous version of this constructor.
24931 *
24932 * Returns: (transfer full) (type FlashControlProxy): The constructed proxy object or %NULL if @error is set.
24933 */
24934FlashControl *
24935flash_control_proxy_new_for_bus_sync (
24936 GBusType bus_type,
24937 GDBusProxyFlags flags,
24938 const gchar *name,
24939 const gchar *object_path,
24940 GCancellable *cancellable,
24941 GError **error)
24942{
24943 GInitable *ret;
24944 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);
24945 if (ret != NULL)
24946 return FLASH_CONTROL (ret);
24947 else
24948 return NULL;
24949}
24950
24951
24952/* ------------------------------------------------------------------------ */
24953
24954/**
24955 * FlashControlSkeleton:
24956 *
24957 * The #FlashControlSkeleton structure contains only private data and should only be accessed using the provided API.
24958 */
24959
24960/**
24961 * FlashControlSkeletonClass:
24962 * @parent_class: The parent class.
24963 *
24964 * Class structure for #FlashControlSkeleton.
24965 */
24966
24967struct _FlashControlSkeletonPrivate
24968{
24969 GValue *properties;
24970 GList *changed_properties;
24971 GSource *changed_properties_idle_source;
24972 GMainContext *context;
24973 GMutex lock;
24974};
24975
24976static void
24977_flash_control_skeleton_handle_method_call (
24978 GDBusConnection *connection G_GNUC_UNUSED,
24979 const gchar *sender G_GNUC_UNUSED,
24980 const gchar *object_path G_GNUC_UNUSED,
24981 const gchar *interface_name,
24982 const gchar *method_name,
24983 GVariant *parameters,
24984 GDBusMethodInvocation *invocation,
24985 gpointer user_data)
24986{
24987 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (user_data);
24988 _ExtendedGDBusMethodInfo *info;
24989 GVariantIter iter;
24990 GVariant *child;
24991 GValue *paramv;
24992 guint num_params;
24993 guint num_extra;
24994 guint n;
24995 guint signal_id;
24996 GValue return_value = G_VALUE_INIT;
24997 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
24998 g_assert (info != NULL);
24999 num_params = g_variant_n_children (parameters);
25000 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
25001 n = 0;
25002 g_value_init (&paramv[n], TYPE_FLASH_CONTROL);
25003 g_value_set_object (&paramv[n++], skeleton);
25004 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
25005 g_value_set_object (&paramv[n++], invocation);
25006 if (info->pass_fdlist)
25007 {
25008#ifdef G_OS_UNIX
25009 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
25010 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
25011#else
25012 g_assert_not_reached ();
25013#endif
25014 }
25015 g_variant_iter_init (&iter, parameters);
25016 while ((child = g_variant_iter_next_value (&iter)) != NULL)
25017 {
25018 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
25019 if (arg_info->use_gvariant)
25020 {
25021 g_value_init (&paramv[n], G_TYPE_VARIANT);
25022 g_value_set_variant (&paramv[n], child);
25023 n++;
25024 }
25025 else
25026 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
25027 g_variant_unref (child);
25028 }
25029 signal_id = g_signal_lookup (info->signal_name, TYPE_FLASH_CONTROL);
25030 g_value_init (&return_value, G_TYPE_BOOLEAN);
25031 g_signal_emitv (paramv, signal_id, 0, &return_value);
25032 if (!g_value_get_boolean (&return_value))
25033 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);
25034 g_value_unset (&return_value);
25035 for (n = 0; n < num_params + num_extra; n++)
25036 g_value_unset (&paramv[n]);
25037 g_free (paramv);
25038}
25039
25040static GVariant *
25041_flash_control_skeleton_handle_get_property (
25042 GDBusConnection *connection G_GNUC_UNUSED,
25043 const gchar *sender G_GNUC_UNUSED,
25044 const gchar *object_path G_GNUC_UNUSED,
25045 const gchar *interface_name G_GNUC_UNUSED,
25046 const gchar *property_name,
25047 GError **error,
25048 gpointer user_data)
25049{
25050 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (user_data);
25051 GValue value = G_VALUE_INIT;
25052 GParamSpec *pspec;
25053 _ExtendedGDBusPropertyInfo *info;
25054 GVariant *ret;
25055 ret = NULL;
25056 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct, property_name);
25057 g_assert (info != NULL);
25058 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
25059 if (pspec == NULL)
25060 {
25061 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
25062 }
25063 else
25064 {
25065 g_value_init (&value, pspec->value_type);
25066 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
25067 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
25068 g_value_unset (&value);
25069 }
25070 return ret;
25071}
25072
25073static gboolean
25074_flash_control_skeleton_handle_set_property (
25075 GDBusConnection *connection G_GNUC_UNUSED,
25076 const gchar *sender G_GNUC_UNUSED,
25077 const gchar *object_path G_GNUC_UNUSED,
25078 const gchar *interface_name G_GNUC_UNUSED,
25079 const gchar *property_name,
25080 GVariant *variant,
25081 GError **error,
25082 gpointer user_data)
25083{
25084 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (user_data);
25085 GValue value = G_VALUE_INIT;
25086 GParamSpec *pspec;
25087 _ExtendedGDBusPropertyInfo *info;
25088 gboolean ret;
25089 ret = FALSE;
25090 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct, property_name);
25091 g_assert (info != NULL);
25092 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
25093 if (pspec == NULL)
25094 {
25095 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
25096 }
25097 else
25098 {
25099 if (info->use_gvariant)
25100 g_value_set_variant (&value, variant);
25101 else
25102 g_dbus_gvariant_to_gvalue (variant, &value);
25103 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
25104 g_value_unset (&value);
25105 ret = TRUE;
25106 }
25107 return ret;
25108}
25109
25110static const GDBusInterfaceVTable _flash_control_skeleton_vtable =
25111{
25112 _flash_control_skeleton_handle_method_call,
25113 _flash_control_skeleton_handle_get_property,
25114 _flash_control_skeleton_handle_set_property,
25115 {NULL}
25116};
25117
25118static GDBusInterfaceInfo *
25119flash_control_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
25120{
25121 return flash_control_interface_info ();
25122}
25123
25124static GDBusInterfaceVTable *
25125flash_control_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
25126{
25127 return (GDBusInterfaceVTable *) &_flash_control_skeleton_vtable;
25128}
25129
25130static GVariant *
25131flash_control_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
25132{
25133 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (_skeleton);
25134
25135 GVariantBuilder builder;
25136 guint n;
25137 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
25138 if (_flash_control_interface_info.parent_struct.properties == NULL)
25139 goto out;
25140 for (n = 0; _flash_control_interface_info.parent_struct.properties[n] != NULL; n++)
25141 {
25142 GDBusPropertyInfo *info = _flash_control_interface_info.parent_struct.properties[n];
25143 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
25144 {
25145 GVariant *value;
25146 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);
25147 if (value != NULL)
25148 {
25149 g_variant_take_ref (value);
25150 g_variant_builder_add (&builder, "{sv}", info->name, value);
25151 g_variant_unref (value);
25152 }
25153 }
25154 }
25155out:
25156 return g_variant_builder_end (&builder);
25157}
25158
25159static gboolean _flash_control_emit_changed (gpointer user_data);
25160
25161static void
25162flash_control_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
25163{
25164 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (_skeleton);
25165 gboolean emit_changed = FALSE;
25166
25167 g_mutex_lock (&skeleton->priv->lock);
25168 if (skeleton->priv->changed_properties_idle_source != NULL)
25169 {
25170 g_source_destroy (skeleton->priv->changed_properties_idle_source);
25171 skeleton->priv->changed_properties_idle_source = NULL;
25172 emit_changed = TRUE;
25173 }
25174 g_mutex_unlock (&skeleton->priv->lock);
25175
25176 if (emit_changed)
25177 _flash_control_emit_changed (skeleton);
25178}
25179
25180static void
25181_flash_control_on_signal_done (
25182 FlashControl *object,
25183 const gchar *arg_filename)
25184{
25185 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
25186
25187 GList *connections, *l;
25188 GVariant *signal_variant;
25189 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
25190
25191 signal_variant = g_variant_ref_sink (g_variant_new ("(s)",
25192 arg_filename));
25193 for (l = connections; l != NULL; l = l->next)
25194 {
25195 GDBusConnection *connection = l->data;
25196 g_dbus_connection_emit_signal (connection,
25197 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.FlashControl", "Done",
25198 signal_variant, NULL);
25199 }
25200 g_variant_unref (signal_variant);
25201 g_list_free_full (connections, g_object_unref);
25202}
25203
25204static void
25205_flash_control_on_signal_error (
25206 FlashControl *object,
25207 const gchar *arg_filename)
25208{
25209 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
25210
25211 GList *connections, *l;
25212 GVariant *signal_variant;
25213 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
25214
25215 signal_variant = g_variant_ref_sink (g_variant_new ("(s)",
25216 arg_filename));
25217 for (l = connections; l != NULL; l = l->next)
25218 {
25219 GDBusConnection *connection = l->data;
25220 g_dbus_connection_emit_signal (connection,
25221 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.FlashControl", "Error",
25222 signal_variant, NULL);
25223 }
25224 g_variant_unref (signal_variant);
25225 g_list_free_full (connections, g_object_unref);
25226}
25227
25228static void
25229_flash_control_on_signal_progress (
25230 FlashControl *object,
25231 const gchar *arg_filename,
25232 guchar arg_progress)
25233{
25234 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
25235
25236 GList *connections, *l;
25237 GVariant *signal_variant;
25238 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
25239
25240 signal_variant = g_variant_ref_sink (g_variant_new ("(sy)",
25241 arg_filename,
25242 arg_progress));
25243 for (l = connections; l != NULL; l = l->next)
25244 {
25245 GDBusConnection *connection = l->data;
25246 g_dbus_connection_emit_signal (connection,
25247 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.FlashControl", "Progress",
25248 signal_variant, NULL);
25249 }
25250 g_variant_unref (signal_variant);
25251 g_list_free_full (connections, g_object_unref);
25252}
25253
25254static void flash_control_skeleton_iface_init (FlashControlIface *iface);
25255#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
25256G_DEFINE_TYPE_WITH_CODE (FlashControlSkeleton, flash_control_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
25257 G_ADD_PRIVATE (FlashControlSkeleton)
25258 G_IMPLEMENT_INTERFACE (TYPE_FLASH_CONTROL, flash_control_skeleton_iface_init));
25259
25260#else
25261G_DEFINE_TYPE_WITH_CODE (FlashControlSkeleton, flash_control_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
25262 G_IMPLEMENT_INTERFACE (TYPE_FLASH_CONTROL, flash_control_skeleton_iface_init));
25263
25264#endif
25265static void
25266flash_control_skeleton_finalize (GObject *object)
25267{
25268 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
25269 guint n;
25270 for (n = 0; n < 2; n++)
25271 g_value_unset (&skeleton->priv->properties[n]);
25272 g_free (skeleton->priv->properties);
25273 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
25274 if (skeleton->priv->changed_properties_idle_source != NULL)
25275 g_source_destroy (skeleton->priv->changed_properties_idle_source);
25276 g_main_context_unref (skeleton->priv->context);
25277 g_mutex_clear (&skeleton->priv->lock);
25278 G_OBJECT_CLASS (flash_control_skeleton_parent_class)->finalize (object);
25279}
25280
25281static void
25282flash_control_skeleton_get_property (GObject *object,
25283 guint prop_id,
25284 GValue *value,
25285 GParamSpec *pspec G_GNUC_UNUSED)
25286{
25287 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
25288 g_assert (prop_id != 0 && prop_id - 1 < 2);
25289 g_mutex_lock (&skeleton->priv->lock);
25290 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
25291 g_mutex_unlock (&skeleton->priv->lock);
25292}
25293
25294static gboolean
25295_flash_control_emit_changed (gpointer user_data)
25296{
25297 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (user_data);
25298 GList *l;
25299 GVariantBuilder builder;
25300 GVariantBuilder invalidated_builder;
25301 guint num_changes;
25302
25303 g_mutex_lock (&skeleton->priv->lock);
25304 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
25305 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
25306 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
25307 {
25308 ChangedProperty *cp = l->data;
25309 GVariant *variant;
25310 const GValue *cur_value;
25311
25312 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
25313 if (!_g_value_equal (cur_value, &cp->orig_value))
25314 {
25315 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
25316 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
25317 g_variant_unref (variant);
25318 num_changes++;
25319 }
25320 }
25321 if (num_changes > 0)
25322 {
25323 GList *connections, *ll;
25324 GVariant *signal_variant;
25325 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.FlashControl",
25326 &builder, &invalidated_builder));
25327 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
25328 for (ll = connections; ll != NULL; ll = ll->next)
25329 {
25330 GDBusConnection *connection = ll->data;
25331
25332 g_dbus_connection_emit_signal (connection,
25333 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
25334 "org.freedesktop.DBus.Properties",
25335 "PropertiesChanged",
25336 signal_variant,
25337 NULL);
25338 }
25339 g_variant_unref (signal_variant);
25340 g_list_free_full (connections, g_object_unref);
25341 }
25342 else
25343 {
25344 g_variant_builder_clear (&builder);
25345 g_variant_builder_clear (&invalidated_builder);
25346 }
25347 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
25348 skeleton->priv->changed_properties = NULL;
25349 skeleton->priv->changed_properties_idle_source = NULL;
25350 g_mutex_unlock (&skeleton->priv->lock);
25351 return FALSE;
25352}
25353
25354static void
25355_flash_control_schedule_emit_changed (FlashControlSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
25356{
25357 ChangedProperty *cp;
25358 GList *l;
25359 cp = NULL;
25360 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
25361 {
25362 ChangedProperty *i_cp = l->data;
25363 if (i_cp->info == info)
25364 {
25365 cp = i_cp;
25366 break;
25367 }
25368 }
25369 if (cp == NULL)
25370 {
25371 cp = g_new0 (ChangedProperty, 1);
25372 cp->prop_id = prop_id;
25373 cp->info = info;
25374 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
25375 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
25376 g_value_copy (orig_value, &cp->orig_value);
25377 }
25378}
25379
25380static void
25381flash_control_skeleton_notify (GObject *object,
25382 GParamSpec *pspec G_GNUC_UNUSED)
25383{
25384 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
25385 g_mutex_lock (&skeleton->priv->lock);
25386 if (skeleton->priv->changed_properties != NULL &&
25387 skeleton->priv->changed_properties_idle_source == NULL)
25388 {
25389 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
25390 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
25391 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _flash_control_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
25392 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
25393 g_source_unref (skeleton->priv->changed_properties_idle_source);
25394 }
25395 g_mutex_unlock (&skeleton->priv->lock);
25396}
25397
25398static void
25399flash_control_skeleton_set_property (GObject *object,
25400 guint prop_id,
25401 const GValue *value,
25402 GParamSpec *pspec)
25403{
25404 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
25405 g_assert (prop_id != 0 && prop_id - 1 < 2);
25406 g_mutex_lock (&skeleton->priv->lock);
25407 g_object_freeze_notify (object);
25408 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
25409 {
25410 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
25411 _flash_control_schedule_emit_changed (skeleton, _flash_control_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
25412 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
25413 g_object_notify_by_pspec (object, pspec);
25414 }
25415 g_mutex_unlock (&skeleton->priv->lock);
25416 g_object_thaw_notify (object);
25417}
25418
25419static void
25420flash_control_skeleton_init (FlashControlSkeleton *skeleton)
25421{
25422#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
25423 skeleton->priv = flash_control_skeleton_get_instance_private (skeleton);
25424#else
25425 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_FLASH_CONTROL_SKELETON, FlashControlSkeletonPrivate);
25426#endif
25427
25428 g_mutex_init (&skeleton->priv->lock);
25429 skeleton->priv->context = g_main_context_ref_thread_default ();
25430 skeleton->priv->properties = g_new0 (GValue, 2);
25431 g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING);
25432 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
25433}
25434
25435static const gchar *
25436flash_control_skeleton_get_filename (FlashControl *object)
25437{
25438 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
25439 const gchar *value;
25440 g_mutex_lock (&skeleton->priv->lock);
25441 value = g_value_get_string (&(skeleton->priv->properties[0]));
25442 g_mutex_unlock (&skeleton->priv->lock);
25443 return value;
25444}
25445
25446static const gchar *
25447flash_control_skeleton_get_type_ (FlashControl *object)
25448{
25449 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
25450 const gchar *value;
25451 g_mutex_lock (&skeleton->priv->lock);
25452 value = g_value_get_string (&(skeleton->priv->properties[1]));
25453 g_mutex_unlock (&skeleton->priv->lock);
25454 return value;
25455}
25456
25457static void
25458flash_control_skeleton_class_init (FlashControlSkeletonClass *klass)
25459{
25460 GObjectClass *gobject_class;
25461 GDBusInterfaceSkeletonClass *skeleton_class;
25462
25463 gobject_class = G_OBJECT_CLASS (klass);
25464 gobject_class->finalize = flash_control_skeleton_finalize;
25465 gobject_class->get_property = flash_control_skeleton_get_property;
25466 gobject_class->set_property = flash_control_skeleton_set_property;
25467 gobject_class->notify = flash_control_skeleton_notify;
25468
25469
25470 flash_control_override_properties (gobject_class, 1);
25471
25472 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
25473 skeleton_class->get_info = flash_control_skeleton_dbus_interface_get_info;
25474 skeleton_class->get_properties = flash_control_skeleton_dbus_interface_get_properties;
25475 skeleton_class->flush = flash_control_skeleton_dbus_interface_flush;
25476 skeleton_class->get_vtable = flash_control_skeleton_dbus_interface_get_vtable;
25477
25478#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
25479 g_type_class_add_private (klass, sizeof (FlashControlSkeletonPrivate));
25480#endif
25481}
25482
25483static void
25484flash_control_skeleton_iface_init (FlashControlIface *iface)
25485{
25486 iface->done = _flash_control_on_signal_done;
25487 iface->error = _flash_control_on_signal_error;
25488 iface->progress = _flash_control_on_signal_progress;
25489 iface->get_filename = flash_control_skeleton_get_filename;
25490 iface->get_type_ = flash_control_skeleton_get_type_;
25491}
25492
25493/**
25494 * flash_control_skeleton_new:
25495 *
25496 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link>.
25497 *
25498 * Returns: (transfer full) (type FlashControlSkeleton): The skeleton object.
25499 */
25500FlashControl *
25501flash_control_skeleton_new (void)
25502{
25503 return FLASH_CONTROL (g_object_new (TYPE_FLASH_CONTROL_SKELETON, NULL));
25504}
25505
25506/* ------------------------------------------------------------------------
Norman James362a80f2015-09-14 14:04:39 -050025507 * Code for interface org.openbmc.Button
25508 * ------------------------------------------------------------------------
25509 */
25510
25511/**
25512 * SECTION:Button
25513 * @title: Button
25514 * @short_description: Generated C code for the org.openbmc.Button D-Bus interface
25515 *
25516 * 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.
25517 */
25518
25519/* ---- Introspection data for org.openbmc.Button ---- */
25520
25521static const _ExtendedGDBusArgInfo _button_method_info_is_on_OUT_ARG_state =
25522{
25523 {
25524 -1,
25525 (gchar *) "state",
25526 (gchar *) "b",
25527 NULL
25528 },
25529 FALSE
25530};
25531
25532static const _ExtendedGDBusArgInfo * const _button_method_info_is_on_OUT_ARG_pointers[] =
25533{
25534 &_button_method_info_is_on_OUT_ARG_state,
25535 NULL
25536};
25537
25538static const _ExtendedGDBusMethodInfo _button_method_info_is_on =
25539{
25540 {
25541 -1,
25542 (gchar *) "isOn",
25543 NULL,
25544 (GDBusArgInfo **) &_button_method_info_is_on_OUT_ARG_pointers,
25545 NULL
25546 },
25547 "handle-is-on",
25548 FALSE
25549};
25550
Norman James493996c2015-10-31 17:27:13 -050025551static const _ExtendedGDBusMethodInfo _button_method_info_sim_press =
Norman James362a80f2015-09-14 14:04:39 -050025552{
25553 {
25554 -1,
Norman James493996c2015-10-31 17:27:13 -050025555 (gchar *) "simPress",
Norman James362a80f2015-09-14 14:04:39 -050025556 NULL,
25557 NULL,
25558 NULL
25559 },
Norman James493996c2015-10-31 17:27:13 -050025560 "handle-sim-press",
Norman James362a80f2015-09-14 14:04:39 -050025561 FALSE
25562};
25563
Norman James493996c2015-10-31 17:27:13 -050025564static const _ExtendedGDBusMethodInfo _button_method_info_sim_long_press =
Norman James362a80f2015-09-14 14:04:39 -050025565{
25566 {
25567 -1,
Norman James493996c2015-10-31 17:27:13 -050025568 (gchar *) "simLongPress",
Norman James362a80f2015-09-14 14:04:39 -050025569 NULL,
25570 NULL,
25571 NULL
25572 },
Norman James493996c2015-10-31 17:27:13 -050025573 "handle-sim-long-press",
Norman James362a80f2015-09-14 14:04:39 -050025574 FALSE
25575};
25576
25577static const _ExtendedGDBusMethodInfo * const _button_method_info_pointers[] =
25578{
25579 &_button_method_info_is_on,
Norman James493996c2015-10-31 17:27:13 -050025580 &_button_method_info_sim_press,
25581 &_button_method_info_sim_long_press,
Norman James362a80f2015-09-14 14:04:39 -050025582 NULL
25583};
25584
Norman James493996c2015-10-31 17:27:13 -050025585static const _ExtendedGDBusSignalInfo _button_signal_info_released =
Norman James362a80f2015-09-14 14:04:39 -050025586{
25587 {
25588 -1,
Norman James493996c2015-10-31 17:27:13 -050025589 (gchar *) "Released",
Norman James362a80f2015-09-14 14:04:39 -050025590 NULL,
25591 NULL
25592 },
Norman James493996c2015-10-31 17:27:13 -050025593 "released"
Norman James362a80f2015-09-14 14:04:39 -050025594};
25595
Norman James493996c2015-10-31 17:27:13 -050025596static const _ExtendedGDBusSignalInfo _button_signal_info_pressed =
Norman James362a80f2015-09-14 14:04:39 -050025597{
25598 {
25599 -1,
Norman James493996c2015-10-31 17:27:13 -050025600 (gchar *) "Pressed",
Norman James362a80f2015-09-14 14:04:39 -050025601 NULL,
25602 NULL
25603 },
Norman James493996c2015-10-31 17:27:13 -050025604 "pressed"
Norman James362a80f2015-09-14 14:04:39 -050025605};
25606
Norman James493996c2015-10-31 17:27:13 -050025607static const _ExtendedGDBusSignalInfo _button_signal_info_pressed_long =
Norman James362a80f2015-09-14 14:04:39 -050025608{
25609 {
25610 -1,
Norman James493996c2015-10-31 17:27:13 -050025611 (gchar *) "PressedLong",
Norman James362a80f2015-09-14 14:04:39 -050025612 NULL,
25613 NULL
25614 },
Norman James493996c2015-10-31 17:27:13 -050025615 "pressed-long"
Norman James362a80f2015-09-14 14:04:39 -050025616};
25617
25618static const _ExtendedGDBusSignalInfo * const _button_signal_info_pointers[] =
25619{
Norman James493996c2015-10-31 17:27:13 -050025620 &_button_signal_info_released,
25621 &_button_signal_info_pressed,
25622 &_button_signal_info_pressed_long,
Norman James362a80f2015-09-14 14:04:39 -050025623 NULL
25624};
25625
25626static const _ExtendedGDBusPropertyInfo _button_property_info_state =
25627{
25628 {
25629 -1,
25630 (gchar *) "state",
25631 (gchar *) "b",
25632 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
25633 NULL
25634 },
25635 "state",
25636 FALSE
25637};
25638
Norman James493996c2015-10-31 17:27:13 -050025639static const _ExtendedGDBusPropertyInfo _button_property_info_timer =
25640{
25641 {
25642 -1,
25643 (gchar *) "timer",
25644 (gchar *) "t",
25645 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
25646 NULL
25647 },
25648 "timer",
25649 FALSE
25650};
25651
Norman James362a80f2015-09-14 14:04:39 -050025652static const _ExtendedGDBusPropertyInfo * const _button_property_info_pointers[] =
25653{
25654 &_button_property_info_state,
Norman James493996c2015-10-31 17:27:13 -050025655 &_button_property_info_timer,
Norman James362a80f2015-09-14 14:04:39 -050025656 NULL
25657};
25658
25659static const _ExtendedGDBusInterfaceInfo _button_interface_info =
25660{
25661 {
25662 -1,
25663 (gchar *) "org.openbmc.Button",
25664 (GDBusMethodInfo **) &_button_method_info_pointers,
25665 (GDBusSignalInfo **) &_button_signal_info_pointers,
25666 (GDBusPropertyInfo **) &_button_property_info_pointers,
25667 NULL
25668 },
25669 "button",
25670};
25671
25672
25673/**
25674 * button_interface_info:
25675 *
25676 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link> D-Bus interface.
25677 *
25678 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
25679 */
25680GDBusInterfaceInfo *
25681button_interface_info (void)
25682{
25683 return (GDBusInterfaceInfo *) &_button_interface_info.parent_struct;
25684}
25685
25686/**
25687 * button_override_properties:
25688 * @klass: The class structure for a #GObject<!-- -->-derived class.
25689 * @property_id_begin: The property id to assign to the first overridden property.
25690 *
25691 * Overrides all #GObject properties in the #Button interface for a concrete class.
25692 * The properties are overridden in the order they are defined.
25693 *
25694 * Returns: The last property id.
25695 */
25696guint
25697button_override_properties (GObjectClass *klass, guint property_id_begin)
25698{
25699 g_object_class_override_property (klass, property_id_begin++, "state");
Norman James493996c2015-10-31 17:27:13 -050025700 g_object_class_override_property (klass, property_id_begin++, "timer");
Norman James362a80f2015-09-14 14:04:39 -050025701 return property_id_begin - 1;
25702}
25703
25704
25705
25706/**
25707 * Button:
25708 *
25709 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link>.
25710 */
25711
25712/**
25713 * ButtonIface:
25714 * @parent_iface: The parent interface.
25715 * @handle_is_on: Handler for the #Button::handle-is-on signal.
Norman James493996c2015-10-31 17:27:13 -050025716 * @handle_sim_long_press: Handler for the #Button::handle-sim-long-press signal.
25717 * @handle_sim_press: Handler for the #Button::handle-sim-press signal.
Norman James362a80f2015-09-14 14:04:39 -050025718 * @get_state: Getter for the #Button:state property.
Norman James493996c2015-10-31 17:27:13 -050025719 * @get_timer: Getter for the #Button:timer property.
25720 * @pressed: Handler for the #Button::pressed signal.
25721 * @pressed_long: Handler for the #Button::pressed-long signal.
25722 * @released: Handler for the #Button::released signal.
Norman James362a80f2015-09-14 14:04:39 -050025723 *
25724 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link>.
25725 */
25726
25727typedef ButtonIface ButtonInterface;
25728G_DEFINE_INTERFACE (Button, button, G_TYPE_OBJECT);
25729
25730static void
25731button_default_init (ButtonIface *iface)
25732{
25733 /* GObject signals for incoming D-Bus method calls: */
25734 /**
25735 * Button::handle-is-on:
25736 * @object: A #Button.
25737 * @invocation: A #GDBusMethodInvocation.
25738 *
25739 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Button.isOn">isOn()</link> D-Bus method.
25740 *
25741 * 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.
25742 *
25743 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
25744 */
25745 g_signal_new ("handle-is-on",
25746 G_TYPE_FROM_INTERFACE (iface),
25747 G_SIGNAL_RUN_LAST,
25748 G_STRUCT_OFFSET (ButtonIface, handle_is_on),
25749 g_signal_accumulator_true_handled,
25750 NULL,
25751 g_cclosure_marshal_generic,
25752 G_TYPE_BOOLEAN,
25753 1,
25754 G_TYPE_DBUS_METHOD_INVOCATION);
25755
25756 /**
Norman James493996c2015-10-31 17:27:13 -050025757 * Button::handle-sim-press:
Norman James362a80f2015-09-14 14:04:39 -050025758 * @object: A #Button.
25759 * @invocation: A #GDBusMethodInvocation.
25760 *
Norman James493996c2015-10-31 17:27:13 -050025761 * 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 -050025762 *
Norman James493996c2015-10-31 17:27:13 -050025763 * 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 -050025764 *
25765 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
25766 */
Norman James493996c2015-10-31 17:27:13 -050025767 g_signal_new ("handle-sim-press",
Norman James362a80f2015-09-14 14:04:39 -050025768 G_TYPE_FROM_INTERFACE (iface),
25769 G_SIGNAL_RUN_LAST,
Norman James493996c2015-10-31 17:27:13 -050025770 G_STRUCT_OFFSET (ButtonIface, handle_sim_press),
Norman James362a80f2015-09-14 14:04:39 -050025771 g_signal_accumulator_true_handled,
25772 NULL,
25773 g_cclosure_marshal_generic,
25774 G_TYPE_BOOLEAN,
25775 1,
25776 G_TYPE_DBUS_METHOD_INVOCATION);
25777
25778 /**
Norman James493996c2015-10-31 17:27:13 -050025779 * Button::handle-sim-long-press:
Norman James362a80f2015-09-14 14:04:39 -050025780 * @object: A #Button.
25781 * @invocation: A #GDBusMethodInvocation.
25782 *
Norman James493996c2015-10-31 17:27:13 -050025783 * 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 -050025784 *
Norman James493996c2015-10-31 17:27:13 -050025785 * 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 -050025786 *
25787 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
25788 */
Norman James493996c2015-10-31 17:27:13 -050025789 g_signal_new ("handle-sim-long-press",
Norman James362a80f2015-09-14 14:04:39 -050025790 G_TYPE_FROM_INTERFACE (iface),
25791 G_SIGNAL_RUN_LAST,
Norman James493996c2015-10-31 17:27:13 -050025792 G_STRUCT_OFFSET (ButtonIface, handle_sim_long_press),
Norman James362a80f2015-09-14 14:04:39 -050025793 g_signal_accumulator_true_handled,
25794 NULL,
25795 g_cclosure_marshal_generic,
25796 G_TYPE_BOOLEAN,
25797 1,
25798 G_TYPE_DBUS_METHOD_INVOCATION);
25799
25800 /* GObject signals for received D-Bus signals: */
25801 /**
Norman James493996c2015-10-31 17:27:13 -050025802 * Button::released:
Norman James362a80f2015-09-14 14:04:39 -050025803 * @object: A #Button.
25804 *
Norman James493996c2015-10-31 17:27:13 -050025805 * 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 -050025806 *
25807 * 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.
25808 */
Norman James493996c2015-10-31 17:27:13 -050025809 g_signal_new ("released",
Norman James362a80f2015-09-14 14:04:39 -050025810 G_TYPE_FROM_INTERFACE (iface),
25811 G_SIGNAL_RUN_LAST,
Norman James493996c2015-10-31 17:27:13 -050025812 G_STRUCT_OFFSET (ButtonIface, released),
Norman James362a80f2015-09-14 14:04:39 -050025813 NULL,
25814 NULL,
25815 g_cclosure_marshal_generic,
25816 G_TYPE_NONE,
25817 0);
25818
25819 /**
Norman James493996c2015-10-31 17:27:13 -050025820 * Button::pressed:
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.Pressed">"Pressed"</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 ("pressed",
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, pressed),
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-long:
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.PressedLong">"PressedLong"</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-long",
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_long),
Norman James362a80f2015-09-14 14:04:39 -050025849 NULL,
25850 NULL,
25851 g_cclosure_marshal_generic,
25852 G_TYPE_NONE,
25853 0);
25854
25855 /* GObject properties for D-Bus properties: */
25856 /**
25857 * Button:state:
25858 *
25859 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Button.state">"state"</link>.
25860 *
25861 * 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.
25862 */
25863 g_object_interface_install_property (iface,
25864 g_param_spec_boolean ("state", "state", "state", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Norman James493996c2015-10-31 17:27:13 -050025865 /**
25866 * Button:timer:
25867 *
25868 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Button.timer">"timer"</link>.
25869 *
25870 * 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.
25871 */
25872 g_object_interface_install_property (iface,
25873 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 -050025874}
25875
25876/**
25877 * button_get_state: (skip)
25878 * @object: A #Button.
25879 *
25880 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Button.state">"state"</link> D-Bus property.
25881 *
25882 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
25883 *
25884 * Returns: The property value.
25885 */
25886gboolean
25887button_get_state (Button *object)
25888{
25889 return BUTTON_GET_IFACE (object)->get_state (object);
25890}
25891
25892/**
25893 * button_set_state: (skip)
25894 * @object: A #Button.
25895 * @value: The value to set.
25896 *
25897 * Sets the <link linkend="gdbus-property-org-openbmc-Button.state">"state"</link> D-Bus property to @value.
25898 *
25899 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
25900 */
25901void
25902button_set_state (Button *object, gboolean value)
25903{
25904 g_object_set (G_OBJECT (object), "state", value, NULL);
25905}
25906
25907/**
Norman James493996c2015-10-31 17:27:13 -050025908 * button_get_timer: (skip)
Norman James362a80f2015-09-14 14:04:39 -050025909 * @object: A #Button.
25910 *
Norman James493996c2015-10-31 17:27:13 -050025911 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Button.timer">"timer"</link> D-Bus property.
25912 *
25913 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
25914 *
25915 * Returns: The property value.
Norman James362a80f2015-09-14 14:04:39 -050025916 */
Norman James493996c2015-10-31 17:27:13 -050025917guint64
25918button_get_timer (Button *object)
Norman James362a80f2015-09-14 14:04:39 -050025919{
Norman James493996c2015-10-31 17:27:13 -050025920 return BUTTON_GET_IFACE (object)->get_timer (object);
Norman James362a80f2015-09-14 14:04:39 -050025921}
25922
25923/**
Norman James493996c2015-10-31 17:27:13 -050025924 * button_set_timer: (skip)
Norman James362a80f2015-09-14 14:04:39 -050025925 * @object: A #Button.
Norman James493996c2015-10-31 17:27:13 -050025926 * @value: The value to set.
Norman James362a80f2015-09-14 14:04:39 -050025927 *
Norman James493996c2015-10-31 17:27:13 -050025928 * Sets the <link linkend="gdbus-property-org-openbmc-Button.timer">"timer"</link> D-Bus property to @value.
25929 *
25930 * 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 -050025931 */
25932void
Norman James493996c2015-10-31 17:27:13 -050025933button_set_timer (Button *object, guint64 value)
Norman James362a80f2015-09-14 14:04:39 -050025934{
Norman James493996c2015-10-31 17:27:13 -050025935 g_object_set (G_OBJECT (object), "timer", value, NULL);
Norman James362a80f2015-09-14 14:04:39 -050025936}
25937
25938/**
Norman James493996c2015-10-31 17:27:13 -050025939 * button_emit_released:
Norman James362a80f2015-09-14 14:04:39 -050025940 * @object: A #Button.
25941 *
Norman James493996c2015-10-31 17:27:13 -050025942 * Emits the <link linkend="gdbus-signal-org-openbmc-Button.Released">"Released"</link> D-Bus signal.
Norman James362a80f2015-09-14 14:04:39 -050025943 */
25944void
Norman James493996c2015-10-31 17:27:13 -050025945button_emit_released (
Norman James362a80f2015-09-14 14:04:39 -050025946 Button *object)
25947{
Norman James493996c2015-10-31 17:27:13 -050025948 g_signal_emit_by_name (object, "released");
25949}
25950
25951/**
25952 * button_emit_pressed:
25953 * @object: A #Button.
25954 *
25955 * Emits the <link linkend="gdbus-signal-org-openbmc-Button.Pressed">"Pressed"</link> D-Bus signal.
25956 */
25957void
25958button_emit_pressed (
25959 Button *object)
25960{
25961 g_signal_emit_by_name (object, "pressed");
25962}
25963
25964/**
25965 * button_emit_pressed_long:
25966 * @object: A #Button.
25967 *
25968 * Emits the <link linkend="gdbus-signal-org-openbmc-Button.PressedLong">"PressedLong"</link> D-Bus signal.
25969 */
25970void
25971button_emit_pressed_long (
25972 Button *object)
25973{
25974 g_signal_emit_by_name (object, "pressed-long");
Norman James362a80f2015-09-14 14:04:39 -050025975}
25976
25977/**
25978 * button_call_is_on:
25979 * @proxy: A #ButtonProxy.
25980 * @cancellable: (allow-none): A #GCancellable or %NULL.
25981 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
25982 * @user_data: User data to pass to @callback.
25983 *
25984 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.isOn">isOn()</link> D-Bus method on @proxy.
25985 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
25986 * You can then call button_call_is_on_finish() to get the result of the operation.
25987 *
25988 * See button_call_is_on_sync() for the synchronous, blocking version of this method.
25989 */
25990void
25991button_call_is_on (
25992 Button *proxy,
25993 GCancellable *cancellable,
25994 GAsyncReadyCallback callback,
25995 gpointer user_data)
25996{
25997 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
25998 "isOn",
25999 g_variant_new ("()"),
26000 G_DBUS_CALL_FLAGS_NONE,
26001 -1,
26002 cancellable,
26003 callback,
26004 user_data);
26005}
26006
26007/**
26008 * button_call_is_on_finish:
26009 * @proxy: A #ButtonProxy.
26010 * @out_state: (out): Return location for return parameter or %NULL to ignore.
26011 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_call_is_on().
26012 * @error: Return location for error or %NULL.
26013 *
26014 * Finishes an operation started with button_call_is_on().
26015 *
26016 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
26017 */
26018gboolean
26019button_call_is_on_finish (
26020 Button *proxy,
26021 gboolean *out_state,
26022 GAsyncResult *res,
26023 GError **error)
26024{
26025 GVariant *_ret;
26026 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
26027 if (_ret == NULL)
26028 goto _out;
26029 g_variant_get (_ret,
26030 "(b)",
26031 out_state);
26032 g_variant_unref (_ret);
26033_out:
26034 return _ret != NULL;
26035}
26036
26037/**
26038 * button_call_is_on_sync:
26039 * @proxy: A #ButtonProxy.
26040 * @out_state: (out): Return location for return parameter or %NULL to ignore.
26041 * @cancellable: (allow-none): A #GCancellable or %NULL.
26042 * @error: Return location for error or %NULL.
26043 *
26044 * 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.
26045 *
26046 * See button_call_is_on() for the asynchronous version of this method.
26047 *
26048 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
26049 */
26050gboolean
26051button_call_is_on_sync (
26052 Button *proxy,
26053 gboolean *out_state,
26054 GCancellable *cancellable,
26055 GError **error)
26056{
26057 GVariant *_ret;
26058 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
26059 "isOn",
26060 g_variant_new ("()"),
26061 G_DBUS_CALL_FLAGS_NONE,
26062 -1,
26063 cancellable,
26064 error);
26065 if (_ret == NULL)
26066 goto _out;
26067 g_variant_get (_ret,
26068 "(b)",
26069 out_state);
26070 g_variant_unref (_ret);
26071_out:
26072 return _ret != NULL;
26073}
26074
26075/**
Norman James493996c2015-10-31 17:27:13 -050026076 * button_call_sim_press:
Norman James362a80f2015-09-14 14:04:39 -050026077 * @proxy: A #ButtonProxy.
26078 * @cancellable: (allow-none): A #GCancellable or %NULL.
26079 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
26080 * @user_data: User data to pass to @callback.
26081 *
Norman James493996c2015-10-31 17:27:13 -050026082 * 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 -050026083 * When the operation is finished, @callback will be invoked 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 -050026084 * You can then call button_call_sim_press_finish() to get the result of the operation.
Norman James362a80f2015-09-14 14:04:39 -050026085 *
Norman James493996c2015-10-31 17:27:13 -050026086 * See button_call_sim_press_sync() for the synchronous, blocking version of this method.
Norman James362a80f2015-09-14 14:04:39 -050026087 */
26088void
Norman James493996c2015-10-31 17:27:13 -050026089button_call_sim_press (
Norman James362a80f2015-09-14 14:04:39 -050026090 Button *proxy,
26091 GCancellable *cancellable,
26092 GAsyncReadyCallback callback,
26093 gpointer user_data)
26094{
26095 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
Norman James493996c2015-10-31 17:27:13 -050026096 "simPress",
Norman James362a80f2015-09-14 14:04:39 -050026097 g_variant_new ("()"),
26098 G_DBUS_CALL_FLAGS_NONE,
26099 -1,
26100 cancellable,
26101 callback,
26102 user_data);
26103}
26104
26105/**
Norman James493996c2015-10-31 17:27:13 -050026106 * button_call_sim_press_finish:
Norman James362a80f2015-09-14 14:04:39 -050026107 * @proxy: A #ButtonProxy.
Norman James493996c2015-10-31 17:27:13 -050026108 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_call_sim_press().
Norman James362a80f2015-09-14 14:04:39 -050026109 * @error: Return location for error or %NULL.
26110 *
Norman James493996c2015-10-31 17:27:13 -050026111 * Finishes an operation started with button_call_sim_press().
Norman James362a80f2015-09-14 14:04:39 -050026112 *
26113 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
26114 */
26115gboolean
Norman James493996c2015-10-31 17:27:13 -050026116button_call_sim_press_finish (
Norman James362a80f2015-09-14 14:04:39 -050026117 Button *proxy,
26118 GAsyncResult *res,
26119 GError **error)
26120{
26121 GVariant *_ret;
26122 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
26123 if (_ret == NULL)
26124 goto _out;
26125 g_variant_get (_ret,
26126 "()");
26127 g_variant_unref (_ret);
26128_out:
26129 return _ret != NULL;
26130}
26131
26132/**
Norman James493996c2015-10-31 17:27:13 -050026133 * button_call_sim_press_sync:
Norman James362a80f2015-09-14 14:04:39 -050026134 * @proxy: A #ButtonProxy.
26135 * @cancellable: (allow-none): A #GCancellable or %NULL.
26136 * @error: Return location for error or %NULL.
26137 *
Norman James493996c2015-10-31 17:27:13 -050026138 * 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 -050026139 *
Norman James493996c2015-10-31 17:27:13 -050026140 * See button_call_sim_press() for the asynchronous version of this method.
Norman James362a80f2015-09-14 14:04:39 -050026141 *
26142 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
26143 */
26144gboolean
Norman James493996c2015-10-31 17:27:13 -050026145button_call_sim_press_sync (
Norman James362a80f2015-09-14 14:04:39 -050026146 Button *proxy,
26147 GCancellable *cancellable,
26148 GError **error)
26149{
26150 GVariant *_ret;
26151 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
Norman James493996c2015-10-31 17:27:13 -050026152 "simPress",
Norman James362a80f2015-09-14 14:04:39 -050026153 g_variant_new ("()"),
26154 G_DBUS_CALL_FLAGS_NONE,
26155 -1,
26156 cancellable,
26157 error);
26158 if (_ret == NULL)
26159 goto _out;
26160 g_variant_get (_ret,
26161 "()");
26162 g_variant_unref (_ret);
26163_out:
26164 return _ret != NULL;
26165}
26166
26167/**
Norman James493996c2015-10-31 17:27:13 -050026168 * button_call_sim_long_press:
Norman James362a80f2015-09-14 14:04:39 -050026169 * @proxy: A #ButtonProxy.
26170 * @cancellable: (allow-none): A #GCancellable or %NULL.
26171 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
26172 * @user_data: User data to pass to @callback.
26173 *
Norman James493996c2015-10-31 17:27:13 -050026174 * 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 -050026175 * When the operation is finished, @callback will be invoked 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 -050026176 * You can then call button_call_sim_long_press_finish() to get the result of the operation.
Norman James362a80f2015-09-14 14:04:39 -050026177 *
Norman James493996c2015-10-31 17:27:13 -050026178 * See button_call_sim_long_press_sync() for the synchronous, blocking version of this method.
Norman James362a80f2015-09-14 14:04:39 -050026179 */
26180void
Norman James493996c2015-10-31 17:27:13 -050026181button_call_sim_long_press (
Norman James362a80f2015-09-14 14:04:39 -050026182 Button *proxy,
26183 GCancellable *cancellable,
26184 GAsyncReadyCallback callback,
26185 gpointer user_data)
26186{
26187 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
Norman James493996c2015-10-31 17:27:13 -050026188 "simLongPress",
Norman James362a80f2015-09-14 14:04:39 -050026189 g_variant_new ("()"),
26190 G_DBUS_CALL_FLAGS_NONE,
26191 -1,
26192 cancellable,
26193 callback,
26194 user_data);
26195}
26196
26197/**
Norman James493996c2015-10-31 17:27:13 -050026198 * button_call_sim_long_press_finish:
Norman James362a80f2015-09-14 14:04:39 -050026199 * @proxy: A #ButtonProxy.
Norman James493996c2015-10-31 17:27:13 -050026200 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_call_sim_long_press().
Norman James362a80f2015-09-14 14:04:39 -050026201 * @error: Return location for error or %NULL.
26202 *
Norman James493996c2015-10-31 17:27:13 -050026203 * Finishes an operation started with button_call_sim_long_press().
Norman James362a80f2015-09-14 14:04:39 -050026204 *
26205 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
26206 */
26207gboolean
Norman James493996c2015-10-31 17:27:13 -050026208button_call_sim_long_press_finish (
Norman James362a80f2015-09-14 14:04:39 -050026209 Button *proxy,
26210 GAsyncResult *res,
26211 GError **error)
26212{
26213 GVariant *_ret;
26214 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
26215 if (_ret == NULL)
26216 goto _out;
26217 g_variant_get (_ret,
26218 "()");
26219 g_variant_unref (_ret);
26220_out:
26221 return _ret != NULL;
26222}
26223
26224/**
Norman James493996c2015-10-31 17:27:13 -050026225 * button_call_sim_long_press_sync:
Norman James362a80f2015-09-14 14:04:39 -050026226 * @proxy: A #ButtonProxy.
26227 * @cancellable: (allow-none): A #GCancellable or %NULL.
26228 * @error: Return location for error or %NULL.
26229 *
Norman James493996c2015-10-31 17:27:13 -050026230 * 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 -050026231 *
Norman James493996c2015-10-31 17:27:13 -050026232 * See button_call_sim_long_press() for the asynchronous version of this method.
Norman James362a80f2015-09-14 14:04:39 -050026233 *
26234 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
26235 */
26236gboolean
Norman James493996c2015-10-31 17:27:13 -050026237button_call_sim_long_press_sync (
Norman James362a80f2015-09-14 14:04:39 -050026238 Button *proxy,
26239 GCancellable *cancellable,
26240 GError **error)
26241{
26242 GVariant *_ret;
26243 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
Norman James493996c2015-10-31 17:27:13 -050026244 "simLongPress",
Norman James362a80f2015-09-14 14:04:39 -050026245 g_variant_new ("()"),
26246 G_DBUS_CALL_FLAGS_NONE,
26247 -1,
26248 cancellable,
26249 error);
26250 if (_ret == NULL)
26251 goto _out;
26252 g_variant_get (_ret,
26253 "()");
26254 g_variant_unref (_ret);
26255_out:
26256 return _ret != NULL;
26257}
26258
26259/**
26260 * button_complete_is_on:
26261 * @object: A #Button.
26262 * @invocation: (transfer full): A #GDBusMethodInvocation.
26263 * @state: Parameter to return.
26264 *
26265 * 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.
26266 *
26267 * This method will free @invocation, you cannot use it afterwards.
26268 */
26269void
26270button_complete_is_on (
26271 Button *object,
26272 GDBusMethodInvocation *invocation,
26273 gboolean state)
26274{
26275 g_dbus_method_invocation_return_value (invocation,
26276 g_variant_new ("(b)",
26277 state));
26278}
26279
26280/**
Norman James493996c2015-10-31 17:27:13 -050026281 * button_complete_sim_press:
Norman James362a80f2015-09-14 14:04:39 -050026282 * @object: A #Button.
26283 * @invocation: (transfer full): A #GDBusMethodInvocation.
26284 *
Norman James493996c2015-10-31 17:27:13 -050026285 * 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 -050026286 *
26287 * This method will free @invocation, you cannot use it afterwards.
26288 */
26289void
Norman James493996c2015-10-31 17:27:13 -050026290button_complete_sim_press (
Norman James362a80f2015-09-14 14:04:39 -050026291 Button *object,
26292 GDBusMethodInvocation *invocation)
26293{
26294 g_dbus_method_invocation_return_value (invocation,
26295 g_variant_new ("()"));
26296}
26297
26298/**
Norman James493996c2015-10-31 17:27:13 -050026299 * button_complete_sim_long_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.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 -050026304 *
26305 * This method will free @invocation, you cannot use it afterwards.
26306 */
26307void
Norman James493996c2015-10-31 17:27:13 -050026308button_complete_sim_long_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/* ------------------------------------------------------------------------ */
26317
26318/**
26319 * ButtonProxy:
26320 *
26321 * The #ButtonProxy structure contains only private data and should only be accessed using the provided API.
26322 */
26323
26324/**
26325 * ButtonProxyClass:
26326 * @parent_class: The parent class.
26327 *
26328 * Class structure for #ButtonProxy.
26329 */
26330
26331struct _ButtonProxyPrivate
26332{
26333 GData *qdata;
26334};
26335
26336static void button_proxy_iface_init (ButtonIface *iface);
26337
26338#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
26339G_DEFINE_TYPE_WITH_CODE (ButtonProxy, button_proxy, G_TYPE_DBUS_PROXY,
26340 G_ADD_PRIVATE (ButtonProxy)
26341 G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_proxy_iface_init));
26342
26343#else
26344G_DEFINE_TYPE_WITH_CODE (ButtonProxy, button_proxy, G_TYPE_DBUS_PROXY,
26345 G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_proxy_iface_init));
26346
26347#endif
26348static void
26349button_proxy_finalize (GObject *object)
26350{
26351 ButtonProxy *proxy = BUTTON_PROXY (object);
26352 g_datalist_clear (&proxy->priv->qdata);
26353 G_OBJECT_CLASS (button_proxy_parent_class)->finalize (object);
26354}
26355
26356static void
26357button_proxy_get_property (GObject *object,
26358 guint prop_id,
26359 GValue *value,
26360 GParamSpec *pspec G_GNUC_UNUSED)
26361{
26362 const _ExtendedGDBusPropertyInfo *info;
26363 GVariant *variant;
Norman James493996c2015-10-31 17:27:13 -050026364 g_assert (prop_id != 0 && prop_id - 1 < 2);
Norman James362a80f2015-09-14 14:04:39 -050026365 info = _button_property_info_pointers[prop_id - 1];
26366 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
26367 if (info->use_gvariant)
26368 {
26369 g_value_set_variant (value, variant);
26370 }
26371 else
26372 {
26373 if (variant != NULL)
26374 g_dbus_gvariant_to_gvalue (variant, value);
26375 }
26376 if (variant != NULL)
26377 g_variant_unref (variant);
26378}
26379
26380static void
26381button_proxy_set_property_cb (GDBusProxy *proxy,
26382 GAsyncResult *res,
26383 gpointer user_data)
26384{
26385 const _ExtendedGDBusPropertyInfo *info = user_data;
26386 GError *error;
26387 GVariant *_ret;
26388 error = NULL;
26389 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
26390 if (!_ret)
26391 {
26392 g_warning ("Error setting property '%s' on interface org.openbmc.Button: %s (%s, %d)",
26393 info->parent_struct.name,
26394 error->message, g_quark_to_string (error->domain), error->code);
26395 g_error_free (error);
26396 }
26397 else
26398 {
26399 g_variant_unref (_ret);
26400 }
26401}
26402
26403static void
26404button_proxy_set_property (GObject *object,
26405 guint prop_id,
26406 const GValue *value,
26407 GParamSpec *pspec G_GNUC_UNUSED)
26408{
26409 const _ExtendedGDBusPropertyInfo *info;
26410 GVariant *variant;
Norman James493996c2015-10-31 17:27:13 -050026411 g_assert (prop_id != 0 && prop_id - 1 < 2);
Norman James362a80f2015-09-14 14:04:39 -050026412 info = _button_property_info_pointers[prop_id - 1];
26413 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
26414 g_dbus_proxy_call (G_DBUS_PROXY (object),
26415 "org.freedesktop.DBus.Properties.Set",
26416 g_variant_new ("(ssv)", "org.openbmc.Button", info->parent_struct.name, variant),
26417 G_DBUS_CALL_FLAGS_NONE,
26418 -1,
26419 NULL, (GAsyncReadyCallback) button_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
26420 g_variant_unref (variant);
26421}
26422
26423static void
26424button_proxy_g_signal (GDBusProxy *proxy,
26425 const gchar *sender_name G_GNUC_UNUSED,
26426 const gchar *signal_name,
26427 GVariant *parameters)
26428{
26429 _ExtendedGDBusSignalInfo *info;
26430 GVariantIter iter;
26431 GVariant *child;
26432 GValue *paramv;
26433 guint num_params;
26434 guint n;
26435 guint signal_id;
26436 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, signal_name);
26437 if (info == NULL)
26438 return;
26439 num_params = g_variant_n_children (parameters);
26440 paramv = g_new0 (GValue, num_params + 1);
26441 g_value_init (&paramv[0], TYPE_BUTTON);
26442 g_value_set_object (&paramv[0], proxy);
26443 g_variant_iter_init (&iter, parameters);
26444 n = 1;
26445 while ((child = g_variant_iter_next_value (&iter)) != NULL)
26446 {
26447 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
26448 if (arg_info->use_gvariant)
26449 {
26450 g_value_init (&paramv[n], G_TYPE_VARIANT);
26451 g_value_set_variant (&paramv[n], child);
26452 n++;
26453 }
26454 else
26455 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
26456 g_variant_unref (child);
26457 }
26458 signal_id = g_signal_lookup (info->signal_name, TYPE_BUTTON);
26459 g_signal_emitv (paramv, signal_id, 0, NULL);
26460 for (n = 0; n < num_params + 1; n++)
26461 g_value_unset (&paramv[n]);
26462 g_free (paramv);
26463}
26464
26465static void
26466button_proxy_g_properties_changed (GDBusProxy *_proxy,
26467 GVariant *changed_properties,
26468 const gchar *const *invalidated_properties)
26469{
26470 ButtonProxy *proxy = BUTTON_PROXY (_proxy);
26471 guint n;
26472 const gchar *key;
26473 GVariantIter *iter;
26474 _ExtendedGDBusPropertyInfo *info;
26475 g_variant_get (changed_properties, "a{sv}", &iter);
26476 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
26477 {
26478 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, key);
26479 g_datalist_remove_data (&proxy->priv->qdata, key);
26480 if (info != NULL)
26481 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
26482 }
26483 g_variant_iter_free (iter);
26484 for (n = 0; invalidated_properties[n] != NULL; n++)
26485 {
26486 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, invalidated_properties[n]);
26487 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
26488 if (info != NULL)
26489 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
26490 }
26491}
26492
26493static gboolean
26494button_proxy_get_state (Button *object)
26495{
26496 ButtonProxy *proxy = BUTTON_PROXY (object);
26497 GVariant *variant;
26498 gboolean value = 0;
26499 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state");
26500 if (variant != NULL)
26501 {
26502 value = g_variant_get_boolean (variant);
26503 g_variant_unref (variant);
26504 }
26505 return value;
26506}
26507
Norman James493996c2015-10-31 17:27:13 -050026508static guint64
26509button_proxy_get_timer (Button *object)
26510{
26511 ButtonProxy *proxy = BUTTON_PROXY (object);
26512 GVariant *variant;
26513 guint64 value = 0;
26514 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "timer");
26515 if (variant != NULL)
26516 {
26517 value = g_variant_get_uint64 (variant);
26518 g_variant_unref (variant);
26519 }
26520 return value;
26521}
26522
Norman James362a80f2015-09-14 14:04:39 -050026523static void
26524button_proxy_init (ButtonProxy *proxy)
26525{
26526#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
26527 proxy->priv = button_proxy_get_instance_private (proxy);
26528#else
26529 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_BUTTON_PROXY, ButtonProxyPrivate);
26530#endif
26531
26532 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), button_interface_info ());
26533}
26534
26535static void
26536button_proxy_class_init (ButtonProxyClass *klass)
26537{
26538 GObjectClass *gobject_class;
26539 GDBusProxyClass *proxy_class;
26540
26541 gobject_class = G_OBJECT_CLASS (klass);
26542 gobject_class->finalize = button_proxy_finalize;
26543 gobject_class->get_property = button_proxy_get_property;
26544 gobject_class->set_property = button_proxy_set_property;
26545
26546 proxy_class = G_DBUS_PROXY_CLASS (klass);
26547 proxy_class->g_signal = button_proxy_g_signal;
26548 proxy_class->g_properties_changed = button_proxy_g_properties_changed;
26549
26550 button_override_properties (gobject_class, 1);
26551
26552#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
26553 g_type_class_add_private (klass, sizeof (ButtonProxyPrivate));
26554#endif
26555}
26556
26557static void
26558button_proxy_iface_init (ButtonIface *iface)
26559{
26560 iface->get_state = button_proxy_get_state;
Norman James493996c2015-10-31 17:27:13 -050026561 iface->get_timer = button_proxy_get_timer;
Norman James362a80f2015-09-14 14:04:39 -050026562}
26563
26564/**
26565 * button_proxy_new:
26566 * @connection: A #GDBusConnection.
26567 * @flags: Flags from the #GDBusProxyFlags enumeration.
26568 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
26569 * @object_path: An object path.
26570 * @cancellable: (allow-none): A #GCancellable or %NULL.
26571 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
26572 * @user_data: User data to pass to @callback.
26573 *
26574 * 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.
26575 *
26576 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
26577 * You can then call button_proxy_new_finish() to get the result of the operation.
26578 *
26579 * See button_proxy_new_sync() for the synchronous, blocking version of this constructor.
26580 */
26581void
26582button_proxy_new (
26583 GDBusConnection *connection,
26584 GDBusProxyFlags flags,
26585 const gchar *name,
26586 const gchar *object_path,
26587 GCancellable *cancellable,
26588 GAsyncReadyCallback callback,
26589 gpointer user_data)
26590{
26591 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);
26592}
26593
26594/**
26595 * button_proxy_new_finish:
26596 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_proxy_new().
26597 * @error: Return location for error or %NULL
26598 *
26599 * Finishes an operation started with button_proxy_new().
26600 *
26601 * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set.
26602 */
26603Button *
26604button_proxy_new_finish (
26605 GAsyncResult *res,
26606 GError **error)
26607{
26608 GObject *ret;
26609 GObject *source_object;
26610 source_object = g_async_result_get_source_object (res);
26611 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
26612 g_object_unref (source_object);
26613 if (ret != NULL)
26614 return BUTTON (ret);
26615 else
26616 return NULL;
26617}
26618
26619/**
26620 * button_proxy_new_sync:
26621 * @connection: A #GDBusConnection.
26622 * @flags: Flags from the #GDBusProxyFlags enumeration.
26623 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
26624 * @object_path: An object path.
26625 * @cancellable: (allow-none): A #GCancellable or %NULL.
26626 * @error: Return location for error or %NULL
26627 *
26628 * 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.
26629 *
26630 * The calling thread is blocked until a reply is received.
26631 *
26632 * See button_proxy_new() for the asynchronous version of this constructor.
26633 *
26634 * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set.
26635 */
26636Button *
26637button_proxy_new_sync (
26638 GDBusConnection *connection,
26639 GDBusProxyFlags flags,
26640 const gchar *name,
26641 const gchar *object_path,
26642 GCancellable *cancellable,
26643 GError **error)
26644{
26645 GInitable *ret;
26646 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);
26647 if (ret != NULL)
26648 return BUTTON (ret);
26649 else
26650 return NULL;
26651}
26652
26653
26654/**
26655 * button_proxy_new_for_bus:
26656 * @bus_type: A #GBusType.
26657 * @flags: Flags from the #GDBusProxyFlags enumeration.
26658 * @name: A bus name (well-known or unique).
26659 * @object_path: An object path.
26660 * @cancellable: (allow-none): A #GCancellable or %NULL.
26661 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
26662 * @user_data: User data to pass to @callback.
26663 *
26664 * Like button_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
26665 *
26666 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
26667 * You can then call button_proxy_new_for_bus_finish() to get the result of the operation.
26668 *
26669 * See button_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
26670 */
26671void
26672button_proxy_new_for_bus (
26673 GBusType bus_type,
26674 GDBusProxyFlags flags,
26675 const gchar *name,
26676 const gchar *object_path,
26677 GCancellable *cancellable,
26678 GAsyncReadyCallback callback,
26679 gpointer user_data)
26680{
26681 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);
26682}
26683
26684/**
26685 * button_proxy_new_for_bus_finish:
26686 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_proxy_new_for_bus().
26687 * @error: Return location for error or %NULL
26688 *
26689 * Finishes an operation started with button_proxy_new_for_bus().
26690 *
26691 * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set.
26692 */
26693Button *
26694button_proxy_new_for_bus_finish (
26695 GAsyncResult *res,
26696 GError **error)
26697{
26698 GObject *ret;
26699 GObject *source_object;
26700 source_object = g_async_result_get_source_object (res);
26701 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
26702 g_object_unref (source_object);
26703 if (ret != NULL)
26704 return BUTTON (ret);
26705 else
26706 return NULL;
26707}
26708
26709/**
26710 * button_proxy_new_for_bus_sync:
26711 * @bus_type: A #GBusType.
26712 * @flags: Flags from the #GDBusProxyFlags enumeration.
26713 * @name: A bus name (well-known or unique).
26714 * @object_path: An object path.
26715 * @cancellable: (allow-none): A #GCancellable or %NULL.
26716 * @error: Return location for error or %NULL
26717 *
26718 * Like button_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
26719 *
26720 * The calling thread is blocked until a reply is received.
26721 *
26722 * See button_proxy_new_for_bus() for the asynchronous version of this constructor.
26723 *
26724 * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set.
26725 */
26726Button *
26727button_proxy_new_for_bus_sync (
26728 GBusType bus_type,
26729 GDBusProxyFlags flags,
26730 const gchar *name,
26731 const gchar *object_path,
26732 GCancellable *cancellable,
26733 GError **error)
26734{
26735 GInitable *ret;
26736 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);
26737 if (ret != NULL)
26738 return BUTTON (ret);
26739 else
26740 return NULL;
26741}
26742
26743
26744/* ------------------------------------------------------------------------ */
26745
26746/**
26747 * ButtonSkeleton:
26748 *
26749 * The #ButtonSkeleton structure contains only private data and should only be accessed using the provided API.
26750 */
26751
26752/**
26753 * ButtonSkeletonClass:
26754 * @parent_class: The parent class.
26755 *
26756 * Class structure for #ButtonSkeleton.
26757 */
26758
26759struct _ButtonSkeletonPrivate
26760{
26761 GValue *properties;
26762 GList *changed_properties;
26763 GSource *changed_properties_idle_source;
26764 GMainContext *context;
26765 GMutex lock;
26766};
26767
26768static void
26769_button_skeleton_handle_method_call (
26770 GDBusConnection *connection G_GNUC_UNUSED,
26771 const gchar *sender G_GNUC_UNUSED,
26772 const gchar *object_path G_GNUC_UNUSED,
26773 const gchar *interface_name,
26774 const gchar *method_name,
26775 GVariant *parameters,
26776 GDBusMethodInvocation *invocation,
26777 gpointer user_data)
26778{
26779 ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data);
26780 _ExtendedGDBusMethodInfo *info;
26781 GVariantIter iter;
26782 GVariant *child;
26783 GValue *paramv;
26784 guint num_params;
26785 guint num_extra;
26786 guint n;
26787 guint signal_id;
26788 GValue return_value = G_VALUE_INIT;
26789 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
26790 g_assert (info != NULL);
26791 num_params = g_variant_n_children (parameters);
26792 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
26793 n = 0;
26794 g_value_init (&paramv[n], TYPE_BUTTON);
26795 g_value_set_object (&paramv[n++], skeleton);
26796 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
26797 g_value_set_object (&paramv[n++], invocation);
26798 if (info->pass_fdlist)
26799 {
26800#ifdef G_OS_UNIX
26801 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
26802 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
26803#else
26804 g_assert_not_reached ();
26805#endif
26806 }
26807 g_variant_iter_init (&iter, parameters);
26808 while ((child = g_variant_iter_next_value (&iter)) != NULL)
26809 {
26810 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
26811 if (arg_info->use_gvariant)
26812 {
26813 g_value_init (&paramv[n], G_TYPE_VARIANT);
26814 g_value_set_variant (&paramv[n], child);
26815 n++;
26816 }
26817 else
26818 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
26819 g_variant_unref (child);
26820 }
26821 signal_id = g_signal_lookup (info->signal_name, TYPE_BUTTON);
26822 g_value_init (&return_value, G_TYPE_BOOLEAN);
26823 g_signal_emitv (paramv, signal_id, 0, &return_value);
26824 if (!g_value_get_boolean (&return_value))
26825 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);
26826 g_value_unset (&return_value);
26827 for (n = 0; n < num_params + num_extra; n++)
26828 g_value_unset (&paramv[n]);
26829 g_free (paramv);
26830}
26831
26832static GVariant *
26833_button_skeleton_handle_get_property (
26834 GDBusConnection *connection G_GNUC_UNUSED,
26835 const gchar *sender G_GNUC_UNUSED,
26836 const gchar *object_path G_GNUC_UNUSED,
26837 const gchar *interface_name G_GNUC_UNUSED,
26838 const gchar *property_name,
26839 GError **error,
26840 gpointer user_data)
26841{
26842 ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data);
26843 GValue value = G_VALUE_INIT;
26844 GParamSpec *pspec;
26845 _ExtendedGDBusPropertyInfo *info;
26846 GVariant *ret;
26847 ret = NULL;
26848 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, property_name);
26849 g_assert (info != NULL);
26850 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
26851 if (pspec == NULL)
26852 {
26853 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
26854 }
26855 else
26856 {
26857 g_value_init (&value, pspec->value_type);
26858 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
26859 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
26860 g_value_unset (&value);
26861 }
26862 return ret;
26863}
26864
26865static gboolean
26866_button_skeleton_handle_set_property (
26867 GDBusConnection *connection G_GNUC_UNUSED,
26868 const gchar *sender G_GNUC_UNUSED,
26869 const gchar *object_path G_GNUC_UNUSED,
26870 const gchar *interface_name G_GNUC_UNUSED,
26871 const gchar *property_name,
26872 GVariant *variant,
26873 GError **error,
26874 gpointer user_data)
26875{
26876 ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data);
26877 GValue value = G_VALUE_INIT;
26878 GParamSpec *pspec;
26879 _ExtendedGDBusPropertyInfo *info;
26880 gboolean ret;
26881 ret = FALSE;
26882 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, property_name);
26883 g_assert (info != NULL);
26884 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
26885 if (pspec == NULL)
26886 {
26887 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
26888 }
26889 else
26890 {
26891 if (info->use_gvariant)
26892 g_value_set_variant (&value, variant);
26893 else
26894 g_dbus_gvariant_to_gvalue (variant, &value);
26895 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
26896 g_value_unset (&value);
26897 ret = TRUE;
26898 }
26899 return ret;
26900}
26901
26902static const GDBusInterfaceVTable _button_skeleton_vtable =
26903{
26904 _button_skeleton_handle_method_call,
26905 _button_skeleton_handle_get_property,
26906 _button_skeleton_handle_set_property,
26907 {NULL}
26908};
26909
26910static GDBusInterfaceInfo *
26911button_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
26912{
26913 return button_interface_info ();
26914}
26915
26916static GDBusInterfaceVTable *
26917button_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
26918{
26919 return (GDBusInterfaceVTable *) &_button_skeleton_vtable;
26920}
26921
26922static GVariant *
26923button_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
26924{
26925 ButtonSkeleton *skeleton = BUTTON_SKELETON (_skeleton);
26926
26927 GVariantBuilder builder;
26928 guint n;
26929 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
26930 if (_button_interface_info.parent_struct.properties == NULL)
26931 goto out;
26932 for (n = 0; _button_interface_info.parent_struct.properties[n] != NULL; n++)
26933 {
26934 GDBusPropertyInfo *info = _button_interface_info.parent_struct.properties[n];
26935 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
26936 {
26937 GVariant *value;
26938 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);
26939 if (value != NULL)
26940 {
26941 g_variant_take_ref (value);
26942 g_variant_builder_add (&builder, "{sv}", info->name, value);
26943 g_variant_unref (value);
26944 }
26945 }
26946 }
26947out:
26948 return g_variant_builder_end (&builder);
26949}
26950
26951static gboolean _button_emit_changed (gpointer user_data);
26952
26953static void
26954button_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
26955{
26956 ButtonSkeleton *skeleton = BUTTON_SKELETON (_skeleton);
26957 gboolean emit_changed = FALSE;
26958
26959 g_mutex_lock (&skeleton->priv->lock);
26960 if (skeleton->priv->changed_properties_idle_source != NULL)
26961 {
26962 g_source_destroy (skeleton->priv->changed_properties_idle_source);
26963 skeleton->priv->changed_properties_idle_source = NULL;
26964 emit_changed = TRUE;
26965 }
26966 g_mutex_unlock (&skeleton->priv->lock);
26967
26968 if (emit_changed)
26969 _button_emit_changed (skeleton);
26970}
26971
26972static void
Norman James493996c2015-10-31 17:27:13 -050026973_button_on_signal_released (
Norman James362a80f2015-09-14 14:04:39 -050026974 Button *object)
26975{
26976 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
26977
26978 GList *connections, *l;
26979 GVariant *signal_variant;
26980 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
26981
26982 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
26983 for (l = connections; l != NULL; l = l->next)
26984 {
26985 GDBusConnection *connection = l->data;
26986 g_dbus_connection_emit_signal (connection,
Norman James493996c2015-10-31 17:27:13 -050026987 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Button", "Released",
Norman James362a80f2015-09-14 14:04:39 -050026988 signal_variant, NULL);
26989 }
26990 g_variant_unref (signal_variant);
26991 g_list_free_full (connections, g_object_unref);
26992}
26993
26994static void
Norman James493996c2015-10-31 17:27:13 -050026995_button_on_signal_pressed (
Norman James362a80f2015-09-14 14:04:39 -050026996 Button *object)
26997{
26998 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
26999
27000 GList *connections, *l;
27001 GVariant *signal_variant;
27002 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
27003
27004 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
27005 for (l = connections; l != NULL; l = l->next)
27006 {
27007 GDBusConnection *connection = l->data;
27008 g_dbus_connection_emit_signal (connection,
Norman James493996c2015-10-31 17:27:13 -050027009 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Button", "Pressed",
Norman James362a80f2015-09-14 14:04:39 -050027010 signal_variant, NULL);
27011 }
27012 g_variant_unref (signal_variant);
27013 g_list_free_full (connections, g_object_unref);
27014}
27015
27016static void
Norman James493996c2015-10-31 17:27:13 -050027017_button_on_signal_pressed_long (
Norman James362a80f2015-09-14 14:04:39 -050027018 Button *object)
27019{
27020 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
27021
27022 GList *connections, *l;
27023 GVariant *signal_variant;
27024 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
27025
27026 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
27027 for (l = connections; l != NULL; l = l->next)
27028 {
27029 GDBusConnection *connection = l->data;
27030 g_dbus_connection_emit_signal (connection,
Norman James493996c2015-10-31 17:27:13 -050027031 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Button", "PressedLong",
Norman James362a80f2015-09-14 14:04:39 -050027032 signal_variant, NULL);
27033 }
27034 g_variant_unref (signal_variant);
27035 g_list_free_full (connections, g_object_unref);
27036}
27037
27038static void button_skeleton_iface_init (ButtonIface *iface);
27039#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
27040G_DEFINE_TYPE_WITH_CODE (ButtonSkeleton, button_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
27041 G_ADD_PRIVATE (ButtonSkeleton)
27042 G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_skeleton_iface_init));
27043
27044#else
27045G_DEFINE_TYPE_WITH_CODE (ButtonSkeleton, button_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
27046 G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_skeleton_iface_init));
27047
27048#endif
27049static void
27050button_skeleton_finalize (GObject *object)
27051{
27052 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
27053 guint n;
Norman James493996c2015-10-31 17:27:13 -050027054 for (n = 0; n < 2; n++)
Norman James362a80f2015-09-14 14:04:39 -050027055 g_value_unset (&skeleton->priv->properties[n]);
27056 g_free (skeleton->priv->properties);
27057 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
27058 if (skeleton->priv->changed_properties_idle_source != NULL)
27059 g_source_destroy (skeleton->priv->changed_properties_idle_source);
27060 g_main_context_unref (skeleton->priv->context);
27061 g_mutex_clear (&skeleton->priv->lock);
27062 G_OBJECT_CLASS (button_skeleton_parent_class)->finalize (object);
27063}
27064
27065static void
27066button_skeleton_get_property (GObject *object,
27067 guint prop_id,
27068 GValue *value,
27069 GParamSpec *pspec G_GNUC_UNUSED)
27070{
27071 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
Norman James493996c2015-10-31 17:27:13 -050027072 g_assert (prop_id != 0 && prop_id - 1 < 2);
Norman James362a80f2015-09-14 14:04:39 -050027073 g_mutex_lock (&skeleton->priv->lock);
27074 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
27075 g_mutex_unlock (&skeleton->priv->lock);
27076}
27077
27078static gboolean
27079_button_emit_changed (gpointer user_data)
27080{
27081 ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data);
27082 GList *l;
27083 GVariantBuilder builder;
27084 GVariantBuilder invalidated_builder;
27085 guint num_changes;
27086
27087 g_mutex_lock (&skeleton->priv->lock);
27088 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
27089 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
27090 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
27091 {
27092 ChangedProperty *cp = l->data;
27093 GVariant *variant;
27094 const GValue *cur_value;
27095
27096 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
27097 if (!_g_value_equal (cur_value, &cp->orig_value))
27098 {
27099 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
27100 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
27101 g_variant_unref (variant);
27102 num_changes++;
27103 }
27104 }
27105 if (num_changes > 0)
27106 {
27107 GList *connections, *ll;
27108 GVariant *signal_variant;
27109 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Button",
27110 &builder, &invalidated_builder));
27111 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
27112 for (ll = connections; ll != NULL; ll = ll->next)
27113 {
27114 GDBusConnection *connection = ll->data;
27115
27116 g_dbus_connection_emit_signal (connection,
27117 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
27118 "org.freedesktop.DBus.Properties",
27119 "PropertiesChanged",
27120 signal_variant,
27121 NULL);
27122 }
27123 g_variant_unref (signal_variant);
27124 g_list_free_full (connections, g_object_unref);
27125 }
27126 else
27127 {
27128 g_variant_builder_clear (&builder);
27129 g_variant_builder_clear (&invalidated_builder);
27130 }
27131 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
27132 skeleton->priv->changed_properties = NULL;
27133 skeleton->priv->changed_properties_idle_source = NULL;
27134 g_mutex_unlock (&skeleton->priv->lock);
27135 return FALSE;
27136}
27137
27138static void
27139_button_schedule_emit_changed (ButtonSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
27140{
27141 ChangedProperty *cp;
27142 GList *l;
27143 cp = NULL;
27144 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
27145 {
27146 ChangedProperty *i_cp = l->data;
27147 if (i_cp->info == info)
27148 {
27149 cp = i_cp;
27150 break;
27151 }
27152 }
27153 if (cp == NULL)
27154 {
27155 cp = g_new0 (ChangedProperty, 1);
27156 cp->prop_id = prop_id;
27157 cp->info = info;
27158 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
27159 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
27160 g_value_copy (orig_value, &cp->orig_value);
27161 }
27162}
27163
27164static void
27165button_skeleton_notify (GObject *object,
27166 GParamSpec *pspec G_GNUC_UNUSED)
27167{
27168 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
27169 g_mutex_lock (&skeleton->priv->lock);
27170 if (skeleton->priv->changed_properties != NULL &&
27171 skeleton->priv->changed_properties_idle_source == NULL)
27172 {
27173 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
27174 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
27175 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _button_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
27176 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
27177 g_source_unref (skeleton->priv->changed_properties_idle_source);
27178 }
27179 g_mutex_unlock (&skeleton->priv->lock);
27180}
27181
27182static void
27183button_skeleton_set_property (GObject *object,
27184 guint prop_id,
27185 const GValue *value,
27186 GParamSpec *pspec)
27187{
27188 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
Norman James493996c2015-10-31 17:27:13 -050027189 g_assert (prop_id != 0 && prop_id - 1 < 2);
Norman James362a80f2015-09-14 14:04:39 -050027190 g_mutex_lock (&skeleton->priv->lock);
27191 g_object_freeze_notify (object);
27192 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
27193 {
27194 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
27195 _button_schedule_emit_changed (skeleton, _button_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
27196 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
27197 g_object_notify_by_pspec (object, pspec);
27198 }
27199 g_mutex_unlock (&skeleton->priv->lock);
27200 g_object_thaw_notify (object);
27201}
27202
27203static void
27204button_skeleton_init (ButtonSkeleton *skeleton)
27205{
27206#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
27207 skeleton->priv = button_skeleton_get_instance_private (skeleton);
27208#else
27209 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_BUTTON_SKELETON, ButtonSkeletonPrivate);
27210#endif
27211
27212 g_mutex_init (&skeleton->priv->lock);
27213 skeleton->priv->context = g_main_context_ref_thread_default ();
Norman James493996c2015-10-31 17:27:13 -050027214 skeleton->priv->properties = g_new0 (GValue, 2);
Norman James362a80f2015-09-14 14:04:39 -050027215 g_value_init (&skeleton->priv->properties[0], G_TYPE_BOOLEAN);
Norman James493996c2015-10-31 17:27:13 -050027216 g_value_init (&skeleton->priv->properties[1], G_TYPE_UINT64);
Norman James362a80f2015-09-14 14:04:39 -050027217}
27218
27219static gboolean
27220button_skeleton_get_state (Button *object)
27221{
27222 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
27223 gboolean value;
27224 g_mutex_lock (&skeleton->priv->lock);
27225 value = g_value_get_boolean (&(skeleton->priv->properties[0]));
27226 g_mutex_unlock (&skeleton->priv->lock);
27227 return value;
27228}
27229
Norman James493996c2015-10-31 17:27:13 -050027230static guint64
27231button_skeleton_get_timer (Button *object)
27232{
27233 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
27234 guint64 value;
27235 g_mutex_lock (&skeleton->priv->lock);
27236 value = g_value_get_uint64 (&(skeleton->priv->properties[1]));
27237 g_mutex_unlock (&skeleton->priv->lock);
27238 return value;
27239}
27240
Norman James362a80f2015-09-14 14:04:39 -050027241static void
27242button_skeleton_class_init (ButtonSkeletonClass *klass)
27243{
27244 GObjectClass *gobject_class;
27245 GDBusInterfaceSkeletonClass *skeleton_class;
27246
27247 gobject_class = G_OBJECT_CLASS (klass);
27248 gobject_class->finalize = button_skeleton_finalize;
27249 gobject_class->get_property = button_skeleton_get_property;
27250 gobject_class->set_property = button_skeleton_set_property;
27251 gobject_class->notify = button_skeleton_notify;
27252
27253
27254 button_override_properties (gobject_class, 1);
27255
27256 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
27257 skeleton_class->get_info = button_skeleton_dbus_interface_get_info;
27258 skeleton_class->get_properties = button_skeleton_dbus_interface_get_properties;
27259 skeleton_class->flush = button_skeleton_dbus_interface_flush;
27260 skeleton_class->get_vtable = button_skeleton_dbus_interface_get_vtable;
27261
27262#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
27263 g_type_class_add_private (klass, sizeof (ButtonSkeletonPrivate));
27264#endif
27265}
27266
27267static void
27268button_skeleton_iface_init (ButtonIface *iface)
27269{
Norman James493996c2015-10-31 17:27:13 -050027270 iface->released = _button_on_signal_released;
27271 iface->pressed = _button_on_signal_pressed;
27272 iface->pressed_long = _button_on_signal_pressed_long;
Norman James362a80f2015-09-14 14:04:39 -050027273 iface->get_state = button_skeleton_get_state;
Norman James493996c2015-10-31 17:27:13 -050027274 iface->get_timer = button_skeleton_get_timer;
Norman James362a80f2015-09-14 14:04:39 -050027275}
27276
27277/**
27278 * button_skeleton_new:
27279 *
27280 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link>.
27281 *
27282 * Returns: (transfer full) (type ButtonSkeleton): The skeleton object.
27283 */
27284Button *
27285button_skeleton_new (void)
27286{
27287 return BUTTON (g_object_new (TYPE_BUTTON_SKELETON, NULL));
27288}
27289
27290/* ------------------------------------------------------------------------
27291 * Code for interface org.openbmc.Led
27292 * ------------------------------------------------------------------------
27293 */
27294
27295/**
27296 * SECTION:Led
27297 * @title: Led
27298 * @short_description: Generated C code for the org.openbmc.Led D-Bus interface
27299 *
27300 * 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.
27301 */
27302
27303/* ---- Introspection data for org.openbmc.Led ---- */
27304
27305static const _ExtendedGDBusMethodInfo _led_method_info_set_on =
27306{
27307 {
27308 -1,
27309 (gchar *) "setOn",
27310 NULL,
27311 NULL,
27312 NULL
27313 },
27314 "handle-set-on",
27315 FALSE
27316};
27317
27318static const _ExtendedGDBusMethodInfo _led_method_info_set_off =
27319{
27320 {
27321 -1,
27322 (gchar *) "setOff",
27323 NULL,
27324 NULL,
27325 NULL
27326 },
27327 "handle-set-off",
27328 FALSE
27329};
27330
27331static const _ExtendedGDBusMethodInfo _led_method_info_set_blink_slow =
27332{
27333 {
27334 -1,
27335 (gchar *) "setBlinkSlow",
27336 NULL,
27337 NULL,
27338 NULL
27339 },
27340 "handle-set-blink-slow",
27341 FALSE
27342};
27343
27344static const _ExtendedGDBusMethodInfo _led_method_info_set_blink_fast =
27345{
27346 {
27347 -1,
27348 (gchar *) "setBlinkFast",
27349 NULL,
27350 NULL,
27351 NULL
27352 },
27353 "handle-set-blink-fast",
27354 FALSE
27355};
27356
27357static const _ExtendedGDBusMethodInfo * const _led_method_info_pointers[] =
27358{
27359 &_led_method_info_set_on,
27360 &_led_method_info_set_off,
27361 &_led_method_info_set_blink_slow,
27362 &_led_method_info_set_blink_fast,
27363 NULL
27364};
27365
27366static const _ExtendedGDBusPropertyInfo _led_property_info_color =
27367{
27368 {
27369 -1,
27370 (gchar *) "color",
27371 (gchar *) "i",
27372 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
27373 NULL
27374 },
27375 "color",
27376 FALSE
27377};
27378
27379static const _ExtendedGDBusPropertyInfo _led_property_info_function =
27380{
27381 {
27382 -1,
27383 (gchar *) "function",
27384 (gchar *) "s",
27385 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
27386 NULL
27387 },
27388 "function",
27389 FALSE
27390};
27391
Norman James493996c2015-10-31 17:27:13 -050027392static const _ExtendedGDBusPropertyInfo _led_property_info_state =
27393{
27394 {
27395 -1,
27396 (gchar *) "state",
27397 (gchar *) "s",
27398 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
27399 NULL
27400 },
27401 "state",
27402 FALSE
27403};
27404
Norman James362a80f2015-09-14 14:04:39 -050027405static const _ExtendedGDBusPropertyInfo * const _led_property_info_pointers[] =
27406{
27407 &_led_property_info_color,
27408 &_led_property_info_function,
Norman James493996c2015-10-31 17:27:13 -050027409 &_led_property_info_state,
Norman James362a80f2015-09-14 14:04:39 -050027410 NULL
27411};
27412
27413static const _ExtendedGDBusInterfaceInfo _led_interface_info =
27414{
27415 {
27416 -1,
27417 (gchar *) "org.openbmc.Led",
27418 (GDBusMethodInfo **) &_led_method_info_pointers,
27419 NULL,
27420 (GDBusPropertyInfo **) &_led_property_info_pointers,
27421 NULL
27422 },
27423 "led",
27424};
27425
27426
27427/**
27428 * led_interface_info:
27429 *
27430 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link> D-Bus interface.
27431 *
27432 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
27433 */
27434GDBusInterfaceInfo *
27435led_interface_info (void)
27436{
27437 return (GDBusInterfaceInfo *) &_led_interface_info.parent_struct;
27438}
27439
27440/**
27441 * led_override_properties:
27442 * @klass: The class structure for a #GObject<!-- -->-derived class.
27443 * @property_id_begin: The property id to assign to the first overridden property.
27444 *
27445 * Overrides all #GObject properties in the #Led interface for a concrete class.
27446 * The properties are overridden in the order they are defined.
27447 *
27448 * Returns: The last property id.
27449 */
27450guint
27451led_override_properties (GObjectClass *klass, guint property_id_begin)
27452{
27453 g_object_class_override_property (klass, property_id_begin++, "color");
27454 g_object_class_override_property (klass, property_id_begin++, "function");
Norman James493996c2015-10-31 17:27:13 -050027455 g_object_class_override_property (klass, property_id_begin++, "state");
Norman James362a80f2015-09-14 14:04:39 -050027456 return property_id_begin - 1;
27457}
27458
27459
27460
27461/**
27462 * Led:
27463 *
27464 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>.
27465 */
27466
27467/**
27468 * LedIface:
27469 * @parent_iface: The parent interface.
27470 * @handle_set_blink_fast: Handler for the #Led::handle-set-blink-fast signal.
27471 * @handle_set_blink_slow: Handler for the #Led::handle-set-blink-slow signal.
27472 * @handle_set_off: Handler for the #Led::handle-set-off signal.
27473 * @handle_set_on: Handler for the #Led::handle-set-on signal.
27474 * @get_color: Getter for the #Led:color property.
27475 * @get_function: Getter for the #Led:function property.
Norman James493996c2015-10-31 17:27:13 -050027476 * @get_state: Getter for the #Led:state property.
Norman James362a80f2015-09-14 14:04:39 -050027477 *
27478 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>.
27479 */
27480
27481typedef LedIface LedInterface;
27482G_DEFINE_INTERFACE (Led, led, G_TYPE_OBJECT);
27483
27484static void
27485led_default_init (LedIface *iface)
27486{
27487 /* GObject signals for incoming D-Bus method calls: */
27488 /**
27489 * Led::handle-set-on:
27490 * @object: A #Led.
27491 * @invocation: A #GDBusMethodInvocation.
27492 *
27493 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setOn">setOn()</link> D-Bus method.
27494 *
27495 * 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.
27496 *
27497 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
27498 */
27499 g_signal_new ("handle-set-on",
27500 G_TYPE_FROM_INTERFACE (iface),
27501 G_SIGNAL_RUN_LAST,
27502 G_STRUCT_OFFSET (LedIface, handle_set_on),
27503 g_signal_accumulator_true_handled,
27504 NULL,
27505 g_cclosure_marshal_generic,
27506 G_TYPE_BOOLEAN,
27507 1,
27508 G_TYPE_DBUS_METHOD_INVOCATION);
27509
27510 /**
27511 * Led::handle-set-off:
27512 * @object: A #Led.
27513 * @invocation: A #GDBusMethodInvocation.
27514 *
27515 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setOff">setOff()</link> D-Bus method.
27516 *
27517 * 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.
27518 *
27519 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
27520 */
27521 g_signal_new ("handle-set-off",
27522 G_TYPE_FROM_INTERFACE (iface),
27523 G_SIGNAL_RUN_LAST,
27524 G_STRUCT_OFFSET (LedIface, handle_set_off),
27525 g_signal_accumulator_true_handled,
27526 NULL,
27527 g_cclosure_marshal_generic,
27528 G_TYPE_BOOLEAN,
27529 1,
27530 G_TYPE_DBUS_METHOD_INVOCATION);
27531
27532 /**
27533 * Led::handle-set-blink-slow:
27534 * @object: A #Led.
27535 * @invocation: A #GDBusMethodInvocation.
27536 *
27537 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setBlinkSlow">setBlinkSlow()</link> D-Bus method.
27538 *
27539 * 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.
27540 *
27541 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
27542 */
27543 g_signal_new ("handle-set-blink-slow",
27544 G_TYPE_FROM_INTERFACE (iface),
27545 G_SIGNAL_RUN_LAST,
27546 G_STRUCT_OFFSET (LedIface, handle_set_blink_slow),
27547 g_signal_accumulator_true_handled,
27548 NULL,
27549 g_cclosure_marshal_generic,
27550 G_TYPE_BOOLEAN,
27551 1,
27552 G_TYPE_DBUS_METHOD_INVOCATION);
27553
27554 /**
27555 * Led::handle-set-blink-fast:
27556 * @object: A #Led.
27557 * @invocation: A #GDBusMethodInvocation.
27558 *
27559 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setBlinkFast">setBlinkFast()</link> D-Bus method.
27560 *
27561 * 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.
27562 *
27563 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
27564 */
27565 g_signal_new ("handle-set-blink-fast",
27566 G_TYPE_FROM_INTERFACE (iface),
27567 G_SIGNAL_RUN_LAST,
27568 G_STRUCT_OFFSET (LedIface, handle_set_blink_fast),
27569 g_signal_accumulator_true_handled,
27570 NULL,
27571 g_cclosure_marshal_generic,
27572 G_TYPE_BOOLEAN,
27573 1,
27574 G_TYPE_DBUS_METHOD_INVOCATION);
27575
27576 /* GObject properties for D-Bus properties: */
27577 /**
27578 * Led:color:
27579 *
27580 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Led.color">"color"</link>.
27581 *
27582 * 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.
27583 */
27584 g_object_interface_install_property (iface,
27585 g_param_spec_int ("color", "color", "color", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
27586 /**
27587 * Led:function:
27588 *
27589 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link>.
27590 *
27591 * 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.
27592 */
27593 g_object_interface_install_property (iface,
27594 g_param_spec_string ("function", "function", "function", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Norman James493996c2015-10-31 17:27:13 -050027595 /**
27596 * Led:state:
27597 *
27598 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Led.state">"state"</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_string ("state", "state", "state", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Norman James362a80f2015-09-14 14:04:39 -050027604}
27605
27606/**
27607 * led_get_color: (skip)
27608 * @object: A #Led.
27609 *
27610 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Led.color">"color"</link> D-Bus property.
27611 *
27612 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
27613 *
27614 * Returns: The property value.
27615 */
27616gint
27617led_get_color (Led *object)
27618{
27619 return LED_GET_IFACE (object)->get_color (object);
27620}
27621
27622/**
27623 * led_set_color: (skip)
27624 * @object: A #Led.
27625 * @value: The value to set.
27626 *
27627 * Sets the <link linkend="gdbus-property-org-openbmc-Led.color">"color"</link> D-Bus property to @value.
27628 *
27629 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
27630 */
27631void
27632led_set_color (Led *object, gint value)
27633{
27634 g_object_set (G_OBJECT (object), "color", value, NULL);
27635}
27636
27637/**
27638 * led_get_function: (skip)
27639 * @object: A #Led.
27640 *
27641 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link> D-Bus property.
27642 *
27643 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
27644 *
27645 * <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>
27646 *
27647 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
27648 */
27649const gchar *
27650led_get_function (Led *object)
27651{
27652 return LED_GET_IFACE (object)->get_function (object);
27653}
27654
27655/**
27656 * led_dup_function: (skip)
27657 * @object: A #Led.
27658 *
27659 * Gets a copy 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 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
27664 */
27665gchar *
27666led_dup_function (Led *object)
27667{
27668 gchar *value;
27669 g_object_get (G_OBJECT (object), "function", &value, NULL);
27670 return value;
27671}
27672
27673/**
27674 * led_set_function: (skip)
27675 * @object: A #Led.
27676 * @value: The value to set.
27677 *
27678 * Sets the <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link> D-Bus property to @value.
27679 *
27680 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
27681 */
27682void
27683led_set_function (Led *object, const gchar *value)
27684{
27685 g_object_set (G_OBJECT (object), "function", value, NULL);
27686}
27687
27688/**
Norman James493996c2015-10-31 17:27:13 -050027689 * led_get_state: (skip)
27690 * @object: A #Led.
27691 *
27692 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Led.state">"state"</link> D-Bus property.
27693 *
27694 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
27695 *
27696 * <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>
27697 *
27698 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
27699 */
27700const gchar *
27701led_get_state (Led *object)
27702{
27703 return LED_GET_IFACE (object)->get_state (object);
27704}
27705
27706/**
27707 * led_dup_state: (skip)
27708 * @object: A #Led.
27709 *
27710 * Gets a copy 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 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
27715 */
27716gchar *
27717led_dup_state (Led *object)
27718{
27719 gchar *value;
27720 g_object_get (G_OBJECT (object), "state", &value, NULL);
27721 return value;
27722}
27723
27724/**
27725 * led_set_state: (skip)
27726 * @object: A #Led.
27727 * @value: The value to set.
27728 *
27729 * Sets the <link linkend="gdbus-property-org-openbmc-Led.state">"state"</link> D-Bus property to @value.
27730 *
27731 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
27732 */
27733void
27734led_set_state (Led *object, const gchar *value)
27735{
27736 g_object_set (G_OBJECT (object), "state", value, NULL);
27737}
27738
27739/**
Norman James362a80f2015-09-14 14:04:39 -050027740 * led_call_set_on:
27741 * @proxy: A #LedProxy.
27742 * @cancellable: (allow-none): A #GCancellable or %NULL.
27743 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
27744 * @user_data: User data to pass to @callback.
27745 *
27746 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setOn">setOn()</link> D-Bus method on @proxy.
27747 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
27748 * You can then call led_call_set_on_finish() to get the result of the operation.
27749 *
27750 * See led_call_set_on_sync() for the synchronous, blocking version of this method.
27751 */
27752void
27753led_call_set_on (
27754 Led *proxy,
27755 GCancellable *cancellable,
27756 GAsyncReadyCallback callback,
27757 gpointer user_data)
27758{
27759 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
27760 "setOn",
27761 g_variant_new ("()"),
27762 G_DBUS_CALL_FLAGS_NONE,
27763 -1,
27764 cancellable,
27765 callback,
27766 user_data);
27767}
27768
27769/**
27770 * led_call_set_on_finish:
27771 * @proxy: A #LedProxy.
27772 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_on().
27773 * @error: Return location for error or %NULL.
27774 *
27775 * Finishes an operation started with led_call_set_on().
27776 *
27777 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
27778 */
27779gboolean
27780led_call_set_on_finish (
27781 Led *proxy,
27782 GAsyncResult *res,
27783 GError **error)
27784{
27785 GVariant *_ret;
27786 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
27787 if (_ret == NULL)
27788 goto _out;
27789 g_variant_get (_ret,
27790 "()");
27791 g_variant_unref (_ret);
27792_out:
27793 return _ret != NULL;
27794}
27795
27796/**
27797 * led_call_set_on_sync:
27798 * @proxy: A #LedProxy.
27799 * @cancellable: (allow-none): A #GCancellable or %NULL.
27800 * @error: Return location for error or %NULL.
27801 *
27802 * 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.
27803 *
27804 * See led_call_set_on() for the asynchronous version of this method.
27805 *
27806 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
27807 */
27808gboolean
27809led_call_set_on_sync (
27810 Led *proxy,
27811 GCancellable *cancellable,
27812 GError **error)
27813{
27814 GVariant *_ret;
27815 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
27816 "setOn",
27817 g_variant_new ("()"),
27818 G_DBUS_CALL_FLAGS_NONE,
27819 -1,
27820 cancellable,
27821 error);
27822 if (_ret == NULL)
27823 goto _out;
27824 g_variant_get (_ret,
27825 "()");
27826 g_variant_unref (_ret);
27827_out:
27828 return _ret != NULL;
27829}
27830
27831/**
27832 * led_call_set_off:
27833 * @proxy: A #LedProxy.
27834 * @cancellable: (allow-none): A #GCancellable or %NULL.
27835 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
27836 * @user_data: User data to pass to @callback.
27837 *
27838 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setOff">setOff()</link> D-Bus method on @proxy.
27839 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
27840 * You can then call led_call_set_off_finish() to get the result of the operation.
27841 *
27842 * See led_call_set_off_sync() for the synchronous, blocking version of this method.
27843 */
27844void
27845led_call_set_off (
27846 Led *proxy,
27847 GCancellable *cancellable,
27848 GAsyncReadyCallback callback,
27849 gpointer user_data)
27850{
27851 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
27852 "setOff",
27853 g_variant_new ("()"),
27854 G_DBUS_CALL_FLAGS_NONE,
27855 -1,
27856 cancellable,
27857 callback,
27858 user_data);
27859}
27860
27861/**
27862 * led_call_set_off_finish:
27863 * @proxy: A #LedProxy.
27864 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_off().
27865 * @error: Return location for error or %NULL.
27866 *
27867 * Finishes an operation started with led_call_set_off().
27868 *
27869 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
27870 */
27871gboolean
27872led_call_set_off_finish (
27873 Led *proxy,
27874 GAsyncResult *res,
27875 GError **error)
27876{
27877 GVariant *_ret;
27878 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
27879 if (_ret == NULL)
27880 goto _out;
27881 g_variant_get (_ret,
27882 "()");
27883 g_variant_unref (_ret);
27884_out:
27885 return _ret != NULL;
27886}
27887
27888/**
27889 * led_call_set_off_sync:
27890 * @proxy: A #LedProxy.
27891 * @cancellable: (allow-none): A #GCancellable or %NULL.
27892 * @error: Return location for error or %NULL.
27893 *
27894 * 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.
27895 *
27896 * See led_call_set_off() for the asynchronous version of this method.
27897 *
27898 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
27899 */
27900gboolean
27901led_call_set_off_sync (
27902 Led *proxy,
27903 GCancellable *cancellable,
27904 GError **error)
27905{
27906 GVariant *_ret;
27907 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
27908 "setOff",
27909 g_variant_new ("()"),
27910 G_DBUS_CALL_FLAGS_NONE,
27911 -1,
27912 cancellable,
27913 error);
27914 if (_ret == NULL)
27915 goto _out;
27916 g_variant_get (_ret,
27917 "()");
27918 g_variant_unref (_ret);
27919_out:
27920 return _ret != NULL;
27921}
27922
27923/**
27924 * led_call_set_blink_slow:
27925 * @proxy: A #LedProxy.
27926 * @cancellable: (allow-none): A #GCancellable or %NULL.
27927 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
27928 * @user_data: User data to pass to @callback.
27929 *
27930 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setBlinkSlow">setBlinkSlow()</link> D-Bus method on @proxy.
27931 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
27932 * You can then call led_call_set_blink_slow_finish() to get the result of the operation.
27933 *
27934 * See led_call_set_blink_slow_sync() for the synchronous, blocking version of this method.
27935 */
27936void
27937led_call_set_blink_slow (
27938 Led *proxy,
27939 GCancellable *cancellable,
27940 GAsyncReadyCallback callback,
27941 gpointer user_data)
27942{
27943 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
27944 "setBlinkSlow",
27945 g_variant_new ("()"),
27946 G_DBUS_CALL_FLAGS_NONE,
27947 -1,
27948 cancellable,
27949 callback,
27950 user_data);
27951}
27952
27953/**
27954 * led_call_set_blink_slow_finish:
27955 * @proxy: A #LedProxy.
27956 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_blink_slow().
27957 * @error: Return location for error or %NULL.
27958 *
27959 * Finishes an operation started with led_call_set_blink_slow().
27960 *
27961 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
27962 */
27963gboolean
27964led_call_set_blink_slow_finish (
27965 Led *proxy,
27966 GAsyncResult *res,
27967 GError **error)
27968{
27969 GVariant *_ret;
27970 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
27971 if (_ret == NULL)
27972 goto _out;
27973 g_variant_get (_ret,
27974 "()");
27975 g_variant_unref (_ret);
27976_out:
27977 return _ret != NULL;
27978}
27979
27980/**
27981 * led_call_set_blink_slow_sync:
27982 * @proxy: A #LedProxy.
27983 * @cancellable: (allow-none): A #GCancellable or %NULL.
27984 * @error: Return location for error or %NULL.
27985 *
27986 * 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.
27987 *
27988 * See led_call_set_blink_slow() for the asynchronous version of this method.
27989 *
27990 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
27991 */
27992gboolean
27993led_call_set_blink_slow_sync (
27994 Led *proxy,
27995 GCancellable *cancellable,
27996 GError **error)
27997{
27998 GVariant *_ret;
27999 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
28000 "setBlinkSlow",
28001 g_variant_new ("()"),
28002 G_DBUS_CALL_FLAGS_NONE,
28003 -1,
28004 cancellable,
28005 error);
28006 if (_ret == NULL)
28007 goto _out;
28008 g_variant_get (_ret,
28009 "()");
28010 g_variant_unref (_ret);
28011_out:
28012 return _ret != NULL;
28013}
28014
28015/**
28016 * led_call_set_blink_fast:
28017 * @proxy: A #LedProxy.
28018 * @cancellable: (allow-none): A #GCancellable or %NULL.
28019 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
28020 * @user_data: User data to pass to @callback.
28021 *
28022 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setBlinkFast">setBlinkFast()</link> D-Bus method on @proxy.
28023 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
28024 * You can then call led_call_set_blink_fast_finish() to get the result of the operation.
28025 *
28026 * See led_call_set_blink_fast_sync() for the synchronous, blocking version of this method.
28027 */
28028void
28029led_call_set_blink_fast (
28030 Led *proxy,
28031 GCancellable *cancellable,
28032 GAsyncReadyCallback callback,
28033 gpointer user_data)
28034{
28035 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
28036 "setBlinkFast",
28037 g_variant_new ("()"),
28038 G_DBUS_CALL_FLAGS_NONE,
28039 -1,
28040 cancellable,
28041 callback,
28042 user_data);
28043}
28044
28045/**
28046 * led_call_set_blink_fast_finish:
28047 * @proxy: A #LedProxy.
28048 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_blink_fast().
28049 * @error: Return location for error or %NULL.
28050 *
28051 * Finishes an operation started with led_call_set_blink_fast().
28052 *
28053 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
28054 */
28055gboolean
28056led_call_set_blink_fast_finish (
28057 Led *proxy,
28058 GAsyncResult *res,
28059 GError **error)
28060{
28061 GVariant *_ret;
28062 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
28063 if (_ret == NULL)
28064 goto _out;
28065 g_variant_get (_ret,
28066 "()");
28067 g_variant_unref (_ret);
28068_out:
28069 return _ret != NULL;
28070}
28071
28072/**
28073 * led_call_set_blink_fast_sync:
28074 * @proxy: A #LedProxy.
28075 * @cancellable: (allow-none): A #GCancellable or %NULL.
28076 * @error: Return location for error or %NULL.
28077 *
28078 * 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.
28079 *
28080 * See led_call_set_blink_fast() for the asynchronous version of this method.
28081 *
28082 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
28083 */
28084gboolean
28085led_call_set_blink_fast_sync (
28086 Led *proxy,
28087 GCancellable *cancellable,
28088 GError **error)
28089{
28090 GVariant *_ret;
28091 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
28092 "setBlinkFast",
28093 g_variant_new ("()"),
28094 G_DBUS_CALL_FLAGS_NONE,
28095 -1,
28096 cancellable,
28097 error);
28098 if (_ret == NULL)
28099 goto _out;
28100 g_variant_get (_ret,
28101 "()");
28102 g_variant_unref (_ret);
28103_out:
28104 return _ret != NULL;
28105}
28106
28107/**
28108 * led_complete_set_on:
28109 * @object: A #Led.
28110 * @invocation: (transfer full): A #GDBusMethodInvocation.
28111 *
28112 * 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.
28113 *
28114 * This method will free @invocation, you cannot use it afterwards.
28115 */
28116void
28117led_complete_set_on (
28118 Led *object,
28119 GDBusMethodInvocation *invocation)
28120{
28121 g_dbus_method_invocation_return_value (invocation,
28122 g_variant_new ("()"));
28123}
28124
28125/**
28126 * led_complete_set_off:
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.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.
28131 *
28132 * This method will free @invocation, you cannot use it afterwards.
28133 */
28134void
28135led_complete_set_off (
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_blink_slow:
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.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.
28149 *
28150 * This method will free @invocation, you cannot use it afterwards.
28151 */
28152void
28153led_complete_set_blink_slow (
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_fast:
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.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.
28167 *
28168 * This method will free @invocation, you cannot use it afterwards.
28169 */
28170void
28171led_complete_set_blink_fast (
28172 Led *object,
28173 GDBusMethodInvocation *invocation)
28174{
28175 g_dbus_method_invocation_return_value (invocation,
28176 g_variant_new ("()"));
28177}
28178
28179/* ------------------------------------------------------------------------ */
28180
28181/**
28182 * LedProxy:
28183 *
28184 * The #LedProxy structure contains only private data and should only be accessed using the provided API.
28185 */
28186
28187/**
28188 * LedProxyClass:
28189 * @parent_class: The parent class.
28190 *
28191 * Class structure for #LedProxy.
28192 */
28193
28194struct _LedProxyPrivate
28195{
28196 GData *qdata;
28197};
28198
28199static void led_proxy_iface_init (LedIface *iface);
28200
28201#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
28202G_DEFINE_TYPE_WITH_CODE (LedProxy, led_proxy, G_TYPE_DBUS_PROXY,
28203 G_ADD_PRIVATE (LedProxy)
28204 G_IMPLEMENT_INTERFACE (TYPE_LED, led_proxy_iface_init));
28205
28206#else
28207G_DEFINE_TYPE_WITH_CODE (LedProxy, led_proxy, G_TYPE_DBUS_PROXY,
28208 G_IMPLEMENT_INTERFACE (TYPE_LED, led_proxy_iface_init));
28209
28210#endif
28211static void
28212led_proxy_finalize (GObject *object)
28213{
28214 LedProxy *proxy = LED_PROXY (object);
28215 g_datalist_clear (&proxy->priv->qdata);
28216 G_OBJECT_CLASS (led_proxy_parent_class)->finalize (object);
28217}
28218
28219static void
28220led_proxy_get_property (GObject *object,
28221 guint prop_id,
28222 GValue *value,
28223 GParamSpec *pspec G_GNUC_UNUSED)
28224{
28225 const _ExtendedGDBusPropertyInfo *info;
28226 GVariant *variant;
Norman James493996c2015-10-31 17:27:13 -050028227 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -050028228 info = _led_property_info_pointers[prop_id - 1];
28229 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
28230 if (info->use_gvariant)
28231 {
28232 g_value_set_variant (value, variant);
28233 }
28234 else
28235 {
28236 if (variant != NULL)
28237 g_dbus_gvariant_to_gvalue (variant, value);
28238 }
28239 if (variant != NULL)
28240 g_variant_unref (variant);
28241}
28242
28243static void
28244led_proxy_set_property_cb (GDBusProxy *proxy,
28245 GAsyncResult *res,
28246 gpointer user_data)
28247{
28248 const _ExtendedGDBusPropertyInfo *info = user_data;
28249 GError *error;
28250 GVariant *_ret;
28251 error = NULL;
28252 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
28253 if (!_ret)
28254 {
28255 g_warning ("Error setting property '%s' on interface org.openbmc.Led: %s (%s, %d)",
28256 info->parent_struct.name,
28257 error->message, g_quark_to_string (error->domain), error->code);
28258 g_error_free (error);
28259 }
28260 else
28261 {
28262 g_variant_unref (_ret);
28263 }
28264}
28265
28266static void
28267led_proxy_set_property (GObject *object,
28268 guint prop_id,
28269 const GValue *value,
28270 GParamSpec *pspec G_GNUC_UNUSED)
28271{
28272 const _ExtendedGDBusPropertyInfo *info;
28273 GVariant *variant;
Norman James493996c2015-10-31 17:27:13 -050028274 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -050028275 info = _led_property_info_pointers[prop_id - 1];
28276 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
28277 g_dbus_proxy_call (G_DBUS_PROXY (object),
28278 "org.freedesktop.DBus.Properties.Set",
28279 g_variant_new ("(ssv)", "org.openbmc.Led", info->parent_struct.name, variant),
28280 G_DBUS_CALL_FLAGS_NONE,
28281 -1,
28282 NULL, (GAsyncReadyCallback) led_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
28283 g_variant_unref (variant);
28284}
28285
28286static void
28287led_proxy_g_signal (GDBusProxy *proxy,
28288 const gchar *sender_name G_GNUC_UNUSED,
28289 const gchar *signal_name,
28290 GVariant *parameters)
28291{
28292 _ExtendedGDBusSignalInfo *info;
28293 GVariantIter iter;
28294 GVariant *child;
28295 GValue *paramv;
28296 guint num_params;
28297 guint n;
28298 guint signal_id;
28299 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, signal_name);
28300 if (info == NULL)
28301 return;
28302 num_params = g_variant_n_children (parameters);
28303 paramv = g_new0 (GValue, num_params + 1);
28304 g_value_init (&paramv[0], TYPE_LED);
28305 g_value_set_object (&paramv[0], proxy);
28306 g_variant_iter_init (&iter, parameters);
28307 n = 1;
28308 while ((child = g_variant_iter_next_value (&iter)) != NULL)
28309 {
28310 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
28311 if (arg_info->use_gvariant)
28312 {
28313 g_value_init (&paramv[n], G_TYPE_VARIANT);
28314 g_value_set_variant (&paramv[n], child);
28315 n++;
28316 }
28317 else
28318 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
28319 g_variant_unref (child);
28320 }
28321 signal_id = g_signal_lookup (info->signal_name, TYPE_LED);
28322 g_signal_emitv (paramv, signal_id, 0, NULL);
28323 for (n = 0; n < num_params + 1; n++)
28324 g_value_unset (&paramv[n]);
28325 g_free (paramv);
28326}
28327
28328static void
28329led_proxy_g_properties_changed (GDBusProxy *_proxy,
28330 GVariant *changed_properties,
28331 const gchar *const *invalidated_properties)
28332{
28333 LedProxy *proxy = LED_PROXY (_proxy);
28334 guint n;
28335 const gchar *key;
28336 GVariantIter *iter;
28337 _ExtendedGDBusPropertyInfo *info;
28338 g_variant_get (changed_properties, "a{sv}", &iter);
28339 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
28340 {
28341 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, key);
28342 g_datalist_remove_data (&proxy->priv->qdata, key);
28343 if (info != NULL)
28344 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
28345 }
28346 g_variant_iter_free (iter);
28347 for (n = 0; invalidated_properties[n] != NULL; n++)
28348 {
28349 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, invalidated_properties[n]);
28350 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
28351 if (info != NULL)
28352 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
28353 }
28354}
28355
28356static gint
28357led_proxy_get_color (Led *object)
28358{
28359 LedProxy *proxy = LED_PROXY (object);
28360 GVariant *variant;
28361 gint value = 0;
28362 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "color");
28363 if (variant != NULL)
28364 {
28365 value = g_variant_get_int32 (variant);
28366 g_variant_unref (variant);
28367 }
28368 return value;
28369}
28370
28371static const gchar *
28372led_proxy_get_function (Led *object)
28373{
28374 LedProxy *proxy = LED_PROXY (object);
28375 GVariant *variant;
28376 const gchar *value = NULL;
28377 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "function");
28378 if (variant != NULL)
28379 {
28380 value = g_variant_get_string (variant, NULL);
28381 g_variant_unref (variant);
28382 }
28383 return value;
28384}
28385
Norman James493996c2015-10-31 17:27:13 -050028386static const gchar *
28387led_proxy_get_state (Led *object)
28388{
28389 LedProxy *proxy = LED_PROXY (object);
28390 GVariant *variant;
28391 const gchar *value = NULL;
28392 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state");
28393 if (variant != NULL)
28394 {
28395 value = g_variant_get_string (variant, NULL);
28396 g_variant_unref (variant);
28397 }
28398 return value;
28399}
28400
Norman James362a80f2015-09-14 14:04:39 -050028401static void
28402led_proxy_init (LedProxy *proxy)
28403{
28404#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
28405 proxy->priv = led_proxy_get_instance_private (proxy);
28406#else
28407 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_LED_PROXY, LedProxyPrivate);
28408#endif
28409
28410 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), led_interface_info ());
28411}
28412
28413static void
28414led_proxy_class_init (LedProxyClass *klass)
28415{
28416 GObjectClass *gobject_class;
28417 GDBusProxyClass *proxy_class;
28418
28419 gobject_class = G_OBJECT_CLASS (klass);
28420 gobject_class->finalize = led_proxy_finalize;
28421 gobject_class->get_property = led_proxy_get_property;
28422 gobject_class->set_property = led_proxy_set_property;
28423
28424 proxy_class = G_DBUS_PROXY_CLASS (klass);
28425 proxy_class->g_signal = led_proxy_g_signal;
28426 proxy_class->g_properties_changed = led_proxy_g_properties_changed;
28427
28428 led_override_properties (gobject_class, 1);
28429
28430#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
28431 g_type_class_add_private (klass, sizeof (LedProxyPrivate));
28432#endif
28433}
28434
28435static void
28436led_proxy_iface_init (LedIface *iface)
28437{
28438 iface->get_color = led_proxy_get_color;
28439 iface->get_function = led_proxy_get_function;
Norman James493996c2015-10-31 17:27:13 -050028440 iface->get_state = led_proxy_get_state;
Norman James362a80f2015-09-14 14:04:39 -050028441}
28442
28443/**
28444 * led_proxy_new:
28445 * @connection: A #GDBusConnection.
28446 * @flags: Flags from the #GDBusProxyFlags enumeration.
28447 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
28448 * @object_path: An object path.
28449 * @cancellable: (allow-none): A #GCancellable or %NULL.
28450 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
28451 * @user_data: User data to pass to @callback.
28452 *
28453 * 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.
28454 *
28455 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
28456 * You can then call led_proxy_new_finish() to get the result of the operation.
28457 *
28458 * See led_proxy_new_sync() for the synchronous, blocking version of this constructor.
28459 */
28460void
28461led_proxy_new (
28462 GDBusConnection *connection,
28463 GDBusProxyFlags flags,
28464 const gchar *name,
28465 const gchar *object_path,
28466 GCancellable *cancellable,
28467 GAsyncReadyCallback callback,
28468 gpointer user_data)
28469{
28470 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);
28471}
28472
28473/**
28474 * led_proxy_new_finish:
28475 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_proxy_new().
28476 * @error: Return location for error or %NULL
28477 *
28478 * Finishes an operation started with led_proxy_new().
28479 *
28480 * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set.
28481 */
28482Led *
28483led_proxy_new_finish (
28484 GAsyncResult *res,
28485 GError **error)
28486{
28487 GObject *ret;
28488 GObject *source_object;
28489 source_object = g_async_result_get_source_object (res);
28490 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
28491 g_object_unref (source_object);
28492 if (ret != NULL)
28493 return LED (ret);
28494 else
28495 return NULL;
28496}
28497
28498/**
28499 * led_proxy_new_sync:
28500 * @connection: A #GDBusConnection.
28501 * @flags: Flags from the #GDBusProxyFlags enumeration.
28502 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
28503 * @object_path: An object path.
28504 * @cancellable: (allow-none): A #GCancellable or %NULL.
28505 * @error: Return location for error or %NULL
28506 *
28507 * 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.
28508 *
28509 * The calling thread is blocked until a reply is received.
28510 *
28511 * See led_proxy_new() for the asynchronous version of this constructor.
28512 *
28513 * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set.
28514 */
28515Led *
28516led_proxy_new_sync (
28517 GDBusConnection *connection,
28518 GDBusProxyFlags flags,
28519 const gchar *name,
28520 const gchar *object_path,
28521 GCancellable *cancellable,
28522 GError **error)
28523{
28524 GInitable *ret;
28525 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);
28526 if (ret != NULL)
28527 return LED (ret);
28528 else
28529 return NULL;
28530}
28531
28532
28533/**
28534 * led_proxy_new_for_bus:
28535 * @bus_type: A #GBusType.
28536 * @flags: Flags from the #GDBusProxyFlags enumeration.
28537 * @name: A bus name (well-known or unique).
28538 * @object_path: An object path.
28539 * @cancellable: (allow-none): A #GCancellable or %NULL.
28540 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
28541 * @user_data: User data to pass to @callback.
28542 *
28543 * Like led_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
28544 *
28545 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
28546 * You can then call led_proxy_new_for_bus_finish() to get the result of the operation.
28547 *
28548 * See led_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
28549 */
28550void
28551led_proxy_new_for_bus (
28552 GBusType bus_type,
28553 GDBusProxyFlags flags,
28554 const gchar *name,
28555 const gchar *object_path,
28556 GCancellable *cancellable,
28557 GAsyncReadyCallback callback,
28558 gpointer user_data)
28559{
28560 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);
28561}
28562
28563/**
28564 * led_proxy_new_for_bus_finish:
28565 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_proxy_new_for_bus().
28566 * @error: Return location for error or %NULL
28567 *
28568 * Finishes an operation started with led_proxy_new_for_bus().
28569 *
28570 * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set.
28571 */
28572Led *
28573led_proxy_new_for_bus_finish (
28574 GAsyncResult *res,
28575 GError **error)
28576{
28577 GObject *ret;
28578 GObject *source_object;
28579 source_object = g_async_result_get_source_object (res);
28580 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
28581 g_object_unref (source_object);
28582 if (ret != NULL)
28583 return LED (ret);
28584 else
28585 return NULL;
28586}
28587
28588/**
28589 * led_proxy_new_for_bus_sync:
28590 * @bus_type: A #GBusType.
28591 * @flags: Flags from the #GDBusProxyFlags enumeration.
28592 * @name: A bus name (well-known or unique).
28593 * @object_path: An object path.
28594 * @cancellable: (allow-none): A #GCancellable or %NULL.
28595 * @error: Return location for error or %NULL
28596 *
28597 * Like led_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
28598 *
28599 * The calling thread is blocked until a reply is received.
28600 *
28601 * See led_proxy_new_for_bus() for the asynchronous version of this constructor.
28602 *
28603 * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set.
28604 */
28605Led *
28606led_proxy_new_for_bus_sync (
28607 GBusType bus_type,
28608 GDBusProxyFlags flags,
28609 const gchar *name,
28610 const gchar *object_path,
28611 GCancellable *cancellable,
28612 GError **error)
28613{
28614 GInitable *ret;
28615 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);
28616 if (ret != NULL)
28617 return LED (ret);
28618 else
28619 return NULL;
28620}
28621
28622
28623/* ------------------------------------------------------------------------ */
28624
28625/**
28626 * LedSkeleton:
28627 *
28628 * The #LedSkeleton structure contains only private data and should only be accessed using the provided API.
28629 */
28630
28631/**
28632 * LedSkeletonClass:
28633 * @parent_class: The parent class.
28634 *
28635 * Class structure for #LedSkeleton.
28636 */
28637
28638struct _LedSkeletonPrivate
28639{
28640 GValue *properties;
28641 GList *changed_properties;
28642 GSource *changed_properties_idle_source;
28643 GMainContext *context;
28644 GMutex lock;
28645};
28646
28647static void
28648_led_skeleton_handle_method_call (
28649 GDBusConnection *connection G_GNUC_UNUSED,
28650 const gchar *sender G_GNUC_UNUSED,
28651 const gchar *object_path G_GNUC_UNUSED,
28652 const gchar *interface_name,
28653 const gchar *method_name,
28654 GVariant *parameters,
28655 GDBusMethodInvocation *invocation,
28656 gpointer user_data)
28657{
28658 LedSkeleton *skeleton = LED_SKELETON (user_data);
28659 _ExtendedGDBusMethodInfo *info;
28660 GVariantIter iter;
28661 GVariant *child;
28662 GValue *paramv;
28663 guint num_params;
28664 guint num_extra;
28665 guint n;
28666 guint signal_id;
28667 GValue return_value = G_VALUE_INIT;
28668 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
28669 g_assert (info != NULL);
28670 num_params = g_variant_n_children (parameters);
28671 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
28672 n = 0;
28673 g_value_init (&paramv[n], TYPE_LED);
28674 g_value_set_object (&paramv[n++], skeleton);
28675 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
28676 g_value_set_object (&paramv[n++], invocation);
28677 if (info->pass_fdlist)
28678 {
28679#ifdef G_OS_UNIX
28680 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
28681 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
28682#else
28683 g_assert_not_reached ();
28684#endif
28685 }
28686 g_variant_iter_init (&iter, parameters);
28687 while ((child = g_variant_iter_next_value (&iter)) != NULL)
28688 {
28689 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
28690 if (arg_info->use_gvariant)
28691 {
28692 g_value_init (&paramv[n], G_TYPE_VARIANT);
28693 g_value_set_variant (&paramv[n], child);
28694 n++;
28695 }
28696 else
28697 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
28698 g_variant_unref (child);
28699 }
28700 signal_id = g_signal_lookup (info->signal_name, TYPE_LED);
28701 g_value_init (&return_value, G_TYPE_BOOLEAN);
28702 g_signal_emitv (paramv, signal_id, 0, &return_value);
28703 if (!g_value_get_boolean (&return_value))
28704 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);
28705 g_value_unset (&return_value);
28706 for (n = 0; n < num_params + num_extra; n++)
28707 g_value_unset (&paramv[n]);
28708 g_free (paramv);
28709}
28710
28711static GVariant *
28712_led_skeleton_handle_get_property (
28713 GDBusConnection *connection G_GNUC_UNUSED,
28714 const gchar *sender G_GNUC_UNUSED,
28715 const gchar *object_path G_GNUC_UNUSED,
28716 const gchar *interface_name G_GNUC_UNUSED,
28717 const gchar *property_name,
28718 GError **error,
28719 gpointer user_data)
28720{
28721 LedSkeleton *skeleton = LED_SKELETON (user_data);
28722 GValue value = G_VALUE_INIT;
28723 GParamSpec *pspec;
28724 _ExtendedGDBusPropertyInfo *info;
28725 GVariant *ret;
28726 ret = NULL;
28727 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, property_name);
28728 g_assert (info != NULL);
28729 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
28730 if (pspec == NULL)
28731 {
28732 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
28733 }
28734 else
28735 {
28736 g_value_init (&value, pspec->value_type);
28737 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
28738 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
28739 g_value_unset (&value);
28740 }
28741 return ret;
28742}
28743
28744static gboolean
28745_led_skeleton_handle_set_property (
28746 GDBusConnection *connection G_GNUC_UNUSED,
28747 const gchar *sender G_GNUC_UNUSED,
28748 const gchar *object_path G_GNUC_UNUSED,
28749 const gchar *interface_name G_GNUC_UNUSED,
28750 const gchar *property_name,
28751 GVariant *variant,
28752 GError **error,
28753 gpointer user_data)
28754{
28755 LedSkeleton *skeleton = LED_SKELETON (user_data);
28756 GValue value = G_VALUE_INIT;
28757 GParamSpec *pspec;
28758 _ExtendedGDBusPropertyInfo *info;
28759 gboolean ret;
28760 ret = FALSE;
28761 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, property_name);
28762 g_assert (info != NULL);
28763 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
28764 if (pspec == NULL)
28765 {
28766 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
28767 }
28768 else
28769 {
28770 if (info->use_gvariant)
28771 g_value_set_variant (&value, variant);
28772 else
28773 g_dbus_gvariant_to_gvalue (variant, &value);
28774 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
28775 g_value_unset (&value);
28776 ret = TRUE;
28777 }
28778 return ret;
28779}
28780
28781static const GDBusInterfaceVTable _led_skeleton_vtable =
28782{
28783 _led_skeleton_handle_method_call,
28784 _led_skeleton_handle_get_property,
28785 _led_skeleton_handle_set_property,
28786 {NULL}
28787};
28788
28789static GDBusInterfaceInfo *
28790led_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
28791{
28792 return led_interface_info ();
28793}
28794
28795static GDBusInterfaceVTable *
28796led_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
28797{
28798 return (GDBusInterfaceVTable *) &_led_skeleton_vtable;
28799}
28800
28801static GVariant *
28802led_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
28803{
28804 LedSkeleton *skeleton = LED_SKELETON (_skeleton);
28805
28806 GVariantBuilder builder;
28807 guint n;
28808 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
28809 if (_led_interface_info.parent_struct.properties == NULL)
28810 goto out;
28811 for (n = 0; _led_interface_info.parent_struct.properties[n] != NULL; n++)
28812 {
28813 GDBusPropertyInfo *info = _led_interface_info.parent_struct.properties[n];
28814 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
28815 {
28816 GVariant *value;
28817 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);
28818 if (value != NULL)
28819 {
28820 g_variant_take_ref (value);
28821 g_variant_builder_add (&builder, "{sv}", info->name, value);
28822 g_variant_unref (value);
28823 }
28824 }
28825 }
28826out:
28827 return g_variant_builder_end (&builder);
28828}
28829
28830static gboolean _led_emit_changed (gpointer user_data);
28831
28832static void
28833led_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
28834{
28835 LedSkeleton *skeleton = LED_SKELETON (_skeleton);
28836 gboolean emit_changed = FALSE;
28837
28838 g_mutex_lock (&skeleton->priv->lock);
28839 if (skeleton->priv->changed_properties_idle_source != NULL)
28840 {
28841 g_source_destroy (skeleton->priv->changed_properties_idle_source);
28842 skeleton->priv->changed_properties_idle_source = NULL;
28843 emit_changed = TRUE;
28844 }
28845 g_mutex_unlock (&skeleton->priv->lock);
28846
28847 if (emit_changed)
28848 _led_emit_changed (skeleton);
28849}
28850
28851static void led_skeleton_iface_init (LedIface *iface);
28852#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
28853G_DEFINE_TYPE_WITH_CODE (LedSkeleton, led_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
28854 G_ADD_PRIVATE (LedSkeleton)
28855 G_IMPLEMENT_INTERFACE (TYPE_LED, led_skeleton_iface_init));
28856
28857#else
28858G_DEFINE_TYPE_WITH_CODE (LedSkeleton, led_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
28859 G_IMPLEMENT_INTERFACE (TYPE_LED, led_skeleton_iface_init));
28860
28861#endif
28862static void
28863led_skeleton_finalize (GObject *object)
28864{
28865 LedSkeleton *skeleton = LED_SKELETON (object);
28866 guint n;
Norman James493996c2015-10-31 17:27:13 -050028867 for (n = 0; n < 3; n++)
Norman James362a80f2015-09-14 14:04:39 -050028868 g_value_unset (&skeleton->priv->properties[n]);
28869 g_free (skeleton->priv->properties);
28870 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
28871 if (skeleton->priv->changed_properties_idle_source != NULL)
28872 g_source_destroy (skeleton->priv->changed_properties_idle_source);
28873 g_main_context_unref (skeleton->priv->context);
28874 g_mutex_clear (&skeleton->priv->lock);
28875 G_OBJECT_CLASS (led_skeleton_parent_class)->finalize (object);
28876}
28877
28878static void
28879led_skeleton_get_property (GObject *object,
28880 guint prop_id,
28881 GValue *value,
28882 GParamSpec *pspec G_GNUC_UNUSED)
28883{
28884 LedSkeleton *skeleton = LED_SKELETON (object);
Norman James493996c2015-10-31 17:27:13 -050028885 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -050028886 g_mutex_lock (&skeleton->priv->lock);
28887 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
28888 g_mutex_unlock (&skeleton->priv->lock);
28889}
28890
28891static gboolean
28892_led_emit_changed (gpointer user_data)
28893{
28894 LedSkeleton *skeleton = LED_SKELETON (user_data);
28895 GList *l;
28896 GVariantBuilder builder;
28897 GVariantBuilder invalidated_builder;
28898 guint num_changes;
28899
28900 g_mutex_lock (&skeleton->priv->lock);
28901 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
28902 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
28903 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
28904 {
28905 ChangedProperty *cp = l->data;
28906 GVariant *variant;
28907 const GValue *cur_value;
28908
28909 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
28910 if (!_g_value_equal (cur_value, &cp->orig_value))
28911 {
28912 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
28913 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
28914 g_variant_unref (variant);
28915 num_changes++;
28916 }
28917 }
28918 if (num_changes > 0)
28919 {
28920 GList *connections, *ll;
28921 GVariant *signal_variant;
28922 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Led",
28923 &builder, &invalidated_builder));
28924 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
28925 for (ll = connections; ll != NULL; ll = ll->next)
28926 {
28927 GDBusConnection *connection = ll->data;
28928
28929 g_dbus_connection_emit_signal (connection,
28930 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
28931 "org.freedesktop.DBus.Properties",
28932 "PropertiesChanged",
28933 signal_variant,
28934 NULL);
28935 }
28936 g_variant_unref (signal_variant);
28937 g_list_free_full (connections, g_object_unref);
28938 }
28939 else
28940 {
28941 g_variant_builder_clear (&builder);
28942 g_variant_builder_clear (&invalidated_builder);
28943 }
28944 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
28945 skeleton->priv->changed_properties = NULL;
28946 skeleton->priv->changed_properties_idle_source = NULL;
28947 g_mutex_unlock (&skeleton->priv->lock);
28948 return FALSE;
28949}
28950
28951static void
28952_led_schedule_emit_changed (LedSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
28953{
28954 ChangedProperty *cp;
28955 GList *l;
28956 cp = NULL;
28957 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
28958 {
28959 ChangedProperty *i_cp = l->data;
28960 if (i_cp->info == info)
28961 {
28962 cp = i_cp;
28963 break;
28964 }
28965 }
28966 if (cp == NULL)
28967 {
28968 cp = g_new0 (ChangedProperty, 1);
28969 cp->prop_id = prop_id;
28970 cp->info = info;
28971 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
28972 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
28973 g_value_copy (orig_value, &cp->orig_value);
28974 }
28975}
28976
28977static void
28978led_skeleton_notify (GObject *object,
28979 GParamSpec *pspec G_GNUC_UNUSED)
28980{
28981 LedSkeleton *skeleton = LED_SKELETON (object);
28982 g_mutex_lock (&skeleton->priv->lock);
28983 if (skeleton->priv->changed_properties != NULL &&
28984 skeleton->priv->changed_properties_idle_source == NULL)
28985 {
28986 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
28987 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
28988 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _led_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
28989 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
28990 g_source_unref (skeleton->priv->changed_properties_idle_source);
28991 }
28992 g_mutex_unlock (&skeleton->priv->lock);
28993}
28994
28995static void
28996led_skeleton_set_property (GObject *object,
28997 guint prop_id,
28998 const GValue *value,
28999 GParamSpec *pspec)
29000{
29001 LedSkeleton *skeleton = LED_SKELETON (object);
Norman James493996c2015-10-31 17:27:13 -050029002 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -050029003 g_mutex_lock (&skeleton->priv->lock);
29004 g_object_freeze_notify (object);
29005 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
29006 {
29007 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
29008 _led_schedule_emit_changed (skeleton, _led_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
29009 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
29010 g_object_notify_by_pspec (object, pspec);
29011 }
29012 g_mutex_unlock (&skeleton->priv->lock);
29013 g_object_thaw_notify (object);
29014}
29015
29016static void
29017led_skeleton_init (LedSkeleton *skeleton)
29018{
29019#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
29020 skeleton->priv = led_skeleton_get_instance_private (skeleton);
29021#else
29022 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_LED_SKELETON, LedSkeletonPrivate);
29023#endif
29024
29025 g_mutex_init (&skeleton->priv->lock);
29026 skeleton->priv->context = g_main_context_ref_thread_default ();
Norman James493996c2015-10-31 17:27:13 -050029027 skeleton->priv->properties = g_new0 (GValue, 3);
Norman James362a80f2015-09-14 14:04:39 -050029028 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
29029 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
Norman James493996c2015-10-31 17:27:13 -050029030 g_value_init (&skeleton->priv->properties[2], G_TYPE_STRING);
Norman James362a80f2015-09-14 14:04:39 -050029031}
29032
29033static gint
29034led_skeleton_get_color (Led *object)
29035{
29036 LedSkeleton *skeleton = LED_SKELETON (object);
29037 gint value;
29038 g_mutex_lock (&skeleton->priv->lock);
29039 value = g_value_get_int (&(skeleton->priv->properties[0]));
29040 g_mutex_unlock (&skeleton->priv->lock);
29041 return value;
29042}
29043
29044static const gchar *
29045led_skeleton_get_function (Led *object)
29046{
29047 LedSkeleton *skeleton = LED_SKELETON (object);
29048 const gchar *value;
29049 g_mutex_lock (&skeleton->priv->lock);
29050 value = g_value_get_string (&(skeleton->priv->properties[1]));
29051 g_mutex_unlock (&skeleton->priv->lock);
29052 return value;
29053}
29054
Norman James493996c2015-10-31 17:27:13 -050029055static const gchar *
29056led_skeleton_get_state (Led *object)
29057{
29058 LedSkeleton *skeleton = LED_SKELETON (object);
29059 const gchar *value;
29060 g_mutex_lock (&skeleton->priv->lock);
29061 value = g_value_get_string (&(skeleton->priv->properties[2]));
29062 g_mutex_unlock (&skeleton->priv->lock);
29063 return value;
29064}
29065
Norman James362a80f2015-09-14 14:04:39 -050029066static void
29067led_skeleton_class_init (LedSkeletonClass *klass)
29068{
29069 GObjectClass *gobject_class;
29070 GDBusInterfaceSkeletonClass *skeleton_class;
29071
29072 gobject_class = G_OBJECT_CLASS (klass);
29073 gobject_class->finalize = led_skeleton_finalize;
29074 gobject_class->get_property = led_skeleton_get_property;
29075 gobject_class->set_property = led_skeleton_set_property;
29076 gobject_class->notify = led_skeleton_notify;
29077
29078
29079 led_override_properties (gobject_class, 1);
29080
29081 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
29082 skeleton_class->get_info = led_skeleton_dbus_interface_get_info;
29083 skeleton_class->get_properties = led_skeleton_dbus_interface_get_properties;
29084 skeleton_class->flush = led_skeleton_dbus_interface_flush;
29085 skeleton_class->get_vtable = led_skeleton_dbus_interface_get_vtable;
29086
29087#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
29088 g_type_class_add_private (klass, sizeof (LedSkeletonPrivate));
29089#endif
29090}
29091
29092static void
29093led_skeleton_iface_init (LedIface *iface)
29094{
29095 iface->get_color = led_skeleton_get_color;
29096 iface->get_function = led_skeleton_get_function;
Norman James493996c2015-10-31 17:27:13 -050029097 iface->get_state = led_skeleton_get_state;
Norman James362a80f2015-09-14 14:04:39 -050029098}
29099
29100/**
29101 * led_skeleton_new:
29102 *
29103 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>.
29104 *
29105 * Returns: (transfer full) (type LedSkeleton): The skeleton object.
29106 */
29107Led *
29108led_skeleton_new (void)
29109{
29110 return LED (g_object_new (TYPE_LED_SKELETON, NULL));
29111}
29112
29113/* ------------------------------------------------------------------------
Norman Jamesdbcffbd2015-10-06 16:53:06 -050029114 * Code for interface org.openbmc.HostIpmi
29115 * ------------------------------------------------------------------------
29116 */
29117
29118/**
29119 * SECTION:HostIpmi
29120 * @title: HostIpmi
29121 * @short_description: Generated C code for the org.openbmc.HostIpmi D-Bus interface
29122 *
29123 * 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.
29124 */
29125
29126/* ---- Introspection data for org.openbmc.HostIpmi ---- */
29127
29128static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_IN_ARG_seq =
29129{
29130 {
29131 -1,
29132 (gchar *) "seq",
29133 (gchar *) "y",
29134 NULL
29135 },
29136 FALSE
29137};
29138
29139static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_IN_ARG_netfn =
29140{
29141 {
29142 -1,
29143 (gchar *) "netfn",
29144 (gchar *) "y",
29145 NULL
29146 },
29147 FALSE
29148};
29149
29150static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_IN_ARG_cmd =
29151{
29152 {
29153 -1,
29154 (gchar *) "cmd",
29155 (gchar *) "y",
29156 NULL
29157 },
29158 FALSE
29159};
29160
29161static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_IN_ARG_data =
29162{
29163 {
29164 -1,
29165 (gchar *) "data",
29166 (gchar *) "ay",
29167 NULL
29168 },
29169 FALSE
29170};
29171
29172static const _ExtendedGDBusArgInfo * const _host_ipmi_method_info_send_message_IN_ARG_pointers[] =
29173{
29174 &_host_ipmi_method_info_send_message_IN_ARG_seq,
29175 &_host_ipmi_method_info_send_message_IN_ARG_netfn,
29176 &_host_ipmi_method_info_send_message_IN_ARG_cmd,
29177 &_host_ipmi_method_info_send_message_IN_ARG_data,
29178 NULL
29179};
29180
29181static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_OUT_ARG_unnamed_arg4 =
29182{
29183 {
29184 -1,
29185 (gchar *) "unnamed_arg4",
29186 (gchar *) "x",
29187 NULL
29188 },
29189 FALSE
29190};
29191
29192static const _ExtendedGDBusArgInfo * const _host_ipmi_method_info_send_message_OUT_ARG_pointers[] =
29193{
29194 &_host_ipmi_method_info_send_message_OUT_ARG_unnamed_arg4,
29195 NULL
29196};
29197
29198static const _ExtendedGDBusMethodInfo _host_ipmi_method_info_send_message =
29199{
29200 {
29201 -1,
29202 (gchar *) "sendMessage",
29203 (GDBusArgInfo **) &_host_ipmi_method_info_send_message_IN_ARG_pointers,
29204 (GDBusArgInfo **) &_host_ipmi_method_info_send_message_OUT_ARG_pointers,
29205 NULL
29206 },
29207 "handle-send-message",
29208 FALSE
29209};
29210
29211static const _ExtendedGDBusMethodInfo * const _host_ipmi_method_info_pointers[] =
29212{
29213 &_host_ipmi_method_info_send_message,
29214 NULL
29215};
29216
29217static const _ExtendedGDBusArgInfo _host_ipmi_signal_info_received_message_ARG_seq =
29218{
29219 {
29220 -1,
29221 (gchar *) "seq",
29222 (gchar *) "y",
29223 NULL
29224 },
29225 FALSE
29226};
29227
29228static const _ExtendedGDBusArgInfo _host_ipmi_signal_info_received_message_ARG_netfn =
29229{
29230 {
29231 -1,
29232 (gchar *) "netfn",
29233 (gchar *) "y",
29234 NULL
29235 },
29236 FALSE
29237};
29238
29239static const _ExtendedGDBusArgInfo _host_ipmi_signal_info_received_message_ARG_cmd =
29240{
29241 {
29242 -1,
29243 (gchar *) "cmd",
29244 (gchar *) "y",
29245 NULL
29246 },
29247 FALSE
29248};
29249
29250static const _ExtendedGDBusArgInfo _host_ipmi_signal_info_received_message_ARG_data =
29251{
29252 {
29253 -1,
29254 (gchar *) "data",
29255 (gchar *) "ay",
29256 NULL
29257 },
29258 FALSE
29259};
29260
29261static const _ExtendedGDBusArgInfo * const _host_ipmi_signal_info_received_message_ARG_pointers[] =
29262{
29263 &_host_ipmi_signal_info_received_message_ARG_seq,
29264 &_host_ipmi_signal_info_received_message_ARG_netfn,
29265 &_host_ipmi_signal_info_received_message_ARG_cmd,
29266 &_host_ipmi_signal_info_received_message_ARG_data,
29267 NULL
29268};
29269
29270static const _ExtendedGDBusSignalInfo _host_ipmi_signal_info_received_message =
29271{
29272 {
29273 -1,
29274 (gchar *) "ReceivedMessage",
29275 (GDBusArgInfo **) &_host_ipmi_signal_info_received_message_ARG_pointers,
29276 NULL
29277 },
29278 "received-message"
29279};
29280
29281static const _ExtendedGDBusSignalInfo * const _host_ipmi_signal_info_pointers[] =
29282{
29283 &_host_ipmi_signal_info_received_message,
29284 NULL
29285};
29286
29287static const _ExtendedGDBusInterfaceInfo _host_ipmi_interface_info =
29288{
29289 {
29290 -1,
29291 (gchar *) "org.openbmc.HostIpmi",
29292 (GDBusMethodInfo **) &_host_ipmi_method_info_pointers,
29293 (GDBusSignalInfo **) &_host_ipmi_signal_info_pointers,
29294 NULL,
29295 NULL
29296 },
29297 "host-ipmi",
29298};
29299
29300
29301/**
29302 * host_ipmi_interface_info:
29303 *
29304 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link> D-Bus interface.
29305 *
29306 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
29307 */
29308GDBusInterfaceInfo *
29309host_ipmi_interface_info (void)
29310{
29311 return (GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct;
29312}
29313
29314/**
29315 * host_ipmi_override_properties:
29316 * @klass: The class structure for a #GObject<!-- -->-derived class.
29317 * @property_id_begin: The property id to assign to the first overridden property.
29318 *
29319 * Overrides all #GObject properties in the #HostIpmi interface for a concrete class.
29320 * The properties are overridden in the order they are defined.
29321 *
29322 * Returns: The last property id.
29323 */
29324guint
29325host_ipmi_override_properties (GObjectClass *klass, guint property_id_begin)
29326{
29327 return property_id_begin - 1;
29328}
29329
29330
29331
29332/**
29333 * HostIpmi:
29334 *
29335 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link>.
29336 */
29337
29338/**
29339 * HostIpmiIface:
29340 * @parent_iface: The parent interface.
29341 * @handle_send_message: Handler for the #HostIpmi::handle-send-message signal.
29342 * @received_message: Handler for the #HostIpmi::received-message signal.
29343 *
29344 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link>.
29345 */
29346
29347typedef HostIpmiIface HostIpmiInterface;
29348G_DEFINE_INTERFACE (HostIpmi, host_ipmi, G_TYPE_OBJECT);
29349
29350static void
29351host_ipmi_default_init (HostIpmiIface *iface)
29352{
29353 /* GObject signals for incoming D-Bus method calls: */
29354 /**
29355 * HostIpmi::handle-send-message:
29356 * @object: A #HostIpmi.
29357 * @invocation: A #GDBusMethodInvocation.
29358 * @arg_seq: Argument passed by remote caller.
29359 * @arg_netfn: Argument passed by remote caller.
29360 * @arg_cmd: Argument passed by remote caller.
29361 * @arg_data: Argument passed by remote caller.
29362 *
29363 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-HostIpmi.sendMessage">sendMessage()</link> D-Bus method.
29364 *
29365 * 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.
29366 *
29367 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
29368 */
29369 g_signal_new ("handle-send-message",
29370 G_TYPE_FROM_INTERFACE (iface),
29371 G_SIGNAL_RUN_LAST,
29372 G_STRUCT_OFFSET (HostIpmiIface, handle_send_message),
29373 g_signal_accumulator_true_handled,
29374 NULL,
29375 g_cclosure_marshal_generic,
29376 G_TYPE_BOOLEAN,
29377 5,
29378 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_UCHAR, G_TYPE_UCHAR, G_TYPE_UCHAR, G_TYPE_STRING);
29379
29380 /* GObject signals for received D-Bus signals: */
29381 /**
29382 * HostIpmi::received-message:
29383 * @object: A #HostIpmi.
29384 * @arg_seq: Argument.
29385 * @arg_netfn: Argument.
29386 * @arg_cmd: Argument.
29387 * @arg_data: Argument.
29388 *
29389 * 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.
29390 *
29391 * 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.
29392 */
29393 g_signal_new ("received-message",
29394 G_TYPE_FROM_INTERFACE (iface),
29395 G_SIGNAL_RUN_LAST,
29396 G_STRUCT_OFFSET (HostIpmiIface, received_message),
29397 NULL,
29398 NULL,
29399 g_cclosure_marshal_generic,
29400 G_TYPE_NONE,
29401 4, G_TYPE_UCHAR, G_TYPE_UCHAR, G_TYPE_UCHAR, G_TYPE_STRING);
29402
29403}
29404
29405/**
29406 * host_ipmi_emit_received_message:
29407 * @object: A #HostIpmi.
29408 * @arg_seq: Argument to pass with the signal.
29409 * @arg_netfn: Argument to pass with the signal.
29410 * @arg_cmd: Argument to pass with the signal.
29411 * @arg_data: Argument to pass with the signal.
29412 *
29413 * Emits the <link linkend="gdbus-signal-org-openbmc-HostIpmi.ReceivedMessage">"ReceivedMessage"</link> D-Bus signal.
29414 */
29415void
29416host_ipmi_emit_received_message (
29417 HostIpmi *object,
29418 guchar arg_seq,
29419 guchar arg_netfn,
29420 guchar arg_cmd,
29421 const gchar *arg_data)
29422{
29423 g_signal_emit_by_name (object, "received-message", arg_seq, arg_netfn, arg_cmd, arg_data);
29424}
29425
29426/**
29427 * host_ipmi_call_send_message:
29428 * @proxy: A #HostIpmiProxy.
29429 * @arg_seq: Argument to pass with the method invocation.
29430 * @arg_netfn: Argument to pass with the method invocation.
29431 * @arg_cmd: Argument to pass with the method invocation.
29432 * @arg_data: Argument to pass with the method invocation.
29433 * @cancellable: (allow-none): A #GCancellable or %NULL.
29434 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
29435 * @user_data: User data to pass to @callback.
29436 *
29437 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-HostIpmi.sendMessage">sendMessage()</link> D-Bus method on @proxy.
29438 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
29439 * You can then call host_ipmi_call_send_message_finish() to get the result of the operation.
29440 *
29441 * See host_ipmi_call_send_message_sync() for the synchronous, blocking version of this method.
29442 */
29443void
29444host_ipmi_call_send_message (
29445 HostIpmi *proxy,
29446 guchar arg_seq,
29447 guchar arg_netfn,
29448 guchar arg_cmd,
29449 const gchar *arg_data,
29450 GCancellable *cancellable,
29451 GAsyncReadyCallback callback,
29452 gpointer user_data)
29453{
29454 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
29455 "sendMessage",
29456 g_variant_new ("(yyy^ay)",
29457 arg_seq,
29458 arg_netfn,
29459 arg_cmd,
29460 arg_data),
29461 G_DBUS_CALL_FLAGS_NONE,
29462 -1,
29463 cancellable,
29464 callback,
29465 user_data);
29466}
29467
29468/**
29469 * host_ipmi_call_send_message_finish:
29470 * @proxy: A #HostIpmiProxy.
29471 * @out_unnamed_arg4: (out): Return location for return parameter or %NULL to ignore.
29472 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to host_ipmi_call_send_message().
29473 * @error: Return location for error or %NULL.
29474 *
29475 * Finishes an operation started with host_ipmi_call_send_message().
29476 *
29477 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
29478 */
29479gboolean
29480host_ipmi_call_send_message_finish (
29481 HostIpmi *proxy,
29482 gint64 *out_unnamed_arg4,
29483 GAsyncResult *res,
29484 GError **error)
29485{
29486 GVariant *_ret;
29487 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
29488 if (_ret == NULL)
29489 goto _out;
29490 g_variant_get (_ret,
29491 "(x)",
29492 out_unnamed_arg4);
29493 g_variant_unref (_ret);
29494_out:
29495 return _ret != NULL;
29496}
29497
29498/**
29499 * host_ipmi_call_send_message_sync:
29500 * @proxy: A #HostIpmiProxy.
29501 * @arg_seq: Argument to pass with the method invocation.
29502 * @arg_netfn: Argument to pass with the method invocation.
29503 * @arg_cmd: Argument to pass with the method invocation.
29504 * @arg_data: Argument to pass with the method invocation.
29505 * @out_unnamed_arg4: (out): Return location for return parameter or %NULL to ignore.
29506 * @cancellable: (allow-none): A #GCancellable or %NULL.
29507 * @error: Return location for error or %NULL.
29508 *
29509 * 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.
29510 *
29511 * See host_ipmi_call_send_message() for the asynchronous version of this method.
29512 *
29513 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
29514 */
29515gboolean
29516host_ipmi_call_send_message_sync (
29517 HostIpmi *proxy,
29518 guchar arg_seq,
29519 guchar arg_netfn,
29520 guchar arg_cmd,
29521 const gchar *arg_data,
29522 gint64 *out_unnamed_arg4,
29523 GCancellable *cancellable,
29524 GError **error)
29525{
29526 GVariant *_ret;
29527 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
29528 "sendMessage",
29529 g_variant_new ("(yyy^ay)",
29530 arg_seq,
29531 arg_netfn,
29532 arg_cmd,
29533 arg_data),
29534 G_DBUS_CALL_FLAGS_NONE,
29535 -1,
29536 cancellable,
29537 error);
29538 if (_ret == NULL)
29539 goto _out;
29540 g_variant_get (_ret,
29541 "(x)",
29542 out_unnamed_arg4);
29543 g_variant_unref (_ret);
29544_out:
29545 return _ret != NULL;
29546}
29547
29548/**
29549 * host_ipmi_complete_send_message:
29550 * @object: A #HostIpmi.
29551 * @invocation: (transfer full): A #GDBusMethodInvocation.
29552 * @unnamed_arg4: Parameter to return.
29553 *
29554 * 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.
29555 *
29556 * This method will free @invocation, you cannot use it afterwards.
29557 */
29558void
29559host_ipmi_complete_send_message (
29560 HostIpmi *object,
29561 GDBusMethodInvocation *invocation,
29562 gint64 unnamed_arg4)
29563{
29564 g_dbus_method_invocation_return_value (invocation,
29565 g_variant_new ("(x)",
29566 unnamed_arg4));
29567}
29568
29569/* ------------------------------------------------------------------------ */
29570
29571/**
29572 * HostIpmiProxy:
29573 *
29574 * The #HostIpmiProxy structure contains only private data and should only be accessed using the provided API.
29575 */
29576
29577/**
29578 * HostIpmiProxyClass:
29579 * @parent_class: The parent class.
29580 *
29581 * Class structure for #HostIpmiProxy.
29582 */
29583
29584struct _HostIpmiProxyPrivate
29585{
29586 GData *qdata;
29587};
29588
29589static void host_ipmi_proxy_iface_init (HostIpmiIface *iface);
29590
29591#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
29592G_DEFINE_TYPE_WITH_CODE (HostIpmiProxy, host_ipmi_proxy, G_TYPE_DBUS_PROXY,
29593 G_ADD_PRIVATE (HostIpmiProxy)
29594 G_IMPLEMENT_INTERFACE (TYPE_HOST_IPMI, host_ipmi_proxy_iface_init));
29595
29596#else
29597G_DEFINE_TYPE_WITH_CODE (HostIpmiProxy, host_ipmi_proxy, G_TYPE_DBUS_PROXY,
29598 G_IMPLEMENT_INTERFACE (TYPE_HOST_IPMI, host_ipmi_proxy_iface_init));
29599
29600#endif
29601static void
29602host_ipmi_proxy_finalize (GObject *object)
29603{
29604 HostIpmiProxy *proxy = HOST_IPMI_PROXY (object);
29605 g_datalist_clear (&proxy->priv->qdata);
29606 G_OBJECT_CLASS (host_ipmi_proxy_parent_class)->finalize (object);
29607}
29608
29609static void
29610host_ipmi_proxy_get_property (GObject *object,
29611 guint prop_id,
29612 GValue *value,
29613 GParamSpec *pspec G_GNUC_UNUSED)
29614{
29615}
29616
29617static void
29618host_ipmi_proxy_set_property (GObject *object,
29619 guint prop_id,
29620 const GValue *value,
29621 GParamSpec *pspec G_GNUC_UNUSED)
29622{
29623}
29624
29625static void
29626host_ipmi_proxy_g_signal (GDBusProxy *proxy,
29627 const gchar *sender_name G_GNUC_UNUSED,
29628 const gchar *signal_name,
29629 GVariant *parameters)
29630{
29631 _ExtendedGDBusSignalInfo *info;
29632 GVariantIter iter;
29633 GVariant *child;
29634 GValue *paramv;
29635 guint num_params;
29636 guint n;
29637 guint signal_id;
29638 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, signal_name);
29639 if (info == NULL)
29640 return;
29641 num_params = g_variant_n_children (parameters);
29642 paramv = g_new0 (GValue, num_params + 1);
29643 g_value_init (&paramv[0], TYPE_HOST_IPMI);
29644 g_value_set_object (&paramv[0], proxy);
29645 g_variant_iter_init (&iter, parameters);
29646 n = 1;
29647 while ((child = g_variant_iter_next_value (&iter)) != NULL)
29648 {
29649 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
29650 if (arg_info->use_gvariant)
29651 {
29652 g_value_init (&paramv[n], G_TYPE_VARIANT);
29653 g_value_set_variant (&paramv[n], child);
29654 n++;
29655 }
29656 else
29657 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
29658 g_variant_unref (child);
29659 }
29660 signal_id = g_signal_lookup (info->signal_name, TYPE_HOST_IPMI);
29661 g_signal_emitv (paramv, signal_id, 0, NULL);
29662 for (n = 0; n < num_params + 1; n++)
29663 g_value_unset (&paramv[n]);
29664 g_free (paramv);
29665}
29666
29667static void
29668host_ipmi_proxy_g_properties_changed (GDBusProxy *_proxy,
29669 GVariant *changed_properties,
29670 const gchar *const *invalidated_properties)
29671{
29672 HostIpmiProxy *proxy = HOST_IPMI_PROXY (_proxy);
29673 guint n;
29674 const gchar *key;
29675 GVariantIter *iter;
29676 _ExtendedGDBusPropertyInfo *info;
29677 g_variant_get (changed_properties, "a{sv}", &iter);
29678 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
29679 {
29680 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, key);
29681 g_datalist_remove_data (&proxy->priv->qdata, key);
29682 if (info != NULL)
29683 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
29684 }
29685 g_variant_iter_free (iter);
29686 for (n = 0; invalidated_properties[n] != NULL; n++)
29687 {
29688 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, invalidated_properties[n]);
29689 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
29690 if (info != NULL)
29691 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
29692 }
29693}
29694
29695static void
29696host_ipmi_proxy_init (HostIpmiProxy *proxy)
29697{
29698#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
29699 proxy->priv = host_ipmi_proxy_get_instance_private (proxy);
29700#else
29701 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_HOST_IPMI_PROXY, HostIpmiProxyPrivate);
29702#endif
29703
29704 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), host_ipmi_interface_info ());
29705}
29706
29707static void
29708host_ipmi_proxy_class_init (HostIpmiProxyClass *klass)
29709{
29710 GObjectClass *gobject_class;
29711 GDBusProxyClass *proxy_class;
29712
29713 gobject_class = G_OBJECT_CLASS (klass);
29714 gobject_class->finalize = host_ipmi_proxy_finalize;
29715 gobject_class->get_property = host_ipmi_proxy_get_property;
29716 gobject_class->set_property = host_ipmi_proxy_set_property;
29717
29718 proxy_class = G_DBUS_PROXY_CLASS (klass);
29719 proxy_class->g_signal = host_ipmi_proxy_g_signal;
29720 proxy_class->g_properties_changed = host_ipmi_proxy_g_properties_changed;
29721
29722#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
29723 g_type_class_add_private (klass, sizeof (HostIpmiProxyPrivate));
29724#endif
29725}
29726
29727static void
29728host_ipmi_proxy_iface_init (HostIpmiIface *iface)
29729{
29730}
29731
29732/**
29733 * host_ipmi_proxy_new:
29734 * @connection: A #GDBusConnection.
29735 * @flags: Flags from the #GDBusProxyFlags enumeration.
29736 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
29737 * @object_path: An object path.
29738 * @cancellable: (allow-none): A #GCancellable or %NULL.
29739 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
29740 * @user_data: User data to pass to @callback.
29741 *
29742 * 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.
29743 *
29744 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
29745 * You can then call host_ipmi_proxy_new_finish() to get the result of the operation.
29746 *
29747 * See host_ipmi_proxy_new_sync() for the synchronous, blocking version of this constructor.
29748 */
29749void
29750host_ipmi_proxy_new (
29751 GDBusConnection *connection,
29752 GDBusProxyFlags flags,
29753 const gchar *name,
29754 const gchar *object_path,
29755 GCancellable *cancellable,
29756 GAsyncReadyCallback callback,
29757 gpointer user_data)
29758{
29759 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);
29760}
29761
29762/**
29763 * host_ipmi_proxy_new_finish:
29764 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to host_ipmi_proxy_new().
29765 * @error: Return location for error or %NULL
29766 *
29767 * Finishes an operation started with host_ipmi_proxy_new().
29768 *
29769 * Returns: (transfer full) (type HostIpmiProxy): The constructed proxy object or %NULL if @error is set.
29770 */
29771HostIpmi *
29772host_ipmi_proxy_new_finish (
29773 GAsyncResult *res,
29774 GError **error)
29775{
29776 GObject *ret;
29777 GObject *source_object;
29778 source_object = g_async_result_get_source_object (res);
29779 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
29780 g_object_unref (source_object);
29781 if (ret != NULL)
29782 return HOST_IPMI (ret);
29783 else
29784 return NULL;
29785}
29786
29787/**
29788 * host_ipmi_proxy_new_sync:
29789 * @connection: A #GDBusConnection.
29790 * @flags: Flags from the #GDBusProxyFlags enumeration.
29791 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
29792 * @object_path: An object path.
29793 * @cancellable: (allow-none): A #GCancellable or %NULL.
29794 * @error: Return location for error or %NULL
29795 *
29796 * 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.
29797 *
29798 * The calling thread is blocked until a reply is received.
29799 *
29800 * See host_ipmi_proxy_new() for the asynchronous version of this constructor.
29801 *
29802 * Returns: (transfer full) (type HostIpmiProxy): The constructed proxy object or %NULL if @error is set.
29803 */
29804HostIpmi *
29805host_ipmi_proxy_new_sync (
29806 GDBusConnection *connection,
29807 GDBusProxyFlags flags,
29808 const gchar *name,
29809 const gchar *object_path,
29810 GCancellable *cancellable,
29811 GError **error)
29812{
29813 GInitable *ret;
29814 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);
29815 if (ret != NULL)
29816 return HOST_IPMI (ret);
29817 else
29818 return NULL;
29819}
29820
29821
29822/**
29823 * host_ipmi_proxy_new_for_bus:
29824 * @bus_type: A #GBusType.
29825 * @flags: Flags from the #GDBusProxyFlags enumeration.
29826 * @name: A bus name (well-known or unique).
29827 * @object_path: An object path.
29828 * @cancellable: (allow-none): A #GCancellable or %NULL.
29829 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
29830 * @user_data: User data to pass to @callback.
29831 *
29832 * Like host_ipmi_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
29833 *
29834 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
29835 * You can then call host_ipmi_proxy_new_for_bus_finish() to get the result of the operation.
29836 *
29837 * See host_ipmi_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
29838 */
29839void
29840host_ipmi_proxy_new_for_bus (
29841 GBusType bus_type,
29842 GDBusProxyFlags flags,
29843 const gchar *name,
29844 const gchar *object_path,
29845 GCancellable *cancellable,
29846 GAsyncReadyCallback callback,
29847 gpointer user_data)
29848{
29849 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);
29850}
29851
29852/**
29853 * host_ipmi_proxy_new_for_bus_finish:
29854 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to host_ipmi_proxy_new_for_bus().
29855 * @error: Return location for error or %NULL
29856 *
29857 * Finishes an operation started with host_ipmi_proxy_new_for_bus().
29858 *
29859 * Returns: (transfer full) (type HostIpmiProxy): The constructed proxy object or %NULL if @error is set.
29860 */
29861HostIpmi *
29862host_ipmi_proxy_new_for_bus_finish (
29863 GAsyncResult *res,
29864 GError **error)
29865{
29866 GObject *ret;
29867 GObject *source_object;
29868 source_object = g_async_result_get_source_object (res);
29869 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
29870 g_object_unref (source_object);
29871 if (ret != NULL)
29872 return HOST_IPMI (ret);
29873 else
29874 return NULL;
29875}
29876
29877/**
29878 * host_ipmi_proxy_new_for_bus_sync:
29879 * @bus_type: A #GBusType.
29880 * @flags: Flags from the #GDBusProxyFlags enumeration.
29881 * @name: A bus name (well-known or unique).
29882 * @object_path: An object path.
29883 * @cancellable: (allow-none): A #GCancellable or %NULL.
29884 * @error: Return location for error or %NULL
29885 *
29886 * Like host_ipmi_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
29887 *
29888 * The calling thread is blocked until a reply is received.
29889 *
29890 * See host_ipmi_proxy_new_for_bus() for the asynchronous version of this constructor.
29891 *
29892 * Returns: (transfer full) (type HostIpmiProxy): The constructed proxy object or %NULL if @error is set.
29893 */
29894HostIpmi *
29895host_ipmi_proxy_new_for_bus_sync (
29896 GBusType bus_type,
29897 GDBusProxyFlags flags,
29898 const gchar *name,
29899 const gchar *object_path,
29900 GCancellable *cancellable,
29901 GError **error)
29902{
29903 GInitable *ret;
29904 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);
29905 if (ret != NULL)
29906 return HOST_IPMI (ret);
29907 else
29908 return NULL;
29909}
29910
29911
29912/* ------------------------------------------------------------------------ */
29913
29914/**
29915 * HostIpmiSkeleton:
29916 *
29917 * The #HostIpmiSkeleton structure contains only private data and should only be accessed using the provided API.
29918 */
29919
29920/**
29921 * HostIpmiSkeletonClass:
29922 * @parent_class: The parent class.
29923 *
29924 * Class structure for #HostIpmiSkeleton.
29925 */
29926
29927struct _HostIpmiSkeletonPrivate
29928{
29929 GValue *properties;
29930 GList *changed_properties;
29931 GSource *changed_properties_idle_source;
29932 GMainContext *context;
29933 GMutex lock;
29934};
29935
29936static void
29937_host_ipmi_skeleton_handle_method_call (
29938 GDBusConnection *connection G_GNUC_UNUSED,
29939 const gchar *sender G_GNUC_UNUSED,
29940 const gchar *object_path G_GNUC_UNUSED,
29941 const gchar *interface_name,
29942 const gchar *method_name,
29943 GVariant *parameters,
29944 GDBusMethodInvocation *invocation,
29945 gpointer user_data)
29946{
29947 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (user_data);
29948 _ExtendedGDBusMethodInfo *info;
29949 GVariantIter iter;
29950 GVariant *child;
29951 GValue *paramv;
29952 guint num_params;
29953 guint num_extra;
29954 guint n;
29955 guint signal_id;
29956 GValue return_value = G_VALUE_INIT;
29957 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
29958 g_assert (info != NULL);
29959 num_params = g_variant_n_children (parameters);
29960 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
29961 n = 0;
29962 g_value_init (&paramv[n], TYPE_HOST_IPMI);
29963 g_value_set_object (&paramv[n++], skeleton);
29964 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
29965 g_value_set_object (&paramv[n++], invocation);
29966 if (info->pass_fdlist)
29967 {
29968#ifdef G_OS_UNIX
29969 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
29970 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
29971#else
29972 g_assert_not_reached ();
29973#endif
29974 }
29975 g_variant_iter_init (&iter, parameters);
29976 while ((child = g_variant_iter_next_value (&iter)) != NULL)
29977 {
29978 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
29979 if (arg_info->use_gvariant)
29980 {
29981 g_value_init (&paramv[n], G_TYPE_VARIANT);
29982 g_value_set_variant (&paramv[n], child);
29983 n++;
29984 }
29985 else
29986 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
29987 g_variant_unref (child);
29988 }
29989 signal_id = g_signal_lookup (info->signal_name, TYPE_HOST_IPMI);
29990 g_value_init (&return_value, G_TYPE_BOOLEAN);
29991 g_signal_emitv (paramv, signal_id, 0, &return_value);
29992 if (!g_value_get_boolean (&return_value))
29993 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);
29994 g_value_unset (&return_value);
29995 for (n = 0; n < num_params + num_extra; n++)
29996 g_value_unset (&paramv[n]);
29997 g_free (paramv);
29998}
29999
30000static GVariant *
30001_host_ipmi_skeleton_handle_get_property (
30002 GDBusConnection *connection G_GNUC_UNUSED,
30003 const gchar *sender G_GNUC_UNUSED,
30004 const gchar *object_path G_GNUC_UNUSED,
30005 const gchar *interface_name G_GNUC_UNUSED,
30006 const gchar *property_name,
30007 GError **error,
30008 gpointer user_data)
30009{
30010 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (user_data);
30011 GValue value = G_VALUE_INIT;
30012 GParamSpec *pspec;
30013 _ExtendedGDBusPropertyInfo *info;
30014 GVariant *ret;
30015 ret = NULL;
30016 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, property_name);
30017 g_assert (info != NULL);
30018 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
30019 if (pspec == NULL)
30020 {
30021 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
30022 }
30023 else
30024 {
30025 g_value_init (&value, pspec->value_type);
30026 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
30027 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
30028 g_value_unset (&value);
30029 }
30030 return ret;
30031}
30032
30033static gboolean
30034_host_ipmi_skeleton_handle_set_property (
30035 GDBusConnection *connection G_GNUC_UNUSED,
30036 const gchar *sender G_GNUC_UNUSED,
30037 const gchar *object_path G_GNUC_UNUSED,
30038 const gchar *interface_name G_GNUC_UNUSED,
30039 const gchar *property_name,
30040 GVariant *variant,
30041 GError **error,
30042 gpointer user_data)
30043{
30044 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (user_data);
30045 GValue value = G_VALUE_INIT;
30046 GParamSpec *pspec;
30047 _ExtendedGDBusPropertyInfo *info;
30048 gboolean ret;
30049 ret = FALSE;
30050 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, property_name);
30051 g_assert (info != NULL);
30052 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
30053 if (pspec == NULL)
30054 {
30055 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
30056 }
30057 else
30058 {
30059 if (info->use_gvariant)
30060 g_value_set_variant (&value, variant);
30061 else
30062 g_dbus_gvariant_to_gvalue (variant, &value);
30063 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
30064 g_value_unset (&value);
30065 ret = TRUE;
30066 }
30067 return ret;
30068}
30069
30070static const GDBusInterfaceVTable _host_ipmi_skeleton_vtable =
30071{
30072 _host_ipmi_skeleton_handle_method_call,
30073 _host_ipmi_skeleton_handle_get_property,
30074 _host_ipmi_skeleton_handle_set_property,
30075 {NULL}
30076};
30077
30078static GDBusInterfaceInfo *
30079host_ipmi_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
30080{
30081 return host_ipmi_interface_info ();
30082}
30083
30084static GDBusInterfaceVTable *
30085host_ipmi_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
30086{
30087 return (GDBusInterfaceVTable *) &_host_ipmi_skeleton_vtable;
30088}
30089
30090static GVariant *
30091host_ipmi_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
30092{
30093 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (_skeleton);
30094
30095 GVariantBuilder builder;
30096 guint n;
30097 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
30098 if (_host_ipmi_interface_info.parent_struct.properties == NULL)
30099 goto out;
30100 for (n = 0; _host_ipmi_interface_info.parent_struct.properties[n] != NULL; n++)
30101 {
30102 GDBusPropertyInfo *info = _host_ipmi_interface_info.parent_struct.properties[n];
30103 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
30104 {
30105 GVariant *value;
30106 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);
30107 if (value != NULL)
30108 {
30109 g_variant_take_ref (value);
30110 g_variant_builder_add (&builder, "{sv}", info->name, value);
30111 g_variant_unref (value);
30112 }
30113 }
30114 }
30115out:
30116 return g_variant_builder_end (&builder);
30117}
30118
30119static void
30120host_ipmi_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
30121{
30122}
30123
30124static void
30125_host_ipmi_on_signal_received_message (
30126 HostIpmi *object,
30127 guchar arg_seq,
30128 guchar arg_netfn,
30129 guchar arg_cmd,
30130 const gchar *arg_data)
30131{
30132 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (object);
30133
30134 GList *connections, *l;
30135 GVariant *signal_variant;
30136 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
30137
30138 signal_variant = g_variant_ref_sink (g_variant_new ("(yyy^ay)",
30139 arg_seq,
30140 arg_netfn,
30141 arg_cmd,
30142 arg_data));
30143 for (l = connections; l != NULL; l = l->next)
30144 {
30145 GDBusConnection *connection = l->data;
30146 g_dbus_connection_emit_signal (connection,
30147 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.HostIpmi", "ReceivedMessage",
30148 signal_variant, NULL);
30149 }
30150 g_variant_unref (signal_variant);
30151 g_list_free_full (connections, g_object_unref);
30152}
30153
30154static void host_ipmi_skeleton_iface_init (HostIpmiIface *iface);
30155#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
30156G_DEFINE_TYPE_WITH_CODE (HostIpmiSkeleton, host_ipmi_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
30157 G_ADD_PRIVATE (HostIpmiSkeleton)
30158 G_IMPLEMENT_INTERFACE (TYPE_HOST_IPMI, host_ipmi_skeleton_iface_init));
30159
30160#else
30161G_DEFINE_TYPE_WITH_CODE (HostIpmiSkeleton, host_ipmi_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
30162 G_IMPLEMENT_INTERFACE (TYPE_HOST_IPMI, host_ipmi_skeleton_iface_init));
30163
30164#endif
30165static void
30166host_ipmi_skeleton_finalize (GObject *object)
30167{
30168 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (object);
30169 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
30170 if (skeleton->priv->changed_properties_idle_source != NULL)
30171 g_source_destroy (skeleton->priv->changed_properties_idle_source);
30172 g_main_context_unref (skeleton->priv->context);
30173 g_mutex_clear (&skeleton->priv->lock);
30174 G_OBJECT_CLASS (host_ipmi_skeleton_parent_class)->finalize (object);
30175}
30176
30177static void
30178host_ipmi_skeleton_init (HostIpmiSkeleton *skeleton)
30179{
30180#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
30181 skeleton->priv = host_ipmi_skeleton_get_instance_private (skeleton);
30182#else
30183 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_HOST_IPMI_SKELETON, HostIpmiSkeletonPrivate);
30184#endif
30185
30186 g_mutex_init (&skeleton->priv->lock);
30187 skeleton->priv->context = g_main_context_ref_thread_default ();
30188}
30189
30190static void
30191host_ipmi_skeleton_class_init (HostIpmiSkeletonClass *klass)
30192{
30193 GObjectClass *gobject_class;
30194 GDBusInterfaceSkeletonClass *skeleton_class;
30195
30196 gobject_class = G_OBJECT_CLASS (klass);
30197 gobject_class->finalize = host_ipmi_skeleton_finalize;
30198
30199 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
30200 skeleton_class->get_info = host_ipmi_skeleton_dbus_interface_get_info;
30201 skeleton_class->get_properties = host_ipmi_skeleton_dbus_interface_get_properties;
30202 skeleton_class->flush = host_ipmi_skeleton_dbus_interface_flush;
30203 skeleton_class->get_vtable = host_ipmi_skeleton_dbus_interface_get_vtable;
30204
30205#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
30206 g_type_class_add_private (klass, sizeof (HostIpmiSkeletonPrivate));
30207#endif
30208}
30209
30210static void
30211host_ipmi_skeleton_iface_init (HostIpmiIface *iface)
30212{
30213 iface->received_message = _host_ipmi_on_signal_received_message;
30214}
30215
30216/**
30217 * host_ipmi_skeleton_new:
30218 *
30219 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link>.
30220 *
30221 * Returns: (transfer full) (type HostIpmiSkeleton): The skeleton object.
30222 */
30223HostIpmi *
30224host_ipmi_skeleton_new (void)
30225{
30226 return HOST_IPMI (g_object_new (TYPE_HOST_IPMI_SKELETON, NULL));
30227}
30228
30229/* ------------------------------------------------------------------------
Norman James362a80f2015-09-14 14:04:39 -050030230 * Code for Object, ObjectProxy and ObjectSkeleton
30231 * ------------------------------------------------------------------------
30232 */
30233
30234/**
30235 * SECTION:Object
30236 * @title: Object
30237 * @short_description: Specialized GDBusObject types
30238 *
30239 * This section contains the #Object, #ObjectProxy, and #ObjectSkeleton types which make it easier to work with objects implementing generated types for D-Bus interfaces.
30240 */
30241
30242/**
30243 * Object:
30244 *
30245 * The #Object type is a specialized container of interfaces.
30246 */
30247
30248/**
30249 * ObjectIface:
30250 * @parent_iface: The parent interface.
30251 *
30252 * Virtual table for the #Object interface.
30253 */
30254
30255typedef ObjectIface ObjectInterface;
30256G_DEFINE_INTERFACE_WITH_CODE (Object, object, G_TYPE_OBJECT, g_type_interface_add_prerequisite (g_define_type_id, G_TYPE_DBUS_OBJECT));
30257
30258static void
30259object_default_init (ObjectIface *iface)
30260{
30261 /**
Norman James493996c2015-10-31 17:27:13 -050030262 * Object:object-mapper:
30263 *
30264 * 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.
30265 *
30266 * Connect to the #GObject::notify signal to get informed of property changes.
30267 */
30268 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));
30269
30270 /**
Norman James5236a8f2015-11-05 20:39:31 -060030271 * Object:hwmon:
30272 *
30273 * 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.
30274 *
30275 * Connect to the #GObject::notify signal to get informed of property changes.
30276 */
30277 g_object_interface_install_property (iface, g_param_spec_object ("hwmon", "hwmon", "hwmon", TYPE_HWMON, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
30278
30279 /**
Norman James362a80f2015-09-14 14:04:39 -050030280 * Object:fan:
30281 *
30282 * 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.
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 ("fan", "fan", "fan", TYPE_FAN, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
30287
30288 /**
30289 * Object:sensor-value:
30290 *
30291 * 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.
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 ("sensor-value", "sensor-value", "sensor-value", TYPE_SENSOR_VALUE, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
30296
30297 /**
30298 * Object:sensor-threshold:
30299 *
30300 * 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.
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 ("sensor-threshold", "sensor-threshold", "sensor-threshold", TYPE_SENSOR_THRESHOLD, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
30305
30306 /**
30307 * Object:sensor-i2c:
30308 *
30309 * 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.
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-i2c", "sensor-i2c", "sensor-i2c", TYPE_SENSOR_I2C, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
30314
30315 /**
30316 * Object:sensor-match:
30317 *
30318 * 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.
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-match", "sensor-match", "sensor-match", TYPE_SENSOR_MATCH, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
30323
30324 /**
30325 * Object:process:
30326 *
30327 * 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.
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 ("process", "process", "process", TYPE_PROCESS, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
30332
30333 /**
Norman James18998182015-10-11 21:54:53 -050030334 * Object:shared-resource:
30335 *
30336 * 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.
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 ("shared-resource", "shared-resource", "shared-resource", TYPE_SHARED_RESOURCE, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
30341
30342 /**
Norman James362a80f2015-09-14 14:04:39 -050030343 * Object:control:
30344 *
30345 * 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.
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 ("control", "control", "control", TYPE_CONTROL, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
30350
30351 /**
30352 * Object:control-bmc:
30353 *
30354 * 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.
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 ("control-bmc", "control-bmc", "control-bmc", TYPE_CONTROL_BMC, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
30359
30360 /**
30361 * Object:control-host:
30362 *
30363 * 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.
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-host", "control-host", "control-host", TYPE_CONTROL_HOST, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
30368
30369 /**
30370 * Object:control-power:
30371 *
30372 * 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.
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-power", "control-power", "control-power", TYPE_CONTROL_POWER, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
30377
30378 /**
30379 * Object:watchdog:
30380 *
30381 * 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.
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 ("watchdog", "watchdog", "watchdog", TYPE_WATCHDOG, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
30386
30387 /**
30388 * Object:event-log:
30389 *
30390 * 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.
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 ("event-log", "event-log", "event-log", TYPE_EVENT_LOG, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
30395
30396 /**
30397 * Object:flash:
30398 *
30399 * 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.
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 ("flash", "flash", "flash", TYPE_FLASH, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
30404
30405 /**
Norman James18998182015-10-11 21:54:53 -050030406 * Object:flash-control:
30407 *
30408 * 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.
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 ("flash-control", "flash-control", "flash-control", TYPE_FLASH_CONTROL, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
30413
30414 /**
Norman James362a80f2015-09-14 14:04:39 -050030415 * Object:button:
30416 *
30417 * 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.
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 ("button", "button", "button", TYPE_BUTTON, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
30422
30423 /**
30424 * Object:led:
30425 *
30426 * 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.
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 ("led", "led", "led", TYPE_LED, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
30431
Norman Jamesdbcffbd2015-10-06 16:53:06 -050030432 /**
30433 * Object:host-ipmi:
30434 *
30435 * 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.
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 ("host-ipmi", "host-ipmi", "host-ipmi", TYPE_HOST_IPMI, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
30440
Norman James362a80f2015-09-14 14:04:39 -050030441}
30442
30443/**
Norman James493996c2015-10-31 17:27:13 -050030444 * object_get_object_mapper:
30445 * @object: A #Object.
30446 *
30447 * 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.
30448 *
30449 * Returns: (transfer full): A #ObjectMapper that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
30450 */
30451ObjectMapper *object_get_object_mapper (Object *object)
30452{
30453 GDBusInterface *ret;
30454 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Object.Mapper");
30455 if (ret == NULL)
30456 return NULL;
30457 return OBJECT_MAPPER (ret);
30458}
30459
30460/**
Norman James5236a8f2015-11-05 20:39:31 -060030461 * object_get_hwmon:
30462 * @object: A #Object.
30463 *
30464 * 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.
30465 *
30466 * Returns: (transfer full): A #Hwmon that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
30467 */
30468Hwmon *object_get_hwmon (Object *object)
30469{
30470 GDBusInterface *ret;
30471 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Hwmon");
30472 if (ret == NULL)
30473 return NULL;
30474 return HWMON (ret);
30475}
30476
30477/**
Norman James362a80f2015-09-14 14:04:39 -050030478 * object_get_fan:
30479 * @object: A #Object.
30480 *
30481 * 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.
30482 *
30483 * Returns: (transfer full): A #Fan that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
30484 */
30485Fan *object_get_fan (Object *object)
30486{
30487 GDBusInterface *ret;
30488 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan");
30489 if (ret == NULL)
30490 return NULL;
30491 return FAN (ret);
30492}
30493
30494/**
30495 * object_get_sensor_value:
30496 * @object: A #Object.
30497 *
30498 * 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.
30499 *
30500 * Returns: (transfer full): A #SensorValue that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
30501 */
30502SensorValue *object_get_sensor_value (Object *object)
30503{
30504 GDBusInterface *ret;
30505 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue");
30506 if (ret == NULL)
30507 return NULL;
30508 return SENSOR_VALUE (ret);
30509}
30510
30511/**
30512 * object_get_sensor_threshold:
30513 * @object: A #Object.
30514 *
30515 * 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.
30516 *
30517 * Returns: (transfer full): A #SensorThreshold that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
30518 */
30519SensorThreshold *object_get_sensor_threshold (Object *object)
30520{
30521 GDBusInterface *ret;
30522 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold");
30523 if (ret == NULL)
30524 return NULL;
30525 return SENSOR_THRESHOLD (ret);
30526}
30527
30528/**
30529 * object_get_sensor_i2c:
30530 * @object: A #Object.
30531 *
30532 * 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.
30533 *
30534 * Returns: (transfer full): A #SensorI2c that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
30535 */
30536SensorI2c *object_get_sensor_i2c (Object *object)
30537{
30538 GDBusInterface *ret;
30539 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
30540 if (ret == NULL)
30541 return NULL;
30542 return SENSOR_I2C (ret);
30543}
30544
30545/**
30546 * object_get_sensor_match:
30547 * @object: A #Object.
30548 *
30549 * 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.
30550 *
30551 * Returns: (transfer full): A #SensorMatch that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
30552 */
30553SensorMatch *object_get_sensor_match (Object *object)
30554{
30555 GDBusInterface *ret;
30556 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch");
30557 if (ret == NULL)
30558 return NULL;
30559 return SENSOR_MATCH (ret);
30560}
30561
30562/**
30563 * object_get_process:
30564 * @object: A #Object.
30565 *
30566 * 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.
30567 *
30568 * Returns: (transfer full): A #Process that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
30569 */
30570Process *object_get_process (Object *object)
30571{
30572 GDBusInterface *ret;
30573 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process");
30574 if (ret == NULL)
30575 return NULL;
30576 return PROCESS (ret);
30577}
30578
30579/**
Norman James18998182015-10-11 21:54:53 -050030580 * object_get_shared_resource:
30581 * @object: A #Object.
30582 *
30583 * 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.
30584 *
30585 * Returns: (transfer full): A #SharedResource that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
30586 */
30587SharedResource *object_get_shared_resource (Object *object)
30588{
30589 GDBusInterface *ret;
30590 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SharedResource");
30591 if (ret == NULL)
30592 return NULL;
30593 return SHARED_RESOURCE (ret);
30594}
30595
30596/**
Norman James362a80f2015-09-14 14:04:39 -050030597 * object_get_control:
30598 * @object: A #Object.
30599 *
30600 * 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.
30601 *
30602 * Returns: (transfer full): A #Control that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
30603 */
30604Control *object_get_control (Object *object)
30605{
30606 GDBusInterface *ret;
30607 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control");
30608 if (ret == NULL)
30609 return NULL;
30610 return CONTROL (ret);
30611}
30612
30613/**
30614 * object_get_control_bmc:
30615 * @object: A #Object.
30616 *
30617 * 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.
30618 *
30619 * Returns: (transfer full): A #ControlBmc that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
30620 */
30621ControlBmc *object_get_control_bmc (Object *object)
30622{
30623 GDBusInterface *ret;
30624 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc");
30625 if (ret == NULL)
30626 return NULL;
30627 return CONTROL_BMC (ret);
30628}
30629
30630/**
30631 * object_get_control_host:
30632 * @object: A #Object.
30633 *
30634 * 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.
30635 *
30636 * Returns: (transfer full): A #ControlHost that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
30637 */
30638ControlHost *object_get_control_host (Object *object)
30639{
30640 GDBusInterface *ret;
30641 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
30642 if (ret == NULL)
30643 return NULL;
30644 return CONTROL_HOST (ret);
30645}
30646
30647/**
30648 * object_get_control_power:
30649 * @object: A #Object.
30650 *
30651 * 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.
30652 *
30653 * Returns: (transfer full): A #ControlPower that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
30654 */
30655ControlPower *object_get_control_power (Object *object)
30656{
30657 GDBusInterface *ret;
30658 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power");
30659 if (ret == NULL)
30660 return NULL;
30661 return CONTROL_POWER (ret);
30662}
30663
30664/**
30665 * object_get_watchdog:
30666 * @object: A #Object.
30667 *
30668 * 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.
30669 *
30670 * Returns: (transfer full): A #Watchdog that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
30671 */
30672Watchdog *object_get_watchdog (Object *object)
30673{
30674 GDBusInterface *ret;
30675 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog");
30676 if (ret == NULL)
30677 return NULL;
30678 return WATCHDOG (ret);
30679}
30680
30681/**
30682 * object_get_event_log:
30683 * @object: A #Object.
30684 *
30685 * 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.
30686 *
30687 * Returns: (transfer full): A #EventLog that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
30688 */
30689EventLog *object_get_event_log (Object *object)
30690{
30691 GDBusInterface *ret;
30692 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
30693 if (ret == NULL)
30694 return NULL;
30695 return EVENT_LOG (ret);
30696}
30697
30698/**
30699 * object_get_flash:
30700 * @object: A #Object.
30701 *
30702 * 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.
30703 *
30704 * Returns: (transfer full): A #Flash that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
30705 */
30706Flash *object_get_flash (Object *object)
30707{
30708 GDBusInterface *ret;
30709 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash");
30710 if (ret == NULL)
30711 return NULL;
30712 return FLASH (ret);
30713}
30714
30715/**
Norman James18998182015-10-11 21:54:53 -050030716 * object_get_flash_control:
30717 * @object: A #Object.
30718 *
30719 * 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.
30720 *
30721 * Returns: (transfer full): A #FlashControl that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
30722 */
30723FlashControl *object_get_flash_control (Object *object)
30724{
30725 GDBusInterface *ret;
30726 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.FlashControl");
30727 if (ret == NULL)
30728 return NULL;
30729 return FLASH_CONTROL (ret);
30730}
30731
30732/**
Norman James362a80f2015-09-14 14:04:39 -050030733 * object_get_button:
30734 * @object: A #Object.
30735 *
30736 * 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.
30737 *
30738 * Returns: (transfer full): A #Button that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
30739 */
30740Button *object_get_button (Object *object)
30741{
30742 GDBusInterface *ret;
30743 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button");
30744 if (ret == NULL)
30745 return NULL;
30746 return BUTTON (ret);
30747}
30748
30749/**
30750 * object_get_led:
30751 * @object: A #Object.
30752 *
30753 * 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.
30754 *
30755 * Returns: (transfer full): A #Led that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
30756 */
30757Led *object_get_led (Object *object)
30758{
30759 GDBusInterface *ret;
30760 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led");
30761 if (ret == NULL)
30762 return NULL;
30763 return LED (ret);
30764}
30765
Norman Jamesdbcffbd2015-10-06 16:53:06 -050030766/**
30767 * object_get_host_ipmi:
30768 * @object: A #Object.
30769 *
30770 * 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.
30771 *
30772 * Returns: (transfer full): A #HostIpmi that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
30773 */
30774HostIpmi *object_get_host_ipmi (Object *object)
30775{
30776 GDBusInterface *ret;
30777 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.HostIpmi");
30778 if (ret == NULL)
30779 return NULL;
30780 return HOST_IPMI (ret);
30781}
30782
Norman James362a80f2015-09-14 14:04:39 -050030783
30784/**
Norman James493996c2015-10-31 17:27:13 -050030785 * object_peek_object_mapper: (skip)
30786 * @object: A #Object.
30787 *
30788 * Like object_get_object_mapper() but doesn't increase the reference count on the returned object.
30789 *
30790 * <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>
30791 *
30792 * 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.
30793 */
30794ObjectMapper *object_peek_object_mapper (Object *object)
30795{
30796 GDBusInterface *ret;
30797 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Object.Mapper");
30798 if (ret == NULL)
30799 return NULL;
30800 g_object_unref (ret);
30801 return OBJECT_MAPPER (ret);
30802}
30803
30804/**
Norman James5236a8f2015-11-05 20:39:31 -060030805 * object_peek_hwmon: (skip)
30806 * @object: A #Object.
30807 *
30808 * Like object_get_hwmon() but doesn't increase the reference count on the returned object.
30809 *
30810 * <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>
30811 *
30812 * 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.
30813 */
30814Hwmon *object_peek_hwmon (Object *object)
30815{
30816 GDBusInterface *ret;
30817 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Hwmon");
30818 if (ret == NULL)
30819 return NULL;
30820 g_object_unref (ret);
30821 return HWMON (ret);
30822}
30823
30824/**
Norman James362a80f2015-09-14 14:04:39 -050030825 * object_peek_fan: (skip)
30826 * @object: A #Object.
30827 *
30828 * Like object_get_fan() but doesn't increase the reference count on the returned object.
30829 *
30830 * <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>
30831 *
30832 * 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.
30833 */
30834Fan *object_peek_fan (Object *object)
30835{
30836 GDBusInterface *ret;
30837 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan");
30838 if (ret == NULL)
30839 return NULL;
30840 g_object_unref (ret);
30841 return FAN (ret);
30842}
30843
30844/**
30845 * object_peek_sensor_value: (skip)
30846 * @object: A #Object.
30847 *
30848 * Like object_get_sensor_value() but doesn't increase the reference count on the returned object.
30849 *
30850 * <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>
30851 *
30852 * 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.
30853 */
30854SensorValue *object_peek_sensor_value (Object *object)
30855{
30856 GDBusInterface *ret;
30857 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue");
30858 if (ret == NULL)
30859 return NULL;
30860 g_object_unref (ret);
30861 return SENSOR_VALUE (ret);
30862}
30863
30864/**
30865 * object_peek_sensor_threshold: (skip)
30866 * @object: A #Object.
30867 *
30868 * Like object_get_sensor_threshold() but doesn't increase the reference count on the returned object.
30869 *
30870 * <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>
30871 *
30872 * 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.
30873 */
30874SensorThreshold *object_peek_sensor_threshold (Object *object)
30875{
30876 GDBusInterface *ret;
30877 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold");
30878 if (ret == NULL)
30879 return NULL;
30880 g_object_unref (ret);
30881 return SENSOR_THRESHOLD (ret);
30882}
30883
30884/**
30885 * object_peek_sensor_i2c: (skip)
30886 * @object: A #Object.
30887 *
30888 * Like object_get_sensor_i2c() but doesn't increase the reference count on the returned object.
30889 *
30890 * <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>
30891 *
30892 * 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.
30893 */
30894SensorI2c *object_peek_sensor_i2c (Object *object)
30895{
30896 GDBusInterface *ret;
30897 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
30898 if (ret == NULL)
30899 return NULL;
30900 g_object_unref (ret);
30901 return SENSOR_I2C (ret);
30902}
30903
30904/**
30905 * object_peek_sensor_match: (skip)
30906 * @object: A #Object.
30907 *
30908 * Like object_get_sensor_match() but doesn't increase the reference count on the returned object.
30909 *
30910 * <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>
30911 *
30912 * 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.
30913 */
30914SensorMatch *object_peek_sensor_match (Object *object)
30915{
30916 GDBusInterface *ret;
30917 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch");
30918 if (ret == NULL)
30919 return NULL;
30920 g_object_unref (ret);
30921 return SENSOR_MATCH (ret);
30922}
30923
30924/**
30925 * object_peek_process: (skip)
30926 * @object: A #Object.
30927 *
30928 * Like object_get_process() but doesn't increase the reference count on the returned object.
30929 *
30930 * <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>
30931 *
30932 * 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.
30933 */
30934Process *object_peek_process (Object *object)
30935{
30936 GDBusInterface *ret;
30937 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process");
30938 if (ret == NULL)
30939 return NULL;
30940 g_object_unref (ret);
30941 return PROCESS (ret);
30942}
30943
30944/**
Norman James18998182015-10-11 21:54:53 -050030945 * object_peek_shared_resource: (skip)
30946 * @object: A #Object.
30947 *
30948 * Like object_get_shared_resource() but doesn't increase the reference count on the returned object.
30949 *
30950 * <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>
30951 *
30952 * 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.
30953 */
30954SharedResource *object_peek_shared_resource (Object *object)
30955{
30956 GDBusInterface *ret;
30957 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SharedResource");
30958 if (ret == NULL)
30959 return NULL;
30960 g_object_unref (ret);
30961 return SHARED_RESOURCE (ret);
30962}
30963
30964/**
Norman James362a80f2015-09-14 14:04:39 -050030965 * object_peek_control: (skip)
30966 * @object: A #Object.
30967 *
30968 * Like object_get_control() but doesn't increase the reference count on the returned object.
30969 *
30970 * <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>
30971 *
30972 * 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.
30973 */
30974Control *object_peek_control (Object *object)
30975{
30976 GDBusInterface *ret;
30977 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control");
30978 if (ret == NULL)
30979 return NULL;
30980 g_object_unref (ret);
30981 return CONTROL (ret);
30982}
30983
30984/**
30985 * object_peek_control_bmc: (skip)
30986 * @object: A #Object.
30987 *
30988 * Like object_get_control_bmc() but doesn't increase the reference count on the returned object.
30989 *
30990 * <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>
30991 *
30992 * 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.
30993 */
30994ControlBmc *object_peek_control_bmc (Object *object)
30995{
30996 GDBusInterface *ret;
30997 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc");
30998 if (ret == NULL)
30999 return NULL;
31000 g_object_unref (ret);
31001 return CONTROL_BMC (ret);
31002}
31003
31004/**
31005 * object_peek_control_host: (skip)
31006 * @object: A #Object.
31007 *
31008 * Like object_get_control_host() but doesn't increase the reference count on the returned object.
31009 *
31010 * <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>
31011 *
31012 * 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.
31013 */
31014ControlHost *object_peek_control_host (Object *object)
31015{
31016 GDBusInterface *ret;
31017 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
31018 if (ret == NULL)
31019 return NULL;
31020 g_object_unref (ret);
31021 return CONTROL_HOST (ret);
31022}
31023
31024/**
31025 * object_peek_control_power: (skip)
31026 * @object: A #Object.
31027 *
31028 * Like object_get_control_power() but doesn't increase the reference count on the returned object.
31029 *
31030 * <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>
31031 *
31032 * 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.
31033 */
31034ControlPower *object_peek_control_power (Object *object)
31035{
31036 GDBusInterface *ret;
31037 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power");
31038 if (ret == NULL)
31039 return NULL;
31040 g_object_unref (ret);
31041 return CONTROL_POWER (ret);
31042}
31043
31044/**
31045 * object_peek_watchdog: (skip)
31046 * @object: A #Object.
31047 *
31048 * Like object_get_watchdog() but doesn't increase the reference count on the returned object.
31049 *
31050 * <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>
31051 *
31052 * 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.
31053 */
31054Watchdog *object_peek_watchdog (Object *object)
31055{
31056 GDBusInterface *ret;
31057 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog");
31058 if (ret == NULL)
31059 return NULL;
31060 g_object_unref (ret);
31061 return WATCHDOG (ret);
31062}
31063
31064/**
31065 * object_peek_event_log: (skip)
31066 * @object: A #Object.
31067 *
31068 * Like object_get_event_log() but doesn't increase the reference count on the returned object.
31069 *
31070 * <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>
31071 *
31072 * 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.
31073 */
31074EventLog *object_peek_event_log (Object *object)
31075{
31076 GDBusInterface *ret;
31077 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
31078 if (ret == NULL)
31079 return NULL;
31080 g_object_unref (ret);
31081 return EVENT_LOG (ret);
31082}
31083
31084/**
31085 * object_peek_flash: (skip)
31086 * @object: A #Object.
31087 *
31088 * Like object_get_flash() but doesn't increase the reference count on the returned object.
31089 *
31090 * <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>
31091 *
31092 * 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.
31093 */
31094Flash *object_peek_flash (Object *object)
31095{
31096 GDBusInterface *ret;
31097 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash");
31098 if (ret == NULL)
31099 return NULL;
31100 g_object_unref (ret);
31101 return FLASH (ret);
31102}
31103
31104/**
Norman James18998182015-10-11 21:54:53 -050031105 * object_peek_flash_control: (skip)
31106 * @object: A #Object.
31107 *
31108 * Like object_get_flash_control() but doesn't increase the reference count on the returned object.
31109 *
31110 * <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>
31111 *
31112 * 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.
31113 */
31114FlashControl *object_peek_flash_control (Object *object)
31115{
31116 GDBusInterface *ret;
31117 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.FlashControl");
31118 if (ret == NULL)
31119 return NULL;
31120 g_object_unref (ret);
31121 return FLASH_CONTROL (ret);
31122}
31123
31124/**
Norman James362a80f2015-09-14 14:04:39 -050031125 * object_peek_button: (skip)
31126 * @object: A #Object.
31127 *
31128 * Like object_get_button() but doesn't increase the reference count on the returned object.
31129 *
31130 * <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>
31131 *
31132 * 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.
31133 */
31134Button *object_peek_button (Object *object)
31135{
31136 GDBusInterface *ret;
31137 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button");
31138 if (ret == NULL)
31139 return NULL;
31140 g_object_unref (ret);
31141 return BUTTON (ret);
31142}
31143
31144/**
31145 * object_peek_led: (skip)
31146 * @object: A #Object.
31147 *
31148 * Like object_get_led() but doesn't increase the reference count on the returned object.
31149 *
31150 * <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>
31151 *
31152 * 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.
31153 */
31154Led *object_peek_led (Object *object)
31155{
31156 GDBusInterface *ret;
31157 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led");
31158 if (ret == NULL)
31159 return NULL;
31160 g_object_unref (ret);
31161 return LED (ret);
31162}
31163
Norman Jamesdbcffbd2015-10-06 16:53:06 -050031164/**
31165 * object_peek_host_ipmi: (skip)
31166 * @object: A #Object.
31167 *
31168 * Like object_get_host_ipmi() but doesn't increase the reference count on the returned object.
31169 *
31170 * <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>
31171 *
31172 * 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.
31173 */
31174HostIpmi *object_peek_host_ipmi (Object *object)
31175{
31176 GDBusInterface *ret;
31177 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.HostIpmi");
31178 if (ret == NULL)
31179 return NULL;
31180 g_object_unref (ret);
31181 return HOST_IPMI (ret);
31182}
31183
Norman James362a80f2015-09-14 14:04:39 -050031184
31185static void
31186object_notify (GDBusObject *object, GDBusInterface *interface)
31187{
31188 _ExtendedGDBusInterfaceInfo *info = (_ExtendedGDBusInterfaceInfo *) g_dbus_interface_get_info (interface);
31189 /* info can be NULL if the other end is using a D-Bus interface we don't know
31190 * anything about, for example old generated code in this process talking to
31191 * newer generated code in the other process. */
31192 if (info != NULL)
31193 g_object_notify (G_OBJECT (object), info->hyphen_name);
31194}
31195
31196/**
31197 * ObjectProxy:
31198 *
31199 * The #ObjectProxy structure contains only private data and should only be accessed using the provided API.
31200 */
31201
31202/**
31203 * ObjectProxyClass:
31204 * @parent_class: The parent class.
31205 *
31206 * Class structure for #ObjectProxy.
31207 */
31208
31209static void
31210object_proxy__object_iface_init (ObjectIface *iface G_GNUC_UNUSED)
31211{
31212}
31213
31214static void
31215object_proxy__g_dbus_object_iface_init (GDBusObjectIface *iface)
31216{
31217 iface->interface_added = object_notify;
31218 iface->interface_removed = object_notify;
31219}
31220
31221
31222G_DEFINE_TYPE_WITH_CODE (ObjectProxy, object_proxy, G_TYPE_DBUS_OBJECT_PROXY,
31223 G_IMPLEMENT_INTERFACE (TYPE_OBJECT, object_proxy__object_iface_init)
31224 G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, object_proxy__g_dbus_object_iface_init));
31225
31226static void
31227object_proxy_init (ObjectProxy *object G_GNUC_UNUSED)
31228{
31229}
31230
31231static void
31232object_proxy_set_property (GObject *gobject,
31233 guint prop_id,
31234 const GValue *value G_GNUC_UNUSED,
31235 GParamSpec *pspec)
31236{
31237 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
31238}
31239
31240static void
31241object_proxy_get_property (GObject *gobject,
31242 guint prop_id,
31243 GValue *value,
31244 GParamSpec *pspec)
31245{
31246 ObjectProxy *object = OBJECT_PROXY (gobject);
31247 GDBusInterface *interface;
31248
31249 switch (prop_id)
31250 {
31251 case 1:
Norman James493996c2015-10-31 17:27:13 -050031252 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Object.Mapper");
Norman James362a80f2015-09-14 14:04:39 -050031253 g_value_take_object (value, interface);
31254 break;
31255
Norman Jamesa3e47c42015-10-18 14:43:10 -050031256 case 2:
Norman James5236a8f2015-11-05 20:39:31 -060031257 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Hwmon");
Norman James362a80f2015-09-14 14:04:39 -050031258 g_value_take_object (value, interface);
31259 break;
31260
Norman Jamesa3e47c42015-10-18 14:43:10 -050031261 case 3:
Norman James5236a8f2015-11-05 20:39:31 -060031262 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan");
Norman James362a80f2015-09-14 14:04:39 -050031263 g_value_take_object (value, interface);
31264 break;
31265
Norman Jamesa3e47c42015-10-18 14:43:10 -050031266 case 4:
Norman James5236a8f2015-11-05 20:39:31 -060031267 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue");
Norman James362a80f2015-09-14 14:04:39 -050031268 g_value_take_object (value, interface);
31269 break;
31270
Norman Jamesa3e47c42015-10-18 14:43:10 -050031271 case 5:
Norman James5236a8f2015-11-05 20:39:31 -060031272 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold");
Norman James362a80f2015-09-14 14:04:39 -050031273 g_value_take_object (value, interface);
31274 break;
31275
Norman Jamesa3e47c42015-10-18 14:43:10 -050031276 case 6:
Norman James5236a8f2015-11-05 20:39:31 -060031277 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
Norman James362a80f2015-09-14 14:04:39 -050031278 g_value_take_object (value, interface);
31279 break;
31280
Norman Jamesa3e47c42015-10-18 14:43:10 -050031281 case 7:
Norman James5236a8f2015-11-05 20:39:31 -060031282 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch");
Norman James362a80f2015-09-14 14:04:39 -050031283 g_value_take_object (value, interface);
31284 break;
31285
Norman Jamesa3e47c42015-10-18 14:43:10 -050031286 case 8:
Norman James5236a8f2015-11-05 20:39:31 -060031287 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process");
Norman James362a80f2015-09-14 14:04:39 -050031288 g_value_take_object (value, interface);
31289 break;
31290
Norman Jamesa3e47c42015-10-18 14:43:10 -050031291 case 9:
Norman James5236a8f2015-11-05 20:39:31 -060031292 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SharedResource");
Norman James362a80f2015-09-14 14:04:39 -050031293 g_value_take_object (value, interface);
31294 break;
31295
Norman Jamesa3e47c42015-10-18 14:43:10 -050031296 case 10:
Norman James5236a8f2015-11-05 20:39:31 -060031297 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control");
Norman James362a80f2015-09-14 14:04:39 -050031298 g_value_take_object (value, interface);
31299 break;
31300
Norman Jamesa3e47c42015-10-18 14:43:10 -050031301 case 11:
Norman James5236a8f2015-11-05 20:39:31 -060031302 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc");
Norman James362a80f2015-09-14 14:04:39 -050031303 g_value_take_object (value, interface);
31304 break;
31305
Norman Jamesa3e47c42015-10-18 14:43:10 -050031306 case 12:
Norman James5236a8f2015-11-05 20:39:31 -060031307 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
Norman James362a80f2015-09-14 14:04:39 -050031308 g_value_take_object (value, interface);
31309 break;
31310
Norman Jamesa3e47c42015-10-18 14:43:10 -050031311 case 13:
Norman James5236a8f2015-11-05 20:39:31 -060031312 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power");
Norman James362a80f2015-09-14 14:04:39 -050031313 g_value_take_object (value, interface);
31314 break;
31315
Norman Jamesa3e47c42015-10-18 14:43:10 -050031316 case 14:
Norman James5236a8f2015-11-05 20:39:31 -060031317 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog");
Norman Jamesdfdaca92015-09-27 22:11:15 -050031318 g_value_take_object (value, interface);
31319 break;
31320
Norman Jamesa3e47c42015-10-18 14:43:10 -050031321 case 15:
Norman James5236a8f2015-11-05 20:39:31 -060031322 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
Norman James362a80f2015-09-14 14:04:39 -050031323 g_value_take_object (value, interface);
31324 break;
31325
Norman Jamesa3e47c42015-10-18 14:43:10 -050031326 case 16:
Norman James5236a8f2015-11-05 20:39:31 -060031327 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash");
Norman James18998182015-10-11 21:54:53 -050031328 g_value_take_object (value, interface);
31329 break;
31330
Norman Jamesa3e47c42015-10-18 14:43:10 -050031331 case 17:
Norman James5236a8f2015-11-05 20:39:31 -060031332 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.FlashControl");
Norman James18998182015-10-11 21:54:53 -050031333 g_value_take_object (value, interface);
31334 break;
31335
Norman Jamesa3e47c42015-10-18 14:43:10 -050031336 case 18:
Norman James5236a8f2015-11-05 20:39:31 -060031337 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button");
Norman James493996c2015-10-31 17:27:13 -050031338 g_value_take_object (value, interface);
31339 break;
31340
31341 case 19:
Norman James5236a8f2015-11-05 20:39:31 -060031342 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led");
31343 g_value_take_object (value, interface);
31344 break;
31345
31346 case 20:
Norman Jamesdbcffbd2015-10-06 16:53:06 -050031347 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.HostIpmi");
31348 g_value_take_object (value, interface);
31349 break;
31350
Norman James362a80f2015-09-14 14:04:39 -050031351 default:
31352 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
31353 break;
31354 }
31355}
31356
31357static void
31358object_proxy_class_init (ObjectProxyClass *klass)
31359{
31360 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
31361
31362 gobject_class->set_property = object_proxy_set_property;
31363 gobject_class->get_property = object_proxy_get_property;
31364
Norman James493996c2015-10-31 17:27:13 -050031365 g_object_class_override_property (gobject_class, 1, "object-mapper");
Norman James5236a8f2015-11-05 20:39:31 -060031366 g_object_class_override_property (gobject_class, 2, "hwmon");
31367 g_object_class_override_property (gobject_class, 3, "fan");
31368 g_object_class_override_property (gobject_class, 4, "sensor-value");
31369 g_object_class_override_property (gobject_class, 5, "sensor-threshold");
31370 g_object_class_override_property (gobject_class, 6, "sensor-i2c");
31371 g_object_class_override_property (gobject_class, 7, "sensor-match");
31372 g_object_class_override_property (gobject_class, 8, "process");
31373 g_object_class_override_property (gobject_class, 9, "shared-resource");
31374 g_object_class_override_property (gobject_class, 10, "control");
31375 g_object_class_override_property (gobject_class, 11, "control-bmc");
31376 g_object_class_override_property (gobject_class, 12, "control-host");
31377 g_object_class_override_property (gobject_class, 13, "control-power");
31378 g_object_class_override_property (gobject_class, 14, "watchdog");
31379 g_object_class_override_property (gobject_class, 15, "event-log");
31380 g_object_class_override_property (gobject_class, 16, "flash");
31381 g_object_class_override_property (gobject_class, 17, "flash-control");
31382 g_object_class_override_property (gobject_class, 18, "button");
31383 g_object_class_override_property (gobject_class, 19, "led");
31384 g_object_class_override_property (gobject_class, 20, "host-ipmi");
Norman James362a80f2015-09-14 14:04:39 -050031385}
31386
31387/**
31388 * object_proxy_new:
31389 * @connection: A #GDBusConnection.
31390 * @object_path: An object path.
31391 *
31392 * Creates a new proxy object.
31393 *
31394 * Returns: (transfer full): The proxy object.
31395 */
31396ObjectProxy *
31397object_proxy_new (GDBusConnection *connection,
31398 const gchar *object_path)
31399{
31400 g_return_val_if_fail (G_IS_DBUS_CONNECTION (connection), NULL);
31401 g_return_val_if_fail (g_variant_is_object_path (object_path), NULL);
31402 return OBJECT_PROXY (g_object_new (TYPE_OBJECT_PROXY, "g-connection", connection, "g-object-path", object_path, NULL));
31403}
31404
31405/**
31406 * ObjectSkeleton:
31407 *
31408 * The #ObjectSkeleton structure contains only private data and should only be accessed using the provided API.
31409 */
31410
31411/**
31412 * ObjectSkeletonClass:
31413 * @parent_class: The parent class.
31414 *
31415 * Class structure for #ObjectSkeleton.
31416 */
31417
31418static void
31419object_skeleton__object_iface_init (ObjectIface *iface G_GNUC_UNUSED)
31420{
31421}
31422
31423
31424static void
31425object_skeleton__g_dbus_object_iface_init (GDBusObjectIface *iface)
31426{
31427 iface->interface_added = object_notify;
31428 iface->interface_removed = object_notify;
31429}
31430
31431G_DEFINE_TYPE_WITH_CODE (ObjectSkeleton, object_skeleton, G_TYPE_DBUS_OBJECT_SKELETON,
31432 G_IMPLEMENT_INTERFACE (TYPE_OBJECT, object_skeleton__object_iface_init)
31433 G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, object_skeleton__g_dbus_object_iface_init));
31434
31435static void
31436object_skeleton_init (ObjectSkeleton *object G_GNUC_UNUSED)
31437{
31438}
31439
31440static void
31441object_skeleton_set_property (GObject *gobject,
31442 guint prop_id,
31443 const GValue *value,
31444 GParamSpec *pspec)
31445{
31446 ObjectSkeleton *object = OBJECT_SKELETON (gobject);
31447 GDBusInterfaceSkeleton *interface;
31448
31449 switch (prop_id)
31450 {
31451 case 1:
31452 interface = g_value_get_object (value);
31453 if (interface != NULL)
31454 {
Norman James493996c2015-10-31 17:27:13 -050031455 g_warn_if_fail (IS_OBJECT_MAPPER (interface));
31456 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
31457 }
31458 else
31459 {
31460 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Object.Mapper");
31461 }
31462 break;
31463
31464 case 2:
31465 interface = g_value_get_object (value);
31466 if (interface != NULL)
31467 {
Norman James5236a8f2015-11-05 20:39:31 -060031468 g_warn_if_fail (IS_HWMON (interface));
31469 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
31470 }
31471 else
31472 {
31473 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Hwmon");
31474 }
31475 break;
31476
31477 case 3:
31478 interface = g_value_get_object (value);
31479 if (interface != NULL)
31480 {
Norman James362a80f2015-09-14 14:04:39 -050031481 g_warn_if_fail (IS_FAN (interface));
31482 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
31483 }
31484 else
31485 {
31486 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Fan");
31487 }
31488 break;
31489
Norman James5236a8f2015-11-05 20:39:31 -060031490 case 4:
Norman James362a80f2015-09-14 14:04:39 -050031491 interface = g_value_get_object (value);
31492 if (interface != NULL)
31493 {
31494 g_warn_if_fail (IS_SENSOR_VALUE (interface));
31495 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
31496 }
31497 else
31498 {
31499 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorValue");
31500 }
31501 break;
31502
Norman James5236a8f2015-11-05 20:39:31 -060031503 case 5:
Norman James362a80f2015-09-14 14:04:39 -050031504 interface = g_value_get_object (value);
31505 if (interface != NULL)
31506 {
31507 g_warn_if_fail (IS_SENSOR_THRESHOLD (interface));
31508 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
31509 }
31510 else
31511 {
31512 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorThreshold");
31513 }
31514 break;
31515
Norman James5236a8f2015-11-05 20:39:31 -060031516 case 6:
Norman James362a80f2015-09-14 14:04:39 -050031517 interface = g_value_get_object (value);
31518 if (interface != NULL)
31519 {
31520 g_warn_if_fail (IS_SENSOR_I2C (interface));
31521 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
31522 }
31523 else
31524 {
31525 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorI2c");
31526 }
31527 break;
31528
Norman James5236a8f2015-11-05 20:39:31 -060031529 case 7:
Norman James362a80f2015-09-14 14:04:39 -050031530 interface = g_value_get_object (value);
31531 if (interface != NULL)
31532 {
31533 g_warn_if_fail (IS_SENSOR_MATCH (interface));
31534 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
31535 }
31536 else
31537 {
31538 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorMatch");
31539 }
31540 break;
31541
Norman James5236a8f2015-11-05 20:39:31 -060031542 case 8:
Norman James362a80f2015-09-14 14:04:39 -050031543 interface = g_value_get_object (value);
31544 if (interface != NULL)
31545 {
31546 g_warn_if_fail (IS_PROCESS (interface));
31547 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
31548 }
31549 else
31550 {
31551 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Process");
31552 }
31553 break;
31554
Norman James5236a8f2015-11-05 20:39:31 -060031555 case 9:
Norman James362a80f2015-09-14 14:04:39 -050031556 interface = g_value_get_object (value);
31557 if (interface != NULL)
31558 {
Norman James18998182015-10-11 21:54:53 -050031559 g_warn_if_fail (IS_SHARED_RESOURCE (interface));
31560 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
31561 }
31562 else
31563 {
31564 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SharedResource");
31565 }
31566 break;
31567
Norman James5236a8f2015-11-05 20:39:31 -060031568 case 10:
Norman James18998182015-10-11 21:54:53 -050031569 interface = g_value_get_object (value);
31570 if (interface != NULL)
31571 {
Norman James362a80f2015-09-14 14:04:39 -050031572 g_warn_if_fail (IS_CONTROL (interface));
31573 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
31574 }
31575 else
31576 {
31577 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Control");
31578 }
31579 break;
31580
Norman James5236a8f2015-11-05 20:39:31 -060031581 case 11:
Norman James362a80f2015-09-14 14:04:39 -050031582 interface = g_value_get_object (value);
31583 if (interface != NULL)
31584 {
31585 g_warn_if_fail (IS_CONTROL_BMC (interface));
31586 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
31587 }
31588 else
31589 {
31590 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.control.Bmc");
31591 }
31592 break;
31593
Norman James5236a8f2015-11-05 20:39:31 -060031594 case 12:
Norman James362a80f2015-09-14 14:04:39 -050031595 interface = g_value_get_object (value);
31596 if (interface != NULL)
31597 {
31598 g_warn_if_fail (IS_CONTROL_HOST (interface));
31599 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
31600 }
31601 else
31602 {
31603 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.control.Host");
31604 }
31605 break;
31606
Norman James5236a8f2015-11-05 20:39:31 -060031607 case 13:
Norman James362a80f2015-09-14 14:04:39 -050031608 interface = g_value_get_object (value);
31609 if (interface != NULL)
31610 {
31611 g_warn_if_fail (IS_CONTROL_POWER (interface));
31612 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
31613 }
31614 else
31615 {
31616 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.control.Power");
31617 }
31618 break;
31619
Norman James5236a8f2015-11-05 20:39:31 -060031620 case 14:
Norman James362a80f2015-09-14 14:04:39 -050031621 interface = g_value_get_object (value);
31622 if (interface != NULL)
31623 {
31624 g_warn_if_fail (IS_WATCHDOG (interface));
31625 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
31626 }
31627 else
31628 {
31629 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Watchdog");
31630 }
31631 break;
31632
Norman James5236a8f2015-11-05 20:39:31 -060031633 case 15:
Norman James362a80f2015-09-14 14:04:39 -050031634 interface = g_value_get_object (value);
31635 if (interface != NULL)
31636 {
31637 g_warn_if_fail (IS_EVENT_LOG (interface));
31638 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
31639 }
31640 else
31641 {
31642 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.EventLog");
31643 }
31644 break;
31645
Norman James5236a8f2015-11-05 20:39:31 -060031646 case 16:
Norman James362a80f2015-09-14 14:04:39 -050031647 interface = g_value_get_object (value);
31648 if (interface != NULL)
31649 {
31650 g_warn_if_fail (IS_FLASH (interface));
31651 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
31652 }
31653 else
31654 {
31655 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Flash");
31656 }
31657 break;
31658
Norman James5236a8f2015-11-05 20:39:31 -060031659 case 17:
Norman James18998182015-10-11 21:54:53 -050031660 interface = g_value_get_object (value);
31661 if (interface != NULL)
31662 {
31663 g_warn_if_fail (IS_FLASH_CONTROL (interface));
31664 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
31665 }
31666 else
31667 {
31668 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.FlashControl");
31669 }
31670 break;
31671
Norman James5236a8f2015-11-05 20:39:31 -060031672 case 18:
Norman James362a80f2015-09-14 14:04:39 -050031673 interface = g_value_get_object (value);
31674 if (interface != NULL)
31675 {
31676 g_warn_if_fail (IS_BUTTON (interface));
31677 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
31678 }
31679 else
31680 {
31681 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Button");
31682 }
31683 break;
31684
Norman James5236a8f2015-11-05 20:39:31 -060031685 case 19:
Norman James362a80f2015-09-14 14:04:39 -050031686 interface = g_value_get_object (value);
31687 if (interface != NULL)
31688 {
31689 g_warn_if_fail (IS_LED (interface));
31690 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
31691 }
31692 else
31693 {
31694 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Led");
31695 }
31696 break;
31697
Norman James5236a8f2015-11-05 20:39:31 -060031698 case 20:
Norman Jamesdbcffbd2015-10-06 16:53:06 -050031699 interface = g_value_get_object (value);
31700 if (interface != NULL)
31701 {
31702 g_warn_if_fail (IS_HOST_IPMI (interface));
31703 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
31704 }
31705 else
31706 {
31707 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.HostIpmi");
31708 }
31709 break;
31710
Norman James362a80f2015-09-14 14:04:39 -050031711 default:
31712 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
31713 break;
31714 }
31715}
31716
31717static void
31718object_skeleton_get_property (GObject *gobject,
31719 guint prop_id,
31720 GValue *value,
31721 GParamSpec *pspec)
31722{
31723 ObjectSkeleton *object = OBJECT_SKELETON (gobject);
31724 GDBusInterface *interface;
31725
31726 switch (prop_id)
31727 {
31728 case 1:
Norman James493996c2015-10-31 17:27:13 -050031729 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Object.Mapper");
Norman James362a80f2015-09-14 14:04:39 -050031730 g_value_take_object (value, interface);
31731 break;
31732
Norman Jamesa3e47c42015-10-18 14:43:10 -050031733 case 2:
Norman James5236a8f2015-11-05 20:39:31 -060031734 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Hwmon");
Norman James362a80f2015-09-14 14:04:39 -050031735 g_value_take_object (value, interface);
31736 break;
31737
Norman Jamesa3e47c42015-10-18 14:43:10 -050031738 case 3:
Norman James5236a8f2015-11-05 20:39:31 -060031739 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan");
Norman James362a80f2015-09-14 14:04:39 -050031740 g_value_take_object (value, interface);
31741 break;
31742
Norman Jamesa3e47c42015-10-18 14:43:10 -050031743 case 4:
Norman James5236a8f2015-11-05 20:39:31 -060031744 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue");
Norman James362a80f2015-09-14 14:04:39 -050031745 g_value_take_object (value, interface);
31746 break;
31747
Norman Jamesa3e47c42015-10-18 14:43:10 -050031748 case 5:
Norman James5236a8f2015-11-05 20:39:31 -060031749 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold");
Norman James362a80f2015-09-14 14:04:39 -050031750 g_value_take_object (value, interface);
31751 break;
31752
Norman Jamesa3e47c42015-10-18 14:43:10 -050031753 case 6:
Norman James5236a8f2015-11-05 20:39:31 -060031754 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
Norman James362a80f2015-09-14 14:04:39 -050031755 g_value_take_object (value, interface);
31756 break;
31757
Norman Jamesa3e47c42015-10-18 14:43:10 -050031758 case 7:
Norman James5236a8f2015-11-05 20:39:31 -060031759 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch");
Norman James362a80f2015-09-14 14:04:39 -050031760 g_value_take_object (value, interface);
31761 break;
31762
Norman Jamesa3e47c42015-10-18 14:43:10 -050031763 case 8:
Norman James5236a8f2015-11-05 20:39:31 -060031764 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process");
Norman James362a80f2015-09-14 14:04:39 -050031765 g_value_take_object (value, interface);
31766 break;
31767
Norman Jamesa3e47c42015-10-18 14:43:10 -050031768 case 9:
Norman James5236a8f2015-11-05 20:39:31 -060031769 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SharedResource");
Norman James362a80f2015-09-14 14:04:39 -050031770 g_value_take_object (value, interface);
31771 break;
31772
Norman Jamesa3e47c42015-10-18 14:43:10 -050031773 case 10:
Norman James5236a8f2015-11-05 20:39:31 -060031774 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control");
Norman James362a80f2015-09-14 14:04:39 -050031775 g_value_take_object (value, interface);
31776 break;
31777
Norman Jamesa3e47c42015-10-18 14:43:10 -050031778 case 11:
Norman James5236a8f2015-11-05 20:39:31 -060031779 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc");
Norman James362a80f2015-09-14 14:04:39 -050031780 g_value_take_object (value, interface);
31781 break;
31782
Norman Jamesa3e47c42015-10-18 14:43:10 -050031783 case 12:
Norman James5236a8f2015-11-05 20:39:31 -060031784 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
Norman James362a80f2015-09-14 14:04:39 -050031785 g_value_take_object (value, interface);
31786 break;
31787
Norman Jamesa3e47c42015-10-18 14:43:10 -050031788 case 13:
Norman James5236a8f2015-11-05 20:39:31 -060031789 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power");
Norman James362a80f2015-09-14 14:04:39 -050031790 g_value_take_object (value, interface);
31791 break;
31792
Norman Jamesa3e47c42015-10-18 14:43:10 -050031793 case 14:
Norman James5236a8f2015-11-05 20:39:31 -060031794 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog");
Norman Jamesdfdaca92015-09-27 22:11:15 -050031795 g_value_take_object (value, interface);
31796 break;
31797
Norman Jamesa3e47c42015-10-18 14:43:10 -050031798 case 15:
Norman James5236a8f2015-11-05 20:39:31 -060031799 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
Norman James362a80f2015-09-14 14:04:39 -050031800 g_value_take_object (value, interface);
31801 break;
31802
Norman Jamesa3e47c42015-10-18 14:43:10 -050031803 case 16:
Norman James5236a8f2015-11-05 20:39:31 -060031804 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash");
Norman James18998182015-10-11 21:54:53 -050031805 g_value_take_object (value, interface);
31806 break;
31807
Norman Jamesa3e47c42015-10-18 14:43:10 -050031808 case 17:
Norman James5236a8f2015-11-05 20:39:31 -060031809 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.FlashControl");
Norman James18998182015-10-11 21:54:53 -050031810 g_value_take_object (value, interface);
31811 break;
31812
Norman Jamesa3e47c42015-10-18 14:43:10 -050031813 case 18:
Norman James5236a8f2015-11-05 20:39:31 -060031814 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button");
Norman James493996c2015-10-31 17:27:13 -050031815 g_value_take_object (value, interface);
31816 break;
31817
31818 case 19:
Norman James5236a8f2015-11-05 20:39:31 -060031819 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led");
31820 g_value_take_object (value, interface);
31821 break;
31822
31823 case 20:
Norman Jamesdbcffbd2015-10-06 16:53:06 -050031824 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.HostIpmi");
31825 g_value_take_object (value, interface);
31826 break;
31827
Norman James362a80f2015-09-14 14:04:39 -050031828 default:
31829 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
31830 break;
31831 }
31832}
31833
31834static void
31835object_skeleton_class_init (ObjectSkeletonClass *klass)
31836{
31837 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
31838
31839 gobject_class->set_property = object_skeleton_set_property;
31840 gobject_class->get_property = object_skeleton_get_property;
31841
Norman James493996c2015-10-31 17:27:13 -050031842 g_object_class_override_property (gobject_class, 1, "object-mapper");
Norman James5236a8f2015-11-05 20:39:31 -060031843 g_object_class_override_property (gobject_class, 2, "hwmon");
31844 g_object_class_override_property (gobject_class, 3, "fan");
31845 g_object_class_override_property (gobject_class, 4, "sensor-value");
31846 g_object_class_override_property (gobject_class, 5, "sensor-threshold");
31847 g_object_class_override_property (gobject_class, 6, "sensor-i2c");
31848 g_object_class_override_property (gobject_class, 7, "sensor-match");
31849 g_object_class_override_property (gobject_class, 8, "process");
31850 g_object_class_override_property (gobject_class, 9, "shared-resource");
31851 g_object_class_override_property (gobject_class, 10, "control");
31852 g_object_class_override_property (gobject_class, 11, "control-bmc");
31853 g_object_class_override_property (gobject_class, 12, "control-host");
31854 g_object_class_override_property (gobject_class, 13, "control-power");
31855 g_object_class_override_property (gobject_class, 14, "watchdog");
31856 g_object_class_override_property (gobject_class, 15, "event-log");
31857 g_object_class_override_property (gobject_class, 16, "flash");
31858 g_object_class_override_property (gobject_class, 17, "flash-control");
31859 g_object_class_override_property (gobject_class, 18, "button");
31860 g_object_class_override_property (gobject_class, 19, "led");
31861 g_object_class_override_property (gobject_class, 20, "host-ipmi");
Norman James362a80f2015-09-14 14:04:39 -050031862}
31863
31864/**
31865 * object_skeleton_new:
31866 * @object_path: An object path.
31867 *
31868 * Creates a new skeleton object.
31869 *
31870 * Returns: (transfer full): The skeleton object.
31871 */
31872ObjectSkeleton *
31873object_skeleton_new (const gchar *object_path)
31874{
31875 g_return_val_if_fail (g_variant_is_object_path (object_path), NULL);
31876 return OBJECT_SKELETON (g_object_new (TYPE_OBJECT_SKELETON, "g-object-path", object_path, NULL));
31877}
31878
31879/**
Norman James493996c2015-10-31 17:27:13 -050031880 * object_skeleton_set_object_mapper:
31881 * @object: A #ObjectSkeleton.
31882 * @interface_: (allow-none): A #ObjectMapper or %NULL to clear the interface.
31883 *
31884 * 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.
31885 */
31886void object_skeleton_set_object_mapper (ObjectSkeleton *object, ObjectMapper *interface_)
31887{
31888 g_object_set (G_OBJECT (object), "object-mapper", interface_, NULL);
31889}
31890
31891/**
Norman James5236a8f2015-11-05 20:39:31 -060031892 * object_skeleton_set_hwmon:
31893 * @object: A #ObjectSkeleton.
31894 * @interface_: (allow-none): A #Hwmon or %NULL to clear the interface.
31895 *
31896 * 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.
31897 */
31898void object_skeleton_set_hwmon (ObjectSkeleton *object, Hwmon *interface_)
31899{
31900 g_object_set (G_OBJECT (object), "hwmon", interface_, NULL);
31901}
31902
31903/**
Norman James362a80f2015-09-14 14:04:39 -050031904 * object_skeleton_set_fan:
31905 * @object: A #ObjectSkeleton.
31906 * @interface_: (allow-none): A #Fan or %NULL to clear the interface.
31907 *
31908 * 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.
31909 */
31910void object_skeleton_set_fan (ObjectSkeleton *object, Fan *interface_)
31911{
31912 g_object_set (G_OBJECT (object), "fan", interface_, NULL);
31913}
31914
31915/**
31916 * object_skeleton_set_sensor_value:
31917 * @object: A #ObjectSkeleton.
31918 * @interface_: (allow-none): A #SensorValue or %NULL to clear the interface.
31919 *
31920 * 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.
31921 */
31922void object_skeleton_set_sensor_value (ObjectSkeleton *object, SensorValue *interface_)
31923{
31924 g_object_set (G_OBJECT (object), "sensor-value", interface_, NULL);
31925}
31926
31927/**
31928 * object_skeleton_set_sensor_threshold:
31929 * @object: A #ObjectSkeleton.
31930 * @interface_: (allow-none): A #SensorThreshold or %NULL to clear the interface.
31931 *
31932 * 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.
31933 */
31934void object_skeleton_set_sensor_threshold (ObjectSkeleton *object, SensorThreshold *interface_)
31935{
31936 g_object_set (G_OBJECT (object), "sensor-threshold", interface_, NULL);
31937}
31938
31939/**
31940 * object_skeleton_set_sensor_i2c:
31941 * @object: A #ObjectSkeleton.
31942 * @interface_: (allow-none): A #SensorI2c or %NULL to clear the interface.
31943 *
31944 * 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.
31945 */
31946void object_skeleton_set_sensor_i2c (ObjectSkeleton *object, SensorI2c *interface_)
31947{
31948 g_object_set (G_OBJECT (object), "sensor-i2c", interface_, NULL);
31949}
31950
31951/**
31952 * object_skeleton_set_sensor_match:
31953 * @object: A #ObjectSkeleton.
31954 * @interface_: (allow-none): A #SensorMatch or %NULL to clear the interface.
31955 *
31956 * 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.
31957 */
31958void object_skeleton_set_sensor_match (ObjectSkeleton *object, SensorMatch *interface_)
31959{
31960 g_object_set (G_OBJECT (object), "sensor-match", interface_, NULL);
31961}
31962
31963/**
31964 * object_skeleton_set_process:
31965 * @object: A #ObjectSkeleton.
31966 * @interface_: (allow-none): A #Process or %NULL to clear the interface.
31967 *
31968 * 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.
31969 */
31970void object_skeleton_set_process (ObjectSkeleton *object, Process *interface_)
31971{
31972 g_object_set (G_OBJECT (object), "process", interface_, NULL);
31973}
31974
31975/**
Norman James18998182015-10-11 21:54:53 -050031976 * object_skeleton_set_shared_resource:
31977 * @object: A #ObjectSkeleton.
31978 * @interface_: (allow-none): A #SharedResource or %NULL to clear the interface.
31979 *
31980 * 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.
31981 */
31982void object_skeleton_set_shared_resource (ObjectSkeleton *object, SharedResource *interface_)
31983{
31984 g_object_set (G_OBJECT (object), "shared-resource", interface_, NULL);
31985}
31986
31987/**
Norman James362a80f2015-09-14 14:04:39 -050031988 * object_skeleton_set_control:
31989 * @object: A #ObjectSkeleton.
31990 * @interface_: (allow-none): A #Control or %NULL to clear the interface.
31991 *
31992 * 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.
31993 */
31994void object_skeleton_set_control (ObjectSkeleton *object, Control *interface_)
31995{
31996 g_object_set (G_OBJECT (object), "control", interface_, NULL);
31997}
31998
31999/**
32000 * object_skeleton_set_control_bmc:
32001 * @object: A #ObjectSkeleton.
32002 * @interface_: (allow-none): A #ControlBmc or %NULL to clear the interface.
32003 *
32004 * 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.
32005 */
32006void object_skeleton_set_control_bmc (ObjectSkeleton *object, ControlBmc *interface_)
32007{
32008 g_object_set (G_OBJECT (object), "control-bmc", interface_, NULL);
32009}
32010
32011/**
32012 * object_skeleton_set_control_host:
32013 * @object: A #ObjectSkeleton.
32014 * @interface_: (allow-none): A #ControlHost or %NULL to clear the interface.
32015 *
32016 * 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.
32017 */
32018void object_skeleton_set_control_host (ObjectSkeleton *object, ControlHost *interface_)
32019{
32020 g_object_set (G_OBJECT (object), "control-host", interface_, NULL);
32021}
32022
32023/**
32024 * object_skeleton_set_control_power:
32025 * @object: A #ObjectSkeleton.
32026 * @interface_: (allow-none): A #ControlPower or %NULL to clear the interface.
32027 *
32028 * 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.
32029 */
32030void object_skeleton_set_control_power (ObjectSkeleton *object, ControlPower *interface_)
32031{
32032 g_object_set (G_OBJECT (object), "control-power", interface_, NULL);
32033}
32034
32035/**
32036 * object_skeleton_set_watchdog:
32037 * @object: A #ObjectSkeleton.
32038 * @interface_: (allow-none): A #Watchdog or %NULL to clear the interface.
32039 *
32040 * 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.
32041 */
32042void object_skeleton_set_watchdog (ObjectSkeleton *object, Watchdog *interface_)
32043{
32044 g_object_set (G_OBJECT (object), "watchdog", interface_, NULL);
32045}
32046
32047/**
32048 * object_skeleton_set_event_log:
32049 * @object: A #ObjectSkeleton.
32050 * @interface_: (allow-none): A #EventLog or %NULL to clear the interface.
32051 *
32052 * 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.
32053 */
32054void object_skeleton_set_event_log (ObjectSkeleton *object, EventLog *interface_)
32055{
32056 g_object_set (G_OBJECT (object), "event-log", interface_, NULL);
32057}
32058
32059/**
32060 * object_skeleton_set_flash:
32061 * @object: A #ObjectSkeleton.
32062 * @interface_: (allow-none): A #Flash or %NULL to clear the interface.
32063 *
32064 * 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.
32065 */
32066void object_skeleton_set_flash (ObjectSkeleton *object, Flash *interface_)
32067{
32068 g_object_set (G_OBJECT (object), "flash", interface_, NULL);
32069}
32070
32071/**
Norman James18998182015-10-11 21:54:53 -050032072 * object_skeleton_set_flash_control:
32073 * @object: A #ObjectSkeleton.
32074 * @interface_: (allow-none): A #FlashControl or %NULL to clear the interface.
32075 *
32076 * 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.
32077 */
32078void object_skeleton_set_flash_control (ObjectSkeleton *object, FlashControl *interface_)
32079{
32080 g_object_set (G_OBJECT (object), "flash-control", interface_, NULL);
32081}
32082
32083/**
Norman James362a80f2015-09-14 14:04:39 -050032084 * object_skeleton_set_button:
32085 * @object: A #ObjectSkeleton.
32086 * @interface_: (allow-none): A #Button or %NULL to clear the interface.
32087 *
32088 * 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.
32089 */
32090void object_skeleton_set_button (ObjectSkeleton *object, Button *interface_)
32091{
32092 g_object_set (G_OBJECT (object), "button", interface_, NULL);
32093}
32094
32095/**
32096 * object_skeleton_set_led:
32097 * @object: A #ObjectSkeleton.
32098 * @interface_: (allow-none): A #Led or %NULL to clear the interface.
32099 *
32100 * 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.
32101 */
32102void object_skeleton_set_led (ObjectSkeleton *object, Led *interface_)
32103{
32104 g_object_set (G_OBJECT (object), "led", interface_, NULL);
32105}
32106
Norman Jamesdbcffbd2015-10-06 16:53:06 -050032107/**
32108 * object_skeleton_set_host_ipmi:
32109 * @object: A #ObjectSkeleton.
32110 * @interface_: (allow-none): A #HostIpmi or %NULL to clear the interface.
32111 *
32112 * 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.
32113 */
32114void object_skeleton_set_host_ipmi (ObjectSkeleton *object, HostIpmi *interface_)
32115{
32116 g_object_set (G_OBJECT (object), "host-ipmi", interface_, NULL);
32117}
32118
Norman James362a80f2015-09-14 14:04:39 -050032119
32120/* ------------------------------------------------------------------------
32121 * Code for ObjectManager client
32122 * ------------------------------------------------------------------------
32123 */
32124
32125/**
32126 * SECTION:ObjectManagerClient
32127 * @title: ObjectManagerClient
32128 * @short_description: Generated GDBusObjectManagerClient type
32129 *
32130 * This section contains a #GDBusObjectManagerClient that uses object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc.
32131 */
32132
32133/**
32134 * ObjectManagerClient:
32135 *
32136 * The #ObjectManagerClient structure contains only private data and should only be accessed using the provided API.
32137 */
32138
32139/**
32140 * ObjectManagerClientClass:
32141 * @parent_class: The parent class.
32142 *
32143 * Class structure for #ObjectManagerClient.
32144 */
32145
32146G_DEFINE_TYPE (ObjectManagerClient, object_manager_client, G_TYPE_DBUS_OBJECT_MANAGER_CLIENT);
32147
32148static void
32149object_manager_client_init (ObjectManagerClient *manager G_GNUC_UNUSED)
32150{
32151}
32152
32153static void
32154object_manager_client_class_init (ObjectManagerClientClass *klass G_GNUC_UNUSED)
32155{
32156}
32157
32158/**
32159 * object_manager_client_get_proxy_type:
32160 * @manager: A #GDBusObjectManagerClient.
32161 * @object_path: The object path of the remote object (unused).
32162 * @interface_name: (allow-none): Interface name of the remote object or %NULL to get the object proxy #GType.
32163 * @user_data: User data (unused).
32164 *
32165 * A #GDBusProxyTypeFunc that maps @interface_name to the generated #GDBusObjectProxy<!-- -->- and #GDBusProxy<!-- -->-derived types.
32166 *
32167 * Returns: A #GDBusProxy<!-- -->-derived #GType if @interface_name is not %NULL, otherwise the #GType for #ObjectProxy.
32168 */
32169GType
32170object_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)
32171{
32172 static gsize once_init_value = 0;
32173 static GHashTable *lookup_hash;
32174 GType ret;
32175
32176 if (interface_name == NULL)
32177 return TYPE_OBJECT_PROXY;
32178 if (g_once_init_enter (&once_init_value))
32179 {
32180 lookup_hash = g_hash_table_new (g_str_hash, g_str_equal);
Norman James493996c2015-10-31 17:27:13 -050032181 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 -060032182 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Hwmon", GSIZE_TO_POINTER (TYPE_HWMON_PROXY));
Norman James362a80f2015-09-14 14:04:39 -050032183 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Fan", GSIZE_TO_POINTER (TYPE_FAN_PROXY));
32184 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorValue", GSIZE_TO_POINTER (TYPE_SENSOR_VALUE_PROXY));
Norman James362a80f2015-09-14 14:04:39 -050032185 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorThreshold", GSIZE_TO_POINTER (TYPE_SENSOR_THRESHOLD_PROXY));
32186 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorI2c", GSIZE_TO_POINTER (TYPE_SENSOR_I2C_PROXY));
32187 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorMatch", GSIZE_TO_POINTER (TYPE_SENSOR_MATCH_PROXY));
32188 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Process", GSIZE_TO_POINTER (TYPE_PROCESS_PROXY));
Norman James18998182015-10-11 21:54:53 -050032189 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SharedResource", GSIZE_TO_POINTER (TYPE_SHARED_RESOURCE_PROXY));
Norman James362a80f2015-09-14 14:04:39 -050032190 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Control", GSIZE_TO_POINTER (TYPE_CONTROL_PROXY));
32191 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.control.Bmc", GSIZE_TO_POINTER (TYPE_CONTROL_BMC_PROXY));
32192 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.control.Host", GSIZE_TO_POINTER (TYPE_CONTROL_HOST_PROXY));
32193 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.control.Power", GSIZE_TO_POINTER (TYPE_CONTROL_POWER_PROXY));
32194 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Watchdog", GSIZE_TO_POINTER (TYPE_WATCHDOG_PROXY));
32195 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.EventLog", GSIZE_TO_POINTER (TYPE_EVENT_LOG_PROXY));
32196 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Flash", GSIZE_TO_POINTER (TYPE_FLASH_PROXY));
Norman James18998182015-10-11 21:54:53 -050032197 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.FlashControl", GSIZE_TO_POINTER (TYPE_FLASH_CONTROL_PROXY));
Norman James362a80f2015-09-14 14:04:39 -050032198 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Button", GSIZE_TO_POINTER (TYPE_BUTTON_PROXY));
32199 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Led", GSIZE_TO_POINTER (TYPE_LED_PROXY));
Norman Jamesdbcffbd2015-10-06 16:53:06 -050032200 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.HostIpmi", GSIZE_TO_POINTER (TYPE_HOST_IPMI_PROXY));
Norman James362a80f2015-09-14 14:04:39 -050032201 g_once_init_leave (&once_init_value, 1);
32202 }
32203 ret = (GType) GPOINTER_TO_SIZE (g_hash_table_lookup (lookup_hash, interface_name));
32204 if (ret == (GType) 0)
32205 ret = G_TYPE_DBUS_PROXY;
32206 return ret;
32207}
32208
32209/**
32210 * object_manager_client_new:
32211 * @connection: A #GDBusConnection.
32212 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
32213 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
32214 * @object_path: An object path.
32215 * @cancellable: (allow-none): A #GCancellable or %NULL.
32216 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
32217 * @user_data: User data to pass to @callback.
32218 *
32219 * Asynchronously creates #GDBusObjectManagerClient using object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new() for more details.
32220 *
32221 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
32222 * You can then call object_manager_client_new_finish() to get the result of the operation.
32223 *
32224 * See object_manager_client_new_sync() for the synchronous, blocking version of this constructor.
32225 */
32226void
32227object_manager_client_new (
32228 GDBusConnection *connection,
32229 GDBusObjectManagerClientFlags flags,
32230 const gchar *name,
32231 const gchar *object_path,
32232 GCancellable *cancellable,
32233 GAsyncReadyCallback callback,
32234 gpointer user_data)
32235{
32236 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);
32237}
32238
32239/**
32240 * object_manager_client_new_finish:
32241 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_manager_client_new().
32242 * @error: Return location for error or %NULL
32243 *
32244 * Finishes an operation started with object_manager_client_new().
32245 *
32246 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
32247 */
32248GDBusObjectManager *
32249object_manager_client_new_finish (
32250 GAsyncResult *res,
32251 GError **error)
32252{
32253 GObject *ret;
32254 GObject *source_object;
32255 source_object = g_async_result_get_source_object (res);
32256 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
32257 g_object_unref (source_object);
32258 if (ret != NULL)
32259 return G_DBUS_OBJECT_MANAGER (ret);
32260 else
32261 return NULL;
32262}
32263
32264/**
32265 * object_manager_client_new_sync:
32266 * @connection: A #GDBusConnection.
32267 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
32268 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
32269 * @object_path: An object path.
32270 * @cancellable: (allow-none): A #GCancellable or %NULL.
32271 * @error: Return location for error or %NULL
32272 *
32273 * Synchronously creates #GDBusObjectManagerClient using object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new_sync() for more details.
32274 *
32275 * The calling thread is blocked until a reply is received.
32276 *
32277 * See object_manager_client_new() for the asynchronous version of this constructor.
32278 *
32279 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
32280 */
32281GDBusObjectManager *
32282object_manager_client_new_sync (
32283 GDBusConnection *connection,
32284 GDBusObjectManagerClientFlags flags,
32285 const gchar *name,
32286 const gchar *object_path,
32287 GCancellable *cancellable,
32288 GError **error)
32289{
32290 GInitable *ret;
32291 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);
32292 if (ret != NULL)
32293 return G_DBUS_OBJECT_MANAGER (ret);
32294 else
32295 return NULL;
32296}
32297
32298
32299/**
32300 * object_manager_client_new_for_bus:
32301 * @bus_type: A #GBusType.
32302 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
32303 * @name: A bus name (well-known or unique).
32304 * @object_path: An object path.
32305 * @cancellable: (allow-none): A #GCancellable or %NULL.
32306 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
32307 * @user_data: User data to pass to @callback.
32308 *
32309 * Like object_manager_client_new() but takes a #GBusType instead of a #GDBusConnection.
32310 *
32311 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
32312 * You can then call object_manager_client_new_for_bus_finish() to get the result of the operation.
32313 *
32314 * See object_manager_client_new_for_bus_sync() for the synchronous, blocking version of this constructor.
32315 */
32316void
32317object_manager_client_new_for_bus (
32318 GBusType bus_type,
32319 GDBusObjectManagerClientFlags flags,
32320 const gchar *name,
32321 const gchar *object_path,
32322 GCancellable *cancellable,
32323 GAsyncReadyCallback callback,
32324 gpointer user_data)
32325{
32326 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);
32327}
32328
32329/**
32330 * object_manager_client_new_for_bus_finish:
32331 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_manager_client_new_for_bus().
32332 * @error: Return location for error or %NULL
32333 *
32334 * Finishes an operation started with object_manager_client_new_for_bus().
32335 *
32336 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
32337 */
32338GDBusObjectManager *
32339object_manager_client_new_for_bus_finish (
32340 GAsyncResult *res,
32341 GError **error)
32342{
32343 GObject *ret;
32344 GObject *source_object;
32345 source_object = g_async_result_get_source_object (res);
32346 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
32347 g_object_unref (source_object);
32348 if (ret != NULL)
32349 return G_DBUS_OBJECT_MANAGER (ret);
32350 else
32351 return NULL;
32352}
32353
32354/**
32355 * object_manager_client_new_for_bus_sync:
32356 * @bus_type: A #GBusType.
32357 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
32358 * @name: A bus name (well-known or unique).
32359 * @object_path: An object path.
32360 * @cancellable: (allow-none): A #GCancellable or %NULL.
32361 * @error: Return location for error or %NULL
32362 *
32363 * Like object_manager_client_new_sync() but takes a #GBusType instead of a #GDBusConnection.
32364 *
32365 * The calling thread is blocked until a reply is received.
32366 *
32367 * See object_manager_client_new_for_bus() for the asynchronous version of this constructor.
32368 *
32369 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
32370 */
32371GDBusObjectManager *
32372object_manager_client_new_for_bus_sync (
32373 GBusType bus_type,
32374 GDBusObjectManagerClientFlags flags,
32375 const gchar *name,
32376 const gchar *object_path,
32377 GCancellable *cancellable,
32378 GError **error)
32379{
32380 GInitable *ret;
32381 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);
32382 if (ret != NULL)
32383 return G_DBUS_OBJECT_MANAGER (ret);
32384 else
32385 return NULL;
32386}
32387
32388