blob: 4d0c822eb8a1b9d442bf11b391a2e2e50373605f [file] [log] [blame]
Norman James362a80f2015-09-14 14:04:39 -05001/*
Adriana Kobylakfd778822016-06-16 09:08:37 -05002 * Generated by gdbus-codegen 2.44.1. 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);
Adriana Kobylakfd778822016-06-16 09:08:37 -05002058 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _hwmon_emit_changed");
Norman James5236a8f2015-11-05 20:39:31 -06002059 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
2060 g_source_unref (skeleton->priv->changed_properties_idle_source);
2061 }
2062 g_mutex_unlock (&skeleton->priv->lock);
2063}
2064
2065static void
2066hwmon_skeleton_set_property (GObject *object,
2067 guint prop_id,
2068 const GValue *value,
2069 GParamSpec *pspec)
2070{
2071 HwmonSkeleton *skeleton = HWMON_SKELETON (object);
2072 g_assert (prop_id != 0 && prop_id - 1 < 3);
2073 g_mutex_lock (&skeleton->priv->lock);
2074 g_object_freeze_notify (object);
2075 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
2076 {
2077 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
2078 _hwmon_schedule_emit_changed (skeleton, _hwmon_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
2079 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
2080 g_object_notify_by_pspec (object, pspec);
2081 }
2082 g_mutex_unlock (&skeleton->priv->lock);
2083 g_object_thaw_notify (object);
2084}
2085
2086static void
2087hwmon_skeleton_init (HwmonSkeleton *skeleton)
2088{
2089#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
2090 skeleton->priv = hwmon_skeleton_get_instance_private (skeleton);
2091#else
2092 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_HWMON_SKELETON, HwmonSkeletonPrivate);
2093#endif
2094
2095 g_mutex_init (&skeleton->priv->lock);
2096 skeleton->priv->context = g_main_context_ref_thread_default ();
2097 skeleton->priv->properties = g_new0 (GValue, 3);
2098 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
2099 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
Norman James74828452015-11-17 13:10:34 -06002100 g_value_init (&skeleton->priv->properties[2], G_TYPE_INT);
Norman James5236a8f2015-11-05 20:39:31 -06002101}
2102
2103static gint
2104hwmon_skeleton_get_poll_interval (Hwmon *object)
2105{
2106 HwmonSkeleton *skeleton = HWMON_SKELETON (object);
2107 gint value;
2108 g_mutex_lock (&skeleton->priv->lock);
2109 value = g_value_get_int (&(skeleton->priv->properties[0]));
2110 g_mutex_unlock (&skeleton->priv->lock);
2111 return value;
2112}
2113
2114static const gchar *
2115hwmon_skeleton_get_sysfs_path (Hwmon *object)
2116{
2117 HwmonSkeleton *skeleton = HWMON_SKELETON (object);
2118 const gchar *value;
2119 g_mutex_lock (&skeleton->priv->lock);
2120 value = g_value_get_string (&(skeleton->priv->properties[1]));
2121 g_mutex_unlock (&skeleton->priv->lock);
2122 return value;
2123}
2124
Norman James74828452015-11-17 13:10:34 -06002125static gint
2126hwmon_skeleton_get_scale (Hwmon *object)
Norman James5236a8f2015-11-05 20:39:31 -06002127{
2128 HwmonSkeleton *skeleton = HWMON_SKELETON (object);
Norman James74828452015-11-17 13:10:34 -06002129 gint value;
Norman James5236a8f2015-11-05 20:39:31 -06002130 g_mutex_lock (&skeleton->priv->lock);
Norman James74828452015-11-17 13:10:34 -06002131 value = g_value_get_int (&(skeleton->priv->properties[2]));
Norman James5236a8f2015-11-05 20:39:31 -06002132 g_mutex_unlock (&skeleton->priv->lock);
2133 return value;
2134}
2135
2136static void
2137hwmon_skeleton_class_init (HwmonSkeletonClass *klass)
2138{
2139 GObjectClass *gobject_class;
2140 GDBusInterfaceSkeletonClass *skeleton_class;
2141
2142 gobject_class = G_OBJECT_CLASS (klass);
2143 gobject_class->finalize = hwmon_skeleton_finalize;
2144 gobject_class->get_property = hwmon_skeleton_get_property;
2145 gobject_class->set_property = hwmon_skeleton_set_property;
2146 gobject_class->notify = hwmon_skeleton_notify;
2147
2148
2149 hwmon_override_properties (gobject_class, 1);
2150
2151 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
2152 skeleton_class->get_info = hwmon_skeleton_dbus_interface_get_info;
2153 skeleton_class->get_properties = hwmon_skeleton_dbus_interface_get_properties;
2154 skeleton_class->flush = hwmon_skeleton_dbus_interface_flush;
2155 skeleton_class->get_vtable = hwmon_skeleton_dbus_interface_get_vtable;
2156
2157#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
2158 g_type_class_add_private (klass, sizeof (HwmonSkeletonPrivate));
2159#endif
2160}
2161
2162static void
2163hwmon_skeleton_iface_init (HwmonIface *iface)
2164{
2165 iface->get_poll_interval = hwmon_skeleton_get_poll_interval;
2166 iface->get_sysfs_path = hwmon_skeleton_get_sysfs_path;
Norman James74828452015-11-17 13:10:34 -06002167 iface->get_scale = hwmon_skeleton_get_scale;
Norman James5236a8f2015-11-05 20:39:31 -06002168}
2169
2170/**
2171 * hwmon_skeleton_new:
2172 *
2173 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Hwmon.top_of_page">org.openbmc.Hwmon</link>.
2174 *
2175 * Returns: (transfer full) (type HwmonSkeleton): The skeleton object.
2176 */
2177Hwmon *
2178hwmon_skeleton_new (void)
2179{
2180 return HWMON (g_object_new (TYPE_HWMON_SKELETON, NULL));
2181}
2182
2183/* ------------------------------------------------------------------------
Norman James362a80f2015-09-14 14:04:39 -05002184 * Code for interface org.openbmc.Fan
2185 * ------------------------------------------------------------------------
2186 */
2187
2188/**
2189 * SECTION:Fan
2190 * @title: Fan
2191 * @short_description: Generated C code for the org.openbmc.Fan D-Bus interface
2192 *
2193 * 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.
2194 */
2195
2196/* ---- Introspection data for org.openbmc.Fan ---- */
2197
2198static const _ExtendedGDBusArgInfo _fan_method_info_set_cooling_zone_IN_ARG_cooling_zone =
2199{
2200 {
2201 -1,
2202 (gchar *) "cooling_zone",
2203 (gchar *) "i",
2204 NULL
2205 },
2206 FALSE
2207};
2208
2209static const _ExtendedGDBusArgInfo * const _fan_method_info_set_cooling_zone_IN_ARG_pointers[] =
2210{
2211 &_fan_method_info_set_cooling_zone_IN_ARG_cooling_zone,
2212 NULL
2213};
2214
2215static const _ExtendedGDBusMethodInfo _fan_method_info_set_cooling_zone =
2216{
2217 {
2218 -1,
2219 (gchar *) "setCoolingZone",
2220 (GDBusArgInfo **) &_fan_method_info_set_cooling_zone_IN_ARG_pointers,
2221 NULL,
2222 NULL
2223 },
2224 "handle-set-cooling-zone",
2225 FALSE
2226};
2227
2228static const _ExtendedGDBusArgInfo _fan_method_info_get_speed_OUT_ARG_speed =
2229{
2230 {
2231 -1,
2232 (gchar *) "speed",
2233 (gchar *) "i",
2234 NULL
2235 },
2236 FALSE
2237};
2238
2239static const _ExtendedGDBusArgInfo * const _fan_method_info_get_speed_OUT_ARG_pointers[] =
2240{
2241 &_fan_method_info_get_speed_OUT_ARG_speed,
2242 NULL
2243};
2244
2245static const _ExtendedGDBusMethodInfo _fan_method_info_get_speed =
2246{
2247 {
2248 -1,
2249 (gchar *) "getSpeed",
2250 NULL,
2251 (GDBusArgInfo **) &_fan_method_info_get_speed_OUT_ARG_pointers,
2252 NULL
2253 },
2254 "handle-get-speed",
2255 FALSE
2256};
2257
2258static const _ExtendedGDBusArgInfo _fan_method_info_set_speed_IN_ARG_speed =
2259{
2260 {
2261 -1,
2262 (gchar *) "speed",
2263 (gchar *) "i",
2264 NULL
2265 },
2266 FALSE
2267};
2268
2269static const _ExtendedGDBusArgInfo * const _fan_method_info_set_speed_IN_ARG_pointers[] =
2270{
2271 &_fan_method_info_set_speed_IN_ARG_speed,
2272 NULL
2273};
2274
2275static const _ExtendedGDBusMethodInfo _fan_method_info_set_speed =
2276{
2277 {
2278 -1,
2279 (gchar *) "setSpeed",
2280 (GDBusArgInfo **) &_fan_method_info_set_speed_IN_ARG_pointers,
2281 NULL,
2282 NULL
2283 },
2284 "handle-set-speed",
2285 FALSE
2286};
2287
2288static const _ExtendedGDBusMethodInfo * const _fan_method_info_pointers[] =
2289{
2290 &_fan_method_info_set_cooling_zone,
2291 &_fan_method_info_get_speed,
2292 &_fan_method_info_set_speed,
2293 NULL
2294};
2295
2296static const _ExtendedGDBusArgInfo _fan_signal_info_speed_changed_ARG_speed =
2297{
2298 {
2299 -1,
2300 (gchar *) "speed",
2301 (gchar *) "i",
2302 NULL
2303 },
2304 FALSE
2305};
2306
2307static const _ExtendedGDBusArgInfo * const _fan_signal_info_speed_changed_ARG_pointers[] =
2308{
2309 &_fan_signal_info_speed_changed_ARG_speed,
2310 NULL
2311};
2312
2313static const _ExtendedGDBusSignalInfo _fan_signal_info_speed_changed =
2314{
2315 {
2316 -1,
2317 (gchar *) "SpeedChanged",
2318 (GDBusArgInfo **) &_fan_signal_info_speed_changed_ARG_pointers,
2319 NULL
2320 },
2321 "speed-changed"
2322};
2323
2324static const _ExtendedGDBusSignalInfo _fan_signal_info_tach_error =
2325{
2326 {
2327 -1,
2328 (gchar *) "TachError",
2329 NULL,
2330 NULL
2331 },
2332 "tach-error"
2333};
2334
2335static const _ExtendedGDBusSignalInfo * const _fan_signal_info_pointers[] =
2336{
2337 &_fan_signal_info_speed_changed,
2338 &_fan_signal_info_tach_error,
2339 NULL
2340};
2341
2342static const _ExtendedGDBusPropertyInfo _fan_property_info_speed =
2343{
2344 {
2345 -1,
2346 (gchar *) "speed",
2347 (gchar *) "i",
2348 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
2349 NULL
2350 },
2351 "speed",
2352 FALSE
2353};
2354
2355static const _ExtendedGDBusPropertyInfo _fan_property_info_cooling_zone =
2356{
2357 {
2358 -1,
2359 (gchar *) "cooling_zone",
2360 (gchar *) "i",
2361 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
2362 NULL
2363 },
2364 "cooling-zone",
2365 FALSE
2366};
2367
2368static const _ExtendedGDBusPropertyInfo _fan_property_info_pwm_num =
2369{
2370 {
2371 -1,
2372 (gchar *) "pwm_num",
2373 (gchar *) "i",
2374 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
2375 NULL
2376 },
2377 "pwm-num",
2378 FALSE
2379};
2380
2381static const _ExtendedGDBusPropertyInfo * const _fan_property_info_pointers[] =
2382{
2383 &_fan_property_info_speed,
2384 &_fan_property_info_cooling_zone,
2385 &_fan_property_info_pwm_num,
2386 NULL
2387};
2388
2389static const _ExtendedGDBusInterfaceInfo _fan_interface_info =
2390{
2391 {
2392 -1,
2393 (gchar *) "org.openbmc.Fan",
2394 (GDBusMethodInfo **) &_fan_method_info_pointers,
2395 (GDBusSignalInfo **) &_fan_signal_info_pointers,
2396 (GDBusPropertyInfo **) &_fan_property_info_pointers,
2397 NULL
2398 },
2399 "fan",
2400};
2401
2402
2403/**
2404 * fan_interface_info:
2405 *
2406 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link> D-Bus interface.
2407 *
2408 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
2409 */
2410GDBusInterfaceInfo *
2411fan_interface_info (void)
2412{
2413 return (GDBusInterfaceInfo *) &_fan_interface_info.parent_struct;
2414}
2415
2416/**
2417 * fan_override_properties:
2418 * @klass: The class structure for a #GObject<!-- -->-derived class.
2419 * @property_id_begin: The property id to assign to the first overridden property.
2420 *
2421 * Overrides all #GObject properties in the #Fan interface for a concrete class.
2422 * The properties are overridden in the order they are defined.
2423 *
2424 * Returns: The last property id.
2425 */
2426guint
2427fan_override_properties (GObjectClass *klass, guint property_id_begin)
2428{
2429 g_object_class_override_property (klass, property_id_begin++, "speed");
2430 g_object_class_override_property (klass, property_id_begin++, "cooling-zone");
2431 g_object_class_override_property (klass, property_id_begin++, "pwm-num");
2432 return property_id_begin - 1;
2433}
2434
2435
2436
2437/**
2438 * Fan:
2439 *
2440 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link>.
2441 */
2442
2443/**
2444 * FanIface:
2445 * @parent_iface: The parent interface.
2446 * @handle_get_speed: Handler for the #Fan::handle-get-speed signal.
2447 * @handle_set_cooling_zone: Handler for the #Fan::handle-set-cooling-zone signal.
2448 * @handle_set_speed: Handler for the #Fan::handle-set-speed signal.
2449 * @get_cooling_zone: Getter for the #Fan:cooling-zone property.
2450 * @get_pwm_num: Getter for the #Fan:pwm-num property.
2451 * @get_speed: Getter for the #Fan:speed property.
2452 * @speed_changed: Handler for the #Fan::speed-changed signal.
2453 * @tach_error: Handler for the #Fan::tach-error signal.
2454 *
2455 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link>.
2456 */
2457
2458typedef FanIface FanInterface;
2459G_DEFINE_INTERFACE (Fan, fan, G_TYPE_OBJECT);
2460
2461static void
2462fan_default_init (FanIface *iface)
2463{
2464 /* GObject signals for incoming D-Bus method calls: */
2465 /**
2466 * Fan::handle-set-cooling-zone:
2467 * @object: A #Fan.
2468 * @invocation: A #GDBusMethodInvocation.
2469 * @arg_cooling_zone: Argument passed by remote caller.
2470 *
2471 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Fan.setCoolingZone">setCoolingZone()</link> D-Bus method.
2472 *
2473 * 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.
2474 *
2475 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
2476 */
2477 g_signal_new ("handle-set-cooling-zone",
2478 G_TYPE_FROM_INTERFACE (iface),
2479 G_SIGNAL_RUN_LAST,
2480 G_STRUCT_OFFSET (FanIface, handle_set_cooling_zone),
2481 g_signal_accumulator_true_handled,
2482 NULL,
2483 g_cclosure_marshal_generic,
2484 G_TYPE_BOOLEAN,
2485 2,
2486 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT);
2487
2488 /**
2489 * Fan::handle-get-speed:
2490 * @object: A #Fan.
2491 * @invocation: A #GDBusMethodInvocation.
2492 *
2493 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Fan.getSpeed">getSpeed()</link> D-Bus method.
2494 *
2495 * 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.
2496 *
2497 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
2498 */
2499 g_signal_new ("handle-get-speed",
2500 G_TYPE_FROM_INTERFACE (iface),
2501 G_SIGNAL_RUN_LAST,
2502 G_STRUCT_OFFSET (FanIface, handle_get_speed),
2503 g_signal_accumulator_true_handled,
2504 NULL,
2505 g_cclosure_marshal_generic,
2506 G_TYPE_BOOLEAN,
2507 1,
2508 G_TYPE_DBUS_METHOD_INVOCATION);
2509
2510 /**
2511 * Fan::handle-set-speed:
2512 * @object: A #Fan.
2513 * @invocation: A #GDBusMethodInvocation.
2514 * @arg_speed: Argument passed by remote caller.
2515 *
2516 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Fan.setSpeed">setSpeed()</link> D-Bus method.
2517 *
2518 * 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.
2519 *
2520 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
2521 */
2522 g_signal_new ("handle-set-speed",
2523 G_TYPE_FROM_INTERFACE (iface),
2524 G_SIGNAL_RUN_LAST,
2525 G_STRUCT_OFFSET (FanIface, handle_set_speed),
2526 g_signal_accumulator_true_handled,
2527 NULL,
2528 g_cclosure_marshal_generic,
2529 G_TYPE_BOOLEAN,
2530 2,
2531 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT);
2532
2533 /* GObject signals for received D-Bus signals: */
2534 /**
2535 * Fan::speed-changed:
2536 * @object: A #Fan.
2537 * @arg_speed: Argument.
2538 *
2539 * 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.
2540 *
2541 * 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.
2542 */
2543 g_signal_new ("speed-changed",
2544 G_TYPE_FROM_INTERFACE (iface),
2545 G_SIGNAL_RUN_LAST,
2546 G_STRUCT_OFFSET (FanIface, speed_changed),
2547 NULL,
2548 NULL,
2549 g_cclosure_marshal_generic,
2550 G_TYPE_NONE,
2551 1, G_TYPE_INT);
2552
2553 /**
2554 * Fan::tach-error:
2555 * @object: A #Fan.
2556 *
2557 * 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.
2558 *
2559 * 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.
2560 */
2561 g_signal_new ("tach-error",
2562 G_TYPE_FROM_INTERFACE (iface),
2563 G_SIGNAL_RUN_LAST,
2564 G_STRUCT_OFFSET (FanIface, tach_error),
2565 NULL,
2566 NULL,
2567 g_cclosure_marshal_generic,
2568 G_TYPE_NONE,
2569 0);
2570
2571 /* GObject properties for D-Bus properties: */
2572 /**
2573 * Fan:speed:
2574 *
2575 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fan.speed">"speed"</link>.
2576 *
2577 * 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.
2578 */
2579 g_object_interface_install_property (iface,
2580 g_param_spec_int ("speed", "speed", "speed", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
2581 /**
2582 * Fan:cooling-zone:
2583 *
2584 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fan.cooling_zone">"cooling_zone"</link>.
2585 *
2586 * 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.
2587 */
2588 g_object_interface_install_property (iface,
2589 g_param_spec_int ("cooling-zone", "cooling_zone", "cooling_zone", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
2590 /**
2591 * Fan:pwm-num:
2592 *
2593 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fan.pwm_num">"pwm_num"</link>.
2594 *
2595 * 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.
2596 */
2597 g_object_interface_install_property (iface,
2598 g_param_spec_int ("pwm-num", "pwm_num", "pwm_num", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
2599}
2600
2601/**
2602 * fan_get_speed: (skip)
2603 * @object: A #Fan.
2604 *
2605 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fan.speed">"speed"</link> D-Bus property.
2606 *
2607 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
2608 *
2609 * Returns: The property value.
2610 */
2611gint
2612fan_get_speed (Fan *object)
2613{
2614 return FAN_GET_IFACE (object)->get_speed (object);
2615}
2616
2617/**
2618 * fan_set_speed: (skip)
2619 * @object: A #Fan.
2620 * @value: The value to set.
2621 *
2622 * Sets the <link linkend="gdbus-property-org-openbmc-Fan.speed">"speed"</link> D-Bus property to @value.
2623 *
2624 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
2625 */
2626void
2627fan_set_speed (Fan *object, gint value)
2628{
2629 g_object_set (G_OBJECT (object), "speed", value, NULL);
2630}
2631
2632/**
2633 * fan_get_cooling_zone: (skip)
2634 * @object: A #Fan.
2635 *
2636 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fan.cooling_zone">"cooling_zone"</link> D-Bus property.
2637 *
2638 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
2639 *
2640 * Returns: The property value.
2641 */
2642gint
2643fan_get_cooling_zone (Fan *object)
2644{
2645 return FAN_GET_IFACE (object)->get_cooling_zone (object);
2646}
2647
2648/**
2649 * fan_set_cooling_zone: (skip)
2650 * @object: A #Fan.
2651 * @value: The value to set.
2652 *
2653 * Sets the <link linkend="gdbus-property-org-openbmc-Fan.cooling_zone">"cooling_zone"</link> D-Bus property to @value.
2654 *
2655 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
2656 */
2657void
2658fan_set_cooling_zone (Fan *object, gint value)
2659{
2660 g_object_set (G_OBJECT (object), "cooling-zone", value, NULL);
2661}
2662
2663/**
2664 * fan_get_pwm_num: (skip)
2665 * @object: A #Fan.
2666 *
2667 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fan.pwm_num">"pwm_num"</link> D-Bus property.
2668 *
2669 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
2670 *
2671 * Returns: The property value.
2672 */
2673gint
2674fan_get_pwm_num (Fan *object)
2675{
2676 return FAN_GET_IFACE (object)->get_pwm_num (object);
2677}
2678
2679/**
2680 * fan_set_pwm_num: (skip)
2681 * @object: A #Fan.
2682 * @value: The value to set.
2683 *
2684 * Sets the <link linkend="gdbus-property-org-openbmc-Fan.pwm_num">"pwm_num"</link> D-Bus property to @value.
2685 *
2686 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
2687 */
2688void
2689fan_set_pwm_num (Fan *object, gint value)
2690{
2691 g_object_set (G_OBJECT (object), "pwm-num", value, NULL);
2692}
2693
2694/**
2695 * fan_emit_speed_changed:
2696 * @object: A #Fan.
2697 * @arg_speed: Argument to pass with the signal.
2698 *
2699 * Emits the <link linkend="gdbus-signal-org-openbmc-Fan.SpeedChanged">"SpeedChanged"</link> D-Bus signal.
2700 */
2701void
2702fan_emit_speed_changed (
2703 Fan *object,
2704 gint arg_speed)
2705{
2706 g_signal_emit_by_name (object, "speed-changed", arg_speed);
2707}
2708
2709/**
2710 * fan_emit_tach_error:
2711 * @object: A #Fan.
2712 *
2713 * Emits the <link linkend="gdbus-signal-org-openbmc-Fan.TachError">"TachError"</link> D-Bus signal.
2714 */
2715void
2716fan_emit_tach_error (
2717 Fan *object)
2718{
2719 g_signal_emit_by_name (object, "tach-error");
2720}
2721
2722/**
2723 * fan_call_set_cooling_zone:
2724 * @proxy: A #FanProxy.
2725 * @arg_cooling_zone: Argument to pass with the method invocation.
2726 * @cancellable: (allow-none): A #GCancellable or %NULL.
2727 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
2728 * @user_data: User data to pass to @callback.
2729 *
2730 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Fan.setCoolingZone">setCoolingZone()</link> D-Bus method on @proxy.
2731 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
2732 * You can then call fan_call_set_cooling_zone_finish() to get the result of the operation.
2733 *
2734 * See fan_call_set_cooling_zone_sync() for the synchronous, blocking version of this method.
2735 */
2736void
2737fan_call_set_cooling_zone (
2738 Fan *proxy,
2739 gint arg_cooling_zone,
2740 GCancellable *cancellable,
2741 GAsyncReadyCallback callback,
2742 gpointer user_data)
2743{
2744 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
2745 "setCoolingZone",
2746 g_variant_new ("(i)",
2747 arg_cooling_zone),
2748 G_DBUS_CALL_FLAGS_NONE,
2749 -1,
2750 cancellable,
2751 callback,
2752 user_data);
2753}
2754
2755/**
2756 * fan_call_set_cooling_zone_finish:
2757 * @proxy: A #FanProxy.
2758 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_call_set_cooling_zone().
2759 * @error: Return location for error or %NULL.
2760 *
2761 * Finishes an operation started with fan_call_set_cooling_zone().
2762 *
2763 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
2764 */
2765gboolean
2766fan_call_set_cooling_zone_finish (
2767 Fan *proxy,
2768 GAsyncResult *res,
2769 GError **error)
2770{
2771 GVariant *_ret;
2772 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
2773 if (_ret == NULL)
2774 goto _out;
2775 g_variant_get (_ret,
2776 "()");
2777 g_variant_unref (_ret);
2778_out:
2779 return _ret != NULL;
2780}
2781
2782/**
2783 * fan_call_set_cooling_zone_sync:
2784 * @proxy: A #FanProxy.
2785 * @arg_cooling_zone: Argument to pass with the method invocation.
2786 * @cancellable: (allow-none): A #GCancellable or %NULL.
2787 * @error: Return location for error or %NULL.
2788 *
2789 * 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.
2790 *
2791 * See fan_call_set_cooling_zone() for the asynchronous version of this method.
2792 *
2793 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
2794 */
2795gboolean
2796fan_call_set_cooling_zone_sync (
2797 Fan *proxy,
2798 gint arg_cooling_zone,
2799 GCancellable *cancellable,
2800 GError **error)
2801{
2802 GVariant *_ret;
2803 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
2804 "setCoolingZone",
2805 g_variant_new ("(i)",
2806 arg_cooling_zone),
2807 G_DBUS_CALL_FLAGS_NONE,
2808 -1,
2809 cancellable,
2810 error);
2811 if (_ret == NULL)
2812 goto _out;
2813 g_variant_get (_ret,
2814 "()");
2815 g_variant_unref (_ret);
2816_out:
2817 return _ret != NULL;
2818}
2819
2820/**
2821 * fan_call_get_speed:
2822 * @proxy: A #FanProxy.
2823 * @cancellable: (allow-none): A #GCancellable or %NULL.
2824 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
2825 * @user_data: User data to pass to @callback.
2826 *
2827 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Fan.getSpeed">getSpeed()</link> D-Bus method on @proxy.
2828 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
2829 * You can then call fan_call_get_speed_finish() to get the result of the operation.
2830 *
2831 * See fan_call_get_speed_sync() for the synchronous, blocking version of this method.
2832 */
2833void
2834fan_call_get_speed (
2835 Fan *proxy,
2836 GCancellable *cancellable,
2837 GAsyncReadyCallback callback,
2838 gpointer user_data)
2839{
2840 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
2841 "getSpeed",
2842 g_variant_new ("()"),
2843 G_DBUS_CALL_FLAGS_NONE,
2844 -1,
2845 cancellable,
2846 callback,
2847 user_data);
2848}
2849
2850/**
2851 * fan_call_get_speed_finish:
2852 * @proxy: A #FanProxy.
2853 * @out_speed: (out): Return location for return parameter or %NULL to ignore.
2854 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_call_get_speed().
2855 * @error: Return location for error or %NULL.
2856 *
2857 * Finishes an operation started with fan_call_get_speed().
2858 *
2859 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
2860 */
2861gboolean
2862fan_call_get_speed_finish (
2863 Fan *proxy,
2864 gint *out_speed,
2865 GAsyncResult *res,
2866 GError **error)
2867{
2868 GVariant *_ret;
2869 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
2870 if (_ret == NULL)
2871 goto _out;
2872 g_variant_get (_ret,
2873 "(i)",
2874 out_speed);
2875 g_variant_unref (_ret);
2876_out:
2877 return _ret != NULL;
2878}
2879
2880/**
2881 * fan_call_get_speed_sync:
2882 * @proxy: A #FanProxy.
2883 * @out_speed: (out): Return location for return parameter or %NULL to ignore.
2884 * @cancellable: (allow-none): A #GCancellable or %NULL.
2885 * @error: Return location for error or %NULL.
2886 *
2887 * 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.
2888 *
2889 * See fan_call_get_speed() for the asynchronous version of this method.
2890 *
2891 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
2892 */
2893gboolean
2894fan_call_get_speed_sync (
2895 Fan *proxy,
2896 gint *out_speed,
2897 GCancellable *cancellable,
2898 GError **error)
2899{
2900 GVariant *_ret;
2901 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
2902 "getSpeed",
2903 g_variant_new ("()"),
2904 G_DBUS_CALL_FLAGS_NONE,
2905 -1,
2906 cancellable,
2907 error);
2908 if (_ret == NULL)
2909 goto _out;
2910 g_variant_get (_ret,
2911 "(i)",
2912 out_speed);
2913 g_variant_unref (_ret);
2914_out:
2915 return _ret != NULL;
2916}
2917
2918/**
2919 * fan_call_set_speed:
2920 * @proxy: A #FanProxy.
2921 * @arg_speed: Argument to pass with the method invocation.
2922 * @cancellable: (allow-none): A #GCancellable or %NULL.
2923 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
2924 * @user_data: User data to pass to @callback.
2925 *
2926 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Fan.setSpeed">setSpeed()</link> D-Bus method on @proxy.
2927 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
2928 * You can then call fan_call_set_speed_finish() to get the result of the operation.
2929 *
2930 * See fan_call_set_speed_sync() for the synchronous, blocking version of this method.
2931 */
2932void
2933fan_call_set_speed (
2934 Fan *proxy,
2935 gint arg_speed,
2936 GCancellable *cancellable,
2937 GAsyncReadyCallback callback,
2938 gpointer user_data)
2939{
2940 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
2941 "setSpeed",
2942 g_variant_new ("(i)",
2943 arg_speed),
2944 G_DBUS_CALL_FLAGS_NONE,
2945 -1,
2946 cancellable,
2947 callback,
2948 user_data);
2949}
2950
2951/**
2952 * fan_call_set_speed_finish:
2953 * @proxy: A #FanProxy.
2954 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_call_set_speed().
2955 * @error: Return location for error or %NULL.
2956 *
2957 * Finishes an operation started with fan_call_set_speed().
2958 *
2959 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
2960 */
2961gboolean
2962fan_call_set_speed_finish (
2963 Fan *proxy,
2964 GAsyncResult *res,
2965 GError **error)
2966{
2967 GVariant *_ret;
2968 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
2969 if (_ret == NULL)
2970 goto _out;
2971 g_variant_get (_ret,
2972 "()");
2973 g_variant_unref (_ret);
2974_out:
2975 return _ret != NULL;
2976}
2977
2978/**
2979 * fan_call_set_speed_sync:
2980 * @proxy: A #FanProxy.
2981 * @arg_speed: Argument to pass with the method invocation.
2982 * @cancellable: (allow-none): A #GCancellable or %NULL.
2983 * @error: Return location for error or %NULL.
2984 *
2985 * 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.
2986 *
2987 * See fan_call_set_speed() for the asynchronous version of this method.
2988 *
2989 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
2990 */
2991gboolean
2992fan_call_set_speed_sync (
2993 Fan *proxy,
2994 gint arg_speed,
2995 GCancellable *cancellable,
2996 GError **error)
2997{
2998 GVariant *_ret;
2999 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
3000 "setSpeed",
3001 g_variant_new ("(i)",
3002 arg_speed),
3003 G_DBUS_CALL_FLAGS_NONE,
3004 -1,
3005 cancellable,
3006 error);
3007 if (_ret == NULL)
3008 goto _out;
3009 g_variant_get (_ret,
3010 "()");
3011 g_variant_unref (_ret);
3012_out:
3013 return _ret != NULL;
3014}
3015
3016/**
3017 * fan_complete_set_cooling_zone:
3018 * @object: A #Fan.
3019 * @invocation: (transfer full): A #GDBusMethodInvocation.
3020 *
3021 * 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.
3022 *
3023 * This method will free @invocation, you cannot use it afterwards.
3024 */
3025void
3026fan_complete_set_cooling_zone (
3027 Fan *object,
3028 GDBusMethodInvocation *invocation)
3029{
3030 g_dbus_method_invocation_return_value (invocation,
3031 g_variant_new ("()"));
3032}
3033
3034/**
3035 * fan_complete_get_speed:
3036 * @object: A #Fan.
3037 * @invocation: (transfer full): A #GDBusMethodInvocation.
3038 * @speed: Parameter to return.
3039 *
3040 * 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.
3041 *
3042 * This method will free @invocation, you cannot use it afterwards.
3043 */
3044void
3045fan_complete_get_speed (
3046 Fan *object,
3047 GDBusMethodInvocation *invocation,
3048 gint speed)
3049{
3050 g_dbus_method_invocation_return_value (invocation,
3051 g_variant_new ("(i)",
3052 speed));
3053}
3054
3055/**
3056 * fan_complete_set_speed:
3057 * @object: A #Fan.
3058 * @invocation: (transfer full): A #GDBusMethodInvocation.
3059 *
3060 * 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.
3061 *
3062 * This method will free @invocation, you cannot use it afterwards.
3063 */
3064void
3065fan_complete_set_speed (
3066 Fan *object,
3067 GDBusMethodInvocation *invocation)
3068{
3069 g_dbus_method_invocation_return_value (invocation,
3070 g_variant_new ("()"));
3071}
3072
3073/* ------------------------------------------------------------------------ */
3074
3075/**
3076 * FanProxy:
3077 *
3078 * The #FanProxy structure contains only private data and should only be accessed using the provided API.
3079 */
3080
3081/**
3082 * FanProxyClass:
3083 * @parent_class: The parent class.
3084 *
3085 * Class structure for #FanProxy.
3086 */
3087
3088struct _FanProxyPrivate
3089{
3090 GData *qdata;
3091};
3092
3093static void fan_proxy_iface_init (FanIface *iface);
3094
3095#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
3096G_DEFINE_TYPE_WITH_CODE (FanProxy, fan_proxy, G_TYPE_DBUS_PROXY,
3097 G_ADD_PRIVATE (FanProxy)
3098 G_IMPLEMENT_INTERFACE (TYPE_FAN, fan_proxy_iface_init));
3099
3100#else
3101G_DEFINE_TYPE_WITH_CODE (FanProxy, fan_proxy, G_TYPE_DBUS_PROXY,
3102 G_IMPLEMENT_INTERFACE (TYPE_FAN, fan_proxy_iface_init));
3103
3104#endif
3105static void
3106fan_proxy_finalize (GObject *object)
3107{
3108 FanProxy *proxy = FAN_PROXY (object);
3109 g_datalist_clear (&proxy->priv->qdata);
3110 G_OBJECT_CLASS (fan_proxy_parent_class)->finalize (object);
3111}
3112
3113static void
3114fan_proxy_get_property (GObject *object,
3115 guint prop_id,
3116 GValue *value,
3117 GParamSpec *pspec G_GNUC_UNUSED)
3118{
3119 const _ExtendedGDBusPropertyInfo *info;
3120 GVariant *variant;
3121 g_assert (prop_id != 0 && prop_id - 1 < 3);
3122 info = _fan_property_info_pointers[prop_id - 1];
3123 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
3124 if (info->use_gvariant)
3125 {
3126 g_value_set_variant (value, variant);
3127 }
3128 else
3129 {
3130 if (variant != NULL)
3131 g_dbus_gvariant_to_gvalue (variant, value);
3132 }
3133 if (variant != NULL)
3134 g_variant_unref (variant);
3135}
3136
3137static void
3138fan_proxy_set_property_cb (GDBusProxy *proxy,
3139 GAsyncResult *res,
3140 gpointer user_data)
3141{
3142 const _ExtendedGDBusPropertyInfo *info = user_data;
3143 GError *error;
3144 GVariant *_ret;
3145 error = NULL;
3146 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
3147 if (!_ret)
3148 {
3149 g_warning ("Error setting property '%s' on interface org.openbmc.Fan: %s (%s, %d)",
3150 info->parent_struct.name,
3151 error->message, g_quark_to_string (error->domain), error->code);
3152 g_error_free (error);
3153 }
3154 else
3155 {
3156 g_variant_unref (_ret);
3157 }
3158}
3159
3160static void
3161fan_proxy_set_property (GObject *object,
3162 guint prop_id,
3163 const GValue *value,
3164 GParamSpec *pspec G_GNUC_UNUSED)
3165{
3166 const _ExtendedGDBusPropertyInfo *info;
3167 GVariant *variant;
3168 g_assert (prop_id != 0 && prop_id - 1 < 3);
3169 info = _fan_property_info_pointers[prop_id - 1];
3170 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
3171 g_dbus_proxy_call (G_DBUS_PROXY (object),
3172 "org.freedesktop.DBus.Properties.Set",
3173 g_variant_new ("(ssv)", "org.openbmc.Fan", info->parent_struct.name, variant),
3174 G_DBUS_CALL_FLAGS_NONE,
3175 -1,
3176 NULL, (GAsyncReadyCallback) fan_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
3177 g_variant_unref (variant);
3178}
3179
3180static void
3181fan_proxy_g_signal (GDBusProxy *proxy,
3182 const gchar *sender_name G_GNUC_UNUSED,
3183 const gchar *signal_name,
3184 GVariant *parameters)
3185{
3186 _ExtendedGDBusSignalInfo *info;
3187 GVariantIter iter;
3188 GVariant *child;
3189 GValue *paramv;
3190 guint num_params;
3191 guint n;
3192 guint signal_id;
3193 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, signal_name);
3194 if (info == NULL)
3195 return;
3196 num_params = g_variant_n_children (parameters);
3197 paramv = g_new0 (GValue, num_params + 1);
3198 g_value_init (&paramv[0], TYPE_FAN);
3199 g_value_set_object (&paramv[0], proxy);
3200 g_variant_iter_init (&iter, parameters);
3201 n = 1;
3202 while ((child = g_variant_iter_next_value (&iter)) != NULL)
3203 {
3204 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
3205 if (arg_info->use_gvariant)
3206 {
3207 g_value_init (&paramv[n], G_TYPE_VARIANT);
3208 g_value_set_variant (&paramv[n], child);
3209 n++;
3210 }
3211 else
3212 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
3213 g_variant_unref (child);
3214 }
3215 signal_id = g_signal_lookup (info->signal_name, TYPE_FAN);
3216 g_signal_emitv (paramv, signal_id, 0, NULL);
3217 for (n = 0; n < num_params + 1; n++)
3218 g_value_unset (&paramv[n]);
3219 g_free (paramv);
3220}
3221
3222static void
3223fan_proxy_g_properties_changed (GDBusProxy *_proxy,
3224 GVariant *changed_properties,
3225 const gchar *const *invalidated_properties)
3226{
3227 FanProxy *proxy = FAN_PROXY (_proxy);
3228 guint n;
3229 const gchar *key;
3230 GVariantIter *iter;
3231 _ExtendedGDBusPropertyInfo *info;
3232 g_variant_get (changed_properties, "a{sv}", &iter);
3233 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
3234 {
3235 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, key);
3236 g_datalist_remove_data (&proxy->priv->qdata, key);
3237 if (info != NULL)
3238 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
3239 }
3240 g_variant_iter_free (iter);
3241 for (n = 0; invalidated_properties[n] != NULL; n++)
3242 {
3243 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, invalidated_properties[n]);
3244 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
3245 if (info != NULL)
3246 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
3247 }
3248}
3249
3250static gint
3251fan_proxy_get_speed (Fan *object)
3252{
3253 FanProxy *proxy = FAN_PROXY (object);
3254 GVariant *variant;
3255 gint value = 0;
3256 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "speed");
3257 if (variant != NULL)
3258 {
3259 value = g_variant_get_int32 (variant);
3260 g_variant_unref (variant);
3261 }
3262 return value;
3263}
3264
3265static gint
3266fan_proxy_get_cooling_zone (Fan *object)
3267{
3268 FanProxy *proxy = FAN_PROXY (object);
3269 GVariant *variant;
3270 gint value = 0;
3271 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "cooling_zone");
3272 if (variant != NULL)
3273 {
3274 value = g_variant_get_int32 (variant);
3275 g_variant_unref (variant);
3276 }
3277 return value;
3278}
3279
3280static gint
3281fan_proxy_get_pwm_num (Fan *object)
3282{
3283 FanProxy *proxy = FAN_PROXY (object);
3284 GVariant *variant;
3285 gint value = 0;
3286 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "pwm_num");
3287 if (variant != NULL)
3288 {
3289 value = g_variant_get_int32 (variant);
3290 g_variant_unref (variant);
3291 }
3292 return value;
3293}
3294
3295static void
3296fan_proxy_init (FanProxy *proxy)
3297{
3298#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
3299 proxy->priv = fan_proxy_get_instance_private (proxy);
3300#else
3301 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_FAN_PROXY, FanProxyPrivate);
3302#endif
3303
3304 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), fan_interface_info ());
3305}
3306
3307static void
3308fan_proxy_class_init (FanProxyClass *klass)
3309{
3310 GObjectClass *gobject_class;
3311 GDBusProxyClass *proxy_class;
3312
3313 gobject_class = G_OBJECT_CLASS (klass);
3314 gobject_class->finalize = fan_proxy_finalize;
3315 gobject_class->get_property = fan_proxy_get_property;
3316 gobject_class->set_property = fan_proxy_set_property;
3317
3318 proxy_class = G_DBUS_PROXY_CLASS (klass);
3319 proxy_class->g_signal = fan_proxy_g_signal;
3320 proxy_class->g_properties_changed = fan_proxy_g_properties_changed;
3321
3322 fan_override_properties (gobject_class, 1);
3323
3324#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
3325 g_type_class_add_private (klass, sizeof (FanProxyPrivate));
3326#endif
3327}
3328
3329static void
3330fan_proxy_iface_init (FanIface *iface)
3331{
3332 iface->get_speed = fan_proxy_get_speed;
3333 iface->get_cooling_zone = fan_proxy_get_cooling_zone;
3334 iface->get_pwm_num = fan_proxy_get_pwm_num;
3335}
3336
3337/**
3338 * fan_proxy_new:
3339 * @connection: A #GDBusConnection.
3340 * @flags: Flags from the #GDBusProxyFlags enumeration.
3341 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
3342 * @object_path: An object path.
3343 * @cancellable: (allow-none): A #GCancellable or %NULL.
3344 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
3345 * @user_data: User data to pass to @callback.
3346 *
3347 * 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.
3348 *
3349 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
3350 * You can then call fan_proxy_new_finish() to get the result of the operation.
3351 *
3352 * See fan_proxy_new_sync() for the synchronous, blocking version of this constructor.
3353 */
3354void
3355fan_proxy_new (
3356 GDBusConnection *connection,
3357 GDBusProxyFlags flags,
3358 const gchar *name,
3359 const gchar *object_path,
3360 GCancellable *cancellable,
3361 GAsyncReadyCallback callback,
3362 gpointer user_data)
3363{
3364 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);
3365}
3366
3367/**
3368 * fan_proxy_new_finish:
3369 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_proxy_new().
3370 * @error: Return location for error or %NULL
3371 *
3372 * Finishes an operation started with fan_proxy_new().
3373 *
3374 * Returns: (transfer full) (type FanProxy): The constructed proxy object or %NULL if @error is set.
3375 */
3376Fan *
3377fan_proxy_new_finish (
3378 GAsyncResult *res,
3379 GError **error)
3380{
3381 GObject *ret;
3382 GObject *source_object;
3383 source_object = g_async_result_get_source_object (res);
3384 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
3385 g_object_unref (source_object);
3386 if (ret != NULL)
3387 return FAN (ret);
3388 else
3389 return NULL;
3390}
3391
3392/**
3393 * fan_proxy_new_sync:
3394 * @connection: A #GDBusConnection.
3395 * @flags: Flags from the #GDBusProxyFlags enumeration.
3396 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
3397 * @object_path: An object path.
3398 * @cancellable: (allow-none): A #GCancellable or %NULL.
3399 * @error: Return location for error or %NULL
3400 *
3401 * 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.
3402 *
3403 * The calling thread is blocked until a reply is received.
3404 *
3405 * See fan_proxy_new() for the asynchronous version of this constructor.
3406 *
3407 * Returns: (transfer full) (type FanProxy): The constructed proxy object or %NULL if @error is set.
3408 */
3409Fan *
3410fan_proxy_new_sync (
3411 GDBusConnection *connection,
3412 GDBusProxyFlags flags,
3413 const gchar *name,
3414 const gchar *object_path,
3415 GCancellable *cancellable,
3416 GError **error)
3417{
3418 GInitable *ret;
3419 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);
3420 if (ret != NULL)
3421 return FAN (ret);
3422 else
3423 return NULL;
3424}
3425
3426
3427/**
3428 * fan_proxy_new_for_bus:
3429 * @bus_type: A #GBusType.
3430 * @flags: Flags from the #GDBusProxyFlags enumeration.
3431 * @name: A bus name (well-known or unique).
3432 * @object_path: An object path.
3433 * @cancellable: (allow-none): A #GCancellable or %NULL.
3434 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
3435 * @user_data: User data to pass to @callback.
3436 *
3437 * Like fan_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
3438 *
3439 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
3440 * You can then call fan_proxy_new_for_bus_finish() to get the result of the operation.
3441 *
3442 * See fan_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
3443 */
3444void
3445fan_proxy_new_for_bus (
3446 GBusType bus_type,
3447 GDBusProxyFlags flags,
3448 const gchar *name,
3449 const gchar *object_path,
3450 GCancellable *cancellable,
3451 GAsyncReadyCallback callback,
3452 gpointer user_data)
3453{
3454 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);
3455}
3456
3457/**
3458 * fan_proxy_new_for_bus_finish:
3459 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_proxy_new_for_bus().
3460 * @error: Return location for error or %NULL
3461 *
3462 * Finishes an operation started with fan_proxy_new_for_bus().
3463 *
3464 * Returns: (transfer full) (type FanProxy): The constructed proxy object or %NULL if @error is set.
3465 */
3466Fan *
3467fan_proxy_new_for_bus_finish (
3468 GAsyncResult *res,
3469 GError **error)
3470{
3471 GObject *ret;
3472 GObject *source_object;
3473 source_object = g_async_result_get_source_object (res);
3474 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
3475 g_object_unref (source_object);
3476 if (ret != NULL)
3477 return FAN (ret);
3478 else
3479 return NULL;
3480}
3481
3482/**
3483 * fan_proxy_new_for_bus_sync:
3484 * @bus_type: A #GBusType.
3485 * @flags: Flags from the #GDBusProxyFlags enumeration.
3486 * @name: A bus name (well-known or unique).
3487 * @object_path: An object path.
3488 * @cancellable: (allow-none): A #GCancellable or %NULL.
3489 * @error: Return location for error or %NULL
3490 *
3491 * Like fan_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
3492 *
3493 * The calling thread is blocked until a reply is received.
3494 *
3495 * See fan_proxy_new_for_bus() for the asynchronous version of this constructor.
3496 *
3497 * Returns: (transfer full) (type FanProxy): The constructed proxy object or %NULL if @error is set.
3498 */
3499Fan *
3500fan_proxy_new_for_bus_sync (
3501 GBusType bus_type,
3502 GDBusProxyFlags flags,
3503 const gchar *name,
3504 const gchar *object_path,
3505 GCancellable *cancellable,
3506 GError **error)
3507{
3508 GInitable *ret;
3509 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);
3510 if (ret != NULL)
3511 return FAN (ret);
3512 else
3513 return NULL;
3514}
3515
3516
3517/* ------------------------------------------------------------------------ */
3518
3519/**
3520 * FanSkeleton:
3521 *
3522 * The #FanSkeleton structure contains only private data and should only be accessed using the provided API.
3523 */
3524
3525/**
3526 * FanSkeletonClass:
3527 * @parent_class: The parent class.
3528 *
3529 * Class structure for #FanSkeleton.
3530 */
3531
3532struct _FanSkeletonPrivate
3533{
3534 GValue *properties;
3535 GList *changed_properties;
3536 GSource *changed_properties_idle_source;
3537 GMainContext *context;
3538 GMutex lock;
3539};
3540
3541static void
3542_fan_skeleton_handle_method_call (
3543 GDBusConnection *connection G_GNUC_UNUSED,
3544 const gchar *sender G_GNUC_UNUSED,
3545 const gchar *object_path G_GNUC_UNUSED,
3546 const gchar *interface_name,
3547 const gchar *method_name,
3548 GVariant *parameters,
3549 GDBusMethodInvocation *invocation,
3550 gpointer user_data)
3551{
3552 FanSkeleton *skeleton = FAN_SKELETON (user_data);
3553 _ExtendedGDBusMethodInfo *info;
3554 GVariantIter iter;
3555 GVariant *child;
3556 GValue *paramv;
3557 guint num_params;
3558 guint num_extra;
3559 guint n;
3560 guint signal_id;
3561 GValue return_value = G_VALUE_INIT;
3562 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
3563 g_assert (info != NULL);
3564 num_params = g_variant_n_children (parameters);
3565 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
3566 n = 0;
3567 g_value_init (&paramv[n], TYPE_FAN);
3568 g_value_set_object (&paramv[n++], skeleton);
3569 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
3570 g_value_set_object (&paramv[n++], invocation);
3571 if (info->pass_fdlist)
3572 {
3573#ifdef G_OS_UNIX
3574 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
3575 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
3576#else
3577 g_assert_not_reached ();
3578#endif
3579 }
3580 g_variant_iter_init (&iter, parameters);
3581 while ((child = g_variant_iter_next_value (&iter)) != NULL)
3582 {
3583 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
3584 if (arg_info->use_gvariant)
3585 {
3586 g_value_init (&paramv[n], G_TYPE_VARIANT);
3587 g_value_set_variant (&paramv[n], child);
3588 n++;
3589 }
3590 else
3591 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
3592 g_variant_unref (child);
3593 }
3594 signal_id = g_signal_lookup (info->signal_name, TYPE_FAN);
3595 g_value_init (&return_value, G_TYPE_BOOLEAN);
3596 g_signal_emitv (paramv, signal_id, 0, &return_value);
3597 if (!g_value_get_boolean (&return_value))
3598 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);
3599 g_value_unset (&return_value);
3600 for (n = 0; n < num_params + num_extra; n++)
3601 g_value_unset (&paramv[n]);
3602 g_free (paramv);
3603}
3604
3605static GVariant *
3606_fan_skeleton_handle_get_property (
3607 GDBusConnection *connection G_GNUC_UNUSED,
3608 const gchar *sender G_GNUC_UNUSED,
3609 const gchar *object_path G_GNUC_UNUSED,
3610 const gchar *interface_name G_GNUC_UNUSED,
3611 const gchar *property_name,
3612 GError **error,
3613 gpointer user_data)
3614{
3615 FanSkeleton *skeleton = FAN_SKELETON (user_data);
3616 GValue value = G_VALUE_INIT;
3617 GParamSpec *pspec;
3618 _ExtendedGDBusPropertyInfo *info;
3619 GVariant *ret;
3620 ret = NULL;
3621 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, property_name);
3622 g_assert (info != NULL);
3623 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
3624 if (pspec == NULL)
3625 {
3626 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
3627 }
3628 else
3629 {
3630 g_value_init (&value, pspec->value_type);
3631 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
3632 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
3633 g_value_unset (&value);
3634 }
3635 return ret;
3636}
3637
3638static gboolean
3639_fan_skeleton_handle_set_property (
3640 GDBusConnection *connection G_GNUC_UNUSED,
3641 const gchar *sender G_GNUC_UNUSED,
3642 const gchar *object_path G_GNUC_UNUSED,
3643 const gchar *interface_name G_GNUC_UNUSED,
3644 const gchar *property_name,
3645 GVariant *variant,
3646 GError **error,
3647 gpointer user_data)
3648{
3649 FanSkeleton *skeleton = FAN_SKELETON (user_data);
3650 GValue value = G_VALUE_INIT;
3651 GParamSpec *pspec;
3652 _ExtendedGDBusPropertyInfo *info;
3653 gboolean ret;
3654 ret = FALSE;
3655 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, property_name);
3656 g_assert (info != NULL);
3657 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
3658 if (pspec == NULL)
3659 {
3660 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
3661 }
3662 else
3663 {
3664 if (info->use_gvariant)
3665 g_value_set_variant (&value, variant);
3666 else
3667 g_dbus_gvariant_to_gvalue (variant, &value);
3668 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
3669 g_value_unset (&value);
3670 ret = TRUE;
3671 }
3672 return ret;
3673}
3674
3675static const GDBusInterfaceVTable _fan_skeleton_vtable =
3676{
3677 _fan_skeleton_handle_method_call,
3678 _fan_skeleton_handle_get_property,
3679 _fan_skeleton_handle_set_property,
3680 {NULL}
3681};
3682
3683static GDBusInterfaceInfo *
3684fan_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
3685{
3686 return fan_interface_info ();
3687}
3688
3689static GDBusInterfaceVTable *
3690fan_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
3691{
3692 return (GDBusInterfaceVTable *) &_fan_skeleton_vtable;
3693}
3694
3695static GVariant *
3696fan_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
3697{
3698 FanSkeleton *skeleton = FAN_SKELETON (_skeleton);
3699
3700 GVariantBuilder builder;
3701 guint n;
3702 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
3703 if (_fan_interface_info.parent_struct.properties == NULL)
3704 goto out;
3705 for (n = 0; _fan_interface_info.parent_struct.properties[n] != NULL; n++)
3706 {
3707 GDBusPropertyInfo *info = _fan_interface_info.parent_struct.properties[n];
3708 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
3709 {
3710 GVariant *value;
3711 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);
3712 if (value != NULL)
3713 {
3714 g_variant_take_ref (value);
3715 g_variant_builder_add (&builder, "{sv}", info->name, value);
3716 g_variant_unref (value);
3717 }
3718 }
3719 }
3720out:
3721 return g_variant_builder_end (&builder);
3722}
3723
3724static gboolean _fan_emit_changed (gpointer user_data);
3725
3726static void
3727fan_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
3728{
3729 FanSkeleton *skeleton = FAN_SKELETON (_skeleton);
3730 gboolean emit_changed = FALSE;
3731
3732 g_mutex_lock (&skeleton->priv->lock);
3733 if (skeleton->priv->changed_properties_idle_source != NULL)
3734 {
3735 g_source_destroy (skeleton->priv->changed_properties_idle_source);
3736 skeleton->priv->changed_properties_idle_source = NULL;
3737 emit_changed = TRUE;
3738 }
3739 g_mutex_unlock (&skeleton->priv->lock);
3740
3741 if (emit_changed)
3742 _fan_emit_changed (skeleton);
3743}
3744
3745static void
3746_fan_on_signal_speed_changed (
3747 Fan *object,
3748 gint arg_speed)
3749{
3750 FanSkeleton *skeleton = FAN_SKELETON (object);
3751
3752 GList *connections, *l;
3753 GVariant *signal_variant;
3754 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
3755
3756 signal_variant = g_variant_ref_sink (g_variant_new ("(i)",
3757 arg_speed));
3758 for (l = connections; l != NULL; l = l->next)
3759 {
3760 GDBusConnection *connection = l->data;
3761 g_dbus_connection_emit_signal (connection,
3762 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Fan", "SpeedChanged",
3763 signal_variant, NULL);
3764 }
3765 g_variant_unref (signal_variant);
3766 g_list_free_full (connections, g_object_unref);
3767}
3768
3769static void
3770_fan_on_signal_tach_error (
3771 Fan *object)
3772{
3773 FanSkeleton *skeleton = FAN_SKELETON (object);
3774
3775 GList *connections, *l;
3776 GVariant *signal_variant;
3777 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
3778
3779 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
3780 for (l = connections; l != NULL; l = l->next)
3781 {
3782 GDBusConnection *connection = l->data;
3783 g_dbus_connection_emit_signal (connection,
3784 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Fan", "TachError",
3785 signal_variant, NULL);
3786 }
3787 g_variant_unref (signal_variant);
3788 g_list_free_full (connections, g_object_unref);
3789}
3790
3791static void fan_skeleton_iface_init (FanIface *iface);
3792#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
3793G_DEFINE_TYPE_WITH_CODE (FanSkeleton, fan_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
3794 G_ADD_PRIVATE (FanSkeleton)
3795 G_IMPLEMENT_INTERFACE (TYPE_FAN, fan_skeleton_iface_init));
3796
3797#else
3798G_DEFINE_TYPE_WITH_CODE (FanSkeleton, fan_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
3799 G_IMPLEMENT_INTERFACE (TYPE_FAN, fan_skeleton_iface_init));
3800
3801#endif
3802static void
3803fan_skeleton_finalize (GObject *object)
3804{
3805 FanSkeleton *skeleton = FAN_SKELETON (object);
3806 guint n;
3807 for (n = 0; n < 3; n++)
3808 g_value_unset (&skeleton->priv->properties[n]);
3809 g_free (skeleton->priv->properties);
3810 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
3811 if (skeleton->priv->changed_properties_idle_source != NULL)
3812 g_source_destroy (skeleton->priv->changed_properties_idle_source);
3813 g_main_context_unref (skeleton->priv->context);
3814 g_mutex_clear (&skeleton->priv->lock);
3815 G_OBJECT_CLASS (fan_skeleton_parent_class)->finalize (object);
3816}
3817
3818static void
3819fan_skeleton_get_property (GObject *object,
3820 guint prop_id,
3821 GValue *value,
3822 GParamSpec *pspec G_GNUC_UNUSED)
3823{
3824 FanSkeleton *skeleton = FAN_SKELETON (object);
3825 g_assert (prop_id != 0 && prop_id - 1 < 3);
3826 g_mutex_lock (&skeleton->priv->lock);
3827 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
3828 g_mutex_unlock (&skeleton->priv->lock);
3829}
3830
3831static gboolean
3832_fan_emit_changed (gpointer user_data)
3833{
3834 FanSkeleton *skeleton = FAN_SKELETON (user_data);
3835 GList *l;
3836 GVariantBuilder builder;
3837 GVariantBuilder invalidated_builder;
3838 guint num_changes;
3839
3840 g_mutex_lock (&skeleton->priv->lock);
3841 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
3842 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
3843 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
3844 {
3845 ChangedProperty *cp = l->data;
3846 GVariant *variant;
3847 const GValue *cur_value;
3848
3849 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
3850 if (!_g_value_equal (cur_value, &cp->orig_value))
3851 {
3852 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
3853 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
3854 g_variant_unref (variant);
3855 num_changes++;
3856 }
3857 }
3858 if (num_changes > 0)
3859 {
3860 GList *connections, *ll;
3861 GVariant *signal_variant;
3862 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Fan",
3863 &builder, &invalidated_builder));
3864 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
3865 for (ll = connections; ll != NULL; ll = ll->next)
3866 {
3867 GDBusConnection *connection = ll->data;
3868
3869 g_dbus_connection_emit_signal (connection,
3870 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
3871 "org.freedesktop.DBus.Properties",
3872 "PropertiesChanged",
3873 signal_variant,
3874 NULL);
3875 }
3876 g_variant_unref (signal_variant);
3877 g_list_free_full (connections, g_object_unref);
3878 }
3879 else
3880 {
3881 g_variant_builder_clear (&builder);
3882 g_variant_builder_clear (&invalidated_builder);
3883 }
3884 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
3885 skeleton->priv->changed_properties = NULL;
3886 skeleton->priv->changed_properties_idle_source = NULL;
3887 g_mutex_unlock (&skeleton->priv->lock);
3888 return FALSE;
3889}
3890
3891static void
3892_fan_schedule_emit_changed (FanSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
3893{
3894 ChangedProperty *cp;
3895 GList *l;
3896 cp = NULL;
3897 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
3898 {
3899 ChangedProperty *i_cp = l->data;
3900 if (i_cp->info == info)
3901 {
3902 cp = i_cp;
3903 break;
3904 }
3905 }
3906 if (cp == NULL)
3907 {
3908 cp = g_new0 (ChangedProperty, 1);
3909 cp->prop_id = prop_id;
3910 cp->info = info;
3911 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
3912 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
3913 g_value_copy (orig_value, &cp->orig_value);
3914 }
3915}
3916
3917static void
3918fan_skeleton_notify (GObject *object,
3919 GParamSpec *pspec G_GNUC_UNUSED)
3920{
3921 FanSkeleton *skeleton = FAN_SKELETON (object);
3922 g_mutex_lock (&skeleton->priv->lock);
3923 if (skeleton->priv->changed_properties != NULL &&
3924 skeleton->priv->changed_properties_idle_source == NULL)
3925 {
3926 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
3927 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
3928 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _fan_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
Adriana Kobylakfd778822016-06-16 09:08:37 -05003929 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _fan_emit_changed");
Norman James362a80f2015-09-14 14:04:39 -05003930 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
3931 g_source_unref (skeleton->priv->changed_properties_idle_source);
3932 }
3933 g_mutex_unlock (&skeleton->priv->lock);
3934}
3935
3936static void
3937fan_skeleton_set_property (GObject *object,
3938 guint prop_id,
3939 const GValue *value,
3940 GParamSpec *pspec)
3941{
3942 FanSkeleton *skeleton = FAN_SKELETON (object);
3943 g_assert (prop_id != 0 && prop_id - 1 < 3);
3944 g_mutex_lock (&skeleton->priv->lock);
3945 g_object_freeze_notify (object);
3946 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
3947 {
3948 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
3949 _fan_schedule_emit_changed (skeleton, _fan_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
3950 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
3951 g_object_notify_by_pspec (object, pspec);
3952 }
3953 g_mutex_unlock (&skeleton->priv->lock);
3954 g_object_thaw_notify (object);
3955}
3956
3957static void
3958fan_skeleton_init (FanSkeleton *skeleton)
3959{
3960#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
3961 skeleton->priv = fan_skeleton_get_instance_private (skeleton);
3962#else
3963 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_FAN_SKELETON, FanSkeletonPrivate);
3964#endif
3965
3966 g_mutex_init (&skeleton->priv->lock);
3967 skeleton->priv->context = g_main_context_ref_thread_default ();
3968 skeleton->priv->properties = g_new0 (GValue, 3);
3969 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
3970 g_value_init (&skeleton->priv->properties[1], G_TYPE_INT);
3971 g_value_init (&skeleton->priv->properties[2], G_TYPE_INT);
3972}
3973
3974static gint
3975fan_skeleton_get_speed (Fan *object)
3976{
3977 FanSkeleton *skeleton = FAN_SKELETON (object);
3978 gint value;
3979 g_mutex_lock (&skeleton->priv->lock);
3980 value = g_value_get_int (&(skeleton->priv->properties[0]));
3981 g_mutex_unlock (&skeleton->priv->lock);
3982 return value;
3983}
3984
3985static gint
3986fan_skeleton_get_cooling_zone (Fan *object)
3987{
3988 FanSkeleton *skeleton = FAN_SKELETON (object);
3989 gint value;
3990 g_mutex_lock (&skeleton->priv->lock);
3991 value = g_value_get_int (&(skeleton->priv->properties[1]));
3992 g_mutex_unlock (&skeleton->priv->lock);
3993 return value;
3994}
3995
3996static gint
3997fan_skeleton_get_pwm_num (Fan *object)
3998{
3999 FanSkeleton *skeleton = FAN_SKELETON (object);
4000 gint value;
4001 g_mutex_lock (&skeleton->priv->lock);
4002 value = g_value_get_int (&(skeleton->priv->properties[2]));
4003 g_mutex_unlock (&skeleton->priv->lock);
4004 return value;
4005}
4006
4007static void
4008fan_skeleton_class_init (FanSkeletonClass *klass)
4009{
4010 GObjectClass *gobject_class;
4011 GDBusInterfaceSkeletonClass *skeleton_class;
4012
4013 gobject_class = G_OBJECT_CLASS (klass);
4014 gobject_class->finalize = fan_skeleton_finalize;
4015 gobject_class->get_property = fan_skeleton_get_property;
4016 gobject_class->set_property = fan_skeleton_set_property;
4017 gobject_class->notify = fan_skeleton_notify;
4018
4019
4020 fan_override_properties (gobject_class, 1);
4021
4022 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
4023 skeleton_class->get_info = fan_skeleton_dbus_interface_get_info;
4024 skeleton_class->get_properties = fan_skeleton_dbus_interface_get_properties;
4025 skeleton_class->flush = fan_skeleton_dbus_interface_flush;
4026 skeleton_class->get_vtable = fan_skeleton_dbus_interface_get_vtable;
4027
4028#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
4029 g_type_class_add_private (klass, sizeof (FanSkeletonPrivate));
4030#endif
4031}
4032
4033static void
4034fan_skeleton_iface_init (FanIface *iface)
4035{
4036 iface->speed_changed = _fan_on_signal_speed_changed;
4037 iface->tach_error = _fan_on_signal_tach_error;
4038 iface->get_speed = fan_skeleton_get_speed;
4039 iface->get_cooling_zone = fan_skeleton_get_cooling_zone;
4040 iface->get_pwm_num = fan_skeleton_get_pwm_num;
4041}
4042
4043/**
4044 * fan_skeleton_new:
4045 *
4046 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link>.
4047 *
4048 * Returns: (transfer full) (type FanSkeleton): The skeleton object.
4049 */
4050Fan *
4051fan_skeleton_new (void)
4052{
4053 return FAN (g_object_new (TYPE_FAN_SKELETON, NULL));
4054}
4055
4056/* ------------------------------------------------------------------------
4057 * Code for interface org.openbmc.SensorValue
4058 * ------------------------------------------------------------------------
4059 */
4060
4061/**
4062 * SECTION:SensorValue
4063 * @title: SensorValue
4064 * @short_description: Generated C code for the org.openbmc.SensorValue D-Bus interface
4065 *
4066 * 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.
4067 */
4068
4069/* ---- Introspection data for org.openbmc.SensorValue ---- */
4070
4071static const _ExtendedGDBusMethodInfo _sensor_value_method_info_init =
4072{
4073 {
4074 -1,
4075 (gchar *) "init",
4076 NULL,
4077 NULL,
4078 NULL
4079 },
4080 "handle-init",
4081 FALSE
4082};
4083
4084static const _ExtendedGDBusArgInfo _sensor_value_method_info_get_value_OUT_ARG_value =
4085{
4086 {
4087 -1,
4088 (gchar *) "value",
4089 (gchar *) "v",
4090 NULL
4091 },
4092 FALSE
4093};
4094
4095static const _ExtendedGDBusArgInfo * const _sensor_value_method_info_get_value_OUT_ARG_pointers[] =
4096{
4097 &_sensor_value_method_info_get_value_OUT_ARG_value,
4098 NULL
4099};
4100
4101static const _ExtendedGDBusMethodInfo _sensor_value_method_info_get_value =
4102{
4103 {
4104 -1,
4105 (gchar *) "getValue",
4106 NULL,
4107 (GDBusArgInfo **) &_sensor_value_method_info_get_value_OUT_ARG_pointers,
4108 NULL
4109 },
4110 "handle-get-value",
4111 FALSE
4112};
4113
Norman James19e45912015-10-04 20:19:41 -05004114static const _ExtendedGDBusArgInfo _sensor_value_method_info_set_value_IN_ARG_value =
4115{
4116 {
4117 -1,
4118 (gchar *) "value",
4119 (gchar *) "v",
4120 NULL
4121 },
4122 FALSE
4123};
4124
4125static const _ExtendedGDBusArgInfo * const _sensor_value_method_info_set_value_IN_ARG_pointers[] =
4126{
4127 &_sensor_value_method_info_set_value_IN_ARG_value,
4128 NULL
4129};
4130
4131static const _ExtendedGDBusMethodInfo _sensor_value_method_info_set_value =
4132{
4133 {
4134 -1,
4135 (gchar *) "setValue",
4136 (GDBusArgInfo **) &_sensor_value_method_info_set_value_IN_ARG_pointers,
4137 NULL,
4138 NULL
4139 },
4140 "handle-set-value",
4141 FALSE
4142};
4143
Norman James362a80f2015-09-14 14:04:39 -05004144static const _ExtendedGDBusMethodInfo * const _sensor_value_method_info_pointers[] =
4145{
4146 &_sensor_value_method_info_init,
4147 &_sensor_value_method_info_get_value,
Norman James19e45912015-10-04 20:19:41 -05004148 &_sensor_value_method_info_set_value,
Norman James362a80f2015-09-14 14:04:39 -05004149 NULL
4150};
4151
4152static const _ExtendedGDBusArgInfo _sensor_value_signal_info_changed_ARG_value =
4153{
4154 {
4155 -1,
4156 (gchar *) "value",
4157 (gchar *) "v",
4158 NULL
4159 },
4160 FALSE
4161};
4162
4163static const _ExtendedGDBusArgInfo _sensor_value_signal_info_changed_ARG_units =
4164{
4165 {
4166 -1,
4167 (gchar *) "units",
4168 (gchar *) "s",
4169 NULL
4170 },
4171 FALSE
4172};
4173
4174static const _ExtendedGDBusArgInfo * const _sensor_value_signal_info_changed_ARG_pointers[] =
4175{
4176 &_sensor_value_signal_info_changed_ARG_value,
4177 &_sensor_value_signal_info_changed_ARG_units,
4178 NULL
4179};
4180
4181static const _ExtendedGDBusSignalInfo _sensor_value_signal_info_changed =
4182{
4183 {
4184 -1,
4185 (gchar *) "Changed",
4186 (GDBusArgInfo **) &_sensor_value_signal_info_changed_ARG_pointers,
4187 NULL
4188 },
4189 "changed"
4190};
4191
Norman James32e74e22015-09-15 21:28:06 -05004192static const _ExtendedGDBusSignalInfo _sensor_value_signal_info_error =
4193{
4194 {
4195 -1,
4196 (gchar *) "Error",
4197 NULL,
4198 NULL
4199 },
4200 "error"
4201};
4202
Norman James362a80f2015-09-14 14:04:39 -05004203static const _ExtendedGDBusArgInfo _sensor_value_signal_info_heartbeat_ARG_bus_name =
4204{
4205 {
4206 -1,
4207 (gchar *) "bus_name",
4208 (gchar *) "s",
4209 NULL
4210 },
4211 FALSE
4212};
4213
4214static const _ExtendedGDBusArgInfo * const _sensor_value_signal_info_heartbeat_ARG_pointers[] =
4215{
4216 &_sensor_value_signal_info_heartbeat_ARG_bus_name,
4217 NULL
4218};
4219
4220static const _ExtendedGDBusSignalInfo _sensor_value_signal_info_heartbeat =
4221{
4222 {
4223 -1,
4224 (gchar *) "Heartbeat",
4225 (GDBusArgInfo **) &_sensor_value_signal_info_heartbeat_ARG_pointers,
4226 NULL
4227 },
4228 "heartbeat"
4229};
4230
4231static const _ExtendedGDBusSignalInfo * const _sensor_value_signal_info_pointers[] =
4232{
4233 &_sensor_value_signal_info_changed,
Norman James32e74e22015-09-15 21:28:06 -05004234 &_sensor_value_signal_info_error,
Norman James362a80f2015-09-14 14:04:39 -05004235 &_sensor_value_signal_info_heartbeat,
4236 NULL
4237};
4238
4239static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_value =
4240{
4241 {
4242 -1,
4243 (gchar *) "value",
4244 (gchar *) "v",
4245 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
4246 NULL
4247 },
4248 "value",
4249 FALSE
4250};
4251
4252static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_units =
4253{
4254 {
4255 -1,
4256 (gchar *) "units",
4257 (gchar *) "s",
4258 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
4259 NULL
4260 },
4261 "units",
4262 FALSE
4263};
4264
4265static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_poll_interval =
4266{
4267 {
4268 -1,
4269 (gchar *) "poll_interval",
4270 (gchar *) "i",
4271 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
4272 NULL
4273 },
4274 "poll-interval",
4275 FALSE
4276};
4277
4278static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_heatbeat =
4279{
4280 {
4281 -1,
4282 (gchar *) "heatbeat",
4283 (gchar *) "i",
4284 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
4285 NULL
4286 },
4287 "heatbeat",
4288 FALSE
4289};
4290
4291static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_settable =
4292{
4293 {
4294 -1,
4295 (gchar *) "settable",
4296 (gchar *) "b",
4297 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
4298 NULL
4299 },
4300 "settable",
4301 FALSE
4302};
4303
Norman James362a80f2015-09-14 14:04:39 -05004304static const _ExtendedGDBusPropertyInfo * const _sensor_value_property_info_pointers[] =
4305{
4306 &_sensor_value_property_info_value,
4307 &_sensor_value_property_info_units,
4308 &_sensor_value_property_info_poll_interval,
4309 &_sensor_value_property_info_heatbeat,
4310 &_sensor_value_property_info_settable,
Norman James362a80f2015-09-14 14:04:39 -05004311 NULL
4312};
4313
4314static const _ExtendedGDBusInterfaceInfo _sensor_value_interface_info =
4315{
4316 {
4317 -1,
4318 (gchar *) "org.openbmc.SensorValue",
4319 (GDBusMethodInfo **) &_sensor_value_method_info_pointers,
4320 (GDBusSignalInfo **) &_sensor_value_signal_info_pointers,
4321 (GDBusPropertyInfo **) &_sensor_value_property_info_pointers,
4322 NULL
4323 },
4324 "sensor-value",
4325};
4326
4327
4328/**
4329 * sensor_value_interface_info:
4330 *
4331 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link> D-Bus interface.
4332 *
4333 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
4334 */
4335GDBusInterfaceInfo *
4336sensor_value_interface_info (void)
4337{
4338 return (GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct;
4339}
4340
4341/**
4342 * sensor_value_override_properties:
4343 * @klass: The class structure for a #GObject<!-- -->-derived class.
4344 * @property_id_begin: The property id to assign to the first overridden property.
4345 *
4346 * Overrides all #GObject properties in the #SensorValue interface for a concrete class.
4347 * The properties are overridden in the order they are defined.
4348 *
4349 * Returns: The last property id.
4350 */
4351guint
4352sensor_value_override_properties (GObjectClass *klass, guint property_id_begin)
4353{
4354 g_object_class_override_property (klass, property_id_begin++, "value");
4355 g_object_class_override_property (klass, property_id_begin++, "units");
4356 g_object_class_override_property (klass, property_id_begin++, "poll-interval");
4357 g_object_class_override_property (klass, property_id_begin++, "heatbeat");
4358 g_object_class_override_property (klass, property_id_begin++, "settable");
Norman James362a80f2015-09-14 14:04:39 -05004359 return property_id_begin - 1;
4360}
4361
4362
4363
4364/**
4365 * SensorValue:
4366 *
4367 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link>.
4368 */
4369
4370/**
4371 * SensorValueIface:
4372 * @parent_iface: The parent interface.
4373 * @handle_get_value: Handler for the #SensorValue::handle-get-value signal.
4374 * @handle_init: Handler for the #SensorValue::handle-init signal.
Norman James19e45912015-10-04 20:19:41 -05004375 * @handle_set_value: Handler for the #SensorValue::handle-set-value signal.
Norman James362a80f2015-09-14 14:04:39 -05004376 * @get_heatbeat: Getter for the #SensorValue:heatbeat property.
Norman James362a80f2015-09-14 14:04:39 -05004377 * @get_poll_interval: Getter for the #SensorValue:poll-interval property.
4378 * @get_settable: Getter for the #SensorValue:settable property.
4379 * @get_units: Getter for the #SensorValue:units property.
4380 * @get_value: Getter for the #SensorValue:value property.
4381 * @changed: Handler for the #SensorValue::changed signal.
Norman James32e74e22015-09-15 21:28:06 -05004382 * @error: Handler for the #SensorValue::error signal.
Norman James362a80f2015-09-14 14:04:39 -05004383 * @heartbeat: Handler for the #SensorValue::heartbeat signal.
4384 *
4385 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link>.
4386 */
4387
4388typedef SensorValueIface SensorValueInterface;
4389G_DEFINE_INTERFACE (SensorValue, sensor_value, G_TYPE_OBJECT);
4390
4391static void
4392sensor_value_default_init (SensorValueIface *iface)
4393{
4394 /* GObject signals for incoming D-Bus method calls: */
4395 /**
4396 * SensorValue::handle-init:
4397 * @object: A #SensorValue.
4398 * @invocation: A #GDBusMethodInvocation.
4399 *
4400 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorValue.init">init()</link> D-Bus method.
4401 *
4402 * 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.
4403 *
4404 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
4405 */
4406 g_signal_new ("handle-init",
4407 G_TYPE_FROM_INTERFACE (iface),
4408 G_SIGNAL_RUN_LAST,
4409 G_STRUCT_OFFSET (SensorValueIface, handle_init),
4410 g_signal_accumulator_true_handled,
4411 NULL,
4412 g_cclosure_marshal_generic,
4413 G_TYPE_BOOLEAN,
4414 1,
4415 G_TYPE_DBUS_METHOD_INVOCATION);
4416
4417 /**
4418 * SensorValue::handle-get-value:
4419 * @object: A #SensorValue.
4420 * @invocation: A #GDBusMethodInvocation.
4421 *
4422 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorValue.getValue">getValue()</link> D-Bus method.
4423 *
4424 * 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.
4425 *
4426 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
4427 */
4428 g_signal_new ("handle-get-value",
4429 G_TYPE_FROM_INTERFACE (iface),
4430 G_SIGNAL_RUN_LAST,
4431 G_STRUCT_OFFSET (SensorValueIface, handle_get_value),
4432 g_signal_accumulator_true_handled,
4433 NULL,
4434 g_cclosure_marshal_generic,
4435 G_TYPE_BOOLEAN,
4436 1,
4437 G_TYPE_DBUS_METHOD_INVOCATION);
4438
Norman James19e45912015-10-04 20:19:41 -05004439 /**
4440 * SensorValue::handle-set-value:
4441 * @object: A #SensorValue.
4442 * @invocation: A #GDBusMethodInvocation.
4443 * @arg_value: Argument passed by remote caller.
4444 *
4445 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorValue.setValue">setValue()</link> D-Bus method.
4446 *
4447 * 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.
4448 *
4449 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
4450 */
4451 g_signal_new ("handle-set-value",
4452 G_TYPE_FROM_INTERFACE (iface),
4453 G_SIGNAL_RUN_LAST,
4454 G_STRUCT_OFFSET (SensorValueIface, handle_set_value),
4455 g_signal_accumulator_true_handled,
4456 NULL,
4457 g_cclosure_marshal_generic,
4458 G_TYPE_BOOLEAN,
4459 2,
4460 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_VARIANT);
4461
Norman James362a80f2015-09-14 14:04:39 -05004462 /* GObject signals for received D-Bus signals: */
4463 /**
4464 * SensorValue::changed:
4465 * @object: A #SensorValue.
4466 * @arg_value: Argument.
4467 * @arg_units: Argument.
4468 *
4469 * 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.
4470 *
4471 * 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.
4472 */
4473 g_signal_new ("changed",
4474 G_TYPE_FROM_INTERFACE (iface),
4475 G_SIGNAL_RUN_LAST,
4476 G_STRUCT_OFFSET (SensorValueIface, changed),
4477 NULL,
4478 NULL,
4479 g_cclosure_marshal_generic,
4480 G_TYPE_NONE,
4481 2, G_TYPE_VARIANT, G_TYPE_STRING);
4482
4483 /**
Norman James32e74e22015-09-15 21:28:06 -05004484 * SensorValue::error:
4485 * @object: A #SensorValue.
4486 *
4487 * 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.
4488 *
4489 * 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.
4490 */
4491 g_signal_new ("error",
4492 G_TYPE_FROM_INTERFACE (iface),
4493 G_SIGNAL_RUN_LAST,
4494 G_STRUCT_OFFSET (SensorValueIface, error),
4495 NULL,
4496 NULL,
4497 g_cclosure_marshal_generic,
4498 G_TYPE_NONE,
4499 0);
4500
4501 /**
Norman James362a80f2015-09-14 14:04:39 -05004502 * SensorValue::heartbeat:
4503 * @object: A #SensorValue.
4504 * @arg_bus_name: Argument.
4505 *
4506 * 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.
4507 *
4508 * 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.
4509 */
4510 g_signal_new ("heartbeat",
4511 G_TYPE_FROM_INTERFACE (iface),
4512 G_SIGNAL_RUN_LAST,
4513 G_STRUCT_OFFSET (SensorValueIface, heartbeat),
4514 NULL,
4515 NULL,
4516 g_cclosure_marshal_generic,
4517 G_TYPE_NONE,
4518 1, G_TYPE_STRING);
4519
4520 /* GObject properties for D-Bus properties: */
4521 /**
4522 * SensorValue:value:
4523 *
4524 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link>.
4525 *
4526 * 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.
4527 */
4528 g_object_interface_install_property (iface,
4529 g_param_spec_variant ("value", "value", "value", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
4530 /**
4531 * SensorValue:units:
4532 *
4533 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link>.
4534 *
4535 * 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.
4536 */
4537 g_object_interface_install_property (iface,
4538 g_param_spec_string ("units", "units", "units", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
4539 /**
4540 * SensorValue:poll-interval:
4541 *
4542 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.poll_interval">"poll_interval"</link>.
4543 *
4544 * 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.
4545 */
4546 g_object_interface_install_property (iface,
4547 g_param_spec_int ("poll-interval", "poll_interval", "poll_interval", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
4548 /**
4549 * SensorValue:heatbeat:
4550 *
4551 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.heatbeat">"heatbeat"</link>.
4552 *
4553 * 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.
4554 */
4555 g_object_interface_install_property (iface,
4556 g_param_spec_int ("heatbeat", "heatbeat", "heatbeat", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
4557 /**
4558 * SensorValue:settable:
4559 *
4560 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.settable">"settable"</link>.
4561 *
4562 * 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.
4563 */
4564 g_object_interface_install_property (iface,
4565 g_param_spec_boolean ("settable", "settable", "settable", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Norman James362a80f2015-09-14 14:04:39 -05004566}
4567
4568/**
4569 * sensor_value_get_value: (skip)
4570 * @object: A #SensorValue.
4571 *
4572 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link> D-Bus property.
4573 *
4574 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4575 *
4576 * <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>
4577 *
4578 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
4579 */
4580GVariant *
4581sensor_value_get_value (SensorValue *object)
4582{
4583 return SENSOR_VALUE_GET_IFACE (object)->get_value (object);
4584}
4585
4586/**
4587 * sensor_value_dup_value: (skip)
4588 * @object: A #SensorValue.
4589 *
4590 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link> D-Bus property.
4591 *
4592 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4593 *
4594 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
4595 */
4596GVariant *
4597sensor_value_dup_value (SensorValue *object)
4598{
4599 GVariant *value;
4600 g_object_get (G_OBJECT (object), "value", &value, NULL);
4601 return value;
4602}
4603
4604/**
4605 * sensor_value_set_value: (skip)
4606 * @object: A #SensorValue.
4607 * @value: The value to set.
4608 *
4609 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link> D-Bus property to @value.
4610 *
4611 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
4612 */
4613void
4614sensor_value_set_value (SensorValue *object, GVariant *value)
4615{
4616 g_object_set (G_OBJECT (object), "value", value, NULL);
4617}
4618
4619/**
4620 * sensor_value_get_units: (skip)
4621 * @object: A #SensorValue.
4622 *
4623 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link> D-Bus property.
4624 *
4625 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4626 *
4627 * <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>
4628 *
4629 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
4630 */
4631const gchar *
4632sensor_value_get_units (SensorValue *object)
4633{
4634 return SENSOR_VALUE_GET_IFACE (object)->get_units (object);
4635}
4636
4637/**
4638 * sensor_value_dup_units: (skip)
4639 * @object: A #SensorValue.
4640 *
4641 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link> D-Bus property.
4642 *
4643 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4644 *
4645 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
4646 */
4647gchar *
4648sensor_value_dup_units (SensorValue *object)
4649{
4650 gchar *value;
4651 g_object_get (G_OBJECT (object), "units", &value, NULL);
4652 return value;
4653}
4654
4655/**
4656 * sensor_value_set_units: (skip)
4657 * @object: A #SensorValue.
4658 * @value: The value to set.
4659 *
4660 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link> D-Bus property to @value.
4661 *
4662 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
4663 */
4664void
4665sensor_value_set_units (SensorValue *object, const gchar *value)
4666{
4667 g_object_set (G_OBJECT (object), "units", value, NULL);
4668}
4669
4670/**
4671 * sensor_value_get_poll_interval: (skip)
4672 * @object: A #SensorValue.
4673 *
4674 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.poll_interval">"poll_interval"</link> D-Bus property.
4675 *
4676 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
4677 *
4678 * Returns: The property value.
4679 */
4680gint
4681sensor_value_get_poll_interval (SensorValue *object)
4682{
4683 return SENSOR_VALUE_GET_IFACE (object)->get_poll_interval (object);
4684}
4685
4686/**
4687 * sensor_value_set_poll_interval: (skip)
4688 * @object: A #SensorValue.
4689 * @value: The value to set.
4690 *
4691 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.poll_interval">"poll_interval"</link> D-Bus property to @value.
4692 *
4693 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
4694 */
4695void
4696sensor_value_set_poll_interval (SensorValue *object, gint value)
4697{
4698 g_object_set (G_OBJECT (object), "poll-interval", value, NULL);
4699}
4700
4701/**
4702 * sensor_value_get_heatbeat: (skip)
4703 * @object: A #SensorValue.
4704 *
4705 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.heatbeat">"heatbeat"</link> D-Bus property.
4706 *
4707 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4708 *
4709 * Returns: The property value.
4710 */
4711gint
4712sensor_value_get_heatbeat (SensorValue *object)
4713{
4714 return SENSOR_VALUE_GET_IFACE (object)->get_heatbeat (object);
4715}
4716
4717/**
4718 * sensor_value_set_heatbeat: (skip)
4719 * @object: A #SensorValue.
4720 * @value: The value to set.
4721 *
4722 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.heatbeat">"heatbeat"</link> D-Bus property to @value.
4723 *
4724 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
4725 */
4726void
4727sensor_value_set_heatbeat (SensorValue *object, gint value)
4728{
4729 g_object_set (G_OBJECT (object), "heatbeat", value, NULL);
4730}
4731
4732/**
4733 * sensor_value_get_settable: (skip)
4734 * @object: A #SensorValue.
4735 *
4736 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.settable">"settable"</link> D-Bus property.
4737 *
4738 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4739 *
4740 * Returns: The property value.
4741 */
4742gboolean
4743sensor_value_get_settable (SensorValue *object)
4744{
4745 return SENSOR_VALUE_GET_IFACE (object)->get_settable (object);
4746}
4747
4748/**
4749 * sensor_value_set_settable: (skip)
4750 * @object: A #SensorValue.
4751 * @value: The value to set.
4752 *
4753 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.settable">"settable"</link> D-Bus property to @value.
4754 *
4755 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
4756 */
4757void
4758sensor_value_set_settable (SensorValue *object, gboolean value)
4759{
4760 g_object_set (G_OBJECT (object), "settable", value, NULL);
4761}
4762
4763/**
Norman James362a80f2015-09-14 14:04:39 -05004764 * sensor_value_emit_changed:
4765 * @object: A #SensorValue.
4766 * @arg_value: Argument to pass with the signal.
4767 * @arg_units: Argument to pass with the signal.
4768 *
4769 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorValue.Changed">"Changed"</link> D-Bus signal.
4770 */
4771void
4772sensor_value_emit_changed (
4773 SensorValue *object,
4774 GVariant *arg_value,
4775 const gchar *arg_units)
4776{
4777 g_signal_emit_by_name (object, "changed", arg_value, arg_units);
4778}
4779
4780/**
Norman James32e74e22015-09-15 21:28:06 -05004781 * sensor_value_emit_error:
4782 * @object: A #SensorValue.
4783 *
4784 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorValue.Error">"Error"</link> D-Bus signal.
4785 */
4786void
4787sensor_value_emit_error (
4788 SensorValue *object)
4789{
4790 g_signal_emit_by_name (object, "error");
4791}
4792
4793/**
Norman James362a80f2015-09-14 14:04:39 -05004794 * sensor_value_emit_heartbeat:
4795 * @object: A #SensorValue.
4796 * @arg_bus_name: Argument to pass with the signal.
4797 *
4798 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorValue.Heartbeat">"Heartbeat"</link> D-Bus signal.
4799 */
4800void
4801sensor_value_emit_heartbeat (
4802 SensorValue *object,
4803 const gchar *arg_bus_name)
4804{
4805 g_signal_emit_by_name (object, "heartbeat", arg_bus_name);
4806}
4807
4808/**
4809 * sensor_value_call_init:
4810 * @proxy: A #SensorValueProxy.
4811 * @cancellable: (allow-none): A #GCancellable or %NULL.
4812 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
4813 * @user_data: User data to pass to @callback.
4814 *
4815 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorValue.init">init()</link> D-Bus method on @proxy.
4816 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
4817 * You can then call sensor_value_call_init_finish() to get the result of the operation.
4818 *
4819 * See sensor_value_call_init_sync() for the synchronous, blocking version of this method.
4820 */
4821void
4822sensor_value_call_init (
4823 SensorValue *proxy,
4824 GCancellable *cancellable,
4825 GAsyncReadyCallback callback,
4826 gpointer user_data)
4827{
4828 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
4829 "init",
4830 g_variant_new ("()"),
4831 G_DBUS_CALL_FLAGS_NONE,
4832 -1,
4833 cancellable,
4834 callback,
4835 user_data);
4836}
4837
4838/**
4839 * sensor_value_call_init_finish:
4840 * @proxy: A #SensorValueProxy.
4841 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_call_init().
4842 * @error: Return location for error or %NULL.
4843 *
4844 * Finishes an operation started with sensor_value_call_init().
4845 *
4846 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
4847 */
4848gboolean
4849sensor_value_call_init_finish (
4850 SensorValue *proxy,
4851 GAsyncResult *res,
4852 GError **error)
4853{
4854 GVariant *_ret;
4855 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
4856 if (_ret == NULL)
4857 goto _out;
4858 g_variant_get (_ret,
4859 "()");
4860 g_variant_unref (_ret);
4861_out:
4862 return _ret != NULL;
4863}
4864
4865/**
4866 * sensor_value_call_init_sync:
4867 * @proxy: A #SensorValueProxy.
4868 * @cancellable: (allow-none): A #GCancellable or %NULL.
4869 * @error: Return location for error or %NULL.
4870 *
4871 * 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.
4872 *
4873 * See sensor_value_call_init() for the asynchronous version of this method.
4874 *
4875 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
4876 */
4877gboolean
4878sensor_value_call_init_sync (
4879 SensorValue *proxy,
4880 GCancellable *cancellable,
4881 GError **error)
4882{
4883 GVariant *_ret;
4884 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
4885 "init",
4886 g_variant_new ("()"),
4887 G_DBUS_CALL_FLAGS_NONE,
4888 -1,
4889 cancellable,
4890 error);
4891 if (_ret == NULL)
4892 goto _out;
4893 g_variant_get (_ret,
4894 "()");
4895 g_variant_unref (_ret);
4896_out:
4897 return _ret != NULL;
4898}
4899
4900/**
4901 * sensor_value_call_get_value:
4902 * @proxy: A #SensorValueProxy.
4903 * @cancellable: (allow-none): A #GCancellable or %NULL.
4904 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
4905 * @user_data: User data to pass to @callback.
4906 *
4907 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorValue.getValue">getValue()</link> D-Bus method on @proxy.
4908 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
4909 * You can then call sensor_value_call_get_value_finish() to get the result of the operation.
4910 *
4911 * See sensor_value_call_get_value_sync() for the synchronous, blocking version of this method.
4912 */
4913void
4914sensor_value_call_get_value (
4915 SensorValue *proxy,
4916 GCancellable *cancellable,
4917 GAsyncReadyCallback callback,
4918 gpointer user_data)
4919{
4920 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
4921 "getValue",
4922 g_variant_new ("()"),
4923 G_DBUS_CALL_FLAGS_NONE,
4924 -1,
4925 cancellable,
4926 callback,
4927 user_data);
4928}
4929
4930/**
4931 * sensor_value_call_get_value_finish:
4932 * @proxy: A #SensorValueProxy.
4933 * @out_value: (out): Return location for return parameter or %NULL to ignore.
4934 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_call_get_value().
4935 * @error: Return location for error or %NULL.
4936 *
4937 * Finishes an operation started with sensor_value_call_get_value().
4938 *
4939 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
4940 */
4941gboolean
4942sensor_value_call_get_value_finish (
4943 SensorValue *proxy,
4944 GVariant **out_value,
4945 GAsyncResult *res,
4946 GError **error)
4947{
4948 GVariant *_ret;
4949 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
4950 if (_ret == NULL)
4951 goto _out;
4952 g_variant_get (_ret,
4953 "(@v)",
4954 out_value);
4955 g_variant_unref (_ret);
4956_out:
4957 return _ret != NULL;
4958}
4959
4960/**
4961 * sensor_value_call_get_value_sync:
4962 * @proxy: A #SensorValueProxy.
4963 * @out_value: (out): Return location for return parameter or %NULL to ignore.
4964 * @cancellable: (allow-none): A #GCancellable or %NULL.
4965 * @error: Return location for error or %NULL.
4966 *
4967 * 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.
4968 *
4969 * See sensor_value_call_get_value() for the asynchronous version of this method.
4970 *
4971 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
4972 */
4973gboolean
4974sensor_value_call_get_value_sync (
4975 SensorValue *proxy,
4976 GVariant **out_value,
4977 GCancellable *cancellable,
4978 GError **error)
4979{
4980 GVariant *_ret;
4981 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
4982 "getValue",
4983 g_variant_new ("()"),
4984 G_DBUS_CALL_FLAGS_NONE,
4985 -1,
4986 cancellable,
4987 error);
4988 if (_ret == NULL)
4989 goto _out;
4990 g_variant_get (_ret,
4991 "(@v)",
4992 out_value);
4993 g_variant_unref (_ret);
4994_out:
4995 return _ret != NULL;
4996}
4997
4998/**
Norman James19e45912015-10-04 20:19:41 -05004999 * sensor_value_call_set_value:
5000 * @proxy: A #SensorValueProxy.
5001 * @arg_value: Argument to pass with the method invocation.
5002 * @cancellable: (allow-none): A #GCancellable or %NULL.
5003 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
5004 * @user_data: User data to pass to @callback.
5005 *
5006 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorValue.setValue">setValue()</link> D-Bus method on @proxy.
5007 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
5008 * You can then call sensor_value_call_set_value_finish() to get the result of the operation.
5009 *
5010 * See sensor_value_call_set_value_sync() for the synchronous, blocking version of this method.
5011 */
5012void
5013sensor_value_call_set_value (
5014 SensorValue *proxy,
5015 GVariant *arg_value,
5016 GCancellable *cancellable,
5017 GAsyncReadyCallback callback,
5018 gpointer user_data)
5019{
5020 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
5021 "setValue",
5022 g_variant_new ("(@v)",
5023 arg_value),
5024 G_DBUS_CALL_FLAGS_NONE,
5025 -1,
5026 cancellable,
5027 callback,
5028 user_data);
5029}
5030
5031/**
5032 * sensor_value_call_set_value_finish:
5033 * @proxy: A #SensorValueProxy.
5034 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_call_set_value().
5035 * @error: Return location for error or %NULL.
5036 *
5037 * Finishes an operation started with sensor_value_call_set_value().
5038 *
5039 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
5040 */
5041gboolean
5042sensor_value_call_set_value_finish (
5043 SensorValue *proxy,
5044 GAsyncResult *res,
5045 GError **error)
5046{
5047 GVariant *_ret;
5048 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
5049 if (_ret == NULL)
5050 goto _out;
5051 g_variant_get (_ret,
5052 "()");
5053 g_variant_unref (_ret);
5054_out:
5055 return _ret != NULL;
5056}
5057
5058/**
5059 * sensor_value_call_set_value_sync:
5060 * @proxy: A #SensorValueProxy.
5061 * @arg_value: Argument to pass with the method invocation.
5062 * @cancellable: (allow-none): A #GCancellable or %NULL.
5063 * @error: Return location for error or %NULL.
5064 *
5065 * 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.
5066 *
5067 * See sensor_value_call_set_value() for the asynchronous version of this method.
5068 *
5069 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
5070 */
5071gboolean
5072sensor_value_call_set_value_sync (
5073 SensorValue *proxy,
5074 GVariant *arg_value,
5075 GCancellable *cancellable,
5076 GError **error)
5077{
5078 GVariant *_ret;
5079 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
5080 "setValue",
5081 g_variant_new ("(@v)",
5082 arg_value),
5083 G_DBUS_CALL_FLAGS_NONE,
5084 -1,
5085 cancellable,
5086 error);
5087 if (_ret == NULL)
5088 goto _out;
5089 g_variant_get (_ret,
5090 "()");
5091 g_variant_unref (_ret);
5092_out:
5093 return _ret != NULL;
5094}
5095
5096/**
Norman James362a80f2015-09-14 14:04:39 -05005097 * sensor_value_complete_init:
5098 * @object: A #SensorValue.
5099 * @invocation: (transfer full): A #GDBusMethodInvocation.
5100 *
5101 * 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.
5102 *
5103 * This method will free @invocation, you cannot use it afterwards.
5104 */
5105void
5106sensor_value_complete_init (
5107 SensorValue *object,
5108 GDBusMethodInvocation *invocation)
5109{
5110 g_dbus_method_invocation_return_value (invocation,
5111 g_variant_new ("()"));
5112}
5113
5114/**
5115 * sensor_value_complete_get_value:
5116 * @object: A #SensorValue.
5117 * @invocation: (transfer full): A #GDBusMethodInvocation.
5118 * @value: Parameter to return.
5119 *
5120 * 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.
5121 *
5122 * This method will free @invocation, you cannot use it afterwards.
5123 */
5124void
5125sensor_value_complete_get_value (
5126 SensorValue *object,
5127 GDBusMethodInvocation *invocation,
5128 GVariant *value)
5129{
5130 g_dbus_method_invocation_return_value (invocation,
5131 g_variant_new ("(@v)",
5132 value));
5133}
5134
Norman James19e45912015-10-04 20:19:41 -05005135/**
5136 * sensor_value_complete_set_value:
5137 * @object: A #SensorValue.
5138 * @invocation: (transfer full): A #GDBusMethodInvocation.
5139 *
5140 * 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.
5141 *
5142 * This method will free @invocation, you cannot use it afterwards.
5143 */
5144void
5145sensor_value_complete_set_value (
5146 SensorValue *object,
5147 GDBusMethodInvocation *invocation)
5148{
5149 g_dbus_method_invocation_return_value (invocation,
5150 g_variant_new ("()"));
5151}
5152
Norman James362a80f2015-09-14 14:04:39 -05005153/* ------------------------------------------------------------------------ */
5154
5155/**
5156 * SensorValueProxy:
5157 *
5158 * The #SensorValueProxy structure contains only private data and should only be accessed using the provided API.
5159 */
5160
5161/**
5162 * SensorValueProxyClass:
5163 * @parent_class: The parent class.
5164 *
5165 * Class structure for #SensorValueProxy.
5166 */
5167
5168struct _SensorValueProxyPrivate
5169{
5170 GData *qdata;
5171};
5172
5173static void sensor_value_proxy_iface_init (SensorValueIface *iface);
5174
5175#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
5176G_DEFINE_TYPE_WITH_CODE (SensorValueProxy, sensor_value_proxy, G_TYPE_DBUS_PROXY,
5177 G_ADD_PRIVATE (SensorValueProxy)
5178 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_proxy_iface_init));
5179
5180#else
5181G_DEFINE_TYPE_WITH_CODE (SensorValueProxy, sensor_value_proxy, G_TYPE_DBUS_PROXY,
5182 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_proxy_iface_init));
5183
5184#endif
5185static void
5186sensor_value_proxy_finalize (GObject *object)
5187{
5188 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
5189 g_datalist_clear (&proxy->priv->qdata);
5190 G_OBJECT_CLASS (sensor_value_proxy_parent_class)->finalize (object);
5191}
5192
5193static void
5194sensor_value_proxy_get_property (GObject *object,
5195 guint prop_id,
5196 GValue *value,
5197 GParamSpec *pspec G_GNUC_UNUSED)
5198{
5199 const _ExtendedGDBusPropertyInfo *info;
5200 GVariant *variant;
Norman Jamesdfdaca92015-09-27 22:11:15 -05005201 g_assert (prop_id != 0 && prop_id - 1 < 5);
Norman James362a80f2015-09-14 14:04:39 -05005202 info = _sensor_value_property_info_pointers[prop_id - 1];
5203 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
5204 if (info->use_gvariant)
5205 {
5206 g_value_set_variant (value, variant);
5207 }
5208 else
5209 {
5210 if (variant != NULL)
5211 g_dbus_gvariant_to_gvalue (variant, value);
5212 }
5213 if (variant != NULL)
5214 g_variant_unref (variant);
5215}
5216
5217static void
5218sensor_value_proxy_set_property_cb (GDBusProxy *proxy,
5219 GAsyncResult *res,
5220 gpointer user_data)
5221{
5222 const _ExtendedGDBusPropertyInfo *info = user_data;
5223 GError *error;
5224 GVariant *_ret;
5225 error = NULL;
5226 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
5227 if (!_ret)
5228 {
5229 g_warning ("Error setting property '%s' on interface org.openbmc.SensorValue: %s (%s, %d)",
5230 info->parent_struct.name,
5231 error->message, g_quark_to_string (error->domain), error->code);
5232 g_error_free (error);
5233 }
5234 else
5235 {
5236 g_variant_unref (_ret);
5237 }
5238}
5239
5240static void
5241sensor_value_proxy_set_property (GObject *object,
5242 guint prop_id,
5243 const GValue *value,
5244 GParamSpec *pspec G_GNUC_UNUSED)
5245{
5246 const _ExtendedGDBusPropertyInfo *info;
5247 GVariant *variant;
Norman Jamesdfdaca92015-09-27 22:11:15 -05005248 g_assert (prop_id != 0 && prop_id - 1 < 5);
Norman James362a80f2015-09-14 14:04:39 -05005249 info = _sensor_value_property_info_pointers[prop_id - 1];
5250 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
5251 g_dbus_proxy_call (G_DBUS_PROXY (object),
5252 "org.freedesktop.DBus.Properties.Set",
5253 g_variant_new ("(ssv)", "org.openbmc.SensorValue", info->parent_struct.name, variant),
5254 G_DBUS_CALL_FLAGS_NONE,
5255 -1,
5256 NULL, (GAsyncReadyCallback) sensor_value_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
5257 g_variant_unref (variant);
5258}
5259
5260static void
5261sensor_value_proxy_g_signal (GDBusProxy *proxy,
5262 const gchar *sender_name G_GNUC_UNUSED,
5263 const gchar *signal_name,
5264 GVariant *parameters)
5265{
5266 _ExtendedGDBusSignalInfo *info;
5267 GVariantIter iter;
5268 GVariant *child;
5269 GValue *paramv;
5270 guint num_params;
5271 guint n;
5272 guint signal_id;
5273 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, signal_name);
5274 if (info == NULL)
5275 return;
5276 num_params = g_variant_n_children (parameters);
5277 paramv = g_new0 (GValue, num_params + 1);
5278 g_value_init (&paramv[0], TYPE_SENSOR_VALUE);
5279 g_value_set_object (&paramv[0], proxy);
5280 g_variant_iter_init (&iter, parameters);
5281 n = 1;
5282 while ((child = g_variant_iter_next_value (&iter)) != NULL)
5283 {
5284 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
5285 if (arg_info->use_gvariant)
5286 {
5287 g_value_init (&paramv[n], G_TYPE_VARIANT);
5288 g_value_set_variant (&paramv[n], child);
5289 n++;
5290 }
5291 else
5292 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
5293 g_variant_unref (child);
5294 }
5295 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_VALUE);
5296 g_signal_emitv (paramv, signal_id, 0, NULL);
5297 for (n = 0; n < num_params + 1; n++)
5298 g_value_unset (&paramv[n]);
5299 g_free (paramv);
5300}
5301
5302static void
5303sensor_value_proxy_g_properties_changed (GDBusProxy *_proxy,
5304 GVariant *changed_properties,
5305 const gchar *const *invalidated_properties)
5306{
5307 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (_proxy);
5308 guint n;
5309 const gchar *key;
5310 GVariantIter *iter;
5311 _ExtendedGDBusPropertyInfo *info;
5312 g_variant_get (changed_properties, "a{sv}", &iter);
5313 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
5314 {
5315 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, key);
5316 g_datalist_remove_data (&proxy->priv->qdata, key);
5317 if (info != NULL)
5318 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
5319 }
5320 g_variant_iter_free (iter);
5321 for (n = 0; invalidated_properties[n] != NULL; n++)
5322 {
5323 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, invalidated_properties[n]);
5324 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
5325 if (info != NULL)
5326 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
5327 }
5328}
5329
5330static GVariant *
5331sensor_value_proxy_get_value (SensorValue *object)
5332{
5333 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
5334 GVariant *variant;
5335 GVariant *value = NULL;
5336 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "value");
5337 value = variant;
5338 if (variant != NULL)
5339 g_variant_unref (variant);
5340 return value;
5341}
5342
5343static const gchar *
5344sensor_value_proxy_get_units (SensorValue *object)
5345{
5346 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
5347 GVariant *variant;
5348 const gchar *value = NULL;
5349 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "units");
5350 if (variant != NULL)
5351 {
5352 value = g_variant_get_string (variant, NULL);
5353 g_variant_unref (variant);
5354 }
5355 return value;
5356}
5357
5358static gint
5359sensor_value_proxy_get_poll_interval (SensorValue *object)
5360{
5361 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
5362 GVariant *variant;
5363 gint value = 0;
5364 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "poll_interval");
5365 if (variant != NULL)
5366 {
5367 value = g_variant_get_int32 (variant);
5368 g_variant_unref (variant);
5369 }
5370 return value;
5371}
5372
5373static gint
5374sensor_value_proxy_get_heatbeat (SensorValue *object)
5375{
5376 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
5377 GVariant *variant;
5378 gint value = 0;
5379 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "heatbeat");
5380 if (variant != NULL)
5381 {
5382 value = g_variant_get_int32 (variant);
5383 g_variant_unref (variant);
5384 }
5385 return value;
5386}
5387
5388static gboolean
5389sensor_value_proxy_get_settable (SensorValue *object)
5390{
5391 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
5392 GVariant *variant;
5393 gboolean value = 0;
5394 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "settable");
5395 if (variant != NULL)
5396 {
5397 value = g_variant_get_boolean (variant);
5398 g_variant_unref (variant);
5399 }
5400 return value;
5401}
5402
Norman James362a80f2015-09-14 14:04:39 -05005403static void
5404sensor_value_proxy_init (SensorValueProxy *proxy)
5405{
5406#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
5407 proxy->priv = sensor_value_proxy_get_instance_private (proxy);
5408#else
5409 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_VALUE_PROXY, SensorValueProxyPrivate);
5410#endif
5411
5412 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_value_interface_info ());
5413}
5414
5415static void
5416sensor_value_proxy_class_init (SensorValueProxyClass *klass)
5417{
5418 GObjectClass *gobject_class;
5419 GDBusProxyClass *proxy_class;
5420
5421 gobject_class = G_OBJECT_CLASS (klass);
5422 gobject_class->finalize = sensor_value_proxy_finalize;
5423 gobject_class->get_property = sensor_value_proxy_get_property;
5424 gobject_class->set_property = sensor_value_proxy_set_property;
5425
5426 proxy_class = G_DBUS_PROXY_CLASS (klass);
5427 proxy_class->g_signal = sensor_value_proxy_g_signal;
5428 proxy_class->g_properties_changed = sensor_value_proxy_g_properties_changed;
5429
5430 sensor_value_override_properties (gobject_class, 1);
5431
5432#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
5433 g_type_class_add_private (klass, sizeof (SensorValueProxyPrivate));
5434#endif
5435}
5436
5437static void
5438sensor_value_proxy_iface_init (SensorValueIface *iface)
5439{
5440 iface->get_value = sensor_value_proxy_get_value;
5441 iface->get_units = sensor_value_proxy_get_units;
5442 iface->get_poll_interval = sensor_value_proxy_get_poll_interval;
5443 iface->get_heatbeat = sensor_value_proxy_get_heatbeat;
5444 iface->get_settable = sensor_value_proxy_get_settable;
Norman James362a80f2015-09-14 14:04:39 -05005445}
5446
5447/**
5448 * sensor_value_proxy_new:
5449 * @connection: A #GDBusConnection.
5450 * @flags: Flags from the #GDBusProxyFlags enumeration.
5451 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
5452 * @object_path: An object path.
5453 * @cancellable: (allow-none): A #GCancellable or %NULL.
5454 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
5455 * @user_data: User data to pass to @callback.
5456 *
5457 * 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.
5458 *
5459 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
5460 * You can then call sensor_value_proxy_new_finish() to get the result of the operation.
5461 *
5462 * See sensor_value_proxy_new_sync() for the synchronous, blocking version of this constructor.
5463 */
5464void
5465sensor_value_proxy_new (
5466 GDBusConnection *connection,
5467 GDBusProxyFlags flags,
5468 const gchar *name,
5469 const gchar *object_path,
5470 GCancellable *cancellable,
5471 GAsyncReadyCallback callback,
5472 gpointer user_data)
5473{
5474 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);
5475}
5476
5477/**
5478 * sensor_value_proxy_new_finish:
5479 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_proxy_new().
5480 * @error: Return location for error or %NULL
5481 *
5482 * Finishes an operation started with sensor_value_proxy_new().
5483 *
5484 * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set.
5485 */
5486SensorValue *
5487sensor_value_proxy_new_finish (
5488 GAsyncResult *res,
5489 GError **error)
5490{
5491 GObject *ret;
5492 GObject *source_object;
5493 source_object = g_async_result_get_source_object (res);
5494 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
5495 g_object_unref (source_object);
5496 if (ret != NULL)
5497 return SENSOR_VALUE (ret);
5498 else
5499 return NULL;
5500}
5501
5502/**
5503 * sensor_value_proxy_new_sync:
5504 * @connection: A #GDBusConnection.
5505 * @flags: Flags from the #GDBusProxyFlags enumeration.
5506 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
5507 * @object_path: An object path.
5508 * @cancellable: (allow-none): A #GCancellable or %NULL.
5509 * @error: Return location for error or %NULL
5510 *
5511 * 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.
5512 *
5513 * The calling thread is blocked until a reply is received.
5514 *
5515 * See sensor_value_proxy_new() for the asynchronous version of this constructor.
5516 *
5517 * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set.
5518 */
5519SensorValue *
5520sensor_value_proxy_new_sync (
5521 GDBusConnection *connection,
5522 GDBusProxyFlags flags,
5523 const gchar *name,
5524 const gchar *object_path,
5525 GCancellable *cancellable,
5526 GError **error)
5527{
5528 GInitable *ret;
5529 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);
5530 if (ret != NULL)
5531 return SENSOR_VALUE (ret);
5532 else
5533 return NULL;
5534}
5535
5536
5537/**
5538 * sensor_value_proxy_new_for_bus:
5539 * @bus_type: A #GBusType.
5540 * @flags: Flags from the #GDBusProxyFlags enumeration.
5541 * @name: A bus name (well-known or unique).
5542 * @object_path: An object path.
5543 * @cancellable: (allow-none): A #GCancellable or %NULL.
5544 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
5545 * @user_data: User data to pass to @callback.
5546 *
5547 * Like sensor_value_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
5548 *
5549 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
5550 * You can then call sensor_value_proxy_new_for_bus_finish() to get the result of the operation.
5551 *
5552 * See sensor_value_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
5553 */
5554void
5555sensor_value_proxy_new_for_bus (
5556 GBusType bus_type,
5557 GDBusProxyFlags flags,
5558 const gchar *name,
5559 const gchar *object_path,
5560 GCancellable *cancellable,
5561 GAsyncReadyCallback callback,
5562 gpointer user_data)
5563{
5564 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);
5565}
5566
5567/**
5568 * sensor_value_proxy_new_for_bus_finish:
5569 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_proxy_new_for_bus().
5570 * @error: Return location for error or %NULL
5571 *
5572 * Finishes an operation started with sensor_value_proxy_new_for_bus().
5573 *
5574 * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set.
5575 */
5576SensorValue *
5577sensor_value_proxy_new_for_bus_finish (
5578 GAsyncResult *res,
5579 GError **error)
5580{
5581 GObject *ret;
5582 GObject *source_object;
5583 source_object = g_async_result_get_source_object (res);
5584 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
5585 g_object_unref (source_object);
5586 if (ret != NULL)
5587 return SENSOR_VALUE (ret);
5588 else
5589 return NULL;
5590}
5591
5592/**
5593 * sensor_value_proxy_new_for_bus_sync:
5594 * @bus_type: A #GBusType.
5595 * @flags: Flags from the #GDBusProxyFlags enumeration.
5596 * @name: A bus name (well-known or unique).
5597 * @object_path: An object path.
5598 * @cancellable: (allow-none): A #GCancellable or %NULL.
5599 * @error: Return location for error or %NULL
5600 *
5601 * Like sensor_value_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
5602 *
5603 * The calling thread is blocked until a reply is received.
5604 *
5605 * See sensor_value_proxy_new_for_bus() for the asynchronous version of this constructor.
5606 *
5607 * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set.
5608 */
5609SensorValue *
5610sensor_value_proxy_new_for_bus_sync (
5611 GBusType bus_type,
5612 GDBusProxyFlags flags,
5613 const gchar *name,
5614 const gchar *object_path,
5615 GCancellable *cancellable,
5616 GError **error)
5617{
5618 GInitable *ret;
5619 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);
5620 if (ret != NULL)
5621 return SENSOR_VALUE (ret);
5622 else
5623 return NULL;
5624}
5625
5626
5627/* ------------------------------------------------------------------------ */
5628
5629/**
5630 * SensorValueSkeleton:
5631 *
5632 * The #SensorValueSkeleton structure contains only private data and should only be accessed using the provided API.
5633 */
5634
5635/**
5636 * SensorValueSkeletonClass:
5637 * @parent_class: The parent class.
5638 *
5639 * Class structure for #SensorValueSkeleton.
5640 */
5641
5642struct _SensorValueSkeletonPrivate
5643{
5644 GValue *properties;
5645 GList *changed_properties;
5646 GSource *changed_properties_idle_source;
5647 GMainContext *context;
5648 GMutex lock;
5649};
5650
5651static void
5652_sensor_value_skeleton_handle_method_call (
5653 GDBusConnection *connection G_GNUC_UNUSED,
5654 const gchar *sender G_GNUC_UNUSED,
5655 const gchar *object_path G_GNUC_UNUSED,
5656 const gchar *interface_name,
5657 const gchar *method_name,
5658 GVariant *parameters,
5659 GDBusMethodInvocation *invocation,
5660 gpointer user_data)
5661{
5662 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data);
5663 _ExtendedGDBusMethodInfo *info;
5664 GVariantIter iter;
5665 GVariant *child;
5666 GValue *paramv;
5667 guint num_params;
5668 guint num_extra;
5669 guint n;
5670 guint signal_id;
5671 GValue return_value = G_VALUE_INIT;
5672 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
5673 g_assert (info != NULL);
5674 num_params = g_variant_n_children (parameters);
5675 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
5676 n = 0;
5677 g_value_init (&paramv[n], TYPE_SENSOR_VALUE);
5678 g_value_set_object (&paramv[n++], skeleton);
5679 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
5680 g_value_set_object (&paramv[n++], invocation);
5681 if (info->pass_fdlist)
5682 {
5683#ifdef G_OS_UNIX
5684 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
5685 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
5686#else
5687 g_assert_not_reached ();
5688#endif
5689 }
5690 g_variant_iter_init (&iter, parameters);
5691 while ((child = g_variant_iter_next_value (&iter)) != NULL)
5692 {
5693 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
5694 if (arg_info->use_gvariant)
5695 {
5696 g_value_init (&paramv[n], G_TYPE_VARIANT);
5697 g_value_set_variant (&paramv[n], child);
5698 n++;
5699 }
5700 else
5701 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
5702 g_variant_unref (child);
5703 }
5704 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_VALUE);
5705 g_value_init (&return_value, G_TYPE_BOOLEAN);
5706 g_signal_emitv (paramv, signal_id, 0, &return_value);
5707 if (!g_value_get_boolean (&return_value))
5708 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);
5709 g_value_unset (&return_value);
5710 for (n = 0; n < num_params + num_extra; n++)
5711 g_value_unset (&paramv[n]);
5712 g_free (paramv);
5713}
5714
5715static GVariant *
5716_sensor_value_skeleton_handle_get_property (
5717 GDBusConnection *connection G_GNUC_UNUSED,
5718 const gchar *sender G_GNUC_UNUSED,
5719 const gchar *object_path G_GNUC_UNUSED,
5720 const gchar *interface_name G_GNUC_UNUSED,
5721 const gchar *property_name,
5722 GError **error,
5723 gpointer user_data)
5724{
5725 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data);
5726 GValue value = G_VALUE_INIT;
5727 GParamSpec *pspec;
5728 _ExtendedGDBusPropertyInfo *info;
5729 GVariant *ret;
5730 ret = NULL;
5731 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, property_name);
5732 g_assert (info != NULL);
5733 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
5734 if (pspec == NULL)
5735 {
5736 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
5737 }
5738 else
5739 {
5740 g_value_init (&value, pspec->value_type);
5741 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
5742 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
5743 g_value_unset (&value);
5744 }
5745 return ret;
5746}
5747
5748static gboolean
5749_sensor_value_skeleton_handle_set_property (
5750 GDBusConnection *connection G_GNUC_UNUSED,
5751 const gchar *sender G_GNUC_UNUSED,
5752 const gchar *object_path G_GNUC_UNUSED,
5753 const gchar *interface_name G_GNUC_UNUSED,
5754 const gchar *property_name,
5755 GVariant *variant,
5756 GError **error,
5757 gpointer user_data)
5758{
5759 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data);
5760 GValue value = G_VALUE_INIT;
5761 GParamSpec *pspec;
5762 _ExtendedGDBusPropertyInfo *info;
5763 gboolean ret;
5764 ret = FALSE;
5765 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, property_name);
5766 g_assert (info != NULL);
5767 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
5768 if (pspec == NULL)
5769 {
5770 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
5771 }
5772 else
5773 {
5774 if (info->use_gvariant)
5775 g_value_set_variant (&value, variant);
5776 else
5777 g_dbus_gvariant_to_gvalue (variant, &value);
5778 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
5779 g_value_unset (&value);
5780 ret = TRUE;
5781 }
5782 return ret;
5783}
5784
5785static const GDBusInterfaceVTable _sensor_value_skeleton_vtable =
5786{
5787 _sensor_value_skeleton_handle_method_call,
5788 _sensor_value_skeleton_handle_get_property,
5789 _sensor_value_skeleton_handle_set_property,
5790 {NULL}
5791};
5792
5793static GDBusInterfaceInfo *
5794sensor_value_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
5795{
5796 return sensor_value_interface_info ();
5797}
5798
5799static GDBusInterfaceVTable *
5800sensor_value_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
5801{
5802 return (GDBusInterfaceVTable *) &_sensor_value_skeleton_vtable;
5803}
5804
5805static GVariant *
5806sensor_value_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
5807{
5808 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (_skeleton);
5809
5810 GVariantBuilder builder;
5811 guint n;
5812 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
5813 if (_sensor_value_interface_info.parent_struct.properties == NULL)
5814 goto out;
5815 for (n = 0; _sensor_value_interface_info.parent_struct.properties[n] != NULL; n++)
5816 {
5817 GDBusPropertyInfo *info = _sensor_value_interface_info.parent_struct.properties[n];
5818 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
5819 {
5820 GVariant *value;
5821 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);
5822 if (value != NULL)
5823 {
5824 g_variant_take_ref (value);
5825 g_variant_builder_add (&builder, "{sv}", info->name, value);
5826 g_variant_unref (value);
5827 }
5828 }
5829 }
5830out:
5831 return g_variant_builder_end (&builder);
5832}
5833
5834static gboolean _sensor_value_emit_changed (gpointer user_data);
5835
5836static void
5837sensor_value_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
5838{
5839 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (_skeleton);
5840 gboolean emit_changed = FALSE;
5841
5842 g_mutex_lock (&skeleton->priv->lock);
5843 if (skeleton->priv->changed_properties_idle_source != NULL)
5844 {
5845 g_source_destroy (skeleton->priv->changed_properties_idle_source);
5846 skeleton->priv->changed_properties_idle_source = NULL;
5847 emit_changed = TRUE;
5848 }
5849 g_mutex_unlock (&skeleton->priv->lock);
5850
5851 if (emit_changed)
5852 _sensor_value_emit_changed (skeleton);
5853}
5854
5855static void
5856_sensor_value_on_signal_changed (
5857 SensorValue *object,
5858 GVariant *arg_value,
5859 const gchar *arg_units)
5860{
5861 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5862
5863 GList *connections, *l;
5864 GVariant *signal_variant;
5865 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
5866
5867 signal_variant = g_variant_ref_sink (g_variant_new ("(@vs)",
5868 arg_value,
5869 arg_units));
5870 for (l = connections; l != NULL; l = l->next)
5871 {
5872 GDBusConnection *connection = l->data;
5873 g_dbus_connection_emit_signal (connection,
5874 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorValue", "Changed",
5875 signal_variant, NULL);
5876 }
5877 g_variant_unref (signal_variant);
5878 g_list_free_full (connections, g_object_unref);
5879}
5880
5881static void
Norman James32e74e22015-09-15 21:28:06 -05005882_sensor_value_on_signal_error (
5883 SensorValue *object)
5884{
5885 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5886
5887 GList *connections, *l;
5888 GVariant *signal_variant;
5889 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
5890
5891 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
5892 for (l = connections; l != NULL; l = l->next)
5893 {
5894 GDBusConnection *connection = l->data;
5895 g_dbus_connection_emit_signal (connection,
5896 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorValue", "Error",
5897 signal_variant, NULL);
5898 }
5899 g_variant_unref (signal_variant);
5900 g_list_free_full (connections, g_object_unref);
5901}
5902
5903static void
Norman James362a80f2015-09-14 14:04:39 -05005904_sensor_value_on_signal_heartbeat (
5905 SensorValue *object,
5906 const gchar *arg_bus_name)
5907{
5908 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5909
5910 GList *connections, *l;
5911 GVariant *signal_variant;
5912 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
5913
5914 signal_variant = g_variant_ref_sink (g_variant_new ("(s)",
5915 arg_bus_name));
5916 for (l = connections; l != NULL; l = l->next)
5917 {
5918 GDBusConnection *connection = l->data;
5919 g_dbus_connection_emit_signal (connection,
5920 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorValue", "Heartbeat",
5921 signal_variant, NULL);
5922 }
5923 g_variant_unref (signal_variant);
5924 g_list_free_full (connections, g_object_unref);
5925}
5926
5927static void sensor_value_skeleton_iface_init (SensorValueIface *iface);
5928#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
5929G_DEFINE_TYPE_WITH_CODE (SensorValueSkeleton, sensor_value_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
5930 G_ADD_PRIVATE (SensorValueSkeleton)
5931 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_skeleton_iface_init));
5932
5933#else
5934G_DEFINE_TYPE_WITH_CODE (SensorValueSkeleton, sensor_value_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
5935 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_skeleton_iface_init));
5936
5937#endif
5938static void
5939sensor_value_skeleton_finalize (GObject *object)
5940{
5941 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5942 guint n;
Norman Jamesdfdaca92015-09-27 22:11:15 -05005943 for (n = 0; n < 5; n++)
Norman James362a80f2015-09-14 14:04:39 -05005944 g_value_unset (&skeleton->priv->properties[n]);
5945 g_free (skeleton->priv->properties);
5946 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
5947 if (skeleton->priv->changed_properties_idle_source != NULL)
5948 g_source_destroy (skeleton->priv->changed_properties_idle_source);
5949 g_main_context_unref (skeleton->priv->context);
5950 g_mutex_clear (&skeleton->priv->lock);
5951 G_OBJECT_CLASS (sensor_value_skeleton_parent_class)->finalize (object);
5952}
5953
5954static void
5955sensor_value_skeleton_get_property (GObject *object,
5956 guint prop_id,
5957 GValue *value,
5958 GParamSpec *pspec G_GNUC_UNUSED)
5959{
5960 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
Norman Jamesdfdaca92015-09-27 22:11:15 -05005961 g_assert (prop_id != 0 && prop_id - 1 < 5);
Norman James362a80f2015-09-14 14:04:39 -05005962 g_mutex_lock (&skeleton->priv->lock);
5963 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
5964 g_mutex_unlock (&skeleton->priv->lock);
5965}
5966
5967static gboolean
5968_sensor_value_emit_changed (gpointer user_data)
5969{
5970 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data);
5971 GList *l;
5972 GVariantBuilder builder;
5973 GVariantBuilder invalidated_builder;
5974 guint num_changes;
5975
5976 g_mutex_lock (&skeleton->priv->lock);
5977 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
5978 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
5979 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
5980 {
5981 ChangedProperty *cp = l->data;
5982 GVariant *variant;
5983 const GValue *cur_value;
5984
5985 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
5986 if (!_g_value_equal (cur_value, &cp->orig_value))
5987 {
5988 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
5989 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
5990 g_variant_unref (variant);
5991 num_changes++;
5992 }
5993 }
5994 if (num_changes > 0)
5995 {
5996 GList *connections, *ll;
5997 GVariant *signal_variant;
5998 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorValue",
5999 &builder, &invalidated_builder));
6000 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
6001 for (ll = connections; ll != NULL; ll = ll->next)
6002 {
6003 GDBusConnection *connection = ll->data;
6004
6005 g_dbus_connection_emit_signal (connection,
6006 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
6007 "org.freedesktop.DBus.Properties",
6008 "PropertiesChanged",
6009 signal_variant,
6010 NULL);
6011 }
6012 g_variant_unref (signal_variant);
6013 g_list_free_full (connections, g_object_unref);
6014 }
6015 else
6016 {
6017 g_variant_builder_clear (&builder);
6018 g_variant_builder_clear (&invalidated_builder);
6019 }
6020 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
6021 skeleton->priv->changed_properties = NULL;
6022 skeleton->priv->changed_properties_idle_source = NULL;
6023 g_mutex_unlock (&skeleton->priv->lock);
6024 return FALSE;
6025}
6026
6027static void
6028_sensor_value_schedule_emit_changed (SensorValueSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
6029{
6030 ChangedProperty *cp;
6031 GList *l;
6032 cp = NULL;
6033 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
6034 {
6035 ChangedProperty *i_cp = l->data;
6036 if (i_cp->info == info)
6037 {
6038 cp = i_cp;
6039 break;
6040 }
6041 }
6042 if (cp == NULL)
6043 {
6044 cp = g_new0 (ChangedProperty, 1);
6045 cp->prop_id = prop_id;
6046 cp->info = info;
6047 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
6048 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
6049 g_value_copy (orig_value, &cp->orig_value);
6050 }
6051}
6052
6053static void
6054sensor_value_skeleton_notify (GObject *object,
6055 GParamSpec *pspec G_GNUC_UNUSED)
6056{
6057 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
6058 g_mutex_lock (&skeleton->priv->lock);
6059 if (skeleton->priv->changed_properties != NULL &&
6060 skeleton->priv->changed_properties_idle_source == NULL)
6061 {
6062 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
6063 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
6064 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_value_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
Adriana Kobylakfd778822016-06-16 09:08:37 -05006065 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _sensor_value_emit_changed");
Norman James362a80f2015-09-14 14:04:39 -05006066 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
6067 g_source_unref (skeleton->priv->changed_properties_idle_source);
6068 }
6069 g_mutex_unlock (&skeleton->priv->lock);
6070}
6071
6072static void
6073sensor_value_skeleton_set_property (GObject *object,
6074 guint prop_id,
6075 const GValue *value,
6076 GParamSpec *pspec)
6077{
6078 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
Norman Jamesdfdaca92015-09-27 22:11:15 -05006079 g_assert (prop_id != 0 && prop_id - 1 < 5);
Norman James362a80f2015-09-14 14:04:39 -05006080 g_mutex_lock (&skeleton->priv->lock);
6081 g_object_freeze_notify (object);
6082 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
6083 {
6084 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
6085 _sensor_value_schedule_emit_changed (skeleton, _sensor_value_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
6086 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
6087 g_object_notify_by_pspec (object, pspec);
6088 }
6089 g_mutex_unlock (&skeleton->priv->lock);
6090 g_object_thaw_notify (object);
6091}
6092
6093static void
6094sensor_value_skeleton_init (SensorValueSkeleton *skeleton)
6095{
6096#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
6097 skeleton->priv = sensor_value_skeleton_get_instance_private (skeleton);
6098#else
6099 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_VALUE_SKELETON, SensorValueSkeletonPrivate);
6100#endif
6101
6102 g_mutex_init (&skeleton->priv->lock);
6103 skeleton->priv->context = g_main_context_ref_thread_default ();
Norman Jamesdfdaca92015-09-27 22:11:15 -05006104 skeleton->priv->properties = g_new0 (GValue, 5);
Norman James362a80f2015-09-14 14:04:39 -05006105 g_value_init (&skeleton->priv->properties[0], G_TYPE_VARIANT);
6106 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
6107 g_value_init (&skeleton->priv->properties[2], G_TYPE_INT);
6108 g_value_init (&skeleton->priv->properties[3], G_TYPE_INT);
6109 g_value_init (&skeleton->priv->properties[4], G_TYPE_BOOLEAN);
Norman James362a80f2015-09-14 14:04:39 -05006110}
6111
6112static GVariant *
6113sensor_value_skeleton_get_value (SensorValue *object)
6114{
6115 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
6116 GVariant *value;
6117 g_mutex_lock (&skeleton->priv->lock);
6118 value = g_value_get_variant (&(skeleton->priv->properties[0]));
6119 g_mutex_unlock (&skeleton->priv->lock);
6120 return value;
6121}
6122
6123static const gchar *
6124sensor_value_skeleton_get_units (SensorValue *object)
6125{
6126 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
6127 const gchar *value;
6128 g_mutex_lock (&skeleton->priv->lock);
6129 value = g_value_get_string (&(skeleton->priv->properties[1]));
6130 g_mutex_unlock (&skeleton->priv->lock);
6131 return value;
6132}
6133
6134static gint
6135sensor_value_skeleton_get_poll_interval (SensorValue *object)
6136{
6137 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
6138 gint value;
6139 g_mutex_lock (&skeleton->priv->lock);
6140 value = g_value_get_int (&(skeleton->priv->properties[2]));
6141 g_mutex_unlock (&skeleton->priv->lock);
6142 return value;
6143}
6144
6145static gint
6146sensor_value_skeleton_get_heatbeat (SensorValue *object)
6147{
6148 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
6149 gint value;
6150 g_mutex_lock (&skeleton->priv->lock);
6151 value = g_value_get_int (&(skeleton->priv->properties[3]));
6152 g_mutex_unlock (&skeleton->priv->lock);
6153 return value;
6154}
6155
6156static gboolean
6157sensor_value_skeleton_get_settable (SensorValue *object)
6158{
6159 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
6160 gboolean value;
6161 g_mutex_lock (&skeleton->priv->lock);
6162 value = g_value_get_boolean (&(skeleton->priv->properties[4]));
6163 g_mutex_unlock (&skeleton->priv->lock);
6164 return value;
6165}
6166
Norman James362a80f2015-09-14 14:04:39 -05006167static void
6168sensor_value_skeleton_class_init (SensorValueSkeletonClass *klass)
6169{
6170 GObjectClass *gobject_class;
6171 GDBusInterfaceSkeletonClass *skeleton_class;
6172
6173 gobject_class = G_OBJECT_CLASS (klass);
6174 gobject_class->finalize = sensor_value_skeleton_finalize;
6175 gobject_class->get_property = sensor_value_skeleton_get_property;
6176 gobject_class->set_property = sensor_value_skeleton_set_property;
6177 gobject_class->notify = sensor_value_skeleton_notify;
6178
6179
6180 sensor_value_override_properties (gobject_class, 1);
6181
6182 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
6183 skeleton_class->get_info = sensor_value_skeleton_dbus_interface_get_info;
6184 skeleton_class->get_properties = sensor_value_skeleton_dbus_interface_get_properties;
6185 skeleton_class->flush = sensor_value_skeleton_dbus_interface_flush;
6186 skeleton_class->get_vtable = sensor_value_skeleton_dbus_interface_get_vtable;
6187
6188#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
6189 g_type_class_add_private (klass, sizeof (SensorValueSkeletonPrivate));
6190#endif
6191}
6192
6193static void
6194sensor_value_skeleton_iface_init (SensorValueIface *iface)
6195{
6196 iface->changed = _sensor_value_on_signal_changed;
Norman James32e74e22015-09-15 21:28:06 -05006197 iface->error = _sensor_value_on_signal_error;
Norman James362a80f2015-09-14 14:04:39 -05006198 iface->heartbeat = _sensor_value_on_signal_heartbeat;
6199 iface->get_value = sensor_value_skeleton_get_value;
6200 iface->get_units = sensor_value_skeleton_get_units;
6201 iface->get_poll_interval = sensor_value_skeleton_get_poll_interval;
6202 iface->get_heatbeat = sensor_value_skeleton_get_heatbeat;
6203 iface->get_settable = sensor_value_skeleton_get_settable;
Norman James362a80f2015-09-14 14:04:39 -05006204}
6205
6206/**
6207 * sensor_value_skeleton_new:
6208 *
6209 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link>.
6210 *
6211 * Returns: (transfer full) (type SensorValueSkeleton): The skeleton object.
6212 */
6213SensorValue *
6214sensor_value_skeleton_new (void)
6215{
6216 return SENSOR_VALUE (g_object_new (TYPE_SENSOR_VALUE_SKELETON, NULL));
6217}
6218
6219/* ------------------------------------------------------------------------
6220 * Code for interface org.openbmc.SensorThreshold
6221 * ------------------------------------------------------------------------
6222 */
6223
6224/**
6225 * SECTION:SensorThreshold
6226 * @title: SensorThreshold
6227 * @short_description: Generated C code for the org.openbmc.SensorThreshold D-Bus interface
6228 *
6229 * 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.
6230 */
6231
6232/* ---- Introspection data for org.openbmc.SensorThreshold ---- */
6233
6234static const _ExtendedGDBusArgInfo _sensor_threshold_method_info_get_state_OUT_ARG_state =
6235{
6236 {
6237 -1,
6238 (gchar *) "state",
6239 (gchar *) "y",
6240 NULL
6241 },
6242 FALSE
6243};
6244
6245static const _ExtendedGDBusArgInfo * const _sensor_threshold_method_info_get_state_OUT_ARG_pointers[] =
6246{
6247 &_sensor_threshold_method_info_get_state_OUT_ARG_state,
6248 NULL
6249};
6250
6251static const _ExtendedGDBusMethodInfo _sensor_threshold_method_info_get_state =
6252{
6253 {
6254 -1,
6255 (gchar *) "getState",
6256 NULL,
6257 (GDBusArgInfo **) &_sensor_threshold_method_info_get_state_OUT_ARG_pointers,
6258 NULL
6259 },
6260 "handle-get-state",
6261 FALSE
6262};
6263
6264static const _ExtendedGDBusMethodInfo * const _sensor_threshold_method_info_pointers[] =
6265{
6266 &_sensor_threshold_method_info_get_state,
6267 NULL
6268};
6269
6270static const _ExtendedGDBusSignalInfo _sensor_threshold_signal_info_warning =
6271{
6272 {
6273 -1,
6274 (gchar *) "Warning",
6275 NULL,
6276 NULL
6277 },
6278 "warning"
6279};
6280
6281static const _ExtendedGDBusSignalInfo _sensor_threshold_signal_info_critical =
6282{
6283 {
6284 -1,
6285 (gchar *) "Critical",
6286 NULL,
6287 NULL
6288 },
6289 "critical"
6290};
6291
6292static const _ExtendedGDBusSignalInfo _sensor_threshold_signal_info_normal =
6293{
6294 {
6295 -1,
6296 (gchar *) "Normal",
6297 NULL,
6298 NULL
6299 },
6300 "normal"
6301};
6302
6303static const _ExtendedGDBusSignalInfo * const _sensor_threshold_signal_info_pointers[] =
6304{
6305 &_sensor_threshold_signal_info_warning,
6306 &_sensor_threshold_signal_info_critical,
6307 &_sensor_threshold_signal_info_normal,
6308 NULL
6309};
6310
6311static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_lower_critical =
6312{
6313 {
6314 -1,
6315 (gchar *) "lower_critical",
6316 (gchar *) "v",
6317 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
6318 NULL
6319 },
6320 "lower-critical",
6321 FALSE
6322};
6323
6324static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_lower_warning =
6325{
6326 {
6327 -1,
6328 (gchar *) "lower_warning",
6329 (gchar *) "v",
6330 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
6331 NULL
6332 },
6333 "lower-warning",
6334 FALSE
6335};
6336
6337static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_upper_warning =
6338{
6339 {
6340 -1,
6341 (gchar *) "upper_warning",
6342 (gchar *) "v",
6343 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
6344 NULL
6345 },
6346 "upper-warning",
6347 FALSE
6348};
6349
6350static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_upper_critical =
6351{
6352 {
6353 -1,
6354 (gchar *) "upper_critical",
6355 (gchar *) "v",
6356 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
6357 NULL
6358 },
6359 "upper-critical",
6360 FALSE
6361};
6362
6363static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_state =
6364{
6365 {
6366 -1,
6367 (gchar *) "state",
6368 (gchar *) "y",
6369 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
6370 NULL
6371 },
6372 "state",
6373 FALSE
6374};
6375
6376static const _ExtendedGDBusPropertyInfo * const _sensor_threshold_property_info_pointers[] =
6377{
6378 &_sensor_threshold_property_info_lower_critical,
6379 &_sensor_threshold_property_info_lower_warning,
6380 &_sensor_threshold_property_info_upper_warning,
6381 &_sensor_threshold_property_info_upper_critical,
6382 &_sensor_threshold_property_info_state,
6383 NULL
6384};
6385
6386static const _ExtendedGDBusInterfaceInfo _sensor_threshold_interface_info =
6387{
6388 {
6389 -1,
6390 (gchar *) "org.openbmc.SensorThreshold",
6391 (GDBusMethodInfo **) &_sensor_threshold_method_info_pointers,
6392 (GDBusSignalInfo **) &_sensor_threshold_signal_info_pointers,
6393 (GDBusPropertyInfo **) &_sensor_threshold_property_info_pointers,
6394 NULL
6395 },
6396 "sensor-threshold",
6397};
6398
6399
6400/**
6401 * sensor_threshold_interface_info:
6402 *
6403 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link> D-Bus interface.
6404 *
6405 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
6406 */
6407GDBusInterfaceInfo *
6408sensor_threshold_interface_info (void)
6409{
6410 return (GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct;
6411}
6412
6413/**
6414 * sensor_threshold_override_properties:
6415 * @klass: The class structure for a #GObject<!-- -->-derived class.
6416 * @property_id_begin: The property id to assign to the first overridden property.
6417 *
6418 * Overrides all #GObject properties in the #SensorThreshold interface for a concrete class.
6419 * The properties are overridden in the order they are defined.
6420 *
6421 * Returns: The last property id.
6422 */
6423guint
6424sensor_threshold_override_properties (GObjectClass *klass, guint property_id_begin)
6425{
6426 g_object_class_override_property (klass, property_id_begin++, "lower-critical");
6427 g_object_class_override_property (klass, property_id_begin++, "lower-warning");
6428 g_object_class_override_property (klass, property_id_begin++, "upper-warning");
6429 g_object_class_override_property (klass, property_id_begin++, "upper-critical");
6430 g_object_class_override_property (klass, property_id_begin++, "state");
6431 return property_id_begin - 1;
6432}
6433
6434
6435
6436/**
6437 * SensorThreshold:
6438 *
6439 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link>.
6440 */
6441
6442/**
6443 * SensorThresholdIface:
6444 * @parent_iface: The parent interface.
6445 * @handle_get_state: Handler for the #SensorThreshold::handle-get-state signal.
6446 * @get_lower_critical: Getter for the #SensorThreshold:lower-critical property.
6447 * @get_lower_warning: Getter for the #SensorThreshold:lower-warning property.
6448 * @get_state: Getter for the #SensorThreshold:state property.
6449 * @get_upper_critical: Getter for the #SensorThreshold:upper-critical property.
6450 * @get_upper_warning: Getter for the #SensorThreshold:upper-warning property.
6451 * @critical: Handler for the #SensorThreshold::critical signal.
6452 * @normal: Handler for the #SensorThreshold::normal signal.
6453 * @warning: Handler for the #SensorThreshold::warning signal.
6454 *
6455 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link>.
6456 */
6457
6458typedef SensorThresholdIface SensorThresholdInterface;
6459G_DEFINE_INTERFACE (SensorThreshold, sensor_threshold, G_TYPE_OBJECT);
6460
6461static void
6462sensor_threshold_default_init (SensorThresholdIface *iface)
6463{
6464 /* GObject signals for incoming D-Bus method calls: */
6465 /**
6466 * SensorThreshold::handle-get-state:
6467 * @object: A #SensorThreshold.
6468 * @invocation: A #GDBusMethodInvocation.
6469 *
6470 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorThreshold.getState">getState()</link> D-Bus method.
6471 *
6472 * 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.
6473 *
6474 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
6475 */
6476 g_signal_new ("handle-get-state",
6477 G_TYPE_FROM_INTERFACE (iface),
6478 G_SIGNAL_RUN_LAST,
6479 G_STRUCT_OFFSET (SensorThresholdIface, handle_get_state),
6480 g_signal_accumulator_true_handled,
6481 NULL,
6482 g_cclosure_marshal_generic,
6483 G_TYPE_BOOLEAN,
6484 1,
6485 G_TYPE_DBUS_METHOD_INVOCATION);
6486
6487 /* GObject signals for received D-Bus signals: */
6488 /**
6489 * SensorThreshold::warning:
6490 * @object: A #SensorThreshold.
6491 *
6492 * 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.
6493 *
6494 * 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.
6495 */
6496 g_signal_new ("warning",
6497 G_TYPE_FROM_INTERFACE (iface),
6498 G_SIGNAL_RUN_LAST,
6499 G_STRUCT_OFFSET (SensorThresholdIface, warning),
6500 NULL,
6501 NULL,
6502 g_cclosure_marshal_generic,
6503 G_TYPE_NONE,
6504 0);
6505
6506 /**
6507 * SensorThreshold::critical:
6508 * @object: A #SensorThreshold.
6509 *
6510 * 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.
6511 *
6512 * 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.
6513 */
6514 g_signal_new ("critical",
6515 G_TYPE_FROM_INTERFACE (iface),
6516 G_SIGNAL_RUN_LAST,
6517 G_STRUCT_OFFSET (SensorThresholdIface, critical),
6518 NULL,
6519 NULL,
6520 g_cclosure_marshal_generic,
6521 G_TYPE_NONE,
6522 0);
6523
6524 /**
6525 * SensorThreshold::normal:
6526 * @object: A #SensorThreshold.
6527 *
6528 * 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.
6529 *
6530 * 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.
6531 */
6532 g_signal_new ("normal",
6533 G_TYPE_FROM_INTERFACE (iface),
6534 G_SIGNAL_RUN_LAST,
6535 G_STRUCT_OFFSET (SensorThresholdIface, normal),
6536 NULL,
6537 NULL,
6538 g_cclosure_marshal_generic,
6539 G_TYPE_NONE,
6540 0);
6541
6542 /* GObject properties for D-Bus properties: */
6543 /**
6544 * SensorThreshold:lower-critical:
6545 *
6546 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link>.
6547 *
6548 * 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.
6549 */
6550 g_object_interface_install_property (iface,
6551 g_param_spec_variant ("lower-critical", "lower_critical", "lower_critical", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
6552 /**
6553 * SensorThreshold:lower-warning:
6554 *
6555 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link>.
6556 *
6557 * 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.
6558 */
6559 g_object_interface_install_property (iface,
6560 g_param_spec_variant ("lower-warning", "lower_warning", "lower_warning", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
6561 /**
6562 * SensorThreshold:upper-warning:
6563 *
6564 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link>.
6565 *
6566 * 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.
6567 */
6568 g_object_interface_install_property (iface,
6569 g_param_spec_variant ("upper-warning", "upper_warning", "upper_warning", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
6570 /**
6571 * SensorThreshold:upper-critical:
6572 *
6573 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link>.
6574 *
6575 * 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.
6576 */
6577 g_object_interface_install_property (iface,
6578 g_param_spec_variant ("upper-critical", "upper_critical", "upper_critical", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
6579 /**
6580 * SensorThreshold:state:
6581 *
6582 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.state">"state"</link>.
6583 *
6584 * 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.
6585 */
6586 g_object_interface_install_property (iface,
6587 g_param_spec_uchar ("state", "state", "state", 0, 255, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
6588}
6589
6590/**
6591 * sensor_threshold_get_lower_critical: (skip)
6592 * @object: A #SensorThreshold.
6593 *
6594 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link> D-Bus property.
6595 *
6596 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6597 *
6598 * <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>
6599 *
6600 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
6601 */
6602GVariant *
6603sensor_threshold_get_lower_critical (SensorThreshold *object)
6604{
6605 return SENSOR_THRESHOLD_GET_IFACE (object)->get_lower_critical (object);
6606}
6607
6608/**
6609 * sensor_threshold_dup_lower_critical: (skip)
6610 * @object: A #SensorThreshold.
6611 *
6612 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link> D-Bus property.
6613 *
6614 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6615 *
6616 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
6617 */
6618GVariant *
6619sensor_threshold_dup_lower_critical (SensorThreshold *object)
6620{
6621 GVariant *value;
6622 g_object_get (G_OBJECT (object), "lower-critical", &value, NULL);
6623 return value;
6624}
6625
6626/**
6627 * sensor_threshold_set_lower_critical: (skip)
6628 * @object: A #SensorThreshold.
6629 * @value: The value to set.
6630 *
6631 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link> D-Bus property to @value.
6632 *
6633 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6634 */
6635void
6636sensor_threshold_set_lower_critical (SensorThreshold *object, GVariant *value)
6637{
6638 g_object_set (G_OBJECT (object), "lower-critical", value, NULL);
6639}
6640
6641/**
6642 * sensor_threshold_get_lower_warning: (skip)
6643 * @object: A #SensorThreshold.
6644 *
6645 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link> D-Bus property.
6646 *
6647 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6648 *
6649 * <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>
6650 *
6651 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
6652 */
6653GVariant *
6654sensor_threshold_get_lower_warning (SensorThreshold *object)
6655{
6656 return SENSOR_THRESHOLD_GET_IFACE (object)->get_lower_warning (object);
6657}
6658
6659/**
6660 * sensor_threshold_dup_lower_warning: (skip)
6661 * @object: A #SensorThreshold.
6662 *
6663 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link> D-Bus property.
6664 *
6665 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6666 *
6667 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
6668 */
6669GVariant *
6670sensor_threshold_dup_lower_warning (SensorThreshold *object)
6671{
6672 GVariant *value;
6673 g_object_get (G_OBJECT (object), "lower-warning", &value, NULL);
6674 return value;
6675}
6676
6677/**
6678 * sensor_threshold_set_lower_warning: (skip)
6679 * @object: A #SensorThreshold.
6680 * @value: The value to set.
6681 *
6682 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link> D-Bus property to @value.
6683 *
6684 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6685 */
6686void
6687sensor_threshold_set_lower_warning (SensorThreshold *object, GVariant *value)
6688{
6689 g_object_set (G_OBJECT (object), "lower-warning", value, NULL);
6690}
6691
6692/**
6693 * sensor_threshold_get_upper_warning: (skip)
6694 * @object: A #SensorThreshold.
6695 *
6696 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link> D-Bus property.
6697 *
6698 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6699 *
6700 * <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>
6701 *
6702 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
6703 */
6704GVariant *
6705sensor_threshold_get_upper_warning (SensorThreshold *object)
6706{
6707 return SENSOR_THRESHOLD_GET_IFACE (object)->get_upper_warning (object);
6708}
6709
6710/**
6711 * sensor_threshold_dup_upper_warning: (skip)
6712 * @object: A #SensorThreshold.
6713 *
6714 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link> D-Bus property.
6715 *
6716 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6717 *
6718 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
6719 */
6720GVariant *
6721sensor_threshold_dup_upper_warning (SensorThreshold *object)
6722{
6723 GVariant *value;
6724 g_object_get (G_OBJECT (object), "upper-warning", &value, NULL);
6725 return value;
6726}
6727
6728/**
6729 * sensor_threshold_set_upper_warning: (skip)
6730 * @object: A #SensorThreshold.
6731 * @value: The value to set.
6732 *
6733 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link> D-Bus property to @value.
6734 *
6735 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6736 */
6737void
6738sensor_threshold_set_upper_warning (SensorThreshold *object, GVariant *value)
6739{
6740 g_object_set (G_OBJECT (object), "upper-warning", value, NULL);
6741}
6742
6743/**
6744 * sensor_threshold_get_upper_critical: (skip)
6745 * @object: A #SensorThreshold.
6746 *
6747 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link> D-Bus property.
6748 *
6749 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6750 *
6751 * <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>
6752 *
6753 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
6754 */
6755GVariant *
6756sensor_threshold_get_upper_critical (SensorThreshold *object)
6757{
6758 return SENSOR_THRESHOLD_GET_IFACE (object)->get_upper_critical (object);
6759}
6760
6761/**
6762 * sensor_threshold_dup_upper_critical: (skip)
6763 * @object: A #SensorThreshold.
6764 *
6765 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link> D-Bus property.
6766 *
6767 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6768 *
6769 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
6770 */
6771GVariant *
6772sensor_threshold_dup_upper_critical (SensorThreshold *object)
6773{
6774 GVariant *value;
6775 g_object_get (G_OBJECT (object), "upper-critical", &value, NULL);
6776 return value;
6777}
6778
6779/**
6780 * sensor_threshold_set_upper_critical: (skip)
6781 * @object: A #SensorThreshold.
6782 * @value: The value to set.
6783 *
6784 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link> D-Bus property to @value.
6785 *
6786 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6787 */
6788void
6789sensor_threshold_set_upper_critical (SensorThreshold *object, GVariant *value)
6790{
6791 g_object_set (G_OBJECT (object), "upper-critical", value, NULL);
6792}
6793
6794/**
6795 * sensor_threshold_get_state: (skip)
6796 * @object: A #SensorThreshold.
6797 *
6798 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.state">"state"</link> D-Bus property.
6799 *
6800 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
6801 *
6802 * Returns: The property value.
6803 */
6804guchar
6805sensor_threshold_get_state (SensorThreshold *object)
6806{
6807 return SENSOR_THRESHOLD_GET_IFACE (object)->get_state (object);
6808}
6809
6810/**
6811 * sensor_threshold_set_state: (skip)
6812 * @object: A #SensorThreshold.
6813 * @value: The value to set.
6814 *
6815 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.state">"state"</link> D-Bus property to @value.
6816 *
6817 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
6818 */
6819void
6820sensor_threshold_set_state (SensorThreshold *object, guchar value)
6821{
6822 g_object_set (G_OBJECT (object), "state", value, NULL);
6823}
6824
6825/**
6826 * sensor_threshold_emit_warning:
6827 * @object: A #SensorThreshold.
6828 *
6829 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorThreshold.Warning">"Warning"</link> D-Bus signal.
6830 */
6831void
6832sensor_threshold_emit_warning (
6833 SensorThreshold *object)
6834{
6835 g_signal_emit_by_name (object, "warning");
6836}
6837
6838/**
6839 * sensor_threshold_emit_critical:
6840 * @object: A #SensorThreshold.
6841 *
6842 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorThreshold.Critical">"Critical"</link> D-Bus signal.
6843 */
6844void
6845sensor_threshold_emit_critical (
6846 SensorThreshold *object)
6847{
6848 g_signal_emit_by_name (object, "critical");
6849}
6850
6851/**
6852 * sensor_threshold_emit_normal:
6853 * @object: A #SensorThreshold.
6854 *
6855 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorThreshold.Normal">"Normal"</link> D-Bus signal.
6856 */
6857void
6858sensor_threshold_emit_normal (
6859 SensorThreshold *object)
6860{
6861 g_signal_emit_by_name (object, "normal");
6862}
6863
6864/**
6865 * sensor_threshold_call_get_state:
6866 * @proxy: A #SensorThresholdProxy.
6867 * @cancellable: (allow-none): A #GCancellable or %NULL.
6868 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
6869 * @user_data: User data to pass to @callback.
6870 *
6871 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorThreshold.getState">getState()</link> D-Bus method on @proxy.
6872 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
6873 * You can then call sensor_threshold_call_get_state_finish() to get the result of the operation.
6874 *
6875 * See sensor_threshold_call_get_state_sync() for the synchronous, blocking version of this method.
6876 */
6877void
6878sensor_threshold_call_get_state (
6879 SensorThreshold *proxy,
6880 GCancellable *cancellable,
6881 GAsyncReadyCallback callback,
6882 gpointer user_data)
6883{
6884 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
6885 "getState",
6886 g_variant_new ("()"),
6887 G_DBUS_CALL_FLAGS_NONE,
6888 -1,
6889 cancellable,
6890 callback,
6891 user_data);
6892}
6893
6894/**
6895 * sensor_threshold_call_get_state_finish:
6896 * @proxy: A #SensorThresholdProxy.
6897 * @out_state: (out): Return location for return parameter or %NULL to ignore.
6898 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_threshold_call_get_state().
6899 * @error: Return location for error or %NULL.
6900 *
6901 * Finishes an operation started with sensor_threshold_call_get_state().
6902 *
6903 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
6904 */
6905gboolean
6906sensor_threshold_call_get_state_finish (
6907 SensorThreshold *proxy,
6908 guchar *out_state,
6909 GAsyncResult *res,
6910 GError **error)
6911{
6912 GVariant *_ret;
6913 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
6914 if (_ret == NULL)
6915 goto _out;
6916 g_variant_get (_ret,
6917 "(y)",
6918 out_state);
6919 g_variant_unref (_ret);
6920_out:
6921 return _ret != NULL;
6922}
6923
6924/**
6925 * sensor_threshold_call_get_state_sync:
6926 * @proxy: A #SensorThresholdProxy.
6927 * @out_state: (out): Return location for return parameter or %NULL to ignore.
6928 * @cancellable: (allow-none): A #GCancellable or %NULL.
6929 * @error: Return location for error or %NULL.
6930 *
6931 * 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.
6932 *
6933 * See sensor_threshold_call_get_state() for the asynchronous version of this method.
6934 *
6935 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
6936 */
6937gboolean
6938sensor_threshold_call_get_state_sync (
6939 SensorThreshold *proxy,
6940 guchar *out_state,
6941 GCancellable *cancellable,
6942 GError **error)
6943{
6944 GVariant *_ret;
6945 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
6946 "getState",
6947 g_variant_new ("()"),
6948 G_DBUS_CALL_FLAGS_NONE,
6949 -1,
6950 cancellable,
6951 error);
6952 if (_ret == NULL)
6953 goto _out;
6954 g_variant_get (_ret,
6955 "(y)",
6956 out_state);
6957 g_variant_unref (_ret);
6958_out:
6959 return _ret != NULL;
6960}
6961
6962/**
6963 * sensor_threshold_complete_get_state:
6964 * @object: A #SensorThreshold.
6965 * @invocation: (transfer full): A #GDBusMethodInvocation.
6966 * @state: Parameter to return.
6967 *
6968 * 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.
6969 *
6970 * This method will free @invocation, you cannot use it afterwards.
6971 */
6972void
6973sensor_threshold_complete_get_state (
6974 SensorThreshold *object,
6975 GDBusMethodInvocation *invocation,
6976 guchar state)
6977{
6978 g_dbus_method_invocation_return_value (invocation,
6979 g_variant_new ("(y)",
6980 state));
6981}
6982
6983/* ------------------------------------------------------------------------ */
6984
6985/**
6986 * SensorThresholdProxy:
6987 *
6988 * The #SensorThresholdProxy structure contains only private data and should only be accessed using the provided API.
6989 */
6990
6991/**
6992 * SensorThresholdProxyClass:
6993 * @parent_class: The parent class.
6994 *
6995 * Class structure for #SensorThresholdProxy.
6996 */
6997
6998struct _SensorThresholdProxyPrivate
6999{
7000 GData *qdata;
7001};
7002
7003static void sensor_threshold_proxy_iface_init (SensorThresholdIface *iface);
7004
7005#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
7006G_DEFINE_TYPE_WITH_CODE (SensorThresholdProxy, sensor_threshold_proxy, G_TYPE_DBUS_PROXY,
7007 G_ADD_PRIVATE (SensorThresholdProxy)
7008 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_proxy_iface_init));
7009
7010#else
7011G_DEFINE_TYPE_WITH_CODE (SensorThresholdProxy, sensor_threshold_proxy, G_TYPE_DBUS_PROXY,
7012 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_proxy_iface_init));
7013
7014#endif
7015static void
7016sensor_threshold_proxy_finalize (GObject *object)
7017{
7018 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
7019 g_datalist_clear (&proxy->priv->qdata);
7020 G_OBJECT_CLASS (sensor_threshold_proxy_parent_class)->finalize (object);
7021}
7022
7023static void
7024sensor_threshold_proxy_get_property (GObject *object,
7025 guint prop_id,
7026 GValue *value,
7027 GParamSpec *pspec G_GNUC_UNUSED)
7028{
7029 const _ExtendedGDBusPropertyInfo *info;
7030 GVariant *variant;
7031 g_assert (prop_id != 0 && prop_id - 1 < 5);
7032 info = _sensor_threshold_property_info_pointers[prop_id - 1];
7033 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
7034 if (info->use_gvariant)
7035 {
7036 g_value_set_variant (value, variant);
7037 }
7038 else
7039 {
7040 if (variant != NULL)
7041 g_dbus_gvariant_to_gvalue (variant, value);
7042 }
7043 if (variant != NULL)
7044 g_variant_unref (variant);
7045}
7046
7047static void
7048sensor_threshold_proxy_set_property_cb (GDBusProxy *proxy,
7049 GAsyncResult *res,
7050 gpointer user_data)
7051{
7052 const _ExtendedGDBusPropertyInfo *info = user_data;
7053 GError *error;
7054 GVariant *_ret;
7055 error = NULL;
7056 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
7057 if (!_ret)
7058 {
7059 g_warning ("Error setting property '%s' on interface org.openbmc.SensorThreshold: %s (%s, %d)",
7060 info->parent_struct.name,
7061 error->message, g_quark_to_string (error->domain), error->code);
7062 g_error_free (error);
7063 }
7064 else
7065 {
7066 g_variant_unref (_ret);
7067 }
7068}
7069
7070static void
7071sensor_threshold_proxy_set_property (GObject *object,
7072 guint prop_id,
7073 const GValue *value,
7074 GParamSpec *pspec G_GNUC_UNUSED)
7075{
7076 const _ExtendedGDBusPropertyInfo *info;
7077 GVariant *variant;
7078 g_assert (prop_id != 0 && prop_id - 1 < 5);
7079 info = _sensor_threshold_property_info_pointers[prop_id - 1];
7080 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
7081 g_dbus_proxy_call (G_DBUS_PROXY (object),
7082 "org.freedesktop.DBus.Properties.Set",
7083 g_variant_new ("(ssv)", "org.openbmc.SensorThreshold", info->parent_struct.name, variant),
7084 G_DBUS_CALL_FLAGS_NONE,
7085 -1,
7086 NULL, (GAsyncReadyCallback) sensor_threshold_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
7087 g_variant_unref (variant);
7088}
7089
7090static void
7091sensor_threshold_proxy_g_signal (GDBusProxy *proxy,
7092 const gchar *sender_name G_GNUC_UNUSED,
7093 const gchar *signal_name,
7094 GVariant *parameters)
7095{
7096 _ExtendedGDBusSignalInfo *info;
7097 GVariantIter iter;
7098 GVariant *child;
7099 GValue *paramv;
7100 guint num_params;
7101 guint n;
7102 guint signal_id;
7103 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, signal_name);
7104 if (info == NULL)
7105 return;
7106 num_params = g_variant_n_children (parameters);
7107 paramv = g_new0 (GValue, num_params + 1);
7108 g_value_init (&paramv[0], TYPE_SENSOR_THRESHOLD);
7109 g_value_set_object (&paramv[0], proxy);
7110 g_variant_iter_init (&iter, parameters);
7111 n = 1;
7112 while ((child = g_variant_iter_next_value (&iter)) != NULL)
7113 {
7114 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
7115 if (arg_info->use_gvariant)
7116 {
7117 g_value_init (&paramv[n], G_TYPE_VARIANT);
7118 g_value_set_variant (&paramv[n], child);
7119 n++;
7120 }
7121 else
7122 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
7123 g_variant_unref (child);
7124 }
7125 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_THRESHOLD);
7126 g_signal_emitv (paramv, signal_id, 0, NULL);
7127 for (n = 0; n < num_params + 1; n++)
7128 g_value_unset (&paramv[n]);
7129 g_free (paramv);
7130}
7131
7132static void
7133sensor_threshold_proxy_g_properties_changed (GDBusProxy *_proxy,
7134 GVariant *changed_properties,
7135 const gchar *const *invalidated_properties)
7136{
7137 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (_proxy);
7138 guint n;
7139 const gchar *key;
7140 GVariantIter *iter;
7141 _ExtendedGDBusPropertyInfo *info;
7142 g_variant_get (changed_properties, "a{sv}", &iter);
7143 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
7144 {
7145 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, key);
7146 g_datalist_remove_data (&proxy->priv->qdata, key);
7147 if (info != NULL)
7148 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
7149 }
7150 g_variant_iter_free (iter);
7151 for (n = 0; invalidated_properties[n] != NULL; n++)
7152 {
7153 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, invalidated_properties[n]);
7154 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
7155 if (info != NULL)
7156 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
7157 }
7158}
7159
7160static GVariant *
7161sensor_threshold_proxy_get_lower_critical (SensorThreshold *object)
7162{
7163 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
7164 GVariant *variant;
7165 GVariant *value = NULL;
7166 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "lower_critical");
7167 value = variant;
7168 if (variant != NULL)
7169 g_variant_unref (variant);
7170 return value;
7171}
7172
7173static GVariant *
7174sensor_threshold_proxy_get_lower_warning (SensorThreshold *object)
7175{
7176 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
7177 GVariant *variant;
7178 GVariant *value = NULL;
7179 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "lower_warning");
7180 value = variant;
7181 if (variant != NULL)
7182 g_variant_unref (variant);
7183 return value;
7184}
7185
7186static GVariant *
7187sensor_threshold_proxy_get_upper_warning (SensorThreshold *object)
7188{
7189 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
7190 GVariant *variant;
7191 GVariant *value = NULL;
7192 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "upper_warning");
7193 value = variant;
7194 if (variant != NULL)
7195 g_variant_unref (variant);
7196 return value;
7197}
7198
7199static GVariant *
7200sensor_threshold_proxy_get_upper_critical (SensorThreshold *object)
7201{
7202 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
7203 GVariant *variant;
7204 GVariant *value = NULL;
7205 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "upper_critical");
7206 value = variant;
7207 if (variant != NULL)
7208 g_variant_unref (variant);
7209 return value;
7210}
7211
7212static guchar
7213sensor_threshold_proxy_get_state (SensorThreshold *object)
7214{
7215 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
7216 GVariant *variant;
7217 guchar value = 0;
7218 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state");
7219 if (variant != NULL)
7220 {
7221 value = g_variant_get_byte (variant);
7222 g_variant_unref (variant);
7223 }
7224 return value;
7225}
7226
7227static void
7228sensor_threshold_proxy_init (SensorThresholdProxy *proxy)
7229{
7230#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
7231 proxy->priv = sensor_threshold_proxy_get_instance_private (proxy);
7232#else
7233 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_THRESHOLD_PROXY, SensorThresholdProxyPrivate);
7234#endif
7235
7236 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_threshold_interface_info ());
7237}
7238
7239static void
7240sensor_threshold_proxy_class_init (SensorThresholdProxyClass *klass)
7241{
7242 GObjectClass *gobject_class;
7243 GDBusProxyClass *proxy_class;
7244
7245 gobject_class = G_OBJECT_CLASS (klass);
7246 gobject_class->finalize = sensor_threshold_proxy_finalize;
7247 gobject_class->get_property = sensor_threshold_proxy_get_property;
7248 gobject_class->set_property = sensor_threshold_proxy_set_property;
7249
7250 proxy_class = G_DBUS_PROXY_CLASS (klass);
7251 proxy_class->g_signal = sensor_threshold_proxy_g_signal;
7252 proxy_class->g_properties_changed = sensor_threshold_proxy_g_properties_changed;
7253
7254 sensor_threshold_override_properties (gobject_class, 1);
7255
7256#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
7257 g_type_class_add_private (klass, sizeof (SensorThresholdProxyPrivate));
7258#endif
7259}
7260
7261static void
7262sensor_threshold_proxy_iface_init (SensorThresholdIface *iface)
7263{
7264 iface->get_lower_critical = sensor_threshold_proxy_get_lower_critical;
7265 iface->get_lower_warning = sensor_threshold_proxy_get_lower_warning;
7266 iface->get_upper_warning = sensor_threshold_proxy_get_upper_warning;
7267 iface->get_upper_critical = sensor_threshold_proxy_get_upper_critical;
7268 iface->get_state = sensor_threshold_proxy_get_state;
7269}
7270
7271/**
7272 * sensor_threshold_proxy_new:
7273 * @connection: A #GDBusConnection.
7274 * @flags: Flags from the #GDBusProxyFlags enumeration.
7275 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
7276 * @object_path: An object path.
7277 * @cancellable: (allow-none): A #GCancellable or %NULL.
7278 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
7279 * @user_data: User data to pass to @callback.
7280 *
7281 * 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.
7282 *
7283 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
7284 * You can then call sensor_threshold_proxy_new_finish() to get the result of the operation.
7285 *
7286 * See sensor_threshold_proxy_new_sync() for the synchronous, blocking version of this constructor.
7287 */
7288void
7289sensor_threshold_proxy_new (
7290 GDBusConnection *connection,
7291 GDBusProxyFlags flags,
7292 const gchar *name,
7293 const gchar *object_path,
7294 GCancellable *cancellable,
7295 GAsyncReadyCallback callback,
7296 gpointer user_data)
7297{
7298 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);
7299}
7300
7301/**
7302 * sensor_threshold_proxy_new_finish:
7303 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_threshold_proxy_new().
7304 * @error: Return location for error or %NULL
7305 *
7306 * Finishes an operation started with sensor_threshold_proxy_new().
7307 *
7308 * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set.
7309 */
7310SensorThreshold *
7311sensor_threshold_proxy_new_finish (
7312 GAsyncResult *res,
7313 GError **error)
7314{
7315 GObject *ret;
7316 GObject *source_object;
7317 source_object = g_async_result_get_source_object (res);
7318 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
7319 g_object_unref (source_object);
7320 if (ret != NULL)
7321 return SENSOR_THRESHOLD (ret);
7322 else
7323 return NULL;
7324}
7325
7326/**
7327 * sensor_threshold_proxy_new_sync:
7328 * @connection: A #GDBusConnection.
7329 * @flags: Flags from the #GDBusProxyFlags enumeration.
7330 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
7331 * @object_path: An object path.
7332 * @cancellable: (allow-none): A #GCancellable or %NULL.
7333 * @error: Return location for error or %NULL
7334 *
7335 * 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.
7336 *
7337 * The calling thread is blocked until a reply is received.
7338 *
7339 * See sensor_threshold_proxy_new() for the asynchronous version of this constructor.
7340 *
7341 * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set.
7342 */
7343SensorThreshold *
7344sensor_threshold_proxy_new_sync (
7345 GDBusConnection *connection,
7346 GDBusProxyFlags flags,
7347 const gchar *name,
7348 const gchar *object_path,
7349 GCancellable *cancellable,
7350 GError **error)
7351{
7352 GInitable *ret;
7353 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);
7354 if (ret != NULL)
7355 return SENSOR_THRESHOLD (ret);
7356 else
7357 return NULL;
7358}
7359
7360
7361/**
7362 * sensor_threshold_proxy_new_for_bus:
7363 * @bus_type: A #GBusType.
7364 * @flags: Flags from the #GDBusProxyFlags enumeration.
7365 * @name: A bus name (well-known or unique).
7366 * @object_path: An object path.
7367 * @cancellable: (allow-none): A #GCancellable or %NULL.
7368 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
7369 * @user_data: User data to pass to @callback.
7370 *
7371 * Like sensor_threshold_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
7372 *
7373 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
7374 * You can then call sensor_threshold_proxy_new_for_bus_finish() to get the result of the operation.
7375 *
7376 * See sensor_threshold_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
7377 */
7378void
7379sensor_threshold_proxy_new_for_bus (
7380 GBusType bus_type,
7381 GDBusProxyFlags flags,
7382 const gchar *name,
7383 const gchar *object_path,
7384 GCancellable *cancellable,
7385 GAsyncReadyCallback callback,
7386 gpointer user_data)
7387{
7388 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);
7389}
7390
7391/**
7392 * sensor_threshold_proxy_new_for_bus_finish:
7393 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_threshold_proxy_new_for_bus().
7394 * @error: Return location for error or %NULL
7395 *
7396 * Finishes an operation started with sensor_threshold_proxy_new_for_bus().
7397 *
7398 * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set.
7399 */
7400SensorThreshold *
7401sensor_threshold_proxy_new_for_bus_finish (
7402 GAsyncResult *res,
7403 GError **error)
7404{
7405 GObject *ret;
7406 GObject *source_object;
7407 source_object = g_async_result_get_source_object (res);
7408 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
7409 g_object_unref (source_object);
7410 if (ret != NULL)
7411 return SENSOR_THRESHOLD (ret);
7412 else
7413 return NULL;
7414}
7415
7416/**
7417 * sensor_threshold_proxy_new_for_bus_sync:
7418 * @bus_type: A #GBusType.
7419 * @flags: Flags from the #GDBusProxyFlags enumeration.
7420 * @name: A bus name (well-known or unique).
7421 * @object_path: An object path.
7422 * @cancellable: (allow-none): A #GCancellable or %NULL.
7423 * @error: Return location for error or %NULL
7424 *
7425 * Like sensor_threshold_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
7426 *
7427 * The calling thread is blocked until a reply is received.
7428 *
7429 * See sensor_threshold_proxy_new_for_bus() for the asynchronous version of this constructor.
7430 *
7431 * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set.
7432 */
7433SensorThreshold *
7434sensor_threshold_proxy_new_for_bus_sync (
7435 GBusType bus_type,
7436 GDBusProxyFlags flags,
7437 const gchar *name,
7438 const gchar *object_path,
7439 GCancellable *cancellable,
7440 GError **error)
7441{
7442 GInitable *ret;
7443 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);
7444 if (ret != NULL)
7445 return SENSOR_THRESHOLD (ret);
7446 else
7447 return NULL;
7448}
7449
7450
7451/* ------------------------------------------------------------------------ */
7452
7453/**
7454 * SensorThresholdSkeleton:
7455 *
7456 * The #SensorThresholdSkeleton structure contains only private data and should only be accessed using the provided API.
7457 */
7458
7459/**
7460 * SensorThresholdSkeletonClass:
7461 * @parent_class: The parent class.
7462 *
7463 * Class structure for #SensorThresholdSkeleton.
7464 */
7465
7466struct _SensorThresholdSkeletonPrivate
7467{
7468 GValue *properties;
7469 GList *changed_properties;
7470 GSource *changed_properties_idle_source;
7471 GMainContext *context;
7472 GMutex lock;
7473};
7474
7475static void
7476_sensor_threshold_skeleton_handle_method_call (
7477 GDBusConnection *connection G_GNUC_UNUSED,
7478 const gchar *sender G_GNUC_UNUSED,
7479 const gchar *object_path G_GNUC_UNUSED,
7480 const gchar *interface_name,
7481 const gchar *method_name,
7482 GVariant *parameters,
7483 GDBusMethodInvocation *invocation,
7484 gpointer user_data)
7485{
7486 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data);
7487 _ExtendedGDBusMethodInfo *info;
7488 GVariantIter iter;
7489 GVariant *child;
7490 GValue *paramv;
7491 guint num_params;
7492 guint num_extra;
7493 guint n;
7494 guint signal_id;
7495 GValue return_value = G_VALUE_INIT;
7496 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
7497 g_assert (info != NULL);
7498 num_params = g_variant_n_children (parameters);
7499 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
7500 n = 0;
7501 g_value_init (&paramv[n], TYPE_SENSOR_THRESHOLD);
7502 g_value_set_object (&paramv[n++], skeleton);
7503 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
7504 g_value_set_object (&paramv[n++], invocation);
7505 if (info->pass_fdlist)
7506 {
7507#ifdef G_OS_UNIX
7508 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
7509 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
7510#else
7511 g_assert_not_reached ();
7512#endif
7513 }
7514 g_variant_iter_init (&iter, parameters);
7515 while ((child = g_variant_iter_next_value (&iter)) != NULL)
7516 {
7517 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
7518 if (arg_info->use_gvariant)
7519 {
7520 g_value_init (&paramv[n], G_TYPE_VARIANT);
7521 g_value_set_variant (&paramv[n], child);
7522 n++;
7523 }
7524 else
7525 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
7526 g_variant_unref (child);
7527 }
7528 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_THRESHOLD);
7529 g_value_init (&return_value, G_TYPE_BOOLEAN);
7530 g_signal_emitv (paramv, signal_id, 0, &return_value);
7531 if (!g_value_get_boolean (&return_value))
7532 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);
7533 g_value_unset (&return_value);
7534 for (n = 0; n < num_params + num_extra; n++)
7535 g_value_unset (&paramv[n]);
7536 g_free (paramv);
7537}
7538
7539static GVariant *
7540_sensor_threshold_skeleton_handle_get_property (
7541 GDBusConnection *connection G_GNUC_UNUSED,
7542 const gchar *sender G_GNUC_UNUSED,
7543 const gchar *object_path G_GNUC_UNUSED,
7544 const gchar *interface_name G_GNUC_UNUSED,
7545 const gchar *property_name,
7546 GError **error,
7547 gpointer user_data)
7548{
7549 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data);
7550 GValue value = G_VALUE_INIT;
7551 GParamSpec *pspec;
7552 _ExtendedGDBusPropertyInfo *info;
7553 GVariant *ret;
7554 ret = NULL;
7555 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, property_name);
7556 g_assert (info != NULL);
7557 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
7558 if (pspec == NULL)
7559 {
7560 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
7561 }
7562 else
7563 {
7564 g_value_init (&value, pspec->value_type);
7565 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
7566 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
7567 g_value_unset (&value);
7568 }
7569 return ret;
7570}
7571
7572static gboolean
7573_sensor_threshold_skeleton_handle_set_property (
7574 GDBusConnection *connection G_GNUC_UNUSED,
7575 const gchar *sender G_GNUC_UNUSED,
7576 const gchar *object_path G_GNUC_UNUSED,
7577 const gchar *interface_name G_GNUC_UNUSED,
7578 const gchar *property_name,
7579 GVariant *variant,
7580 GError **error,
7581 gpointer user_data)
7582{
7583 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data);
7584 GValue value = G_VALUE_INIT;
7585 GParamSpec *pspec;
7586 _ExtendedGDBusPropertyInfo *info;
7587 gboolean ret;
7588 ret = FALSE;
7589 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, property_name);
7590 g_assert (info != NULL);
7591 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
7592 if (pspec == NULL)
7593 {
7594 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
7595 }
7596 else
7597 {
7598 if (info->use_gvariant)
7599 g_value_set_variant (&value, variant);
7600 else
7601 g_dbus_gvariant_to_gvalue (variant, &value);
7602 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
7603 g_value_unset (&value);
7604 ret = TRUE;
7605 }
7606 return ret;
7607}
7608
7609static const GDBusInterfaceVTable _sensor_threshold_skeleton_vtable =
7610{
7611 _sensor_threshold_skeleton_handle_method_call,
7612 _sensor_threshold_skeleton_handle_get_property,
7613 _sensor_threshold_skeleton_handle_set_property,
7614 {NULL}
7615};
7616
7617static GDBusInterfaceInfo *
7618sensor_threshold_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
7619{
7620 return sensor_threshold_interface_info ();
7621}
7622
7623static GDBusInterfaceVTable *
7624sensor_threshold_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
7625{
7626 return (GDBusInterfaceVTable *) &_sensor_threshold_skeleton_vtable;
7627}
7628
7629static GVariant *
7630sensor_threshold_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
7631{
7632 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (_skeleton);
7633
7634 GVariantBuilder builder;
7635 guint n;
7636 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
7637 if (_sensor_threshold_interface_info.parent_struct.properties == NULL)
7638 goto out;
7639 for (n = 0; _sensor_threshold_interface_info.parent_struct.properties[n] != NULL; n++)
7640 {
7641 GDBusPropertyInfo *info = _sensor_threshold_interface_info.parent_struct.properties[n];
7642 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
7643 {
7644 GVariant *value;
7645 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);
7646 if (value != NULL)
7647 {
7648 g_variant_take_ref (value);
7649 g_variant_builder_add (&builder, "{sv}", info->name, value);
7650 g_variant_unref (value);
7651 }
7652 }
7653 }
7654out:
7655 return g_variant_builder_end (&builder);
7656}
7657
7658static gboolean _sensor_threshold_emit_changed (gpointer user_data);
7659
7660static void
7661sensor_threshold_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
7662{
7663 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (_skeleton);
7664 gboolean emit_changed = FALSE;
7665
7666 g_mutex_lock (&skeleton->priv->lock);
7667 if (skeleton->priv->changed_properties_idle_source != NULL)
7668 {
7669 g_source_destroy (skeleton->priv->changed_properties_idle_source);
7670 skeleton->priv->changed_properties_idle_source = NULL;
7671 emit_changed = TRUE;
7672 }
7673 g_mutex_unlock (&skeleton->priv->lock);
7674
7675 if (emit_changed)
7676 _sensor_threshold_emit_changed (skeleton);
7677}
7678
7679static void
7680_sensor_threshold_on_signal_warning (
7681 SensorThreshold *object)
7682{
7683 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7684
7685 GList *connections, *l;
7686 GVariant *signal_variant;
7687 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
7688
7689 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
7690 for (l = connections; l != NULL; l = l->next)
7691 {
7692 GDBusConnection *connection = l->data;
7693 g_dbus_connection_emit_signal (connection,
7694 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorThreshold", "Warning",
7695 signal_variant, NULL);
7696 }
7697 g_variant_unref (signal_variant);
7698 g_list_free_full (connections, g_object_unref);
7699}
7700
7701static void
7702_sensor_threshold_on_signal_critical (
7703 SensorThreshold *object)
7704{
7705 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7706
7707 GList *connections, *l;
7708 GVariant *signal_variant;
7709 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
7710
7711 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
7712 for (l = connections; l != NULL; l = l->next)
7713 {
7714 GDBusConnection *connection = l->data;
7715 g_dbus_connection_emit_signal (connection,
7716 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorThreshold", "Critical",
7717 signal_variant, NULL);
7718 }
7719 g_variant_unref (signal_variant);
7720 g_list_free_full (connections, g_object_unref);
7721}
7722
7723static void
7724_sensor_threshold_on_signal_normal (
7725 SensorThreshold *object)
7726{
7727 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7728
7729 GList *connections, *l;
7730 GVariant *signal_variant;
7731 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
7732
7733 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
7734 for (l = connections; l != NULL; l = l->next)
7735 {
7736 GDBusConnection *connection = l->data;
7737 g_dbus_connection_emit_signal (connection,
7738 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorThreshold", "Normal",
7739 signal_variant, NULL);
7740 }
7741 g_variant_unref (signal_variant);
7742 g_list_free_full (connections, g_object_unref);
7743}
7744
7745static void sensor_threshold_skeleton_iface_init (SensorThresholdIface *iface);
7746#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
7747G_DEFINE_TYPE_WITH_CODE (SensorThresholdSkeleton, sensor_threshold_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
7748 G_ADD_PRIVATE (SensorThresholdSkeleton)
7749 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_skeleton_iface_init));
7750
7751#else
7752G_DEFINE_TYPE_WITH_CODE (SensorThresholdSkeleton, sensor_threshold_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
7753 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_skeleton_iface_init));
7754
7755#endif
7756static void
7757sensor_threshold_skeleton_finalize (GObject *object)
7758{
7759 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7760 guint n;
7761 for (n = 0; n < 5; n++)
7762 g_value_unset (&skeleton->priv->properties[n]);
7763 g_free (skeleton->priv->properties);
7764 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
7765 if (skeleton->priv->changed_properties_idle_source != NULL)
7766 g_source_destroy (skeleton->priv->changed_properties_idle_source);
7767 g_main_context_unref (skeleton->priv->context);
7768 g_mutex_clear (&skeleton->priv->lock);
7769 G_OBJECT_CLASS (sensor_threshold_skeleton_parent_class)->finalize (object);
7770}
7771
7772static void
7773sensor_threshold_skeleton_get_property (GObject *object,
7774 guint prop_id,
7775 GValue *value,
7776 GParamSpec *pspec G_GNUC_UNUSED)
7777{
7778 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7779 g_assert (prop_id != 0 && prop_id - 1 < 5);
7780 g_mutex_lock (&skeleton->priv->lock);
7781 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
7782 g_mutex_unlock (&skeleton->priv->lock);
7783}
7784
7785static gboolean
7786_sensor_threshold_emit_changed (gpointer user_data)
7787{
7788 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data);
7789 GList *l;
7790 GVariantBuilder builder;
7791 GVariantBuilder invalidated_builder;
7792 guint num_changes;
7793
7794 g_mutex_lock (&skeleton->priv->lock);
7795 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
7796 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
7797 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
7798 {
7799 ChangedProperty *cp = l->data;
7800 GVariant *variant;
7801 const GValue *cur_value;
7802
7803 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
7804 if (!_g_value_equal (cur_value, &cp->orig_value))
7805 {
7806 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
7807 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
7808 g_variant_unref (variant);
7809 num_changes++;
7810 }
7811 }
7812 if (num_changes > 0)
7813 {
7814 GList *connections, *ll;
7815 GVariant *signal_variant;
7816 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorThreshold",
7817 &builder, &invalidated_builder));
7818 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
7819 for (ll = connections; ll != NULL; ll = ll->next)
7820 {
7821 GDBusConnection *connection = ll->data;
7822
7823 g_dbus_connection_emit_signal (connection,
7824 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
7825 "org.freedesktop.DBus.Properties",
7826 "PropertiesChanged",
7827 signal_variant,
7828 NULL);
7829 }
7830 g_variant_unref (signal_variant);
7831 g_list_free_full (connections, g_object_unref);
7832 }
7833 else
7834 {
7835 g_variant_builder_clear (&builder);
7836 g_variant_builder_clear (&invalidated_builder);
7837 }
7838 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
7839 skeleton->priv->changed_properties = NULL;
7840 skeleton->priv->changed_properties_idle_source = NULL;
7841 g_mutex_unlock (&skeleton->priv->lock);
7842 return FALSE;
7843}
7844
7845static void
7846_sensor_threshold_schedule_emit_changed (SensorThresholdSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
7847{
7848 ChangedProperty *cp;
7849 GList *l;
7850 cp = NULL;
7851 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
7852 {
7853 ChangedProperty *i_cp = l->data;
7854 if (i_cp->info == info)
7855 {
7856 cp = i_cp;
7857 break;
7858 }
7859 }
7860 if (cp == NULL)
7861 {
7862 cp = g_new0 (ChangedProperty, 1);
7863 cp->prop_id = prop_id;
7864 cp->info = info;
7865 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
7866 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
7867 g_value_copy (orig_value, &cp->orig_value);
7868 }
7869}
7870
7871static void
7872sensor_threshold_skeleton_notify (GObject *object,
7873 GParamSpec *pspec G_GNUC_UNUSED)
7874{
7875 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7876 g_mutex_lock (&skeleton->priv->lock);
7877 if (skeleton->priv->changed_properties != NULL &&
7878 skeleton->priv->changed_properties_idle_source == NULL)
7879 {
7880 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
7881 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
7882 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_threshold_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
Adriana Kobylakfd778822016-06-16 09:08:37 -05007883 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _sensor_threshold_emit_changed");
Norman James362a80f2015-09-14 14:04:39 -05007884 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
7885 g_source_unref (skeleton->priv->changed_properties_idle_source);
7886 }
7887 g_mutex_unlock (&skeleton->priv->lock);
7888}
7889
7890static void
7891sensor_threshold_skeleton_set_property (GObject *object,
7892 guint prop_id,
7893 const GValue *value,
7894 GParamSpec *pspec)
7895{
7896 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7897 g_assert (prop_id != 0 && prop_id - 1 < 5);
7898 g_mutex_lock (&skeleton->priv->lock);
7899 g_object_freeze_notify (object);
7900 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
7901 {
7902 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
7903 _sensor_threshold_schedule_emit_changed (skeleton, _sensor_threshold_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
7904 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
7905 g_object_notify_by_pspec (object, pspec);
7906 }
7907 g_mutex_unlock (&skeleton->priv->lock);
7908 g_object_thaw_notify (object);
7909}
7910
7911static void
7912sensor_threshold_skeleton_init (SensorThresholdSkeleton *skeleton)
7913{
7914#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
7915 skeleton->priv = sensor_threshold_skeleton_get_instance_private (skeleton);
7916#else
7917 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_THRESHOLD_SKELETON, SensorThresholdSkeletonPrivate);
7918#endif
7919
7920 g_mutex_init (&skeleton->priv->lock);
7921 skeleton->priv->context = g_main_context_ref_thread_default ();
7922 skeleton->priv->properties = g_new0 (GValue, 5);
7923 g_value_init (&skeleton->priv->properties[0], G_TYPE_VARIANT);
7924 g_value_init (&skeleton->priv->properties[1], G_TYPE_VARIANT);
7925 g_value_init (&skeleton->priv->properties[2], G_TYPE_VARIANT);
7926 g_value_init (&skeleton->priv->properties[3], G_TYPE_VARIANT);
7927 g_value_init (&skeleton->priv->properties[4], G_TYPE_UCHAR);
7928}
7929
7930static GVariant *
7931sensor_threshold_skeleton_get_lower_critical (SensorThreshold *object)
7932{
7933 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7934 GVariant *value;
7935 g_mutex_lock (&skeleton->priv->lock);
7936 value = g_value_get_variant (&(skeleton->priv->properties[0]));
7937 g_mutex_unlock (&skeleton->priv->lock);
7938 return value;
7939}
7940
7941static GVariant *
7942sensor_threshold_skeleton_get_lower_warning (SensorThreshold *object)
7943{
7944 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7945 GVariant *value;
7946 g_mutex_lock (&skeleton->priv->lock);
7947 value = g_value_get_variant (&(skeleton->priv->properties[1]));
7948 g_mutex_unlock (&skeleton->priv->lock);
7949 return value;
7950}
7951
7952static GVariant *
7953sensor_threshold_skeleton_get_upper_warning (SensorThreshold *object)
7954{
7955 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7956 GVariant *value;
7957 g_mutex_lock (&skeleton->priv->lock);
7958 value = g_value_get_variant (&(skeleton->priv->properties[2]));
7959 g_mutex_unlock (&skeleton->priv->lock);
7960 return value;
7961}
7962
7963static GVariant *
7964sensor_threshold_skeleton_get_upper_critical (SensorThreshold *object)
7965{
7966 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7967 GVariant *value;
7968 g_mutex_lock (&skeleton->priv->lock);
7969 value = g_value_get_variant (&(skeleton->priv->properties[3]));
7970 g_mutex_unlock (&skeleton->priv->lock);
7971 return value;
7972}
7973
7974static guchar
7975sensor_threshold_skeleton_get_state (SensorThreshold *object)
7976{
7977 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7978 guchar value;
7979 g_mutex_lock (&skeleton->priv->lock);
7980 value = g_value_get_uchar (&(skeleton->priv->properties[4]));
7981 g_mutex_unlock (&skeleton->priv->lock);
7982 return value;
7983}
7984
7985static void
7986sensor_threshold_skeleton_class_init (SensorThresholdSkeletonClass *klass)
7987{
7988 GObjectClass *gobject_class;
7989 GDBusInterfaceSkeletonClass *skeleton_class;
7990
7991 gobject_class = G_OBJECT_CLASS (klass);
7992 gobject_class->finalize = sensor_threshold_skeleton_finalize;
7993 gobject_class->get_property = sensor_threshold_skeleton_get_property;
7994 gobject_class->set_property = sensor_threshold_skeleton_set_property;
7995 gobject_class->notify = sensor_threshold_skeleton_notify;
7996
7997
7998 sensor_threshold_override_properties (gobject_class, 1);
7999
8000 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
8001 skeleton_class->get_info = sensor_threshold_skeleton_dbus_interface_get_info;
8002 skeleton_class->get_properties = sensor_threshold_skeleton_dbus_interface_get_properties;
8003 skeleton_class->flush = sensor_threshold_skeleton_dbus_interface_flush;
8004 skeleton_class->get_vtable = sensor_threshold_skeleton_dbus_interface_get_vtable;
8005
8006#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
8007 g_type_class_add_private (klass, sizeof (SensorThresholdSkeletonPrivate));
8008#endif
8009}
8010
8011static void
8012sensor_threshold_skeleton_iface_init (SensorThresholdIface *iface)
8013{
8014 iface->warning = _sensor_threshold_on_signal_warning;
8015 iface->critical = _sensor_threshold_on_signal_critical;
8016 iface->normal = _sensor_threshold_on_signal_normal;
8017 iface->get_lower_critical = sensor_threshold_skeleton_get_lower_critical;
8018 iface->get_lower_warning = sensor_threshold_skeleton_get_lower_warning;
8019 iface->get_upper_warning = sensor_threshold_skeleton_get_upper_warning;
8020 iface->get_upper_critical = sensor_threshold_skeleton_get_upper_critical;
8021 iface->get_state = sensor_threshold_skeleton_get_state;
8022}
8023
8024/**
8025 * sensor_threshold_skeleton_new:
8026 *
8027 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link>.
8028 *
8029 * Returns: (transfer full) (type SensorThresholdSkeleton): The skeleton object.
8030 */
8031SensorThreshold *
8032sensor_threshold_skeleton_new (void)
8033{
8034 return SENSOR_THRESHOLD (g_object_new (TYPE_SENSOR_THRESHOLD_SKELETON, NULL));
8035}
8036
8037/* ------------------------------------------------------------------------
8038 * Code for interface org.openbmc.SensorI2c
8039 * ------------------------------------------------------------------------
8040 */
8041
8042/**
8043 * SECTION:SensorI2c
8044 * @title: SensorI2c
8045 * @short_description: Generated C code for the org.openbmc.SensorI2c D-Bus interface
8046 *
8047 * 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.
8048 */
8049
8050/* ---- Introspection data for org.openbmc.SensorI2c ---- */
8051
8052static const _ExtendedGDBusPropertyInfo _sensor_i2c_property_info_dev_path =
8053{
8054 {
8055 -1,
8056 (gchar *) "dev_path",
8057 (gchar *) "s",
8058 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
8059 NULL
8060 },
8061 "dev-path",
8062 FALSE
8063};
8064
8065static const _ExtendedGDBusPropertyInfo _sensor_i2c_property_info_address =
8066{
8067 {
8068 -1,
8069 (gchar *) "address",
8070 (gchar *) "s",
8071 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
8072 NULL
8073 },
8074 "address",
8075 FALSE
8076};
8077
8078static const _ExtendedGDBusPropertyInfo * const _sensor_i2c_property_info_pointers[] =
8079{
8080 &_sensor_i2c_property_info_dev_path,
8081 &_sensor_i2c_property_info_address,
8082 NULL
8083};
8084
8085static const _ExtendedGDBusInterfaceInfo _sensor_i2c_interface_info =
8086{
8087 {
8088 -1,
8089 (gchar *) "org.openbmc.SensorI2c",
8090 NULL,
8091 NULL,
8092 (GDBusPropertyInfo **) &_sensor_i2c_property_info_pointers,
8093 NULL
8094 },
8095 "sensor-i2c",
8096};
8097
8098
8099/**
8100 * sensor_i2c_interface_info:
8101 *
8102 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link> D-Bus interface.
8103 *
8104 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
8105 */
8106GDBusInterfaceInfo *
8107sensor_i2c_interface_info (void)
8108{
8109 return (GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct;
8110}
8111
8112/**
8113 * sensor_i2c_override_properties:
8114 * @klass: The class structure for a #GObject<!-- -->-derived class.
8115 * @property_id_begin: The property id to assign to the first overridden property.
8116 *
8117 * Overrides all #GObject properties in the #SensorI2c interface for a concrete class.
8118 * The properties are overridden in the order they are defined.
8119 *
8120 * Returns: The last property id.
8121 */
8122guint
8123sensor_i2c_override_properties (GObjectClass *klass, guint property_id_begin)
8124{
8125 g_object_class_override_property (klass, property_id_begin++, "dev-path");
8126 g_object_class_override_property (klass, property_id_begin++, "address");
8127 return property_id_begin - 1;
8128}
8129
8130
8131
8132/**
8133 * SensorI2c:
8134 *
8135 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>.
8136 */
8137
8138/**
8139 * SensorI2cIface:
8140 * @parent_iface: The parent interface.
8141 * @get_address: Getter for the #SensorI2c:address property.
8142 * @get_dev_path: Getter for the #SensorI2c:dev-path property.
8143 *
8144 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>.
8145 */
8146
8147typedef SensorI2cIface SensorI2cInterface;
8148G_DEFINE_INTERFACE (SensorI2c, sensor_i2c, G_TYPE_OBJECT);
8149
8150static void
8151sensor_i2c_default_init (SensorI2cIface *iface)
8152{
8153 /* GObject properties for D-Bus properties: */
8154 /**
8155 * SensorI2c:dev-path:
8156 *
8157 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link>.
8158 *
8159 * 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.
8160 */
8161 g_object_interface_install_property (iface,
8162 g_param_spec_string ("dev-path", "dev_path", "dev_path", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
8163 /**
8164 * SensorI2c:address:
8165 *
8166 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link>.
8167 *
8168 * 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.
8169 */
8170 g_object_interface_install_property (iface,
8171 g_param_spec_string ("address", "address", "address", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
8172}
8173
8174/**
8175 * sensor_i2c_get_dev_path: (skip)
8176 * @object: A #SensorI2c.
8177 *
8178 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link> D-Bus property.
8179 *
8180 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
8181 *
8182 * <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>
8183 *
8184 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
8185 */
8186const gchar *
8187sensor_i2c_get_dev_path (SensorI2c *object)
8188{
8189 return SENSOR_I2C_GET_IFACE (object)->get_dev_path (object);
8190}
8191
8192/**
8193 * sensor_i2c_dup_dev_path: (skip)
8194 * @object: A #SensorI2c.
8195 *
8196 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link> D-Bus property.
8197 *
8198 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
8199 *
8200 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
8201 */
8202gchar *
8203sensor_i2c_dup_dev_path (SensorI2c *object)
8204{
8205 gchar *value;
8206 g_object_get (G_OBJECT (object), "dev-path", &value, NULL);
8207 return value;
8208}
8209
8210/**
8211 * sensor_i2c_set_dev_path: (skip)
8212 * @object: A #SensorI2c.
8213 * @value: The value to set.
8214 *
8215 * Sets the <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link> D-Bus property to @value.
8216 *
8217 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
8218 */
8219void
8220sensor_i2c_set_dev_path (SensorI2c *object, const gchar *value)
8221{
8222 g_object_set (G_OBJECT (object), "dev-path", value, NULL);
8223}
8224
8225/**
8226 * sensor_i2c_get_address: (skip)
8227 * @object: A #SensorI2c.
8228 *
8229 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link> D-Bus property.
8230 *
8231 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
8232 *
8233 * <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>
8234 *
8235 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
8236 */
8237const gchar *
8238sensor_i2c_get_address (SensorI2c *object)
8239{
8240 return SENSOR_I2C_GET_IFACE (object)->get_address (object);
8241}
8242
8243/**
8244 * sensor_i2c_dup_address: (skip)
8245 * @object: A #SensorI2c.
8246 *
8247 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link> D-Bus property.
8248 *
8249 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
8250 *
8251 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
8252 */
8253gchar *
8254sensor_i2c_dup_address (SensorI2c *object)
8255{
8256 gchar *value;
8257 g_object_get (G_OBJECT (object), "address", &value, NULL);
8258 return value;
8259}
8260
8261/**
8262 * sensor_i2c_set_address: (skip)
8263 * @object: A #SensorI2c.
8264 * @value: The value to set.
8265 *
8266 * Sets the <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link> D-Bus property to @value.
8267 *
8268 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
8269 */
8270void
8271sensor_i2c_set_address (SensorI2c *object, const gchar *value)
8272{
8273 g_object_set (G_OBJECT (object), "address", value, NULL);
8274}
8275
8276/* ------------------------------------------------------------------------ */
8277
8278/**
8279 * SensorI2cProxy:
8280 *
8281 * The #SensorI2cProxy structure contains only private data and should only be accessed using the provided API.
8282 */
8283
8284/**
8285 * SensorI2cProxyClass:
8286 * @parent_class: The parent class.
8287 *
8288 * Class structure for #SensorI2cProxy.
8289 */
8290
8291struct _SensorI2cProxyPrivate
8292{
8293 GData *qdata;
8294};
8295
8296static void sensor_i2c_proxy_iface_init (SensorI2cIface *iface);
8297
8298#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
8299G_DEFINE_TYPE_WITH_CODE (SensorI2cProxy, sensor_i2c_proxy, G_TYPE_DBUS_PROXY,
8300 G_ADD_PRIVATE (SensorI2cProxy)
8301 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_proxy_iface_init));
8302
8303#else
8304G_DEFINE_TYPE_WITH_CODE (SensorI2cProxy, sensor_i2c_proxy, G_TYPE_DBUS_PROXY,
8305 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_proxy_iface_init));
8306
8307#endif
8308static void
8309sensor_i2c_proxy_finalize (GObject *object)
8310{
8311 SensorI2cProxy *proxy = SENSOR_I2C_PROXY (object);
8312 g_datalist_clear (&proxy->priv->qdata);
8313 G_OBJECT_CLASS (sensor_i2c_proxy_parent_class)->finalize (object);
8314}
8315
8316static void
8317sensor_i2c_proxy_get_property (GObject *object,
8318 guint prop_id,
8319 GValue *value,
8320 GParamSpec *pspec G_GNUC_UNUSED)
8321{
8322 const _ExtendedGDBusPropertyInfo *info;
8323 GVariant *variant;
8324 g_assert (prop_id != 0 && prop_id - 1 < 2);
8325 info = _sensor_i2c_property_info_pointers[prop_id - 1];
8326 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
8327 if (info->use_gvariant)
8328 {
8329 g_value_set_variant (value, variant);
8330 }
8331 else
8332 {
8333 if (variant != NULL)
8334 g_dbus_gvariant_to_gvalue (variant, value);
8335 }
8336 if (variant != NULL)
8337 g_variant_unref (variant);
8338}
8339
8340static void
8341sensor_i2c_proxy_set_property_cb (GDBusProxy *proxy,
8342 GAsyncResult *res,
8343 gpointer user_data)
8344{
8345 const _ExtendedGDBusPropertyInfo *info = user_data;
8346 GError *error;
8347 GVariant *_ret;
8348 error = NULL;
8349 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
8350 if (!_ret)
8351 {
8352 g_warning ("Error setting property '%s' on interface org.openbmc.SensorI2c: %s (%s, %d)",
8353 info->parent_struct.name,
8354 error->message, g_quark_to_string (error->domain), error->code);
8355 g_error_free (error);
8356 }
8357 else
8358 {
8359 g_variant_unref (_ret);
8360 }
8361}
8362
8363static void
8364sensor_i2c_proxy_set_property (GObject *object,
8365 guint prop_id,
8366 const GValue *value,
8367 GParamSpec *pspec G_GNUC_UNUSED)
8368{
8369 const _ExtendedGDBusPropertyInfo *info;
8370 GVariant *variant;
8371 g_assert (prop_id != 0 && prop_id - 1 < 2);
8372 info = _sensor_i2c_property_info_pointers[prop_id - 1];
8373 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
8374 g_dbus_proxy_call (G_DBUS_PROXY (object),
8375 "org.freedesktop.DBus.Properties.Set",
8376 g_variant_new ("(ssv)", "org.openbmc.SensorI2c", info->parent_struct.name, variant),
8377 G_DBUS_CALL_FLAGS_NONE,
8378 -1,
8379 NULL, (GAsyncReadyCallback) sensor_i2c_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
8380 g_variant_unref (variant);
8381}
8382
8383static void
8384sensor_i2c_proxy_g_signal (GDBusProxy *proxy,
8385 const gchar *sender_name G_GNUC_UNUSED,
8386 const gchar *signal_name,
8387 GVariant *parameters)
8388{
8389 _ExtendedGDBusSignalInfo *info;
8390 GVariantIter iter;
8391 GVariant *child;
8392 GValue *paramv;
8393 guint num_params;
8394 guint n;
8395 guint signal_id;
8396 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, signal_name);
8397 if (info == NULL)
8398 return;
8399 num_params = g_variant_n_children (parameters);
8400 paramv = g_new0 (GValue, num_params + 1);
8401 g_value_init (&paramv[0], TYPE_SENSOR_I2C);
8402 g_value_set_object (&paramv[0], proxy);
8403 g_variant_iter_init (&iter, parameters);
8404 n = 1;
8405 while ((child = g_variant_iter_next_value (&iter)) != NULL)
8406 {
8407 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
8408 if (arg_info->use_gvariant)
8409 {
8410 g_value_init (&paramv[n], G_TYPE_VARIANT);
8411 g_value_set_variant (&paramv[n], child);
8412 n++;
8413 }
8414 else
8415 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
8416 g_variant_unref (child);
8417 }
8418 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_I2C);
8419 g_signal_emitv (paramv, signal_id, 0, NULL);
8420 for (n = 0; n < num_params + 1; n++)
8421 g_value_unset (&paramv[n]);
8422 g_free (paramv);
8423}
8424
8425static void
8426sensor_i2c_proxy_g_properties_changed (GDBusProxy *_proxy,
8427 GVariant *changed_properties,
8428 const gchar *const *invalidated_properties)
8429{
8430 SensorI2cProxy *proxy = SENSOR_I2C_PROXY (_proxy);
8431 guint n;
8432 const gchar *key;
8433 GVariantIter *iter;
8434 _ExtendedGDBusPropertyInfo *info;
8435 g_variant_get (changed_properties, "a{sv}", &iter);
8436 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
8437 {
8438 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, key);
8439 g_datalist_remove_data (&proxy->priv->qdata, key);
8440 if (info != NULL)
8441 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
8442 }
8443 g_variant_iter_free (iter);
8444 for (n = 0; invalidated_properties[n] != NULL; n++)
8445 {
8446 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, invalidated_properties[n]);
8447 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
8448 if (info != NULL)
8449 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
8450 }
8451}
8452
8453static const gchar *
8454sensor_i2c_proxy_get_dev_path (SensorI2c *object)
8455{
8456 SensorI2cProxy *proxy = SENSOR_I2C_PROXY (object);
8457 GVariant *variant;
8458 const gchar *value = NULL;
8459 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "dev_path");
8460 if (variant != NULL)
8461 {
8462 value = g_variant_get_string (variant, NULL);
8463 g_variant_unref (variant);
8464 }
8465 return value;
8466}
8467
8468static const gchar *
8469sensor_i2c_proxy_get_address (SensorI2c *object)
8470{
8471 SensorI2cProxy *proxy = SENSOR_I2C_PROXY (object);
8472 GVariant *variant;
8473 const gchar *value = NULL;
8474 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "address");
8475 if (variant != NULL)
8476 {
8477 value = g_variant_get_string (variant, NULL);
8478 g_variant_unref (variant);
8479 }
8480 return value;
8481}
8482
8483static void
8484sensor_i2c_proxy_init (SensorI2cProxy *proxy)
8485{
8486#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
8487 proxy->priv = sensor_i2c_proxy_get_instance_private (proxy);
8488#else
8489 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_I2C_PROXY, SensorI2cProxyPrivate);
8490#endif
8491
8492 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_i2c_interface_info ());
8493}
8494
8495static void
8496sensor_i2c_proxy_class_init (SensorI2cProxyClass *klass)
8497{
8498 GObjectClass *gobject_class;
8499 GDBusProxyClass *proxy_class;
8500
8501 gobject_class = G_OBJECT_CLASS (klass);
8502 gobject_class->finalize = sensor_i2c_proxy_finalize;
8503 gobject_class->get_property = sensor_i2c_proxy_get_property;
8504 gobject_class->set_property = sensor_i2c_proxy_set_property;
8505
8506 proxy_class = G_DBUS_PROXY_CLASS (klass);
8507 proxy_class->g_signal = sensor_i2c_proxy_g_signal;
8508 proxy_class->g_properties_changed = sensor_i2c_proxy_g_properties_changed;
8509
8510 sensor_i2c_override_properties (gobject_class, 1);
8511
8512#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
8513 g_type_class_add_private (klass, sizeof (SensorI2cProxyPrivate));
8514#endif
8515}
8516
8517static void
8518sensor_i2c_proxy_iface_init (SensorI2cIface *iface)
8519{
8520 iface->get_dev_path = sensor_i2c_proxy_get_dev_path;
8521 iface->get_address = sensor_i2c_proxy_get_address;
8522}
8523
8524/**
8525 * sensor_i2c_proxy_new:
8526 * @connection: A #GDBusConnection.
8527 * @flags: Flags from the #GDBusProxyFlags enumeration.
8528 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
8529 * @object_path: An object path.
8530 * @cancellable: (allow-none): A #GCancellable or %NULL.
8531 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
8532 * @user_data: User data to pass to @callback.
8533 *
8534 * 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.
8535 *
8536 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
8537 * You can then call sensor_i2c_proxy_new_finish() to get the result of the operation.
8538 *
8539 * See sensor_i2c_proxy_new_sync() for the synchronous, blocking version of this constructor.
8540 */
8541void
8542sensor_i2c_proxy_new (
8543 GDBusConnection *connection,
8544 GDBusProxyFlags flags,
8545 const gchar *name,
8546 const gchar *object_path,
8547 GCancellable *cancellable,
8548 GAsyncReadyCallback callback,
8549 gpointer user_data)
8550{
8551 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);
8552}
8553
8554/**
8555 * sensor_i2c_proxy_new_finish:
8556 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_i2c_proxy_new().
8557 * @error: Return location for error or %NULL
8558 *
8559 * Finishes an operation started with sensor_i2c_proxy_new().
8560 *
8561 * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set.
8562 */
8563SensorI2c *
8564sensor_i2c_proxy_new_finish (
8565 GAsyncResult *res,
8566 GError **error)
8567{
8568 GObject *ret;
8569 GObject *source_object;
8570 source_object = g_async_result_get_source_object (res);
8571 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
8572 g_object_unref (source_object);
8573 if (ret != NULL)
8574 return SENSOR_I2C (ret);
8575 else
8576 return NULL;
8577}
8578
8579/**
8580 * sensor_i2c_proxy_new_sync:
8581 * @connection: A #GDBusConnection.
8582 * @flags: Flags from the #GDBusProxyFlags enumeration.
8583 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
8584 * @object_path: An object path.
8585 * @cancellable: (allow-none): A #GCancellable or %NULL.
8586 * @error: Return location for error or %NULL
8587 *
8588 * 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.
8589 *
8590 * The calling thread is blocked until a reply is received.
8591 *
8592 * See sensor_i2c_proxy_new() for the asynchronous version of this constructor.
8593 *
8594 * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set.
8595 */
8596SensorI2c *
8597sensor_i2c_proxy_new_sync (
8598 GDBusConnection *connection,
8599 GDBusProxyFlags flags,
8600 const gchar *name,
8601 const gchar *object_path,
8602 GCancellable *cancellable,
8603 GError **error)
8604{
8605 GInitable *ret;
8606 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);
8607 if (ret != NULL)
8608 return SENSOR_I2C (ret);
8609 else
8610 return NULL;
8611}
8612
8613
8614/**
8615 * sensor_i2c_proxy_new_for_bus:
8616 * @bus_type: A #GBusType.
8617 * @flags: Flags from the #GDBusProxyFlags enumeration.
8618 * @name: A bus name (well-known or unique).
8619 * @object_path: An object path.
8620 * @cancellable: (allow-none): A #GCancellable or %NULL.
8621 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
8622 * @user_data: User data to pass to @callback.
8623 *
8624 * Like sensor_i2c_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
8625 *
8626 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
8627 * You can then call sensor_i2c_proxy_new_for_bus_finish() to get the result of the operation.
8628 *
8629 * See sensor_i2c_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
8630 */
8631void
8632sensor_i2c_proxy_new_for_bus (
8633 GBusType bus_type,
8634 GDBusProxyFlags flags,
8635 const gchar *name,
8636 const gchar *object_path,
8637 GCancellable *cancellable,
8638 GAsyncReadyCallback callback,
8639 gpointer user_data)
8640{
8641 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);
8642}
8643
8644/**
8645 * sensor_i2c_proxy_new_for_bus_finish:
8646 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_i2c_proxy_new_for_bus().
8647 * @error: Return location for error or %NULL
8648 *
8649 * Finishes an operation started with sensor_i2c_proxy_new_for_bus().
8650 *
8651 * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set.
8652 */
8653SensorI2c *
8654sensor_i2c_proxy_new_for_bus_finish (
8655 GAsyncResult *res,
8656 GError **error)
8657{
8658 GObject *ret;
8659 GObject *source_object;
8660 source_object = g_async_result_get_source_object (res);
8661 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
8662 g_object_unref (source_object);
8663 if (ret != NULL)
8664 return SENSOR_I2C (ret);
8665 else
8666 return NULL;
8667}
8668
8669/**
8670 * sensor_i2c_proxy_new_for_bus_sync:
8671 * @bus_type: A #GBusType.
8672 * @flags: Flags from the #GDBusProxyFlags enumeration.
8673 * @name: A bus name (well-known or unique).
8674 * @object_path: An object path.
8675 * @cancellable: (allow-none): A #GCancellable or %NULL.
8676 * @error: Return location for error or %NULL
8677 *
8678 * Like sensor_i2c_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
8679 *
8680 * The calling thread is blocked until a reply is received.
8681 *
8682 * See sensor_i2c_proxy_new_for_bus() for the asynchronous version of this constructor.
8683 *
8684 * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set.
8685 */
8686SensorI2c *
8687sensor_i2c_proxy_new_for_bus_sync (
8688 GBusType bus_type,
8689 GDBusProxyFlags flags,
8690 const gchar *name,
8691 const gchar *object_path,
8692 GCancellable *cancellable,
8693 GError **error)
8694{
8695 GInitable *ret;
8696 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);
8697 if (ret != NULL)
8698 return SENSOR_I2C (ret);
8699 else
8700 return NULL;
8701}
8702
8703
8704/* ------------------------------------------------------------------------ */
8705
8706/**
8707 * SensorI2cSkeleton:
8708 *
8709 * The #SensorI2cSkeleton structure contains only private data and should only be accessed using the provided API.
8710 */
8711
8712/**
8713 * SensorI2cSkeletonClass:
8714 * @parent_class: The parent class.
8715 *
8716 * Class structure for #SensorI2cSkeleton.
8717 */
8718
8719struct _SensorI2cSkeletonPrivate
8720{
8721 GValue *properties;
8722 GList *changed_properties;
8723 GSource *changed_properties_idle_source;
8724 GMainContext *context;
8725 GMutex lock;
8726};
8727
8728static void
8729_sensor_i2c_skeleton_handle_method_call (
8730 GDBusConnection *connection G_GNUC_UNUSED,
8731 const gchar *sender G_GNUC_UNUSED,
8732 const gchar *object_path G_GNUC_UNUSED,
8733 const gchar *interface_name,
8734 const gchar *method_name,
8735 GVariant *parameters,
8736 GDBusMethodInvocation *invocation,
8737 gpointer user_data)
8738{
8739 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data);
8740 _ExtendedGDBusMethodInfo *info;
8741 GVariantIter iter;
8742 GVariant *child;
8743 GValue *paramv;
8744 guint num_params;
8745 guint num_extra;
8746 guint n;
8747 guint signal_id;
8748 GValue return_value = G_VALUE_INIT;
8749 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
8750 g_assert (info != NULL);
8751 num_params = g_variant_n_children (parameters);
8752 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
8753 n = 0;
8754 g_value_init (&paramv[n], TYPE_SENSOR_I2C);
8755 g_value_set_object (&paramv[n++], skeleton);
8756 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
8757 g_value_set_object (&paramv[n++], invocation);
8758 if (info->pass_fdlist)
8759 {
8760#ifdef G_OS_UNIX
8761 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
8762 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
8763#else
8764 g_assert_not_reached ();
8765#endif
8766 }
8767 g_variant_iter_init (&iter, parameters);
8768 while ((child = g_variant_iter_next_value (&iter)) != NULL)
8769 {
8770 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
8771 if (arg_info->use_gvariant)
8772 {
8773 g_value_init (&paramv[n], G_TYPE_VARIANT);
8774 g_value_set_variant (&paramv[n], child);
8775 n++;
8776 }
8777 else
8778 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
8779 g_variant_unref (child);
8780 }
8781 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_I2C);
8782 g_value_init (&return_value, G_TYPE_BOOLEAN);
8783 g_signal_emitv (paramv, signal_id, 0, &return_value);
8784 if (!g_value_get_boolean (&return_value))
8785 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);
8786 g_value_unset (&return_value);
8787 for (n = 0; n < num_params + num_extra; n++)
8788 g_value_unset (&paramv[n]);
8789 g_free (paramv);
8790}
8791
8792static GVariant *
8793_sensor_i2c_skeleton_handle_get_property (
8794 GDBusConnection *connection G_GNUC_UNUSED,
8795 const gchar *sender G_GNUC_UNUSED,
8796 const gchar *object_path G_GNUC_UNUSED,
8797 const gchar *interface_name G_GNUC_UNUSED,
8798 const gchar *property_name,
8799 GError **error,
8800 gpointer user_data)
8801{
8802 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data);
8803 GValue value = G_VALUE_INIT;
8804 GParamSpec *pspec;
8805 _ExtendedGDBusPropertyInfo *info;
8806 GVariant *ret;
8807 ret = NULL;
8808 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, property_name);
8809 g_assert (info != NULL);
8810 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
8811 if (pspec == NULL)
8812 {
8813 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
8814 }
8815 else
8816 {
8817 g_value_init (&value, pspec->value_type);
8818 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
8819 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
8820 g_value_unset (&value);
8821 }
8822 return ret;
8823}
8824
8825static gboolean
8826_sensor_i2c_skeleton_handle_set_property (
8827 GDBusConnection *connection G_GNUC_UNUSED,
8828 const gchar *sender G_GNUC_UNUSED,
8829 const gchar *object_path G_GNUC_UNUSED,
8830 const gchar *interface_name G_GNUC_UNUSED,
8831 const gchar *property_name,
8832 GVariant *variant,
8833 GError **error,
8834 gpointer user_data)
8835{
8836 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data);
8837 GValue value = G_VALUE_INIT;
8838 GParamSpec *pspec;
8839 _ExtendedGDBusPropertyInfo *info;
8840 gboolean ret;
8841 ret = FALSE;
8842 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, property_name);
8843 g_assert (info != NULL);
8844 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
8845 if (pspec == NULL)
8846 {
8847 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
8848 }
8849 else
8850 {
8851 if (info->use_gvariant)
8852 g_value_set_variant (&value, variant);
8853 else
8854 g_dbus_gvariant_to_gvalue (variant, &value);
8855 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
8856 g_value_unset (&value);
8857 ret = TRUE;
8858 }
8859 return ret;
8860}
8861
8862static const GDBusInterfaceVTable _sensor_i2c_skeleton_vtable =
8863{
8864 _sensor_i2c_skeleton_handle_method_call,
8865 _sensor_i2c_skeleton_handle_get_property,
8866 _sensor_i2c_skeleton_handle_set_property,
8867 {NULL}
8868};
8869
8870static GDBusInterfaceInfo *
8871sensor_i2c_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
8872{
8873 return sensor_i2c_interface_info ();
8874}
8875
8876static GDBusInterfaceVTable *
8877sensor_i2c_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
8878{
8879 return (GDBusInterfaceVTable *) &_sensor_i2c_skeleton_vtable;
8880}
8881
8882static GVariant *
8883sensor_i2c_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
8884{
8885 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (_skeleton);
8886
8887 GVariantBuilder builder;
8888 guint n;
8889 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
8890 if (_sensor_i2c_interface_info.parent_struct.properties == NULL)
8891 goto out;
8892 for (n = 0; _sensor_i2c_interface_info.parent_struct.properties[n] != NULL; n++)
8893 {
8894 GDBusPropertyInfo *info = _sensor_i2c_interface_info.parent_struct.properties[n];
8895 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
8896 {
8897 GVariant *value;
8898 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);
8899 if (value != NULL)
8900 {
8901 g_variant_take_ref (value);
8902 g_variant_builder_add (&builder, "{sv}", info->name, value);
8903 g_variant_unref (value);
8904 }
8905 }
8906 }
8907out:
8908 return g_variant_builder_end (&builder);
8909}
8910
8911static gboolean _sensor_i2c_emit_changed (gpointer user_data);
8912
8913static void
8914sensor_i2c_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
8915{
8916 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (_skeleton);
8917 gboolean emit_changed = FALSE;
8918
8919 g_mutex_lock (&skeleton->priv->lock);
8920 if (skeleton->priv->changed_properties_idle_source != NULL)
8921 {
8922 g_source_destroy (skeleton->priv->changed_properties_idle_source);
8923 skeleton->priv->changed_properties_idle_source = NULL;
8924 emit_changed = TRUE;
8925 }
8926 g_mutex_unlock (&skeleton->priv->lock);
8927
8928 if (emit_changed)
8929 _sensor_i2c_emit_changed (skeleton);
8930}
8931
8932static void sensor_i2c_skeleton_iface_init (SensorI2cIface *iface);
8933#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
8934G_DEFINE_TYPE_WITH_CODE (SensorI2cSkeleton, sensor_i2c_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
8935 G_ADD_PRIVATE (SensorI2cSkeleton)
8936 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_skeleton_iface_init));
8937
8938#else
8939G_DEFINE_TYPE_WITH_CODE (SensorI2cSkeleton, sensor_i2c_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
8940 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_skeleton_iface_init));
8941
8942#endif
8943static void
8944sensor_i2c_skeleton_finalize (GObject *object)
8945{
8946 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
8947 guint n;
8948 for (n = 0; n < 2; n++)
8949 g_value_unset (&skeleton->priv->properties[n]);
8950 g_free (skeleton->priv->properties);
8951 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
8952 if (skeleton->priv->changed_properties_idle_source != NULL)
8953 g_source_destroy (skeleton->priv->changed_properties_idle_source);
8954 g_main_context_unref (skeleton->priv->context);
8955 g_mutex_clear (&skeleton->priv->lock);
8956 G_OBJECT_CLASS (sensor_i2c_skeleton_parent_class)->finalize (object);
8957}
8958
8959static void
8960sensor_i2c_skeleton_get_property (GObject *object,
8961 guint prop_id,
8962 GValue *value,
8963 GParamSpec *pspec G_GNUC_UNUSED)
8964{
8965 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
8966 g_assert (prop_id != 0 && prop_id - 1 < 2);
8967 g_mutex_lock (&skeleton->priv->lock);
8968 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
8969 g_mutex_unlock (&skeleton->priv->lock);
8970}
8971
8972static gboolean
8973_sensor_i2c_emit_changed (gpointer user_data)
8974{
8975 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data);
8976 GList *l;
8977 GVariantBuilder builder;
8978 GVariantBuilder invalidated_builder;
8979 guint num_changes;
8980
8981 g_mutex_lock (&skeleton->priv->lock);
8982 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
8983 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
8984 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
8985 {
8986 ChangedProperty *cp = l->data;
8987 GVariant *variant;
8988 const GValue *cur_value;
8989
8990 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
8991 if (!_g_value_equal (cur_value, &cp->orig_value))
8992 {
8993 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
8994 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
8995 g_variant_unref (variant);
8996 num_changes++;
8997 }
8998 }
8999 if (num_changes > 0)
9000 {
9001 GList *connections, *ll;
9002 GVariant *signal_variant;
9003 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorI2c",
9004 &builder, &invalidated_builder));
9005 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
9006 for (ll = connections; ll != NULL; ll = ll->next)
9007 {
9008 GDBusConnection *connection = ll->data;
9009
9010 g_dbus_connection_emit_signal (connection,
9011 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
9012 "org.freedesktop.DBus.Properties",
9013 "PropertiesChanged",
9014 signal_variant,
9015 NULL);
9016 }
9017 g_variant_unref (signal_variant);
9018 g_list_free_full (connections, g_object_unref);
9019 }
9020 else
9021 {
9022 g_variant_builder_clear (&builder);
9023 g_variant_builder_clear (&invalidated_builder);
9024 }
9025 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
9026 skeleton->priv->changed_properties = NULL;
9027 skeleton->priv->changed_properties_idle_source = NULL;
9028 g_mutex_unlock (&skeleton->priv->lock);
9029 return FALSE;
9030}
9031
9032static void
9033_sensor_i2c_schedule_emit_changed (SensorI2cSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
9034{
9035 ChangedProperty *cp;
9036 GList *l;
9037 cp = NULL;
9038 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
9039 {
9040 ChangedProperty *i_cp = l->data;
9041 if (i_cp->info == info)
9042 {
9043 cp = i_cp;
9044 break;
9045 }
9046 }
9047 if (cp == NULL)
9048 {
9049 cp = g_new0 (ChangedProperty, 1);
9050 cp->prop_id = prop_id;
9051 cp->info = info;
9052 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
9053 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
9054 g_value_copy (orig_value, &cp->orig_value);
9055 }
9056}
9057
9058static void
9059sensor_i2c_skeleton_notify (GObject *object,
9060 GParamSpec *pspec G_GNUC_UNUSED)
9061{
9062 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
9063 g_mutex_lock (&skeleton->priv->lock);
9064 if (skeleton->priv->changed_properties != NULL &&
9065 skeleton->priv->changed_properties_idle_source == NULL)
9066 {
9067 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
9068 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
9069 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_i2c_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
Adriana Kobylakfd778822016-06-16 09:08:37 -05009070 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _sensor_i2c_emit_changed");
Norman James362a80f2015-09-14 14:04:39 -05009071 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
9072 g_source_unref (skeleton->priv->changed_properties_idle_source);
9073 }
9074 g_mutex_unlock (&skeleton->priv->lock);
9075}
9076
9077static void
9078sensor_i2c_skeleton_set_property (GObject *object,
9079 guint prop_id,
9080 const GValue *value,
9081 GParamSpec *pspec)
9082{
9083 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
9084 g_assert (prop_id != 0 && prop_id - 1 < 2);
9085 g_mutex_lock (&skeleton->priv->lock);
9086 g_object_freeze_notify (object);
9087 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
9088 {
9089 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
9090 _sensor_i2c_schedule_emit_changed (skeleton, _sensor_i2c_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
9091 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
9092 g_object_notify_by_pspec (object, pspec);
9093 }
9094 g_mutex_unlock (&skeleton->priv->lock);
9095 g_object_thaw_notify (object);
9096}
9097
9098static void
9099sensor_i2c_skeleton_init (SensorI2cSkeleton *skeleton)
9100{
9101#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
9102 skeleton->priv = sensor_i2c_skeleton_get_instance_private (skeleton);
9103#else
9104 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_I2C_SKELETON, SensorI2cSkeletonPrivate);
9105#endif
9106
9107 g_mutex_init (&skeleton->priv->lock);
9108 skeleton->priv->context = g_main_context_ref_thread_default ();
9109 skeleton->priv->properties = g_new0 (GValue, 2);
9110 g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING);
9111 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
9112}
9113
9114static const gchar *
9115sensor_i2c_skeleton_get_dev_path (SensorI2c *object)
9116{
9117 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
9118 const gchar *value;
9119 g_mutex_lock (&skeleton->priv->lock);
9120 value = g_value_get_string (&(skeleton->priv->properties[0]));
9121 g_mutex_unlock (&skeleton->priv->lock);
9122 return value;
9123}
9124
9125static const gchar *
9126sensor_i2c_skeleton_get_address (SensorI2c *object)
9127{
9128 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
9129 const gchar *value;
9130 g_mutex_lock (&skeleton->priv->lock);
9131 value = g_value_get_string (&(skeleton->priv->properties[1]));
9132 g_mutex_unlock (&skeleton->priv->lock);
9133 return value;
9134}
9135
9136static void
9137sensor_i2c_skeleton_class_init (SensorI2cSkeletonClass *klass)
9138{
9139 GObjectClass *gobject_class;
9140 GDBusInterfaceSkeletonClass *skeleton_class;
9141
9142 gobject_class = G_OBJECT_CLASS (klass);
9143 gobject_class->finalize = sensor_i2c_skeleton_finalize;
9144 gobject_class->get_property = sensor_i2c_skeleton_get_property;
9145 gobject_class->set_property = sensor_i2c_skeleton_set_property;
9146 gobject_class->notify = sensor_i2c_skeleton_notify;
9147
9148
9149 sensor_i2c_override_properties (gobject_class, 1);
9150
9151 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
9152 skeleton_class->get_info = sensor_i2c_skeleton_dbus_interface_get_info;
9153 skeleton_class->get_properties = sensor_i2c_skeleton_dbus_interface_get_properties;
9154 skeleton_class->flush = sensor_i2c_skeleton_dbus_interface_flush;
9155 skeleton_class->get_vtable = sensor_i2c_skeleton_dbus_interface_get_vtable;
9156
9157#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
9158 g_type_class_add_private (klass, sizeof (SensorI2cSkeletonPrivate));
9159#endif
9160}
9161
9162static void
9163sensor_i2c_skeleton_iface_init (SensorI2cIface *iface)
9164{
9165 iface->get_dev_path = sensor_i2c_skeleton_get_dev_path;
9166 iface->get_address = sensor_i2c_skeleton_get_address;
9167}
9168
9169/**
9170 * sensor_i2c_skeleton_new:
9171 *
9172 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>.
9173 *
9174 * Returns: (transfer full) (type SensorI2cSkeleton): The skeleton object.
9175 */
9176SensorI2c *
9177sensor_i2c_skeleton_new (void)
9178{
9179 return SENSOR_I2C (g_object_new (TYPE_SENSOR_I2C_SKELETON, NULL));
9180}
9181
9182/* ------------------------------------------------------------------------
9183 * Code for interface org.openbmc.SensorMatch
9184 * ------------------------------------------------------------------------
9185 */
9186
9187/**
9188 * SECTION:SensorMatch
9189 * @title: SensorMatch
9190 * @short_description: Generated C code for the org.openbmc.SensorMatch D-Bus interface
9191 *
9192 * 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.
9193 */
9194
9195/* ---- Introspection data for org.openbmc.SensorMatch ---- */
9196
9197static const _ExtendedGDBusArgInfo _sensor_match_signal_info_sensor_match_ARG_state =
9198{
9199 {
9200 -1,
9201 (gchar *) "state",
9202 (gchar *) "y",
9203 NULL
9204 },
9205 FALSE
9206};
9207
9208static const _ExtendedGDBusArgInfo * const _sensor_match_signal_info_sensor_match_ARG_pointers[] =
9209{
9210 &_sensor_match_signal_info_sensor_match_ARG_state,
9211 NULL
9212};
9213
9214static const _ExtendedGDBusSignalInfo _sensor_match_signal_info_sensor_match =
9215{
9216 {
9217 -1,
9218 (gchar *) "SensorMatch",
9219 (GDBusArgInfo **) &_sensor_match_signal_info_sensor_match_ARG_pointers,
9220 NULL
9221 },
9222 "sensor-match"
9223};
9224
9225static const _ExtendedGDBusSignalInfo * const _sensor_match_signal_info_pointers[] =
9226{
9227 &_sensor_match_signal_info_sensor_match,
9228 NULL
9229};
9230
9231static const _ExtendedGDBusPropertyInfo _sensor_match_property_info_match_value =
9232{
9233 {
9234 -1,
9235 (gchar *) "match_value",
9236 (gchar *) "v",
9237 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
9238 NULL
9239 },
9240 "match-value",
9241 FALSE
9242};
9243
9244static const _ExtendedGDBusPropertyInfo _sensor_match_property_info_state =
9245{
9246 {
9247 -1,
9248 (gchar *) "state",
9249 (gchar *) "y",
9250 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
9251 NULL
9252 },
9253 "state",
9254 FALSE
9255};
9256
9257static const _ExtendedGDBusPropertyInfo * const _sensor_match_property_info_pointers[] =
9258{
9259 &_sensor_match_property_info_match_value,
9260 &_sensor_match_property_info_state,
9261 NULL
9262};
9263
9264static const _ExtendedGDBusInterfaceInfo _sensor_match_interface_info =
9265{
9266 {
9267 -1,
9268 (gchar *) "org.openbmc.SensorMatch",
9269 NULL,
9270 (GDBusSignalInfo **) &_sensor_match_signal_info_pointers,
9271 (GDBusPropertyInfo **) &_sensor_match_property_info_pointers,
9272 NULL
9273 },
9274 "sensor-match",
9275};
9276
9277
9278/**
9279 * sensor_match_interface_info:
9280 *
9281 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link> D-Bus interface.
9282 *
9283 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
9284 */
9285GDBusInterfaceInfo *
9286sensor_match_interface_info (void)
9287{
9288 return (GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct;
9289}
9290
9291/**
9292 * sensor_match_override_properties:
9293 * @klass: The class structure for a #GObject<!-- -->-derived class.
9294 * @property_id_begin: The property id to assign to the first overridden property.
9295 *
9296 * Overrides all #GObject properties in the #SensorMatch interface for a concrete class.
9297 * The properties are overridden in the order they are defined.
9298 *
9299 * Returns: The last property id.
9300 */
9301guint
9302sensor_match_override_properties (GObjectClass *klass, guint property_id_begin)
9303{
9304 g_object_class_override_property (klass, property_id_begin++, "match-value");
9305 g_object_class_override_property (klass, property_id_begin++, "state");
9306 return property_id_begin - 1;
9307}
9308
9309
9310
9311/**
9312 * SensorMatch:
9313 *
9314 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>.
9315 */
9316
9317/**
9318 * SensorMatchIface:
9319 * @parent_iface: The parent interface.
9320 * @get_match_value: Getter for the #SensorMatch:match-value property.
9321 * @get_state: Getter for the #SensorMatch:state property.
9322 * @sensor_match: Handler for the #SensorMatch::sensor-match signal.
9323 *
9324 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>.
9325 */
9326
9327typedef SensorMatchIface SensorMatchInterface;
9328G_DEFINE_INTERFACE (SensorMatch, sensor_match, G_TYPE_OBJECT);
9329
9330static void
9331sensor_match_default_init (SensorMatchIface *iface)
9332{
9333 /* GObject signals for received D-Bus signals: */
9334 /**
9335 * SensorMatch::sensor-match:
9336 * @object: A #SensorMatch.
9337 * @arg_state: Argument.
9338 *
9339 * 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.
9340 *
9341 * 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.
9342 */
9343 g_signal_new ("sensor-match",
9344 G_TYPE_FROM_INTERFACE (iface),
9345 G_SIGNAL_RUN_LAST,
9346 G_STRUCT_OFFSET (SensorMatchIface, sensor_match),
9347 NULL,
9348 NULL,
9349 g_cclosure_marshal_generic,
9350 G_TYPE_NONE,
9351 1, G_TYPE_UCHAR);
9352
9353 /* GObject properties for D-Bus properties: */
9354 /**
9355 * SensorMatch:match-value:
9356 *
9357 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link>.
9358 *
9359 * 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.
9360 */
9361 g_object_interface_install_property (iface,
9362 g_param_spec_variant ("match-value", "match_value", "match_value", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
9363 /**
9364 * SensorMatch:state:
9365 *
9366 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorMatch.state">"state"</link>.
9367 *
9368 * 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.
9369 */
9370 g_object_interface_install_property (iface,
9371 g_param_spec_uchar ("state", "state", "state", 0, 255, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
9372}
9373
9374/**
9375 * sensor_match_get_match_value: (skip)
9376 * @object: A #SensorMatch.
9377 *
9378 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link> D-Bus property.
9379 *
9380 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
9381 *
9382 * <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>
9383 *
9384 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
9385 */
9386GVariant *
9387sensor_match_get_match_value (SensorMatch *object)
9388{
9389 return SENSOR_MATCH_GET_IFACE (object)->get_match_value (object);
9390}
9391
9392/**
9393 * sensor_match_dup_match_value: (skip)
9394 * @object: A #SensorMatch.
9395 *
9396 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link> D-Bus property.
9397 *
9398 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
9399 *
9400 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
9401 */
9402GVariant *
9403sensor_match_dup_match_value (SensorMatch *object)
9404{
9405 GVariant *value;
9406 g_object_get (G_OBJECT (object), "match-value", &value, NULL);
9407 return value;
9408}
9409
9410/**
9411 * sensor_match_set_match_value: (skip)
9412 * @object: A #SensorMatch.
9413 * @value: The value to set.
9414 *
9415 * Sets the <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link> D-Bus property to @value.
9416 *
9417 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
9418 */
9419void
9420sensor_match_set_match_value (SensorMatch *object, GVariant *value)
9421{
9422 g_object_set (G_OBJECT (object), "match-value", value, NULL);
9423}
9424
9425/**
9426 * sensor_match_get_state: (skip)
9427 * @object: A #SensorMatch.
9428 *
9429 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorMatch.state">"state"</link> D-Bus property.
9430 *
9431 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
9432 *
9433 * Returns: The property value.
9434 */
9435guchar
9436sensor_match_get_state (SensorMatch *object)
9437{
9438 return SENSOR_MATCH_GET_IFACE (object)->get_state (object);
9439}
9440
9441/**
9442 * sensor_match_set_state: (skip)
9443 * @object: A #SensorMatch.
9444 * @value: The value to set.
9445 *
9446 * Sets the <link linkend="gdbus-property-org-openbmc-SensorMatch.state">"state"</link> D-Bus property to @value.
9447 *
9448 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
9449 */
9450void
9451sensor_match_set_state (SensorMatch *object, guchar value)
9452{
9453 g_object_set (G_OBJECT (object), "state", value, NULL);
9454}
9455
9456/**
9457 * sensor_match_emit_sensor_match:
9458 * @object: A #SensorMatch.
9459 * @arg_state: Argument to pass with the signal.
9460 *
9461 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorMatch.SensorMatch">"SensorMatch"</link> D-Bus signal.
9462 */
9463void
9464sensor_match_emit_sensor_match (
9465 SensorMatch *object,
9466 guchar arg_state)
9467{
9468 g_signal_emit_by_name (object, "sensor-match", arg_state);
9469}
9470
9471/* ------------------------------------------------------------------------ */
9472
9473/**
9474 * SensorMatchProxy:
9475 *
9476 * The #SensorMatchProxy structure contains only private data and should only be accessed using the provided API.
9477 */
9478
9479/**
9480 * SensorMatchProxyClass:
9481 * @parent_class: The parent class.
9482 *
9483 * Class structure for #SensorMatchProxy.
9484 */
9485
9486struct _SensorMatchProxyPrivate
9487{
9488 GData *qdata;
9489};
9490
9491static void sensor_match_proxy_iface_init (SensorMatchIface *iface);
9492
9493#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
9494G_DEFINE_TYPE_WITH_CODE (SensorMatchProxy, sensor_match_proxy, G_TYPE_DBUS_PROXY,
9495 G_ADD_PRIVATE (SensorMatchProxy)
9496 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_proxy_iface_init));
9497
9498#else
9499G_DEFINE_TYPE_WITH_CODE (SensorMatchProxy, sensor_match_proxy, G_TYPE_DBUS_PROXY,
9500 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_proxy_iface_init));
9501
9502#endif
9503static void
9504sensor_match_proxy_finalize (GObject *object)
9505{
9506 SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (object);
9507 g_datalist_clear (&proxy->priv->qdata);
9508 G_OBJECT_CLASS (sensor_match_proxy_parent_class)->finalize (object);
9509}
9510
9511static void
9512sensor_match_proxy_get_property (GObject *object,
9513 guint prop_id,
9514 GValue *value,
9515 GParamSpec *pspec G_GNUC_UNUSED)
9516{
9517 const _ExtendedGDBusPropertyInfo *info;
9518 GVariant *variant;
9519 g_assert (prop_id != 0 && prop_id - 1 < 2);
9520 info = _sensor_match_property_info_pointers[prop_id - 1];
9521 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
9522 if (info->use_gvariant)
9523 {
9524 g_value_set_variant (value, variant);
9525 }
9526 else
9527 {
9528 if (variant != NULL)
9529 g_dbus_gvariant_to_gvalue (variant, value);
9530 }
9531 if (variant != NULL)
9532 g_variant_unref (variant);
9533}
9534
9535static void
9536sensor_match_proxy_set_property_cb (GDBusProxy *proxy,
9537 GAsyncResult *res,
9538 gpointer user_data)
9539{
9540 const _ExtendedGDBusPropertyInfo *info = user_data;
9541 GError *error;
9542 GVariant *_ret;
9543 error = NULL;
9544 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
9545 if (!_ret)
9546 {
9547 g_warning ("Error setting property '%s' on interface org.openbmc.SensorMatch: %s (%s, %d)",
9548 info->parent_struct.name,
9549 error->message, g_quark_to_string (error->domain), error->code);
9550 g_error_free (error);
9551 }
9552 else
9553 {
9554 g_variant_unref (_ret);
9555 }
9556}
9557
9558static void
9559sensor_match_proxy_set_property (GObject *object,
9560 guint prop_id,
9561 const GValue *value,
9562 GParamSpec *pspec G_GNUC_UNUSED)
9563{
9564 const _ExtendedGDBusPropertyInfo *info;
9565 GVariant *variant;
9566 g_assert (prop_id != 0 && prop_id - 1 < 2);
9567 info = _sensor_match_property_info_pointers[prop_id - 1];
9568 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
9569 g_dbus_proxy_call (G_DBUS_PROXY (object),
9570 "org.freedesktop.DBus.Properties.Set",
9571 g_variant_new ("(ssv)", "org.openbmc.SensorMatch", info->parent_struct.name, variant),
9572 G_DBUS_CALL_FLAGS_NONE,
9573 -1,
9574 NULL, (GAsyncReadyCallback) sensor_match_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
9575 g_variant_unref (variant);
9576}
9577
9578static void
9579sensor_match_proxy_g_signal (GDBusProxy *proxy,
9580 const gchar *sender_name G_GNUC_UNUSED,
9581 const gchar *signal_name,
9582 GVariant *parameters)
9583{
9584 _ExtendedGDBusSignalInfo *info;
9585 GVariantIter iter;
9586 GVariant *child;
9587 GValue *paramv;
9588 guint num_params;
9589 guint n;
9590 guint signal_id;
9591 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, signal_name);
9592 if (info == NULL)
9593 return;
9594 num_params = g_variant_n_children (parameters);
9595 paramv = g_new0 (GValue, num_params + 1);
9596 g_value_init (&paramv[0], TYPE_SENSOR_MATCH);
9597 g_value_set_object (&paramv[0], proxy);
9598 g_variant_iter_init (&iter, parameters);
9599 n = 1;
9600 while ((child = g_variant_iter_next_value (&iter)) != NULL)
9601 {
9602 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
9603 if (arg_info->use_gvariant)
9604 {
9605 g_value_init (&paramv[n], G_TYPE_VARIANT);
9606 g_value_set_variant (&paramv[n], child);
9607 n++;
9608 }
9609 else
9610 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
9611 g_variant_unref (child);
9612 }
9613 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_MATCH);
9614 g_signal_emitv (paramv, signal_id, 0, NULL);
9615 for (n = 0; n < num_params + 1; n++)
9616 g_value_unset (&paramv[n]);
9617 g_free (paramv);
9618}
9619
9620static void
9621sensor_match_proxy_g_properties_changed (GDBusProxy *_proxy,
9622 GVariant *changed_properties,
9623 const gchar *const *invalidated_properties)
9624{
9625 SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (_proxy);
9626 guint n;
9627 const gchar *key;
9628 GVariantIter *iter;
9629 _ExtendedGDBusPropertyInfo *info;
9630 g_variant_get (changed_properties, "a{sv}", &iter);
9631 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
9632 {
9633 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, key);
9634 g_datalist_remove_data (&proxy->priv->qdata, key);
9635 if (info != NULL)
9636 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
9637 }
9638 g_variant_iter_free (iter);
9639 for (n = 0; invalidated_properties[n] != NULL; n++)
9640 {
9641 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, invalidated_properties[n]);
9642 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
9643 if (info != NULL)
9644 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
9645 }
9646}
9647
9648static GVariant *
9649sensor_match_proxy_get_match_value (SensorMatch *object)
9650{
9651 SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (object);
9652 GVariant *variant;
9653 GVariant *value = NULL;
9654 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "match_value");
9655 value = variant;
9656 if (variant != NULL)
9657 g_variant_unref (variant);
9658 return value;
9659}
9660
9661static guchar
9662sensor_match_proxy_get_state (SensorMatch *object)
9663{
9664 SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (object);
9665 GVariant *variant;
9666 guchar value = 0;
9667 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state");
9668 if (variant != NULL)
9669 {
9670 value = g_variant_get_byte (variant);
9671 g_variant_unref (variant);
9672 }
9673 return value;
9674}
9675
9676static void
9677sensor_match_proxy_init (SensorMatchProxy *proxy)
9678{
9679#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
9680 proxy->priv = sensor_match_proxy_get_instance_private (proxy);
9681#else
9682 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_MATCH_PROXY, SensorMatchProxyPrivate);
9683#endif
9684
9685 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_match_interface_info ());
9686}
9687
9688static void
9689sensor_match_proxy_class_init (SensorMatchProxyClass *klass)
9690{
9691 GObjectClass *gobject_class;
9692 GDBusProxyClass *proxy_class;
9693
9694 gobject_class = G_OBJECT_CLASS (klass);
9695 gobject_class->finalize = sensor_match_proxy_finalize;
9696 gobject_class->get_property = sensor_match_proxy_get_property;
9697 gobject_class->set_property = sensor_match_proxy_set_property;
9698
9699 proxy_class = G_DBUS_PROXY_CLASS (klass);
9700 proxy_class->g_signal = sensor_match_proxy_g_signal;
9701 proxy_class->g_properties_changed = sensor_match_proxy_g_properties_changed;
9702
9703 sensor_match_override_properties (gobject_class, 1);
9704
9705#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
9706 g_type_class_add_private (klass, sizeof (SensorMatchProxyPrivate));
9707#endif
9708}
9709
9710static void
9711sensor_match_proxy_iface_init (SensorMatchIface *iface)
9712{
9713 iface->get_match_value = sensor_match_proxy_get_match_value;
9714 iface->get_state = sensor_match_proxy_get_state;
9715}
9716
9717/**
9718 * sensor_match_proxy_new:
9719 * @connection: A #GDBusConnection.
9720 * @flags: Flags from the #GDBusProxyFlags enumeration.
9721 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
9722 * @object_path: An object path.
9723 * @cancellable: (allow-none): A #GCancellable or %NULL.
9724 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
9725 * @user_data: User data to pass to @callback.
9726 *
9727 * 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.
9728 *
9729 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
9730 * You can then call sensor_match_proxy_new_finish() to get the result of the operation.
9731 *
9732 * See sensor_match_proxy_new_sync() for the synchronous, blocking version of this constructor.
9733 */
9734void
9735sensor_match_proxy_new (
9736 GDBusConnection *connection,
9737 GDBusProxyFlags flags,
9738 const gchar *name,
9739 const gchar *object_path,
9740 GCancellable *cancellable,
9741 GAsyncReadyCallback callback,
9742 gpointer user_data)
9743{
9744 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);
9745}
9746
9747/**
9748 * sensor_match_proxy_new_finish:
9749 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_match_proxy_new().
9750 * @error: Return location for error or %NULL
9751 *
9752 * Finishes an operation started with sensor_match_proxy_new().
9753 *
9754 * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set.
9755 */
9756SensorMatch *
9757sensor_match_proxy_new_finish (
9758 GAsyncResult *res,
9759 GError **error)
9760{
9761 GObject *ret;
9762 GObject *source_object;
9763 source_object = g_async_result_get_source_object (res);
9764 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
9765 g_object_unref (source_object);
9766 if (ret != NULL)
9767 return SENSOR_MATCH (ret);
9768 else
9769 return NULL;
9770}
9771
9772/**
9773 * sensor_match_proxy_new_sync:
9774 * @connection: A #GDBusConnection.
9775 * @flags: Flags from the #GDBusProxyFlags enumeration.
9776 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
9777 * @object_path: An object path.
9778 * @cancellable: (allow-none): A #GCancellable or %NULL.
9779 * @error: Return location for error or %NULL
9780 *
9781 * 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.
9782 *
9783 * The calling thread is blocked until a reply is received.
9784 *
9785 * See sensor_match_proxy_new() for the asynchronous version of this constructor.
9786 *
9787 * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set.
9788 */
9789SensorMatch *
9790sensor_match_proxy_new_sync (
9791 GDBusConnection *connection,
9792 GDBusProxyFlags flags,
9793 const gchar *name,
9794 const gchar *object_path,
9795 GCancellable *cancellable,
9796 GError **error)
9797{
9798 GInitable *ret;
9799 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);
9800 if (ret != NULL)
9801 return SENSOR_MATCH (ret);
9802 else
9803 return NULL;
9804}
9805
9806
9807/**
9808 * sensor_match_proxy_new_for_bus:
9809 * @bus_type: A #GBusType.
9810 * @flags: Flags from the #GDBusProxyFlags enumeration.
9811 * @name: A bus name (well-known or unique).
9812 * @object_path: An object path.
9813 * @cancellable: (allow-none): A #GCancellable or %NULL.
9814 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
9815 * @user_data: User data to pass to @callback.
9816 *
9817 * Like sensor_match_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
9818 *
9819 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
9820 * You can then call sensor_match_proxy_new_for_bus_finish() to get the result of the operation.
9821 *
9822 * See sensor_match_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
9823 */
9824void
9825sensor_match_proxy_new_for_bus (
9826 GBusType bus_type,
9827 GDBusProxyFlags flags,
9828 const gchar *name,
9829 const gchar *object_path,
9830 GCancellable *cancellable,
9831 GAsyncReadyCallback callback,
9832 gpointer user_data)
9833{
9834 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);
9835}
9836
9837/**
9838 * sensor_match_proxy_new_for_bus_finish:
9839 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_match_proxy_new_for_bus().
9840 * @error: Return location for error or %NULL
9841 *
9842 * Finishes an operation started with sensor_match_proxy_new_for_bus().
9843 *
9844 * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set.
9845 */
9846SensorMatch *
9847sensor_match_proxy_new_for_bus_finish (
9848 GAsyncResult *res,
9849 GError **error)
9850{
9851 GObject *ret;
9852 GObject *source_object;
9853 source_object = g_async_result_get_source_object (res);
9854 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
9855 g_object_unref (source_object);
9856 if (ret != NULL)
9857 return SENSOR_MATCH (ret);
9858 else
9859 return NULL;
9860}
9861
9862/**
9863 * sensor_match_proxy_new_for_bus_sync:
9864 * @bus_type: A #GBusType.
9865 * @flags: Flags from the #GDBusProxyFlags enumeration.
9866 * @name: A bus name (well-known or unique).
9867 * @object_path: An object path.
9868 * @cancellable: (allow-none): A #GCancellable or %NULL.
9869 * @error: Return location for error or %NULL
9870 *
9871 * Like sensor_match_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
9872 *
9873 * The calling thread is blocked until a reply is received.
9874 *
9875 * See sensor_match_proxy_new_for_bus() for the asynchronous version of this constructor.
9876 *
9877 * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set.
9878 */
9879SensorMatch *
9880sensor_match_proxy_new_for_bus_sync (
9881 GBusType bus_type,
9882 GDBusProxyFlags flags,
9883 const gchar *name,
9884 const gchar *object_path,
9885 GCancellable *cancellable,
9886 GError **error)
9887{
9888 GInitable *ret;
9889 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);
9890 if (ret != NULL)
9891 return SENSOR_MATCH (ret);
9892 else
9893 return NULL;
9894}
9895
9896
9897/* ------------------------------------------------------------------------ */
9898
9899/**
9900 * SensorMatchSkeleton:
9901 *
9902 * The #SensorMatchSkeleton structure contains only private data and should only be accessed using the provided API.
9903 */
9904
9905/**
9906 * SensorMatchSkeletonClass:
9907 * @parent_class: The parent class.
9908 *
9909 * Class structure for #SensorMatchSkeleton.
9910 */
9911
9912struct _SensorMatchSkeletonPrivate
9913{
9914 GValue *properties;
9915 GList *changed_properties;
9916 GSource *changed_properties_idle_source;
9917 GMainContext *context;
9918 GMutex lock;
9919};
9920
9921static void
9922_sensor_match_skeleton_handle_method_call (
9923 GDBusConnection *connection G_GNUC_UNUSED,
9924 const gchar *sender G_GNUC_UNUSED,
9925 const gchar *object_path G_GNUC_UNUSED,
9926 const gchar *interface_name,
9927 const gchar *method_name,
9928 GVariant *parameters,
9929 GDBusMethodInvocation *invocation,
9930 gpointer user_data)
9931{
9932 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data);
9933 _ExtendedGDBusMethodInfo *info;
9934 GVariantIter iter;
9935 GVariant *child;
9936 GValue *paramv;
9937 guint num_params;
9938 guint num_extra;
9939 guint n;
9940 guint signal_id;
9941 GValue return_value = G_VALUE_INIT;
9942 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
9943 g_assert (info != NULL);
9944 num_params = g_variant_n_children (parameters);
9945 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
9946 n = 0;
9947 g_value_init (&paramv[n], TYPE_SENSOR_MATCH);
9948 g_value_set_object (&paramv[n++], skeleton);
9949 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
9950 g_value_set_object (&paramv[n++], invocation);
9951 if (info->pass_fdlist)
9952 {
9953#ifdef G_OS_UNIX
9954 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
9955 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
9956#else
9957 g_assert_not_reached ();
9958#endif
9959 }
9960 g_variant_iter_init (&iter, parameters);
9961 while ((child = g_variant_iter_next_value (&iter)) != NULL)
9962 {
9963 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
9964 if (arg_info->use_gvariant)
9965 {
9966 g_value_init (&paramv[n], G_TYPE_VARIANT);
9967 g_value_set_variant (&paramv[n], child);
9968 n++;
9969 }
9970 else
9971 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
9972 g_variant_unref (child);
9973 }
9974 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_MATCH);
9975 g_value_init (&return_value, G_TYPE_BOOLEAN);
9976 g_signal_emitv (paramv, signal_id, 0, &return_value);
9977 if (!g_value_get_boolean (&return_value))
9978 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);
9979 g_value_unset (&return_value);
9980 for (n = 0; n < num_params + num_extra; n++)
9981 g_value_unset (&paramv[n]);
9982 g_free (paramv);
9983}
9984
9985static GVariant *
9986_sensor_match_skeleton_handle_get_property (
9987 GDBusConnection *connection G_GNUC_UNUSED,
9988 const gchar *sender G_GNUC_UNUSED,
9989 const gchar *object_path G_GNUC_UNUSED,
9990 const gchar *interface_name G_GNUC_UNUSED,
9991 const gchar *property_name,
9992 GError **error,
9993 gpointer user_data)
9994{
9995 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data);
9996 GValue value = G_VALUE_INIT;
9997 GParamSpec *pspec;
9998 _ExtendedGDBusPropertyInfo *info;
9999 GVariant *ret;
10000 ret = NULL;
10001 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, property_name);
10002 g_assert (info != NULL);
10003 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
10004 if (pspec == NULL)
10005 {
10006 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
10007 }
10008 else
10009 {
10010 g_value_init (&value, pspec->value_type);
10011 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
10012 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
10013 g_value_unset (&value);
10014 }
10015 return ret;
10016}
10017
10018static gboolean
10019_sensor_match_skeleton_handle_set_property (
10020 GDBusConnection *connection G_GNUC_UNUSED,
10021 const gchar *sender G_GNUC_UNUSED,
10022 const gchar *object_path G_GNUC_UNUSED,
10023 const gchar *interface_name G_GNUC_UNUSED,
10024 const gchar *property_name,
10025 GVariant *variant,
10026 GError **error,
10027 gpointer user_data)
10028{
10029 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data);
10030 GValue value = G_VALUE_INIT;
10031 GParamSpec *pspec;
10032 _ExtendedGDBusPropertyInfo *info;
10033 gboolean ret;
10034 ret = FALSE;
10035 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, property_name);
10036 g_assert (info != NULL);
10037 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
10038 if (pspec == NULL)
10039 {
10040 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
10041 }
10042 else
10043 {
10044 if (info->use_gvariant)
10045 g_value_set_variant (&value, variant);
10046 else
10047 g_dbus_gvariant_to_gvalue (variant, &value);
10048 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
10049 g_value_unset (&value);
10050 ret = TRUE;
10051 }
10052 return ret;
10053}
10054
10055static const GDBusInterfaceVTable _sensor_match_skeleton_vtable =
10056{
10057 _sensor_match_skeleton_handle_method_call,
10058 _sensor_match_skeleton_handle_get_property,
10059 _sensor_match_skeleton_handle_set_property,
10060 {NULL}
10061};
10062
10063static GDBusInterfaceInfo *
10064sensor_match_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
10065{
10066 return sensor_match_interface_info ();
10067}
10068
10069static GDBusInterfaceVTable *
10070sensor_match_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
10071{
10072 return (GDBusInterfaceVTable *) &_sensor_match_skeleton_vtable;
10073}
10074
10075static GVariant *
10076sensor_match_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
10077{
10078 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (_skeleton);
10079
10080 GVariantBuilder builder;
10081 guint n;
10082 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
10083 if (_sensor_match_interface_info.parent_struct.properties == NULL)
10084 goto out;
10085 for (n = 0; _sensor_match_interface_info.parent_struct.properties[n] != NULL; n++)
10086 {
10087 GDBusPropertyInfo *info = _sensor_match_interface_info.parent_struct.properties[n];
10088 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
10089 {
10090 GVariant *value;
10091 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);
10092 if (value != NULL)
10093 {
10094 g_variant_take_ref (value);
10095 g_variant_builder_add (&builder, "{sv}", info->name, value);
10096 g_variant_unref (value);
10097 }
10098 }
10099 }
10100out:
10101 return g_variant_builder_end (&builder);
10102}
10103
10104static gboolean _sensor_match_emit_changed (gpointer user_data);
10105
10106static void
10107sensor_match_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
10108{
10109 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (_skeleton);
10110 gboolean emit_changed = FALSE;
10111
10112 g_mutex_lock (&skeleton->priv->lock);
10113 if (skeleton->priv->changed_properties_idle_source != NULL)
10114 {
10115 g_source_destroy (skeleton->priv->changed_properties_idle_source);
10116 skeleton->priv->changed_properties_idle_source = NULL;
10117 emit_changed = TRUE;
10118 }
10119 g_mutex_unlock (&skeleton->priv->lock);
10120
10121 if (emit_changed)
10122 _sensor_match_emit_changed (skeleton);
10123}
10124
10125static void
10126_sensor_match_on_signal_sensor_match (
10127 SensorMatch *object,
10128 guchar arg_state)
10129{
10130 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
10131
10132 GList *connections, *l;
10133 GVariant *signal_variant;
10134 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
10135
10136 signal_variant = g_variant_ref_sink (g_variant_new ("(y)",
10137 arg_state));
10138 for (l = connections; l != NULL; l = l->next)
10139 {
10140 GDBusConnection *connection = l->data;
10141 g_dbus_connection_emit_signal (connection,
10142 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorMatch", "SensorMatch",
10143 signal_variant, NULL);
10144 }
10145 g_variant_unref (signal_variant);
10146 g_list_free_full (connections, g_object_unref);
10147}
10148
10149static void sensor_match_skeleton_iface_init (SensorMatchIface *iface);
10150#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
10151G_DEFINE_TYPE_WITH_CODE (SensorMatchSkeleton, sensor_match_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
10152 G_ADD_PRIVATE (SensorMatchSkeleton)
10153 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_skeleton_iface_init));
10154
10155#else
10156G_DEFINE_TYPE_WITH_CODE (SensorMatchSkeleton, sensor_match_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
10157 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_skeleton_iface_init));
10158
10159#endif
10160static void
10161sensor_match_skeleton_finalize (GObject *object)
10162{
10163 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
10164 guint n;
10165 for (n = 0; n < 2; n++)
10166 g_value_unset (&skeleton->priv->properties[n]);
10167 g_free (skeleton->priv->properties);
10168 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
10169 if (skeleton->priv->changed_properties_idle_source != NULL)
10170 g_source_destroy (skeleton->priv->changed_properties_idle_source);
10171 g_main_context_unref (skeleton->priv->context);
10172 g_mutex_clear (&skeleton->priv->lock);
10173 G_OBJECT_CLASS (sensor_match_skeleton_parent_class)->finalize (object);
10174}
10175
10176static void
10177sensor_match_skeleton_get_property (GObject *object,
10178 guint prop_id,
10179 GValue *value,
10180 GParamSpec *pspec G_GNUC_UNUSED)
10181{
10182 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
10183 g_assert (prop_id != 0 && prop_id - 1 < 2);
10184 g_mutex_lock (&skeleton->priv->lock);
10185 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
10186 g_mutex_unlock (&skeleton->priv->lock);
10187}
10188
10189static gboolean
10190_sensor_match_emit_changed (gpointer user_data)
10191{
10192 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data);
10193 GList *l;
10194 GVariantBuilder builder;
10195 GVariantBuilder invalidated_builder;
10196 guint num_changes;
10197
10198 g_mutex_lock (&skeleton->priv->lock);
10199 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
10200 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
10201 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
10202 {
10203 ChangedProperty *cp = l->data;
10204 GVariant *variant;
10205 const GValue *cur_value;
10206
10207 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
10208 if (!_g_value_equal (cur_value, &cp->orig_value))
10209 {
10210 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
10211 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
10212 g_variant_unref (variant);
10213 num_changes++;
10214 }
10215 }
10216 if (num_changes > 0)
10217 {
10218 GList *connections, *ll;
10219 GVariant *signal_variant;
10220 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorMatch",
10221 &builder, &invalidated_builder));
10222 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
10223 for (ll = connections; ll != NULL; ll = ll->next)
10224 {
10225 GDBusConnection *connection = ll->data;
10226
10227 g_dbus_connection_emit_signal (connection,
10228 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
10229 "org.freedesktop.DBus.Properties",
10230 "PropertiesChanged",
10231 signal_variant,
10232 NULL);
10233 }
10234 g_variant_unref (signal_variant);
10235 g_list_free_full (connections, g_object_unref);
10236 }
10237 else
10238 {
10239 g_variant_builder_clear (&builder);
10240 g_variant_builder_clear (&invalidated_builder);
10241 }
10242 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
10243 skeleton->priv->changed_properties = NULL;
10244 skeleton->priv->changed_properties_idle_source = NULL;
10245 g_mutex_unlock (&skeleton->priv->lock);
10246 return FALSE;
10247}
10248
10249static void
10250_sensor_match_schedule_emit_changed (SensorMatchSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
10251{
10252 ChangedProperty *cp;
10253 GList *l;
10254 cp = NULL;
10255 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
10256 {
10257 ChangedProperty *i_cp = l->data;
10258 if (i_cp->info == info)
10259 {
10260 cp = i_cp;
10261 break;
10262 }
10263 }
10264 if (cp == NULL)
10265 {
10266 cp = g_new0 (ChangedProperty, 1);
10267 cp->prop_id = prop_id;
10268 cp->info = info;
10269 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
10270 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
10271 g_value_copy (orig_value, &cp->orig_value);
10272 }
10273}
10274
10275static void
10276sensor_match_skeleton_notify (GObject *object,
10277 GParamSpec *pspec G_GNUC_UNUSED)
10278{
10279 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
10280 g_mutex_lock (&skeleton->priv->lock);
10281 if (skeleton->priv->changed_properties != NULL &&
10282 skeleton->priv->changed_properties_idle_source == NULL)
10283 {
10284 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
10285 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
10286 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_match_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
Adriana Kobylakfd778822016-06-16 09:08:37 -050010287 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _sensor_match_emit_changed");
Norman James362a80f2015-09-14 14:04:39 -050010288 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
10289 g_source_unref (skeleton->priv->changed_properties_idle_source);
10290 }
10291 g_mutex_unlock (&skeleton->priv->lock);
10292}
10293
10294static void
10295sensor_match_skeleton_set_property (GObject *object,
10296 guint prop_id,
10297 const GValue *value,
10298 GParamSpec *pspec)
10299{
10300 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
10301 g_assert (prop_id != 0 && prop_id - 1 < 2);
10302 g_mutex_lock (&skeleton->priv->lock);
10303 g_object_freeze_notify (object);
10304 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
10305 {
10306 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
10307 _sensor_match_schedule_emit_changed (skeleton, _sensor_match_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
10308 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
10309 g_object_notify_by_pspec (object, pspec);
10310 }
10311 g_mutex_unlock (&skeleton->priv->lock);
10312 g_object_thaw_notify (object);
10313}
10314
10315static void
10316sensor_match_skeleton_init (SensorMatchSkeleton *skeleton)
10317{
10318#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
10319 skeleton->priv = sensor_match_skeleton_get_instance_private (skeleton);
10320#else
10321 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_MATCH_SKELETON, SensorMatchSkeletonPrivate);
10322#endif
10323
10324 g_mutex_init (&skeleton->priv->lock);
10325 skeleton->priv->context = g_main_context_ref_thread_default ();
10326 skeleton->priv->properties = g_new0 (GValue, 2);
10327 g_value_init (&skeleton->priv->properties[0], G_TYPE_VARIANT);
10328 g_value_init (&skeleton->priv->properties[1], G_TYPE_UCHAR);
10329}
10330
10331static GVariant *
10332sensor_match_skeleton_get_match_value (SensorMatch *object)
10333{
10334 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
10335 GVariant *value;
10336 g_mutex_lock (&skeleton->priv->lock);
10337 value = g_value_get_variant (&(skeleton->priv->properties[0]));
10338 g_mutex_unlock (&skeleton->priv->lock);
10339 return value;
10340}
10341
10342static guchar
10343sensor_match_skeleton_get_state (SensorMatch *object)
10344{
10345 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
10346 guchar value;
10347 g_mutex_lock (&skeleton->priv->lock);
10348 value = g_value_get_uchar (&(skeleton->priv->properties[1]));
10349 g_mutex_unlock (&skeleton->priv->lock);
10350 return value;
10351}
10352
10353static void
10354sensor_match_skeleton_class_init (SensorMatchSkeletonClass *klass)
10355{
10356 GObjectClass *gobject_class;
10357 GDBusInterfaceSkeletonClass *skeleton_class;
10358
10359 gobject_class = G_OBJECT_CLASS (klass);
10360 gobject_class->finalize = sensor_match_skeleton_finalize;
10361 gobject_class->get_property = sensor_match_skeleton_get_property;
10362 gobject_class->set_property = sensor_match_skeleton_set_property;
10363 gobject_class->notify = sensor_match_skeleton_notify;
10364
10365
10366 sensor_match_override_properties (gobject_class, 1);
10367
10368 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
10369 skeleton_class->get_info = sensor_match_skeleton_dbus_interface_get_info;
10370 skeleton_class->get_properties = sensor_match_skeleton_dbus_interface_get_properties;
10371 skeleton_class->flush = sensor_match_skeleton_dbus_interface_flush;
10372 skeleton_class->get_vtable = sensor_match_skeleton_dbus_interface_get_vtable;
10373
10374#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
10375 g_type_class_add_private (klass, sizeof (SensorMatchSkeletonPrivate));
10376#endif
10377}
10378
10379static void
10380sensor_match_skeleton_iface_init (SensorMatchIface *iface)
10381{
10382 iface->sensor_match = _sensor_match_on_signal_sensor_match;
10383 iface->get_match_value = sensor_match_skeleton_get_match_value;
10384 iface->get_state = sensor_match_skeleton_get_state;
10385}
10386
10387/**
10388 * sensor_match_skeleton_new:
10389 *
10390 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>.
10391 *
10392 * Returns: (transfer full) (type SensorMatchSkeleton): The skeleton object.
10393 */
10394SensorMatch *
10395sensor_match_skeleton_new (void)
10396{
10397 return SENSOR_MATCH (g_object_new (TYPE_SENSOR_MATCH_SKELETON, NULL));
10398}
10399
10400/* ------------------------------------------------------------------------
10401 * Code for interface org.openbmc.Process
10402 * ------------------------------------------------------------------------
10403 */
10404
10405/**
10406 * SECTION:Process
10407 * @title: Process
10408 * @short_description: Generated C code for the org.openbmc.Process D-Bus interface
10409 *
10410 * 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.
10411 */
10412
10413/* ---- Introspection data for org.openbmc.Process ---- */
10414
10415static const _ExtendedGDBusMethodInfo _process_method_info_stop =
10416{
10417 {
10418 -1,
10419 (gchar *) "stop",
10420 NULL,
10421 NULL,
10422 NULL
10423 },
10424 "handle-stop",
10425 FALSE
10426};
10427
10428static const _ExtendedGDBusMethodInfo * const _process_method_info_pointers[] =
10429{
10430 &_process_method_info_stop,
10431 NULL
10432};
10433
10434static const _ExtendedGDBusInterfaceInfo _process_interface_info =
10435{
10436 {
10437 -1,
10438 (gchar *) "org.openbmc.Process",
10439 (GDBusMethodInfo **) &_process_method_info_pointers,
10440 NULL,
10441 NULL,
10442 NULL
10443 },
10444 "process",
10445};
10446
10447
10448/**
10449 * process_interface_info:
10450 *
10451 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link> D-Bus interface.
10452 *
10453 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
10454 */
10455GDBusInterfaceInfo *
10456process_interface_info (void)
10457{
10458 return (GDBusInterfaceInfo *) &_process_interface_info.parent_struct;
10459}
10460
10461/**
10462 * process_override_properties:
10463 * @klass: The class structure for a #GObject<!-- -->-derived class.
10464 * @property_id_begin: The property id to assign to the first overridden property.
10465 *
10466 * Overrides all #GObject properties in the #Process interface for a concrete class.
10467 * The properties are overridden in the order they are defined.
10468 *
10469 * Returns: The last property id.
10470 */
10471guint
10472process_override_properties (GObjectClass *klass, guint property_id_begin)
10473{
10474 return property_id_begin - 1;
10475}
10476
10477
10478
10479/**
10480 * Process:
10481 *
10482 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link>.
10483 */
10484
10485/**
10486 * ProcessIface:
10487 * @parent_iface: The parent interface.
10488 * @handle_stop: Handler for the #Process::handle-stop signal.
10489 *
10490 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link>.
10491 */
10492
10493typedef ProcessIface ProcessInterface;
10494G_DEFINE_INTERFACE (Process, process, G_TYPE_OBJECT);
10495
10496static void
10497process_default_init (ProcessIface *iface)
10498{
10499 /* GObject signals for incoming D-Bus method calls: */
10500 /**
10501 * Process::handle-stop:
10502 * @object: A #Process.
10503 * @invocation: A #GDBusMethodInvocation.
10504 *
10505 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Process.stop">stop()</link> D-Bus method.
10506 *
10507 * 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.
10508 *
10509 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
10510 */
10511 g_signal_new ("handle-stop",
10512 G_TYPE_FROM_INTERFACE (iface),
10513 G_SIGNAL_RUN_LAST,
10514 G_STRUCT_OFFSET (ProcessIface, handle_stop),
10515 g_signal_accumulator_true_handled,
10516 NULL,
10517 g_cclosure_marshal_generic,
10518 G_TYPE_BOOLEAN,
10519 1,
10520 G_TYPE_DBUS_METHOD_INVOCATION);
10521
10522}
10523
10524/**
10525 * process_call_stop:
10526 * @proxy: A #ProcessProxy.
10527 * @cancellable: (allow-none): A #GCancellable or %NULL.
10528 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
10529 * @user_data: User data to pass to @callback.
10530 *
10531 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Process.stop">stop()</link> D-Bus method on @proxy.
10532 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
10533 * You can then call process_call_stop_finish() to get the result of the operation.
10534 *
10535 * See process_call_stop_sync() for the synchronous, blocking version of this method.
10536 */
10537void
10538process_call_stop (
10539 Process *proxy,
10540 GCancellable *cancellable,
10541 GAsyncReadyCallback callback,
10542 gpointer user_data)
10543{
10544 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
10545 "stop",
10546 g_variant_new ("()"),
10547 G_DBUS_CALL_FLAGS_NONE,
10548 -1,
10549 cancellable,
10550 callback,
10551 user_data);
10552}
10553
10554/**
10555 * process_call_stop_finish:
10556 * @proxy: A #ProcessProxy.
10557 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to process_call_stop().
10558 * @error: Return location for error or %NULL.
10559 *
10560 * Finishes an operation started with process_call_stop().
10561 *
10562 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
10563 */
10564gboolean
10565process_call_stop_finish (
10566 Process *proxy,
10567 GAsyncResult *res,
10568 GError **error)
10569{
10570 GVariant *_ret;
10571 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
10572 if (_ret == NULL)
10573 goto _out;
10574 g_variant_get (_ret,
10575 "()");
10576 g_variant_unref (_ret);
10577_out:
10578 return _ret != NULL;
10579}
10580
10581/**
10582 * process_call_stop_sync:
10583 * @proxy: A #ProcessProxy.
10584 * @cancellable: (allow-none): A #GCancellable or %NULL.
10585 * @error: Return location for error or %NULL.
10586 *
10587 * 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.
10588 *
10589 * See process_call_stop() for the asynchronous version of this method.
10590 *
10591 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
10592 */
10593gboolean
10594process_call_stop_sync (
10595 Process *proxy,
10596 GCancellable *cancellable,
10597 GError **error)
10598{
10599 GVariant *_ret;
10600 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
10601 "stop",
10602 g_variant_new ("()"),
10603 G_DBUS_CALL_FLAGS_NONE,
10604 -1,
10605 cancellable,
10606 error);
10607 if (_ret == NULL)
10608 goto _out;
10609 g_variant_get (_ret,
10610 "()");
10611 g_variant_unref (_ret);
10612_out:
10613 return _ret != NULL;
10614}
10615
10616/**
10617 * process_complete_stop:
10618 * @object: A #Process.
10619 * @invocation: (transfer full): A #GDBusMethodInvocation.
10620 *
10621 * 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.
10622 *
10623 * This method will free @invocation, you cannot use it afterwards.
10624 */
10625void
10626process_complete_stop (
10627 Process *object,
10628 GDBusMethodInvocation *invocation)
10629{
10630 g_dbus_method_invocation_return_value (invocation,
10631 g_variant_new ("()"));
10632}
10633
10634/* ------------------------------------------------------------------------ */
10635
10636/**
10637 * ProcessProxy:
10638 *
10639 * The #ProcessProxy structure contains only private data and should only be accessed using the provided API.
10640 */
10641
10642/**
10643 * ProcessProxyClass:
10644 * @parent_class: The parent class.
10645 *
10646 * Class structure for #ProcessProxy.
10647 */
10648
10649struct _ProcessProxyPrivate
10650{
10651 GData *qdata;
10652};
10653
10654static void process_proxy_iface_init (ProcessIface *iface);
10655
10656#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
10657G_DEFINE_TYPE_WITH_CODE (ProcessProxy, process_proxy, G_TYPE_DBUS_PROXY,
10658 G_ADD_PRIVATE (ProcessProxy)
10659 G_IMPLEMENT_INTERFACE (TYPE_PROCESS, process_proxy_iface_init));
10660
10661#else
10662G_DEFINE_TYPE_WITH_CODE (ProcessProxy, process_proxy, G_TYPE_DBUS_PROXY,
10663 G_IMPLEMENT_INTERFACE (TYPE_PROCESS, process_proxy_iface_init));
10664
10665#endif
10666static void
10667process_proxy_finalize (GObject *object)
10668{
10669 ProcessProxy *proxy = PROCESS_PROXY (object);
10670 g_datalist_clear (&proxy->priv->qdata);
10671 G_OBJECT_CLASS (process_proxy_parent_class)->finalize (object);
10672}
10673
10674static void
10675process_proxy_get_property (GObject *object,
10676 guint prop_id,
10677 GValue *value,
10678 GParamSpec *pspec G_GNUC_UNUSED)
10679{
10680}
10681
10682static void
10683process_proxy_set_property (GObject *object,
10684 guint prop_id,
10685 const GValue *value,
10686 GParamSpec *pspec G_GNUC_UNUSED)
10687{
10688}
10689
10690static void
10691process_proxy_g_signal (GDBusProxy *proxy,
10692 const gchar *sender_name G_GNUC_UNUSED,
10693 const gchar *signal_name,
10694 GVariant *parameters)
10695{
10696 _ExtendedGDBusSignalInfo *info;
10697 GVariantIter iter;
10698 GVariant *child;
10699 GValue *paramv;
10700 guint num_params;
10701 guint n;
10702 guint signal_id;
10703 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, signal_name);
10704 if (info == NULL)
10705 return;
10706 num_params = g_variant_n_children (parameters);
10707 paramv = g_new0 (GValue, num_params + 1);
10708 g_value_init (&paramv[0], TYPE_PROCESS);
10709 g_value_set_object (&paramv[0], proxy);
10710 g_variant_iter_init (&iter, parameters);
10711 n = 1;
10712 while ((child = g_variant_iter_next_value (&iter)) != NULL)
10713 {
10714 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
10715 if (arg_info->use_gvariant)
10716 {
10717 g_value_init (&paramv[n], G_TYPE_VARIANT);
10718 g_value_set_variant (&paramv[n], child);
10719 n++;
10720 }
10721 else
10722 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
10723 g_variant_unref (child);
10724 }
10725 signal_id = g_signal_lookup (info->signal_name, TYPE_PROCESS);
10726 g_signal_emitv (paramv, signal_id, 0, NULL);
10727 for (n = 0; n < num_params + 1; n++)
10728 g_value_unset (&paramv[n]);
10729 g_free (paramv);
10730}
10731
10732static void
10733process_proxy_g_properties_changed (GDBusProxy *_proxy,
10734 GVariant *changed_properties,
10735 const gchar *const *invalidated_properties)
10736{
10737 ProcessProxy *proxy = PROCESS_PROXY (_proxy);
10738 guint n;
10739 const gchar *key;
10740 GVariantIter *iter;
10741 _ExtendedGDBusPropertyInfo *info;
10742 g_variant_get (changed_properties, "a{sv}", &iter);
10743 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
10744 {
10745 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, key);
10746 g_datalist_remove_data (&proxy->priv->qdata, key);
10747 if (info != NULL)
10748 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
10749 }
10750 g_variant_iter_free (iter);
10751 for (n = 0; invalidated_properties[n] != NULL; n++)
10752 {
10753 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, invalidated_properties[n]);
10754 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
10755 if (info != NULL)
10756 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
10757 }
10758}
10759
10760static void
10761process_proxy_init (ProcessProxy *proxy)
10762{
10763#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
10764 proxy->priv = process_proxy_get_instance_private (proxy);
10765#else
10766 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_PROCESS_PROXY, ProcessProxyPrivate);
10767#endif
10768
10769 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), process_interface_info ());
10770}
10771
10772static void
10773process_proxy_class_init (ProcessProxyClass *klass)
10774{
10775 GObjectClass *gobject_class;
10776 GDBusProxyClass *proxy_class;
10777
10778 gobject_class = G_OBJECT_CLASS (klass);
10779 gobject_class->finalize = process_proxy_finalize;
10780 gobject_class->get_property = process_proxy_get_property;
10781 gobject_class->set_property = process_proxy_set_property;
10782
10783 proxy_class = G_DBUS_PROXY_CLASS (klass);
10784 proxy_class->g_signal = process_proxy_g_signal;
10785 proxy_class->g_properties_changed = process_proxy_g_properties_changed;
10786
10787#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
10788 g_type_class_add_private (klass, sizeof (ProcessProxyPrivate));
10789#endif
10790}
10791
10792static void
10793process_proxy_iface_init (ProcessIface *iface)
10794{
10795}
10796
10797/**
10798 * process_proxy_new:
10799 * @connection: A #GDBusConnection.
10800 * @flags: Flags from the #GDBusProxyFlags enumeration.
10801 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
10802 * @object_path: An object path.
10803 * @cancellable: (allow-none): A #GCancellable or %NULL.
10804 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
10805 * @user_data: User data to pass to @callback.
10806 *
10807 * 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.
10808 *
10809 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
10810 * You can then call process_proxy_new_finish() to get the result of the operation.
10811 *
10812 * See process_proxy_new_sync() for the synchronous, blocking version of this constructor.
10813 */
10814void
10815process_proxy_new (
10816 GDBusConnection *connection,
10817 GDBusProxyFlags flags,
10818 const gchar *name,
10819 const gchar *object_path,
10820 GCancellable *cancellable,
10821 GAsyncReadyCallback callback,
10822 gpointer user_data)
10823{
10824 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);
10825}
10826
10827/**
10828 * process_proxy_new_finish:
10829 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to process_proxy_new().
10830 * @error: Return location for error or %NULL
10831 *
10832 * Finishes an operation started with process_proxy_new().
10833 *
10834 * Returns: (transfer full) (type ProcessProxy): The constructed proxy object or %NULL if @error is set.
10835 */
10836Process *
10837process_proxy_new_finish (
10838 GAsyncResult *res,
10839 GError **error)
10840{
10841 GObject *ret;
10842 GObject *source_object;
10843 source_object = g_async_result_get_source_object (res);
10844 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
10845 g_object_unref (source_object);
10846 if (ret != NULL)
10847 return PROCESS (ret);
10848 else
10849 return NULL;
10850}
10851
10852/**
10853 * process_proxy_new_sync:
10854 * @connection: A #GDBusConnection.
10855 * @flags: Flags from the #GDBusProxyFlags enumeration.
10856 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
10857 * @object_path: An object path.
10858 * @cancellable: (allow-none): A #GCancellable or %NULL.
10859 * @error: Return location for error or %NULL
10860 *
10861 * 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.
10862 *
10863 * The calling thread is blocked until a reply is received.
10864 *
10865 * See process_proxy_new() for the asynchronous version of this constructor.
10866 *
10867 * Returns: (transfer full) (type ProcessProxy): The constructed proxy object or %NULL if @error is set.
10868 */
10869Process *
10870process_proxy_new_sync (
10871 GDBusConnection *connection,
10872 GDBusProxyFlags flags,
10873 const gchar *name,
10874 const gchar *object_path,
10875 GCancellable *cancellable,
10876 GError **error)
10877{
10878 GInitable *ret;
10879 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);
10880 if (ret != NULL)
10881 return PROCESS (ret);
10882 else
10883 return NULL;
10884}
10885
10886
10887/**
10888 * process_proxy_new_for_bus:
10889 * @bus_type: A #GBusType.
10890 * @flags: Flags from the #GDBusProxyFlags enumeration.
10891 * @name: A bus name (well-known or unique).
10892 * @object_path: An object path.
10893 * @cancellable: (allow-none): A #GCancellable or %NULL.
10894 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
10895 * @user_data: User data to pass to @callback.
10896 *
10897 * Like process_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
10898 *
10899 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
10900 * You can then call process_proxy_new_for_bus_finish() to get the result of the operation.
10901 *
10902 * See process_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
10903 */
10904void
10905process_proxy_new_for_bus (
10906 GBusType bus_type,
10907 GDBusProxyFlags flags,
10908 const gchar *name,
10909 const gchar *object_path,
10910 GCancellable *cancellable,
10911 GAsyncReadyCallback callback,
10912 gpointer user_data)
10913{
10914 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);
10915}
10916
10917/**
10918 * process_proxy_new_for_bus_finish:
10919 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to process_proxy_new_for_bus().
10920 * @error: Return location for error or %NULL
10921 *
10922 * Finishes an operation started with process_proxy_new_for_bus().
10923 *
10924 * Returns: (transfer full) (type ProcessProxy): The constructed proxy object or %NULL if @error is set.
10925 */
10926Process *
10927process_proxy_new_for_bus_finish (
10928 GAsyncResult *res,
10929 GError **error)
10930{
10931 GObject *ret;
10932 GObject *source_object;
10933 source_object = g_async_result_get_source_object (res);
10934 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
10935 g_object_unref (source_object);
10936 if (ret != NULL)
10937 return PROCESS (ret);
10938 else
10939 return NULL;
10940}
10941
10942/**
10943 * process_proxy_new_for_bus_sync:
10944 * @bus_type: A #GBusType.
10945 * @flags: Flags from the #GDBusProxyFlags enumeration.
10946 * @name: A bus name (well-known or unique).
10947 * @object_path: An object path.
10948 * @cancellable: (allow-none): A #GCancellable or %NULL.
10949 * @error: Return location for error or %NULL
10950 *
10951 * Like process_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
10952 *
10953 * The calling thread is blocked until a reply is received.
10954 *
10955 * See process_proxy_new_for_bus() for the asynchronous version of this constructor.
10956 *
10957 * Returns: (transfer full) (type ProcessProxy): The constructed proxy object or %NULL if @error is set.
10958 */
10959Process *
10960process_proxy_new_for_bus_sync (
10961 GBusType bus_type,
10962 GDBusProxyFlags flags,
10963 const gchar *name,
10964 const gchar *object_path,
10965 GCancellable *cancellable,
10966 GError **error)
10967{
10968 GInitable *ret;
10969 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);
10970 if (ret != NULL)
10971 return PROCESS (ret);
10972 else
10973 return NULL;
10974}
10975
10976
10977/* ------------------------------------------------------------------------ */
10978
10979/**
10980 * ProcessSkeleton:
10981 *
10982 * The #ProcessSkeleton structure contains only private data and should only be accessed using the provided API.
10983 */
10984
10985/**
10986 * ProcessSkeletonClass:
10987 * @parent_class: The parent class.
10988 *
10989 * Class structure for #ProcessSkeleton.
10990 */
10991
10992struct _ProcessSkeletonPrivate
10993{
10994 GValue *properties;
10995 GList *changed_properties;
10996 GSource *changed_properties_idle_source;
10997 GMainContext *context;
10998 GMutex lock;
10999};
11000
11001static void
11002_process_skeleton_handle_method_call (
11003 GDBusConnection *connection G_GNUC_UNUSED,
11004 const gchar *sender G_GNUC_UNUSED,
11005 const gchar *object_path G_GNUC_UNUSED,
11006 const gchar *interface_name,
11007 const gchar *method_name,
11008 GVariant *parameters,
11009 GDBusMethodInvocation *invocation,
11010 gpointer user_data)
11011{
11012 ProcessSkeleton *skeleton = PROCESS_SKELETON (user_data);
11013 _ExtendedGDBusMethodInfo *info;
11014 GVariantIter iter;
11015 GVariant *child;
11016 GValue *paramv;
11017 guint num_params;
11018 guint num_extra;
11019 guint n;
11020 guint signal_id;
11021 GValue return_value = G_VALUE_INIT;
11022 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
11023 g_assert (info != NULL);
11024 num_params = g_variant_n_children (parameters);
11025 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
11026 n = 0;
11027 g_value_init (&paramv[n], TYPE_PROCESS);
11028 g_value_set_object (&paramv[n++], skeleton);
11029 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
11030 g_value_set_object (&paramv[n++], invocation);
11031 if (info->pass_fdlist)
11032 {
11033#ifdef G_OS_UNIX
11034 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
11035 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
11036#else
11037 g_assert_not_reached ();
11038#endif
11039 }
11040 g_variant_iter_init (&iter, parameters);
11041 while ((child = g_variant_iter_next_value (&iter)) != NULL)
11042 {
11043 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
11044 if (arg_info->use_gvariant)
11045 {
11046 g_value_init (&paramv[n], G_TYPE_VARIANT);
11047 g_value_set_variant (&paramv[n], child);
11048 n++;
11049 }
11050 else
11051 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
11052 g_variant_unref (child);
11053 }
11054 signal_id = g_signal_lookup (info->signal_name, TYPE_PROCESS);
11055 g_value_init (&return_value, G_TYPE_BOOLEAN);
11056 g_signal_emitv (paramv, signal_id, 0, &return_value);
11057 if (!g_value_get_boolean (&return_value))
11058 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);
11059 g_value_unset (&return_value);
11060 for (n = 0; n < num_params + num_extra; n++)
11061 g_value_unset (&paramv[n]);
11062 g_free (paramv);
11063}
11064
11065static GVariant *
11066_process_skeleton_handle_get_property (
11067 GDBusConnection *connection G_GNUC_UNUSED,
11068 const gchar *sender G_GNUC_UNUSED,
11069 const gchar *object_path G_GNUC_UNUSED,
11070 const gchar *interface_name G_GNUC_UNUSED,
11071 const gchar *property_name,
11072 GError **error,
11073 gpointer user_data)
11074{
11075 ProcessSkeleton *skeleton = PROCESS_SKELETON (user_data);
11076 GValue value = G_VALUE_INIT;
11077 GParamSpec *pspec;
11078 _ExtendedGDBusPropertyInfo *info;
11079 GVariant *ret;
11080 ret = NULL;
11081 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, property_name);
11082 g_assert (info != NULL);
11083 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
11084 if (pspec == NULL)
11085 {
11086 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
11087 }
11088 else
11089 {
11090 g_value_init (&value, pspec->value_type);
11091 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
11092 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
11093 g_value_unset (&value);
11094 }
11095 return ret;
11096}
11097
11098static gboolean
11099_process_skeleton_handle_set_property (
11100 GDBusConnection *connection G_GNUC_UNUSED,
11101 const gchar *sender G_GNUC_UNUSED,
11102 const gchar *object_path G_GNUC_UNUSED,
11103 const gchar *interface_name G_GNUC_UNUSED,
11104 const gchar *property_name,
11105 GVariant *variant,
11106 GError **error,
11107 gpointer user_data)
11108{
11109 ProcessSkeleton *skeleton = PROCESS_SKELETON (user_data);
11110 GValue value = G_VALUE_INIT;
11111 GParamSpec *pspec;
11112 _ExtendedGDBusPropertyInfo *info;
11113 gboolean ret;
11114 ret = FALSE;
11115 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, property_name);
11116 g_assert (info != NULL);
11117 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
11118 if (pspec == NULL)
11119 {
11120 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
11121 }
11122 else
11123 {
11124 if (info->use_gvariant)
11125 g_value_set_variant (&value, variant);
11126 else
11127 g_dbus_gvariant_to_gvalue (variant, &value);
11128 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
11129 g_value_unset (&value);
11130 ret = TRUE;
11131 }
11132 return ret;
11133}
11134
11135static const GDBusInterfaceVTable _process_skeleton_vtable =
11136{
11137 _process_skeleton_handle_method_call,
11138 _process_skeleton_handle_get_property,
11139 _process_skeleton_handle_set_property,
11140 {NULL}
11141};
11142
11143static GDBusInterfaceInfo *
11144process_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
11145{
11146 return process_interface_info ();
11147}
11148
11149static GDBusInterfaceVTable *
11150process_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
11151{
11152 return (GDBusInterfaceVTable *) &_process_skeleton_vtable;
11153}
11154
11155static GVariant *
11156process_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
11157{
11158 ProcessSkeleton *skeleton = PROCESS_SKELETON (_skeleton);
11159
11160 GVariantBuilder builder;
11161 guint n;
11162 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
11163 if (_process_interface_info.parent_struct.properties == NULL)
11164 goto out;
11165 for (n = 0; _process_interface_info.parent_struct.properties[n] != NULL; n++)
11166 {
11167 GDBusPropertyInfo *info = _process_interface_info.parent_struct.properties[n];
11168 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
11169 {
11170 GVariant *value;
11171 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);
11172 if (value != NULL)
11173 {
11174 g_variant_take_ref (value);
11175 g_variant_builder_add (&builder, "{sv}", info->name, value);
11176 g_variant_unref (value);
11177 }
11178 }
11179 }
11180out:
11181 return g_variant_builder_end (&builder);
11182}
11183
11184static void
11185process_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
11186{
11187}
11188
11189static void process_skeleton_iface_init (ProcessIface *iface);
11190#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
11191G_DEFINE_TYPE_WITH_CODE (ProcessSkeleton, process_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
11192 G_ADD_PRIVATE (ProcessSkeleton)
11193 G_IMPLEMENT_INTERFACE (TYPE_PROCESS, process_skeleton_iface_init));
11194
11195#else
11196G_DEFINE_TYPE_WITH_CODE (ProcessSkeleton, process_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
11197 G_IMPLEMENT_INTERFACE (TYPE_PROCESS, process_skeleton_iface_init));
11198
11199#endif
11200static void
11201process_skeleton_finalize (GObject *object)
11202{
11203 ProcessSkeleton *skeleton = PROCESS_SKELETON (object);
11204 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
11205 if (skeleton->priv->changed_properties_idle_source != NULL)
11206 g_source_destroy (skeleton->priv->changed_properties_idle_source);
11207 g_main_context_unref (skeleton->priv->context);
11208 g_mutex_clear (&skeleton->priv->lock);
11209 G_OBJECT_CLASS (process_skeleton_parent_class)->finalize (object);
11210}
11211
11212static void
11213process_skeleton_init (ProcessSkeleton *skeleton)
11214{
11215#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
11216 skeleton->priv = process_skeleton_get_instance_private (skeleton);
11217#else
11218 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_PROCESS_SKELETON, ProcessSkeletonPrivate);
11219#endif
11220
11221 g_mutex_init (&skeleton->priv->lock);
11222 skeleton->priv->context = g_main_context_ref_thread_default ();
11223}
11224
11225static void
11226process_skeleton_class_init (ProcessSkeletonClass *klass)
11227{
11228 GObjectClass *gobject_class;
11229 GDBusInterfaceSkeletonClass *skeleton_class;
11230
11231 gobject_class = G_OBJECT_CLASS (klass);
11232 gobject_class->finalize = process_skeleton_finalize;
11233
11234 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
11235 skeleton_class->get_info = process_skeleton_dbus_interface_get_info;
11236 skeleton_class->get_properties = process_skeleton_dbus_interface_get_properties;
11237 skeleton_class->flush = process_skeleton_dbus_interface_flush;
11238 skeleton_class->get_vtable = process_skeleton_dbus_interface_get_vtable;
11239
11240#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
11241 g_type_class_add_private (klass, sizeof (ProcessSkeletonPrivate));
11242#endif
11243}
11244
11245static void
11246process_skeleton_iface_init (ProcessIface *iface)
11247{
11248}
11249
11250/**
11251 * process_skeleton_new:
11252 *
11253 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link>.
11254 *
11255 * Returns: (transfer full) (type ProcessSkeleton): The skeleton object.
11256 */
11257Process *
11258process_skeleton_new (void)
11259{
11260 return PROCESS (g_object_new (TYPE_PROCESS_SKELETON, NULL));
11261}
11262
11263/* ------------------------------------------------------------------------
Norman James18998182015-10-11 21:54:53 -050011264 * Code for interface org.openbmc.SharedResource
11265 * ------------------------------------------------------------------------
11266 */
11267
11268/**
11269 * SECTION:SharedResource
11270 * @title: SharedResource
11271 * @short_description: Generated C code for the org.openbmc.SharedResource D-Bus interface
11272 *
11273 * 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.
11274 */
11275
11276/* ---- Introspection data for org.openbmc.SharedResource ---- */
11277
11278static const _ExtendedGDBusArgInfo _shared_resource_method_info_lock_IN_ARG_name =
11279{
11280 {
11281 -1,
11282 (gchar *) "name",
11283 (gchar *) "s",
11284 NULL
11285 },
11286 FALSE
11287};
11288
11289static const _ExtendedGDBusArgInfo * const _shared_resource_method_info_lock_IN_ARG_pointers[] =
11290{
11291 &_shared_resource_method_info_lock_IN_ARG_name,
11292 NULL
11293};
11294
11295static const _ExtendedGDBusMethodInfo _shared_resource_method_info_lock =
11296{
11297 {
11298 -1,
11299 (gchar *) "lock",
11300 (GDBusArgInfo **) &_shared_resource_method_info_lock_IN_ARG_pointers,
11301 NULL,
11302 NULL
11303 },
11304 "handle-lock",
11305 FALSE
11306};
11307
11308static const _ExtendedGDBusMethodInfo _shared_resource_method_info_unlock =
11309{
11310 {
11311 -1,
11312 (gchar *) "unlock",
11313 NULL,
11314 NULL,
11315 NULL
11316 },
11317 "handle-unlock",
11318 FALSE
11319};
11320
11321static const _ExtendedGDBusArgInfo _shared_resource_method_info_is_locked_OUT_ARG_lock =
11322{
11323 {
11324 -1,
11325 (gchar *) "lock",
11326 (gchar *) "b",
11327 NULL
11328 },
11329 FALSE
11330};
11331
11332static const _ExtendedGDBusArgInfo _shared_resource_method_info_is_locked_OUT_ARG_name =
11333{
11334 {
11335 -1,
11336 (gchar *) "name",
11337 (gchar *) "s",
11338 NULL
11339 },
11340 FALSE
11341};
11342
11343static const _ExtendedGDBusArgInfo * const _shared_resource_method_info_is_locked_OUT_ARG_pointers[] =
11344{
11345 &_shared_resource_method_info_is_locked_OUT_ARG_lock,
11346 &_shared_resource_method_info_is_locked_OUT_ARG_name,
11347 NULL
11348};
11349
11350static const _ExtendedGDBusMethodInfo _shared_resource_method_info_is_locked =
11351{
11352 {
11353 -1,
11354 (gchar *) "isLocked",
11355 NULL,
11356 (GDBusArgInfo **) &_shared_resource_method_info_is_locked_OUT_ARG_pointers,
11357 NULL
11358 },
11359 "handle-is-locked",
11360 FALSE
11361};
11362
11363static const _ExtendedGDBusMethodInfo * const _shared_resource_method_info_pointers[] =
11364{
11365 &_shared_resource_method_info_lock,
11366 &_shared_resource_method_info_unlock,
11367 &_shared_resource_method_info_is_locked,
11368 NULL
11369};
11370
11371static const _ExtendedGDBusPropertyInfo _shared_resource_property_info_lock =
11372{
11373 {
11374 -1,
11375 (gchar *) "lock",
11376 (gchar *) "b",
11377 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
11378 NULL
11379 },
11380 "lock",
11381 FALSE
11382};
11383
11384static const _ExtendedGDBusPropertyInfo _shared_resource_property_info_name =
11385{
11386 {
11387 -1,
11388 (gchar *) "name",
11389 (gchar *) "s",
11390 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
11391 NULL
11392 },
11393 "name",
11394 FALSE
11395};
11396
11397static const _ExtendedGDBusPropertyInfo * const _shared_resource_property_info_pointers[] =
11398{
11399 &_shared_resource_property_info_lock,
11400 &_shared_resource_property_info_name,
11401 NULL
11402};
11403
11404static const _ExtendedGDBusInterfaceInfo _shared_resource_interface_info =
11405{
11406 {
11407 -1,
11408 (gchar *) "org.openbmc.SharedResource",
11409 (GDBusMethodInfo **) &_shared_resource_method_info_pointers,
11410 NULL,
11411 (GDBusPropertyInfo **) &_shared_resource_property_info_pointers,
11412 NULL
11413 },
11414 "shared-resource",
11415};
11416
11417
11418/**
11419 * shared_resource_interface_info:
11420 *
11421 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link> D-Bus interface.
11422 *
11423 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
11424 */
11425GDBusInterfaceInfo *
11426shared_resource_interface_info (void)
11427{
11428 return (GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct;
11429}
11430
11431/**
11432 * shared_resource_override_properties:
11433 * @klass: The class structure for a #GObject<!-- -->-derived class.
11434 * @property_id_begin: The property id to assign to the first overridden property.
11435 *
11436 * Overrides all #GObject properties in the #SharedResource interface for a concrete class.
11437 * The properties are overridden in the order they are defined.
11438 *
11439 * Returns: The last property id.
11440 */
11441guint
11442shared_resource_override_properties (GObjectClass *klass, guint property_id_begin)
11443{
11444 g_object_class_override_property (klass, property_id_begin++, "lock");
11445 g_object_class_override_property (klass, property_id_begin++, "name");
11446 return property_id_begin - 1;
11447}
11448
11449
11450
11451/**
11452 * SharedResource:
11453 *
11454 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link>.
11455 */
11456
11457/**
11458 * SharedResourceIface:
11459 * @parent_iface: The parent interface.
11460 * @handle_is_locked: Handler for the #SharedResource::handle-is-locked signal.
11461 * @handle_lock: Handler for the #SharedResource::handle-lock signal.
11462 * @handle_unlock: Handler for the #SharedResource::handle-unlock signal.
11463 * @get_lock: Getter for the #SharedResource:lock property.
11464 * @get_name: Getter for the #SharedResource:name property.
11465 *
11466 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link>.
11467 */
11468
11469typedef SharedResourceIface SharedResourceInterface;
11470G_DEFINE_INTERFACE (SharedResource, shared_resource, G_TYPE_OBJECT);
11471
11472static void
11473shared_resource_default_init (SharedResourceIface *iface)
11474{
11475 /* GObject signals for incoming D-Bus method calls: */
11476 /**
11477 * SharedResource::handle-lock:
11478 * @object: A #SharedResource.
11479 * @invocation: A #GDBusMethodInvocation.
11480 * @arg_name: Argument passed by remote caller.
11481 *
11482 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SharedResource.lock">lock()</link> D-Bus method.
11483 *
11484 * 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.
11485 *
11486 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
11487 */
11488 g_signal_new ("handle-lock",
11489 G_TYPE_FROM_INTERFACE (iface),
11490 G_SIGNAL_RUN_LAST,
11491 G_STRUCT_OFFSET (SharedResourceIface, handle_lock),
11492 g_signal_accumulator_true_handled,
11493 NULL,
11494 g_cclosure_marshal_generic,
11495 G_TYPE_BOOLEAN,
11496 2,
11497 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING);
11498
11499 /**
11500 * SharedResource::handle-unlock:
11501 * @object: A #SharedResource.
11502 * @invocation: A #GDBusMethodInvocation.
11503 *
11504 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SharedResource.unlock">unlock()</link> D-Bus method.
11505 *
11506 * 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.
11507 *
11508 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
11509 */
11510 g_signal_new ("handle-unlock",
11511 G_TYPE_FROM_INTERFACE (iface),
11512 G_SIGNAL_RUN_LAST,
11513 G_STRUCT_OFFSET (SharedResourceIface, handle_unlock),
11514 g_signal_accumulator_true_handled,
11515 NULL,
11516 g_cclosure_marshal_generic,
11517 G_TYPE_BOOLEAN,
11518 1,
11519 G_TYPE_DBUS_METHOD_INVOCATION);
11520
11521 /**
11522 * SharedResource::handle-is-locked:
11523 * @object: A #SharedResource.
11524 * @invocation: A #GDBusMethodInvocation.
11525 *
11526 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SharedResource.isLocked">isLocked()</link> D-Bus method.
11527 *
11528 * 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.
11529 *
11530 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
11531 */
11532 g_signal_new ("handle-is-locked",
11533 G_TYPE_FROM_INTERFACE (iface),
11534 G_SIGNAL_RUN_LAST,
11535 G_STRUCT_OFFSET (SharedResourceIface, handle_is_locked),
11536 g_signal_accumulator_true_handled,
11537 NULL,
11538 g_cclosure_marshal_generic,
11539 G_TYPE_BOOLEAN,
11540 1,
11541 G_TYPE_DBUS_METHOD_INVOCATION);
11542
11543 /* GObject properties for D-Bus properties: */
11544 /**
11545 * SharedResource:lock:
11546 *
11547 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SharedResource.lock">"lock"</link>.
11548 *
11549 * 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.
11550 */
11551 g_object_interface_install_property (iface,
11552 g_param_spec_boolean ("lock", "lock", "lock", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
11553 /**
11554 * SharedResource:name:
11555 *
11556 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SharedResource.name">"name"</link>.
11557 *
11558 * 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.
11559 */
11560 g_object_interface_install_property (iface,
11561 g_param_spec_string ("name", "name", "name", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
11562}
11563
11564/**
11565 * shared_resource_get_lock: (skip)
11566 * @object: A #SharedResource.
11567 *
11568 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SharedResource.lock">"lock"</link> D-Bus property.
11569 *
11570 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
11571 *
11572 * Returns: The property value.
11573 */
11574gboolean
11575shared_resource_get_lock (SharedResource *object)
11576{
11577 return SHARED_RESOURCE_GET_IFACE (object)->get_lock (object);
11578}
11579
11580/**
11581 * shared_resource_set_lock: (skip)
11582 * @object: A #SharedResource.
11583 * @value: The value to set.
11584 *
11585 * Sets the <link linkend="gdbus-property-org-openbmc-SharedResource.lock">"lock"</link> D-Bus property to @value.
11586 *
11587 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
11588 */
11589void
11590shared_resource_set_lock (SharedResource *object, gboolean value)
11591{
11592 g_object_set (G_OBJECT (object), "lock", value, NULL);
11593}
11594
11595/**
11596 * shared_resource_get_name: (skip)
11597 * @object: A #SharedResource.
11598 *
11599 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SharedResource.name">"name"</link> D-Bus property.
11600 *
11601 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
11602 *
11603 * <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>
11604 *
11605 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
11606 */
11607const gchar *
11608shared_resource_get_name (SharedResource *object)
11609{
11610 return SHARED_RESOURCE_GET_IFACE (object)->get_name (object);
11611}
11612
11613/**
11614 * shared_resource_dup_name: (skip)
11615 * @object: A #SharedResource.
11616 *
11617 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SharedResource.name">"name"</link> D-Bus property.
11618 *
11619 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
11620 *
11621 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
11622 */
11623gchar *
11624shared_resource_dup_name (SharedResource *object)
11625{
11626 gchar *value;
11627 g_object_get (G_OBJECT (object), "name", &value, NULL);
11628 return value;
11629}
11630
11631/**
11632 * shared_resource_set_name: (skip)
11633 * @object: A #SharedResource.
11634 * @value: The value to set.
11635 *
11636 * Sets the <link linkend="gdbus-property-org-openbmc-SharedResource.name">"name"</link> D-Bus property to @value.
11637 *
11638 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
11639 */
11640void
11641shared_resource_set_name (SharedResource *object, const gchar *value)
11642{
11643 g_object_set (G_OBJECT (object), "name", value, NULL);
11644}
11645
11646/**
11647 * shared_resource_call_lock:
11648 * @proxy: A #SharedResourceProxy.
11649 * @arg_name: Argument to pass with the method invocation.
11650 * @cancellable: (allow-none): A #GCancellable or %NULL.
11651 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
11652 * @user_data: User data to pass to @callback.
11653 *
11654 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SharedResource.lock">lock()</link> D-Bus method on @proxy.
11655 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
11656 * You can then call shared_resource_call_lock_finish() to get the result of the operation.
11657 *
11658 * See shared_resource_call_lock_sync() for the synchronous, blocking version of this method.
11659 */
11660void
11661shared_resource_call_lock (
11662 SharedResource *proxy,
11663 const gchar *arg_name,
11664 GCancellable *cancellable,
11665 GAsyncReadyCallback callback,
11666 gpointer user_data)
11667{
11668 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
11669 "lock",
11670 g_variant_new ("(s)",
11671 arg_name),
11672 G_DBUS_CALL_FLAGS_NONE,
11673 -1,
11674 cancellable,
11675 callback,
11676 user_data);
11677}
11678
11679/**
11680 * shared_resource_call_lock_finish:
11681 * @proxy: A #SharedResourceProxy.
11682 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to shared_resource_call_lock().
11683 * @error: Return location for error or %NULL.
11684 *
11685 * Finishes an operation started with shared_resource_call_lock().
11686 *
11687 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
11688 */
11689gboolean
11690shared_resource_call_lock_finish (
11691 SharedResource *proxy,
11692 GAsyncResult *res,
11693 GError **error)
11694{
11695 GVariant *_ret;
11696 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
11697 if (_ret == NULL)
11698 goto _out;
11699 g_variant_get (_ret,
11700 "()");
11701 g_variant_unref (_ret);
11702_out:
11703 return _ret != NULL;
11704}
11705
11706/**
11707 * shared_resource_call_lock_sync:
11708 * @proxy: A #SharedResourceProxy.
11709 * @arg_name: Argument to pass with the method invocation.
11710 * @cancellable: (allow-none): A #GCancellable or %NULL.
11711 * @error: Return location for error or %NULL.
11712 *
11713 * 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.
11714 *
11715 * See shared_resource_call_lock() for the asynchronous version of this method.
11716 *
11717 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
11718 */
11719gboolean
11720shared_resource_call_lock_sync (
11721 SharedResource *proxy,
11722 const gchar *arg_name,
11723 GCancellable *cancellable,
11724 GError **error)
11725{
11726 GVariant *_ret;
11727 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
11728 "lock",
11729 g_variant_new ("(s)",
11730 arg_name),
11731 G_DBUS_CALL_FLAGS_NONE,
11732 -1,
11733 cancellable,
11734 error);
11735 if (_ret == NULL)
11736 goto _out;
11737 g_variant_get (_ret,
11738 "()");
11739 g_variant_unref (_ret);
11740_out:
11741 return _ret != NULL;
11742}
11743
11744/**
11745 * shared_resource_call_unlock:
11746 * @proxy: A #SharedResourceProxy.
11747 * @cancellable: (allow-none): A #GCancellable or %NULL.
11748 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
11749 * @user_data: User data to pass to @callback.
11750 *
11751 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SharedResource.unlock">unlock()</link> D-Bus method on @proxy.
11752 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
11753 * You can then call shared_resource_call_unlock_finish() to get the result of the operation.
11754 *
11755 * See shared_resource_call_unlock_sync() for the synchronous, blocking version of this method.
11756 */
11757void
11758shared_resource_call_unlock (
11759 SharedResource *proxy,
11760 GCancellable *cancellable,
11761 GAsyncReadyCallback callback,
11762 gpointer user_data)
11763{
11764 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
11765 "unlock",
11766 g_variant_new ("()"),
11767 G_DBUS_CALL_FLAGS_NONE,
11768 -1,
11769 cancellable,
11770 callback,
11771 user_data);
11772}
11773
11774/**
11775 * shared_resource_call_unlock_finish:
11776 * @proxy: A #SharedResourceProxy.
11777 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to shared_resource_call_unlock().
11778 * @error: Return location for error or %NULL.
11779 *
11780 * Finishes an operation started with shared_resource_call_unlock().
11781 *
11782 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
11783 */
11784gboolean
11785shared_resource_call_unlock_finish (
11786 SharedResource *proxy,
11787 GAsyncResult *res,
11788 GError **error)
11789{
11790 GVariant *_ret;
11791 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
11792 if (_ret == NULL)
11793 goto _out;
11794 g_variant_get (_ret,
11795 "()");
11796 g_variant_unref (_ret);
11797_out:
11798 return _ret != NULL;
11799}
11800
11801/**
11802 * shared_resource_call_unlock_sync:
11803 * @proxy: A #SharedResourceProxy.
11804 * @cancellable: (allow-none): A #GCancellable or %NULL.
11805 * @error: Return location for error or %NULL.
11806 *
11807 * 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.
11808 *
11809 * See shared_resource_call_unlock() for the asynchronous version of this method.
11810 *
11811 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
11812 */
11813gboolean
11814shared_resource_call_unlock_sync (
11815 SharedResource *proxy,
11816 GCancellable *cancellable,
11817 GError **error)
11818{
11819 GVariant *_ret;
11820 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
11821 "unlock",
11822 g_variant_new ("()"),
11823 G_DBUS_CALL_FLAGS_NONE,
11824 -1,
11825 cancellable,
11826 error);
11827 if (_ret == NULL)
11828 goto _out;
11829 g_variant_get (_ret,
11830 "()");
11831 g_variant_unref (_ret);
11832_out:
11833 return _ret != NULL;
11834}
11835
11836/**
11837 * shared_resource_call_is_locked:
11838 * @proxy: A #SharedResourceProxy.
11839 * @cancellable: (allow-none): A #GCancellable or %NULL.
11840 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
11841 * @user_data: User data to pass to @callback.
11842 *
11843 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SharedResource.isLocked">isLocked()</link> D-Bus method on @proxy.
11844 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
11845 * You can then call shared_resource_call_is_locked_finish() to get the result of the operation.
11846 *
11847 * See shared_resource_call_is_locked_sync() for the synchronous, blocking version of this method.
11848 */
11849void
11850shared_resource_call_is_locked (
11851 SharedResource *proxy,
11852 GCancellable *cancellable,
11853 GAsyncReadyCallback callback,
11854 gpointer user_data)
11855{
11856 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
11857 "isLocked",
11858 g_variant_new ("()"),
11859 G_DBUS_CALL_FLAGS_NONE,
11860 -1,
11861 cancellable,
11862 callback,
11863 user_data);
11864}
11865
11866/**
11867 * shared_resource_call_is_locked_finish:
11868 * @proxy: A #SharedResourceProxy.
11869 * @out_lock: (out): Return location for return parameter or %NULL to ignore.
11870 * @out_name: (out): Return location for return parameter or %NULL to ignore.
11871 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to shared_resource_call_is_locked().
11872 * @error: Return location for error or %NULL.
11873 *
11874 * Finishes an operation started with shared_resource_call_is_locked().
11875 *
11876 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
11877 */
11878gboolean
11879shared_resource_call_is_locked_finish (
11880 SharedResource *proxy,
11881 gboolean *out_lock,
11882 gchar **out_name,
11883 GAsyncResult *res,
11884 GError **error)
11885{
11886 GVariant *_ret;
11887 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
11888 if (_ret == NULL)
11889 goto _out;
11890 g_variant_get (_ret,
11891 "(bs)",
11892 out_lock,
11893 out_name);
11894 g_variant_unref (_ret);
11895_out:
11896 return _ret != NULL;
11897}
11898
11899/**
11900 * shared_resource_call_is_locked_sync:
11901 * @proxy: A #SharedResourceProxy.
11902 * @out_lock: (out): Return location for return parameter or %NULL to ignore.
11903 * @out_name: (out): Return location for return parameter or %NULL to ignore.
11904 * @cancellable: (allow-none): A #GCancellable or %NULL.
11905 * @error: Return location for error or %NULL.
11906 *
11907 * 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.
11908 *
11909 * See shared_resource_call_is_locked() for the asynchronous version of this method.
11910 *
11911 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
11912 */
11913gboolean
11914shared_resource_call_is_locked_sync (
11915 SharedResource *proxy,
11916 gboolean *out_lock,
11917 gchar **out_name,
11918 GCancellable *cancellable,
11919 GError **error)
11920{
11921 GVariant *_ret;
11922 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
11923 "isLocked",
11924 g_variant_new ("()"),
11925 G_DBUS_CALL_FLAGS_NONE,
11926 -1,
11927 cancellable,
11928 error);
11929 if (_ret == NULL)
11930 goto _out;
11931 g_variant_get (_ret,
11932 "(bs)",
11933 out_lock,
11934 out_name);
11935 g_variant_unref (_ret);
11936_out:
11937 return _ret != NULL;
11938}
11939
11940/**
11941 * shared_resource_complete_lock:
11942 * @object: A #SharedResource.
11943 * @invocation: (transfer full): A #GDBusMethodInvocation.
11944 *
11945 * 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.
11946 *
11947 * This method will free @invocation, you cannot use it afterwards.
11948 */
11949void
11950shared_resource_complete_lock (
11951 SharedResource *object,
11952 GDBusMethodInvocation *invocation)
11953{
11954 g_dbus_method_invocation_return_value (invocation,
11955 g_variant_new ("()"));
11956}
11957
11958/**
11959 * shared_resource_complete_unlock:
11960 * @object: A #SharedResource.
11961 * @invocation: (transfer full): A #GDBusMethodInvocation.
11962 *
11963 * 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.
11964 *
11965 * This method will free @invocation, you cannot use it afterwards.
11966 */
11967void
11968shared_resource_complete_unlock (
11969 SharedResource *object,
11970 GDBusMethodInvocation *invocation)
11971{
11972 g_dbus_method_invocation_return_value (invocation,
11973 g_variant_new ("()"));
11974}
11975
11976/**
11977 * shared_resource_complete_is_locked:
11978 * @object: A #SharedResource.
11979 * @invocation: (transfer full): A #GDBusMethodInvocation.
11980 * @lock: Parameter to return.
11981 * @name: Parameter to return.
11982 *
11983 * 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.
11984 *
11985 * This method will free @invocation, you cannot use it afterwards.
11986 */
11987void
11988shared_resource_complete_is_locked (
11989 SharedResource *object,
11990 GDBusMethodInvocation *invocation,
11991 gboolean lock,
11992 const gchar *name)
11993{
11994 g_dbus_method_invocation_return_value (invocation,
11995 g_variant_new ("(bs)",
11996 lock,
11997 name));
11998}
11999
12000/* ------------------------------------------------------------------------ */
12001
12002/**
12003 * SharedResourceProxy:
12004 *
12005 * The #SharedResourceProxy structure contains only private data and should only be accessed using the provided API.
12006 */
12007
12008/**
12009 * SharedResourceProxyClass:
12010 * @parent_class: The parent class.
12011 *
12012 * Class structure for #SharedResourceProxy.
12013 */
12014
12015struct _SharedResourceProxyPrivate
12016{
12017 GData *qdata;
12018};
12019
12020static void shared_resource_proxy_iface_init (SharedResourceIface *iface);
12021
12022#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
12023G_DEFINE_TYPE_WITH_CODE (SharedResourceProxy, shared_resource_proxy, G_TYPE_DBUS_PROXY,
12024 G_ADD_PRIVATE (SharedResourceProxy)
12025 G_IMPLEMENT_INTERFACE (TYPE_SHARED_RESOURCE, shared_resource_proxy_iface_init));
12026
12027#else
12028G_DEFINE_TYPE_WITH_CODE (SharedResourceProxy, shared_resource_proxy, G_TYPE_DBUS_PROXY,
12029 G_IMPLEMENT_INTERFACE (TYPE_SHARED_RESOURCE, shared_resource_proxy_iface_init));
12030
12031#endif
12032static void
12033shared_resource_proxy_finalize (GObject *object)
12034{
12035 SharedResourceProxy *proxy = SHARED_RESOURCE_PROXY (object);
12036 g_datalist_clear (&proxy->priv->qdata);
12037 G_OBJECT_CLASS (shared_resource_proxy_parent_class)->finalize (object);
12038}
12039
12040static void
12041shared_resource_proxy_get_property (GObject *object,
12042 guint prop_id,
12043 GValue *value,
12044 GParamSpec *pspec G_GNUC_UNUSED)
12045{
12046 const _ExtendedGDBusPropertyInfo *info;
12047 GVariant *variant;
12048 g_assert (prop_id != 0 && prop_id - 1 < 2);
12049 info = _shared_resource_property_info_pointers[prop_id - 1];
12050 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
12051 if (info->use_gvariant)
12052 {
12053 g_value_set_variant (value, variant);
12054 }
12055 else
12056 {
12057 if (variant != NULL)
12058 g_dbus_gvariant_to_gvalue (variant, value);
12059 }
12060 if (variant != NULL)
12061 g_variant_unref (variant);
12062}
12063
12064static void
12065shared_resource_proxy_set_property_cb (GDBusProxy *proxy,
12066 GAsyncResult *res,
12067 gpointer user_data)
12068{
12069 const _ExtendedGDBusPropertyInfo *info = user_data;
12070 GError *error;
12071 GVariant *_ret;
12072 error = NULL;
12073 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
12074 if (!_ret)
12075 {
12076 g_warning ("Error setting property '%s' on interface org.openbmc.SharedResource: %s (%s, %d)",
12077 info->parent_struct.name,
12078 error->message, g_quark_to_string (error->domain), error->code);
12079 g_error_free (error);
12080 }
12081 else
12082 {
12083 g_variant_unref (_ret);
12084 }
12085}
12086
12087static void
12088shared_resource_proxy_set_property (GObject *object,
12089 guint prop_id,
12090 const GValue *value,
12091 GParamSpec *pspec G_GNUC_UNUSED)
12092{
12093 const _ExtendedGDBusPropertyInfo *info;
12094 GVariant *variant;
12095 g_assert (prop_id != 0 && prop_id - 1 < 2);
12096 info = _shared_resource_property_info_pointers[prop_id - 1];
12097 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
12098 g_dbus_proxy_call (G_DBUS_PROXY (object),
12099 "org.freedesktop.DBus.Properties.Set",
12100 g_variant_new ("(ssv)", "org.openbmc.SharedResource", info->parent_struct.name, variant),
12101 G_DBUS_CALL_FLAGS_NONE,
12102 -1,
12103 NULL, (GAsyncReadyCallback) shared_resource_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
12104 g_variant_unref (variant);
12105}
12106
12107static void
12108shared_resource_proxy_g_signal (GDBusProxy *proxy,
12109 const gchar *sender_name G_GNUC_UNUSED,
12110 const gchar *signal_name,
12111 GVariant *parameters)
12112{
12113 _ExtendedGDBusSignalInfo *info;
12114 GVariantIter iter;
12115 GVariant *child;
12116 GValue *paramv;
12117 guint num_params;
12118 guint n;
12119 guint signal_id;
12120 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct, signal_name);
12121 if (info == NULL)
12122 return;
12123 num_params = g_variant_n_children (parameters);
12124 paramv = g_new0 (GValue, num_params + 1);
12125 g_value_init (&paramv[0], TYPE_SHARED_RESOURCE);
12126 g_value_set_object (&paramv[0], proxy);
12127 g_variant_iter_init (&iter, parameters);
12128 n = 1;
12129 while ((child = g_variant_iter_next_value (&iter)) != NULL)
12130 {
12131 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
12132 if (arg_info->use_gvariant)
12133 {
12134 g_value_init (&paramv[n], G_TYPE_VARIANT);
12135 g_value_set_variant (&paramv[n], child);
12136 n++;
12137 }
12138 else
12139 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
12140 g_variant_unref (child);
12141 }
12142 signal_id = g_signal_lookup (info->signal_name, TYPE_SHARED_RESOURCE);
12143 g_signal_emitv (paramv, signal_id, 0, NULL);
12144 for (n = 0; n < num_params + 1; n++)
12145 g_value_unset (&paramv[n]);
12146 g_free (paramv);
12147}
12148
12149static void
12150shared_resource_proxy_g_properties_changed (GDBusProxy *_proxy,
12151 GVariant *changed_properties,
12152 const gchar *const *invalidated_properties)
12153{
12154 SharedResourceProxy *proxy = SHARED_RESOURCE_PROXY (_proxy);
12155 guint n;
12156 const gchar *key;
12157 GVariantIter *iter;
12158 _ExtendedGDBusPropertyInfo *info;
12159 g_variant_get (changed_properties, "a{sv}", &iter);
12160 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
12161 {
12162 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct, key);
12163 g_datalist_remove_data (&proxy->priv->qdata, key);
12164 if (info != NULL)
12165 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
12166 }
12167 g_variant_iter_free (iter);
12168 for (n = 0; invalidated_properties[n] != NULL; n++)
12169 {
12170 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct, invalidated_properties[n]);
12171 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
12172 if (info != NULL)
12173 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
12174 }
12175}
12176
12177static gboolean
12178shared_resource_proxy_get_lock (SharedResource *object)
12179{
12180 SharedResourceProxy *proxy = SHARED_RESOURCE_PROXY (object);
12181 GVariant *variant;
12182 gboolean value = 0;
12183 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "lock");
12184 if (variant != NULL)
12185 {
12186 value = g_variant_get_boolean (variant);
12187 g_variant_unref (variant);
12188 }
12189 return value;
12190}
12191
12192static const gchar *
12193shared_resource_proxy_get_name (SharedResource *object)
12194{
12195 SharedResourceProxy *proxy = SHARED_RESOURCE_PROXY (object);
12196 GVariant *variant;
12197 const gchar *value = NULL;
12198 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "name");
12199 if (variant != NULL)
12200 {
12201 value = g_variant_get_string (variant, NULL);
12202 g_variant_unref (variant);
12203 }
12204 return value;
12205}
12206
12207static void
12208shared_resource_proxy_init (SharedResourceProxy *proxy)
12209{
12210#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
12211 proxy->priv = shared_resource_proxy_get_instance_private (proxy);
12212#else
12213 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SHARED_RESOURCE_PROXY, SharedResourceProxyPrivate);
12214#endif
12215
12216 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), shared_resource_interface_info ());
12217}
12218
12219static void
12220shared_resource_proxy_class_init (SharedResourceProxyClass *klass)
12221{
12222 GObjectClass *gobject_class;
12223 GDBusProxyClass *proxy_class;
12224
12225 gobject_class = G_OBJECT_CLASS (klass);
12226 gobject_class->finalize = shared_resource_proxy_finalize;
12227 gobject_class->get_property = shared_resource_proxy_get_property;
12228 gobject_class->set_property = shared_resource_proxy_set_property;
12229
12230 proxy_class = G_DBUS_PROXY_CLASS (klass);
12231 proxy_class->g_signal = shared_resource_proxy_g_signal;
12232 proxy_class->g_properties_changed = shared_resource_proxy_g_properties_changed;
12233
12234 shared_resource_override_properties (gobject_class, 1);
12235
12236#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
12237 g_type_class_add_private (klass, sizeof (SharedResourceProxyPrivate));
12238#endif
12239}
12240
12241static void
12242shared_resource_proxy_iface_init (SharedResourceIface *iface)
12243{
12244 iface->get_lock = shared_resource_proxy_get_lock;
12245 iface->get_name = shared_resource_proxy_get_name;
12246}
12247
12248/**
12249 * shared_resource_proxy_new:
12250 * @connection: A #GDBusConnection.
12251 * @flags: Flags from the #GDBusProxyFlags enumeration.
12252 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
12253 * @object_path: An object path.
12254 * @cancellable: (allow-none): A #GCancellable or %NULL.
12255 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
12256 * @user_data: User data to pass to @callback.
12257 *
12258 * 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.
12259 *
12260 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
12261 * You can then call shared_resource_proxy_new_finish() to get the result of the operation.
12262 *
12263 * See shared_resource_proxy_new_sync() for the synchronous, blocking version of this constructor.
12264 */
12265void
12266shared_resource_proxy_new (
12267 GDBusConnection *connection,
12268 GDBusProxyFlags flags,
12269 const gchar *name,
12270 const gchar *object_path,
12271 GCancellable *cancellable,
12272 GAsyncReadyCallback callback,
12273 gpointer user_data)
12274{
12275 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);
12276}
12277
12278/**
12279 * shared_resource_proxy_new_finish:
12280 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to shared_resource_proxy_new().
12281 * @error: Return location for error or %NULL
12282 *
12283 * Finishes an operation started with shared_resource_proxy_new().
12284 *
12285 * Returns: (transfer full) (type SharedResourceProxy): The constructed proxy object or %NULL if @error is set.
12286 */
12287SharedResource *
12288shared_resource_proxy_new_finish (
12289 GAsyncResult *res,
12290 GError **error)
12291{
12292 GObject *ret;
12293 GObject *source_object;
12294 source_object = g_async_result_get_source_object (res);
12295 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
12296 g_object_unref (source_object);
12297 if (ret != NULL)
12298 return SHARED_RESOURCE (ret);
12299 else
12300 return NULL;
12301}
12302
12303/**
12304 * shared_resource_proxy_new_sync:
12305 * @connection: A #GDBusConnection.
12306 * @flags: Flags from the #GDBusProxyFlags enumeration.
12307 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
12308 * @object_path: An object path.
12309 * @cancellable: (allow-none): A #GCancellable or %NULL.
12310 * @error: Return location for error or %NULL
12311 *
12312 * 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.
12313 *
12314 * The calling thread is blocked until a reply is received.
12315 *
12316 * See shared_resource_proxy_new() for the asynchronous version of this constructor.
12317 *
12318 * Returns: (transfer full) (type SharedResourceProxy): The constructed proxy object or %NULL if @error is set.
12319 */
12320SharedResource *
12321shared_resource_proxy_new_sync (
12322 GDBusConnection *connection,
12323 GDBusProxyFlags flags,
12324 const gchar *name,
12325 const gchar *object_path,
12326 GCancellable *cancellable,
12327 GError **error)
12328{
12329 GInitable *ret;
12330 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);
12331 if (ret != NULL)
12332 return SHARED_RESOURCE (ret);
12333 else
12334 return NULL;
12335}
12336
12337
12338/**
12339 * shared_resource_proxy_new_for_bus:
12340 * @bus_type: A #GBusType.
12341 * @flags: Flags from the #GDBusProxyFlags enumeration.
12342 * @name: A bus name (well-known or unique).
12343 * @object_path: An object path.
12344 * @cancellable: (allow-none): A #GCancellable or %NULL.
12345 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
12346 * @user_data: User data to pass to @callback.
12347 *
12348 * Like shared_resource_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
12349 *
12350 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
12351 * You can then call shared_resource_proxy_new_for_bus_finish() to get the result of the operation.
12352 *
12353 * See shared_resource_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
12354 */
12355void
12356shared_resource_proxy_new_for_bus (
12357 GBusType bus_type,
12358 GDBusProxyFlags flags,
12359 const gchar *name,
12360 const gchar *object_path,
12361 GCancellable *cancellable,
12362 GAsyncReadyCallback callback,
12363 gpointer user_data)
12364{
12365 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);
12366}
12367
12368/**
12369 * shared_resource_proxy_new_for_bus_finish:
12370 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to shared_resource_proxy_new_for_bus().
12371 * @error: Return location for error or %NULL
12372 *
12373 * Finishes an operation started with shared_resource_proxy_new_for_bus().
12374 *
12375 * Returns: (transfer full) (type SharedResourceProxy): The constructed proxy object or %NULL if @error is set.
12376 */
12377SharedResource *
12378shared_resource_proxy_new_for_bus_finish (
12379 GAsyncResult *res,
12380 GError **error)
12381{
12382 GObject *ret;
12383 GObject *source_object;
12384 source_object = g_async_result_get_source_object (res);
12385 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
12386 g_object_unref (source_object);
12387 if (ret != NULL)
12388 return SHARED_RESOURCE (ret);
12389 else
12390 return NULL;
12391}
12392
12393/**
12394 * shared_resource_proxy_new_for_bus_sync:
12395 * @bus_type: A #GBusType.
12396 * @flags: Flags from the #GDBusProxyFlags enumeration.
12397 * @name: A bus name (well-known or unique).
12398 * @object_path: An object path.
12399 * @cancellable: (allow-none): A #GCancellable or %NULL.
12400 * @error: Return location for error or %NULL
12401 *
12402 * Like shared_resource_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
12403 *
12404 * The calling thread is blocked until a reply is received.
12405 *
12406 * See shared_resource_proxy_new_for_bus() for the asynchronous version of this constructor.
12407 *
12408 * Returns: (transfer full) (type SharedResourceProxy): The constructed proxy object or %NULL if @error is set.
12409 */
12410SharedResource *
12411shared_resource_proxy_new_for_bus_sync (
12412 GBusType bus_type,
12413 GDBusProxyFlags flags,
12414 const gchar *name,
12415 const gchar *object_path,
12416 GCancellable *cancellable,
12417 GError **error)
12418{
12419 GInitable *ret;
12420 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);
12421 if (ret != NULL)
12422 return SHARED_RESOURCE (ret);
12423 else
12424 return NULL;
12425}
12426
12427
12428/* ------------------------------------------------------------------------ */
12429
12430/**
12431 * SharedResourceSkeleton:
12432 *
12433 * The #SharedResourceSkeleton structure contains only private data and should only be accessed using the provided API.
12434 */
12435
12436/**
12437 * SharedResourceSkeletonClass:
12438 * @parent_class: The parent class.
12439 *
12440 * Class structure for #SharedResourceSkeleton.
12441 */
12442
12443struct _SharedResourceSkeletonPrivate
12444{
12445 GValue *properties;
12446 GList *changed_properties;
12447 GSource *changed_properties_idle_source;
12448 GMainContext *context;
12449 GMutex lock;
12450};
12451
12452static void
12453_shared_resource_skeleton_handle_method_call (
12454 GDBusConnection *connection G_GNUC_UNUSED,
12455 const gchar *sender G_GNUC_UNUSED,
12456 const gchar *object_path G_GNUC_UNUSED,
12457 const gchar *interface_name,
12458 const gchar *method_name,
12459 GVariant *parameters,
12460 GDBusMethodInvocation *invocation,
12461 gpointer user_data)
12462{
12463 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (user_data);
12464 _ExtendedGDBusMethodInfo *info;
12465 GVariantIter iter;
12466 GVariant *child;
12467 GValue *paramv;
12468 guint num_params;
12469 guint num_extra;
12470 guint n;
12471 guint signal_id;
12472 GValue return_value = G_VALUE_INIT;
12473 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
12474 g_assert (info != NULL);
12475 num_params = g_variant_n_children (parameters);
12476 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
12477 n = 0;
12478 g_value_init (&paramv[n], TYPE_SHARED_RESOURCE);
12479 g_value_set_object (&paramv[n++], skeleton);
12480 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
12481 g_value_set_object (&paramv[n++], invocation);
12482 if (info->pass_fdlist)
12483 {
12484#ifdef G_OS_UNIX
12485 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
12486 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
12487#else
12488 g_assert_not_reached ();
12489#endif
12490 }
12491 g_variant_iter_init (&iter, parameters);
12492 while ((child = g_variant_iter_next_value (&iter)) != NULL)
12493 {
12494 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
12495 if (arg_info->use_gvariant)
12496 {
12497 g_value_init (&paramv[n], G_TYPE_VARIANT);
12498 g_value_set_variant (&paramv[n], child);
12499 n++;
12500 }
12501 else
12502 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
12503 g_variant_unref (child);
12504 }
12505 signal_id = g_signal_lookup (info->signal_name, TYPE_SHARED_RESOURCE);
12506 g_value_init (&return_value, G_TYPE_BOOLEAN);
12507 g_signal_emitv (paramv, signal_id, 0, &return_value);
12508 if (!g_value_get_boolean (&return_value))
12509 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);
12510 g_value_unset (&return_value);
12511 for (n = 0; n < num_params + num_extra; n++)
12512 g_value_unset (&paramv[n]);
12513 g_free (paramv);
12514}
12515
12516static GVariant *
12517_shared_resource_skeleton_handle_get_property (
12518 GDBusConnection *connection G_GNUC_UNUSED,
12519 const gchar *sender G_GNUC_UNUSED,
12520 const gchar *object_path G_GNUC_UNUSED,
12521 const gchar *interface_name G_GNUC_UNUSED,
12522 const gchar *property_name,
12523 GError **error,
12524 gpointer user_data)
12525{
12526 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (user_data);
12527 GValue value = G_VALUE_INIT;
12528 GParamSpec *pspec;
12529 _ExtendedGDBusPropertyInfo *info;
12530 GVariant *ret;
12531 ret = NULL;
12532 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct, property_name);
12533 g_assert (info != NULL);
12534 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
12535 if (pspec == NULL)
12536 {
12537 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
12538 }
12539 else
12540 {
12541 g_value_init (&value, pspec->value_type);
12542 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
12543 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
12544 g_value_unset (&value);
12545 }
12546 return ret;
12547}
12548
12549static gboolean
12550_shared_resource_skeleton_handle_set_property (
12551 GDBusConnection *connection G_GNUC_UNUSED,
12552 const gchar *sender G_GNUC_UNUSED,
12553 const gchar *object_path G_GNUC_UNUSED,
12554 const gchar *interface_name G_GNUC_UNUSED,
12555 const gchar *property_name,
12556 GVariant *variant,
12557 GError **error,
12558 gpointer user_data)
12559{
12560 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (user_data);
12561 GValue value = G_VALUE_INIT;
12562 GParamSpec *pspec;
12563 _ExtendedGDBusPropertyInfo *info;
12564 gboolean ret;
12565 ret = FALSE;
12566 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct, property_name);
12567 g_assert (info != NULL);
12568 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
12569 if (pspec == NULL)
12570 {
12571 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
12572 }
12573 else
12574 {
12575 if (info->use_gvariant)
12576 g_value_set_variant (&value, variant);
12577 else
12578 g_dbus_gvariant_to_gvalue (variant, &value);
12579 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
12580 g_value_unset (&value);
12581 ret = TRUE;
12582 }
12583 return ret;
12584}
12585
12586static const GDBusInterfaceVTable _shared_resource_skeleton_vtable =
12587{
12588 _shared_resource_skeleton_handle_method_call,
12589 _shared_resource_skeleton_handle_get_property,
12590 _shared_resource_skeleton_handle_set_property,
12591 {NULL}
12592};
12593
12594static GDBusInterfaceInfo *
12595shared_resource_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
12596{
12597 return shared_resource_interface_info ();
12598}
12599
12600static GDBusInterfaceVTable *
12601shared_resource_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
12602{
12603 return (GDBusInterfaceVTable *) &_shared_resource_skeleton_vtable;
12604}
12605
12606static GVariant *
12607shared_resource_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
12608{
12609 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (_skeleton);
12610
12611 GVariantBuilder builder;
12612 guint n;
12613 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
12614 if (_shared_resource_interface_info.parent_struct.properties == NULL)
12615 goto out;
12616 for (n = 0; _shared_resource_interface_info.parent_struct.properties[n] != NULL; n++)
12617 {
12618 GDBusPropertyInfo *info = _shared_resource_interface_info.parent_struct.properties[n];
12619 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
12620 {
12621 GVariant *value;
12622 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);
12623 if (value != NULL)
12624 {
12625 g_variant_take_ref (value);
12626 g_variant_builder_add (&builder, "{sv}", info->name, value);
12627 g_variant_unref (value);
12628 }
12629 }
12630 }
12631out:
12632 return g_variant_builder_end (&builder);
12633}
12634
12635static gboolean _shared_resource_emit_changed (gpointer user_data);
12636
12637static void
12638shared_resource_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
12639{
12640 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (_skeleton);
12641 gboolean emit_changed = FALSE;
12642
12643 g_mutex_lock (&skeleton->priv->lock);
12644 if (skeleton->priv->changed_properties_idle_source != NULL)
12645 {
12646 g_source_destroy (skeleton->priv->changed_properties_idle_source);
12647 skeleton->priv->changed_properties_idle_source = NULL;
12648 emit_changed = TRUE;
12649 }
12650 g_mutex_unlock (&skeleton->priv->lock);
12651
12652 if (emit_changed)
12653 _shared_resource_emit_changed (skeleton);
12654}
12655
12656static void shared_resource_skeleton_iface_init (SharedResourceIface *iface);
12657#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
12658G_DEFINE_TYPE_WITH_CODE (SharedResourceSkeleton, shared_resource_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
12659 G_ADD_PRIVATE (SharedResourceSkeleton)
12660 G_IMPLEMENT_INTERFACE (TYPE_SHARED_RESOURCE, shared_resource_skeleton_iface_init));
12661
12662#else
12663G_DEFINE_TYPE_WITH_CODE (SharedResourceSkeleton, shared_resource_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
12664 G_IMPLEMENT_INTERFACE (TYPE_SHARED_RESOURCE, shared_resource_skeleton_iface_init));
12665
12666#endif
12667static void
12668shared_resource_skeleton_finalize (GObject *object)
12669{
12670 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object);
12671 guint n;
12672 for (n = 0; n < 2; n++)
12673 g_value_unset (&skeleton->priv->properties[n]);
12674 g_free (skeleton->priv->properties);
12675 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
12676 if (skeleton->priv->changed_properties_idle_source != NULL)
12677 g_source_destroy (skeleton->priv->changed_properties_idle_source);
12678 g_main_context_unref (skeleton->priv->context);
12679 g_mutex_clear (&skeleton->priv->lock);
12680 G_OBJECT_CLASS (shared_resource_skeleton_parent_class)->finalize (object);
12681}
12682
12683static void
12684shared_resource_skeleton_get_property (GObject *object,
12685 guint prop_id,
12686 GValue *value,
12687 GParamSpec *pspec G_GNUC_UNUSED)
12688{
12689 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object);
12690 g_assert (prop_id != 0 && prop_id - 1 < 2);
12691 g_mutex_lock (&skeleton->priv->lock);
12692 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
12693 g_mutex_unlock (&skeleton->priv->lock);
12694}
12695
12696static gboolean
12697_shared_resource_emit_changed (gpointer user_data)
12698{
12699 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (user_data);
12700 GList *l;
12701 GVariantBuilder builder;
12702 GVariantBuilder invalidated_builder;
12703 guint num_changes;
12704
12705 g_mutex_lock (&skeleton->priv->lock);
12706 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
12707 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
12708 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
12709 {
12710 ChangedProperty *cp = l->data;
12711 GVariant *variant;
12712 const GValue *cur_value;
12713
12714 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
12715 if (!_g_value_equal (cur_value, &cp->orig_value))
12716 {
12717 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
12718 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
12719 g_variant_unref (variant);
12720 num_changes++;
12721 }
12722 }
12723 if (num_changes > 0)
12724 {
12725 GList *connections, *ll;
12726 GVariant *signal_variant;
12727 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SharedResource",
12728 &builder, &invalidated_builder));
12729 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
12730 for (ll = connections; ll != NULL; ll = ll->next)
12731 {
12732 GDBusConnection *connection = ll->data;
12733
12734 g_dbus_connection_emit_signal (connection,
12735 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
12736 "org.freedesktop.DBus.Properties",
12737 "PropertiesChanged",
12738 signal_variant,
12739 NULL);
12740 }
12741 g_variant_unref (signal_variant);
12742 g_list_free_full (connections, g_object_unref);
12743 }
12744 else
12745 {
12746 g_variant_builder_clear (&builder);
12747 g_variant_builder_clear (&invalidated_builder);
12748 }
12749 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
12750 skeleton->priv->changed_properties = NULL;
12751 skeleton->priv->changed_properties_idle_source = NULL;
12752 g_mutex_unlock (&skeleton->priv->lock);
12753 return FALSE;
12754}
12755
12756static void
12757_shared_resource_schedule_emit_changed (SharedResourceSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
12758{
12759 ChangedProperty *cp;
12760 GList *l;
12761 cp = NULL;
12762 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
12763 {
12764 ChangedProperty *i_cp = l->data;
12765 if (i_cp->info == info)
12766 {
12767 cp = i_cp;
12768 break;
12769 }
12770 }
12771 if (cp == NULL)
12772 {
12773 cp = g_new0 (ChangedProperty, 1);
12774 cp->prop_id = prop_id;
12775 cp->info = info;
12776 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
12777 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
12778 g_value_copy (orig_value, &cp->orig_value);
12779 }
12780}
12781
12782static void
12783shared_resource_skeleton_notify (GObject *object,
12784 GParamSpec *pspec G_GNUC_UNUSED)
12785{
12786 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object);
12787 g_mutex_lock (&skeleton->priv->lock);
12788 if (skeleton->priv->changed_properties != NULL &&
12789 skeleton->priv->changed_properties_idle_source == NULL)
12790 {
12791 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
12792 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
12793 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _shared_resource_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
Adriana Kobylakfd778822016-06-16 09:08:37 -050012794 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _shared_resource_emit_changed");
Norman James18998182015-10-11 21:54:53 -050012795 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
12796 g_source_unref (skeleton->priv->changed_properties_idle_source);
12797 }
12798 g_mutex_unlock (&skeleton->priv->lock);
12799}
12800
12801static void
12802shared_resource_skeleton_set_property (GObject *object,
12803 guint prop_id,
12804 const GValue *value,
12805 GParamSpec *pspec)
12806{
12807 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object);
12808 g_assert (prop_id != 0 && prop_id - 1 < 2);
12809 g_mutex_lock (&skeleton->priv->lock);
12810 g_object_freeze_notify (object);
12811 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
12812 {
12813 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
12814 _shared_resource_schedule_emit_changed (skeleton, _shared_resource_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
12815 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
12816 g_object_notify_by_pspec (object, pspec);
12817 }
12818 g_mutex_unlock (&skeleton->priv->lock);
12819 g_object_thaw_notify (object);
12820}
12821
12822static void
12823shared_resource_skeleton_init (SharedResourceSkeleton *skeleton)
12824{
12825#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
12826 skeleton->priv = shared_resource_skeleton_get_instance_private (skeleton);
12827#else
12828 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SHARED_RESOURCE_SKELETON, SharedResourceSkeletonPrivate);
12829#endif
12830
12831 g_mutex_init (&skeleton->priv->lock);
12832 skeleton->priv->context = g_main_context_ref_thread_default ();
12833 skeleton->priv->properties = g_new0 (GValue, 2);
12834 g_value_init (&skeleton->priv->properties[0], G_TYPE_BOOLEAN);
12835 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
12836}
12837
12838static gboolean
12839shared_resource_skeleton_get_lock (SharedResource *object)
12840{
12841 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object);
12842 gboolean value;
12843 g_mutex_lock (&skeleton->priv->lock);
12844 value = g_value_get_boolean (&(skeleton->priv->properties[0]));
12845 g_mutex_unlock (&skeleton->priv->lock);
12846 return value;
12847}
12848
12849static const gchar *
12850shared_resource_skeleton_get_name (SharedResource *object)
12851{
12852 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object);
12853 const gchar *value;
12854 g_mutex_lock (&skeleton->priv->lock);
12855 value = g_value_get_string (&(skeleton->priv->properties[1]));
12856 g_mutex_unlock (&skeleton->priv->lock);
12857 return value;
12858}
12859
12860static void
12861shared_resource_skeleton_class_init (SharedResourceSkeletonClass *klass)
12862{
12863 GObjectClass *gobject_class;
12864 GDBusInterfaceSkeletonClass *skeleton_class;
12865
12866 gobject_class = G_OBJECT_CLASS (klass);
12867 gobject_class->finalize = shared_resource_skeleton_finalize;
12868 gobject_class->get_property = shared_resource_skeleton_get_property;
12869 gobject_class->set_property = shared_resource_skeleton_set_property;
12870 gobject_class->notify = shared_resource_skeleton_notify;
12871
12872
12873 shared_resource_override_properties (gobject_class, 1);
12874
12875 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
12876 skeleton_class->get_info = shared_resource_skeleton_dbus_interface_get_info;
12877 skeleton_class->get_properties = shared_resource_skeleton_dbus_interface_get_properties;
12878 skeleton_class->flush = shared_resource_skeleton_dbus_interface_flush;
12879 skeleton_class->get_vtable = shared_resource_skeleton_dbus_interface_get_vtable;
12880
12881#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
12882 g_type_class_add_private (klass, sizeof (SharedResourceSkeletonPrivate));
12883#endif
12884}
12885
12886static void
12887shared_resource_skeleton_iface_init (SharedResourceIface *iface)
12888{
12889 iface->get_lock = shared_resource_skeleton_get_lock;
12890 iface->get_name = shared_resource_skeleton_get_name;
12891}
12892
12893/**
12894 * shared_resource_skeleton_new:
12895 *
12896 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link>.
12897 *
12898 * Returns: (transfer full) (type SharedResourceSkeleton): The skeleton object.
12899 */
12900SharedResource *
12901shared_resource_skeleton_new (void)
12902{
12903 return SHARED_RESOURCE (g_object_new (TYPE_SHARED_RESOURCE_SKELETON, NULL));
12904}
12905
12906/* ------------------------------------------------------------------------
Norman James362a80f2015-09-14 14:04:39 -050012907 * Code for interface org.openbmc.Control
12908 * ------------------------------------------------------------------------
12909 */
12910
12911/**
12912 * SECTION:Control
12913 * @title: Control
12914 * @short_description: Generated C code for the org.openbmc.Control D-Bus interface
12915 *
12916 * 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.
12917 */
12918
12919/* ---- Introspection data for org.openbmc.Control ---- */
12920
12921static const _ExtendedGDBusMethodInfo _control_method_info_init =
12922{
12923 {
12924 -1,
12925 (gchar *) "init",
12926 NULL,
12927 NULL,
12928 NULL
12929 },
12930 "handle-init",
12931 FALSE
12932};
12933
12934static const _ExtendedGDBusMethodInfo * const _control_method_info_pointers[] =
12935{
12936 &_control_method_info_init,
12937 NULL
12938};
12939
12940static const _ExtendedGDBusArgInfo _control_signal_info_heartbeat_ARG_bus_name =
12941{
12942 {
12943 -1,
12944 (gchar *) "bus_name",
12945 (gchar *) "s",
12946 NULL
12947 },
12948 FALSE
12949};
12950
12951static const _ExtendedGDBusArgInfo * const _control_signal_info_heartbeat_ARG_pointers[] =
12952{
12953 &_control_signal_info_heartbeat_ARG_bus_name,
12954 NULL
12955};
12956
12957static const _ExtendedGDBusSignalInfo _control_signal_info_heartbeat =
12958{
12959 {
12960 -1,
12961 (gchar *) "Heartbeat",
12962 (GDBusArgInfo **) &_control_signal_info_heartbeat_ARG_pointers,
12963 NULL
12964 },
12965 "heartbeat"
12966};
12967
12968static const _ExtendedGDBusArgInfo _control_signal_info_goto_system_state_ARG_state_name =
12969{
12970 {
12971 -1,
12972 (gchar *) "state_name",
12973 (gchar *) "s",
12974 NULL
12975 },
12976 FALSE
12977};
12978
12979static const _ExtendedGDBusArgInfo * const _control_signal_info_goto_system_state_ARG_pointers[] =
12980{
12981 &_control_signal_info_goto_system_state_ARG_state_name,
12982 NULL
12983};
12984
12985static const _ExtendedGDBusSignalInfo _control_signal_info_goto_system_state =
12986{
12987 {
12988 -1,
12989 (gchar *) "GotoSystemState",
12990 (GDBusArgInfo **) &_control_signal_info_goto_system_state_ARG_pointers,
12991 NULL
12992 },
12993 "goto-system-state"
12994};
12995
Norman Jamesa3e47c42015-10-18 14:43:10 -050012996static const _ExtendedGDBusSignalInfo _control_signal_info_started =
12997{
12998 {
12999 -1,
13000 (gchar *) "Started",
13001 NULL,
13002 NULL
13003 },
13004 "started"
13005};
13006
Norman James362a80f2015-09-14 14:04:39 -050013007static const _ExtendedGDBusSignalInfo * const _control_signal_info_pointers[] =
13008{
13009 &_control_signal_info_heartbeat,
13010 &_control_signal_info_goto_system_state,
Norman Jamesa3e47c42015-10-18 14:43:10 -050013011 &_control_signal_info_started,
Norman James362a80f2015-09-14 14:04:39 -050013012 NULL
13013};
13014
13015static const _ExtendedGDBusPropertyInfo _control_property_info_poll_interval =
13016{
13017 {
13018 -1,
13019 (gchar *) "poll_interval",
13020 (gchar *) "i",
13021 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
13022 NULL
13023 },
13024 "poll-interval",
13025 FALSE
13026};
13027
13028static const _ExtendedGDBusPropertyInfo _control_property_info_heatbeat =
13029{
13030 {
13031 -1,
13032 (gchar *) "heatbeat",
13033 (gchar *) "i",
13034 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
13035 NULL
13036 },
13037 "heatbeat",
13038 FALSE
13039};
13040
13041static const _ExtendedGDBusPropertyInfo * const _control_property_info_pointers[] =
13042{
13043 &_control_property_info_poll_interval,
13044 &_control_property_info_heatbeat,
13045 NULL
13046};
13047
13048static const _ExtendedGDBusInterfaceInfo _control_interface_info =
13049{
13050 {
13051 -1,
13052 (gchar *) "org.openbmc.Control",
13053 (GDBusMethodInfo **) &_control_method_info_pointers,
13054 (GDBusSignalInfo **) &_control_signal_info_pointers,
13055 (GDBusPropertyInfo **) &_control_property_info_pointers,
13056 NULL
13057 },
13058 "control",
13059};
13060
13061
13062/**
13063 * control_interface_info:
13064 *
13065 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link> D-Bus interface.
13066 *
13067 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
13068 */
13069GDBusInterfaceInfo *
13070control_interface_info (void)
13071{
13072 return (GDBusInterfaceInfo *) &_control_interface_info.parent_struct;
13073}
13074
13075/**
13076 * control_override_properties:
13077 * @klass: The class structure for a #GObject<!-- -->-derived class.
13078 * @property_id_begin: The property id to assign to the first overridden property.
13079 *
13080 * Overrides all #GObject properties in the #Control interface for a concrete class.
13081 * The properties are overridden in the order they are defined.
13082 *
13083 * Returns: The last property id.
13084 */
13085guint
13086control_override_properties (GObjectClass *klass, guint property_id_begin)
13087{
13088 g_object_class_override_property (klass, property_id_begin++, "poll-interval");
13089 g_object_class_override_property (klass, property_id_begin++, "heatbeat");
13090 return property_id_begin - 1;
13091}
13092
13093
13094
13095/**
13096 * Control:
13097 *
13098 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link>.
13099 */
13100
13101/**
13102 * ControlIface:
13103 * @parent_iface: The parent interface.
13104 * @handle_init: Handler for the #Control::handle-init signal.
13105 * @get_heatbeat: Getter for the #Control:heatbeat property.
13106 * @get_poll_interval: Getter for the #Control:poll-interval property.
13107 * @goto_system_state: Handler for the #Control::goto-system-state signal.
13108 * @heartbeat: Handler for the #Control::heartbeat signal.
Norman Jamesa3e47c42015-10-18 14:43:10 -050013109 * @started: Handler for the #Control::started signal.
Norman James362a80f2015-09-14 14:04:39 -050013110 *
13111 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link>.
13112 */
13113
13114typedef ControlIface ControlInterface;
13115G_DEFINE_INTERFACE (Control, control, G_TYPE_OBJECT);
13116
13117static void
13118control_default_init (ControlIface *iface)
13119{
13120 /* GObject signals for incoming D-Bus method calls: */
13121 /**
13122 * Control::handle-init:
13123 * @object: A #Control.
13124 * @invocation: A #GDBusMethodInvocation.
13125 *
13126 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Control.init">init()</link> D-Bus method.
13127 *
13128 * 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.
13129 *
13130 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
13131 */
13132 g_signal_new ("handle-init",
13133 G_TYPE_FROM_INTERFACE (iface),
13134 G_SIGNAL_RUN_LAST,
13135 G_STRUCT_OFFSET (ControlIface, handle_init),
13136 g_signal_accumulator_true_handled,
13137 NULL,
13138 g_cclosure_marshal_generic,
13139 G_TYPE_BOOLEAN,
13140 1,
13141 G_TYPE_DBUS_METHOD_INVOCATION);
13142
13143 /* GObject signals for received D-Bus signals: */
13144 /**
13145 * Control::heartbeat:
13146 * @object: A #Control.
13147 * @arg_bus_name: Argument.
13148 *
13149 * 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.
13150 *
13151 * 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.
13152 */
13153 g_signal_new ("heartbeat",
13154 G_TYPE_FROM_INTERFACE (iface),
13155 G_SIGNAL_RUN_LAST,
13156 G_STRUCT_OFFSET (ControlIface, heartbeat),
13157 NULL,
13158 NULL,
13159 g_cclosure_marshal_generic,
13160 G_TYPE_NONE,
13161 1, G_TYPE_STRING);
13162
13163 /**
13164 * Control::goto-system-state:
13165 * @object: A #Control.
13166 * @arg_state_name: Argument.
13167 *
13168 * 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.
13169 *
13170 * 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.
13171 */
13172 g_signal_new ("goto-system-state",
13173 G_TYPE_FROM_INTERFACE (iface),
13174 G_SIGNAL_RUN_LAST,
13175 G_STRUCT_OFFSET (ControlIface, goto_system_state),
13176 NULL,
13177 NULL,
13178 g_cclosure_marshal_generic,
13179 G_TYPE_NONE,
13180 1, G_TYPE_STRING);
13181
Norman Jamesa3e47c42015-10-18 14:43:10 -050013182 /**
13183 * Control::started:
13184 * @object: A #Control.
13185 *
13186 * 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.
13187 *
13188 * 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.
13189 */
13190 g_signal_new ("started",
13191 G_TYPE_FROM_INTERFACE (iface),
13192 G_SIGNAL_RUN_LAST,
13193 G_STRUCT_OFFSET (ControlIface, started),
13194 NULL,
13195 NULL,
13196 g_cclosure_marshal_generic,
13197 G_TYPE_NONE,
13198 0);
13199
Norman James362a80f2015-09-14 14:04:39 -050013200 /* GObject properties for D-Bus properties: */
13201 /**
13202 * Control:poll-interval:
13203 *
13204 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Control.poll_interval">"poll_interval"</link>.
13205 *
13206 * 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.
13207 */
13208 g_object_interface_install_property (iface,
13209 g_param_spec_int ("poll-interval", "poll_interval", "poll_interval", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
13210 /**
13211 * Control:heatbeat:
13212 *
13213 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Control.heatbeat">"heatbeat"</link>.
13214 *
13215 * 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.
13216 */
13217 g_object_interface_install_property (iface,
13218 g_param_spec_int ("heatbeat", "heatbeat", "heatbeat", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
13219}
13220
13221/**
13222 * control_get_poll_interval: (skip)
13223 * @object: A #Control.
13224 *
13225 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Control.poll_interval">"poll_interval"</link> D-Bus property.
13226 *
13227 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
13228 *
13229 * Returns: The property value.
13230 */
13231gint
13232control_get_poll_interval (Control *object)
13233{
13234 return CONTROL_GET_IFACE (object)->get_poll_interval (object);
13235}
13236
13237/**
13238 * control_set_poll_interval: (skip)
13239 * @object: A #Control.
13240 * @value: The value to set.
13241 *
13242 * Sets the <link linkend="gdbus-property-org-openbmc-Control.poll_interval">"poll_interval"</link> D-Bus property to @value.
13243 *
13244 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
13245 */
13246void
13247control_set_poll_interval (Control *object, gint value)
13248{
13249 g_object_set (G_OBJECT (object), "poll-interval", value, NULL);
13250}
13251
13252/**
13253 * control_get_heatbeat: (skip)
13254 * @object: A #Control.
13255 *
13256 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Control.heatbeat">"heatbeat"</link> D-Bus property.
13257 *
13258 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
13259 *
13260 * Returns: The property value.
13261 */
13262gint
13263control_get_heatbeat (Control *object)
13264{
13265 return CONTROL_GET_IFACE (object)->get_heatbeat (object);
13266}
13267
13268/**
13269 * control_set_heatbeat: (skip)
13270 * @object: A #Control.
13271 * @value: The value to set.
13272 *
13273 * Sets the <link linkend="gdbus-property-org-openbmc-Control.heatbeat">"heatbeat"</link> D-Bus property to @value.
13274 *
13275 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
13276 */
13277void
13278control_set_heatbeat (Control *object, gint value)
13279{
13280 g_object_set (G_OBJECT (object), "heatbeat", value, NULL);
13281}
13282
13283/**
13284 * control_emit_heartbeat:
13285 * @object: A #Control.
13286 * @arg_bus_name: Argument to pass with the signal.
13287 *
13288 * Emits the <link linkend="gdbus-signal-org-openbmc-Control.Heartbeat">"Heartbeat"</link> D-Bus signal.
13289 */
13290void
13291control_emit_heartbeat (
13292 Control *object,
13293 const gchar *arg_bus_name)
13294{
13295 g_signal_emit_by_name (object, "heartbeat", arg_bus_name);
13296}
13297
13298/**
13299 * control_emit_goto_system_state:
13300 * @object: A #Control.
13301 * @arg_state_name: Argument to pass with the signal.
13302 *
13303 * Emits the <link linkend="gdbus-signal-org-openbmc-Control.GotoSystemState">"GotoSystemState"</link> D-Bus signal.
13304 */
13305void
13306control_emit_goto_system_state (
13307 Control *object,
13308 const gchar *arg_state_name)
13309{
13310 g_signal_emit_by_name (object, "goto-system-state", arg_state_name);
13311}
13312
13313/**
Norman Jamesa3e47c42015-10-18 14:43:10 -050013314 * control_emit_started:
13315 * @object: A #Control.
13316 *
13317 * Emits the <link linkend="gdbus-signal-org-openbmc-Control.Started">"Started"</link> D-Bus signal.
13318 */
13319void
13320control_emit_started (
13321 Control *object)
13322{
13323 g_signal_emit_by_name (object, "started");
13324}
13325
13326/**
Norman James362a80f2015-09-14 14:04:39 -050013327 * control_call_init:
13328 * @proxy: A #ControlProxy.
13329 * @cancellable: (allow-none): A #GCancellable or %NULL.
13330 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
13331 * @user_data: User data to pass to @callback.
13332 *
13333 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Control.init">init()</link> D-Bus method on @proxy.
13334 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
13335 * You can then call control_call_init_finish() to get the result of the operation.
13336 *
13337 * See control_call_init_sync() for the synchronous, blocking version of this method.
13338 */
13339void
13340control_call_init (
13341 Control *proxy,
13342 GCancellable *cancellable,
13343 GAsyncReadyCallback callback,
13344 gpointer user_data)
13345{
13346 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
13347 "init",
13348 g_variant_new ("()"),
13349 G_DBUS_CALL_FLAGS_NONE,
13350 -1,
13351 cancellable,
13352 callback,
13353 user_data);
13354}
13355
13356/**
13357 * control_call_init_finish:
13358 * @proxy: A #ControlProxy.
13359 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_call_init().
13360 * @error: Return location for error or %NULL.
13361 *
13362 * Finishes an operation started with control_call_init().
13363 *
13364 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
13365 */
13366gboolean
13367control_call_init_finish (
13368 Control *proxy,
13369 GAsyncResult *res,
13370 GError **error)
13371{
13372 GVariant *_ret;
13373 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
13374 if (_ret == NULL)
13375 goto _out;
13376 g_variant_get (_ret,
13377 "()");
13378 g_variant_unref (_ret);
13379_out:
13380 return _ret != NULL;
13381}
13382
13383/**
13384 * control_call_init_sync:
13385 * @proxy: A #ControlProxy.
13386 * @cancellable: (allow-none): A #GCancellable or %NULL.
13387 * @error: Return location for error or %NULL.
13388 *
13389 * 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.
13390 *
13391 * See control_call_init() for the asynchronous version of this method.
13392 *
13393 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
13394 */
13395gboolean
13396control_call_init_sync (
13397 Control *proxy,
13398 GCancellable *cancellable,
13399 GError **error)
13400{
13401 GVariant *_ret;
13402 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
13403 "init",
13404 g_variant_new ("()"),
13405 G_DBUS_CALL_FLAGS_NONE,
13406 -1,
13407 cancellable,
13408 error);
13409 if (_ret == NULL)
13410 goto _out;
13411 g_variant_get (_ret,
13412 "()");
13413 g_variant_unref (_ret);
13414_out:
13415 return _ret != NULL;
13416}
13417
13418/**
13419 * control_complete_init:
13420 * @object: A #Control.
13421 * @invocation: (transfer full): A #GDBusMethodInvocation.
13422 *
13423 * 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.
13424 *
13425 * This method will free @invocation, you cannot use it afterwards.
13426 */
13427void
13428control_complete_init (
13429 Control *object,
13430 GDBusMethodInvocation *invocation)
13431{
13432 g_dbus_method_invocation_return_value (invocation,
13433 g_variant_new ("()"));
13434}
13435
13436/* ------------------------------------------------------------------------ */
13437
13438/**
13439 * ControlProxy:
13440 *
13441 * The #ControlProxy structure contains only private data and should only be accessed using the provided API.
13442 */
13443
13444/**
13445 * ControlProxyClass:
13446 * @parent_class: The parent class.
13447 *
13448 * Class structure for #ControlProxy.
13449 */
13450
13451struct _ControlProxyPrivate
13452{
13453 GData *qdata;
13454};
13455
13456static void control_proxy_iface_init (ControlIface *iface);
13457
13458#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
13459G_DEFINE_TYPE_WITH_CODE (ControlProxy, control_proxy, G_TYPE_DBUS_PROXY,
13460 G_ADD_PRIVATE (ControlProxy)
13461 G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_proxy_iface_init));
13462
13463#else
13464G_DEFINE_TYPE_WITH_CODE (ControlProxy, control_proxy, G_TYPE_DBUS_PROXY,
13465 G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_proxy_iface_init));
13466
13467#endif
13468static void
13469control_proxy_finalize (GObject *object)
13470{
13471 ControlProxy *proxy = CONTROL_PROXY (object);
13472 g_datalist_clear (&proxy->priv->qdata);
13473 G_OBJECT_CLASS (control_proxy_parent_class)->finalize (object);
13474}
13475
13476static void
13477control_proxy_get_property (GObject *object,
13478 guint prop_id,
13479 GValue *value,
13480 GParamSpec *pspec G_GNUC_UNUSED)
13481{
13482 const _ExtendedGDBusPropertyInfo *info;
13483 GVariant *variant;
13484 g_assert (prop_id != 0 && prop_id - 1 < 2);
13485 info = _control_property_info_pointers[prop_id - 1];
13486 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
13487 if (info->use_gvariant)
13488 {
13489 g_value_set_variant (value, variant);
13490 }
13491 else
13492 {
13493 if (variant != NULL)
13494 g_dbus_gvariant_to_gvalue (variant, value);
13495 }
13496 if (variant != NULL)
13497 g_variant_unref (variant);
13498}
13499
13500static void
13501control_proxy_set_property_cb (GDBusProxy *proxy,
13502 GAsyncResult *res,
13503 gpointer user_data)
13504{
13505 const _ExtendedGDBusPropertyInfo *info = user_data;
13506 GError *error;
13507 GVariant *_ret;
13508 error = NULL;
13509 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
13510 if (!_ret)
13511 {
13512 g_warning ("Error setting property '%s' on interface org.openbmc.Control: %s (%s, %d)",
13513 info->parent_struct.name,
13514 error->message, g_quark_to_string (error->domain), error->code);
13515 g_error_free (error);
13516 }
13517 else
13518 {
13519 g_variant_unref (_ret);
13520 }
13521}
13522
13523static void
13524control_proxy_set_property (GObject *object,
13525 guint prop_id,
13526 const GValue *value,
13527 GParamSpec *pspec G_GNUC_UNUSED)
13528{
13529 const _ExtendedGDBusPropertyInfo *info;
13530 GVariant *variant;
13531 g_assert (prop_id != 0 && prop_id - 1 < 2);
13532 info = _control_property_info_pointers[prop_id - 1];
13533 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
13534 g_dbus_proxy_call (G_DBUS_PROXY (object),
13535 "org.freedesktop.DBus.Properties.Set",
13536 g_variant_new ("(ssv)", "org.openbmc.Control", info->parent_struct.name, variant),
13537 G_DBUS_CALL_FLAGS_NONE,
13538 -1,
13539 NULL, (GAsyncReadyCallback) control_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
13540 g_variant_unref (variant);
13541}
13542
13543static void
13544control_proxy_g_signal (GDBusProxy *proxy,
13545 const gchar *sender_name G_GNUC_UNUSED,
13546 const gchar *signal_name,
13547 GVariant *parameters)
13548{
13549 _ExtendedGDBusSignalInfo *info;
13550 GVariantIter iter;
13551 GVariant *child;
13552 GValue *paramv;
13553 guint num_params;
13554 guint n;
13555 guint signal_id;
13556 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, signal_name);
13557 if (info == NULL)
13558 return;
13559 num_params = g_variant_n_children (parameters);
13560 paramv = g_new0 (GValue, num_params + 1);
13561 g_value_init (&paramv[0], TYPE_CONTROL);
13562 g_value_set_object (&paramv[0], proxy);
13563 g_variant_iter_init (&iter, parameters);
13564 n = 1;
13565 while ((child = g_variant_iter_next_value (&iter)) != NULL)
13566 {
13567 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
13568 if (arg_info->use_gvariant)
13569 {
13570 g_value_init (&paramv[n], G_TYPE_VARIANT);
13571 g_value_set_variant (&paramv[n], child);
13572 n++;
13573 }
13574 else
13575 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
13576 g_variant_unref (child);
13577 }
13578 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL);
13579 g_signal_emitv (paramv, signal_id, 0, NULL);
13580 for (n = 0; n < num_params + 1; n++)
13581 g_value_unset (&paramv[n]);
13582 g_free (paramv);
13583}
13584
13585static void
13586control_proxy_g_properties_changed (GDBusProxy *_proxy,
13587 GVariant *changed_properties,
13588 const gchar *const *invalidated_properties)
13589{
13590 ControlProxy *proxy = CONTROL_PROXY (_proxy);
13591 guint n;
13592 const gchar *key;
13593 GVariantIter *iter;
13594 _ExtendedGDBusPropertyInfo *info;
13595 g_variant_get (changed_properties, "a{sv}", &iter);
13596 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
13597 {
13598 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, key);
13599 g_datalist_remove_data (&proxy->priv->qdata, key);
13600 if (info != NULL)
13601 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
13602 }
13603 g_variant_iter_free (iter);
13604 for (n = 0; invalidated_properties[n] != NULL; n++)
13605 {
13606 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, invalidated_properties[n]);
13607 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
13608 if (info != NULL)
13609 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
13610 }
13611}
13612
13613static gint
13614control_proxy_get_poll_interval (Control *object)
13615{
13616 ControlProxy *proxy = CONTROL_PROXY (object);
13617 GVariant *variant;
13618 gint value = 0;
13619 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "poll_interval");
13620 if (variant != NULL)
13621 {
13622 value = g_variant_get_int32 (variant);
13623 g_variant_unref (variant);
13624 }
13625 return value;
13626}
13627
13628static gint
13629control_proxy_get_heatbeat (Control *object)
13630{
13631 ControlProxy *proxy = CONTROL_PROXY (object);
13632 GVariant *variant;
13633 gint value = 0;
13634 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "heatbeat");
13635 if (variant != NULL)
13636 {
13637 value = g_variant_get_int32 (variant);
13638 g_variant_unref (variant);
13639 }
13640 return value;
13641}
13642
13643static void
13644control_proxy_init (ControlProxy *proxy)
13645{
13646#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
13647 proxy->priv = control_proxy_get_instance_private (proxy);
13648#else
13649 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_PROXY, ControlProxyPrivate);
13650#endif
13651
13652 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_interface_info ());
13653}
13654
13655static void
13656control_proxy_class_init (ControlProxyClass *klass)
13657{
13658 GObjectClass *gobject_class;
13659 GDBusProxyClass *proxy_class;
13660
13661 gobject_class = G_OBJECT_CLASS (klass);
13662 gobject_class->finalize = control_proxy_finalize;
13663 gobject_class->get_property = control_proxy_get_property;
13664 gobject_class->set_property = control_proxy_set_property;
13665
13666 proxy_class = G_DBUS_PROXY_CLASS (klass);
13667 proxy_class->g_signal = control_proxy_g_signal;
13668 proxy_class->g_properties_changed = control_proxy_g_properties_changed;
13669
13670 control_override_properties (gobject_class, 1);
13671
13672#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
13673 g_type_class_add_private (klass, sizeof (ControlProxyPrivate));
13674#endif
13675}
13676
13677static void
13678control_proxy_iface_init (ControlIface *iface)
13679{
13680 iface->get_poll_interval = control_proxy_get_poll_interval;
13681 iface->get_heatbeat = control_proxy_get_heatbeat;
13682}
13683
13684/**
13685 * control_proxy_new:
13686 * @connection: A #GDBusConnection.
13687 * @flags: Flags from the #GDBusProxyFlags enumeration.
13688 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
13689 * @object_path: An object path.
13690 * @cancellable: (allow-none): A #GCancellable or %NULL.
13691 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
13692 * @user_data: User data to pass to @callback.
13693 *
13694 * 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.
13695 *
13696 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
13697 * You can then call control_proxy_new_finish() to get the result of the operation.
13698 *
13699 * See control_proxy_new_sync() for the synchronous, blocking version of this constructor.
13700 */
13701void
13702control_proxy_new (
13703 GDBusConnection *connection,
13704 GDBusProxyFlags flags,
13705 const gchar *name,
13706 const gchar *object_path,
13707 GCancellable *cancellable,
13708 GAsyncReadyCallback callback,
13709 gpointer user_data)
13710{
13711 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);
13712}
13713
13714/**
13715 * control_proxy_new_finish:
13716 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_proxy_new().
13717 * @error: Return location for error or %NULL
13718 *
13719 * Finishes an operation started with control_proxy_new().
13720 *
13721 * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set.
13722 */
13723Control *
13724control_proxy_new_finish (
13725 GAsyncResult *res,
13726 GError **error)
13727{
13728 GObject *ret;
13729 GObject *source_object;
13730 source_object = g_async_result_get_source_object (res);
13731 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
13732 g_object_unref (source_object);
13733 if (ret != NULL)
13734 return CONTROL (ret);
13735 else
13736 return NULL;
13737}
13738
13739/**
13740 * control_proxy_new_sync:
13741 * @connection: A #GDBusConnection.
13742 * @flags: Flags from the #GDBusProxyFlags enumeration.
13743 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
13744 * @object_path: An object path.
13745 * @cancellable: (allow-none): A #GCancellable or %NULL.
13746 * @error: Return location for error or %NULL
13747 *
13748 * 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.
13749 *
13750 * The calling thread is blocked until a reply is received.
13751 *
13752 * See control_proxy_new() for the asynchronous version of this constructor.
13753 *
13754 * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set.
13755 */
13756Control *
13757control_proxy_new_sync (
13758 GDBusConnection *connection,
13759 GDBusProxyFlags flags,
13760 const gchar *name,
13761 const gchar *object_path,
13762 GCancellable *cancellable,
13763 GError **error)
13764{
13765 GInitable *ret;
13766 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);
13767 if (ret != NULL)
13768 return CONTROL (ret);
13769 else
13770 return NULL;
13771}
13772
13773
13774/**
13775 * control_proxy_new_for_bus:
13776 * @bus_type: A #GBusType.
13777 * @flags: Flags from the #GDBusProxyFlags enumeration.
13778 * @name: A bus name (well-known or unique).
13779 * @object_path: An object path.
13780 * @cancellable: (allow-none): A #GCancellable or %NULL.
13781 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
13782 * @user_data: User data to pass to @callback.
13783 *
13784 * Like control_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
13785 *
13786 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
13787 * You can then call control_proxy_new_for_bus_finish() to get the result of the operation.
13788 *
13789 * See control_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
13790 */
13791void
13792control_proxy_new_for_bus (
13793 GBusType bus_type,
13794 GDBusProxyFlags flags,
13795 const gchar *name,
13796 const gchar *object_path,
13797 GCancellable *cancellable,
13798 GAsyncReadyCallback callback,
13799 gpointer user_data)
13800{
13801 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);
13802}
13803
13804/**
13805 * control_proxy_new_for_bus_finish:
13806 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_proxy_new_for_bus().
13807 * @error: Return location for error or %NULL
13808 *
13809 * Finishes an operation started with control_proxy_new_for_bus().
13810 *
13811 * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set.
13812 */
13813Control *
13814control_proxy_new_for_bus_finish (
13815 GAsyncResult *res,
13816 GError **error)
13817{
13818 GObject *ret;
13819 GObject *source_object;
13820 source_object = g_async_result_get_source_object (res);
13821 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
13822 g_object_unref (source_object);
13823 if (ret != NULL)
13824 return CONTROL (ret);
13825 else
13826 return NULL;
13827}
13828
13829/**
13830 * control_proxy_new_for_bus_sync:
13831 * @bus_type: A #GBusType.
13832 * @flags: Flags from the #GDBusProxyFlags enumeration.
13833 * @name: A bus name (well-known or unique).
13834 * @object_path: An object path.
13835 * @cancellable: (allow-none): A #GCancellable or %NULL.
13836 * @error: Return location for error or %NULL
13837 *
13838 * Like control_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
13839 *
13840 * The calling thread is blocked until a reply is received.
13841 *
13842 * See control_proxy_new_for_bus() for the asynchronous version of this constructor.
13843 *
13844 * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set.
13845 */
13846Control *
13847control_proxy_new_for_bus_sync (
13848 GBusType bus_type,
13849 GDBusProxyFlags flags,
13850 const gchar *name,
13851 const gchar *object_path,
13852 GCancellable *cancellable,
13853 GError **error)
13854{
13855 GInitable *ret;
13856 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);
13857 if (ret != NULL)
13858 return CONTROL (ret);
13859 else
13860 return NULL;
13861}
13862
13863
13864/* ------------------------------------------------------------------------ */
13865
13866/**
13867 * ControlSkeleton:
13868 *
13869 * The #ControlSkeleton structure contains only private data and should only be accessed using the provided API.
13870 */
13871
13872/**
13873 * ControlSkeletonClass:
13874 * @parent_class: The parent class.
13875 *
13876 * Class structure for #ControlSkeleton.
13877 */
13878
13879struct _ControlSkeletonPrivate
13880{
13881 GValue *properties;
13882 GList *changed_properties;
13883 GSource *changed_properties_idle_source;
13884 GMainContext *context;
13885 GMutex lock;
13886};
13887
13888static void
13889_control_skeleton_handle_method_call (
13890 GDBusConnection *connection G_GNUC_UNUSED,
13891 const gchar *sender G_GNUC_UNUSED,
13892 const gchar *object_path G_GNUC_UNUSED,
13893 const gchar *interface_name,
13894 const gchar *method_name,
13895 GVariant *parameters,
13896 GDBusMethodInvocation *invocation,
13897 gpointer user_data)
13898{
13899 ControlSkeleton *skeleton = CONTROL_SKELETON (user_data);
13900 _ExtendedGDBusMethodInfo *info;
13901 GVariantIter iter;
13902 GVariant *child;
13903 GValue *paramv;
13904 guint num_params;
13905 guint num_extra;
13906 guint n;
13907 guint signal_id;
13908 GValue return_value = G_VALUE_INIT;
13909 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
13910 g_assert (info != NULL);
13911 num_params = g_variant_n_children (parameters);
13912 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
13913 n = 0;
13914 g_value_init (&paramv[n], TYPE_CONTROL);
13915 g_value_set_object (&paramv[n++], skeleton);
13916 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
13917 g_value_set_object (&paramv[n++], invocation);
13918 if (info->pass_fdlist)
13919 {
13920#ifdef G_OS_UNIX
13921 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
13922 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
13923#else
13924 g_assert_not_reached ();
13925#endif
13926 }
13927 g_variant_iter_init (&iter, parameters);
13928 while ((child = g_variant_iter_next_value (&iter)) != NULL)
13929 {
13930 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
13931 if (arg_info->use_gvariant)
13932 {
13933 g_value_init (&paramv[n], G_TYPE_VARIANT);
13934 g_value_set_variant (&paramv[n], child);
13935 n++;
13936 }
13937 else
13938 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
13939 g_variant_unref (child);
13940 }
13941 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL);
13942 g_value_init (&return_value, G_TYPE_BOOLEAN);
13943 g_signal_emitv (paramv, signal_id, 0, &return_value);
13944 if (!g_value_get_boolean (&return_value))
13945 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);
13946 g_value_unset (&return_value);
13947 for (n = 0; n < num_params + num_extra; n++)
13948 g_value_unset (&paramv[n]);
13949 g_free (paramv);
13950}
13951
13952static GVariant *
13953_control_skeleton_handle_get_property (
13954 GDBusConnection *connection G_GNUC_UNUSED,
13955 const gchar *sender G_GNUC_UNUSED,
13956 const gchar *object_path G_GNUC_UNUSED,
13957 const gchar *interface_name G_GNUC_UNUSED,
13958 const gchar *property_name,
13959 GError **error,
13960 gpointer user_data)
13961{
13962 ControlSkeleton *skeleton = CONTROL_SKELETON (user_data);
13963 GValue value = G_VALUE_INIT;
13964 GParamSpec *pspec;
13965 _ExtendedGDBusPropertyInfo *info;
13966 GVariant *ret;
13967 ret = NULL;
13968 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, property_name);
13969 g_assert (info != NULL);
13970 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
13971 if (pspec == NULL)
13972 {
13973 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
13974 }
13975 else
13976 {
13977 g_value_init (&value, pspec->value_type);
13978 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
13979 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
13980 g_value_unset (&value);
13981 }
13982 return ret;
13983}
13984
13985static gboolean
13986_control_skeleton_handle_set_property (
13987 GDBusConnection *connection G_GNUC_UNUSED,
13988 const gchar *sender G_GNUC_UNUSED,
13989 const gchar *object_path G_GNUC_UNUSED,
13990 const gchar *interface_name G_GNUC_UNUSED,
13991 const gchar *property_name,
13992 GVariant *variant,
13993 GError **error,
13994 gpointer user_data)
13995{
13996 ControlSkeleton *skeleton = CONTROL_SKELETON (user_data);
13997 GValue value = G_VALUE_INIT;
13998 GParamSpec *pspec;
13999 _ExtendedGDBusPropertyInfo *info;
14000 gboolean ret;
14001 ret = FALSE;
14002 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, property_name);
14003 g_assert (info != NULL);
14004 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
14005 if (pspec == NULL)
14006 {
14007 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
14008 }
14009 else
14010 {
14011 if (info->use_gvariant)
14012 g_value_set_variant (&value, variant);
14013 else
14014 g_dbus_gvariant_to_gvalue (variant, &value);
14015 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
14016 g_value_unset (&value);
14017 ret = TRUE;
14018 }
14019 return ret;
14020}
14021
14022static const GDBusInterfaceVTable _control_skeleton_vtable =
14023{
14024 _control_skeleton_handle_method_call,
14025 _control_skeleton_handle_get_property,
14026 _control_skeleton_handle_set_property,
14027 {NULL}
14028};
14029
14030static GDBusInterfaceInfo *
14031control_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
14032{
14033 return control_interface_info ();
14034}
14035
14036static GDBusInterfaceVTable *
14037control_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
14038{
14039 return (GDBusInterfaceVTable *) &_control_skeleton_vtable;
14040}
14041
14042static GVariant *
14043control_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
14044{
14045 ControlSkeleton *skeleton = CONTROL_SKELETON (_skeleton);
14046
14047 GVariantBuilder builder;
14048 guint n;
14049 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
14050 if (_control_interface_info.parent_struct.properties == NULL)
14051 goto out;
14052 for (n = 0; _control_interface_info.parent_struct.properties[n] != NULL; n++)
14053 {
14054 GDBusPropertyInfo *info = _control_interface_info.parent_struct.properties[n];
14055 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
14056 {
14057 GVariant *value;
14058 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);
14059 if (value != NULL)
14060 {
14061 g_variant_take_ref (value);
14062 g_variant_builder_add (&builder, "{sv}", info->name, value);
14063 g_variant_unref (value);
14064 }
14065 }
14066 }
14067out:
14068 return g_variant_builder_end (&builder);
14069}
14070
14071static gboolean _control_emit_changed (gpointer user_data);
14072
14073static void
14074control_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
14075{
14076 ControlSkeleton *skeleton = CONTROL_SKELETON (_skeleton);
14077 gboolean emit_changed = FALSE;
14078
14079 g_mutex_lock (&skeleton->priv->lock);
14080 if (skeleton->priv->changed_properties_idle_source != NULL)
14081 {
14082 g_source_destroy (skeleton->priv->changed_properties_idle_source);
14083 skeleton->priv->changed_properties_idle_source = NULL;
14084 emit_changed = TRUE;
14085 }
14086 g_mutex_unlock (&skeleton->priv->lock);
14087
14088 if (emit_changed)
14089 _control_emit_changed (skeleton);
14090}
14091
14092static void
14093_control_on_signal_heartbeat (
14094 Control *object,
14095 const gchar *arg_bus_name)
14096{
14097 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
14098
14099 GList *connections, *l;
14100 GVariant *signal_variant;
14101 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
14102
14103 signal_variant = g_variant_ref_sink (g_variant_new ("(s)",
14104 arg_bus_name));
14105 for (l = connections; l != NULL; l = l->next)
14106 {
14107 GDBusConnection *connection = l->data;
14108 g_dbus_connection_emit_signal (connection,
14109 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Control", "Heartbeat",
14110 signal_variant, NULL);
14111 }
14112 g_variant_unref (signal_variant);
14113 g_list_free_full (connections, g_object_unref);
14114}
14115
14116static void
14117_control_on_signal_goto_system_state (
14118 Control *object,
14119 const gchar *arg_state_name)
14120{
14121 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
14122
14123 GList *connections, *l;
14124 GVariant *signal_variant;
14125 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
14126
14127 signal_variant = g_variant_ref_sink (g_variant_new ("(s)",
14128 arg_state_name));
14129 for (l = connections; l != NULL; l = l->next)
14130 {
14131 GDBusConnection *connection = l->data;
14132 g_dbus_connection_emit_signal (connection,
14133 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Control", "GotoSystemState",
14134 signal_variant, NULL);
14135 }
14136 g_variant_unref (signal_variant);
14137 g_list_free_full (connections, g_object_unref);
14138}
14139
Norman Jamesa3e47c42015-10-18 14:43:10 -050014140static void
14141_control_on_signal_started (
14142 Control *object)
14143{
14144 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
14145
14146 GList *connections, *l;
14147 GVariant *signal_variant;
14148 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
14149
14150 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
14151 for (l = connections; l != NULL; l = l->next)
14152 {
14153 GDBusConnection *connection = l->data;
14154 g_dbus_connection_emit_signal (connection,
14155 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Control", "Started",
14156 signal_variant, NULL);
14157 }
14158 g_variant_unref (signal_variant);
14159 g_list_free_full (connections, g_object_unref);
14160}
14161
Norman James362a80f2015-09-14 14:04:39 -050014162static void control_skeleton_iface_init (ControlIface *iface);
14163#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
14164G_DEFINE_TYPE_WITH_CODE (ControlSkeleton, control_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
14165 G_ADD_PRIVATE (ControlSkeleton)
14166 G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_skeleton_iface_init));
14167
14168#else
14169G_DEFINE_TYPE_WITH_CODE (ControlSkeleton, control_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
14170 G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_skeleton_iface_init));
14171
14172#endif
14173static void
14174control_skeleton_finalize (GObject *object)
14175{
14176 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
14177 guint n;
14178 for (n = 0; n < 2; n++)
14179 g_value_unset (&skeleton->priv->properties[n]);
14180 g_free (skeleton->priv->properties);
14181 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
14182 if (skeleton->priv->changed_properties_idle_source != NULL)
14183 g_source_destroy (skeleton->priv->changed_properties_idle_source);
14184 g_main_context_unref (skeleton->priv->context);
14185 g_mutex_clear (&skeleton->priv->lock);
14186 G_OBJECT_CLASS (control_skeleton_parent_class)->finalize (object);
14187}
14188
14189static void
14190control_skeleton_get_property (GObject *object,
14191 guint prop_id,
14192 GValue *value,
14193 GParamSpec *pspec G_GNUC_UNUSED)
14194{
14195 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
14196 g_assert (prop_id != 0 && prop_id - 1 < 2);
14197 g_mutex_lock (&skeleton->priv->lock);
14198 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
14199 g_mutex_unlock (&skeleton->priv->lock);
14200}
14201
14202static gboolean
14203_control_emit_changed (gpointer user_data)
14204{
14205 ControlSkeleton *skeleton = CONTROL_SKELETON (user_data);
14206 GList *l;
14207 GVariantBuilder builder;
14208 GVariantBuilder invalidated_builder;
14209 guint num_changes;
14210
14211 g_mutex_lock (&skeleton->priv->lock);
14212 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
14213 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
14214 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
14215 {
14216 ChangedProperty *cp = l->data;
14217 GVariant *variant;
14218 const GValue *cur_value;
14219
14220 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
14221 if (!_g_value_equal (cur_value, &cp->orig_value))
14222 {
14223 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
14224 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
14225 g_variant_unref (variant);
14226 num_changes++;
14227 }
14228 }
14229 if (num_changes > 0)
14230 {
14231 GList *connections, *ll;
14232 GVariant *signal_variant;
14233 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Control",
14234 &builder, &invalidated_builder));
14235 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
14236 for (ll = connections; ll != NULL; ll = ll->next)
14237 {
14238 GDBusConnection *connection = ll->data;
14239
14240 g_dbus_connection_emit_signal (connection,
14241 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
14242 "org.freedesktop.DBus.Properties",
14243 "PropertiesChanged",
14244 signal_variant,
14245 NULL);
14246 }
14247 g_variant_unref (signal_variant);
14248 g_list_free_full (connections, g_object_unref);
14249 }
14250 else
14251 {
14252 g_variant_builder_clear (&builder);
14253 g_variant_builder_clear (&invalidated_builder);
14254 }
14255 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
14256 skeleton->priv->changed_properties = NULL;
14257 skeleton->priv->changed_properties_idle_source = NULL;
14258 g_mutex_unlock (&skeleton->priv->lock);
14259 return FALSE;
14260}
14261
14262static void
14263_control_schedule_emit_changed (ControlSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
14264{
14265 ChangedProperty *cp;
14266 GList *l;
14267 cp = NULL;
14268 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
14269 {
14270 ChangedProperty *i_cp = l->data;
14271 if (i_cp->info == info)
14272 {
14273 cp = i_cp;
14274 break;
14275 }
14276 }
14277 if (cp == NULL)
14278 {
14279 cp = g_new0 (ChangedProperty, 1);
14280 cp->prop_id = prop_id;
14281 cp->info = info;
14282 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
14283 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
14284 g_value_copy (orig_value, &cp->orig_value);
14285 }
14286}
14287
14288static void
14289control_skeleton_notify (GObject *object,
14290 GParamSpec *pspec G_GNUC_UNUSED)
14291{
14292 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
14293 g_mutex_lock (&skeleton->priv->lock);
14294 if (skeleton->priv->changed_properties != NULL &&
14295 skeleton->priv->changed_properties_idle_source == NULL)
14296 {
14297 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
14298 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
14299 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _control_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
Adriana Kobylakfd778822016-06-16 09:08:37 -050014300 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _control_emit_changed");
Norman James362a80f2015-09-14 14:04:39 -050014301 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
14302 g_source_unref (skeleton->priv->changed_properties_idle_source);
14303 }
14304 g_mutex_unlock (&skeleton->priv->lock);
14305}
14306
14307static void
14308control_skeleton_set_property (GObject *object,
14309 guint prop_id,
14310 const GValue *value,
14311 GParamSpec *pspec)
14312{
14313 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
14314 g_assert (prop_id != 0 && prop_id - 1 < 2);
14315 g_mutex_lock (&skeleton->priv->lock);
14316 g_object_freeze_notify (object);
14317 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
14318 {
14319 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
14320 _control_schedule_emit_changed (skeleton, _control_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
14321 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
14322 g_object_notify_by_pspec (object, pspec);
14323 }
14324 g_mutex_unlock (&skeleton->priv->lock);
14325 g_object_thaw_notify (object);
14326}
14327
14328static void
14329control_skeleton_init (ControlSkeleton *skeleton)
14330{
14331#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
14332 skeleton->priv = control_skeleton_get_instance_private (skeleton);
14333#else
14334 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_SKELETON, ControlSkeletonPrivate);
14335#endif
14336
14337 g_mutex_init (&skeleton->priv->lock);
14338 skeleton->priv->context = g_main_context_ref_thread_default ();
14339 skeleton->priv->properties = g_new0 (GValue, 2);
14340 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
14341 g_value_init (&skeleton->priv->properties[1], G_TYPE_INT);
14342}
14343
14344static gint
14345control_skeleton_get_poll_interval (Control *object)
14346{
14347 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
14348 gint value;
14349 g_mutex_lock (&skeleton->priv->lock);
14350 value = g_value_get_int (&(skeleton->priv->properties[0]));
14351 g_mutex_unlock (&skeleton->priv->lock);
14352 return value;
14353}
14354
14355static gint
14356control_skeleton_get_heatbeat (Control *object)
14357{
14358 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
14359 gint value;
14360 g_mutex_lock (&skeleton->priv->lock);
14361 value = g_value_get_int (&(skeleton->priv->properties[1]));
14362 g_mutex_unlock (&skeleton->priv->lock);
14363 return value;
14364}
14365
14366static void
14367control_skeleton_class_init (ControlSkeletonClass *klass)
14368{
14369 GObjectClass *gobject_class;
14370 GDBusInterfaceSkeletonClass *skeleton_class;
14371
14372 gobject_class = G_OBJECT_CLASS (klass);
14373 gobject_class->finalize = control_skeleton_finalize;
14374 gobject_class->get_property = control_skeleton_get_property;
14375 gobject_class->set_property = control_skeleton_set_property;
14376 gobject_class->notify = control_skeleton_notify;
14377
14378
14379 control_override_properties (gobject_class, 1);
14380
14381 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
14382 skeleton_class->get_info = control_skeleton_dbus_interface_get_info;
14383 skeleton_class->get_properties = control_skeleton_dbus_interface_get_properties;
14384 skeleton_class->flush = control_skeleton_dbus_interface_flush;
14385 skeleton_class->get_vtable = control_skeleton_dbus_interface_get_vtable;
14386
14387#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
14388 g_type_class_add_private (klass, sizeof (ControlSkeletonPrivate));
14389#endif
14390}
14391
14392static void
14393control_skeleton_iface_init (ControlIface *iface)
14394{
14395 iface->heartbeat = _control_on_signal_heartbeat;
14396 iface->goto_system_state = _control_on_signal_goto_system_state;
Norman Jamesa3e47c42015-10-18 14:43:10 -050014397 iface->started = _control_on_signal_started;
Norman James362a80f2015-09-14 14:04:39 -050014398 iface->get_poll_interval = control_skeleton_get_poll_interval;
14399 iface->get_heatbeat = control_skeleton_get_heatbeat;
14400}
14401
14402/**
14403 * control_skeleton_new:
14404 *
14405 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link>.
14406 *
14407 * Returns: (transfer full) (type ControlSkeleton): The skeleton object.
14408 */
14409Control *
14410control_skeleton_new (void)
14411{
14412 return CONTROL (g_object_new (TYPE_CONTROL_SKELETON, NULL));
14413}
14414
14415/* ------------------------------------------------------------------------
14416 * Code for interface org.openbmc.control.Bmc
14417 * ------------------------------------------------------------------------
14418 */
14419
14420/**
14421 * SECTION:ControlBmc
14422 * @title: ControlBmc
14423 * @short_description: Generated C code for the org.openbmc.control.Bmc D-Bus interface
14424 *
14425 * 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.
14426 */
14427
14428/* ---- Introspection data for org.openbmc.control.Bmc ---- */
14429
Williamf784d752016-01-19 12:28:49 +080014430static const _ExtendedGDBusMethodInfo _control_bmc_method_info_warm_reset =
Norman James362a80f2015-09-14 14:04:39 -050014431{
14432 {
14433 -1,
Williamf784d752016-01-19 12:28:49 +080014434 (gchar *) "warmReset",
Norman James362a80f2015-09-14 14:04:39 -050014435 NULL,
14436 NULL,
14437 NULL
14438 },
Williamf784d752016-01-19 12:28:49 +080014439 "handle-warm-reset",
Norman James362a80f2015-09-14 14:04:39 -050014440 FALSE
14441};
14442
14443static const _ExtendedGDBusMethodInfo * const _control_bmc_method_info_pointers[] =
14444{
Williamf784d752016-01-19 12:28:49 +080014445 &_control_bmc_method_info_warm_reset,
Norman James362a80f2015-09-14 14:04:39 -050014446 NULL
14447};
14448
14449static const _ExtendedGDBusInterfaceInfo _control_bmc_interface_info =
14450{
14451 {
14452 -1,
14453 (gchar *) "org.openbmc.control.Bmc",
14454 (GDBusMethodInfo **) &_control_bmc_method_info_pointers,
14455 NULL,
14456 NULL,
14457 NULL
14458 },
14459 "control-bmc",
14460};
14461
14462
14463/**
14464 * control_bmc_interface_info:
14465 *
14466 * 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.
14467 *
14468 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
14469 */
14470GDBusInterfaceInfo *
14471control_bmc_interface_info (void)
14472{
14473 return (GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct;
14474}
14475
14476/**
14477 * control_bmc_override_properties:
14478 * @klass: The class structure for a #GObject<!-- -->-derived class.
14479 * @property_id_begin: The property id to assign to the first overridden property.
14480 *
14481 * Overrides all #GObject properties in the #ControlBmc interface for a concrete class.
14482 * The properties are overridden in the order they are defined.
14483 *
14484 * Returns: The last property id.
14485 */
14486guint
14487control_bmc_override_properties (GObjectClass *klass, guint property_id_begin)
14488{
14489 return property_id_begin - 1;
14490}
14491
14492
14493
14494/**
14495 * ControlBmc:
14496 *
14497 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Bmc.top_of_page">org.openbmc.control.Bmc</link>.
14498 */
14499
14500/**
14501 * ControlBmcIface:
14502 * @parent_iface: The parent interface.
Williamf784d752016-01-19 12:28:49 +080014503 * @handle_warm_reset: Handler for the #ControlBmc::handle-warm-reset signal.
Norman James362a80f2015-09-14 14:04:39 -050014504 *
14505 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Bmc.top_of_page">org.openbmc.control.Bmc</link>.
14506 */
14507
14508typedef ControlBmcIface ControlBmcInterface;
14509G_DEFINE_INTERFACE (ControlBmc, control_bmc, G_TYPE_OBJECT);
14510
14511static void
14512control_bmc_default_init (ControlBmcIface *iface)
14513{
14514 /* GObject signals for incoming D-Bus method calls: */
14515 /**
Williamf784d752016-01-19 12:28:49 +080014516 * ControlBmc::handle-warm-reset:
Norman James362a80f2015-09-14 14:04:39 -050014517 * @object: A #ControlBmc.
14518 * @invocation: A #GDBusMethodInvocation.
14519 *
Williamf784d752016-01-19 12:28:49 +080014520 * 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 -050014521 *
Williamf784d752016-01-19 12:28:49 +080014522 * 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 -050014523 *
14524 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
14525 */
Williamf784d752016-01-19 12:28:49 +080014526 g_signal_new ("handle-warm-reset",
Norman James362a80f2015-09-14 14:04:39 -050014527 G_TYPE_FROM_INTERFACE (iface),
14528 G_SIGNAL_RUN_LAST,
Williamf784d752016-01-19 12:28:49 +080014529 G_STRUCT_OFFSET (ControlBmcIface, handle_warm_reset),
Norman James362a80f2015-09-14 14:04:39 -050014530 g_signal_accumulator_true_handled,
14531 NULL,
14532 g_cclosure_marshal_generic,
14533 G_TYPE_BOOLEAN,
14534 1,
14535 G_TYPE_DBUS_METHOD_INVOCATION);
14536
14537}
14538
14539/**
Williamf784d752016-01-19 12:28:49 +080014540 * control_bmc_call_warm_reset:
Norman James362a80f2015-09-14 14:04:39 -050014541 * @proxy: A #ControlBmcProxy.
14542 * @cancellable: (allow-none): A #GCancellable or %NULL.
14543 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
14544 * @user_data: User data to pass to @callback.
14545 *
Williamf784d752016-01-19 12:28:49 +080014546 * 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 -050014547 * When the operation is finished, @callback will be invoked 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 +080014548 * You can then call control_bmc_call_warm_reset_finish() to get the result of the operation.
Norman James362a80f2015-09-14 14:04:39 -050014549 *
Williamf784d752016-01-19 12:28:49 +080014550 * See control_bmc_call_warm_reset_sync() for the synchronous, blocking version of this method.
Norman James362a80f2015-09-14 14:04:39 -050014551 */
14552void
Williamf784d752016-01-19 12:28:49 +080014553control_bmc_call_warm_reset (
Norman James362a80f2015-09-14 14:04:39 -050014554 ControlBmc *proxy,
14555 GCancellable *cancellable,
14556 GAsyncReadyCallback callback,
14557 gpointer user_data)
14558{
14559 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
Williamf784d752016-01-19 12:28:49 +080014560 "warmReset",
Norman James362a80f2015-09-14 14:04:39 -050014561 g_variant_new ("()"),
14562 G_DBUS_CALL_FLAGS_NONE,
14563 -1,
14564 cancellable,
14565 callback,
14566 user_data);
14567}
14568
14569/**
Williamf784d752016-01-19 12:28:49 +080014570 * control_bmc_call_warm_reset_finish:
Norman James362a80f2015-09-14 14:04:39 -050014571 * @proxy: A #ControlBmcProxy.
Williamf784d752016-01-19 12:28:49 +080014572 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_bmc_call_warm_reset().
Norman James362a80f2015-09-14 14:04:39 -050014573 * @error: Return location for error or %NULL.
14574 *
Williamf784d752016-01-19 12:28:49 +080014575 * Finishes an operation started with control_bmc_call_warm_reset().
Norman James362a80f2015-09-14 14:04:39 -050014576 *
14577 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
14578 */
14579gboolean
Williamf784d752016-01-19 12:28:49 +080014580control_bmc_call_warm_reset_finish (
Norman James362a80f2015-09-14 14:04:39 -050014581 ControlBmc *proxy,
14582 GAsyncResult *res,
14583 GError **error)
14584{
14585 GVariant *_ret;
14586 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
14587 if (_ret == NULL)
14588 goto _out;
14589 g_variant_get (_ret,
14590 "()");
14591 g_variant_unref (_ret);
14592_out:
14593 return _ret != NULL;
14594}
14595
14596/**
Williamf784d752016-01-19 12:28:49 +080014597 * control_bmc_call_warm_reset_sync:
Norman James362a80f2015-09-14 14:04:39 -050014598 * @proxy: A #ControlBmcProxy.
14599 * @cancellable: (allow-none): A #GCancellable or %NULL.
14600 * @error: Return location for error or %NULL.
14601 *
Williamf784d752016-01-19 12:28:49 +080014602 * 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 -050014603 *
Williamf784d752016-01-19 12:28:49 +080014604 * See control_bmc_call_warm_reset() for the asynchronous version of this method.
Norman James362a80f2015-09-14 14:04:39 -050014605 *
14606 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
14607 */
14608gboolean
Williamf784d752016-01-19 12:28:49 +080014609control_bmc_call_warm_reset_sync (
Norman James362a80f2015-09-14 14:04:39 -050014610 ControlBmc *proxy,
14611 GCancellable *cancellable,
14612 GError **error)
14613{
14614 GVariant *_ret;
14615 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
Williamf784d752016-01-19 12:28:49 +080014616 "warmReset",
Norman James362a80f2015-09-14 14:04:39 -050014617 g_variant_new ("()"),
14618 G_DBUS_CALL_FLAGS_NONE,
14619 -1,
14620 cancellable,
14621 error);
14622 if (_ret == NULL)
14623 goto _out;
14624 g_variant_get (_ret,
14625 "()");
14626 g_variant_unref (_ret);
14627_out:
14628 return _ret != NULL;
14629}
14630
14631/**
Williamf784d752016-01-19 12:28:49 +080014632 * control_bmc_complete_warm_reset:
Norman James362a80f2015-09-14 14:04:39 -050014633 * @object: A #ControlBmc.
14634 * @invocation: (transfer full): A #GDBusMethodInvocation.
14635 *
Williamf784d752016-01-19 12:28:49 +080014636 * 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 -050014637 *
14638 * This method will free @invocation, you cannot use it afterwards.
14639 */
14640void
Williamf784d752016-01-19 12:28:49 +080014641control_bmc_complete_warm_reset (
Norman James362a80f2015-09-14 14:04:39 -050014642 ControlBmc *object,
14643 GDBusMethodInvocation *invocation)
14644{
14645 g_dbus_method_invocation_return_value (invocation,
14646 g_variant_new ("()"));
14647}
14648
14649/* ------------------------------------------------------------------------ */
14650
14651/**
14652 * ControlBmcProxy:
14653 *
14654 * The #ControlBmcProxy structure contains only private data and should only be accessed using the provided API.
14655 */
14656
14657/**
14658 * ControlBmcProxyClass:
14659 * @parent_class: The parent class.
14660 *
14661 * Class structure for #ControlBmcProxy.
14662 */
14663
14664struct _ControlBmcProxyPrivate
14665{
14666 GData *qdata;
14667};
14668
14669static void control_bmc_proxy_iface_init (ControlBmcIface *iface);
14670
14671#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
14672G_DEFINE_TYPE_WITH_CODE (ControlBmcProxy, control_bmc_proxy, G_TYPE_DBUS_PROXY,
14673 G_ADD_PRIVATE (ControlBmcProxy)
14674 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_BMC, control_bmc_proxy_iface_init));
14675
14676#else
14677G_DEFINE_TYPE_WITH_CODE (ControlBmcProxy, control_bmc_proxy, G_TYPE_DBUS_PROXY,
14678 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_BMC, control_bmc_proxy_iface_init));
14679
14680#endif
14681static void
14682control_bmc_proxy_finalize (GObject *object)
14683{
14684 ControlBmcProxy *proxy = CONTROL_BMC_PROXY (object);
14685 g_datalist_clear (&proxy->priv->qdata);
14686 G_OBJECT_CLASS (control_bmc_proxy_parent_class)->finalize (object);
14687}
14688
14689static void
14690control_bmc_proxy_get_property (GObject *object,
14691 guint prop_id,
14692 GValue *value,
14693 GParamSpec *pspec G_GNUC_UNUSED)
14694{
14695}
14696
14697static void
14698control_bmc_proxy_set_property (GObject *object,
14699 guint prop_id,
14700 const GValue *value,
14701 GParamSpec *pspec G_GNUC_UNUSED)
14702{
14703}
14704
14705static void
14706control_bmc_proxy_g_signal (GDBusProxy *proxy,
14707 const gchar *sender_name G_GNUC_UNUSED,
14708 const gchar *signal_name,
14709 GVariant *parameters)
14710{
14711 _ExtendedGDBusSignalInfo *info;
14712 GVariantIter iter;
14713 GVariant *child;
14714 GValue *paramv;
14715 guint num_params;
14716 guint n;
14717 guint signal_id;
14718 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, signal_name);
14719 if (info == NULL)
14720 return;
14721 num_params = g_variant_n_children (parameters);
14722 paramv = g_new0 (GValue, num_params + 1);
14723 g_value_init (&paramv[0], TYPE_CONTROL_BMC);
14724 g_value_set_object (&paramv[0], proxy);
14725 g_variant_iter_init (&iter, parameters);
14726 n = 1;
14727 while ((child = g_variant_iter_next_value (&iter)) != NULL)
14728 {
14729 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
14730 if (arg_info->use_gvariant)
14731 {
14732 g_value_init (&paramv[n], G_TYPE_VARIANT);
14733 g_value_set_variant (&paramv[n], child);
14734 n++;
14735 }
14736 else
14737 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
14738 g_variant_unref (child);
14739 }
14740 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_BMC);
14741 g_signal_emitv (paramv, signal_id, 0, NULL);
14742 for (n = 0; n < num_params + 1; n++)
14743 g_value_unset (&paramv[n]);
14744 g_free (paramv);
14745}
14746
14747static void
14748control_bmc_proxy_g_properties_changed (GDBusProxy *_proxy,
14749 GVariant *changed_properties,
14750 const gchar *const *invalidated_properties)
14751{
14752 ControlBmcProxy *proxy = CONTROL_BMC_PROXY (_proxy);
14753 guint n;
14754 const gchar *key;
14755 GVariantIter *iter;
14756 _ExtendedGDBusPropertyInfo *info;
14757 g_variant_get (changed_properties, "a{sv}", &iter);
14758 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
14759 {
14760 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, key);
14761 g_datalist_remove_data (&proxy->priv->qdata, key);
14762 if (info != NULL)
14763 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
14764 }
14765 g_variant_iter_free (iter);
14766 for (n = 0; invalidated_properties[n] != NULL; n++)
14767 {
14768 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, invalidated_properties[n]);
14769 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
14770 if (info != NULL)
14771 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
14772 }
14773}
14774
14775static void
14776control_bmc_proxy_init (ControlBmcProxy *proxy)
14777{
14778#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
14779 proxy->priv = control_bmc_proxy_get_instance_private (proxy);
14780#else
14781 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_BMC_PROXY, ControlBmcProxyPrivate);
14782#endif
14783
14784 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_bmc_interface_info ());
14785}
14786
14787static void
14788control_bmc_proxy_class_init (ControlBmcProxyClass *klass)
14789{
14790 GObjectClass *gobject_class;
14791 GDBusProxyClass *proxy_class;
14792
14793 gobject_class = G_OBJECT_CLASS (klass);
14794 gobject_class->finalize = control_bmc_proxy_finalize;
14795 gobject_class->get_property = control_bmc_proxy_get_property;
14796 gobject_class->set_property = control_bmc_proxy_set_property;
14797
14798 proxy_class = G_DBUS_PROXY_CLASS (klass);
14799 proxy_class->g_signal = control_bmc_proxy_g_signal;
14800 proxy_class->g_properties_changed = control_bmc_proxy_g_properties_changed;
14801
14802#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
14803 g_type_class_add_private (klass, sizeof (ControlBmcProxyPrivate));
14804#endif
14805}
14806
14807static void
14808control_bmc_proxy_iface_init (ControlBmcIface *iface)
14809{
14810}
14811
14812/**
14813 * control_bmc_proxy_new:
14814 * @connection: A #GDBusConnection.
14815 * @flags: Flags from the #GDBusProxyFlags enumeration.
14816 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
14817 * @object_path: An object path.
14818 * @cancellable: (allow-none): A #GCancellable or %NULL.
14819 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
14820 * @user_data: User data to pass to @callback.
14821 *
14822 * 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.
14823 *
14824 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
14825 * You can then call control_bmc_proxy_new_finish() to get the result of the operation.
14826 *
14827 * See control_bmc_proxy_new_sync() for the synchronous, blocking version of this constructor.
14828 */
14829void
14830control_bmc_proxy_new (
14831 GDBusConnection *connection,
14832 GDBusProxyFlags flags,
14833 const gchar *name,
14834 const gchar *object_path,
14835 GCancellable *cancellable,
14836 GAsyncReadyCallback callback,
14837 gpointer user_data)
14838{
14839 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);
14840}
14841
14842/**
14843 * control_bmc_proxy_new_finish:
14844 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_bmc_proxy_new().
14845 * @error: Return location for error or %NULL
14846 *
14847 * Finishes an operation started with control_bmc_proxy_new().
14848 *
14849 * Returns: (transfer full) (type ControlBmcProxy): The constructed proxy object or %NULL if @error is set.
14850 */
14851ControlBmc *
14852control_bmc_proxy_new_finish (
14853 GAsyncResult *res,
14854 GError **error)
14855{
14856 GObject *ret;
14857 GObject *source_object;
14858 source_object = g_async_result_get_source_object (res);
14859 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
14860 g_object_unref (source_object);
14861 if (ret != NULL)
14862 return CONTROL_BMC (ret);
14863 else
14864 return NULL;
14865}
14866
14867/**
14868 * control_bmc_proxy_new_sync:
14869 * @connection: A #GDBusConnection.
14870 * @flags: Flags from the #GDBusProxyFlags enumeration.
14871 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
14872 * @object_path: An object path.
14873 * @cancellable: (allow-none): A #GCancellable or %NULL.
14874 * @error: Return location for error or %NULL
14875 *
14876 * 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.
14877 *
14878 * The calling thread is blocked until a reply is received.
14879 *
14880 * See control_bmc_proxy_new() for the asynchronous version of this constructor.
14881 *
14882 * Returns: (transfer full) (type ControlBmcProxy): The constructed proxy object or %NULL if @error is set.
14883 */
14884ControlBmc *
14885control_bmc_proxy_new_sync (
14886 GDBusConnection *connection,
14887 GDBusProxyFlags flags,
14888 const gchar *name,
14889 const gchar *object_path,
14890 GCancellable *cancellable,
14891 GError **error)
14892{
14893 GInitable *ret;
14894 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);
14895 if (ret != NULL)
14896 return CONTROL_BMC (ret);
14897 else
14898 return NULL;
14899}
14900
14901
14902/**
14903 * control_bmc_proxy_new_for_bus:
14904 * @bus_type: A #GBusType.
14905 * @flags: Flags from the #GDBusProxyFlags enumeration.
14906 * @name: A bus name (well-known or unique).
14907 * @object_path: An object path.
14908 * @cancellable: (allow-none): A #GCancellable or %NULL.
14909 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
14910 * @user_data: User data to pass to @callback.
14911 *
14912 * Like control_bmc_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
14913 *
14914 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
14915 * You can then call control_bmc_proxy_new_for_bus_finish() to get the result of the operation.
14916 *
14917 * See control_bmc_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
14918 */
14919void
14920control_bmc_proxy_new_for_bus (
14921 GBusType bus_type,
14922 GDBusProxyFlags flags,
14923 const gchar *name,
14924 const gchar *object_path,
14925 GCancellable *cancellable,
14926 GAsyncReadyCallback callback,
14927 gpointer user_data)
14928{
14929 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);
14930}
14931
14932/**
14933 * control_bmc_proxy_new_for_bus_finish:
14934 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_bmc_proxy_new_for_bus().
14935 * @error: Return location for error or %NULL
14936 *
14937 * Finishes an operation started with control_bmc_proxy_new_for_bus().
14938 *
14939 * Returns: (transfer full) (type ControlBmcProxy): The constructed proxy object or %NULL if @error is set.
14940 */
14941ControlBmc *
14942control_bmc_proxy_new_for_bus_finish (
14943 GAsyncResult *res,
14944 GError **error)
14945{
14946 GObject *ret;
14947 GObject *source_object;
14948 source_object = g_async_result_get_source_object (res);
14949 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
14950 g_object_unref (source_object);
14951 if (ret != NULL)
14952 return CONTROL_BMC (ret);
14953 else
14954 return NULL;
14955}
14956
14957/**
14958 * control_bmc_proxy_new_for_bus_sync:
14959 * @bus_type: A #GBusType.
14960 * @flags: Flags from the #GDBusProxyFlags enumeration.
14961 * @name: A bus name (well-known or unique).
14962 * @object_path: An object path.
14963 * @cancellable: (allow-none): A #GCancellable or %NULL.
14964 * @error: Return location for error or %NULL
14965 *
14966 * Like control_bmc_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
14967 *
14968 * The calling thread is blocked until a reply is received.
14969 *
14970 * See control_bmc_proxy_new_for_bus() for the asynchronous version of this constructor.
14971 *
14972 * Returns: (transfer full) (type ControlBmcProxy): The constructed proxy object or %NULL if @error is set.
14973 */
14974ControlBmc *
14975control_bmc_proxy_new_for_bus_sync (
14976 GBusType bus_type,
14977 GDBusProxyFlags flags,
14978 const gchar *name,
14979 const gchar *object_path,
14980 GCancellable *cancellable,
14981 GError **error)
14982{
14983 GInitable *ret;
14984 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);
14985 if (ret != NULL)
14986 return CONTROL_BMC (ret);
14987 else
14988 return NULL;
14989}
14990
14991
14992/* ------------------------------------------------------------------------ */
14993
14994/**
14995 * ControlBmcSkeleton:
14996 *
14997 * The #ControlBmcSkeleton structure contains only private data and should only be accessed using the provided API.
14998 */
14999
15000/**
15001 * ControlBmcSkeletonClass:
15002 * @parent_class: The parent class.
15003 *
15004 * Class structure for #ControlBmcSkeleton.
15005 */
15006
15007struct _ControlBmcSkeletonPrivate
15008{
15009 GValue *properties;
15010 GList *changed_properties;
15011 GSource *changed_properties_idle_source;
15012 GMainContext *context;
15013 GMutex lock;
15014};
15015
15016static void
15017_control_bmc_skeleton_handle_method_call (
15018 GDBusConnection *connection G_GNUC_UNUSED,
15019 const gchar *sender G_GNUC_UNUSED,
15020 const gchar *object_path G_GNUC_UNUSED,
15021 const gchar *interface_name,
15022 const gchar *method_name,
15023 GVariant *parameters,
15024 GDBusMethodInvocation *invocation,
15025 gpointer user_data)
15026{
15027 ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (user_data);
15028 _ExtendedGDBusMethodInfo *info;
15029 GVariantIter iter;
15030 GVariant *child;
15031 GValue *paramv;
15032 guint num_params;
15033 guint num_extra;
15034 guint n;
15035 guint signal_id;
15036 GValue return_value = G_VALUE_INIT;
15037 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
15038 g_assert (info != NULL);
15039 num_params = g_variant_n_children (parameters);
15040 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
15041 n = 0;
15042 g_value_init (&paramv[n], TYPE_CONTROL_BMC);
15043 g_value_set_object (&paramv[n++], skeleton);
15044 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
15045 g_value_set_object (&paramv[n++], invocation);
15046 if (info->pass_fdlist)
15047 {
15048#ifdef G_OS_UNIX
15049 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
15050 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
15051#else
15052 g_assert_not_reached ();
15053#endif
15054 }
15055 g_variant_iter_init (&iter, parameters);
15056 while ((child = g_variant_iter_next_value (&iter)) != NULL)
15057 {
15058 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
15059 if (arg_info->use_gvariant)
15060 {
15061 g_value_init (&paramv[n], G_TYPE_VARIANT);
15062 g_value_set_variant (&paramv[n], child);
15063 n++;
15064 }
15065 else
15066 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
15067 g_variant_unref (child);
15068 }
15069 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_BMC);
15070 g_value_init (&return_value, G_TYPE_BOOLEAN);
15071 g_signal_emitv (paramv, signal_id, 0, &return_value);
15072 if (!g_value_get_boolean (&return_value))
15073 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);
15074 g_value_unset (&return_value);
15075 for (n = 0; n < num_params + num_extra; n++)
15076 g_value_unset (&paramv[n]);
15077 g_free (paramv);
15078}
15079
15080static GVariant *
15081_control_bmc_skeleton_handle_get_property (
15082 GDBusConnection *connection G_GNUC_UNUSED,
15083 const gchar *sender G_GNUC_UNUSED,
15084 const gchar *object_path G_GNUC_UNUSED,
15085 const gchar *interface_name G_GNUC_UNUSED,
15086 const gchar *property_name,
15087 GError **error,
15088 gpointer user_data)
15089{
15090 ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (user_data);
15091 GValue value = G_VALUE_INIT;
15092 GParamSpec *pspec;
15093 _ExtendedGDBusPropertyInfo *info;
15094 GVariant *ret;
15095 ret = NULL;
15096 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, property_name);
15097 g_assert (info != NULL);
15098 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
15099 if (pspec == NULL)
15100 {
15101 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
15102 }
15103 else
15104 {
15105 g_value_init (&value, pspec->value_type);
15106 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
15107 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
15108 g_value_unset (&value);
15109 }
15110 return ret;
15111}
15112
15113static gboolean
15114_control_bmc_skeleton_handle_set_property (
15115 GDBusConnection *connection G_GNUC_UNUSED,
15116 const gchar *sender G_GNUC_UNUSED,
15117 const gchar *object_path G_GNUC_UNUSED,
15118 const gchar *interface_name G_GNUC_UNUSED,
15119 const gchar *property_name,
15120 GVariant *variant,
15121 GError **error,
15122 gpointer user_data)
15123{
15124 ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (user_data);
15125 GValue value = G_VALUE_INIT;
15126 GParamSpec *pspec;
15127 _ExtendedGDBusPropertyInfo *info;
15128 gboolean ret;
15129 ret = FALSE;
15130 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, property_name);
15131 g_assert (info != NULL);
15132 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
15133 if (pspec == NULL)
15134 {
15135 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
15136 }
15137 else
15138 {
15139 if (info->use_gvariant)
15140 g_value_set_variant (&value, variant);
15141 else
15142 g_dbus_gvariant_to_gvalue (variant, &value);
15143 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
15144 g_value_unset (&value);
15145 ret = TRUE;
15146 }
15147 return ret;
15148}
15149
15150static const GDBusInterfaceVTable _control_bmc_skeleton_vtable =
15151{
15152 _control_bmc_skeleton_handle_method_call,
15153 _control_bmc_skeleton_handle_get_property,
15154 _control_bmc_skeleton_handle_set_property,
15155 {NULL}
15156};
15157
15158static GDBusInterfaceInfo *
15159control_bmc_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
15160{
15161 return control_bmc_interface_info ();
15162}
15163
15164static GDBusInterfaceVTable *
15165control_bmc_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
15166{
15167 return (GDBusInterfaceVTable *) &_control_bmc_skeleton_vtable;
15168}
15169
15170static GVariant *
15171control_bmc_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
15172{
15173 ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (_skeleton);
15174
15175 GVariantBuilder builder;
15176 guint n;
15177 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
15178 if (_control_bmc_interface_info.parent_struct.properties == NULL)
15179 goto out;
15180 for (n = 0; _control_bmc_interface_info.parent_struct.properties[n] != NULL; n++)
15181 {
15182 GDBusPropertyInfo *info = _control_bmc_interface_info.parent_struct.properties[n];
15183 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
15184 {
15185 GVariant *value;
15186 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);
15187 if (value != NULL)
15188 {
15189 g_variant_take_ref (value);
15190 g_variant_builder_add (&builder, "{sv}", info->name, value);
15191 g_variant_unref (value);
15192 }
15193 }
15194 }
15195out:
15196 return g_variant_builder_end (&builder);
15197}
15198
15199static void
15200control_bmc_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
15201{
15202}
15203
15204static void control_bmc_skeleton_iface_init (ControlBmcIface *iface);
15205#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
15206G_DEFINE_TYPE_WITH_CODE (ControlBmcSkeleton, control_bmc_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
15207 G_ADD_PRIVATE (ControlBmcSkeleton)
15208 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_BMC, control_bmc_skeleton_iface_init));
15209
15210#else
15211G_DEFINE_TYPE_WITH_CODE (ControlBmcSkeleton, control_bmc_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
15212 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_BMC, control_bmc_skeleton_iface_init));
15213
15214#endif
15215static void
15216control_bmc_skeleton_finalize (GObject *object)
15217{
15218 ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (object);
15219 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
15220 if (skeleton->priv->changed_properties_idle_source != NULL)
15221 g_source_destroy (skeleton->priv->changed_properties_idle_source);
15222 g_main_context_unref (skeleton->priv->context);
15223 g_mutex_clear (&skeleton->priv->lock);
15224 G_OBJECT_CLASS (control_bmc_skeleton_parent_class)->finalize (object);
15225}
15226
15227static void
15228control_bmc_skeleton_init (ControlBmcSkeleton *skeleton)
15229{
15230#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
15231 skeleton->priv = control_bmc_skeleton_get_instance_private (skeleton);
15232#else
15233 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_BMC_SKELETON, ControlBmcSkeletonPrivate);
15234#endif
15235
15236 g_mutex_init (&skeleton->priv->lock);
15237 skeleton->priv->context = g_main_context_ref_thread_default ();
15238}
15239
15240static void
15241control_bmc_skeleton_class_init (ControlBmcSkeletonClass *klass)
15242{
15243 GObjectClass *gobject_class;
15244 GDBusInterfaceSkeletonClass *skeleton_class;
15245
15246 gobject_class = G_OBJECT_CLASS (klass);
15247 gobject_class->finalize = control_bmc_skeleton_finalize;
15248
15249 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
15250 skeleton_class->get_info = control_bmc_skeleton_dbus_interface_get_info;
15251 skeleton_class->get_properties = control_bmc_skeleton_dbus_interface_get_properties;
15252 skeleton_class->flush = control_bmc_skeleton_dbus_interface_flush;
15253 skeleton_class->get_vtable = control_bmc_skeleton_dbus_interface_get_vtable;
15254
15255#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
15256 g_type_class_add_private (klass, sizeof (ControlBmcSkeletonPrivate));
15257#endif
15258}
15259
15260static void
15261control_bmc_skeleton_iface_init (ControlBmcIface *iface)
15262{
15263}
15264
15265/**
15266 * control_bmc_skeleton_new:
15267 *
15268 * 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>.
15269 *
15270 * Returns: (transfer full) (type ControlBmcSkeleton): The skeleton object.
15271 */
15272ControlBmc *
15273control_bmc_skeleton_new (void)
15274{
15275 return CONTROL_BMC (g_object_new (TYPE_CONTROL_BMC_SKELETON, NULL));
15276}
15277
15278/* ------------------------------------------------------------------------
15279 * Code for interface org.openbmc.control.Host
15280 * ------------------------------------------------------------------------
15281 */
15282
15283/**
15284 * SECTION:ControlHost
15285 * @title: ControlHost
15286 * @short_description: Generated C code for the org.openbmc.control.Host D-Bus interface
15287 *
15288 * 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.
15289 */
15290
15291/* ---- Introspection data for org.openbmc.control.Host ---- */
15292
15293static const _ExtendedGDBusMethodInfo _control_host_method_info_boot =
15294{
15295 {
15296 -1,
15297 (gchar *) "boot",
15298 NULL,
15299 NULL,
15300 NULL
15301 },
15302 "handle-boot",
15303 FALSE
15304};
15305
15306static const _ExtendedGDBusMethodInfo _control_host_method_info_shutdown =
15307{
15308 {
15309 -1,
15310 (gchar *) "shutdown",
15311 NULL,
15312 NULL,
15313 NULL
15314 },
15315 "handle-shutdown",
15316 FALSE
15317};
15318
15319static const _ExtendedGDBusMethodInfo _control_host_method_info_reboot =
15320{
15321 {
15322 -1,
15323 (gchar *) "reboot",
15324 NULL,
15325 NULL,
15326 NULL
15327 },
15328 "handle-reboot",
15329 FALSE
15330};
15331
15332static const _ExtendedGDBusMethodInfo * const _control_host_method_info_pointers[] =
15333{
15334 &_control_host_method_info_boot,
15335 &_control_host_method_info_shutdown,
15336 &_control_host_method_info_reboot,
15337 NULL
15338};
15339
15340static const _ExtendedGDBusSignalInfo _control_host_signal_info_booted =
15341{
15342 {
15343 -1,
15344 (gchar *) "Booted",
15345 NULL,
15346 NULL
15347 },
15348 "booted"
15349};
15350
15351static const _ExtendedGDBusSignalInfo * const _control_host_signal_info_pointers[] =
15352{
15353 &_control_host_signal_info_booted,
15354 NULL
15355};
15356
Norman James493996c2015-10-31 17:27:13 -050015357static const _ExtendedGDBusPropertyInfo _control_host_property_info_debug_mode =
15358{
15359 {
15360 -1,
15361 (gchar *) "debug_mode",
15362 (gchar *) "i",
15363 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
15364 NULL
15365 },
15366 "debug-mode",
15367 FALSE
15368};
15369
15370static const _ExtendedGDBusPropertyInfo _control_host_property_info_flash_side =
15371{
15372 {
15373 -1,
15374 (gchar *) "flash_side",
15375 (gchar *) "s",
15376 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
15377 NULL
15378 },
15379 "flash-side",
15380 FALSE
15381};
15382
15383static const _ExtendedGDBusPropertyInfo * const _control_host_property_info_pointers[] =
15384{
15385 &_control_host_property_info_debug_mode,
15386 &_control_host_property_info_flash_side,
15387 NULL
15388};
15389
Norman James362a80f2015-09-14 14:04:39 -050015390static const _ExtendedGDBusInterfaceInfo _control_host_interface_info =
15391{
15392 {
15393 -1,
15394 (gchar *) "org.openbmc.control.Host",
15395 (GDBusMethodInfo **) &_control_host_method_info_pointers,
15396 (GDBusSignalInfo **) &_control_host_signal_info_pointers,
Norman James493996c2015-10-31 17:27:13 -050015397 (GDBusPropertyInfo **) &_control_host_property_info_pointers,
Norman James362a80f2015-09-14 14:04:39 -050015398 NULL
15399 },
15400 "control-host",
15401};
15402
15403
15404/**
15405 * control_host_interface_info:
15406 *
15407 * 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.
15408 *
15409 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
15410 */
15411GDBusInterfaceInfo *
15412control_host_interface_info (void)
15413{
15414 return (GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct;
15415}
15416
15417/**
15418 * control_host_override_properties:
15419 * @klass: The class structure for a #GObject<!-- -->-derived class.
15420 * @property_id_begin: The property id to assign to the first overridden property.
15421 *
15422 * Overrides all #GObject properties in the #ControlHost interface for a concrete class.
15423 * The properties are overridden in the order they are defined.
15424 *
15425 * Returns: The last property id.
15426 */
15427guint
15428control_host_override_properties (GObjectClass *klass, guint property_id_begin)
15429{
Norman James493996c2015-10-31 17:27:13 -050015430 g_object_class_override_property (klass, property_id_begin++, "debug-mode");
15431 g_object_class_override_property (klass, property_id_begin++, "flash-side");
Norman James362a80f2015-09-14 14:04:39 -050015432 return property_id_begin - 1;
15433}
15434
15435
15436
15437/**
15438 * ControlHost:
15439 *
15440 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link>.
15441 */
15442
15443/**
15444 * ControlHostIface:
15445 * @parent_iface: The parent interface.
15446 * @handle_boot: Handler for the #ControlHost::handle-boot signal.
15447 * @handle_reboot: Handler for the #ControlHost::handle-reboot signal.
15448 * @handle_shutdown: Handler for the #ControlHost::handle-shutdown signal.
Norman James493996c2015-10-31 17:27:13 -050015449 * @get_debug_mode: Getter for the #ControlHost:debug-mode property.
15450 * @get_flash_side: Getter for the #ControlHost:flash-side property.
Norman James362a80f2015-09-14 14:04:39 -050015451 * @booted: Handler for the #ControlHost::booted signal.
15452 *
15453 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link>.
15454 */
15455
15456typedef ControlHostIface ControlHostInterface;
15457G_DEFINE_INTERFACE (ControlHost, control_host, G_TYPE_OBJECT);
15458
15459static void
15460control_host_default_init (ControlHostIface *iface)
15461{
15462 /* GObject signals for incoming D-Bus method calls: */
15463 /**
15464 * ControlHost::handle-boot:
15465 * @object: A #ControlHost.
15466 * @invocation: A #GDBusMethodInvocation.
15467 *
15468 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Host.boot">boot()</link> D-Bus method.
15469 *
15470 * 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.
15471 *
15472 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
15473 */
15474 g_signal_new ("handle-boot",
15475 G_TYPE_FROM_INTERFACE (iface),
15476 G_SIGNAL_RUN_LAST,
15477 G_STRUCT_OFFSET (ControlHostIface, handle_boot),
15478 g_signal_accumulator_true_handled,
15479 NULL,
15480 g_cclosure_marshal_generic,
15481 G_TYPE_BOOLEAN,
15482 1,
15483 G_TYPE_DBUS_METHOD_INVOCATION);
15484
15485 /**
15486 * ControlHost::handle-shutdown:
15487 * @object: A #ControlHost.
15488 * @invocation: A #GDBusMethodInvocation.
15489 *
15490 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Host.shutdown">shutdown()</link> D-Bus method.
15491 *
15492 * 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.
15493 *
15494 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
15495 */
15496 g_signal_new ("handle-shutdown",
15497 G_TYPE_FROM_INTERFACE (iface),
15498 G_SIGNAL_RUN_LAST,
15499 G_STRUCT_OFFSET (ControlHostIface, handle_shutdown),
15500 g_signal_accumulator_true_handled,
15501 NULL,
15502 g_cclosure_marshal_generic,
15503 G_TYPE_BOOLEAN,
15504 1,
15505 G_TYPE_DBUS_METHOD_INVOCATION);
15506
15507 /**
15508 * ControlHost::handle-reboot:
15509 * @object: A #ControlHost.
15510 * @invocation: A #GDBusMethodInvocation.
15511 *
15512 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Host.reboot">reboot()</link> D-Bus method.
15513 *
15514 * 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.
15515 *
15516 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
15517 */
15518 g_signal_new ("handle-reboot",
15519 G_TYPE_FROM_INTERFACE (iface),
15520 G_SIGNAL_RUN_LAST,
15521 G_STRUCT_OFFSET (ControlHostIface, handle_reboot),
15522 g_signal_accumulator_true_handled,
15523 NULL,
15524 g_cclosure_marshal_generic,
15525 G_TYPE_BOOLEAN,
15526 1,
15527 G_TYPE_DBUS_METHOD_INVOCATION);
15528
15529 /* GObject signals for received D-Bus signals: */
15530 /**
15531 * ControlHost::booted:
15532 * @object: A #ControlHost.
15533 *
15534 * 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.
15535 *
15536 * 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.
15537 */
15538 g_signal_new ("booted",
15539 G_TYPE_FROM_INTERFACE (iface),
15540 G_SIGNAL_RUN_LAST,
15541 G_STRUCT_OFFSET (ControlHostIface, booted),
15542 NULL,
15543 NULL,
15544 g_cclosure_marshal_generic,
15545 G_TYPE_NONE,
15546 0);
15547
Norman James493996c2015-10-31 17:27:13 -050015548 /* GObject properties for D-Bus properties: */
15549 /**
15550 * ControlHost:debug-mode:
15551 *
15552 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-control-Host.debug_mode">"debug_mode"</link>.
15553 *
15554 * 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.
15555 */
15556 g_object_interface_install_property (iface,
15557 g_param_spec_int ("debug-mode", "debug_mode", "debug_mode", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
15558 /**
15559 * ControlHost:flash-side:
15560 *
15561 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-control-Host.flash_side">"flash_side"</link>.
15562 *
15563 * 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.
15564 */
15565 g_object_interface_install_property (iface,
15566 g_param_spec_string ("flash-side", "flash_side", "flash_side", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
15567}
15568
15569/**
15570 * control_host_get_debug_mode: (skip)
15571 * @object: A #ControlHost.
15572 *
15573 * Gets the value of the <link linkend="gdbus-property-org-openbmc-control-Host.debug_mode">"debug_mode"</link> D-Bus property.
15574 *
15575 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
15576 *
15577 * Returns: The property value.
15578 */
15579gint
15580control_host_get_debug_mode (ControlHost *object)
15581{
15582 return CONTROL_HOST_GET_IFACE (object)->get_debug_mode (object);
15583}
15584
15585/**
15586 * control_host_set_debug_mode: (skip)
15587 * @object: A #ControlHost.
15588 * @value: The value to set.
15589 *
15590 * Sets the <link linkend="gdbus-property-org-openbmc-control-Host.debug_mode">"debug_mode"</link> D-Bus property to @value.
15591 *
15592 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
15593 */
15594void
15595control_host_set_debug_mode (ControlHost *object, gint value)
15596{
15597 g_object_set (G_OBJECT (object), "debug-mode", value, NULL);
15598}
15599
15600/**
15601 * control_host_get_flash_side: (skip)
15602 * @object: A #ControlHost.
15603 *
15604 * Gets the value of the <link linkend="gdbus-property-org-openbmc-control-Host.flash_side">"flash_side"</link> D-Bus property.
15605 *
15606 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
15607 *
15608 * <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>
15609 *
15610 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
15611 */
15612const gchar *
15613control_host_get_flash_side (ControlHost *object)
15614{
15615 return CONTROL_HOST_GET_IFACE (object)->get_flash_side (object);
15616}
15617
15618/**
15619 * control_host_dup_flash_side: (skip)
15620 * @object: A #ControlHost.
15621 *
15622 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-control-Host.flash_side">"flash_side"</link> D-Bus property.
15623 *
15624 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
15625 *
15626 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
15627 */
15628gchar *
15629control_host_dup_flash_side (ControlHost *object)
15630{
15631 gchar *value;
15632 g_object_get (G_OBJECT (object), "flash-side", &value, NULL);
15633 return value;
15634}
15635
15636/**
15637 * control_host_set_flash_side: (skip)
15638 * @object: A #ControlHost.
15639 * @value: The value to set.
15640 *
15641 * Sets the <link linkend="gdbus-property-org-openbmc-control-Host.flash_side">"flash_side"</link> D-Bus property to @value.
15642 *
15643 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
15644 */
15645void
15646control_host_set_flash_side (ControlHost *object, const gchar *value)
15647{
15648 g_object_set (G_OBJECT (object), "flash-side", value, NULL);
Norman James362a80f2015-09-14 14:04:39 -050015649}
15650
15651/**
15652 * control_host_emit_booted:
15653 * @object: A #ControlHost.
15654 *
15655 * Emits the <link linkend="gdbus-signal-org-openbmc-control-Host.Booted">"Booted"</link> D-Bus signal.
15656 */
15657void
15658control_host_emit_booted (
15659 ControlHost *object)
15660{
15661 g_signal_emit_by_name (object, "booted");
15662}
15663
15664/**
15665 * control_host_call_boot:
15666 * @proxy: A #ControlHostProxy.
15667 * @cancellable: (allow-none): A #GCancellable or %NULL.
15668 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
15669 * @user_data: User data to pass to @callback.
15670 *
15671 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Host.boot">boot()</link> D-Bus method on @proxy.
15672 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
15673 * You can then call control_host_call_boot_finish() to get the result of the operation.
15674 *
15675 * See control_host_call_boot_sync() for the synchronous, blocking version of this method.
15676 */
15677void
15678control_host_call_boot (
15679 ControlHost *proxy,
15680 GCancellable *cancellable,
15681 GAsyncReadyCallback callback,
15682 gpointer user_data)
15683{
15684 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
15685 "boot",
15686 g_variant_new ("()"),
15687 G_DBUS_CALL_FLAGS_NONE,
15688 -1,
15689 cancellable,
15690 callback,
15691 user_data);
15692}
15693
15694/**
15695 * control_host_call_boot_finish:
15696 * @proxy: A #ControlHostProxy.
15697 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_call_boot().
15698 * @error: Return location for error or %NULL.
15699 *
15700 * Finishes an operation started with control_host_call_boot().
15701 *
15702 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
15703 */
15704gboolean
15705control_host_call_boot_finish (
15706 ControlHost *proxy,
15707 GAsyncResult *res,
15708 GError **error)
15709{
15710 GVariant *_ret;
15711 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
15712 if (_ret == NULL)
15713 goto _out;
15714 g_variant_get (_ret,
15715 "()");
15716 g_variant_unref (_ret);
15717_out:
15718 return _ret != NULL;
15719}
15720
15721/**
15722 * control_host_call_boot_sync:
15723 * @proxy: A #ControlHostProxy.
15724 * @cancellable: (allow-none): A #GCancellable or %NULL.
15725 * @error: Return location for error or %NULL.
15726 *
15727 * 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.
15728 *
15729 * See control_host_call_boot() for the asynchronous version of this method.
15730 *
15731 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
15732 */
15733gboolean
15734control_host_call_boot_sync (
15735 ControlHost *proxy,
15736 GCancellable *cancellable,
15737 GError **error)
15738{
15739 GVariant *_ret;
15740 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
15741 "boot",
15742 g_variant_new ("()"),
15743 G_DBUS_CALL_FLAGS_NONE,
15744 -1,
15745 cancellable,
15746 error);
15747 if (_ret == NULL)
15748 goto _out;
15749 g_variant_get (_ret,
15750 "()");
15751 g_variant_unref (_ret);
15752_out:
15753 return _ret != NULL;
15754}
15755
15756/**
15757 * control_host_call_shutdown:
15758 * @proxy: A #ControlHostProxy.
15759 * @cancellable: (allow-none): A #GCancellable or %NULL.
15760 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
15761 * @user_data: User data to pass to @callback.
15762 *
15763 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Host.shutdown">shutdown()</link> D-Bus method on @proxy.
15764 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
15765 * You can then call control_host_call_shutdown_finish() to get the result of the operation.
15766 *
15767 * See control_host_call_shutdown_sync() for the synchronous, blocking version of this method.
15768 */
15769void
15770control_host_call_shutdown (
15771 ControlHost *proxy,
15772 GCancellable *cancellable,
15773 GAsyncReadyCallback callback,
15774 gpointer user_data)
15775{
15776 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
15777 "shutdown",
15778 g_variant_new ("()"),
15779 G_DBUS_CALL_FLAGS_NONE,
15780 -1,
15781 cancellable,
15782 callback,
15783 user_data);
15784}
15785
15786/**
15787 * control_host_call_shutdown_finish:
15788 * @proxy: A #ControlHostProxy.
15789 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_call_shutdown().
15790 * @error: Return location for error or %NULL.
15791 *
15792 * Finishes an operation started with control_host_call_shutdown().
15793 *
15794 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
15795 */
15796gboolean
15797control_host_call_shutdown_finish (
15798 ControlHost *proxy,
15799 GAsyncResult *res,
15800 GError **error)
15801{
15802 GVariant *_ret;
15803 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
15804 if (_ret == NULL)
15805 goto _out;
15806 g_variant_get (_ret,
15807 "()");
15808 g_variant_unref (_ret);
15809_out:
15810 return _ret != NULL;
15811}
15812
15813/**
15814 * control_host_call_shutdown_sync:
15815 * @proxy: A #ControlHostProxy.
15816 * @cancellable: (allow-none): A #GCancellable or %NULL.
15817 * @error: Return location for error or %NULL.
15818 *
15819 * 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.
15820 *
15821 * See control_host_call_shutdown() for the asynchronous version of this method.
15822 *
15823 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
15824 */
15825gboolean
15826control_host_call_shutdown_sync (
15827 ControlHost *proxy,
15828 GCancellable *cancellable,
15829 GError **error)
15830{
15831 GVariant *_ret;
15832 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
15833 "shutdown",
15834 g_variant_new ("()"),
15835 G_DBUS_CALL_FLAGS_NONE,
15836 -1,
15837 cancellable,
15838 error);
15839 if (_ret == NULL)
15840 goto _out;
15841 g_variant_get (_ret,
15842 "()");
15843 g_variant_unref (_ret);
15844_out:
15845 return _ret != NULL;
15846}
15847
15848/**
15849 * control_host_call_reboot:
15850 * @proxy: A #ControlHostProxy.
15851 * @cancellable: (allow-none): A #GCancellable or %NULL.
15852 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
15853 * @user_data: User data to pass to @callback.
15854 *
15855 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Host.reboot">reboot()</link> D-Bus method on @proxy.
15856 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
15857 * You can then call control_host_call_reboot_finish() to get the result of the operation.
15858 *
15859 * See control_host_call_reboot_sync() for the synchronous, blocking version of this method.
15860 */
15861void
15862control_host_call_reboot (
15863 ControlHost *proxy,
15864 GCancellable *cancellable,
15865 GAsyncReadyCallback callback,
15866 gpointer user_data)
15867{
15868 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
15869 "reboot",
15870 g_variant_new ("()"),
15871 G_DBUS_CALL_FLAGS_NONE,
15872 -1,
15873 cancellable,
15874 callback,
15875 user_data);
15876}
15877
15878/**
15879 * control_host_call_reboot_finish:
15880 * @proxy: A #ControlHostProxy.
15881 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_call_reboot().
15882 * @error: Return location for error or %NULL.
15883 *
15884 * Finishes an operation started with control_host_call_reboot().
15885 *
15886 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
15887 */
15888gboolean
15889control_host_call_reboot_finish (
15890 ControlHost *proxy,
15891 GAsyncResult *res,
15892 GError **error)
15893{
15894 GVariant *_ret;
15895 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
15896 if (_ret == NULL)
15897 goto _out;
15898 g_variant_get (_ret,
15899 "()");
15900 g_variant_unref (_ret);
15901_out:
15902 return _ret != NULL;
15903}
15904
15905/**
15906 * control_host_call_reboot_sync:
15907 * @proxy: A #ControlHostProxy.
15908 * @cancellable: (allow-none): A #GCancellable or %NULL.
15909 * @error: Return location for error or %NULL.
15910 *
15911 * 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.
15912 *
15913 * See control_host_call_reboot() for the asynchronous version of this method.
15914 *
15915 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
15916 */
15917gboolean
15918control_host_call_reboot_sync (
15919 ControlHost *proxy,
15920 GCancellable *cancellable,
15921 GError **error)
15922{
15923 GVariant *_ret;
15924 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
15925 "reboot",
15926 g_variant_new ("()"),
15927 G_DBUS_CALL_FLAGS_NONE,
15928 -1,
15929 cancellable,
15930 error);
15931 if (_ret == NULL)
15932 goto _out;
15933 g_variant_get (_ret,
15934 "()");
15935 g_variant_unref (_ret);
15936_out:
15937 return _ret != NULL;
15938}
15939
15940/**
15941 * control_host_complete_boot:
15942 * @object: A #ControlHost.
15943 * @invocation: (transfer full): A #GDBusMethodInvocation.
15944 *
15945 * 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.
15946 *
15947 * This method will free @invocation, you cannot use it afterwards.
15948 */
15949void
15950control_host_complete_boot (
15951 ControlHost *object,
15952 GDBusMethodInvocation *invocation)
15953{
15954 g_dbus_method_invocation_return_value (invocation,
15955 g_variant_new ("()"));
15956}
15957
15958/**
15959 * control_host_complete_shutdown:
15960 * @object: A #ControlHost.
15961 * @invocation: (transfer full): A #GDBusMethodInvocation.
15962 *
15963 * 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.
15964 *
15965 * This method will free @invocation, you cannot use it afterwards.
15966 */
15967void
15968control_host_complete_shutdown (
15969 ControlHost *object,
15970 GDBusMethodInvocation *invocation)
15971{
15972 g_dbus_method_invocation_return_value (invocation,
15973 g_variant_new ("()"));
15974}
15975
15976/**
15977 * control_host_complete_reboot:
15978 * @object: A #ControlHost.
15979 * @invocation: (transfer full): A #GDBusMethodInvocation.
15980 *
15981 * 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.
15982 *
15983 * This method will free @invocation, you cannot use it afterwards.
15984 */
15985void
15986control_host_complete_reboot (
15987 ControlHost *object,
15988 GDBusMethodInvocation *invocation)
15989{
15990 g_dbus_method_invocation_return_value (invocation,
15991 g_variant_new ("()"));
15992}
15993
15994/* ------------------------------------------------------------------------ */
15995
15996/**
15997 * ControlHostProxy:
15998 *
15999 * The #ControlHostProxy structure contains only private data and should only be accessed using the provided API.
16000 */
16001
16002/**
16003 * ControlHostProxyClass:
16004 * @parent_class: The parent class.
16005 *
16006 * Class structure for #ControlHostProxy.
16007 */
16008
16009struct _ControlHostProxyPrivate
16010{
16011 GData *qdata;
16012};
16013
16014static void control_host_proxy_iface_init (ControlHostIface *iface);
16015
16016#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
16017G_DEFINE_TYPE_WITH_CODE (ControlHostProxy, control_host_proxy, G_TYPE_DBUS_PROXY,
16018 G_ADD_PRIVATE (ControlHostProxy)
16019 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_proxy_iface_init));
16020
16021#else
16022G_DEFINE_TYPE_WITH_CODE (ControlHostProxy, control_host_proxy, G_TYPE_DBUS_PROXY,
16023 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_proxy_iface_init));
16024
16025#endif
16026static void
16027control_host_proxy_finalize (GObject *object)
16028{
16029 ControlHostProxy *proxy = CONTROL_HOST_PROXY (object);
16030 g_datalist_clear (&proxy->priv->qdata);
16031 G_OBJECT_CLASS (control_host_proxy_parent_class)->finalize (object);
16032}
16033
16034static void
16035control_host_proxy_get_property (GObject *object,
16036 guint prop_id,
16037 GValue *value,
16038 GParamSpec *pspec G_GNUC_UNUSED)
16039{
Norman James493996c2015-10-31 17:27:13 -050016040 const _ExtendedGDBusPropertyInfo *info;
16041 GVariant *variant;
16042 g_assert (prop_id != 0 && prop_id - 1 < 2);
16043 info = _control_host_property_info_pointers[prop_id - 1];
16044 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
16045 if (info->use_gvariant)
16046 {
16047 g_value_set_variant (value, variant);
16048 }
16049 else
16050 {
16051 if (variant != NULL)
16052 g_dbus_gvariant_to_gvalue (variant, value);
16053 }
16054 if (variant != NULL)
16055 g_variant_unref (variant);
16056}
16057
16058static void
16059control_host_proxy_set_property_cb (GDBusProxy *proxy,
16060 GAsyncResult *res,
16061 gpointer user_data)
16062{
16063 const _ExtendedGDBusPropertyInfo *info = user_data;
16064 GError *error;
16065 GVariant *_ret;
16066 error = NULL;
16067 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
16068 if (!_ret)
16069 {
16070 g_warning ("Error setting property '%s' on interface org.openbmc.control.Host: %s (%s, %d)",
16071 info->parent_struct.name,
16072 error->message, g_quark_to_string (error->domain), error->code);
16073 g_error_free (error);
16074 }
16075 else
16076 {
16077 g_variant_unref (_ret);
16078 }
Norman James362a80f2015-09-14 14:04:39 -050016079}
16080
16081static void
16082control_host_proxy_set_property (GObject *object,
16083 guint prop_id,
16084 const GValue *value,
16085 GParamSpec *pspec G_GNUC_UNUSED)
16086{
Norman James493996c2015-10-31 17:27:13 -050016087 const _ExtendedGDBusPropertyInfo *info;
16088 GVariant *variant;
16089 g_assert (prop_id != 0 && prop_id - 1 < 2);
16090 info = _control_host_property_info_pointers[prop_id - 1];
16091 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
16092 g_dbus_proxy_call (G_DBUS_PROXY (object),
16093 "org.freedesktop.DBus.Properties.Set",
16094 g_variant_new ("(ssv)", "org.openbmc.control.Host", info->parent_struct.name, variant),
16095 G_DBUS_CALL_FLAGS_NONE,
16096 -1,
16097 NULL, (GAsyncReadyCallback) control_host_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
16098 g_variant_unref (variant);
Norman James362a80f2015-09-14 14:04:39 -050016099}
16100
16101static void
16102control_host_proxy_g_signal (GDBusProxy *proxy,
16103 const gchar *sender_name G_GNUC_UNUSED,
16104 const gchar *signal_name,
16105 GVariant *parameters)
16106{
16107 _ExtendedGDBusSignalInfo *info;
16108 GVariantIter iter;
16109 GVariant *child;
16110 GValue *paramv;
16111 guint num_params;
16112 guint n;
16113 guint signal_id;
16114 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, signal_name);
16115 if (info == NULL)
16116 return;
16117 num_params = g_variant_n_children (parameters);
16118 paramv = g_new0 (GValue, num_params + 1);
16119 g_value_init (&paramv[0], TYPE_CONTROL_HOST);
16120 g_value_set_object (&paramv[0], proxy);
16121 g_variant_iter_init (&iter, parameters);
16122 n = 1;
16123 while ((child = g_variant_iter_next_value (&iter)) != NULL)
16124 {
16125 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
16126 if (arg_info->use_gvariant)
16127 {
16128 g_value_init (&paramv[n], G_TYPE_VARIANT);
16129 g_value_set_variant (&paramv[n], child);
16130 n++;
16131 }
16132 else
16133 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
16134 g_variant_unref (child);
16135 }
16136 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_HOST);
16137 g_signal_emitv (paramv, signal_id, 0, NULL);
16138 for (n = 0; n < num_params + 1; n++)
16139 g_value_unset (&paramv[n]);
16140 g_free (paramv);
16141}
16142
16143static void
16144control_host_proxy_g_properties_changed (GDBusProxy *_proxy,
16145 GVariant *changed_properties,
16146 const gchar *const *invalidated_properties)
16147{
16148 ControlHostProxy *proxy = CONTROL_HOST_PROXY (_proxy);
16149 guint n;
16150 const gchar *key;
16151 GVariantIter *iter;
16152 _ExtendedGDBusPropertyInfo *info;
16153 g_variant_get (changed_properties, "a{sv}", &iter);
16154 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
16155 {
16156 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, key);
16157 g_datalist_remove_data (&proxy->priv->qdata, key);
16158 if (info != NULL)
16159 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
16160 }
16161 g_variant_iter_free (iter);
16162 for (n = 0; invalidated_properties[n] != NULL; n++)
16163 {
16164 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, invalidated_properties[n]);
16165 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
16166 if (info != NULL)
16167 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
16168 }
16169}
16170
Norman James493996c2015-10-31 17:27:13 -050016171static gint
16172control_host_proxy_get_debug_mode (ControlHost *object)
16173{
16174 ControlHostProxy *proxy = CONTROL_HOST_PROXY (object);
16175 GVariant *variant;
16176 gint value = 0;
16177 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "debug_mode");
16178 if (variant != NULL)
16179 {
16180 value = g_variant_get_int32 (variant);
16181 g_variant_unref (variant);
16182 }
16183 return value;
16184}
16185
16186static const gchar *
16187control_host_proxy_get_flash_side (ControlHost *object)
16188{
16189 ControlHostProxy *proxy = CONTROL_HOST_PROXY (object);
16190 GVariant *variant;
16191 const gchar *value = NULL;
16192 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "flash_side");
16193 if (variant != NULL)
16194 {
16195 value = g_variant_get_string (variant, NULL);
16196 g_variant_unref (variant);
16197 }
16198 return value;
16199}
16200
Norman James362a80f2015-09-14 14:04:39 -050016201static void
16202control_host_proxy_init (ControlHostProxy *proxy)
16203{
16204#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
16205 proxy->priv = control_host_proxy_get_instance_private (proxy);
16206#else
16207 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_HOST_PROXY, ControlHostProxyPrivate);
16208#endif
16209
16210 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_host_interface_info ());
16211}
16212
16213static void
16214control_host_proxy_class_init (ControlHostProxyClass *klass)
16215{
16216 GObjectClass *gobject_class;
16217 GDBusProxyClass *proxy_class;
16218
16219 gobject_class = G_OBJECT_CLASS (klass);
16220 gobject_class->finalize = control_host_proxy_finalize;
16221 gobject_class->get_property = control_host_proxy_get_property;
16222 gobject_class->set_property = control_host_proxy_set_property;
16223
16224 proxy_class = G_DBUS_PROXY_CLASS (klass);
16225 proxy_class->g_signal = control_host_proxy_g_signal;
16226 proxy_class->g_properties_changed = control_host_proxy_g_properties_changed;
16227
Norman James493996c2015-10-31 17:27:13 -050016228 control_host_override_properties (gobject_class, 1);
16229
Norman James362a80f2015-09-14 14:04:39 -050016230#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
16231 g_type_class_add_private (klass, sizeof (ControlHostProxyPrivate));
16232#endif
16233}
16234
16235static void
16236control_host_proxy_iface_init (ControlHostIface *iface)
16237{
Norman James493996c2015-10-31 17:27:13 -050016238 iface->get_debug_mode = control_host_proxy_get_debug_mode;
16239 iface->get_flash_side = control_host_proxy_get_flash_side;
Norman James362a80f2015-09-14 14:04:39 -050016240}
16241
16242/**
16243 * control_host_proxy_new:
16244 * @connection: A #GDBusConnection.
16245 * @flags: Flags from the #GDBusProxyFlags enumeration.
16246 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
16247 * @object_path: An object path.
16248 * @cancellable: (allow-none): A #GCancellable or %NULL.
16249 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
16250 * @user_data: User data to pass to @callback.
16251 *
16252 * 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.
16253 *
16254 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
16255 * You can then call control_host_proxy_new_finish() to get the result of the operation.
16256 *
16257 * See control_host_proxy_new_sync() for the synchronous, blocking version of this constructor.
16258 */
16259void
16260control_host_proxy_new (
16261 GDBusConnection *connection,
16262 GDBusProxyFlags flags,
16263 const gchar *name,
16264 const gchar *object_path,
16265 GCancellable *cancellable,
16266 GAsyncReadyCallback callback,
16267 gpointer user_data)
16268{
16269 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);
16270}
16271
16272/**
16273 * control_host_proxy_new_finish:
16274 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_proxy_new().
16275 * @error: Return location for error or %NULL
16276 *
16277 * Finishes an operation started with control_host_proxy_new().
16278 *
16279 * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set.
16280 */
16281ControlHost *
16282control_host_proxy_new_finish (
16283 GAsyncResult *res,
16284 GError **error)
16285{
16286 GObject *ret;
16287 GObject *source_object;
16288 source_object = g_async_result_get_source_object (res);
16289 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
16290 g_object_unref (source_object);
16291 if (ret != NULL)
16292 return CONTROL_HOST (ret);
16293 else
16294 return NULL;
16295}
16296
16297/**
16298 * control_host_proxy_new_sync:
16299 * @connection: A #GDBusConnection.
16300 * @flags: Flags from the #GDBusProxyFlags enumeration.
16301 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
16302 * @object_path: An object path.
16303 * @cancellable: (allow-none): A #GCancellable or %NULL.
16304 * @error: Return location for error or %NULL
16305 *
16306 * 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.
16307 *
16308 * The calling thread is blocked until a reply is received.
16309 *
16310 * See control_host_proxy_new() for the asynchronous version of this constructor.
16311 *
16312 * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set.
16313 */
16314ControlHost *
16315control_host_proxy_new_sync (
16316 GDBusConnection *connection,
16317 GDBusProxyFlags flags,
16318 const gchar *name,
16319 const gchar *object_path,
16320 GCancellable *cancellable,
16321 GError **error)
16322{
16323 GInitable *ret;
16324 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);
16325 if (ret != NULL)
16326 return CONTROL_HOST (ret);
16327 else
16328 return NULL;
16329}
16330
16331
16332/**
16333 * control_host_proxy_new_for_bus:
16334 * @bus_type: A #GBusType.
16335 * @flags: Flags from the #GDBusProxyFlags enumeration.
16336 * @name: A bus name (well-known or unique).
16337 * @object_path: An object path.
16338 * @cancellable: (allow-none): A #GCancellable or %NULL.
16339 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
16340 * @user_data: User data to pass to @callback.
16341 *
16342 * Like control_host_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
16343 *
16344 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
16345 * You can then call control_host_proxy_new_for_bus_finish() to get the result of the operation.
16346 *
16347 * See control_host_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
16348 */
16349void
16350control_host_proxy_new_for_bus (
16351 GBusType bus_type,
16352 GDBusProxyFlags flags,
16353 const gchar *name,
16354 const gchar *object_path,
16355 GCancellable *cancellable,
16356 GAsyncReadyCallback callback,
16357 gpointer user_data)
16358{
16359 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);
16360}
16361
16362/**
16363 * control_host_proxy_new_for_bus_finish:
16364 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_proxy_new_for_bus().
16365 * @error: Return location for error or %NULL
16366 *
16367 * Finishes an operation started with control_host_proxy_new_for_bus().
16368 *
16369 * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set.
16370 */
16371ControlHost *
16372control_host_proxy_new_for_bus_finish (
16373 GAsyncResult *res,
16374 GError **error)
16375{
16376 GObject *ret;
16377 GObject *source_object;
16378 source_object = g_async_result_get_source_object (res);
16379 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
16380 g_object_unref (source_object);
16381 if (ret != NULL)
16382 return CONTROL_HOST (ret);
16383 else
16384 return NULL;
16385}
16386
16387/**
16388 * control_host_proxy_new_for_bus_sync:
16389 * @bus_type: A #GBusType.
16390 * @flags: Flags from the #GDBusProxyFlags enumeration.
16391 * @name: A bus name (well-known or unique).
16392 * @object_path: An object path.
16393 * @cancellable: (allow-none): A #GCancellable or %NULL.
16394 * @error: Return location for error or %NULL
16395 *
16396 * Like control_host_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
16397 *
16398 * The calling thread is blocked until a reply is received.
16399 *
16400 * See control_host_proxy_new_for_bus() for the asynchronous version of this constructor.
16401 *
16402 * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set.
16403 */
16404ControlHost *
16405control_host_proxy_new_for_bus_sync (
16406 GBusType bus_type,
16407 GDBusProxyFlags flags,
16408 const gchar *name,
16409 const gchar *object_path,
16410 GCancellable *cancellable,
16411 GError **error)
16412{
16413 GInitable *ret;
16414 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);
16415 if (ret != NULL)
16416 return CONTROL_HOST (ret);
16417 else
16418 return NULL;
16419}
16420
16421
16422/* ------------------------------------------------------------------------ */
16423
16424/**
16425 * ControlHostSkeleton:
16426 *
16427 * The #ControlHostSkeleton structure contains only private data and should only be accessed using the provided API.
16428 */
16429
16430/**
16431 * ControlHostSkeletonClass:
16432 * @parent_class: The parent class.
16433 *
16434 * Class structure for #ControlHostSkeleton.
16435 */
16436
16437struct _ControlHostSkeletonPrivate
16438{
16439 GValue *properties;
16440 GList *changed_properties;
16441 GSource *changed_properties_idle_source;
16442 GMainContext *context;
16443 GMutex lock;
16444};
16445
16446static void
16447_control_host_skeleton_handle_method_call (
16448 GDBusConnection *connection G_GNUC_UNUSED,
16449 const gchar *sender G_GNUC_UNUSED,
16450 const gchar *object_path G_GNUC_UNUSED,
16451 const gchar *interface_name,
16452 const gchar *method_name,
16453 GVariant *parameters,
16454 GDBusMethodInvocation *invocation,
16455 gpointer user_data)
16456{
16457 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (user_data);
16458 _ExtendedGDBusMethodInfo *info;
16459 GVariantIter iter;
16460 GVariant *child;
16461 GValue *paramv;
16462 guint num_params;
16463 guint num_extra;
16464 guint n;
16465 guint signal_id;
16466 GValue return_value = G_VALUE_INIT;
16467 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
16468 g_assert (info != NULL);
16469 num_params = g_variant_n_children (parameters);
16470 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
16471 n = 0;
16472 g_value_init (&paramv[n], TYPE_CONTROL_HOST);
16473 g_value_set_object (&paramv[n++], skeleton);
16474 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
16475 g_value_set_object (&paramv[n++], invocation);
16476 if (info->pass_fdlist)
16477 {
16478#ifdef G_OS_UNIX
16479 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
16480 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
16481#else
16482 g_assert_not_reached ();
16483#endif
16484 }
16485 g_variant_iter_init (&iter, parameters);
16486 while ((child = g_variant_iter_next_value (&iter)) != NULL)
16487 {
16488 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
16489 if (arg_info->use_gvariant)
16490 {
16491 g_value_init (&paramv[n], G_TYPE_VARIANT);
16492 g_value_set_variant (&paramv[n], child);
16493 n++;
16494 }
16495 else
16496 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
16497 g_variant_unref (child);
16498 }
16499 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_HOST);
16500 g_value_init (&return_value, G_TYPE_BOOLEAN);
16501 g_signal_emitv (paramv, signal_id, 0, &return_value);
16502 if (!g_value_get_boolean (&return_value))
16503 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);
16504 g_value_unset (&return_value);
16505 for (n = 0; n < num_params + num_extra; n++)
16506 g_value_unset (&paramv[n]);
16507 g_free (paramv);
16508}
16509
16510static GVariant *
16511_control_host_skeleton_handle_get_property (
16512 GDBusConnection *connection G_GNUC_UNUSED,
16513 const gchar *sender G_GNUC_UNUSED,
16514 const gchar *object_path G_GNUC_UNUSED,
16515 const gchar *interface_name G_GNUC_UNUSED,
16516 const gchar *property_name,
16517 GError **error,
16518 gpointer user_data)
16519{
16520 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (user_data);
16521 GValue value = G_VALUE_INIT;
16522 GParamSpec *pspec;
16523 _ExtendedGDBusPropertyInfo *info;
16524 GVariant *ret;
16525 ret = NULL;
16526 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, property_name);
16527 g_assert (info != NULL);
16528 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
16529 if (pspec == NULL)
16530 {
16531 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
16532 }
16533 else
16534 {
16535 g_value_init (&value, pspec->value_type);
16536 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
16537 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
16538 g_value_unset (&value);
16539 }
16540 return ret;
16541}
16542
16543static gboolean
16544_control_host_skeleton_handle_set_property (
16545 GDBusConnection *connection G_GNUC_UNUSED,
16546 const gchar *sender G_GNUC_UNUSED,
16547 const gchar *object_path G_GNUC_UNUSED,
16548 const gchar *interface_name G_GNUC_UNUSED,
16549 const gchar *property_name,
16550 GVariant *variant,
16551 GError **error,
16552 gpointer user_data)
16553{
16554 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (user_data);
16555 GValue value = G_VALUE_INIT;
16556 GParamSpec *pspec;
16557 _ExtendedGDBusPropertyInfo *info;
16558 gboolean ret;
16559 ret = FALSE;
16560 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, property_name);
16561 g_assert (info != NULL);
16562 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
16563 if (pspec == NULL)
16564 {
16565 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
16566 }
16567 else
16568 {
16569 if (info->use_gvariant)
16570 g_value_set_variant (&value, variant);
16571 else
16572 g_dbus_gvariant_to_gvalue (variant, &value);
16573 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
16574 g_value_unset (&value);
16575 ret = TRUE;
16576 }
16577 return ret;
16578}
16579
16580static const GDBusInterfaceVTable _control_host_skeleton_vtable =
16581{
16582 _control_host_skeleton_handle_method_call,
16583 _control_host_skeleton_handle_get_property,
16584 _control_host_skeleton_handle_set_property,
16585 {NULL}
16586};
16587
16588static GDBusInterfaceInfo *
16589control_host_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
16590{
16591 return control_host_interface_info ();
16592}
16593
16594static GDBusInterfaceVTable *
16595control_host_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
16596{
16597 return (GDBusInterfaceVTable *) &_control_host_skeleton_vtable;
16598}
16599
16600static GVariant *
16601control_host_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
16602{
16603 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (_skeleton);
16604
16605 GVariantBuilder builder;
16606 guint n;
16607 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
16608 if (_control_host_interface_info.parent_struct.properties == NULL)
16609 goto out;
16610 for (n = 0; _control_host_interface_info.parent_struct.properties[n] != NULL; n++)
16611 {
16612 GDBusPropertyInfo *info = _control_host_interface_info.parent_struct.properties[n];
16613 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
16614 {
16615 GVariant *value;
16616 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);
16617 if (value != NULL)
16618 {
16619 g_variant_take_ref (value);
16620 g_variant_builder_add (&builder, "{sv}", info->name, value);
16621 g_variant_unref (value);
16622 }
16623 }
16624 }
16625out:
16626 return g_variant_builder_end (&builder);
16627}
16628
Norman James493996c2015-10-31 17:27:13 -050016629static gboolean _control_host_emit_changed (gpointer user_data);
16630
Norman James362a80f2015-09-14 14:04:39 -050016631static void
16632control_host_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
16633{
Norman James493996c2015-10-31 17:27:13 -050016634 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (_skeleton);
16635 gboolean emit_changed = FALSE;
16636
16637 g_mutex_lock (&skeleton->priv->lock);
16638 if (skeleton->priv->changed_properties_idle_source != NULL)
16639 {
16640 g_source_destroy (skeleton->priv->changed_properties_idle_source);
16641 skeleton->priv->changed_properties_idle_source = NULL;
16642 emit_changed = TRUE;
16643 }
16644 g_mutex_unlock (&skeleton->priv->lock);
16645
16646 if (emit_changed)
16647 _control_host_emit_changed (skeleton);
Norman James362a80f2015-09-14 14:04:39 -050016648}
16649
16650static void
16651_control_host_on_signal_booted (
16652 ControlHost *object)
16653{
16654 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object);
16655
16656 GList *connections, *l;
16657 GVariant *signal_variant;
16658 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
16659
16660 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
16661 for (l = connections; l != NULL; l = l->next)
16662 {
16663 GDBusConnection *connection = l->data;
16664 g_dbus_connection_emit_signal (connection,
16665 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.control.Host", "Booted",
16666 signal_variant, NULL);
16667 }
16668 g_variant_unref (signal_variant);
16669 g_list_free_full (connections, g_object_unref);
16670}
16671
16672static void control_host_skeleton_iface_init (ControlHostIface *iface);
16673#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
16674G_DEFINE_TYPE_WITH_CODE (ControlHostSkeleton, control_host_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
16675 G_ADD_PRIVATE (ControlHostSkeleton)
16676 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_skeleton_iface_init));
16677
16678#else
16679G_DEFINE_TYPE_WITH_CODE (ControlHostSkeleton, control_host_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
16680 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_skeleton_iface_init));
16681
16682#endif
16683static void
16684control_host_skeleton_finalize (GObject *object)
16685{
16686 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object);
Norman James493996c2015-10-31 17:27:13 -050016687 guint n;
16688 for (n = 0; n < 2; n++)
16689 g_value_unset (&skeleton->priv->properties[n]);
16690 g_free (skeleton->priv->properties);
Norman James362a80f2015-09-14 14:04:39 -050016691 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
16692 if (skeleton->priv->changed_properties_idle_source != NULL)
16693 g_source_destroy (skeleton->priv->changed_properties_idle_source);
16694 g_main_context_unref (skeleton->priv->context);
16695 g_mutex_clear (&skeleton->priv->lock);
16696 G_OBJECT_CLASS (control_host_skeleton_parent_class)->finalize (object);
16697}
16698
16699static void
Norman James493996c2015-10-31 17:27:13 -050016700control_host_skeleton_get_property (GObject *object,
16701 guint prop_id,
16702 GValue *value,
16703 GParamSpec *pspec G_GNUC_UNUSED)
16704{
16705 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object);
16706 g_assert (prop_id != 0 && prop_id - 1 < 2);
16707 g_mutex_lock (&skeleton->priv->lock);
16708 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
16709 g_mutex_unlock (&skeleton->priv->lock);
16710}
16711
16712static gboolean
16713_control_host_emit_changed (gpointer user_data)
16714{
16715 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (user_data);
16716 GList *l;
16717 GVariantBuilder builder;
16718 GVariantBuilder invalidated_builder;
16719 guint num_changes;
16720
16721 g_mutex_lock (&skeleton->priv->lock);
16722 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
16723 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
16724 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
16725 {
16726 ChangedProperty *cp = l->data;
16727 GVariant *variant;
16728 const GValue *cur_value;
16729
16730 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
16731 if (!_g_value_equal (cur_value, &cp->orig_value))
16732 {
16733 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
16734 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
16735 g_variant_unref (variant);
16736 num_changes++;
16737 }
16738 }
16739 if (num_changes > 0)
16740 {
16741 GList *connections, *ll;
16742 GVariant *signal_variant;
16743 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.control.Host",
16744 &builder, &invalidated_builder));
16745 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
16746 for (ll = connections; ll != NULL; ll = ll->next)
16747 {
16748 GDBusConnection *connection = ll->data;
16749
16750 g_dbus_connection_emit_signal (connection,
16751 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
16752 "org.freedesktop.DBus.Properties",
16753 "PropertiesChanged",
16754 signal_variant,
16755 NULL);
16756 }
16757 g_variant_unref (signal_variant);
16758 g_list_free_full (connections, g_object_unref);
16759 }
16760 else
16761 {
16762 g_variant_builder_clear (&builder);
16763 g_variant_builder_clear (&invalidated_builder);
16764 }
16765 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
16766 skeleton->priv->changed_properties = NULL;
16767 skeleton->priv->changed_properties_idle_source = NULL;
16768 g_mutex_unlock (&skeleton->priv->lock);
16769 return FALSE;
16770}
16771
16772static void
16773_control_host_schedule_emit_changed (ControlHostSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
16774{
16775 ChangedProperty *cp;
16776 GList *l;
16777 cp = NULL;
16778 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
16779 {
16780 ChangedProperty *i_cp = l->data;
16781 if (i_cp->info == info)
16782 {
16783 cp = i_cp;
16784 break;
16785 }
16786 }
16787 if (cp == NULL)
16788 {
16789 cp = g_new0 (ChangedProperty, 1);
16790 cp->prop_id = prop_id;
16791 cp->info = info;
16792 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
16793 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
16794 g_value_copy (orig_value, &cp->orig_value);
16795 }
16796}
16797
16798static void
16799control_host_skeleton_notify (GObject *object,
16800 GParamSpec *pspec G_GNUC_UNUSED)
16801{
16802 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object);
16803 g_mutex_lock (&skeleton->priv->lock);
16804 if (skeleton->priv->changed_properties != NULL &&
16805 skeleton->priv->changed_properties_idle_source == NULL)
16806 {
16807 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
16808 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
16809 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _control_host_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
Adriana Kobylakfd778822016-06-16 09:08:37 -050016810 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _control_host_emit_changed");
Norman James493996c2015-10-31 17:27:13 -050016811 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
16812 g_source_unref (skeleton->priv->changed_properties_idle_source);
16813 }
16814 g_mutex_unlock (&skeleton->priv->lock);
16815}
16816
16817static void
16818control_host_skeleton_set_property (GObject *object,
16819 guint prop_id,
16820 const GValue *value,
16821 GParamSpec *pspec)
16822{
16823 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object);
16824 g_assert (prop_id != 0 && prop_id - 1 < 2);
16825 g_mutex_lock (&skeleton->priv->lock);
16826 g_object_freeze_notify (object);
16827 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
16828 {
16829 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
16830 _control_host_schedule_emit_changed (skeleton, _control_host_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
16831 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
16832 g_object_notify_by_pspec (object, pspec);
16833 }
16834 g_mutex_unlock (&skeleton->priv->lock);
16835 g_object_thaw_notify (object);
16836}
16837
16838static void
Norman James362a80f2015-09-14 14:04:39 -050016839control_host_skeleton_init (ControlHostSkeleton *skeleton)
16840{
16841#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
16842 skeleton->priv = control_host_skeleton_get_instance_private (skeleton);
16843#else
16844 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_HOST_SKELETON, ControlHostSkeletonPrivate);
16845#endif
16846
16847 g_mutex_init (&skeleton->priv->lock);
16848 skeleton->priv->context = g_main_context_ref_thread_default ();
Norman James493996c2015-10-31 17:27:13 -050016849 skeleton->priv->properties = g_new0 (GValue, 2);
16850 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
16851 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
16852}
16853
16854static gint
16855control_host_skeleton_get_debug_mode (ControlHost *object)
16856{
16857 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object);
16858 gint value;
16859 g_mutex_lock (&skeleton->priv->lock);
16860 value = g_value_get_int (&(skeleton->priv->properties[0]));
16861 g_mutex_unlock (&skeleton->priv->lock);
16862 return value;
16863}
16864
16865static const gchar *
16866control_host_skeleton_get_flash_side (ControlHost *object)
16867{
16868 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object);
16869 const gchar *value;
16870 g_mutex_lock (&skeleton->priv->lock);
16871 value = g_value_get_string (&(skeleton->priv->properties[1]));
16872 g_mutex_unlock (&skeleton->priv->lock);
16873 return value;
Norman James362a80f2015-09-14 14:04:39 -050016874}
16875
16876static void
16877control_host_skeleton_class_init (ControlHostSkeletonClass *klass)
16878{
16879 GObjectClass *gobject_class;
16880 GDBusInterfaceSkeletonClass *skeleton_class;
16881
16882 gobject_class = G_OBJECT_CLASS (klass);
16883 gobject_class->finalize = control_host_skeleton_finalize;
Norman James493996c2015-10-31 17:27:13 -050016884 gobject_class->get_property = control_host_skeleton_get_property;
16885 gobject_class->set_property = control_host_skeleton_set_property;
16886 gobject_class->notify = control_host_skeleton_notify;
16887
16888
16889 control_host_override_properties (gobject_class, 1);
Norman James362a80f2015-09-14 14:04:39 -050016890
16891 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
16892 skeleton_class->get_info = control_host_skeleton_dbus_interface_get_info;
16893 skeleton_class->get_properties = control_host_skeleton_dbus_interface_get_properties;
16894 skeleton_class->flush = control_host_skeleton_dbus_interface_flush;
16895 skeleton_class->get_vtable = control_host_skeleton_dbus_interface_get_vtable;
16896
16897#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
16898 g_type_class_add_private (klass, sizeof (ControlHostSkeletonPrivate));
16899#endif
16900}
16901
16902static void
16903control_host_skeleton_iface_init (ControlHostIface *iface)
16904{
16905 iface->booted = _control_host_on_signal_booted;
Norman James493996c2015-10-31 17:27:13 -050016906 iface->get_debug_mode = control_host_skeleton_get_debug_mode;
16907 iface->get_flash_side = control_host_skeleton_get_flash_side;
Norman James362a80f2015-09-14 14:04:39 -050016908}
16909
16910/**
16911 * control_host_skeleton_new:
16912 *
16913 * 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>.
16914 *
16915 * Returns: (transfer full) (type ControlHostSkeleton): The skeleton object.
16916 */
16917ControlHost *
16918control_host_skeleton_new (void)
16919{
16920 return CONTROL_HOST (g_object_new (TYPE_CONTROL_HOST_SKELETON, NULL));
16921}
16922
16923/* ------------------------------------------------------------------------
16924 * Code for interface org.openbmc.control.Power
16925 * ------------------------------------------------------------------------
16926 */
16927
16928/**
16929 * SECTION:ControlPower
16930 * @title: ControlPower
16931 * @short_description: Generated C code for the org.openbmc.control.Power D-Bus interface
16932 *
16933 * 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.
16934 */
16935
16936/* ---- Introspection data for org.openbmc.control.Power ---- */
16937
16938static const _ExtendedGDBusArgInfo _control_power_method_info_set_power_state_IN_ARG_state =
16939{
16940 {
16941 -1,
16942 (gchar *) "state",
16943 (gchar *) "i",
16944 NULL
16945 },
16946 FALSE
16947};
16948
16949static const _ExtendedGDBusArgInfo * const _control_power_method_info_set_power_state_IN_ARG_pointers[] =
16950{
16951 &_control_power_method_info_set_power_state_IN_ARG_state,
16952 NULL
16953};
16954
16955static const _ExtendedGDBusMethodInfo _control_power_method_info_set_power_state =
16956{
16957 {
16958 -1,
16959 (gchar *) "setPowerState",
16960 (GDBusArgInfo **) &_control_power_method_info_set_power_state_IN_ARG_pointers,
16961 NULL,
16962 NULL
16963 },
16964 "handle-set-power-state",
16965 FALSE
16966};
16967
16968static const _ExtendedGDBusArgInfo _control_power_method_info_get_power_state_OUT_ARG_state =
16969{
16970 {
16971 -1,
16972 (gchar *) "state",
16973 (gchar *) "i",
16974 NULL
16975 },
16976 FALSE
16977};
16978
16979static const _ExtendedGDBusArgInfo * const _control_power_method_info_get_power_state_OUT_ARG_pointers[] =
16980{
16981 &_control_power_method_info_get_power_state_OUT_ARG_state,
16982 NULL
16983};
16984
16985static const _ExtendedGDBusMethodInfo _control_power_method_info_get_power_state =
16986{
16987 {
16988 -1,
16989 (gchar *) "getPowerState",
16990 NULL,
16991 (GDBusArgInfo **) &_control_power_method_info_get_power_state_OUT_ARG_pointers,
16992 NULL
16993 },
16994 "handle-get-power-state",
16995 FALSE
16996};
16997
16998static const _ExtendedGDBusMethodInfo * const _control_power_method_info_pointers[] =
16999{
17000 &_control_power_method_info_set_power_state,
17001 &_control_power_method_info_get_power_state,
17002 NULL
17003};
17004
17005static const _ExtendedGDBusSignalInfo _control_power_signal_info_power_good =
17006{
17007 {
17008 -1,
17009 (gchar *) "PowerGood",
17010 NULL,
17011 NULL
17012 },
17013 "power-good"
17014};
17015
17016static const _ExtendedGDBusSignalInfo _control_power_signal_info_power_lost =
17017{
17018 {
17019 -1,
17020 (gchar *) "PowerLost",
17021 NULL,
17022 NULL
17023 },
17024 "power-lost"
17025};
17026
17027static const _ExtendedGDBusSignalInfo * const _control_power_signal_info_pointers[] =
17028{
17029 &_control_power_signal_info_power_good,
17030 &_control_power_signal_info_power_lost,
17031 NULL
17032};
17033
17034static const _ExtendedGDBusPropertyInfo _control_power_property_info_pgood =
17035{
17036 {
17037 -1,
17038 (gchar *) "pgood",
17039 (gchar *) "i",
17040 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
17041 NULL
17042 },
17043 "pgood",
17044 FALSE
17045};
17046
17047static const _ExtendedGDBusPropertyInfo _control_power_property_info_state =
17048{
17049 {
17050 -1,
17051 (gchar *) "state",
17052 (gchar *) "i",
17053 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
17054 NULL
17055 },
17056 "state",
17057 FALSE
17058};
17059
Norman James32e74e22015-09-15 21:28:06 -050017060static const _ExtendedGDBusPropertyInfo _control_power_property_info_pgood_timeout =
17061{
17062 {
17063 -1,
17064 (gchar *) "pgood_timeout",
17065 (gchar *) "i",
17066 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
17067 NULL
17068 },
17069 "pgood-timeout",
17070 FALSE
17071};
17072
Norman James362a80f2015-09-14 14:04:39 -050017073static const _ExtendedGDBusPropertyInfo * const _control_power_property_info_pointers[] =
17074{
17075 &_control_power_property_info_pgood,
17076 &_control_power_property_info_state,
Norman James32e74e22015-09-15 21:28:06 -050017077 &_control_power_property_info_pgood_timeout,
Norman James362a80f2015-09-14 14:04:39 -050017078 NULL
17079};
17080
17081static const _ExtendedGDBusInterfaceInfo _control_power_interface_info =
17082{
17083 {
17084 -1,
17085 (gchar *) "org.openbmc.control.Power",
17086 (GDBusMethodInfo **) &_control_power_method_info_pointers,
17087 (GDBusSignalInfo **) &_control_power_signal_info_pointers,
17088 (GDBusPropertyInfo **) &_control_power_property_info_pointers,
17089 NULL
17090 },
17091 "control-power",
17092};
17093
17094
17095/**
17096 * control_power_interface_info:
17097 *
17098 * 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.
17099 *
17100 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
17101 */
17102GDBusInterfaceInfo *
17103control_power_interface_info (void)
17104{
17105 return (GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct;
17106}
17107
17108/**
17109 * control_power_override_properties:
17110 * @klass: The class structure for a #GObject<!-- -->-derived class.
17111 * @property_id_begin: The property id to assign to the first overridden property.
17112 *
17113 * Overrides all #GObject properties in the #ControlPower interface for a concrete class.
17114 * The properties are overridden in the order they are defined.
17115 *
17116 * Returns: The last property id.
17117 */
17118guint
17119control_power_override_properties (GObjectClass *klass, guint property_id_begin)
17120{
17121 g_object_class_override_property (klass, property_id_begin++, "pgood");
17122 g_object_class_override_property (klass, property_id_begin++, "state");
Norman James32e74e22015-09-15 21:28:06 -050017123 g_object_class_override_property (klass, property_id_begin++, "pgood-timeout");
Norman James362a80f2015-09-14 14:04:39 -050017124 return property_id_begin - 1;
17125}
17126
17127
17128
17129/**
17130 * ControlPower:
17131 *
17132 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Power.top_of_page">org.openbmc.control.Power</link>.
17133 */
17134
17135/**
17136 * ControlPowerIface:
17137 * @parent_iface: The parent interface.
17138 * @handle_get_power_state: Handler for the #ControlPower::handle-get-power-state signal.
17139 * @handle_set_power_state: Handler for the #ControlPower::handle-set-power-state signal.
17140 * @get_pgood: Getter for the #ControlPower:pgood property.
Norman James32e74e22015-09-15 21:28:06 -050017141 * @get_pgood_timeout: Getter for the #ControlPower:pgood-timeout property.
Norman James362a80f2015-09-14 14:04:39 -050017142 * @get_state: Getter for the #ControlPower:state property.
17143 * @power_good: Handler for the #ControlPower::power-good signal.
17144 * @power_lost: Handler for the #ControlPower::power-lost signal.
17145 *
17146 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Power.top_of_page">org.openbmc.control.Power</link>.
17147 */
17148
17149typedef ControlPowerIface ControlPowerInterface;
17150G_DEFINE_INTERFACE (ControlPower, control_power, G_TYPE_OBJECT);
17151
17152static void
17153control_power_default_init (ControlPowerIface *iface)
17154{
17155 /* GObject signals for incoming D-Bus method calls: */
17156 /**
17157 * ControlPower::handle-set-power-state:
17158 * @object: A #ControlPower.
17159 * @invocation: A #GDBusMethodInvocation.
17160 * @arg_state: Argument passed by remote caller.
17161 *
17162 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Power.setPowerState">setPowerState()</link> D-Bus method.
17163 *
17164 * 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.
17165 *
17166 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
17167 */
17168 g_signal_new ("handle-set-power-state",
17169 G_TYPE_FROM_INTERFACE (iface),
17170 G_SIGNAL_RUN_LAST,
17171 G_STRUCT_OFFSET (ControlPowerIface, handle_set_power_state),
17172 g_signal_accumulator_true_handled,
17173 NULL,
17174 g_cclosure_marshal_generic,
17175 G_TYPE_BOOLEAN,
17176 2,
17177 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT);
17178
17179 /**
17180 * ControlPower::handle-get-power-state:
17181 * @object: A #ControlPower.
17182 * @invocation: A #GDBusMethodInvocation.
17183 *
17184 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Power.getPowerState">getPowerState()</link> D-Bus method.
17185 *
17186 * 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.
17187 *
17188 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
17189 */
17190 g_signal_new ("handle-get-power-state",
17191 G_TYPE_FROM_INTERFACE (iface),
17192 G_SIGNAL_RUN_LAST,
17193 G_STRUCT_OFFSET (ControlPowerIface, handle_get_power_state),
17194 g_signal_accumulator_true_handled,
17195 NULL,
17196 g_cclosure_marshal_generic,
17197 G_TYPE_BOOLEAN,
17198 1,
17199 G_TYPE_DBUS_METHOD_INVOCATION);
17200
17201 /* GObject signals for received D-Bus signals: */
17202 /**
17203 * ControlPower::power-good:
17204 * @object: A #ControlPower.
17205 *
17206 * 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.
17207 *
17208 * 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.
17209 */
17210 g_signal_new ("power-good",
17211 G_TYPE_FROM_INTERFACE (iface),
17212 G_SIGNAL_RUN_LAST,
17213 G_STRUCT_OFFSET (ControlPowerIface, power_good),
17214 NULL,
17215 NULL,
17216 g_cclosure_marshal_generic,
17217 G_TYPE_NONE,
17218 0);
17219
17220 /**
17221 * ControlPower::power-lost:
17222 * @object: A #ControlPower.
17223 *
17224 * 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.
17225 *
17226 * 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.
17227 */
17228 g_signal_new ("power-lost",
17229 G_TYPE_FROM_INTERFACE (iface),
17230 G_SIGNAL_RUN_LAST,
17231 G_STRUCT_OFFSET (ControlPowerIface, power_lost),
17232 NULL,
17233 NULL,
17234 g_cclosure_marshal_generic,
17235 G_TYPE_NONE,
17236 0);
17237
17238 /* GObject properties for D-Bus properties: */
17239 /**
17240 * ControlPower:pgood:
17241 *
17242 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-control-Power.pgood">"pgood"</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 ("pgood", "pgood", "pgood", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
17248 /**
17249 * ControlPower:state:
17250 *
17251 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-control-Power.state">"state"</link>.
17252 *
17253 * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.
17254 */
17255 g_object_interface_install_property (iface,
17256 g_param_spec_int ("state", "state", "state", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Norman James32e74e22015-09-15 21:28:06 -050017257 /**
17258 * ControlPower:pgood-timeout:
17259 *
17260 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-control-Power.pgood_timeout">"pgood_timeout"</link>.
17261 *
17262 * 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.
17263 */
17264 g_object_interface_install_property (iface,
17265 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 -050017266}
17267
17268/**
17269 * control_power_get_pgood: (skip)
17270 * @object: A #ControlPower.
17271 *
17272 * Gets the value of the <link linkend="gdbus-property-org-openbmc-control-Power.pgood">"pgood"</link> D-Bus property.
17273 *
17274 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
17275 *
17276 * Returns: The property value.
17277 */
17278gint
17279control_power_get_pgood (ControlPower *object)
17280{
17281 return CONTROL_POWER_GET_IFACE (object)->get_pgood (object);
17282}
17283
17284/**
17285 * control_power_set_pgood: (skip)
17286 * @object: A #ControlPower.
17287 * @value: The value to set.
17288 *
17289 * Sets the <link linkend="gdbus-property-org-openbmc-control-Power.pgood">"pgood"</link> D-Bus property to @value.
17290 *
17291 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
17292 */
17293void
17294control_power_set_pgood (ControlPower *object, gint value)
17295{
17296 g_object_set (G_OBJECT (object), "pgood", value, NULL);
17297}
17298
17299/**
17300 * control_power_get_state: (skip)
17301 * @object: A #ControlPower.
17302 *
17303 * Gets the value of the <link linkend="gdbus-property-org-openbmc-control-Power.state">"state"</link> D-Bus property.
17304 *
17305 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
17306 *
17307 * Returns: The property value.
17308 */
17309gint
17310control_power_get_state (ControlPower *object)
17311{
17312 return CONTROL_POWER_GET_IFACE (object)->get_state (object);
17313}
17314
17315/**
17316 * control_power_set_state: (skip)
17317 * @object: A #ControlPower.
17318 * @value: The value to set.
17319 *
17320 * Sets the <link linkend="gdbus-property-org-openbmc-control-Power.state">"state"</link> D-Bus property to @value.
17321 *
17322 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
17323 */
17324void
17325control_power_set_state (ControlPower *object, gint value)
17326{
17327 g_object_set (G_OBJECT (object), "state", value, NULL);
17328}
17329
17330/**
Norman James32e74e22015-09-15 21:28:06 -050017331 * control_power_get_pgood_timeout: (skip)
17332 * @object: A #ControlPower.
17333 *
17334 * Gets the value of the <link linkend="gdbus-property-org-openbmc-control-Power.pgood_timeout">"pgood_timeout"</link> D-Bus property.
17335 *
17336 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
17337 *
17338 * Returns: The property value.
17339 */
17340gint
17341control_power_get_pgood_timeout (ControlPower *object)
17342{
17343 return CONTROL_POWER_GET_IFACE (object)->get_pgood_timeout (object);
17344}
17345
17346/**
17347 * control_power_set_pgood_timeout: (skip)
17348 * @object: A #ControlPower.
17349 * @value: The value to set.
17350 *
17351 * Sets the <link linkend="gdbus-property-org-openbmc-control-Power.pgood_timeout">"pgood_timeout"</link> D-Bus property to @value.
17352 *
17353 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
17354 */
17355void
17356control_power_set_pgood_timeout (ControlPower *object, gint value)
17357{
17358 g_object_set (G_OBJECT (object), "pgood-timeout", value, NULL);
17359}
17360
17361/**
Norman James362a80f2015-09-14 14:04:39 -050017362 * control_power_emit_power_good:
17363 * @object: A #ControlPower.
17364 *
17365 * Emits the <link linkend="gdbus-signal-org-openbmc-control-Power.PowerGood">"PowerGood"</link> D-Bus signal.
17366 */
17367void
17368control_power_emit_power_good (
17369 ControlPower *object)
17370{
17371 g_signal_emit_by_name (object, "power-good");
17372}
17373
17374/**
17375 * control_power_emit_power_lost:
17376 * @object: A #ControlPower.
17377 *
17378 * Emits the <link linkend="gdbus-signal-org-openbmc-control-Power.PowerLost">"PowerLost"</link> D-Bus signal.
17379 */
17380void
17381control_power_emit_power_lost (
17382 ControlPower *object)
17383{
17384 g_signal_emit_by_name (object, "power-lost");
17385}
17386
17387/**
17388 * control_power_call_set_power_state:
17389 * @proxy: A #ControlPowerProxy.
17390 * @arg_state: Argument to pass with the method invocation.
17391 * @cancellable: (allow-none): A #GCancellable or %NULL.
17392 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
17393 * @user_data: User data to pass to @callback.
17394 *
17395 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Power.setPowerState">setPowerState()</link> D-Bus method on @proxy.
17396 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
17397 * You can then call control_power_call_set_power_state_finish() to get the result of the operation.
17398 *
17399 * See control_power_call_set_power_state_sync() for the synchronous, blocking version of this method.
17400 */
17401void
17402control_power_call_set_power_state (
17403 ControlPower *proxy,
17404 gint arg_state,
17405 GCancellable *cancellable,
17406 GAsyncReadyCallback callback,
17407 gpointer user_data)
17408{
17409 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
17410 "setPowerState",
17411 g_variant_new ("(i)",
17412 arg_state),
17413 G_DBUS_CALL_FLAGS_NONE,
17414 -1,
17415 cancellable,
17416 callback,
17417 user_data);
17418}
17419
17420/**
17421 * control_power_call_set_power_state_finish:
17422 * @proxy: A #ControlPowerProxy.
17423 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_call_set_power_state().
17424 * @error: Return location for error or %NULL.
17425 *
17426 * Finishes an operation started with control_power_call_set_power_state().
17427 *
17428 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
17429 */
17430gboolean
17431control_power_call_set_power_state_finish (
17432 ControlPower *proxy,
17433 GAsyncResult *res,
17434 GError **error)
17435{
17436 GVariant *_ret;
17437 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
17438 if (_ret == NULL)
17439 goto _out;
17440 g_variant_get (_ret,
17441 "()");
17442 g_variant_unref (_ret);
17443_out:
17444 return _ret != NULL;
17445}
17446
17447/**
17448 * control_power_call_set_power_state_sync:
17449 * @proxy: A #ControlPowerProxy.
17450 * @arg_state: Argument to pass with the method invocation.
17451 * @cancellable: (allow-none): A #GCancellable or %NULL.
17452 * @error: Return location for error or %NULL.
17453 *
17454 * 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.
17455 *
17456 * See control_power_call_set_power_state() for the asynchronous version of this method.
17457 *
17458 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
17459 */
17460gboolean
17461control_power_call_set_power_state_sync (
17462 ControlPower *proxy,
17463 gint arg_state,
17464 GCancellable *cancellable,
17465 GError **error)
17466{
17467 GVariant *_ret;
17468 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
17469 "setPowerState",
17470 g_variant_new ("(i)",
17471 arg_state),
17472 G_DBUS_CALL_FLAGS_NONE,
17473 -1,
17474 cancellable,
17475 error);
17476 if (_ret == NULL)
17477 goto _out;
17478 g_variant_get (_ret,
17479 "()");
17480 g_variant_unref (_ret);
17481_out:
17482 return _ret != NULL;
17483}
17484
17485/**
17486 * control_power_call_get_power_state:
17487 * @proxy: A #ControlPowerProxy.
17488 * @cancellable: (allow-none): A #GCancellable or %NULL.
17489 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
17490 * @user_data: User data to pass to @callback.
17491 *
17492 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Power.getPowerState">getPowerState()</link> D-Bus method on @proxy.
17493 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
17494 * You can then call control_power_call_get_power_state_finish() to get the result of the operation.
17495 *
17496 * See control_power_call_get_power_state_sync() for the synchronous, blocking version of this method.
17497 */
17498void
17499control_power_call_get_power_state (
17500 ControlPower *proxy,
17501 GCancellable *cancellable,
17502 GAsyncReadyCallback callback,
17503 gpointer user_data)
17504{
17505 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
17506 "getPowerState",
17507 g_variant_new ("()"),
17508 G_DBUS_CALL_FLAGS_NONE,
17509 -1,
17510 cancellable,
17511 callback,
17512 user_data);
17513}
17514
17515/**
17516 * control_power_call_get_power_state_finish:
17517 * @proxy: A #ControlPowerProxy.
17518 * @out_state: (out): Return location for return parameter or %NULL to ignore.
17519 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_call_get_power_state().
17520 * @error: Return location for error or %NULL.
17521 *
17522 * Finishes an operation started with control_power_call_get_power_state().
17523 *
17524 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
17525 */
17526gboolean
17527control_power_call_get_power_state_finish (
17528 ControlPower *proxy,
17529 gint *out_state,
17530 GAsyncResult *res,
17531 GError **error)
17532{
17533 GVariant *_ret;
17534 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
17535 if (_ret == NULL)
17536 goto _out;
17537 g_variant_get (_ret,
17538 "(i)",
17539 out_state);
17540 g_variant_unref (_ret);
17541_out:
17542 return _ret != NULL;
17543}
17544
17545/**
17546 * control_power_call_get_power_state_sync:
17547 * @proxy: A #ControlPowerProxy.
17548 * @out_state: (out): Return location for return parameter or %NULL to ignore.
17549 * @cancellable: (allow-none): A #GCancellable or %NULL.
17550 * @error: Return location for error or %NULL.
17551 *
17552 * 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.
17553 *
17554 * See control_power_call_get_power_state() for the asynchronous version of this method.
17555 *
17556 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
17557 */
17558gboolean
17559control_power_call_get_power_state_sync (
17560 ControlPower *proxy,
17561 gint *out_state,
17562 GCancellable *cancellable,
17563 GError **error)
17564{
17565 GVariant *_ret;
17566 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
17567 "getPowerState",
17568 g_variant_new ("()"),
17569 G_DBUS_CALL_FLAGS_NONE,
17570 -1,
17571 cancellable,
17572 error);
17573 if (_ret == NULL)
17574 goto _out;
17575 g_variant_get (_ret,
17576 "(i)",
17577 out_state);
17578 g_variant_unref (_ret);
17579_out:
17580 return _ret != NULL;
17581}
17582
17583/**
17584 * control_power_complete_set_power_state:
17585 * @object: A #ControlPower.
17586 * @invocation: (transfer full): A #GDBusMethodInvocation.
17587 *
17588 * 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.
17589 *
17590 * This method will free @invocation, you cannot use it afterwards.
17591 */
17592void
17593control_power_complete_set_power_state (
17594 ControlPower *object,
17595 GDBusMethodInvocation *invocation)
17596{
17597 g_dbus_method_invocation_return_value (invocation,
17598 g_variant_new ("()"));
17599}
17600
17601/**
17602 * control_power_complete_get_power_state:
17603 * @object: A #ControlPower.
17604 * @invocation: (transfer full): A #GDBusMethodInvocation.
17605 * @state: Parameter to return.
17606 *
17607 * 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.
17608 *
17609 * This method will free @invocation, you cannot use it afterwards.
17610 */
17611void
17612control_power_complete_get_power_state (
17613 ControlPower *object,
17614 GDBusMethodInvocation *invocation,
17615 gint state)
17616{
17617 g_dbus_method_invocation_return_value (invocation,
17618 g_variant_new ("(i)",
17619 state));
17620}
17621
17622/* ------------------------------------------------------------------------ */
17623
17624/**
17625 * ControlPowerProxy:
17626 *
17627 * The #ControlPowerProxy structure contains only private data and should only be accessed using the provided API.
17628 */
17629
17630/**
17631 * ControlPowerProxyClass:
17632 * @parent_class: The parent class.
17633 *
17634 * Class structure for #ControlPowerProxy.
17635 */
17636
17637struct _ControlPowerProxyPrivate
17638{
17639 GData *qdata;
17640};
17641
17642static void control_power_proxy_iface_init (ControlPowerIface *iface);
17643
17644#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
17645G_DEFINE_TYPE_WITH_CODE (ControlPowerProxy, control_power_proxy, G_TYPE_DBUS_PROXY,
17646 G_ADD_PRIVATE (ControlPowerProxy)
17647 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_proxy_iface_init));
17648
17649#else
17650G_DEFINE_TYPE_WITH_CODE (ControlPowerProxy, control_power_proxy, G_TYPE_DBUS_PROXY,
17651 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_proxy_iface_init));
17652
17653#endif
17654static void
17655control_power_proxy_finalize (GObject *object)
17656{
17657 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (object);
17658 g_datalist_clear (&proxy->priv->qdata);
17659 G_OBJECT_CLASS (control_power_proxy_parent_class)->finalize (object);
17660}
17661
17662static void
17663control_power_proxy_get_property (GObject *object,
17664 guint prop_id,
17665 GValue *value,
17666 GParamSpec *pspec G_GNUC_UNUSED)
17667{
17668 const _ExtendedGDBusPropertyInfo *info;
17669 GVariant *variant;
Norman James32e74e22015-09-15 21:28:06 -050017670 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -050017671 info = _control_power_property_info_pointers[prop_id - 1];
17672 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
17673 if (info->use_gvariant)
17674 {
17675 g_value_set_variant (value, variant);
17676 }
17677 else
17678 {
17679 if (variant != NULL)
17680 g_dbus_gvariant_to_gvalue (variant, value);
17681 }
17682 if (variant != NULL)
17683 g_variant_unref (variant);
17684}
17685
17686static void
17687control_power_proxy_set_property_cb (GDBusProxy *proxy,
17688 GAsyncResult *res,
17689 gpointer user_data)
17690{
17691 const _ExtendedGDBusPropertyInfo *info = user_data;
17692 GError *error;
17693 GVariant *_ret;
17694 error = NULL;
17695 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
17696 if (!_ret)
17697 {
17698 g_warning ("Error setting property '%s' on interface org.openbmc.control.Power: %s (%s, %d)",
17699 info->parent_struct.name,
17700 error->message, g_quark_to_string (error->domain), error->code);
17701 g_error_free (error);
17702 }
17703 else
17704 {
17705 g_variant_unref (_ret);
17706 }
17707}
17708
17709static void
17710control_power_proxy_set_property (GObject *object,
17711 guint prop_id,
17712 const GValue *value,
17713 GParamSpec *pspec G_GNUC_UNUSED)
17714{
17715 const _ExtendedGDBusPropertyInfo *info;
17716 GVariant *variant;
Norman James32e74e22015-09-15 21:28:06 -050017717 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -050017718 info = _control_power_property_info_pointers[prop_id - 1];
17719 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
17720 g_dbus_proxy_call (G_DBUS_PROXY (object),
17721 "org.freedesktop.DBus.Properties.Set",
17722 g_variant_new ("(ssv)", "org.openbmc.control.Power", info->parent_struct.name, variant),
17723 G_DBUS_CALL_FLAGS_NONE,
17724 -1,
17725 NULL, (GAsyncReadyCallback) control_power_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
17726 g_variant_unref (variant);
17727}
17728
17729static void
17730control_power_proxy_g_signal (GDBusProxy *proxy,
17731 const gchar *sender_name G_GNUC_UNUSED,
17732 const gchar *signal_name,
17733 GVariant *parameters)
17734{
17735 _ExtendedGDBusSignalInfo *info;
17736 GVariantIter iter;
17737 GVariant *child;
17738 GValue *paramv;
17739 guint num_params;
17740 guint n;
17741 guint signal_id;
17742 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, signal_name);
17743 if (info == NULL)
17744 return;
17745 num_params = g_variant_n_children (parameters);
17746 paramv = g_new0 (GValue, num_params + 1);
17747 g_value_init (&paramv[0], TYPE_CONTROL_POWER);
17748 g_value_set_object (&paramv[0], proxy);
17749 g_variant_iter_init (&iter, parameters);
17750 n = 1;
17751 while ((child = g_variant_iter_next_value (&iter)) != NULL)
17752 {
17753 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
17754 if (arg_info->use_gvariant)
17755 {
17756 g_value_init (&paramv[n], G_TYPE_VARIANT);
17757 g_value_set_variant (&paramv[n], child);
17758 n++;
17759 }
17760 else
17761 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
17762 g_variant_unref (child);
17763 }
17764 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_POWER);
17765 g_signal_emitv (paramv, signal_id, 0, NULL);
17766 for (n = 0; n < num_params + 1; n++)
17767 g_value_unset (&paramv[n]);
17768 g_free (paramv);
17769}
17770
17771static void
17772control_power_proxy_g_properties_changed (GDBusProxy *_proxy,
17773 GVariant *changed_properties,
17774 const gchar *const *invalidated_properties)
17775{
17776 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (_proxy);
17777 guint n;
17778 const gchar *key;
17779 GVariantIter *iter;
17780 _ExtendedGDBusPropertyInfo *info;
17781 g_variant_get (changed_properties, "a{sv}", &iter);
17782 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
17783 {
17784 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, key);
17785 g_datalist_remove_data (&proxy->priv->qdata, key);
17786 if (info != NULL)
17787 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
17788 }
17789 g_variant_iter_free (iter);
17790 for (n = 0; invalidated_properties[n] != NULL; n++)
17791 {
17792 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, invalidated_properties[n]);
17793 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
17794 if (info != NULL)
17795 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
17796 }
17797}
17798
17799static gint
17800control_power_proxy_get_pgood (ControlPower *object)
17801{
17802 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (object);
17803 GVariant *variant;
17804 gint value = 0;
17805 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "pgood");
17806 if (variant != NULL)
17807 {
17808 value = g_variant_get_int32 (variant);
17809 g_variant_unref (variant);
17810 }
17811 return value;
17812}
17813
17814static gint
17815control_power_proxy_get_state (ControlPower *object)
17816{
17817 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (object);
17818 GVariant *variant;
17819 gint value = 0;
17820 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state");
17821 if (variant != NULL)
17822 {
17823 value = g_variant_get_int32 (variant);
17824 g_variant_unref (variant);
17825 }
17826 return value;
17827}
17828
Norman James32e74e22015-09-15 21:28:06 -050017829static gint
17830control_power_proxy_get_pgood_timeout (ControlPower *object)
17831{
17832 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (object);
17833 GVariant *variant;
17834 gint value = 0;
17835 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "pgood_timeout");
17836 if (variant != NULL)
17837 {
17838 value = g_variant_get_int32 (variant);
17839 g_variant_unref (variant);
17840 }
17841 return value;
17842}
17843
Norman James362a80f2015-09-14 14:04:39 -050017844static void
17845control_power_proxy_init (ControlPowerProxy *proxy)
17846{
17847#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
17848 proxy->priv = control_power_proxy_get_instance_private (proxy);
17849#else
17850 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_POWER_PROXY, ControlPowerProxyPrivate);
17851#endif
17852
17853 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_power_interface_info ());
17854}
17855
17856static void
17857control_power_proxy_class_init (ControlPowerProxyClass *klass)
17858{
17859 GObjectClass *gobject_class;
17860 GDBusProxyClass *proxy_class;
17861
17862 gobject_class = G_OBJECT_CLASS (klass);
17863 gobject_class->finalize = control_power_proxy_finalize;
17864 gobject_class->get_property = control_power_proxy_get_property;
17865 gobject_class->set_property = control_power_proxy_set_property;
17866
17867 proxy_class = G_DBUS_PROXY_CLASS (klass);
17868 proxy_class->g_signal = control_power_proxy_g_signal;
17869 proxy_class->g_properties_changed = control_power_proxy_g_properties_changed;
17870
17871 control_power_override_properties (gobject_class, 1);
17872
17873#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
17874 g_type_class_add_private (klass, sizeof (ControlPowerProxyPrivate));
17875#endif
17876}
17877
17878static void
17879control_power_proxy_iface_init (ControlPowerIface *iface)
17880{
17881 iface->get_pgood = control_power_proxy_get_pgood;
17882 iface->get_state = control_power_proxy_get_state;
Norman James32e74e22015-09-15 21:28:06 -050017883 iface->get_pgood_timeout = control_power_proxy_get_pgood_timeout;
Norman James362a80f2015-09-14 14:04:39 -050017884}
17885
17886/**
17887 * control_power_proxy_new:
17888 * @connection: A #GDBusConnection.
17889 * @flags: Flags from the #GDBusProxyFlags enumeration.
17890 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
17891 * @object_path: An object path.
17892 * @cancellable: (allow-none): A #GCancellable or %NULL.
17893 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
17894 * @user_data: User data to pass to @callback.
17895 *
17896 * 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.
17897 *
17898 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
17899 * You can then call control_power_proxy_new_finish() to get the result of the operation.
17900 *
17901 * See control_power_proxy_new_sync() for the synchronous, blocking version of this constructor.
17902 */
17903void
17904control_power_proxy_new (
17905 GDBusConnection *connection,
17906 GDBusProxyFlags flags,
17907 const gchar *name,
17908 const gchar *object_path,
17909 GCancellable *cancellable,
17910 GAsyncReadyCallback callback,
17911 gpointer user_data)
17912{
17913 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);
17914}
17915
17916/**
17917 * control_power_proxy_new_finish:
17918 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_proxy_new().
17919 * @error: Return location for error or %NULL
17920 *
17921 * Finishes an operation started with control_power_proxy_new().
17922 *
17923 * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set.
17924 */
17925ControlPower *
17926control_power_proxy_new_finish (
17927 GAsyncResult *res,
17928 GError **error)
17929{
17930 GObject *ret;
17931 GObject *source_object;
17932 source_object = g_async_result_get_source_object (res);
17933 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
17934 g_object_unref (source_object);
17935 if (ret != NULL)
17936 return CONTROL_POWER (ret);
17937 else
17938 return NULL;
17939}
17940
17941/**
17942 * control_power_proxy_new_sync:
17943 * @connection: A #GDBusConnection.
17944 * @flags: Flags from the #GDBusProxyFlags enumeration.
17945 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
17946 * @object_path: An object path.
17947 * @cancellable: (allow-none): A #GCancellable or %NULL.
17948 * @error: Return location for error or %NULL
17949 *
17950 * 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.
17951 *
17952 * The calling thread is blocked until a reply is received.
17953 *
17954 * See control_power_proxy_new() for the asynchronous version of this constructor.
17955 *
17956 * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set.
17957 */
17958ControlPower *
17959control_power_proxy_new_sync (
17960 GDBusConnection *connection,
17961 GDBusProxyFlags flags,
17962 const gchar *name,
17963 const gchar *object_path,
17964 GCancellable *cancellable,
17965 GError **error)
17966{
17967 GInitable *ret;
17968 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);
17969 if (ret != NULL)
17970 return CONTROL_POWER (ret);
17971 else
17972 return NULL;
17973}
17974
17975
17976/**
17977 * control_power_proxy_new_for_bus:
17978 * @bus_type: A #GBusType.
17979 * @flags: Flags from the #GDBusProxyFlags enumeration.
17980 * @name: A bus name (well-known or unique).
17981 * @object_path: An object path.
17982 * @cancellable: (allow-none): A #GCancellable or %NULL.
17983 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
17984 * @user_data: User data to pass to @callback.
17985 *
17986 * Like control_power_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
17987 *
17988 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
17989 * You can then call control_power_proxy_new_for_bus_finish() to get the result of the operation.
17990 *
17991 * See control_power_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
17992 */
17993void
17994control_power_proxy_new_for_bus (
17995 GBusType bus_type,
17996 GDBusProxyFlags flags,
17997 const gchar *name,
17998 const gchar *object_path,
17999 GCancellable *cancellable,
18000 GAsyncReadyCallback callback,
18001 gpointer user_data)
18002{
18003 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);
18004}
18005
18006/**
18007 * control_power_proxy_new_for_bus_finish:
18008 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_proxy_new_for_bus().
18009 * @error: Return location for error or %NULL
18010 *
18011 * Finishes an operation started with control_power_proxy_new_for_bus().
18012 *
18013 * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set.
18014 */
18015ControlPower *
18016control_power_proxy_new_for_bus_finish (
18017 GAsyncResult *res,
18018 GError **error)
18019{
18020 GObject *ret;
18021 GObject *source_object;
18022 source_object = g_async_result_get_source_object (res);
18023 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
18024 g_object_unref (source_object);
18025 if (ret != NULL)
18026 return CONTROL_POWER (ret);
18027 else
18028 return NULL;
18029}
18030
18031/**
18032 * control_power_proxy_new_for_bus_sync:
18033 * @bus_type: A #GBusType.
18034 * @flags: Flags from the #GDBusProxyFlags enumeration.
18035 * @name: A bus name (well-known or unique).
18036 * @object_path: An object path.
18037 * @cancellable: (allow-none): A #GCancellable or %NULL.
18038 * @error: Return location for error or %NULL
18039 *
18040 * Like control_power_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
18041 *
18042 * The calling thread is blocked until a reply is received.
18043 *
18044 * See control_power_proxy_new_for_bus() for the asynchronous version of this constructor.
18045 *
18046 * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set.
18047 */
18048ControlPower *
18049control_power_proxy_new_for_bus_sync (
18050 GBusType bus_type,
18051 GDBusProxyFlags flags,
18052 const gchar *name,
18053 const gchar *object_path,
18054 GCancellable *cancellable,
18055 GError **error)
18056{
18057 GInitable *ret;
18058 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);
18059 if (ret != NULL)
18060 return CONTROL_POWER (ret);
18061 else
18062 return NULL;
18063}
18064
18065
18066/* ------------------------------------------------------------------------ */
18067
18068/**
18069 * ControlPowerSkeleton:
18070 *
18071 * The #ControlPowerSkeleton structure contains only private data and should only be accessed using the provided API.
18072 */
18073
18074/**
18075 * ControlPowerSkeletonClass:
18076 * @parent_class: The parent class.
18077 *
18078 * Class structure for #ControlPowerSkeleton.
18079 */
18080
18081struct _ControlPowerSkeletonPrivate
18082{
18083 GValue *properties;
18084 GList *changed_properties;
18085 GSource *changed_properties_idle_source;
18086 GMainContext *context;
18087 GMutex lock;
18088};
18089
18090static void
18091_control_power_skeleton_handle_method_call (
18092 GDBusConnection *connection G_GNUC_UNUSED,
18093 const gchar *sender G_GNUC_UNUSED,
18094 const gchar *object_path G_GNUC_UNUSED,
18095 const gchar *interface_name,
18096 const gchar *method_name,
18097 GVariant *parameters,
18098 GDBusMethodInvocation *invocation,
18099 gpointer user_data)
18100{
18101 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data);
18102 _ExtendedGDBusMethodInfo *info;
18103 GVariantIter iter;
18104 GVariant *child;
18105 GValue *paramv;
18106 guint num_params;
18107 guint num_extra;
18108 guint n;
18109 guint signal_id;
18110 GValue return_value = G_VALUE_INIT;
18111 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
18112 g_assert (info != NULL);
18113 num_params = g_variant_n_children (parameters);
18114 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
18115 n = 0;
18116 g_value_init (&paramv[n], TYPE_CONTROL_POWER);
18117 g_value_set_object (&paramv[n++], skeleton);
18118 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
18119 g_value_set_object (&paramv[n++], invocation);
18120 if (info->pass_fdlist)
18121 {
18122#ifdef G_OS_UNIX
18123 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
18124 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
18125#else
18126 g_assert_not_reached ();
18127#endif
18128 }
18129 g_variant_iter_init (&iter, parameters);
18130 while ((child = g_variant_iter_next_value (&iter)) != NULL)
18131 {
18132 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
18133 if (arg_info->use_gvariant)
18134 {
18135 g_value_init (&paramv[n], G_TYPE_VARIANT);
18136 g_value_set_variant (&paramv[n], child);
18137 n++;
18138 }
18139 else
18140 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
18141 g_variant_unref (child);
18142 }
18143 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_POWER);
18144 g_value_init (&return_value, G_TYPE_BOOLEAN);
18145 g_signal_emitv (paramv, signal_id, 0, &return_value);
18146 if (!g_value_get_boolean (&return_value))
18147 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);
18148 g_value_unset (&return_value);
18149 for (n = 0; n < num_params + num_extra; n++)
18150 g_value_unset (&paramv[n]);
18151 g_free (paramv);
18152}
18153
18154static GVariant *
18155_control_power_skeleton_handle_get_property (
18156 GDBusConnection *connection G_GNUC_UNUSED,
18157 const gchar *sender G_GNUC_UNUSED,
18158 const gchar *object_path G_GNUC_UNUSED,
18159 const gchar *interface_name G_GNUC_UNUSED,
18160 const gchar *property_name,
18161 GError **error,
18162 gpointer user_data)
18163{
18164 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data);
18165 GValue value = G_VALUE_INIT;
18166 GParamSpec *pspec;
18167 _ExtendedGDBusPropertyInfo *info;
18168 GVariant *ret;
18169 ret = NULL;
18170 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, property_name);
18171 g_assert (info != NULL);
18172 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
18173 if (pspec == NULL)
18174 {
18175 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
18176 }
18177 else
18178 {
18179 g_value_init (&value, pspec->value_type);
18180 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
18181 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
18182 g_value_unset (&value);
18183 }
18184 return ret;
18185}
18186
18187static gboolean
18188_control_power_skeleton_handle_set_property (
18189 GDBusConnection *connection G_GNUC_UNUSED,
18190 const gchar *sender G_GNUC_UNUSED,
18191 const gchar *object_path G_GNUC_UNUSED,
18192 const gchar *interface_name G_GNUC_UNUSED,
18193 const gchar *property_name,
18194 GVariant *variant,
18195 GError **error,
18196 gpointer user_data)
18197{
18198 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data);
18199 GValue value = G_VALUE_INIT;
18200 GParamSpec *pspec;
18201 _ExtendedGDBusPropertyInfo *info;
18202 gboolean ret;
18203 ret = FALSE;
18204 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, property_name);
18205 g_assert (info != NULL);
18206 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
18207 if (pspec == NULL)
18208 {
18209 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
18210 }
18211 else
18212 {
18213 if (info->use_gvariant)
18214 g_value_set_variant (&value, variant);
18215 else
18216 g_dbus_gvariant_to_gvalue (variant, &value);
18217 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
18218 g_value_unset (&value);
18219 ret = TRUE;
18220 }
18221 return ret;
18222}
18223
18224static const GDBusInterfaceVTable _control_power_skeleton_vtable =
18225{
18226 _control_power_skeleton_handle_method_call,
18227 _control_power_skeleton_handle_get_property,
18228 _control_power_skeleton_handle_set_property,
18229 {NULL}
18230};
18231
18232static GDBusInterfaceInfo *
18233control_power_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
18234{
18235 return control_power_interface_info ();
18236}
18237
18238static GDBusInterfaceVTable *
18239control_power_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
18240{
18241 return (GDBusInterfaceVTable *) &_control_power_skeleton_vtable;
18242}
18243
18244static GVariant *
18245control_power_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
18246{
18247 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (_skeleton);
18248
18249 GVariantBuilder builder;
18250 guint n;
18251 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
18252 if (_control_power_interface_info.parent_struct.properties == NULL)
18253 goto out;
18254 for (n = 0; _control_power_interface_info.parent_struct.properties[n] != NULL; n++)
18255 {
18256 GDBusPropertyInfo *info = _control_power_interface_info.parent_struct.properties[n];
18257 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
18258 {
18259 GVariant *value;
18260 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);
18261 if (value != NULL)
18262 {
18263 g_variant_take_ref (value);
18264 g_variant_builder_add (&builder, "{sv}", info->name, value);
18265 g_variant_unref (value);
18266 }
18267 }
18268 }
18269out:
18270 return g_variant_builder_end (&builder);
18271}
18272
18273static gboolean _control_power_emit_changed (gpointer user_data);
18274
18275static void
18276control_power_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
18277{
18278 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (_skeleton);
18279 gboolean emit_changed = FALSE;
18280
18281 g_mutex_lock (&skeleton->priv->lock);
18282 if (skeleton->priv->changed_properties_idle_source != NULL)
18283 {
18284 g_source_destroy (skeleton->priv->changed_properties_idle_source);
18285 skeleton->priv->changed_properties_idle_source = NULL;
18286 emit_changed = TRUE;
18287 }
18288 g_mutex_unlock (&skeleton->priv->lock);
18289
18290 if (emit_changed)
18291 _control_power_emit_changed (skeleton);
18292}
18293
18294static void
18295_control_power_on_signal_power_good (
18296 ControlPower *object)
18297{
18298 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
18299
18300 GList *connections, *l;
18301 GVariant *signal_variant;
18302 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
18303
18304 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
18305 for (l = connections; l != NULL; l = l->next)
18306 {
18307 GDBusConnection *connection = l->data;
18308 g_dbus_connection_emit_signal (connection,
18309 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.control.Power", "PowerGood",
18310 signal_variant, NULL);
18311 }
18312 g_variant_unref (signal_variant);
18313 g_list_free_full (connections, g_object_unref);
18314}
18315
18316static void
18317_control_power_on_signal_power_lost (
18318 ControlPower *object)
18319{
18320 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
18321
18322 GList *connections, *l;
18323 GVariant *signal_variant;
18324 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
18325
18326 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
18327 for (l = connections; l != NULL; l = l->next)
18328 {
18329 GDBusConnection *connection = l->data;
18330 g_dbus_connection_emit_signal (connection,
18331 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.control.Power", "PowerLost",
18332 signal_variant, NULL);
18333 }
18334 g_variant_unref (signal_variant);
18335 g_list_free_full (connections, g_object_unref);
18336}
18337
18338static void control_power_skeleton_iface_init (ControlPowerIface *iface);
18339#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
18340G_DEFINE_TYPE_WITH_CODE (ControlPowerSkeleton, control_power_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
18341 G_ADD_PRIVATE (ControlPowerSkeleton)
18342 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_skeleton_iface_init));
18343
18344#else
18345G_DEFINE_TYPE_WITH_CODE (ControlPowerSkeleton, control_power_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
18346 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_skeleton_iface_init));
18347
18348#endif
18349static void
18350control_power_skeleton_finalize (GObject *object)
18351{
18352 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
18353 guint n;
Norman James32e74e22015-09-15 21:28:06 -050018354 for (n = 0; n < 3; n++)
Norman James362a80f2015-09-14 14:04:39 -050018355 g_value_unset (&skeleton->priv->properties[n]);
18356 g_free (skeleton->priv->properties);
18357 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
18358 if (skeleton->priv->changed_properties_idle_source != NULL)
18359 g_source_destroy (skeleton->priv->changed_properties_idle_source);
18360 g_main_context_unref (skeleton->priv->context);
18361 g_mutex_clear (&skeleton->priv->lock);
18362 G_OBJECT_CLASS (control_power_skeleton_parent_class)->finalize (object);
18363}
18364
18365static void
18366control_power_skeleton_get_property (GObject *object,
18367 guint prop_id,
18368 GValue *value,
18369 GParamSpec *pspec G_GNUC_UNUSED)
18370{
18371 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
Norman James32e74e22015-09-15 21:28:06 -050018372 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -050018373 g_mutex_lock (&skeleton->priv->lock);
18374 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
18375 g_mutex_unlock (&skeleton->priv->lock);
18376}
18377
18378static gboolean
18379_control_power_emit_changed (gpointer user_data)
18380{
18381 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data);
18382 GList *l;
18383 GVariantBuilder builder;
18384 GVariantBuilder invalidated_builder;
18385 guint num_changes;
18386
18387 g_mutex_lock (&skeleton->priv->lock);
18388 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
18389 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
18390 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
18391 {
18392 ChangedProperty *cp = l->data;
18393 GVariant *variant;
18394 const GValue *cur_value;
18395
18396 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
18397 if (!_g_value_equal (cur_value, &cp->orig_value))
18398 {
18399 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
18400 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
18401 g_variant_unref (variant);
18402 num_changes++;
18403 }
18404 }
18405 if (num_changes > 0)
18406 {
18407 GList *connections, *ll;
18408 GVariant *signal_variant;
18409 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.control.Power",
18410 &builder, &invalidated_builder));
18411 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
18412 for (ll = connections; ll != NULL; ll = ll->next)
18413 {
18414 GDBusConnection *connection = ll->data;
18415
18416 g_dbus_connection_emit_signal (connection,
18417 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
18418 "org.freedesktop.DBus.Properties",
18419 "PropertiesChanged",
18420 signal_variant,
18421 NULL);
18422 }
18423 g_variant_unref (signal_variant);
18424 g_list_free_full (connections, g_object_unref);
18425 }
18426 else
18427 {
18428 g_variant_builder_clear (&builder);
18429 g_variant_builder_clear (&invalidated_builder);
18430 }
18431 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
18432 skeleton->priv->changed_properties = NULL;
18433 skeleton->priv->changed_properties_idle_source = NULL;
18434 g_mutex_unlock (&skeleton->priv->lock);
18435 return FALSE;
18436}
18437
18438static void
18439_control_power_schedule_emit_changed (ControlPowerSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
18440{
18441 ChangedProperty *cp;
18442 GList *l;
18443 cp = NULL;
18444 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
18445 {
18446 ChangedProperty *i_cp = l->data;
18447 if (i_cp->info == info)
18448 {
18449 cp = i_cp;
18450 break;
18451 }
18452 }
18453 if (cp == NULL)
18454 {
18455 cp = g_new0 (ChangedProperty, 1);
18456 cp->prop_id = prop_id;
18457 cp->info = info;
18458 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
18459 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
18460 g_value_copy (orig_value, &cp->orig_value);
18461 }
18462}
18463
18464static void
18465control_power_skeleton_notify (GObject *object,
18466 GParamSpec *pspec G_GNUC_UNUSED)
18467{
18468 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
18469 g_mutex_lock (&skeleton->priv->lock);
18470 if (skeleton->priv->changed_properties != NULL &&
18471 skeleton->priv->changed_properties_idle_source == NULL)
18472 {
18473 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
18474 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
18475 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _control_power_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
Adriana Kobylakfd778822016-06-16 09:08:37 -050018476 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _control_power_emit_changed");
Norman James362a80f2015-09-14 14:04:39 -050018477 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
18478 g_source_unref (skeleton->priv->changed_properties_idle_source);
18479 }
18480 g_mutex_unlock (&skeleton->priv->lock);
18481}
18482
18483static void
18484control_power_skeleton_set_property (GObject *object,
18485 guint prop_id,
18486 const GValue *value,
18487 GParamSpec *pspec)
18488{
18489 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
Norman James32e74e22015-09-15 21:28:06 -050018490 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -050018491 g_mutex_lock (&skeleton->priv->lock);
18492 g_object_freeze_notify (object);
18493 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
18494 {
18495 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
18496 _control_power_schedule_emit_changed (skeleton, _control_power_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
18497 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
18498 g_object_notify_by_pspec (object, pspec);
18499 }
18500 g_mutex_unlock (&skeleton->priv->lock);
18501 g_object_thaw_notify (object);
18502}
18503
18504static void
18505control_power_skeleton_init (ControlPowerSkeleton *skeleton)
18506{
18507#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
18508 skeleton->priv = control_power_skeleton_get_instance_private (skeleton);
18509#else
18510 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_POWER_SKELETON, ControlPowerSkeletonPrivate);
18511#endif
18512
18513 g_mutex_init (&skeleton->priv->lock);
18514 skeleton->priv->context = g_main_context_ref_thread_default ();
Norman James32e74e22015-09-15 21:28:06 -050018515 skeleton->priv->properties = g_new0 (GValue, 3);
Norman James362a80f2015-09-14 14:04:39 -050018516 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
18517 g_value_init (&skeleton->priv->properties[1], G_TYPE_INT);
Norman James32e74e22015-09-15 21:28:06 -050018518 g_value_init (&skeleton->priv->properties[2], G_TYPE_INT);
Norman James362a80f2015-09-14 14:04:39 -050018519}
18520
18521static gint
18522control_power_skeleton_get_pgood (ControlPower *object)
18523{
18524 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
18525 gint value;
18526 g_mutex_lock (&skeleton->priv->lock);
18527 value = g_value_get_int (&(skeleton->priv->properties[0]));
18528 g_mutex_unlock (&skeleton->priv->lock);
18529 return value;
18530}
18531
18532static gint
18533control_power_skeleton_get_state (ControlPower *object)
18534{
18535 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
18536 gint value;
18537 g_mutex_lock (&skeleton->priv->lock);
18538 value = g_value_get_int (&(skeleton->priv->properties[1]));
18539 g_mutex_unlock (&skeleton->priv->lock);
18540 return value;
18541}
18542
Norman James32e74e22015-09-15 21:28:06 -050018543static gint
18544control_power_skeleton_get_pgood_timeout (ControlPower *object)
18545{
18546 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
18547 gint value;
18548 g_mutex_lock (&skeleton->priv->lock);
18549 value = g_value_get_int (&(skeleton->priv->properties[2]));
18550 g_mutex_unlock (&skeleton->priv->lock);
18551 return value;
18552}
18553
Norman James362a80f2015-09-14 14:04:39 -050018554static void
18555control_power_skeleton_class_init (ControlPowerSkeletonClass *klass)
18556{
18557 GObjectClass *gobject_class;
18558 GDBusInterfaceSkeletonClass *skeleton_class;
18559
18560 gobject_class = G_OBJECT_CLASS (klass);
18561 gobject_class->finalize = control_power_skeleton_finalize;
18562 gobject_class->get_property = control_power_skeleton_get_property;
18563 gobject_class->set_property = control_power_skeleton_set_property;
18564 gobject_class->notify = control_power_skeleton_notify;
18565
18566
18567 control_power_override_properties (gobject_class, 1);
18568
18569 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
18570 skeleton_class->get_info = control_power_skeleton_dbus_interface_get_info;
18571 skeleton_class->get_properties = control_power_skeleton_dbus_interface_get_properties;
18572 skeleton_class->flush = control_power_skeleton_dbus_interface_flush;
18573 skeleton_class->get_vtable = control_power_skeleton_dbus_interface_get_vtable;
18574
18575#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
18576 g_type_class_add_private (klass, sizeof (ControlPowerSkeletonPrivate));
18577#endif
18578}
18579
18580static void
18581control_power_skeleton_iface_init (ControlPowerIface *iface)
18582{
18583 iface->power_good = _control_power_on_signal_power_good;
18584 iface->power_lost = _control_power_on_signal_power_lost;
18585 iface->get_pgood = control_power_skeleton_get_pgood;
18586 iface->get_state = control_power_skeleton_get_state;
Norman James32e74e22015-09-15 21:28:06 -050018587 iface->get_pgood_timeout = control_power_skeleton_get_pgood_timeout;
Norman James362a80f2015-09-14 14:04:39 -050018588}
18589
18590/**
18591 * control_power_skeleton_new:
18592 *
18593 * 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>.
18594 *
18595 * Returns: (transfer full) (type ControlPowerSkeleton): The skeleton object.
18596 */
18597ControlPower *
18598control_power_skeleton_new (void)
18599{
18600 return CONTROL_POWER (g_object_new (TYPE_CONTROL_POWER_SKELETON, NULL));
18601}
18602
18603/* ------------------------------------------------------------------------
Adriana Kobylakfd778822016-06-16 09:08:37 -050018604 * Code for interface org.openbmc.control.Checkstop
18605 * ------------------------------------------------------------------------
18606 */
18607
18608/**
18609 * SECTION:ControlCheckstop
18610 * @title: ControlCheckstop
18611 * @short_description: Generated C code for the org.openbmc.control.Checkstop D-Bus interface
18612 *
18613 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-control-Checkstop.top_of_page">org.openbmc.control.Checkstop</link> D-Bus interface in C.
18614 */
18615
18616/* ---- Introspection data for org.openbmc.control.Checkstop ---- */
18617
18618static const _ExtendedGDBusInterfaceInfo _control_checkstop_interface_info =
18619{
18620 {
18621 -1,
18622 (gchar *) "org.openbmc.control.Checkstop",
18623 NULL,
18624 NULL,
18625 NULL,
18626 NULL
18627 },
18628 "control-checkstop",
18629};
18630
18631
18632/**
18633 * control_checkstop_interface_info:
18634 *
18635 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-control-Checkstop.top_of_page">org.openbmc.control.Checkstop</link> D-Bus interface.
18636 *
18637 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
18638 */
18639GDBusInterfaceInfo *
18640control_checkstop_interface_info (void)
18641{
18642 return (GDBusInterfaceInfo *) &_control_checkstop_interface_info.parent_struct;
18643}
18644
18645/**
18646 * control_checkstop_override_properties:
18647 * @klass: The class structure for a #GObject<!-- -->-derived class.
18648 * @property_id_begin: The property id to assign to the first overridden property.
18649 *
18650 * Overrides all #GObject properties in the #ControlCheckstop interface for a concrete class.
18651 * The properties are overridden in the order they are defined.
18652 *
18653 * Returns: The last property id.
18654 */
18655guint
18656control_checkstop_override_properties (GObjectClass *klass, guint property_id_begin)
18657{
18658 return property_id_begin - 1;
18659}
18660
18661
18662
18663/**
18664 * ControlCheckstop:
18665 *
18666 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Checkstop.top_of_page">org.openbmc.control.Checkstop</link>.
18667 */
18668
18669/**
18670 * ControlCheckstopIface:
18671 * @parent_iface: The parent interface.
18672 *
18673 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Checkstop.top_of_page">org.openbmc.control.Checkstop</link>.
18674 */
18675
18676typedef ControlCheckstopIface ControlCheckstopInterface;
18677G_DEFINE_INTERFACE (ControlCheckstop, control_checkstop, G_TYPE_OBJECT);
18678
18679static void
18680control_checkstop_default_init (ControlCheckstopIface *iface)
18681{
18682}
18683
18684/* ------------------------------------------------------------------------ */
18685
18686/**
18687 * ControlCheckstopProxy:
18688 *
18689 * The #ControlCheckstopProxy structure contains only private data and should only be accessed using the provided API.
18690 */
18691
18692/**
18693 * ControlCheckstopProxyClass:
18694 * @parent_class: The parent class.
18695 *
18696 * Class structure for #ControlCheckstopProxy.
18697 */
18698
18699struct _ControlCheckstopProxyPrivate
18700{
18701 GData *qdata;
18702};
18703
18704static void control_checkstop_proxy_iface_init (ControlCheckstopIface *iface);
18705
18706#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
18707G_DEFINE_TYPE_WITH_CODE (ControlCheckstopProxy, control_checkstop_proxy, G_TYPE_DBUS_PROXY,
18708 G_ADD_PRIVATE (ControlCheckstopProxy)
18709 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_CHECKSTOP, control_checkstop_proxy_iface_init));
18710
18711#else
18712G_DEFINE_TYPE_WITH_CODE (ControlCheckstopProxy, control_checkstop_proxy, G_TYPE_DBUS_PROXY,
18713 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_CHECKSTOP, control_checkstop_proxy_iface_init));
18714
18715#endif
18716static void
18717control_checkstop_proxy_finalize (GObject *object)
18718{
18719 ControlCheckstopProxy *proxy = CONTROL_CHECKSTOP_PROXY (object);
18720 g_datalist_clear (&proxy->priv->qdata);
18721 G_OBJECT_CLASS (control_checkstop_proxy_parent_class)->finalize (object);
18722}
18723
18724static void
18725control_checkstop_proxy_get_property (GObject *object,
18726 guint prop_id,
18727 GValue *value,
18728 GParamSpec *pspec G_GNUC_UNUSED)
18729{
18730}
18731
18732static void
18733control_checkstop_proxy_set_property (GObject *object,
18734 guint prop_id,
18735 const GValue *value,
18736 GParamSpec *pspec G_GNUC_UNUSED)
18737{
18738}
18739
18740static void
18741control_checkstop_proxy_g_signal (GDBusProxy *proxy,
18742 const gchar *sender_name G_GNUC_UNUSED,
18743 const gchar *signal_name,
18744 GVariant *parameters)
18745{
18746 _ExtendedGDBusSignalInfo *info;
18747 GVariantIter iter;
18748 GVariant *child;
18749 GValue *paramv;
18750 guint num_params;
18751 guint n;
18752 guint signal_id;
18753 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_checkstop_interface_info.parent_struct, signal_name);
18754 if (info == NULL)
18755 return;
18756 num_params = g_variant_n_children (parameters);
18757 paramv = g_new0 (GValue, num_params + 1);
18758 g_value_init (&paramv[0], TYPE_CONTROL_CHECKSTOP);
18759 g_value_set_object (&paramv[0], proxy);
18760 g_variant_iter_init (&iter, parameters);
18761 n = 1;
18762 while ((child = g_variant_iter_next_value (&iter)) != NULL)
18763 {
18764 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
18765 if (arg_info->use_gvariant)
18766 {
18767 g_value_init (&paramv[n], G_TYPE_VARIANT);
18768 g_value_set_variant (&paramv[n], child);
18769 n++;
18770 }
18771 else
18772 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
18773 g_variant_unref (child);
18774 }
18775 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_CHECKSTOP);
18776 g_signal_emitv (paramv, signal_id, 0, NULL);
18777 for (n = 0; n < num_params + 1; n++)
18778 g_value_unset (&paramv[n]);
18779 g_free (paramv);
18780}
18781
18782static void
18783control_checkstop_proxy_g_properties_changed (GDBusProxy *_proxy,
18784 GVariant *changed_properties,
18785 const gchar *const *invalidated_properties)
18786{
18787 ControlCheckstopProxy *proxy = CONTROL_CHECKSTOP_PROXY (_proxy);
18788 guint n;
18789 const gchar *key;
18790 GVariantIter *iter;
18791 _ExtendedGDBusPropertyInfo *info;
18792 g_variant_get (changed_properties, "a{sv}", &iter);
18793 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
18794 {
18795 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_checkstop_interface_info.parent_struct, key);
18796 g_datalist_remove_data (&proxy->priv->qdata, key);
18797 if (info != NULL)
18798 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
18799 }
18800 g_variant_iter_free (iter);
18801 for (n = 0; invalidated_properties[n] != NULL; n++)
18802 {
18803 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_checkstop_interface_info.parent_struct, invalidated_properties[n]);
18804 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
18805 if (info != NULL)
18806 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
18807 }
18808}
18809
18810static void
18811control_checkstop_proxy_init (ControlCheckstopProxy *proxy)
18812{
18813#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
18814 proxy->priv = control_checkstop_proxy_get_instance_private (proxy);
18815#else
18816 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_CHECKSTOP_PROXY, ControlCheckstopProxyPrivate);
18817#endif
18818
18819 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_checkstop_interface_info ());
18820}
18821
18822static void
18823control_checkstop_proxy_class_init (ControlCheckstopProxyClass *klass)
18824{
18825 GObjectClass *gobject_class;
18826 GDBusProxyClass *proxy_class;
18827
18828 gobject_class = G_OBJECT_CLASS (klass);
18829 gobject_class->finalize = control_checkstop_proxy_finalize;
18830 gobject_class->get_property = control_checkstop_proxy_get_property;
18831 gobject_class->set_property = control_checkstop_proxy_set_property;
18832
18833 proxy_class = G_DBUS_PROXY_CLASS (klass);
18834 proxy_class->g_signal = control_checkstop_proxy_g_signal;
18835 proxy_class->g_properties_changed = control_checkstop_proxy_g_properties_changed;
18836
18837#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
18838 g_type_class_add_private (klass, sizeof (ControlCheckstopProxyPrivate));
18839#endif
18840}
18841
18842static void
18843control_checkstop_proxy_iface_init (ControlCheckstopIface *iface)
18844{
18845}
18846
18847/**
18848 * control_checkstop_proxy_new:
18849 * @connection: A #GDBusConnection.
18850 * @flags: Flags from the #GDBusProxyFlags enumeration.
18851 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
18852 * @object_path: An object path.
18853 * @cancellable: (allow-none): A #GCancellable or %NULL.
18854 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
18855 * @user_data: User data to pass to @callback.
18856 *
18857 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Checkstop.top_of_page">org.openbmc.control.Checkstop</link>. See g_dbus_proxy_new() for more details.
18858 *
18859 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
18860 * You can then call control_checkstop_proxy_new_finish() to get the result of the operation.
18861 *
18862 * See control_checkstop_proxy_new_sync() for the synchronous, blocking version of this constructor.
18863 */
18864void
18865control_checkstop_proxy_new (
18866 GDBusConnection *connection,
18867 GDBusProxyFlags flags,
18868 const gchar *name,
18869 const gchar *object_path,
18870 GCancellable *cancellable,
18871 GAsyncReadyCallback callback,
18872 gpointer user_data)
18873{
18874 g_async_initable_new_async (TYPE_CONTROL_CHECKSTOP_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.control.Checkstop", NULL);
18875}
18876
18877/**
18878 * control_checkstop_proxy_new_finish:
18879 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_checkstop_proxy_new().
18880 * @error: Return location for error or %NULL
18881 *
18882 * Finishes an operation started with control_checkstop_proxy_new().
18883 *
18884 * Returns: (transfer full) (type ControlCheckstopProxy): The constructed proxy object or %NULL if @error is set.
18885 */
18886ControlCheckstop *
18887control_checkstop_proxy_new_finish (
18888 GAsyncResult *res,
18889 GError **error)
18890{
18891 GObject *ret;
18892 GObject *source_object;
18893 source_object = g_async_result_get_source_object (res);
18894 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
18895 g_object_unref (source_object);
18896 if (ret != NULL)
18897 return CONTROL_CHECKSTOP (ret);
18898 else
18899 return NULL;
18900}
18901
18902/**
18903 * control_checkstop_proxy_new_sync:
18904 * @connection: A #GDBusConnection.
18905 * @flags: Flags from the #GDBusProxyFlags enumeration.
18906 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
18907 * @object_path: An object path.
18908 * @cancellable: (allow-none): A #GCancellable or %NULL.
18909 * @error: Return location for error or %NULL
18910 *
18911 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Checkstop.top_of_page">org.openbmc.control.Checkstop</link>. See g_dbus_proxy_new_sync() for more details.
18912 *
18913 * The calling thread is blocked until a reply is received.
18914 *
18915 * See control_checkstop_proxy_new() for the asynchronous version of this constructor.
18916 *
18917 * Returns: (transfer full) (type ControlCheckstopProxy): The constructed proxy object or %NULL if @error is set.
18918 */
18919ControlCheckstop *
18920control_checkstop_proxy_new_sync (
18921 GDBusConnection *connection,
18922 GDBusProxyFlags flags,
18923 const gchar *name,
18924 const gchar *object_path,
18925 GCancellable *cancellable,
18926 GError **error)
18927{
18928 GInitable *ret;
18929 ret = g_initable_new (TYPE_CONTROL_CHECKSTOP_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.control.Checkstop", NULL);
18930 if (ret != NULL)
18931 return CONTROL_CHECKSTOP (ret);
18932 else
18933 return NULL;
18934}
18935
18936
18937/**
18938 * control_checkstop_proxy_new_for_bus:
18939 * @bus_type: A #GBusType.
18940 * @flags: Flags from the #GDBusProxyFlags enumeration.
18941 * @name: A bus name (well-known or unique).
18942 * @object_path: An object path.
18943 * @cancellable: (allow-none): A #GCancellable or %NULL.
18944 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
18945 * @user_data: User data to pass to @callback.
18946 *
18947 * Like control_checkstop_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
18948 *
18949 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
18950 * You can then call control_checkstop_proxy_new_for_bus_finish() to get the result of the operation.
18951 *
18952 * See control_checkstop_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
18953 */
18954void
18955control_checkstop_proxy_new_for_bus (
18956 GBusType bus_type,
18957 GDBusProxyFlags flags,
18958 const gchar *name,
18959 const gchar *object_path,
18960 GCancellable *cancellable,
18961 GAsyncReadyCallback callback,
18962 gpointer user_data)
18963{
18964 g_async_initable_new_async (TYPE_CONTROL_CHECKSTOP_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.control.Checkstop", NULL);
18965}
18966
18967/**
18968 * control_checkstop_proxy_new_for_bus_finish:
18969 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_checkstop_proxy_new_for_bus().
18970 * @error: Return location for error or %NULL
18971 *
18972 * Finishes an operation started with control_checkstop_proxy_new_for_bus().
18973 *
18974 * Returns: (transfer full) (type ControlCheckstopProxy): The constructed proxy object or %NULL if @error is set.
18975 */
18976ControlCheckstop *
18977control_checkstop_proxy_new_for_bus_finish (
18978 GAsyncResult *res,
18979 GError **error)
18980{
18981 GObject *ret;
18982 GObject *source_object;
18983 source_object = g_async_result_get_source_object (res);
18984 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
18985 g_object_unref (source_object);
18986 if (ret != NULL)
18987 return CONTROL_CHECKSTOP (ret);
18988 else
18989 return NULL;
18990}
18991
18992/**
18993 * control_checkstop_proxy_new_for_bus_sync:
18994 * @bus_type: A #GBusType.
18995 * @flags: Flags from the #GDBusProxyFlags enumeration.
18996 * @name: A bus name (well-known or unique).
18997 * @object_path: An object path.
18998 * @cancellable: (allow-none): A #GCancellable or %NULL.
18999 * @error: Return location for error or %NULL
19000 *
19001 * Like control_checkstop_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
19002 *
19003 * The calling thread is blocked until a reply is received.
19004 *
19005 * See control_checkstop_proxy_new_for_bus() for the asynchronous version of this constructor.
19006 *
19007 * Returns: (transfer full) (type ControlCheckstopProxy): The constructed proxy object or %NULL if @error is set.
19008 */
19009ControlCheckstop *
19010control_checkstop_proxy_new_for_bus_sync (
19011 GBusType bus_type,
19012 GDBusProxyFlags flags,
19013 const gchar *name,
19014 const gchar *object_path,
19015 GCancellable *cancellable,
19016 GError **error)
19017{
19018 GInitable *ret;
19019 ret = g_initable_new (TYPE_CONTROL_CHECKSTOP_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.control.Checkstop", NULL);
19020 if (ret != NULL)
19021 return CONTROL_CHECKSTOP (ret);
19022 else
19023 return NULL;
19024}
19025
19026
19027/* ------------------------------------------------------------------------ */
19028
19029/**
19030 * ControlCheckstopSkeleton:
19031 *
19032 * The #ControlCheckstopSkeleton structure contains only private data and should only be accessed using the provided API.
19033 */
19034
19035/**
19036 * ControlCheckstopSkeletonClass:
19037 * @parent_class: The parent class.
19038 *
19039 * Class structure for #ControlCheckstopSkeleton.
19040 */
19041
19042struct _ControlCheckstopSkeletonPrivate
19043{
19044 GValue *properties;
19045 GList *changed_properties;
19046 GSource *changed_properties_idle_source;
19047 GMainContext *context;
19048 GMutex lock;
19049};
19050
19051static void
19052_control_checkstop_skeleton_handle_method_call (
19053 GDBusConnection *connection G_GNUC_UNUSED,
19054 const gchar *sender G_GNUC_UNUSED,
19055 const gchar *object_path G_GNUC_UNUSED,
19056 const gchar *interface_name,
19057 const gchar *method_name,
19058 GVariant *parameters,
19059 GDBusMethodInvocation *invocation,
19060 gpointer user_data)
19061{
19062 ControlCheckstopSkeleton *skeleton = CONTROL_CHECKSTOP_SKELETON (user_data);
19063 _ExtendedGDBusMethodInfo *info;
19064 GVariantIter iter;
19065 GVariant *child;
19066 GValue *paramv;
19067 guint num_params;
19068 guint num_extra;
19069 guint n;
19070 guint signal_id;
19071 GValue return_value = G_VALUE_INIT;
19072 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
19073 g_assert (info != NULL);
19074 num_params = g_variant_n_children (parameters);
19075 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
19076 n = 0;
19077 g_value_init (&paramv[n], TYPE_CONTROL_CHECKSTOP);
19078 g_value_set_object (&paramv[n++], skeleton);
19079 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
19080 g_value_set_object (&paramv[n++], invocation);
19081 if (info->pass_fdlist)
19082 {
19083#ifdef G_OS_UNIX
19084 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
19085 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
19086#else
19087 g_assert_not_reached ();
19088#endif
19089 }
19090 g_variant_iter_init (&iter, parameters);
19091 while ((child = g_variant_iter_next_value (&iter)) != NULL)
19092 {
19093 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
19094 if (arg_info->use_gvariant)
19095 {
19096 g_value_init (&paramv[n], G_TYPE_VARIANT);
19097 g_value_set_variant (&paramv[n], child);
19098 n++;
19099 }
19100 else
19101 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
19102 g_variant_unref (child);
19103 }
19104 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_CHECKSTOP);
19105 g_value_init (&return_value, G_TYPE_BOOLEAN);
19106 g_signal_emitv (paramv, signal_id, 0, &return_value);
19107 if (!g_value_get_boolean (&return_value))
19108 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);
19109 g_value_unset (&return_value);
19110 for (n = 0; n < num_params + num_extra; n++)
19111 g_value_unset (&paramv[n]);
19112 g_free (paramv);
19113}
19114
19115static GVariant *
19116_control_checkstop_skeleton_handle_get_property (
19117 GDBusConnection *connection G_GNUC_UNUSED,
19118 const gchar *sender G_GNUC_UNUSED,
19119 const gchar *object_path G_GNUC_UNUSED,
19120 const gchar *interface_name G_GNUC_UNUSED,
19121 const gchar *property_name,
19122 GError **error,
19123 gpointer user_data)
19124{
19125 ControlCheckstopSkeleton *skeleton = CONTROL_CHECKSTOP_SKELETON (user_data);
19126 GValue value = G_VALUE_INIT;
19127 GParamSpec *pspec;
19128 _ExtendedGDBusPropertyInfo *info;
19129 GVariant *ret;
19130 ret = NULL;
19131 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_checkstop_interface_info.parent_struct, property_name);
19132 g_assert (info != NULL);
19133 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
19134 if (pspec == NULL)
19135 {
19136 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
19137 }
19138 else
19139 {
19140 g_value_init (&value, pspec->value_type);
19141 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
19142 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
19143 g_value_unset (&value);
19144 }
19145 return ret;
19146}
19147
19148static gboolean
19149_control_checkstop_skeleton_handle_set_property (
19150 GDBusConnection *connection G_GNUC_UNUSED,
19151 const gchar *sender G_GNUC_UNUSED,
19152 const gchar *object_path G_GNUC_UNUSED,
19153 const gchar *interface_name G_GNUC_UNUSED,
19154 const gchar *property_name,
19155 GVariant *variant,
19156 GError **error,
19157 gpointer user_data)
19158{
19159 ControlCheckstopSkeleton *skeleton = CONTROL_CHECKSTOP_SKELETON (user_data);
19160 GValue value = G_VALUE_INIT;
19161 GParamSpec *pspec;
19162 _ExtendedGDBusPropertyInfo *info;
19163 gboolean ret;
19164 ret = FALSE;
19165 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_checkstop_interface_info.parent_struct, property_name);
19166 g_assert (info != NULL);
19167 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
19168 if (pspec == NULL)
19169 {
19170 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
19171 }
19172 else
19173 {
19174 if (info->use_gvariant)
19175 g_value_set_variant (&value, variant);
19176 else
19177 g_dbus_gvariant_to_gvalue (variant, &value);
19178 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
19179 g_value_unset (&value);
19180 ret = TRUE;
19181 }
19182 return ret;
19183}
19184
19185static const GDBusInterfaceVTable _control_checkstop_skeleton_vtable =
19186{
19187 _control_checkstop_skeleton_handle_method_call,
19188 _control_checkstop_skeleton_handle_get_property,
19189 _control_checkstop_skeleton_handle_set_property,
19190 {NULL}
19191};
19192
19193static GDBusInterfaceInfo *
19194control_checkstop_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
19195{
19196 return control_checkstop_interface_info ();
19197}
19198
19199static GDBusInterfaceVTable *
19200control_checkstop_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
19201{
19202 return (GDBusInterfaceVTable *) &_control_checkstop_skeleton_vtable;
19203}
19204
19205static GVariant *
19206control_checkstop_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
19207{
19208 ControlCheckstopSkeleton *skeleton = CONTROL_CHECKSTOP_SKELETON (_skeleton);
19209
19210 GVariantBuilder builder;
19211 guint n;
19212 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
19213 if (_control_checkstop_interface_info.parent_struct.properties == NULL)
19214 goto out;
19215 for (n = 0; _control_checkstop_interface_info.parent_struct.properties[n] != NULL; n++)
19216 {
19217 GDBusPropertyInfo *info = _control_checkstop_interface_info.parent_struct.properties[n];
19218 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
19219 {
19220 GVariant *value;
19221 value = _control_checkstop_skeleton_handle_get_property (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.control.Checkstop", info->name, NULL, skeleton);
19222 if (value != NULL)
19223 {
19224 g_variant_take_ref (value);
19225 g_variant_builder_add (&builder, "{sv}", info->name, value);
19226 g_variant_unref (value);
19227 }
19228 }
19229 }
19230out:
19231 return g_variant_builder_end (&builder);
19232}
19233
19234static void
19235control_checkstop_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
19236{
19237}
19238
19239static void control_checkstop_skeleton_iface_init (ControlCheckstopIface *iface);
19240#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
19241G_DEFINE_TYPE_WITH_CODE (ControlCheckstopSkeleton, control_checkstop_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
19242 G_ADD_PRIVATE (ControlCheckstopSkeleton)
19243 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_CHECKSTOP, control_checkstop_skeleton_iface_init));
19244
19245#else
19246G_DEFINE_TYPE_WITH_CODE (ControlCheckstopSkeleton, control_checkstop_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
19247 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_CHECKSTOP, control_checkstop_skeleton_iface_init));
19248
19249#endif
19250static void
19251control_checkstop_skeleton_finalize (GObject *object)
19252{
19253 ControlCheckstopSkeleton *skeleton = CONTROL_CHECKSTOP_SKELETON (object);
19254 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
19255 if (skeleton->priv->changed_properties_idle_source != NULL)
19256 g_source_destroy (skeleton->priv->changed_properties_idle_source);
19257 g_main_context_unref (skeleton->priv->context);
19258 g_mutex_clear (&skeleton->priv->lock);
19259 G_OBJECT_CLASS (control_checkstop_skeleton_parent_class)->finalize (object);
19260}
19261
19262static void
19263control_checkstop_skeleton_init (ControlCheckstopSkeleton *skeleton)
19264{
19265#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
19266 skeleton->priv = control_checkstop_skeleton_get_instance_private (skeleton);
19267#else
19268 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_CHECKSTOP_SKELETON, ControlCheckstopSkeletonPrivate);
19269#endif
19270
19271 g_mutex_init (&skeleton->priv->lock);
19272 skeleton->priv->context = g_main_context_ref_thread_default ();
19273}
19274
19275static void
19276control_checkstop_skeleton_class_init (ControlCheckstopSkeletonClass *klass)
19277{
19278 GObjectClass *gobject_class;
19279 GDBusInterfaceSkeletonClass *skeleton_class;
19280
19281 gobject_class = G_OBJECT_CLASS (klass);
19282 gobject_class->finalize = control_checkstop_skeleton_finalize;
19283
19284 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
19285 skeleton_class->get_info = control_checkstop_skeleton_dbus_interface_get_info;
19286 skeleton_class->get_properties = control_checkstop_skeleton_dbus_interface_get_properties;
19287 skeleton_class->flush = control_checkstop_skeleton_dbus_interface_flush;
19288 skeleton_class->get_vtable = control_checkstop_skeleton_dbus_interface_get_vtable;
19289
19290#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
19291 g_type_class_add_private (klass, sizeof (ControlCheckstopSkeletonPrivate));
19292#endif
19293}
19294
19295static void
19296control_checkstop_skeleton_iface_init (ControlCheckstopIface *iface)
19297{
19298}
19299
19300/**
19301 * control_checkstop_skeleton_new:
19302 *
19303 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Checkstop.top_of_page">org.openbmc.control.Checkstop</link>.
19304 *
19305 * Returns: (transfer full) (type ControlCheckstopSkeleton): The skeleton object.
19306 */
19307ControlCheckstop *
19308control_checkstop_skeleton_new (void)
19309{
19310 return CONTROL_CHECKSTOP (g_object_new (TYPE_CONTROL_CHECKSTOP_SKELETON, NULL));
19311}
19312
19313/* ------------------------------------------------------------------------
Norman James362a80f2015-09-14 14:04:39 -050019314 * Code for interface org.openbmc.Watchdog
19315 * ------------------------------------------------------------------------
19316 */
19317
19318/**
19319 * SECTION:Watchdog
19320 * @title: Watchdog
19321 * @short_description: Generated C code for the org.openbmc.Watchdog D-Bus interface
19322 *
19323 * 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.
19324 */
19325
19326/* ---- Introspection data for org.openbmc.Watchdog ---- */
19327
19328static const _ExtendedGDBusMethodInfo _watchdog_method_info_start =
19329{
19330 {
19331 -1,
19332 (gchar *) "start",
19333 NULL,
19334 NULL,
19335 NULL
19336 },
19337 "handle-start",
19338 FALSE
19339};
19340
19341static const _ExtendedGDBusMethodInfo _watchdog_method_info_poke =
19342{
19343 {
19344 -1,
19345 (gchar *) "poke",
19346 NULL,
19347 NULL,
19348 NULL
19349 },
19350 "handle-poke",
19351 FALSE
19352};
19353
19354static const _ExtendedGDBusMethodInfo _watchdog_method_info_stop =
19355{
19356 {
19357 -1,
19358 (gchar *) "stop",
19359 NULL,
19360 NULL,
19361 NULL
19362 },
19363 "handle-stop",
19364 FALSE
19365};
19366
Adriana Kobylak2cb27752015-10-19 16:23:14 -050019367static const _ExtendedGDBusArgInfo _watchdog_method_info_set_IN_ARG_interval =
19368{
19369 {
19370 -1,
19371 (gchar *) "interval",
19372 (gchar *) "i",
19373 NULL
19374 },
19375 FALSE
19376};
19377
19378static const _ExtendedGDBusArgInfo * const _watchdog_method_info_set_IN_ARG_pointers[] =
19379{
19380 &_watchdog_method_info_set_IN_ARG_interval,
19381 NULL
19382};
19383
19384static const _ExtendedGDBusMethodInfo _watchdog_method_info_set =
19385{
19386 {
19387 -1,
19388 (gchar *) "set",
19389 (GDBusArgInfo **) &_watchdog_method_info_set_IN_ARG_pointers,
19390 NULL,
19391 NULL
19392 },
19393 "handle-set",
19394 FALSE
19395};
19396
Norman James362a80f2015-09-14 14:04:39 -050019397static const _ExtendedGDBusMethodInfo * const _watchdog_method_info_pointers[] =
19398{
19399 &_watchdog_method_info_start,
19400 &_watchdog_method_info_poke,
19401 &_watchdog_method_info_stop,
Adriana Kobylak2cb27752015-10-19 16:23:14 -050019402 &_watchdog_method_info_set,
Norman James362a80f2015-09-14 14:04:39 -050019403 NULL
19404};
19405
19406static const _ExtendedGDBusSignalInfo _watchdog_signal_info_watchdog_error =
19407{
19408 {
19409 -1,
19410 (gchar *) "WatchdogError",
19411 NULL,
19412 NULL
19413 },
19414 "watchdog-error"
19415};
19416
19417static const _ExtendedGDBusSignalInfo * const _watchdog_signal_info_pointers[] =
19418{
19419 &_watchdog_signal_info_watchdog_error,
19420 NULL
19421};
19422
19423static const _ExtendedGDBusPropertyInfo _watchdog_property_info_watchdog =
19424{
19425 {
19426 -1,
19427 (gchar *) "watchdog",
19428 (gchar *) "i",
19429 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
19430 NULL
19431 },
19432 "watchdog",
19433 FALSE
19434};
19435
19436static const _ExtendedGDBusPropertyInfo _watchdog_property_info_poll_interval =
19437{
19438 {
19439 -1,
19440 (gchar *) "poll_interval",
19441 (gchar *) "i",
19442 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
19443 NULL
19444 },
19445 "poll-interval",
19446 FALSE
19447};
19448
19449static const _ExtendedGDBusPropertyInfo * const _watchdog_property_info_pointers[] =
19450{
19451 &_watchdog_property_info_watchdog,
19452 &_watchdog_property_info_poll_interval,
19453 NULL
19454};
19455
19456static const _ExtendedGDBusInterfaceInfo _watchdog_interface_info =
19457{
19458 {
19459 -1,
19460 (gchar *) "org.openbmc.Watchdog",
19461 (GDBusMethodInfo **) &_watchdog_method_info_pointers,
19462 (GDBusSignalInfo **) &_watchdog_signal_info_pointers,
19463 (GDBusPropertyInfo **) &_watchdog_property_info_pointers,
19464 NULL
19465 },
19466 "watchdog",
19467};
19468
19469
19470/**
19471 * watchdog_interface_info:
19472 *
19473 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link> D-Bus interface.
19474 *
19475 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
19476 */
19477GDBusInterfaceInfo *
19478watchdog_interface_info (void)
19479{
19480 return (GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct;
19481}
19482
19483/**
19484 * watchdog_override_properties:
19485 * @klass: The class structure for a #GObject<!-- -->-derived class.
19486 * @property_id_begin: The property id to assign to the first overridden property.
19487 *
19488 * Overrides all #GObject properties in the #Watchdog interface for a concrete class.
19489 * The properties are overridden in the order they are defined.
19490 *
19491 * Returns: The last property id.
19492 */
19493guint
19494watchdog_override_properties (GObjectClass *klass, guint property_id_begin)
19495{
19496 g_object_class_override_property (klass, property_id_begin++, "watchdog");
19497 g_object_class_override_property (klass, property_id_begin++, "poll-interval");
19498 return property_id_begin - 1;
19499}
19500
19501
19502
19503/**
19504 * Watchdog:
19505 *
19506 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link>.
19507 */
19508
19509/**
19510 * WatchdogIface:
19511 * @parent_iface: The parent interface.
19512 * @handle_poke: Handler for the #Watchdog::handle-poke signal.
Adriana Kobylak2cb27752015-10-19 16:23:14 -050019513 * @handle_set: Handler for the #Watchdog::handle-set signal.
Norman James362a80f2015-09-14 14:04:39 -050019514 * @handle_start: Handler for the #Watchdog::handle-start signal.
19515 * @handle_stop: Handler for the #Watchdog::handle-stop signal.
19516 * @get_poll_interval: Getter for the #Watchdog:poll-interval property.
19517 * @get_watchdog: Getter for the #Watchdog:watchdog property.
19518 * @watchdog_error: Handler for the #Watchdog::watchdog-error signal.
19519 *
19520 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link>.
19521 */
19522
19523typedef WatchdogIface WatchdogInterface;
19524G_DEFINE_INTERFACE (Watchdog, watchdog, G_TYPE_OBJECT);
19525
19526static void
19527watchdog_default_init (WatchdogIface *iface)
19528{
19529 /* GObject signals for incoming D-Bus method calls: */
19530 /**
19531 * Watchdog::handle-start:
19532 * @object: A #Watchdog.
19533 * @invocation: A #GDBusMethodInvocation.
19534 *
19535 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Watchdog.start">start()</link> D-Bus method.
19536 *
19537 * 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.
19538 *
19539 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
19540 */
19541 g_signal_new ("handle-start",
19542 G_TYPE_FROM_INTERFACE (iface),
19543 G_SIGNAL_RUN_LAST,
19544 G_STRUCT_OFFSET (WatchdogIface, handle_start),
19545 g_signal_accumulator_true_handled,
19546 NULL,
19547 g_cclosure_marshal_generic,
19548 G_TYPE_BOOLEAN,
19549 1,
19550 G_TYPE_DBUS_METHOD_INVOCATION);
19551
19552 /**
19553 * Watchdog::handle-poke:
19554 * @object: A #Watchdog.
19555 * @invocation: A #GDBusMethodInvocation.
19556 *
19557 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Watchdog.poke">poke()</link> D-Bus method.
19558 *
19559 * 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.
19560 *
19561 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
19562 */
19563 g_signal_new ("handle-poke",
19564 G_TYPE_FROM_INTERFACE (iface),
19565 G_SIGNAL_RUN_LAST,
19566 G_STRUCT_OFFSET (WatchdogIface, handle_poke),
19567 g_signal_accumulator_true_handled,
19568 NULL,
19569 g_cclosure_marshal_generic,
19570 G_TYPE_BOOLEAN,
19571 1,
19572 G_TYPE_DBUS_METHOD_INVOCATION);
19573
19574 /**
19575 * Watchdog::handle-stop:
19576 * @object: A #Watchdog.
19577 * @invocation: A #GDBusMethodInvocation.
19578 *
19579 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Watchdog.stop">stop()</link> D-Bus method.
19580 *
19581 * 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.
19582 *
19583 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
19584 */
19585 g_signal_new ("handle-stop",
19586 G_TYPE_FROM_INTERFACE (iface),
19587 G_SIGNAL_RUN_LAST,
19588 G_STRUCT_OFFSET (WatchdogIface, handle_stop),
19589 g_signal_accumulator_true_handled,
19590 NULL,
19591 g_cclosure_marshal_generic,
19592 G_TYPE_BOOLEAN,
19593 1,
19594 G_TYPE_DBUS_METHOD_INVOCATION);
19595
Adriana Kobylak2cb27752015-10-19 16:23:14 -050019596 /**
19597 * Watchdog::handle-set:
19598 * @object: A #Watchdog.
19599 * @invocation: A #GDBusMethodInvocation.
19600 * @arg_interval: Argument passed by remote caller.
19601 *
19602 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Watchdog.set">set()</link> D-Bus method.
19603 *
19604 * 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.
19605 *
19606 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
19607 */
19608 g_signal_new ("handle-set",
19609 G_TYPE_FROM_INTERFACE (iface),
19610 G_SIGNAL_RUN_LAST,
19611 G_STRUCT_OFFSET (WatchdogIface, handle_set),
19612 g_signal_accumulator_true_handled,
19613 NULL,
19614 g_cclosure_marshal_generic,
19615 G_TYPE_BOOLEAN,
19616 2,
19617 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT);
19618
Norman James362a80f2015-09-14 14:04:39 -050019619 /* GObject signals for received D-Bus signals: */
19620 /**
19621 * Watchdog::watchdog-error:
19622 * @object: A #Watchdog.
19623 *
19624 * 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.
19625 *
19626 * 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.
19627 */
19628 g_signal_new ("watchdog-error",
19629 G_TYPE_FROM_INTERFACE (iface),
19630 G_SIGNAL_RUN_LAST,
19631 G_STRUCT_OFFSET (WatchdogIface, watchdog_error),
19632 NULL,
19633 NULL,
19634 g_cclosure_marshal_generic,
19635 G_TYPE_NONE,
19636 0);
19637
19638 /* GObject properties for D-Bus properties: */
19639 /**
19640 * Watchdog:watchdog:
19641 *
19642 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Watchdog.watchdog">"watchdog"</link>.
19643 *
19644 * 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.
19645 */
19646 g_object_interface_install_property (iface,
19647 g_param_spec_int ("watchdog", "watchdog", "watchdog", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
19648 /**
19649 * Watchdog:poll-interval:
19650 *
19651 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Watchdog.poll_interval">"poll_interval"</link>.
19652 *
19653 * 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.
19654 */
19655 g_object_interface_install_property (iface,
19656 g_param_spec_int ("poll-interval", "poll_interval", "poll_interval", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
19657}
19658
19659/**
19660 * watchdog_get_watchdog: (skip)
19661 * @object: A #Watchdog.
19662 *
19663 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Watchdog.watchdog">"watchdog"</link> D-Bus property.
19664 *
19665 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
19666 *
19667 * Returns: The property value.
19668 */
19669gint
19670watchdog_get_watchdog (Watchdog *object)
19671{
19672 return WATCHDOG_GET_IFACE (object)->get_watchdog (object);
19673}
19674
19675/**
19676 * watchdog_set_watchdog: (skip)
19677 * @object: A #Watchdog.
19678 * @value: The value to set.
19679 *
19680 * Sets the <link linkend="gdbus-property-org-openbmc-Watchdog.watchdog">"watchdog"</link> D-Bus property to @value.
19681 *
19682 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
19683 */
19684void
19685watchdog_set_watchdog (Watchdog *object, gint value)
19686{
19687 g_object_set (G_OBJECT (object), "watchdog", value, NULL);
19688}
19689
19690/**
19691 * watchdog_get_poll_interval: (skip)
19692 * @object: A #Watchdog.
19693 *
19694 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Watchdog.poll_interval">"poll_interval"</link> D-Bus property.
19695 *
19696 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
19697 *
19698 * Returns: The property value.
19699 */
19700gint
19701watchdog_get_poll_interval (Watchdog *object)
19702{
19703 return WATCHDOG_GET_IFACE (object)->get_poll_interval (object);
19704}
19705
19706/**
19707 * watchdog_set_poll_interval: (skip)
19708 * @object: A #Watchdog.
19709 * @value: The value to set.
19710 *
19711 * Sets the <link linkend="gdbus-property-org-openbmc-Watchdog.poll_interval">"poll_interval"</link> D-Bus property to @value.
19712 *
19713 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
19714 */
19715void
19716watchdog_set_poll_interval (Watchdog *object, gint value)
19717{
19718 g_object_set (G_OBJECT (object), "poll-interval", value, NULL);
19719}
19720
19721/**
19722 * watchdog_emit_watchdog_error:
19723 * @object: A #Watchdog.
19724 *
19725 * Emits the <link linkend="gdbus-signal-org-openbmc-Watchdog.WatchdogError">"WatchdogError"</link> D-Bus signal.
19726 */
19727void
19728watchdog_emit_watchdog_error (
19729 Watchdog *object)
19730{
19731 g_signal_emit_by_name (object, "watchdog-error");
19732}
19733
19734/**
19735 * watchdog_call_start:
19736 * @proxy: A #WatchdogProxy.
19737 * @cancellable: (allow-none): A #GCancellable or %NULL.
19738 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
19739 * @user_data: User data to pass to @callback.
19740 *
19741 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.start">start()</link> D-Bus method on @proxy.
19742 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
19743 * You can then call watchdog_call_start_finish() to get the result of the operation.
19744 *
19745 * See watchdog_call_start_sync() for the synchronous, blocking version of this method.
19746 */
19747void
19748watchdog_call_start (
19749 Watchdog *proxy,
19750 GCancellable *cancellable,
19751 GAsyncReadyCallback callback,
19752 gpointer user_data)
19753{
19754 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
19755 "start",
19756 g_variant_new ("()"),
19757 G_DBUS_CALL_FLAGS_NONE,
19758 -1,
19759 cancellable,
19760 callback,
19761 user_data);
19762}
19763
19764/**
19765 * watchdog_call_start_finish:
19766 * @proxy: A #WatchdogProxy.
19767 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_call_start().
19768 * @error: Return location for error or %NULL.
19769 *
19770 * Finishes an operation started with watchdog_call_start().
19771 *
19772 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19773 */
19774gboolean
19775watchdog_call_start_finish (
19776 Watchdog *proxy,
19777 GAsyncResult *res,
19778 GError **error)
19779{
19780 GVariant *_ret;
19781 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
19782 if (_ret == NULL)
19783 goto _out;
19784 g_variant_get (_ret,
19785 "()");
19786 g_variant_unref (_ret);
19787_out:
19788 return _ret != NULL;
19789}
19790
19791/**
19792 * watchdog_call_start_sync:
19793 * @proxy: A #WatchdogProxy.
19794 * @cancellable: (allow-none): A #GCancellable or %NULL.
19795 * @error: Return location for error or %NULL.
19796 *
19797 * 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.
19798 *
19799 * See watchdog_call_start() for the asynchronous version of this method.
19800 *
19801 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19802 */
19803gboolean
19804watchdog_call_start_sync (
19805 Watchdog *proxy,
19806 GCancellable *cancellable,
19807 GError **error)
19808{
19809 GVariant *_ret;
19810 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
19811 "start",
19812 g_variant_new ("()"),
19813 G_DBUS_CALL_FLAGS_NONE,
19814 -1,
19815 cancellable,
19816 error);
19817 if (_ret == NULL)
19818 goto _out;
19819 g_variant_get (_ret,
19820 "()");
19821 g_variant_unref (_ret);
19822_out:
19823 return _ret != NULL;
19824}
19825
19826/**
19827 * watchdog_call_poke:
19828 * @proxy: A #WatchdogProxy.
19829 * @cancellable: (allow-none): A #GCancellable or %NULL.
19830 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
19831 * @user_data: User data to pass to @callback.
19832 *
19833 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.poke">poke()</link> D-Bus method on @proxy.
19834 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
19835 * You can then call watchdog_call_poke_finish() to get the result of the operation.
19836 *
19837 * See watchdog_call_poke_sync() for the synchronous, blocking version of this method.
19838 */
19839void
19840watchdog_call_poke (
19841 Watchdog *proxy,
19842 GCancellable *cancellable,
19843 GAsyncReadyCallback callback,
19844 gpointer user_data)
19845{
19846 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
19847 "poke",
19848 g_variant_new ("()"),
19849 G_DBUS_CALL_FLAGS_NONE,
19850 -1,
19851 cancellable,
19852 callback,
19853 user_data);
19854}
19855
19856/**
19857 * watchdog_call_poke_finish:
19858 * @proxy: A #WatchdogProxy.
19859 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_call_poke().
19860 * @error: Return location for error or %NULL.
19861 *
19862 * Finishes an operation started with watchdog_call_poke().
19863 *
19864 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19865 */
19866gboolean
19867watchdog_call_poke_finish (
19868 Watchdog *proxy,
19869 GAsyncResult *res,
19870 GError **error)
19871{
19872 GVariant *_ret;
19873 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
19874 if (_ret == NULL)
19875 goto _out;
19876 g_variant_get (_ret,
19877 "()");
19878 g_variant_unref (_ret);
19879_out:
19880 return _ret != NULL;
19881}
19882
19883/**
19884 * watchdog_call_poke_sync:
19885 * @proxy: A #WatchdogProxy.
19886 * @cancellable: (allow-none): A #GCancellable or %NULL.
19887 * @error: Return location for error or %NULL.
19888 *
19889 * 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.
19890 *
19891 * See watchdog_call_poke() for the asynchronous version of this method.
19892 *
19893 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19894 */
19895gboolean
19896watchdog_call_poke_sync (
19897 Watchdog *proxy,
19898 GCancellable *cancellable,
19899 GError **error)
19900{
19901 GVariant *_ret;
19902 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
19903 "poke",
19904 g_variant_new ("()"),
19905 G_DBUS_CALL_FLAGS_NONE,
19906 -1,
19907 cancellable,
19908 error);
19909 if (_ret == NULL)
19910 goto _out;
19911 g_variant_get (_ret,
19912 "()");
19913 g_variant_unref (_ret);
19914_out:
19915 return _ret != NULL;
19916}
19917
19918/**
19919 * watchdog_call_stop:
19920 * @proxy: A #WatchdogProxy.
19921 * @cancellable: (allow-none): A #GCancellable or %NULL.
19922 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
19923 * @user_data: User data to pass to @callback.
19924 *
19925 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.stop">stop()</link> D-Bus method on @proxy.
19926 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
19927 * You can then call watchdog_call_stop_finish() to get the result of the operation.
19928 *
19929 * See watchdog_call_stop_sync() for the synchronous, blocking version of this method.
19930 */
19931void
19932watchdog_call_stop (
19933 Watchdog *proxy,
19934 GCancellable *cancellable,
19935 GAsyncReadyCallback callback,
19936 gpointer user_data)
19937{
19938 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
19939 "stop",
19940 g_variant_new ("()"),
19941 G_DBUS_CALL_FLAGS_NONE,
19942 -1,
19943 cancellable,
19944 callback,
19945 user_data);
19946}
19947
19948/**
19949 * watchdog_call_stop_finish:
19950 * @proxy: A #WatchdogProxy.
19951 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_call_stop().
19952 * @error: Return location for error or %NULL.
19953 *
19954 * Finishes an operation started with watchdog_call_stop().
19955 *
19956 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19957 */
19958gboolean
19959watchdog_call_stop_finish (
19960 Watchdog *proxy,
19961 GAsyncResult *res,
19962 GError **error)
19963{
19964 GVariant *_ret;
19965 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
19966 if (_ret == NULL)
19967 goto _out;
19968 g_variant_get (_ret,
19969 "()");
19970 g_variant_unref (_ret);
19971_out:
19972 return _ret != NULL;
19973}
19974
19975/**
19976 * watchdog_call_stop_sync:
19977 * @proxy: A #WatchdogProxy.
19978 * @cancellable: (allow-none): A #GCancellable or %NULL.
19979 * @error: Return location for error or %NULL.
19980 *
19981 * 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.
19982 *
19983 * See watchdog_call_stop() for the asynchronous version of this method.
19984 *
19985 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19986 */
19987gboolean
19988watchdog_call_stop_sync (
19989 Watchdog *proxy,
19990 GCancellable *cancellable,
19991 GError **error)
19992{
19993 GVariant *_ret;
19994 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
19995 "stop",
19996 g_variant_new ("()"),
19997 G_DBUS_CALL_FLAGS_NONE,
19998 -1,
19999 cancellable,
20000 error);
20001 if (_ret == NULL)
20002 goto _out;
20003 g_variant_get (_ret,
20004 "()");
20005 g_variant_unref (_ret);
20006_out:
20007 return _ret != NULL;
20008}
20009
20010/**
Adriana Kobylak2cb27752015-10-19 16:23:14 -050020011 * watchdog_call_set:
20012 * @proxy: A #WatchdogProxy.
20013 * @arg_interval: Argument to pass with the method invocation.
20014 * @cancellable: (allow-none): A #GCancellable or %NULL.
20015 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
20016 * @user_data: User data to pass to @callback.
20017 *
20018 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.set">set()</link> D-Bus method on @proxy.
20019 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
20020 * You can then call watchdog_call_set_finish() to get the result of the operation.
20021 *
20022 * See watchdog_call_set_sync() for the synchronous, blocking version of this method.
20023 */
20024void
20025watchdog_call_set (
20026 Watchdog *proxy,
20027 gint arg_interval,
20028 GCancellable *cancellable,
20029 GAsyncReadyCallback callback,
20030 gpointer user_data)
20031{
20032 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
20033 "set",
20034 g_variant_new ("(i)",
20035 arg_interval),
20036 G_DBUS_CALL_FLAGS_NONE,
20037 -1,
20038 cancellable,
20039 callback,
20040 user_data);
20041}
20042
20043/**
20044 * watchdog_call_set_finish:
20045 * @proxy: A #WatchdogProxy.
20046 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_call_set().
20047 * @error: Return location for error or %NULL.
20048 *
20049 * Finishes an operation started with watchdog_call_set().
20050 *
20051 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
20052 */
20053gboolean
20054watchdog_call_set_finish (
20055 Watchdog *proxy,
20056 GAsyncResult *res,
20057 GError **error)
20058{
20059 GVariant *_ret;
20060 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
20061 if (_ret == NULL)
20062 goto _out;
20063 g_variant_get (_ret,
20064 "()");
20065 g_variant_unref (_ret);
20066_out:
20067 return _ret != NULL;
20068}
20069
20070/**
20071 * watchdog_call_set_sync:
20072 * @proxy: A #WatchdogProxy.
20073 * @arg_interval: Argument to pass with the method invocation.
20074 * @cancellable: (allow-none): A #GCancellable or %NULL.
20075 * @error: Return location for error or %NULL.
20076 *
20077 * 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.
20078 *
20079 * See watchdog_call_set() for the asynchronous version of this method.
20080 *
20081 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
20082 */
20083gboolean
20084watchdog_call_set_sync (
20085 Watchdog *proxy,
20086 gint arg_interval,
20087 GCancellable *cancellable,
20088 GError **error)
20089{
20090 GVariant *_ret;
20091 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
20092 "set",
20093 g_variant_new ("(i)",
20094 arg_interval),
20095 G_DBUS_CALL_FLAGS_NONE,
20096 -1,
20097 cancellable,
20098 error);
20099 if (_ret == NULL)
20100 goto _out;
20101 g_variant_get (_ret,
20102 "()");
20103 g_variant_unref (_ret);
20104_out:
20105 return _ret != NULL;
20106}
20107
20108/**
Norman James362a80f2015-09-14 14:04:39 -050020109 * watchdog_complete_start:
20110 * @object: A #Watchdog.
20111 * @invocation: (transfer full): A #GDBusMethodInvocation.
20112 *
20113 * 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.
20114 *
20115 * This method will free @invocation, you cannot use it afterwards.
20116 */
20117void
20118watchdog_complete_start (
20119 Watchdog *object,
20120 GDBusMethodInvocation *invocation)
20121{
20122 g_dbus_method_invocation_return_value (invocation,
20123 g_variant_new ("()"));
20124}
20125
20126/**
20127 * watchdog_complete_poke:
20128 * @object: A #Watchdog.
20129 * @invocation: (transfer full): A #GDBusMethodInvocation.
20130 *
20131 * 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.
20132 *
20133 * This method will free @invocation, you cannot use it afterwards.
20134 */
20135void
20136watchdog_complete_poke (
20137 Watchdog *object,
20138 GDBusMethodInvocation *invocation)
20139{
20140 g_dbus_method_invocation_return_value (invocation,
20141 g_variant_new ("()"));
20142}
20143
20144/**
20145 * watchdog_complete_stop:
20146 * @object: A #Watchdog.
20147 * @invocation: (transfer full): A #GDBusMethodInvocation.
20148 *
20149 * 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.
20150 *
20151 * This method will free @invocation, you cannot use it afterwards.
20152 */
20153void
20154watchdog_complete_stop (
20155 Watchdog *object,
20156 GDBusMethodInvocation *invocation)
20157{
20158 g_dbus_method_invocation_return_value (invocation,
20159 g_variant_new ("()"));
20160}
20161
Adriana Kobylak2cb27752015-10-19 16:23:14 -050020162/**
20163 * watchdog_complete_set:
20164 * @object: A #Watchdog.
20165 * @invocation: (transfer full): A #GDBusMethodInvocation.
20166 *
20167 * 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.
20168 *
20169 * This method will free @invocation, you cannot use it afterwards.
20170 */
20171void
20172watchdog_complete_set (
20173 Watchdog *object,
20174 GDBusMethodInvocation *invocation)
20175{
20176 g_dbus_method_invocation_return_value (invocation,
20177 g_variant_new ("()"));
20178}
20179
Norman James362a80f2015-09-14 14:04:39 -050020180/* ------------------------------------------------------------------------ */
20181
20182/**
20183 * WatchdogProxy:
20184 *
20185 * The #WatchdogProxy structure contains only private data and should only be accessed using the provided API.
20186 */
20187
20188/**
20189 * WatchdogProxyClass:
20190 * @parent_class: The parent class.
20191 *
20192 * Class structure for #WatchdogProxy.
20193 */
20194
20195struct _WatchdogProxyPrivate
20196{
20197 GData *qdata;
20198};
20199
20200static void watchdog_proxy_iface_init (WatchdogIface *iface);
20201
20202#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
20203G_DEFINE_TYPE_WITH_CODE (WatchdogProxy, watchdog_proxy, G_TYPE_DBUS_PROXY,
20204 G_ADD_PRIVATE (WatchdogProxy)
20205 G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_proxy_iface_init));
20206
20207#else
20208G_DEFINE_TYPE_WITH_CODE (WatchdogProxy, watchdog_proxy, G_TYPE_DBUS_PROXY,
20209 G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_proxy_iface_init));
20210
20211#endif
20212static void
20213watchdog_proxy_finalize (GObject *object)
20214{
20215 WatchdogProxy *proxy = WATCHDOG_PROXY (object);
20216 g_datalist_clear (&proxy->priv->qdata);
20217 G_OBJECT_CLASS (watchdog_proxy_parent_class)->finalize (object);
20218}
20219
20220static void
20221watchdog_proxy_get_property (GObject *object,
20222 guint prop_id,
20223 GValue *value,
20224 GParamSpec *pspec G_GNUC_UNUSED)
20225{
20226 const _ExtendedGDBusPropertyInfo *info;
20227 GVariant *variant;
20228 g_assert (prop_id != 0 && prop_id - 1 < 2);
20229 info = _watchdog_property_info_pointers[prop_id - 1];
20230 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
20231 if (info->use_gvariant)
20232 {
20233 g_value_set_variant (value, variant);
20234 }
20235 else
20236 {
20237 if (variant != NULL)
20238 g_dbus_gvariant_to_gvalue (variant, value);
20239 }
20240 if (variant != NULL)
20241 g_variant_unref (variant);
20242}
20243
20244static void
20245watchdog_proxy_set_property_cb (GDBusProxy *proxy,
20246 GAsyncResult *res,
20247 gpointer user_data)
20248{
20249 const _ExtendedGDBusPropertyInfo *info = user_data;
20250 GError *error;
20251 GVariant *_ret;
20252 error = NULL;
20253 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
20254 if (!_ret)
20255 {
20256 g_warning ("Error setting property '%s' on interface org.openbmc.Watchdog: %s (%s, %d)",
20257 info->parent_struct.name,
20258 error->message, g_quark_to_string (error->domain), error->code);
20259 g_error_free (error);
20260 }
20261 else
20262 {
20263 g_variant_unref (_ret);
20264 }
20265}
20266
20267static void
20268watchdog_proxy_set_property (GObject *object,
20269 guint prop_id,
20270 const GValue *value,
20271 GParamSpec *pspec G_GNUC_UNUSED)
20272{
20273 const _ExtendedGDBusPropertyInfo *info;
20274 GVariant *variant;
20275 g_assert (prop_id != 0 && prop_id - 1 < 2);
20276 info = _watchdog_property_info_pointers[prop_id - 1];
20277 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
20278 g_dbus_proxy_call (G_DBUS_PROXY (object),
20279 "org.freedesktop.DBus.Properties.Set",
20280 g_variant_new ("(ssv)", "org.openbmc.Watchdog", info->parent_struct.name, variant),
20281 G_DBUS_CALL_FLAGS_NONE,
20282 -1,
20283 NULL, (GAsyncReadyCallback) watchdog_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
20284 g_variant_unref (variant);
20285}
20286
20287static void
20288watchdog_proxy_g_signal (GDBusProxy *proxy,
20289 const gchar *sender_name G_GNUC_UNUSED,
20290 const gchar *signal_name,
20291 GVariant *parameters)
20292{
20293 _ExtendedGDBusSignalInfo *info;
20294 GVariantIter iter;
20295 GVariant *child;
20296 GValue *paramv;
20297 guint num_params;
20298 guint n;
20299 guint signal_id;
20300 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, signal_name);
20301 if (info == NULL)
20302 return;
20303 num_params = g_variant_n_children (parameters);
20304 paramv = g_new0 (GValue, num_params + 1);
20305 g_value_init (&paramv[0], TYPE_WATCHDOG);
20306 g_value_set_object (&paramv[0], proxy);
20307 g_variant_iter_init (&iter, parameters);
20308 n = 1;
20309 while ((child = g_variant_iter_next_value (&iter)) != NULL)
20310 {
20311 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
20312 if (arg_info->use_gvariant)
20313 {
20314 g_value_init (&paramv[n], G_TYPE_VARIANT);
20315 g_value_set_variant (&paramv[n], child);
20316 n++;
20317 }
20318 else
20319 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
20320 g_variant_unref (child);
20321 }
20322 signal_id = g_signal_lookup (info->signal_name, TYPE_WATCHDOG);
20323 g_signal_emitv (paramv, signal_id, 0, NULL);
20324 for (n = 0; n < num_params + 1; n++)
20325 g_value_unset (&paramv[n]);
20326 g_free (paramv);
20327}
20328
20329static void
20330watchdog_proxy_g_properties_changed (GDBusProxy *_proxy,
20331 GVariant *changed_properties,
20332 const gchar *const *invalidated_properties)
20333{
20334 WatchdogProxy *proxy = WATCHDOG_PROXY (_proxy);
20335 guint n;
20336 const gchar *key;
20337 GVariantIter *iter;
20338 _ExtendedGDBusPropertyInfo *info;
20339 g_variant_get (changed_properties, "a{sv}", &iter);
20340 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
20341 {
20342 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, key);
20343 g_datalist_remove_data (&proxy->priv->qdata, key);
20344 if (info != NULL)
20345 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
20346 }
20347 g_variant_iter_free (iter);
20348 for (n = 0; invalidated_properties[n] != NULL; n++)
20349 {
20350 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, invalidated_properties[n]);
20351 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
20352 if (info != NULL)
20353 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
20354 }
20355}
20356
20357static gint
20358watchdog_proxy_get_watchdog (Watchdog *object)
20359{
20360 WatchdogProxy *proxy = WATCHDOG_PROXY (object);
20361 GVariant *variant;
20362 gint value = 0;
20363 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "watchdog");
20364 if (variant != NULL)
20365 {
20366 value = g_variant_get_int32 (variant);
20367 g_variant_unref (variant);
20368 }
20369 return value;
20370}
20371
20372static gint
20373watchdog_proxy_get_poll_interval (Watchdog *object)
20374{
20375 WatchdogProxy *proxy = WATCHDOG_PROXY (object);
20376 GVariant *variant;
20377 gint value = 0;
20378 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "poll_interval");
20379 if (variant != NULL)
20380 {
20381 value = g_variant_get_int32 (variant);
20382 g_variant_unref (variant);
20383 }
20384 return value;
20385}
20386
20387static void
20388watchdog_proxy_init (WatchdogProxy *proxy)
20389{
20390#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
20391 proxy->priv = watchdog_proxy_get_instance_private (proxy);
20392#else
20393 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_WATCHDOG_PROXY, WatchdogProxyPrivate);
20394#endif
20395
20396 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), watchdog_interface_info ());
20397}
20398
20399static void
20400watchdog_proxy_class_init (WatchdogProxyClass *klass)
20401{
20402 GObjectClass *gobject_class;
20403 GDBusProxyClass *proxy_class;
20404
20405 gobject_class = G_OBJECT_CLASS (klass);
20406 gobject_class->finalize = watchdog_proxy_finalize;
20407 gobject_class->get_property = watchdog_proxy_get_property;
20408 gobject_class->set_property = watchdog_proxy_set_property;
20409
20410 proxy_class = G_DBUS_PROXY_CLASS (klass);
20411 proxy_class->g_signal = watchdog_proxy_g_signal;
20412 proxy_class->g_properties_changed = watchdog_proxy_g_properties_changed;
20413
20414 watchdog_override_properties (gobject_class, 1);
20415
20416#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
20417 g_type_class_add_private (klass, sizeof (WatchdogProxyPrivate));
20418#endif
20419}
20420
20421static void
20422watchdog_proxy_iface_init (WatchdogIface *iface)
20423{
20424 iface->get_watchdog = watchdog_proxy_get_watchdog;
20425 iface->get_poll_interval = watchdog_proxy_get_poll_interval;
20426}
20427
20428/**
20429 * watchdog_proxy_new:
20430 * @connection: A #GDBusConnection.
20431 * @flags: Flags from the #GDBusProxyFlags enumeration.
20432 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
20433 * @object_path: An object path.
20434 * @cancellable: (allow-none): A #GCancellable or %NULL.
20435 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
20436 * @user_data: User data to pass to @callback.
20437 *
20438 * 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.
20439 *
20440 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
20441 * You can then call watchdog_proxy_new_finish() to get the result of the operation.
20442 *
20443 * See watchdog_proxy_new_sync() for the synchronous, blocking version of this constructor.
20444 */
20445void
20446watchdog_proxy_new (
20447 GDBusConnection *connection,
20448 GDBusProxyFlags flags,
20449 const gchar *name,
20450 const gchar *object_path,
20451 GCancellable *cancellable,
20452 GAsyncReadyCallback callback,
20453 gpointer user_data)
20454{
20455 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);
20456}
20457
20458/**
20459 * watchdog_proxy_new_finish:
20460 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_proxy_new().
20461 * @error: Return location for error or %NULL
20462 *
20463 * Finishes an operation started with watchdog_proxy_new().
20464 *
20465 * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set.
20466 */
20467Watchdog *
20468watchdog_proxy_new_finish (
20469 GAsyncResult *res,
20470 GError **error)
20471{
20472 GObject *ret;
20473 GObject *source_object;
20474 source_object = g_async_result_get_source_object (res);
20475 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
20476 g_object_unref (source_object);
20477 if (ret != NULL)
20478 return WATCHDOG (ret);
20479 else
20480 return NULL;
20481}
20482
20483/**
20484 * watchdog_proxy_new_sync:
20485 * @connection: A #GDBusConnection.
20486 * @flags: Flags from the #GDBusProxyFlags enumeration.
20487 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
20488 * @object_path: An object path.
20489 * @cancellable: (allow-none): A #GCancellable or %NULL.
20490 * @error: Return location for error or %NULL
20491 *
20492 * 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.
20493 *
20494 * The calling thread is blocked until a reply is received.
20495 *
20496 * See watchdog_proxy_new() for the asynchronous version of this constructor.
20497 *
20498 * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set.
20499 */
20500Watchdog *
20501watchdog_proxy_new_sync (
20502 GDBusConnection *connection,
20503 GDBusProxyFlags flags,
20504 const gchar *name,
20505 const gchar *object_path,
20506 GCancellable *cancellable,
20507 GError **error)
20508{
20509 GInitable *ret;
20510 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);
20511 if (ret != NULL)
20512 return WATCHDOG (ret);
20513 else
20514 return NULL;
20515}
20516
20517
20518/**
20519 * watchdog_proxy_new_for_bus:
20520 * @bus_type: A #GBusType.
20521 * @flags: Flags from the #GDBusProxyFlags enumeration.
20522 * @name: A bus name (well-known or unique).
20523 * @object_path: An object path.
20524 * @cancellable: (allow-none): A #GCancellable or %NULL.
20525 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
20526 * @user_data: User data to pass to @callback.
20527 *
20528 * Like watchdog_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
20529 *
20530 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
20531 * You can then call watchdog_proxy_new_for_bus_finish() to get the result of the operation.
20532 *
20533 * See watchdog_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
20534 */
20535void
20536watchdog_proxy_new_for_bus (
20537 GBusType bus_type,
20538 GDBusProxyFlags flags,
20539 const gchar *name,
20540 const gchar *object_path,
20541 GCancellable *cancellable,
20542 GAsyncReadyCallback callback,
20543 gpointer user_data)
20544{
20545 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);
20546}
20547
20548/**
20549 * watchdog_proxy_new_for_bus_finish:
20550 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_proxy_new_for_bus().
20551 * @error: Return location for error or %NULL
20552 *
20553 * Finishes an operation started with watchdog_proxy_new_for_bus().
20554 *
20555 * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set.
20556 */
20557Watchdog *
20558watchdog_proxy_new_for_bus_finish (
20559 GAsyncResult *res,
20560 GError **error)
20561{
20562 GObject *ret;
20563 GObject *source_object;
20564 source_object = g_async_result_get_source_object (res);
20565 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
20566 g_object_unref (source_object);
20567 if (ret != NULL)
20568 return WATCHDOG (ret);
20569 else
20570 return NULL;
20571}
20572
20573/**
20574 * watchdog_proxy_new_for_bus_sync:
20575 * @bus_type: A #GBusType.
20576 * @flags: Flags from the #GDBusProxyFlags enumeration.
20577 * @name: A bus name (well-known or unique).
20578 * @object_path: An object path.
20579 * @cancellable: (allow-none): A #GCancellable or %NULL.
20580 * @error: Return location for error or %NULL
20581 *
20582 * Like watchdog_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
20583 *
20584 * The calling thread is blocked until a reply is received.
20585 *
20586 * See watchdog_proxy_new_for_bus() for the asynchronous version of this constructor.
20587 *
20588 * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set.
20589 */
20590Watchdog *
20591watchdog_proxy_new_for_bus_sync (
20592 GBusType bus_type,
20593 GDBusProxyFlags flags,
20594 const gchar *name,
20595 const gchar *object_path,
20596 GCancellable *cancellable,
20597 GError **error)
20598{
20599 GInitable *ret;
20600 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);
20601 if (ret != NULL)
20602 return WATCHDOG (ret);
20603 else
20604 return NULL;
20605}
20606
20607
20608/* ------------------------------------------------------------------------ */
20609
20610/**
20611 * WatchdogSkeleton:
20612 *
20613 * The #WatchdogSkeleton structure contains only private data and should only be accessed using the provided API.
20614 */
20615
20616/**
20617 * WatchdogSkeletonClass:
20618 * @parent_class: The parent class.
20619 *
20620 * Class structure for #WatchdogSkeleton.
20621 */
20622
20623struct _WatchdogSkeletonPrivate
20624{
20625 GValue *properties;
20626 GList *changed_properties;
20627 GSource *changed_properties_idle_source;
20628 GMainContext *context;
20629 GMutex lock;
20630};
20631
20632static void
20633_watchdog_skeleton_handle_method_call (
20634 GDBusConnection *connection G_GNUC_UNUSED,
20635 const gchar *sender G_GNUC_UNUSED,
20636 const gchar *object_path G_GNUC_UNUSED,
20637 const gchar *interface_name,
20638 const gchar *method_name,
20639 GVariant *parameters,
20640 GDBusMethodInvocation *invocation,
20641 gpointer user_data)
20642{
20643 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data);
20644 _ExtendedGDBusMethodInfo *info;
20645 GVariantIter iter;
20646 GVariant *child;
20647 GValue *paramv;
20648 guint num_params;
20649 guint num_extra;
20650 guint n;
20651 guint signal_id;
20652 GValue return_value = G_VALUE_INIT;
20653 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
20654 g_assert (info != NULL);
20655 num_params = g_variant_n_children (parameters);
20656 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
20657 n = 0;
20658 g_value_init (&paramv[n], TYPE_WATCHDOG);
20659 g_value_set_object (&paramv[n++], skeleton);
20660 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
20661 g_value_set_object (&paramv[n++], invocation);
20662 if (info->pass_fdlist)
20663 {
20664#ifdef G_OS_UNIX
20665 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
20666 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
20667#else
20668 g_assert_not_reached ();
20669#endif
20670 }
20671 g_variant_iter_init (&iter, parameters);
20672 while ((child = g_variant_iter_next_value (&iter)) != NULL)
20673 {
20674 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
20675 if (arg_info->use_gvariant)
20676 {
20677 g_value_init (&paramv[n], G_TYPE_VARIANT);
20678 g_value_set_variant (&paramv[n], child);
20679 n++;
20680 }
20681 else
20682 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
20683 g_variant_unref (child);
20684 }
20685 signal_id = g_signal_lookup (info->signal_name, TYPE_WATCHDOG);
20686 g_value_init (&return_value, G_TYPE_BOOLEAN);
20687 g_signal_emitv (paramv, signal_id, 0, &return_value);
20688 if (!g_value_get_boolean (&return_value))
20689 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);
20690 g_value_unset (&return_value);
20691 for (n = 0; n < num_params + num_extra; n++)
20692 g_value_unset (&paramv[n]);
20693 g_free (paramv);
20694}
20695
20696static GVariant *
20697_watchdog_skeleton_handle_get_property (
20698 GDBusConnection *connection G_GNUC_UNUSED,
20699 const gchar *sender G_GNUC_UNUSED,
20700 const gchar *object_path G_GNUC_UNUSED,
20701 const gchar *interface_name G_GNUC_UNUSED,
20702 const gchar *property_name,
20703 GError **error,
20704 gpointer user_data)
20705{
20706 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data);
20707 GValue value = G_VALUE_INIT;
20708 GParamSpec *pspec;
20709 _ExtendedGDBusPropertyInfo *info;
20710 GVariant *ret;
20711 ret = NULL;
20712 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, property_name);
20713 g_assert (info != NULL);
20714 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
20715 if (pspec == NULL)
20716 {
20717 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
20718 }
20719 else
20720 {
20721 g_value_init (&value, pspec->value_type);
20722 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
20723 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
20724 g_value_unset (&value);
20725 }
20726 return ret;
20727}
20728
20729static gboolean
20730_watchdog_skeleton_handle_set_property (
20731 GDBusConnection *connection G_GNUC_UNUSED,
20732 const gchar *sender G_GNUC_UNUSED,
20733 const gchar *object_path G_GNUC_UNUSED,
20734 const gchar *interface_name G_GNUC_UNUSED,
20735 const gchar *property_name,
20736 GVariant *variant,
20737 GError **error,
20738 gpointer user_data)
20739{
20740 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data);
20741 GValue value = G_VALUE_INIT;
20742 GParamSpec *pspec;
20743 _ExtendedGDBusPropertyInfo *info;
20744 gboolean ret;
20745 ret = FALSE;
20746 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, property_name);
20747 g_assert (info != NULL);
20748 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
20749 if (pspec == NULL)
20750 {
20751 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
20752 }
20753 else
20754 {
20755 if (info->use_gvariant)
20756 g_value_set_variant (&value, variant);
20757 else
20758 g_dbus_gvariant_to_gvalue (variant, &value);
20759 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
20760 g_value_unset (&value);
20761 ret = TRUE;
20762 }
20763 return ret;
20764}
20765
20766static const GDBusInterfaceVTable _watchdog_skeleton_vtable =
20767{
20768 _watchdog_skeleton_handle_method_call,
20769 _watchdog_skeleton_handle_get_property,
20770 _watchdog_skeleton_handle_set_property,
20771 {NULL}
20772};
20773
20774static GDBusInterfaceInfo *
20775watchdog_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
20776{
20777 return watchdog_interface_info ();
20778}
20779
20780static GDBusInterfaceVTable *
20781watchdog_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
20782{
20783 return (GDBusInterfaceVTable *) &_watchdog_skeleton_vtable;
20784}
20785
20786static GVariant *
20787watchdog_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
20788{
20789 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (_skeleton);
20790
20791 GVariantBuilder builder;
20792 guint n;
20793 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
20794 if (_watchdog_interface_info.parent_struct.properties == NULL)
20795 goto out;
20796 for (n = 0; _watchdog_interface_info.parent_struct.properties[n] != NULL; n++)
20797 {
20798 GDBusPropertyInfo *info = _watchdog_interface_info.parent_struct.properties[n];
20799 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
20800 {
20801 GVariant *value;
20802 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);
20803 if (value != NULL)
20804 {
20805 g_variant_take_ref (value);
20806 g_variant_builder_add (&builder, "{sv}", info->name, value);
20807 g_variant_unref (value);
20808 }
20809 }
20810 }
20811out:
20812 return g_variant_builder_end (&builder);
20813}
20814
20815static gboolean _watchdog_emit_changed (gpointer user_data);
20816
20817static void
20818watchdog_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
20819{
20820 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (_skeleton);
20821 gboolean emit_changed = FALSE;
20822
20823 g_mutex_lock (&skeleton->priv->lock);
20824 if (skeleton->priv->changed_properties_idle_source != NULL)
20825 {
20826 g_source_destroy (skeleton->priv->changed_properties_idle_source);
20827 skeleton->priv->changed_properties_idle_source = NULL;
20828 emit_changed = TRUE;
20829 }
20830 g_mutex_unlock (&skeleton->priv->lock);
20831
20832 if (emit_changed)
20833 _watchdog_emit_changed (skeleton);
20834}
20835
20836static void
20837_watchdog_on_signal_watchdog_error (
20838 Watchdog *object)
20839{
20840 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
20841
20842 GList *connections, *l;
20843 GVariant *signal_variant;
20844 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
20845
20846 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
20847 for (l = connections; l != NULL; l = l->next)
20848 {
20849 GDBusConnection *connection = l->data;
20850 g_dbus_connection_emit_signal (connection,
20851 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Watchdog", "WatchdogError",
20852 signal_variant, NULL);
20853 }
20854 g_variant_unref (signal_variant);
20855 g_list_free_full (connections, g_object_unref);
20856}
20857
20858static void watchdog_skeleton_iface_init (WatchdogIface *iface);
20859#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
20860G_DEFINE_TYPE_WITH_CODE (WatchdogSkeleton, watchdog_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
20861 G_ADD_PRIVATE (WatchdogSkeleton)
20862 G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_skeleton_iface_init));
20863
20864#else
20865G_DEFINE_TYPE_WITH_CODE (WatchdogSkeleton, watchdog_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
20866 G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_skeleton_iface_init));
20867
20868#endif
20869static void
20870watchdog_skeleton_finalize (GObject *object)
20871{
20872 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
20873 guint n;
20874 for (n = 0; n < 2; n++)
20875 g_value_unset (&skeleton->priv->properties[n]);
20876 g_free (skeleton->priv->properties);
20877 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
20878 if (skeleton->priv->changed_properties_idle_source != NULL)
20879 g_source_destroy (skeleton->priv->changed_properties_idle_source);
20880 g_main_context_unref (skeleton->priv->context);
20881 g_mutex_clear (&skeleton->priv->lock);
20882 G_OBJECT_CLASS (watchdog_skeleton_parent_class)->finalize (object);
20883}
20884
20885static void
20886watchdog_skeleton_get_property (GObject *object,
20887 guint prop_id,
20888 GValue *value,
20889 GParamSpec *pspec G_GNUC_UNUSED)
20890{
20891 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
20892 g_assert (prop_id != 0 && prop_id - 1 < 2);
20893 g_mutex_lock (&skeleton->priv->lock);
20894 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
20895 g_mutex_unlock (&skeleton->priv->lock);
20896}
20897
20898static gboolean
20899_watchdog_emit_changed (gpointer user_data)
20900{
20901 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data);
20902 GList *l;
20903 GVariantBuilder builder;
20904 GVariantBuilder invalidated_builder;
20905 guint num_changes;
20906
20907 g_mutex_lock (&skeleton->priv->lock);
20908 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
20909 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
20910 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
20911 {
20912 ChangedProperty *cp = l->data;
20913 GVariant *variant;
20914 const GValue *cur_value;
20915
20916 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
20917 if (!_g_value_equal (cur_value, &cp->orig_value))
20918 {
20919 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
20920 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
20921 g_variant_unref (variant);
20922 num_changes++;
20923 }
20924 }
20925 if (num_changes > 0)
20926 {
20927 GList *connections, *ll;
20928 GVariant *signal_variant;
20929 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Watchdog",
20930 &builder, &invalidated_builder));
20931 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
20932 for (ll = connections; ll != NULL; ll = ll->next)
20933 {
20934 GDBusConnection *connection = ll->data;
20935
20936 g_dbus_connection_emit_signal (connection,
20937 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
20938 "org.freedesktop.DBus.Properties",
20939 "PropertiesChanged",
20940 signal_variant,
20941 NULL);
20942 }
20943 g_variant_unref (signal_variant);
20944 g_list_free_full (connections, g_object_unref);
20945 }
20946 else
20947 {
20948 g_variant_builder_clear (&builder);
20949 g_variant_builder_clear (&invalidated_builder);
20950 }
20951 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
20952 skeleton->priv->changed_properties = NULL;
20953 skeleton->priv->changed_properties_idle_source = NULL;
20954 g_mutex_unlock (&skeleton->priv->lock);
20955 return FALSE;
20956}
20957
20958static void
20959_watchdog_schedule_emit_changed (WatchdogSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
20960{
20961 ChangedProperty *cp;
20962 GList *l;
20963 cp = NULL;
20964 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
20965 {
20966 ChangedProperty *i_cp = l->data;
20967 if (i_cp->info == info)
20968 {
20969 cp = i_cp;
20970 break;
20971 }
20972 }
20973 if (cp == NULL)
20974 {
20975 cp = g_new0 (ChangedProperty, 1);
20976 cp->prop_id = prop_id;
20977 cp->info = info;
20978 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
20979 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
20980 g_value_copy (orig_value, &cp->orig_value);
20981 }
20982}
20983
20984static void
20985watchdog_skeleton_notify (GObject *object,
20986 GParamSpec *pspec G_GNUC_UNUSED)
20987{
20988 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
20989 g_mutex_lock (&skeleton->priv->lock);
20990 if (skeleton->priv->changed_properties != NULL &&
20991 skeleton->priv->changed_properties_idle_source == NULL)
20992 {
20993 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
20994 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
20995 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _watchdog_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
Adriana Kobylakfd778822016-06-16 09:08:37 -050020996 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _watchdog_emit_changed");
Norman James362a80f2015-09-14 14:04:39 -050020997 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
20998 g_source_unref (skeleton->priv->changed_properties_idle_source);
20999 }
21000 g_mutex_unlock (&skeleton->priv->lock);
21001}
21002
21003static void
21004watchdog_skeleton_set_property (GObject *object,
21005 guint prop_id,
21006 const GValue *value,
21007 GParamSpec *pspec)
21008{
21009 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
21010 g_assert (prop_id != 0 && prop_id - 1 < 2);
21011 g_mutex_lock (&skeleton->priv->lock);
21012 g_object_freeze_notify (object);
21013 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
21014 {
21015 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
21016 _watchdog_schedule_emit_changed (skeleton, _watchdog_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
21017 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
21018 g_object_notify_by_pspec (object, pspec);
21019 }
21020 g_mutex_unlock (&skeleton->priv->lock);
21021 g_object_thaw_notify (object);
21022}
21023
21024static void
21025watchdog_skeleton_init (WatchdogSkeleton *skeleton)
21026{
21027#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
21028 skeleton->priv = watchdog_skeleton_get_instance_private (skeleton);
21029#else
21030 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_WATCHDOG_SKELETON, WatchdogSkeletonPrivate);
21031#endif
21032
21033 g_mutex_init (&skeleton->priv->lock);
21034 skeleton->priv->context = g_main_context_ref_thread_default ();
21035 skeleton->priv->properties = g_new0 (GValue, 2);
21036 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
21037 g_value_init (&skeleton->priv->properties[1], G_TYPE_INT);
21038}
21039
21040static gint
21041watchdog_skeleton_get_watchdog (Watchdog *object)
21042{
21043 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
21044 gint value;
21045 g_mutex_lock (&skeleton->priv->lock);
21046 value = g_value_get_int (&(skeleton->priv->properties[0]));
21047 g_mutex_unlock (&skeleton->priv->lock);
21048 return value;
21049}
21050
21051static gint
21052watchdog_skeleton_get_poll_interval (Watchdog *object)
21053{
21054 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
21055 gint value;
21056 g_mutex_lock (&skeleton->priv->lock);
21057 value = g_value_get_int (&(skeleton->priv->properties[1]));
21058 g_mutex_unlock (&skeleton->priv->lock);
21059 return value;
21060}
21061
21062static void
21063watchdog_skeleton_class_init (WatchdogSkeletonClass *klass)
21064{
21065 GObjectClass *gobject_class;
21066 GDBusInterfaceSkeletonClass *skeleton_class;
21067
21068 gobject_class = G_OBJECT_CLASS (klass);
21069 gobject_class->finalize = watchdog_skeleton_finalize;
21070 gobject_class->get_property = watchdog_skeleton_get_property;
21071 gobject_class->set_property = watchdog_skeleton_set_property;
21072 gobject_class->notify = watchdog_skeleton_notify;
21073
21074
21075 watchdog_override_properties (gobject_class, 1);
21076
21077 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
21078 skeleton_class->get_info = watchdog_skeleton_dbus_interface_get_info;
21079 skeleton_class->get_properties = watchdog_skeleton_dbus_interface_get_properties;
21080 skeleton_class->flush = watchdog_skeleton_dbus_interface_flush;
21081 skeleton_class->get_vtable = watchdog_skeleton_dbus_interface_get_vtable;
21082
21083#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
21084 g_type_class_add_private (klass, sizeof (WatchdogSkeletonPrivate));
21085#endif
21086}
21087
21088static void
21089watchdog_skeleton_iface_init (WatchdogIface *iface)
21090{
21091 iface->watchdog_error = _watchdog_on_signal_watchdog_error;
21092 iface->get_watchdog = watchdog_skeleton_get_watchdog;
21093 iface->get_poll_interval = watchdog_skeleton_get_poll_interval;
21094}
21095
21096/**
21097 * watchdog_skeleton_new:
21098 *
21099 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link>.
21100 *
21101 * Returns: (transfer full) (type WatchdogSkeleton): The skeleton object.
21102 */
21103Watchdog *
21104watchdog_skeleton_new (void)
21105{
21106 return WATCHDOG (g_object_new (TYPE_WATCHDOG_SKELETON, NULL));
21107}
21108
21109/* ------------------------------------------------------------------------
21110 * Code for interface org.openbmc.EventLog
21111 * ------------------------------------------------------------------------
21112 */
21113
21114/**
21115 * SECTION:EventLog
21116 * @title: EventLog
21117 * @short_description: Generated C code for the org.openbmc.EventLog D-Bus interface
21118 *
21119 * 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.
21120 */
21121
21122/* ---- Introspection data for org.openbmc.EventLog ---- */
21123
Norman James2d1ee892015-09-16 23:13:45 -050021124static const _ExtendedGDBusArgInfo _event_log_method_info_get_event_log_OUT_ARG_log =
21125{
21126 {
21127 -1,
21128 (gchar *) "log",
21129 (gchar *) "a(s)",
21130 NULL
21131 },
21132 FALSE
21133};
21134
21135static const _ExtendedGDBusArgInfo * const _event_log_method_info_get_event_log_OUT_ARG_pointers[] =
21136{
21137 &_event_log_method_info_get_event_log_OUT_ARG_log,
21138 NULL
21139};
21140
21141static const _ExtendedGDBusMethodInfo _event_log_method_info_get_event_log =
21142{
21143 {
21144 -1,
21145 (gchar *) "getEventLog",
21146 NULL,
21147 (GDBusArgInfo **) &_event_log_method_info_get_event_log_OUT_ARG_pointers,
21148 NULL
21149 },
21150 "handle-get-event-log",
21151 FALSE
21152};
21153
21154static const _ExtendedGDBusMethodInfo * const _event_log_method_info_pointers[] =
21155{
21156 &_event_log_method_info_get_event_log,
21157 NULL
21158};
21159
Norman James8abb50c2015-09-16 10:58:16 -050021160static const _ExtendedGDBusArgInfo _event_log_signal_info_event_log_ARG_priority =
Norman James362a80f2015-09-14 14:04:39 -050021161{
21162 {
21163 -1,
Norman James8abb50c2015-09-16 10:58:16 -050021164 (gchar *) "priority",
21165 (gchar *) "i",
Norman James362a80f2015-09-14 14:04:39 -050021166 NULL
21167 },
21168 FALSE
21169};
21170
Norman James362a80f2015-09-14 14:04:39 -050021171static const _ExtendedGDBusArgInfo _event_log_signal_info_event_log_ARG_message =
21172{
21173 {
21174 -1,
21175 (gchar *) "message",
Norman James32e74e22015-09-15 21:28:06 -050021176 (gchar *) "s",
Norman James362a80f2015-09-14 14:04:39 -050021177 NULL
21178 },
21179 FALSE
21180};
21181
Norman James88872672015-09-21 16:51:35 -050021182static const _ExtendedGDBusArgInfo _event_log_signal_info_event_log_ARG_rc =
21183{
21184 {
21185 -1,
21186 (gchar *) "rc",
21187 (gchar *) "i",
21188 NULL
21189 },
21190 FALSE
21191};
21192
Norman James362a80f2015-09-14 14:04:39 -050021193static const _ExtendedGDBusArgInfo * const _event_log_signal_info_event_log_ARG_pointers[] =
21194{
Norman James8abb50c2015-09-16 10:58:16 -050021195 &_event_log_signal_info_event_log_ARG_priority,
Norman James362a80f2015-09-14 14:04:39 -050021196 &_event_log_signal_info_event_log_ARG_message,
Norman James88872672015-09-21 16:51:35 -050021197 &_event_log_signal_info_event_log_ARG_rc,
Norman James362a80f2015-09-14 14:04:39 -050021198 NULL
21199};
21200
21201static const _ExtendedGDBusSignalInfo _event_log_signal_info_event_log =
21202{
21203 {
21204 -1,
21205 (gchar *) "EventLog",
21206 (GDBusArgInfo **) &_event_log_signal_info_event_log_ARG_pointers,
21207 NULL
21208 },
21209 "event-log"
21210};
21211
21212static const _ExtendedGDBusSignalInfo * const _event_log_signal_info_pointers[] =
21213{
21214 &_event_log_signal_info_event_log,
21215 NULL
21216};
21217
Norman James362a80f2015-09-14 14:04:39 -050021218static const _ExtendedGDBusInterfaceInfo _event_log_interface_info =
21219{
21220 {
21221 -1,
21222 (gchar *) "org.openbmc.EventLog",
Norman James2d1ee892015-09-16 23:13:45 -050021223 (GDBusMethodInfo **) &_event_log_method_info_pointers,
Norman James362a80f2015-09-14 14:04:39 -050021224 (GDBusSignalInfo **) &_event_log_signal_info_pointers,
Norman James32e74e22015-09-15 21:28:06 -050021225 NULL,
Norman James362a80f2015-09-14 14:04:39 -050021226 NULL
21227 },
21228 "event-log",
21229};
21230
21231
21232/**
21233 * event_log_interface_info:
21234 *
21235 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link> D-Bus interface.
21236 *
21237 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
21238 */
21239GDBusInterfaceInfo *
21240event_log_interface_info (void)
21241{
21242 return (GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct;
21243}
21244
21245/**
21246 * event_log_override_properties:
21247 * @klass: The class structure for a #GObject<!-- -->-derived class.
21248 * @property_id_begin: The property id to assign to the first overridden property.
21249 *
21250 * Overrides all #GObject properties in the #EventLog interface for a concrete class.
21251 * The properties are overridden in the order they are defined.
21252 *
21253 * Returns: The last property id.
21254 */
21255guint
21256event_log_override_properties (GObjectClass *klass, guint property_id_begin)
21257{
Norman James362a80f2015-09-14 14:04:39 -050021258 return property_id_begin - 1;
21259}
21260
21261
21262
21263/**
21264 * EventLog:
21265 *
21266 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>.
21267 */
21268
21269/**
21270 * EventLogIface:
21271 * @parent_iface: The parent interface.
Norman James2d1ee892015-09-16 23:13:45 -050021272 * @handle_get_event_log: Handler for the #EventLog::handle-get-event-log signal.
Norman James362a80f2015-09-14 14:04:39 -050021273 * @event_log: Handler for the #EventLog::event-log signal.
21274 *
21275 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>.
21276 */
21277
21278typedef EventLogIface EventLogInterface;
21279G_DEFINE_INTERFACE (EventLog, event_log, G_TYPE_OBJECT);
21280
21281static void
21282event_log_default_init (EventLogIface *iface)
21283{
Norman James2d1ee892015-09-16 23:13:45 -050021284 /* GObject signals for incoming D-Bus method calls: */
21285 /**
21286 * EventLog::handle-get-event-log:
21287 * @object: A #EventLog.
21288 * @invocation: A #GDBusMethodInvocation.
21289 *
21290 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-EventLog.getEventLog">getEventLog()</link> D-Bus method.
21291 *
21292 * 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.
21293 *
21294 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
21295 */
21296 g_signal_new ("handle-get-event-log",
21297 G_TYPE_FROM_INTERFACE (iface),
21298 G_SIGNAL_RUN_LAST,
21299 G_STRUCT_OFFSET (EventLogIface, handle_get_event_log),
21300 g_signal_accumulator_true_handled,
21301 NULL,
21302 g_cclosure_marshal_generic,
21303 G_TYPE_BOOLEAN,
21304 1,
21305 G_TYPE_DBUS_METHOD_INVOCATION);
21306
Norman James362a80f2015-09-14 14:04:39 -050021307 /* GObject signals for received D-Bus signals: */
21308 /**
21309 * EventLog::event-log:
21310 * @object: A #EventLog.
Norman James8abb50c2015-09-16 10:58:16 -050021311 * @arg_priority: Argument.
Norman James362a80f2015-09-14 14:04:39 -050021312 * @arg_message: Argument.
Norman James88872672015-09-21 16:51:35 -050021313 * @arg_rc: Argument.
Norman James362a80f2015-09-14 14:04:39 -050021314 *
21315 * 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.
21316 *
21317 * 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.
21318 */
21319 g_signal_new ("event-log",
21320 G_TYPE_FROM_INTERFACE (iface),
21321 G_SIGNAL_RUN_LAST,
21322 G_STRUCT_OFFSET (EventLogIface, event_log),
21323 NULL,
21324 NULL,
21325 g_cclosure_marshal_generic,
21326 G_TYPE_NONE,
Norman James88872672015-09-21 16:51:35 -050021327 3, G_TYPE_INT, G_TYPE_STRING, G_TYPE_INT);
Norman James362a80f2015-09-14 14:04:39 -050021328
Norman James362a80f2015-09-14 14:04:39 -050021329}
21330
21331/**
21332 * event_log_emit_event_log:
21333 * @object: A #EventLog.
Norman James8abb50c2015-09-16 10:58:16 -050021334 * @arg_priority: Argument to pass with the signal.
Norman James362a80f2015-09-14 14:04:39 -050021335 * @arg_message: Argument to pass with the signal.
Norman James88872672015-09-21 16:51:35 -050021336 * @arg_rc: Argument to pass with the signal.
Norman James362a80f2015-09-14 14:04:39 -050021337 *
21338 * Emits the <link linkend="gdbus-signal-org-openbmc-EventLog.EventLog">"EventLog"</link> D-Bus signal.
21339 */
21340void
21341event_log_emit_event_log (
21342 EventLog *object,
Norman James8abb50c2015-09-16 10:58:16 -050021343 gint arg_priority,
Norman James88872672015-09-21 16:51:35 -050021344 const gchar *arg_message,
21345 gint arg_rc)
Norman James362a80f2015-09-14 14:04:39 -050021346{
Norman James88872672015-09-21 16:51:35 -050021347 g_signal_emit_by_name (object, "event-log", arg_priority, arg_message, arg_rc);
Norman James362a80f2015-09-14 14:04:39 -050021348}
21349
Norman James2d1ee892015-09-16 23:13:45 -050021350/**
21351 * event_log_call_get_event_log:
21352 * @proxy: A #EventLogProxy.
21353 * @cancellable: (allow-none): A #GCancellable or %NULL.
21354 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
21355 * @user_data: User data to pass to @callback.
21356 *
21357 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-EventLog.getEventLog">getEventLog()</link> D-Bus method on @proxy.
21358 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
21359 * You can then call event_log_call_get_event_log_finish() to get the result of the operation.
21360 *
21361 * See event_log_call_get_event_log_sync() for the synchronous, blocking version of this method.
21362 */
21363void
21364event_log_call_get_event_log (
21365 EventLog *proxy,
21366 GCancellable *cancellable,
21367 GAsyncReadyCallback callback,
21368 gpointer user_data)
21369{
21370 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
21371 "getEventLog",
21372 g_variant_new ("()"),
21373 G_DBUS_CALL_FLAGS_NONE,
21374 -1,
21375 cancellable,
21376 callback,
21377 user_data);
21378}
21379
21380/**
21381 * event_log_call_get_event_log_finish:
21382 * @proxy: A #EventLogProxy.
21383 * @out_log: (out): Return location for return parameter or %NULL to ignore.
21384 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to event_log_call_get_event_log().
21385 * @error: Return location for error or %NULL.
21386 *
21387 * Finishes an operation started with event_log_call_get_event_log().
21388 *
21389 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
21390 */
21391gboolean
21392event_log_call_get_event_log_finish (
21393 EventLog *proxy,
21394 GVariant **out_log,
21395 GAsyncResult *res,
21396 GError **error)
21397{
21398 GVariant *_ret;
21399 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
21400 if (_ret == NULL)
21401 goto _out;
21402 g_variant_get (_ret,
21403 "(@a(s))",
21404 out_log);
21405 g_variant_unref (_ret);
21406_out:
21407 return _ret != NULL;
21408}
21409
21410/**
21411 * event_log_call_get_event_log_sync:
21412 * @proxy: A #EventLogProxy.
21413 * @out_log: (out): Return location for return parameter or %NULL to ignore.
21414 * @cancellable: (allow-none): A #GCancellable or %NULL.
21415 * @error: Return location for error or %NULL.
21416 *
21417 * 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.
21418 *
21419 * See event_log_call_get_event_log() for the asynchronous version of this method.
21420 *
21421 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
21422 */
21423gboolean
21424event_log_call_get_event_log_sync (
21425 EventLog *proxy,
21426 GVariant **out_log,
21427 GCancellable *cancellable,
21428 GError **error)
21429{
21430 GVariant *_ret;
21431 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
21432 "getEventLog",
21433 g_variant_new ("()"),
21434 G_DBUS_CALL_FLAGS_NONE,
21435 -1,
21436 cancellable,
21437 error);
21438 if (_ret == NULL)
21439 goto _out;
21440 g_variant_get (_ret,
21441 "(@a(s))",
21442 out_log);
21443 g_variant_unref (_ret);
21444_out:
21445 return _ret != NULL;
21446}
21447
21448/**
21449 * event_log_complete_get_event_log:
21450 * @object: A #EventLog.
21451 * @invocation: (transfer full): A #GDBusMethodInvocation.
21452 * @log: Parameter to return.
21453 *
21454 * 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.
21455 *
21456 * This method will free @invocation, you cannot use it afterwards.
21457 */
21458void
21459event_log_complete_get_event_log (
21460 EventLog *object,
21461 GDBusMethodInvocation *invocation,
21462 GVariant *log)
21463{
21464 g_dbus_method_invocation_return_value (invocation,
21465 g_variant_new ("(@a(s))",
21466 log));
21467}
21468
Norman James362a80f2015-09-14 14:04:39 -050021469/* ------------------------------------------------------------------------ */
21470
21471/**
21472 * EventLogProxy:
21473 *
21474 * The #EventLogProxy structure contains only private data and should only be accessed using the provided API.
21475 */
21476
21477/**
21478 * EventLogProxyClass:
21479 * @parent_class: The parent class.
21480 *
21481 * Class structure for #EventLogProxy.
21482 */
21483
21484struct _EventLogProxyPrivate
21485{
21486 GData *qdata;
21487};
21488
21489static void event_log_proxy_iface_init (EventLogIface *iface);
21490
21491#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
21492G_DEFINE_TYPE_WITH_CODE (EventLogProxy, event_log_proxy, G_TYPE_DBUS_PROXY,
21493 G_ADD_PRIVATE (EventLogProxy)
21494 G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_proxy_iface_init));
21495
21496#else
21497G_DEFINE_TYPE_WITH_CODE (EventLogProxy, event_log_proxy, G_TYPE_DBUS_PROXY,
21498 G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_proxy_iface_init));
21499
21500#endif
21501static void
21502event_log_proxy_finalize (GObject *object)
21503{
21504 EventLogProxy *proxy = EVENT_LOG_PROXY (object);
21505 g_datalist_clear (&proxy->priv->qdata);
21506 G_OBJECT_CLASS (event_log_proxy_parent_class)->finalize (object);
21507}
21508
21509static void
21510event_log_proxy_get_property (GObject *object,
21511 guint prop_id,
21512 GValue *value,
21513 GParamSpec *pspec G_GNUC_UNUSED)
21514{
Norman James362a80f2015-09-14 14:04:39 -050021515}
21516
21517static void
21518event_log_proxy_set_property (GObject *object,
21519 guint prop_id,
21520 const GValue *value,
21521 GParamSpec *pspec G_GNUC_UNUSED)
21522{
Norman James362a80f2015-09-14 14:04:39 -050021523}
21524
21525static void
21526event_log_proxy_g_signal (GDBusProxy *proxy,
21527 const gchar *sender_name G_GNUC_UNUSED,
21528 const gchar *signal_name,
21529 GVariant *parameters)
21530{
21531 _ExtendedGDBusSignalInfo *info;
21532 GVariantIter iter;
21533 GVariant *child;
21534 GValue *paramv;
21535 guint num_params;
21536 guint n;
21537 guint signal_id;
21538 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, signal_name);
21539 if (info == NULL)
21540 return;
21541 num_params = g_variant_n_children (parameters);
21542 paramv = g_new0 (GValue, num_params + 1);
21543 g_value_init (&paramv[0], TYPE_EVENT_LOG);
21544 g_value_set_object (&paramv[0], proxy);
21545 g_variant_iter_init (&iter, parameters);
21546 n = 1;
21547 while ((child = g_variant_iter_next_value (&iter)) != NULL)
21548 {
21549 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
21550 if (arg_info->use_gvariant)
21551 {
21552 g_value_init (&paramv[n], G_TYPE_VARIANT);
21553 g_value_set_variant (&paramv[n], child);
21554 n++;
21555 }
21556 else
21557 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
21558 g_variant_unref (child);
21559 }
21560 signal_id = g_signal_lookup (info->signal_name, TYPE_EVENT_LOG);
21561 g_signal_emitv (paramv, signal_id, 0, NULL);
21562 for (n = 0; n < num_params + 1; n++)
21563 g_value_unset (&paramv[n]);
21564 g_free (paramv);
21565}
21566
21567static void
21568event_log_proxy_g_properties_changed (GDBusProxy *_proxy,
21569 GVariant *changed_properties,
21570 const gchar *const *invalidated_properties)
21571{
21572 EventLogProxy *proxy = EVENT_LOG_PROXY (_proxy);
21573 guint n;
21574 const gchar *key;
21575 GVariantIter *iter;
21576 _ExtendedGDBusPropertyInfo *info;
21577 g_variant_get (changed_properties, "a{sv}", &iter);
21578 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
21579 {
21580 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, key);
21581 g_datalist_remove_data (&proxy->priv->qdata, key);
21582 if (info != NULL)
21583 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
21584 }
21585 g_variant_iter_free (iter);
21586 for (n = 0; invalidated_properties[n] != NULL; n++)
21587 {
21588 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, invalidated_properties[n]);
21589 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
21590 if (info != NULL)
21591 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
21592 }
21593}
21594
Norman James362a80f2015-09-14 14:04:39 -050021595static void
21596event_log_proxy_init (EventLogProxy *proxy)
21597{
21598#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
21599 proxy->priv = event_log_proxy_get_instance_private (proxy);
21600#else
21601 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_EVENT_LOG_PROXY, EventLogProxyPrivate);
21602#endif
21603
21604 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), event_log_interface_info ());
21605}
21606
21607static void
21608event_log_proxy_class_init (EventLogProxyClass *klass)
21609{
21610 GObjectClass *gobject_class;
21611 GDBusProxyClass *proxy_class;
21612
21613 gobject_class = G_OBJECT_CLASS (klass);
21614 gobject_class->finalize = event_log_proxy_finalize;
21615 gobject_class->get_property = event_log_proxy_get_property;
21616 gobject_class->set_property = event_log_proxy_set_property;
21617
21618 proxy_class = G_DBUS_PROXY_CLASS (klass);
21619 proxy_class->g_signal = event_log_proxy_g_signal;
21620 proxy_class->g_properties_changed = event_log_proxy_g_properties_changed;
21621
Norman James362a80f2015-09-14 14:04:39 -050021622#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
21623 g_type_class_add_private (klass, sizeof (EventLogProxyPrivate));
21624#endif
21625}
21626
21627static void
21628event_log_proxy_iface_init (EventLogIface *iface)
21629{
Norman James362a80f2015-09-14 14:04:39 -050021630}
21631
21632/**
21633 * event_log_proxy_new:
21634 * @connection: A #GDBusConnection.
21635 * @flags: Flags from the #GDBusProxyFlags enumeration.
21636 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
21637 * @object_path: An object path.
21638 * @cancellable: (allow-none): A #GCancellable or %NULL.
21639 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
21640 * @user_data: User data to pass to @callback.
21641 *
21642 * 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.
21643 *
21644 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
21645 * You can then call event_log_proxy_new_finish() to get the result of the operation.
21646 *
21647 * See event_log_proxy_new_sync() for the synchronous, blocking version of this constructor.
21648 */
21649void
21650event_log_proxy_new (
21651 GDBusConnection *connection,
21652 GDBusProxyFlags flags,
21653 const gchar *name,
21654 const gchar *object_path,
21655 GCancellable *cancellable,
21656 GAsyncReadyCallback callback,
21657 gpointer user_data)
21658{
21659 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);
21660}
21661
21662/**
21663 * event_log_proxy_new_finish:
21664 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to event_log_proxy_new().
21665 * @error: Return location for error or %NULL
21666 *
21667 * Finishes an operation started with event_log_proxy_new().
21668 *
21669 * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set.
21670 */
21671EventLog *
21672event_log_proxy_new_finish (
21673 GAsyncResult *res,
21674 GError **error)
21675{
21676 GObject *ret;
21677 GObject *source_object;
21678 source_object = g_async_result_get_source_object (res);
21679 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
21680 g_object_unref (source_object);
21681 if (ret != NULL)
21682 return EVENT_LOG (ret);
21683 else
21684 return NULL;
21685}
21686
21687/**
21688 * event_log_proxy_new_sync:
21689 * @connection: A #GDBusConnection.
21690 * @flags: Flags from the #GDBusProxyFlags enumeration.
21691 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
21692 * @object_path: An object path.
21693 * @cancellable: (allow-none): A #GCancellable or %NULL.
21694 * @error: Return location for error or %NULL
21695 *
21696 * 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.
21697 *
21698 * The calling thread is blocked until a reply is received.
21699 *
21700 * See event_log_proxy_new() for the asynchronous version of this constructor.
21701 *
21702 * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set.
21703 */
21704EventLog *
21705event_log_proxy_new_sync (
21706 GDBusConnection *connection,
21707 GDBusProxyFlags flags,
21708 const gchar *name,
21709 const gchar *object_path,
21710 GCancellable *cancellable,
21711 GError **error)
21712{
21713 GInitable *ret;
21714 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);
21715 if (ret != NULL)
21716 return EVENT_LOG (ret);
21717 else
21718 return NULL;
21719}
21720
21721
21722/**
21723 * event_log_proxy_new_for_bus:
21724 * @bus_type: A #GBusType.
21725 * @flags: Flags from the #GDBusProxyFlags enumeration.
21726 * @name: A bus name (well-known or unique).
21727 * @object_path: An object path.
21728 * @cancellable: (allow-none): A #GCancellable or %NULL.
21729 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
21730 * @user_data: User data to pass to @callback.
21731 *
21732 * Like event_log_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
21733 *
21734 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
21735 * You can then call event_log_proxy_new_for_bus_finish() to get the result of the operation.
21736 *
21737 * See event_log_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
21738 */
21739void
21740event_log_proxy_new_for_bus (
21741 GBusType bus_type,
21742 GDBusProxyFlags flags,
21743 const gchar *name,
21744 const gchar *object_path,
21745 GCancellable *cancellable,
21746 GAsyncReadyCallback callback,
21747 gpointer user_data)
21748{
21749 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);
21750}
21751
21752/**
21753 * event_log_proxy_new_for_bus_finish:
21754 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to event_log_proxy_new_for_bus().
21755 * @error: Return location for error or %NULL
21756 *
21757 * Finishes an operation started with event_log_proxy_new_for_bus().
21758 *
21759 * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set.
21760 */
21761EventLog *
21762event_log_proxy_new_for_bus_finish (
21763 GAsyncResult *res,
21764 GError **error)
21765{
21766 GObject *ret;
21767 GObject *source_object;
21768 source_object = g_async_result_get_source_object (res);
21769 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
21770 g_object_unref (source_object);
21771 if (ret != NULL)
21772 return EVENT_LOG (ret);
21773 else
21774 return NULL;
21775}
21776
21777/**
21778 * event_log_proxy_new_for_bus_sync:
21779 * @bus_type: A #GBusType.
21780 * @flags: Flags from the #GDBusProxyFlags enumeration.
21781 * @name: A bus name (well-known or unique).
21782 * @object_path: An object path.
21783 * @cancellable: (allow-none): A #GCancellable or %NULL.
21784 * @error: Return location for error or %NULL
21785 *
21786 * Like event_log_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
21787 *
21788 * The calling thread is blocked until a reply is received.
21789 *
21790 * See event_log_proxy_new_for_bus() for the asynchronous version of this constructor.
21791 *
21792 * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set.
21793 */
21794EventLog *
21795event_log_proxy_new_for_bus_sync (
21796 GBusType bus_type,
21797 GDBusProxyFlags flags,
21798 const gchar *name,
21799 const gchar *object_path,
21800 GCancellable *cancellable,
21801 GError **error)
21802{
21803 GInitable *ret;
21804 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);
21805 if (ret != NULL)
21806 return EVENT_LOG (ret);
21807 else
21808 return NULL;
21809}
21810
21811
21812/* ------------------------------------------------------------------------ */
21813
21814/**
21815 * EventLogSkeleton:
21816 *
21817 * The #EventLogSkeleton structure contains only private data and should only be accessed using the provided API.
21818 */
21819
21820/**
21821 * EventLogSkeletonClass:
21822 * @parent_class: The parent class.
21823 *
21824 * Class structure for #EventLogSkeleton.
21825 */
21826
21827struct _EventLogSkeletonPrivate
21828{
21829 GValue *properties;
21830 GList *changed_properties;
21831 GSource *changed_properties_idle_source;
21832 GMainContext *context;
21833 GMutex lock;
21834};
21835
21836static void
21837_event_log_skeleton_handle_method_call (
21838 GDBusConnection *connection G_GNUC_UNUSED,
21839 const gchar *sender G_GNUC_UNUSED,
21840 const gchar *object_path G_GNUC_UNUSED,
21841 const gchar *interface_name,
21842 const gchar *method_name,
21843 GVariant *parameters,
21844 GDBusMethodInvocation *invocation,
21845 gpointer user_data)
21846{
21847 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (user_data);
21848 _ExtendedGDBusMethodInfo *info;
21849 GVariantIter iter;
21850 GVariant *child;
21851 GValue *paramv;
21852 guint num_params;
21853 guint num_extra;
21854 guint n;
21855 guint signal_id;
21856 GValue return_value = G_VALUE_INIT;
21857 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
21858 g_assert (info != NULL);
21859 num_params = g_variant_n_children (parameters);
21860 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
21861 n = 0;
21862 g_value_init (&paramv[n], TYPE_EVENT_LOG);
21863 g_value_set_object (&paramv[n++], skeleton);
21864 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
21865 g_value_set_object (&paramv[n++], invocation);
21866 if (info->pass_fdlist)
21867 {
21868#ifdef G_OS_UNIX
21869 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
21870 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
21871#else
21872 g_assert_not_reached ();
21873#endif
21874 }
21875 g_variant_iter_init (&iter, parameters);
21876 while ((child = g_variant_iter_next_value (&iter)) != NULL)
21877 {
21878 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
21879 if (arg_info->use_gvariant)
21880 {
21881 g_value_init (&paramv[n], G_TYPE_VARIANT);
21882 g_value_set_variant (&paramv[n], child);
21883 n++;
21884 }
21885 else
21886 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
21887 g_variant_unref (child);
21888 }
21889 signal_id = g_signal_lookup (info->signal_name, TYPE_EVENT_LOG);
21890 g_value_init (&return_value, G_TYPE_BOOLEAN);
21891 g_signal_emitv (paramv, signal_id, 0, &return_value);
21892 if (!g_value_get_boolean (&return_value))
21893 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);
21894 g_value_unset (&return_value);
21895 for (n = 0; n < num_params + num_extra; n++)
21896 g_value_unset (&paramv[n]);
21897 g_free (paramv);
21898}
21899
21900static GVariant *
21901_event_log_skeleton_handle_get_property (
21902 GDBusConnection *connection G_GNUC_UNUSED,
21903 const gchar *sender G_GNUC_UNUSED,
21904 const gchar *object_path G_GNUC_UNUSED,
21905 const gchar *interface_name G_GNUC_UNUSED,
21906 const gchar *property_name,
21907 GError **error,
21908 gpointer user_data)
21909{
21910 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (user_data);
21911 GValue value = G_VALUE_INIT;
21912 GParamSpec *pspec;
21913 _ExtendedGDBusPropertyInfo *info;
21914 GVariant *ret;
21915 ret = NULL;
21916 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, property_name);
21917 g_assert (info != NULL);
21918 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
21919 if (pspec == NULL)
21920 {
21921 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
21922 }
21923 else
21924 {
21925 g_value_init (&value, pspec->value_type);
21926 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
21927 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
21928 g_value_unset (&value);
21929 }
21930 return ret;
21931}
21932
21933static gboolean
21934_event_log_skeleton_handle_set_property (
21935 GDBusConnection *connection G_GNUC_UNUSED,
21936 const gchar *sender G_GNUC_UNUSED,
21937 const gchar *object_path G_GNUC_UNUSED,
21938 const gchar *interface_name G_GNUC_UNUSED,
21939 const gchar *property_name,
21940 GVariant *variant,
21941 GError **error,
21942 gpointer user_data)
21943{
21944 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (user_data);
21945 GValue value = G_VALUE_INIT;
21946 GParamSpec *pspec;
21947 _ExtendedGDBusPropertyInfo *info;
21948 gboolean ret;
21949 ret = FALSE;
21950 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, property_name);
21951 g_assert (info != NULL);
21952 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
21953 if (pspec == NULL)
21954 {
21955 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
21956 }
21957 else
21958 {
21959 if (info->use_gvariant)
21960 g_value_set_variant (&value, variant);
21961 else
21962 g_dbus_gvariant_to_gvalue (variant, &value);
21963 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
21964 g_value_unset (&value);
21965 ret = TRUE;
21966 }
21967 return ret;
21968}
21969
21970static const GDBusInterfaceVTable _event_log_skeleton_vtable =
21971{
21972 _event_log_skeleton_handle_method_call,
21973 _event_log_skeleton_handle_get_property,
21974 _event_log_skeleton_handle_set_property,
21975 {NULL}
21976};
21977
21978static GDBusInterfaceInfo *
21979event_log_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
21980{
21981 return event_log_interface_info ();
21982}
21983
21984static GDBusInterfaceVTable *
21985event_log_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
21986{
21987 return (GDBusInterfaceVTable *) &_event_log_skeleton_vtable;
21988}
21989
21990static GVariant *
21991event_log_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
21992{
21993 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (_skeleton);
21994
21995 GVariantBuilder builder;
21996 guint n;
21997 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
21998 if (_event_log_interface_info.parent_struct.properties == NULL)
21999 goto out;
22000 for (n = 0; _event_log_interface_info.parent_struct.properties[n] != NULL; n++)
22001 {
22002 GDBusPropertyInfo *info = _event_log_interface_info.parent_struct.properties[n];
22003 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
22004 {
22005 GVariant *value;
22006 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);
22007 if (value != NULL)
22008 {
22009 g_variant_take_ref (value);
22010 g_variant_builder_add (&builder, "{sv}", info->name, value);
22011 g_variant_unref (value);
22012 }
22013 }
22014 }
22015out:
22016 return g_variant_builder_end (&builder);
22017}
22018
Norman James362a80f2015-09-14 14:04:39 -050022019static void
22020event_log_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
22021{
Norman James362a80f2015-09-14 14:04:39 -050022022}
22023
22024static void
22025_event_log_on_signal_event_log (
22026 EventLog *object,
Norman James8abb50c2015-09-16 10:58:16 -050022027 gint arg_priority,
Norman James88872672015-09-21 16:51:35 -050022028 const gchar *arg_message,
22029 gint arg_rc)
Norman James362a80f2015-09-14 14:04:39 -050022030{
22031 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (object);
22032
22033 GList *connections, *l;
22034 GVariant *signal_variant;
22035 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
22036
Norman James88872672015-09-21 16:51:35 -050022037 signal_variant = g_variant_ref_sink (g_variant_new ("(isi)",
Norman James8abb50c2015-09-16 10:58:16 -050022038 arg_priority,
Norman James88872672015-09-21 16:51:35 -050022039 arg_message,
22040 arg_rc));
Norman James362a80f2015-09-14 14:04:39 -050022041 for (l = connections; l != NULL; l = l->next)
22042 {
22043 GDBusConnection *connection = l->data;
22044 g_dbus_connection_emit_signal (connection,
22045 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.EventLog", "EventLog",
22046 signal_variant, NULL);
22047 }
22048 g_variant_unref (signal_variant);
22049 g_list_free_full (connections, g_object_unref);
22050}
22051
22052static void event_log_skeleton_iface_init (EventLogIface *iface);
22053#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
22054G_DEFINE_TYPE_WITH_CODE (EventLogSkeleton, event_log_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
22055 G_ADD_PRIVATE (EventLogSkeleton)
22056 G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_skeleton_iface_init));
22057
22058#else
22059G_DEFINE_TYPE_WITH_CODE (EventLogSkeleton, event_log_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
22060 G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_skeleton_iface_init));
22061
22062#endif
22063static void
22064event_log_skeleton_finalize (GObject *object)
22065{
22066 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (object);
Norman James362a80f2015-09-14 14:04:39 -050022067 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
22068 if (skeleton->priv->changed_properties_idle_source != NULL)
22069 g_source_destroy (skeleton->priv->changed_properties_idle_source);
22070 g_main_context_unref (skeleton->priv->context);
22071 g_mutex_clear (&skeleton->priv->lock);
22072 G_OBJECT_CLASS (event_log_skeleton_parent_class)->finalize (object);
22073}
22074
22075static void
Norman James362a80f2015-09-14 14:04:39 -050022076event_log_skeleton_init (EventLogSkeleton *skeleton)
22077{
22078#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
22079 skeleton->priv = event_log_skeleton_get_instance_private (skeleton);
22080#else
22081 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_EVENT_LOG_SKELETON, EventLogSkeletonPrivate);
22082#endif
22083
22084 g_mutex_init (&skeleton->priv->lock);
22085 skeleton->priv->context = g_main_context_ref_thread_default ();
Norman James362a80f2015-09-14 14:04:39 -050022086}
22087
22088static void
22089event_log_skeleton_class_init (EventLogSkeletonClass *klass)
22090{
22091 GObjectClass *gobject_class;
22092 GDBusInterfaceSkeletonClass *skeleton_class;
22093
22094 gobject_class = G_OBJECT_CLASS (klass);
22095 gobject_class->finalize = event_log_skeleton_finalize;
Norman James362a80f2015-09-14 14:04:39 -050022096
22097 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
22098 skeleton_class->get_info = event_log_skeleton_dbus_interface_get_info;
22099 skeleton_class->get_properties = event_log_skeleton_dbus_interface_get_properties;
22100 skeleton_class->flush = event_log_skeleton_dbus_interface_flush;
22101 skeleton_class->get_vtable = event_log_skeleton_dbus_interface_get_vtable;
22102
22103#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
22104 g_type_class_add_private (klass, sizeof (EventLogSkeletonPrivate));
22105#endif
22106}
22107
22108static void
22109event_log_skeleton_iface_init (EventLogIface *iface)
22110{
22111 iface->event_log = _event_log_on_signal_event_log;
Norman James362a80f2015-09-14 14:04:39 -050022112}
22113
22114/**
22115 * event_log_skeleton_new:
22116 *
22117 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>.
22118 *
22119 * Returns: (transfer full) (type EventLogSkeleton): The skeleton object.
22120 */
22121EventLog *
22122event_log_skeleton_new (void)
22123{
22124 return EVENT_LOG (g_object_new (TYPE_EVENT_LOG_SKELETON, NULL));
22125}
22126
22127/* ------------------------------------------------------------------------
22128 * Code for interface org.openbmc.Flash
22129 * ------------------------------------------------------------------------
22130 */
22131
22132/**
22133 * SECTION:Flash
22134 * @title: Flash
22135 * @short_description: Generated C code for the org.openbmc.Flash D-Bus interface
22136 *
22137 * 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.
22138 */
22139
22140/* ---- Introspection data for org.openbmc.Flash ---- */
22141
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022142static const _ExtendedGDBusArgInfo _flash_method_info_update_IN_ARG_filename =
Norman James362a80f2015-09-14 14:04:39 -050022143{
22144 {
22145 -1,
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022146 (gchar *) "filename",
Norman James362a80f2015-09-14 14:04:39 -050022147 (gchar *) "s",
22148 NULL
22149 },
22150 FALSE
22151};
22152
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022153static const _ExtendedGDBusArgInfo * const _flash_method_info_update_IN_ARG_pointers[] =
Norman James362a80f2015-09-14 14:04:39 -050022154{
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022155 &_flash_method_info_update_IN_ARG_filename,
Norman James362a80f2015-09-14 14:04:39 -050022156 NULL
22157};
22158
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022159static const _ExtendedGDBusMethodInfo _flash_method_info_update =
Norman James362a80f2015-09-14 14:04:39 -050022160{
22161 {
22162 -1,
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022163 (gchar *) "update",
22164 (GDBusArgInfo **) &_flash_method_info_update_IN_ARG_pointers,
Norman James362a80f2015-09-14 14:04:39 -050022165 NULL,
22166 NULL
22167 },
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022168 "handle-update",
Norman James362a80f2015-09-14 14:04:39 -050022169 FALSE
22170};
22171
Norman James166acf42015-10-22 07:11:51 -050022172static const _ExtendedGDBusArgInfo _flash_method_info_error_IN_ARG_message =
22173{
22174 {
22175 -1,
22176 (gchar *) "message",
22177 (gchar *) "s",
22178 NULL
22179 },
22180 FALSE
22181};
22182
22183static const _ExtendedGDBusArgInfo * const _flash_method_info_error_IN_ARG_pointers[] =
22184{
22185 &_flash_method_info_error_IN_ARG_message,
22186 NULL
22187};
22188
22189static const _ExtendedGDBusMethodInfo _flash_method_info_error =
22190{
22191 {
22192 -1,
22193 (gchar *) "error",
22194 (GDBusArgInfo **) &_flash_method_info_error_IN_ARG_pointers,
22195 NULL,
22196 NULL
22197 },
22198 "handle-error",
22199 FALSE
22200};
22201
22202static const _ExtendedGDBusMethodInfo _flash_method_info_done =
22203{
22204 {
22205 -1,
22206 (gchar *) "done",
22207 NULL,
22208 NULL,
22209 NULL
22210 },
22211 "handle-done",
22212 FALSE
22213};
22214
Norman Jamesf066e872015-10-07 15:29:51 -050022215static const _ExtendedGDBusArgInfo _flash_method_info_update_via_tftp_IN_ARG_url =
22216{
22217 {
22218 -1,
22219 (gchar *) "url",
22220 (gchar *) "s",
22221 NULL
22222 },
22223 FALSE
22224};
22225
22226static const _ExtendedGDBusArgInfo _flash_method_info_update_via_tftp_IN_ARG_filename =
22227{
22228 {
22229 -1,
22230 (gchar *) "filename",
22231 (gchar *) "s",
22232 NULL
22233 },
22234 FALSE
22235};
22236
22237static const _ExtendedGDBusArgInfo * const _flash_method_info_update_via_tftp_IN_ARG_pointers[] =
22238{
22239 &_flash_method_info_update_via_tftp_IN_ARG_url,
22240 &_flash_method_info_update_via_tftp_IN_ARG_filename,
22241 NULL
22242};
22243
22244static const _ExtendedGDBusMethodInfo _flash_method_info_update_via_tftp =
22245{
22246 {
22247 -1,
22248 (gchar *) "updateViaTftp",
22249 (GDBusArgInfo **) &_flash_method_info_update_via_tftp_IN_ARG_pointers,
22250 NULL,
22251 NULL
22252 },
22253 "handle-update-via-tftp",
22254 FALSE
22255};
22256
Norman James362a80f2015-09-14 14:04:39 -050022257static const _ExtendedGDBusMethodInfo _flash_method_info_init =
22258{
22259 {
22260 -1,
22261 (gchar *) "init",
22262 NULL,
22263 NULL,
22264 NULL
22265 },
22266 "handle-init",
22267 FALSE
22268};
22269
22270static const _ExtendedGDBusMethodInfo * const _flash_method_info_pointers[] =
22271{
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022272 &_flash_method_info_update,
Norman James166acf42015-10-22 07:11:51 -050022273 &_flash_method_info_error,
22274 &_flash_method_info_done,
Norman Jamesf066e872015-10-07 15:29:51 -050022275 &_flash_method_info_update_via_tftp,
Norman James362a80f2015-09-14 14:04:39 -050022276 &_flash_method_info_init,
22277 NULL
22278};
22279
22280static const _ExtendedGDBusSignalInfo _flash_signal_info_updated =
22281{
22282 {
22283 -1,
22284 (gchar *) "Updated",
22285 NULL,
22286 NULL
22287 },
22288 "updated"
22289};
22290
Norman Jamesf066e872015-10-07 15:29:51 -050022291static const _ExtendedGDBusArgInfo _flash_signal_info_download_ARG_url =
22292{
22293 {
22294 -1,
22295 (gchar *) "url",
22296 (gchar *) "s",
22297 NULL
22298 },
22299 FALSE
22300};
22301
22302static const _ExtendedGDBusArgInfo _flash_signal_info_download_ARG_filename =
22303{
22304 {
22305 -1,
22306 (gchar *) "filename",
22307 (gchar *) "s",
22308 NULL
22309 },
22310 FALSE
22311};
22312
22313static const _ExtendedGDBusArgInfo * const _flash_signal_info_download_ARG_pointers[] =
22314{
22315 &_flash_signal_info_download_ARG_url,
22316 &_flash_signal_info_download_ARG_filename,
22317 NULL
22318};
22319
22320static const _ExtendedGDBusSignalInfo _flash_signal_info_download =
22321{
22322 {
22323 -1,
22324 (gchar *) "Download",
22325 (GDBusArgInfo **) &_flash_signal_info_download_ARG_pointers,
22326 NULL
22327 },
22328 "download"
22329};
22330
Norman James362a80f2015-09-14 14:04:39 -050022331static const _ExtendedGDBusSignalInfo * const _flash_signal_info_pointers[] =
22332{
22333 &_flash_signal_info_updated,
Norman Jamesf066e872015-10-07 15:29:51 -050022334 &_flash_signal_info_download,
Norman James362a80f2015-09-14 14:04:39 -050022335 NULL
22336};
22337
Norman James18998182015-10-11 21:54:53 -050022338static const _ExtendedGDBusPropertyInfo _flash_property_info_filename =
22339{
22340 {
22341 -1,
22342 (gchar *) "filename",
22343 (gchar *) "s",
22344 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
22345 NULL
22346 },
22347 "filename",
22348 FALSE
22349};
22350
22351static const _ExtendedGDBusPropertyInfo _flash_property_info_flasher_path =
22352{
22353 {
22354 -1,
22355 (gchar *) "flasher_path",
22356 (gchar *) "s",
22357 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
22358 NULL
22359 },
22360 "flasher-path",
22361 FALSE
22362};
22363
22364static const _ExtendedGDBusPropertyInfo _flash_property_info_flasher_name =
22365{
22366 {
22367 -1,
22368 (gchar *) "flasher_name",
22369 (gchar *) "s",
22370 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
22371 NULL
22372 },
22373 "flasher-name",
22374 FALSE
22375};
22376
22377static const _ExtendedGDBusPropertyInfo _flash_property_info_flasher_instance =
22378{
22379 {
22380 -1,
22381 (gchar *) "flasher_instance",
22382 (gchar *) "s",
22383 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
22384 NULL
22385 },
22386 "flasher-instance",
22387 FALSE
22388};
22389
Norman James166acf42015-10-22 07:11:51 -050022390static const _ExtendedGDBusPropertyInfo _flash_property_info_status =
22391{
22392 {
22393 -1,
22394 (gchar *) "status",
22395 (gchar *) "s",
22396 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
22397 NULL
22398 },
22399 "status",
22400 FALSE
22401};
22402
Norman James18998182015-10-11 21:54:53 -050022403static const _ExtendedGDBusPropertyInfo * const _flash_property_info_pointers[] =
22404{
22405 &_flash_property_info_filename,
22406 &_flash_property_info_flasher_path,
22407 &_flash_property_info_flasher_name,
22408 &_flash_property_info_flasher_instance,
Norman James166acf42015-10-22 07:11:51 -050022409 &_flash_property_info_status,
Norman James18998182015-10-11 21:54:53 -050022410 NULL
22411};
22412
Norman James362a80f2015-09-14 14:04:39 -050022413static const _ExtendedGDBusInterfaceInfo _flash_interface_info =
22414{
22415 {
22416 -1,
22417 (gchar *) "org.openbmc.Flash",
22418 (GDBusMethodInfo **) &_flash_method_info_pointers,
22419 (GDBusSignalInfo **) &_flash_signal_info_pointers,
Norman James18998182015-10-11 21:54:53 -050022420 (GDBusPropertyInfo **) &_flash_property_info_pointers,
Norman James362a80f2015-09-14 14:04:39 -050022421 NULL
22422 },
22423 "flash",
22424};
22425
22426
22427/**
22428 * flash_interface_info:
22429 *
22430 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link> D-Bus interface.
22431 *
22432 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
22433 */
22434GDBusInterfaceInfo *
22435flash_interface_info (void)
22436{
22437 return (GDBusInterfaceInfo *) &_flash_interface_info.parent_struct;
22438}
22439
22440/**
22441 * flash_override_properties:
22442 * @klass: The class structure for a #GObject<!-- -->-derived class.
22443 * @property_id_begin: The property id to assign to the first overridden property.
22444 *
22445 * Overrides all #GObject properties in the #Flash interface for a concrete class.
22446 * The properties are overridden in the order they are defined.
22447 *
22448 * Returns: The last property id.
22449 */
22450guint
22451flash_override_properties (GObjectClass *klass, guint property_id_begin)
22452{
Norman James18998182015-10-11 21:54:53 -050022453 g_object_class_override_property (klass, property_id_begin++, "filename");
22454 g_object_class_override_property (klass, property_id_begin++, "flasher-path");
22455 g_object_class_override_property (klass, property_id_begin++, "flasher-name");
22456 g_object_class_override_property (klass, property_id_begin++, "flasher-instance");
Norman James166acf42015-10-22 07:11:51 -050022457 g_object_class_override_property (klass, property_id_begin++, "status");
Norman James362a80f2015-09-14 14:04:39 -050022458 return property_id_begin - 1;
22459}
22460
22461
22462
22463/**
22464 * Flash:
22465 *
22466 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>.
22467 */
22468
22469/**
22470 * FlashIface:
22471 * @parent_iface: The parent interface.
Norman James166acf42015-10-22 07:11:51 -050022472 * @handle_done: Handler for the #Flash::handle-done signal.
22473 * @handle_error: Handler for the #Flash::handle-error signal.
Norman James362a80f2015-09-14 14:04:39 -050022474 * @handle_init: Handler for the #Flash::handle-init signal.
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022475 * @handle_update: Handler for the #Flash::handle-update signal.
Norman Jamesf066e872015-10-07 15:29:51 -050022476 * @handle_update_via_tftp: Handler for the #Flash::handle-update-via-tftp signal.
Norman James18998182015-10-11 21:54:53 -050022477 * @get_filename: Getter for the #Flash:filename property.
22478 * @get_flasher_instance: Getter for the #Flash:flasher-instance property.
22479 * @get_flasher_name: Getter for the #Flash:flasher-name property.
22480 * @get_flasher_path: Getter for the #Flash:flasher-path property.
Norman James166acf42015-10-22 07:11:51 -050022481 * @get_status: Getter for the #Flash:status property.
Norman Jamesf066e872015-10-07 15:29:51 -050022482 * @download: Handler for the #Flash::download signal.
Norman James362a80f2015-09-14 14:04:39 -050022483 * @updated: Handler for the #Flash::updated signal.
22484 *
22485 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>.
22486 */
22487
22488typedef FlashIface FlashInterface;
22489G_DEFINE_INTERFACE (Flash, flash, G_TYPE_OBJECT);
22490
22491static void
22492flash_default_init (FlashIface *iface)
22493{
22494 /* GObject signals for incoming D-Bus method calls: */
22495 /**
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022496 * Flash::handle-update:
Norman James362a80f2015-09-14 14:04:39 -050022497 * @object: A #Flash.
22498 * @invocation: A #GDBusMethodInvocation.
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022499 * @arg_filename: Argument passed by remote caller.
Norman James362a80f2015-09-14 14:04:39 -050022500 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022501 * 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 -050022502 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022503 * 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 -050022504 *
22505 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
22506 */
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022507 g_signal_new ("handle-update",
Norman James362a80f2015-09-14 14:04:39 -050022508 G_TYPE_FROM_INTERFACE (iface),
22509 G_SIGNAL_RUN_LAST,
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022510 G_STRUCT_OFFSET (FlashIface, handle_update),
Norman James362a80f2015-09-14 14:04:39 -050022511 g_signal_accumulator_true_handled,
22512 NULL,
22513 g_cclosure_marshal_generic,
22514 G_TYPE_BOOLEAN,
22515 2,
22516 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING);
22517
22518 /**
Norman James166acf42015-10-22 07:11:51 -050022519 * Flash::handle-error:
22520 * @object: A #Flash.
22521 * @invocation: A #GDBusMethodInvocation.
22522 * @arg_message: Argument passed by remote caller.
22523 *
22524 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.error">error()</link> D-Bus method.
22525 *
22526 * 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.
22527 *
22528 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
22529 */
22530 g_signal_new ("handle-error",
22531 G_TYPE_FROM_INTERFACE (iface),
22532 G_SIGNAL_RUN_LAST,
22533 G_STRUCT_OFFSET (FlashIface, handle_error),
22534 g_signal_accumulator_true_handled,
22535 NULL,
22536 g_cclosure_marshal_generic,
22537 G_TYPE_BOOLEAN,
22538 2,
22539 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING);
22540
22541 /**
22542 * Flash::handle-done:
22543 * @object: A #Flash.
22544 * @invocation: A #GDBusMethodInvocation.
22545 *
22546 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.done">done()</link> D-Bus method.
22547 *
22548 * 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.
22549 *
22550 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
22551 */
22552 g_signal_new ("handle-done",
22553 G_TYPE_FROM_INTERFACE (iface),
22554 G_SIGNAL_RUN_LAST,
22555 G_STRUCT_OFFSET (FlashIface, handle_done),
22556 g_signal_accumulator_true_handled,
22557 NULL,
22558 g_cclosure_marshal_generic,
22559 G_TYPE_BOOLEAN,
22560 1,
22561 G_TYPE_DBUS_METHOD_INVOCATION);
22562
22563 /**
Norman Jamesf066e872015-10-07 15:29:51 -050022564 * Flash::handle-update-via-tftp:
22565 * @object: A #Flash.
22566 * @invocation: A #GDBusMethodInvocation.
22567 * @arg_url: Argument passed by remote caller.
22568 * @arg_filename: Argument passed by remote caller.
22569 *
22570 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.updateViaTftp">updateViaTftp()</link> D-Bus method.
22571 *
22572 * 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.
22573 *
22574 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
22575 */
22576 g_signal_new ("handle-update-via-tftp",
22577 G_TYPE_FROM_INTERFACE (iface),
22578 G_SIGNAL_RUN_LAST,
22579 G_STRUCT_OFFSET (FlashIface, handle_update_via_tftp),
22580 g_signal_accumulator_true_handled,
22581 NULL,
22582 g_cclosure_marshal_generic,
22583 G_TYPE_BOOLEAN,
22584 3,
22585 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_STRING);
22586
22587 /**
Norman James362a80f2015-09-14 14:04:39 -050022588 * Flash::handle-init:
22589 * @object: A #Flash.
22590 * @invocation: A #GDBusMethodInvocation.
22591 *
22592 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.init">init()</link> D-Bus method.
22593 *
22594 * 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.
22595 *
22596 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
22597 */
22598 g_signal_new ("handle-init",
22599 G_TYPE_FROM_INTERFACE (iface),
22600 G_SIGNAL_RUN_LAST,
22601 G_STRUCT_OFFSET (FlashIface, handle_init),
22602 g_signal_accumulator_true_handled,
22603 NULL,
22604 g_cclosure_marshal_generic,
22605 G_TYPE_BOOLEAN,
22606 1,
22607 G_TYPE_DBUS_METHOD_INVOCATION);
22608
22609 /* GObject signals for received D-Bus signals: */
22610 /**
22611 * Flash::updated:
22612 * @object: A #Flash.
22613 *
22614 * 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.
22615 *
22616 * 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.
22617 */
22618 g_signal_new ("updated",
22619 G_TYPE_FROM_INTERFACE (iface),
22620 G_SIGNAL_RUN_LAST,
22621 G_STRUCT_OFFSET (FlashIface, updated),
22622 NULL,
22623 NULL,
22624 g_cclosure_marshal_generic,
22625 G_TYPE_NONE,
22626 0);
22627
Norman Jamesf066e872015-10-07 15:29:51 -050022628 /**
22629 * Flash::download:
22630 * @object: A #Flash.
22631 * @arg_url: Argument.
22632 * @arg_filename: Argument.
22633 *
22634 * 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.
22635 *
22636 * 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.
22637 */
22638 g_signal_new ("download",
22639 G_TYPE_FROM_INTERFACE (iface),
22640 G_SIGNAL_RUN_LAST,
22641 G_STRUCT_OFFSET (FlashIface, download),
22642 NULL,
22643 NULL,
22644 g_cclosure_marshal_generic,
22645 G_TYPE_NONE,
22646 2, G_TYPE_STRING, G_TYPE_STRING);
22647
Norman James18998182015-10-11 21:54:53 -050022648 /* GObject properties for D-Bus properties: */
22649 /**
22650 * Flash:filename:
22651 *
22652 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Flash.filename">"filename"</link>.
22653 *
22654 * 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.
22655 */
22656 g_object_interface_install_property (iface,
22657 g_param_spec_string ("filename", "filename", "filename", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
22658 /**
22659 * Flash:flasher-path:
22660 *
22661 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Flash.flasher_path">"flasher_path"</link>.
22662 *
22663 * 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.
22664 */
22665 g_object_interface_install_property (iface,
22666 g_param_spec_string ("flasher-path", "flasher_path", "flasher_path", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
22667 /**
22668 * Flash:flasher-name:
22669 *
22670 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Flash.flasher_name">"flasher_name"</link>.
22671 *
22672 * 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.
22673 */
22674 g_object_interface_install_property (iface,
22675 g_param_spec_string ("flasher-name", "flasher_name", "flasher_name", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
22676 /**
22677 * Flash:flasher-instance:
22678 *
22679 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Flash.flasher_instance">"flasher_instance"</link>.
22680 *
22681 * 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.
22682 */
22683 g_object_interface_install_property (iface,
22684 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 -050022685 /**
22686 * Flash:status:
22687 *
22688 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Flash.status">"status"</link>.
22689 *
22690 * 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.
22691 */
22692 g_object_interface_install_property (iface,
22693 g_param_spec_string ("status", "status", "status", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Norman James18998182015-10-11 21:54:53 -050022694}
22695
22696/**
22697 * flash_get_filename: (skip)
22698 * @object: A #Flash.
22699 *
22700 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Flash.filename">"filename"</link> D-Bus property.
22701 *
22702 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
22703 *
22704 * <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>
22705 *
22706 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
22707 */
22708const gchar *
22709flash_get_filename (Flash *object)
22710{
22711 return FLASH_GET_IFACE (object)->get_filename (object);
22712}
22713
22714/**
22715 * flash_dup_filename: (skip)
22716 * @object: A #Flash.
22717 *
22718 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Flash.filename">"filename"</link> D-Bus property.
22719 *
22720 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
22721 *
22722 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
22723 */
22724gchar *
22725flash_dup_filename (Flash *object)
22726{
22727 gchar *value;
22728 g_object_get (G_OBJECT (object), "filename", &value, NULL);
22729 return value;
22730}
22731
22732/**
22733 * flash_set_filename: (skip)
22734 * @object: A #Flash.
22735 * @value: The value to set.
22736 *
22737 * Sets the <link linkend="gdbus-property-org-openbmc-Flash.filename">"filename"</link> D-Bus property to @value.
22738 *
22739 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
22740 */
22741void
22742flash_set_filename (Flash *object, const gchar *value)
22743{
22744 g_object_set (G_OBJECT (object), "filename", value, NULL);
22745}
22746
22747/**
22748 * flash_get_flasher_path: (skip)
22749 * @object: A #Flash.
22750 *
22751 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_path">"flasher_path"</link> D-Bus property.
22752 *
22753 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
22754 *
22755 * <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>
22756 *
22757 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
22758 */
22759const gchar *
22760flash_get_flasher_path (Flash *object)
22761{
22762 return FLASH_GET_IFACE (object)->get_flasher_path (object);
22763}
22764
22765/**
22766 * flash_dup_flasher_path: (skip)
22767 * @object: A #Flash.
22768 *
22769 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_path">"flasher_path"</link> D-Bus property.
22770 *
22771 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
22772 *
22773 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
22774 */
22775gchar *
22776flash_dup_flasher_path (Flash *object)
22777{
22778 gchar *value;
22779 g_object_get (G_OBJECT (object), "flasher-path", &value, NULL);
22780 return value;
22781}
22782
22783/**
22784 * flash_set_flasher_path: (skip)
22785 * @object: A #Flash.
22786 * @value: The value to set.
22787 *
22788 * Sets the <link linkend="gdbus-property-org-openbmc-Flash.flasher_path">"flasher_path"</link> D-Bus property to @value.
22789 *
22790 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
22791 */
22792void
22793flash_set_flasher_path (Flash *object, const gchar *value)
22794{
22795 g_object_set (G_OBJECT (object), "flasher-path", value, NULL);
22796}
22797
22798/**
22799 * flash_get_flasher_name: (skip)
22800 * @object: A #Flash.
22801 *
22802 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_name">"flasher_name"</link> D-Bus property.
22803 *
22804 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
22805 *
22806 * <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>
22807 *
22808 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
22809 */
22810const gchar *
22811flash_get_flasher_name (Flash *object)
22812{
22813 return FLASH_GET_IFACE (object)->get_flasher_name (object);
22814}
22815
22816/**
22817 * flash_dup_flasher_name: (skip)
22818 * @object: A #Flash.
22819 *
22820 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_name">"flasher_name"</link> D-Bus property.
22821 *
22822 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
22823 *
22824 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
22825 */
22826gchar *
22827flash_dup_flasher_name (Flash *object)
22828{
22829 gchar *value;
22830 g_object_get (G_OBJECT (object), "flasher-name", &value, NULL);
22831 return value;
22832}
22833
22834/**
22835 * flash_set_flasher_name: (skip)
22836 * @object: A #Flash.
22837 * @value: The value to set.
22838 *
22839 * Sets the <link linkend="gdbus-property-org-openbmc-Flash.flasher_name">"flasher_name"</link> D-Bus property to @value.
22840 *
22841 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
22842 */
22843void
22844flash_set_flasher_name (Flash *object, const gchar *value)
22845{
22846 g_object_set (G_OBJECT (object), "flasher-name", value, NULL);
22847}
22848
22849/**
22850 * flash_get_flasher_instance: (skip)
22851 * @object: A #Flash.
22852 *
22853 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_instance">"flasher_instance"</link> D-Bus property.
22854 *
22855 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
22856 *
22857 * <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>
22858 *
22859 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
22860 */
22861const gchar *
22862flash_get_flasher_instance (Flash *object)
22863{
22864 return FLASH_GET_IFACE (object)->get_flasher_instance (object);
22865}
22866
22867/**
22868 * flash_dup_flasher_instance: (skip)
22869 * @object: A #Flash.
22870 *
22871 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_instance">"flasher_instance"</link> D-Bus property.
22872 *
22873 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
22874 *
22875 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
22876 */
22877gchar *
22878flash_dup_flasher_instance (Flash *object)
22879{
22880 gchar *value;
22881 g_object_get (G_OBJECT (object), "flasher-instance", &value, NULL);
22882 return value;
22883}
22884
22885/**
22886 * flash_set_flasher_instance: (skip)
22887 * @object: A #Flash.
22888 * @value: The value to set.
22889 *
22890 * Sets the <link linkend="gdbus-property-org-openbmc-Flash.flasher_instance">"flasher_instance"</link> D-Bus property to @value.
22891 *
22892 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
22893 */
22894void
22895flash_set_flasher_instance (Flash *object, const gchar *value)
22896{
22897 g_object_set (G_OBJECT (object), "flasher-instance", value, NULL);
Norman James362a80f2015-09-14 14:04:39 -050022898}
22899
22900/**
Norman James166acf42015-10-22 07:11:51 -050022901 * flash_get_status: (skip)
22902 * @object: A #Flash.
22903 *
22904 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Flash.status">"status"</link> D-Bus property.
22905 *
22906 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
22907 *
22908 * <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>
22909 *
22910 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
22911 */
22912const gchar *
22913flash_get_status (Flash *object)
22914{
22915 return FLASH_GET_IFACE (object)->get_status (object);
22916}
22917
22918/**
22919 * flash_dup_status: (skip)
22920 * @object: A #Flash.
22921 *
22922 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Flash.status">"status"</link> D-Bus property.
22923 *
22924 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
22925 *
22926 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
22927 */
22928gchar *
22929flash_dup_status (Flash *object)
22930{
22931 gchar *value;
22932 g_object_get (G_OBJECT (object), "status", &value, NULL);
22933 return value;
22934}
22935
22936/**
22937 * flash_set_status: (skip)
22938 * @object: A #Flash.
22939 * @value: The value to set.
22940 *
22941 * Sets the <link linkend="gdbus-property-org-openbmc-Flash.status">"status"</link> D-Bus property to @value.
22942 *
22943 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
22944 */
22945void
22946flash_set_status (Flash *object, const gchar *value)
22947{
22948 g_object_set (G_OBJECT (object), "status", value, NULL);
22949}
22950
22951/**
Norman James362a80f2015-09-14 14:04:39 -050022952 * flash_emit_updated:
22953 * @object: A #Flash.
22954 *
22955 * Emits the <link linkend="gdbus-signal-org-openbmc-Flash.Updated">"Updated"</link> D-Bus signal.
22956 */
22957void
22958flash_emit_updated (
22959 Flash *object)
22960{
22961 g_signal_emit_by_name (object, "updated");
22962}
22963
22964/**
Norman Jamesf066e872015-10-07 15:29:51 -050022965 * flash_emit_download:
22966 * @object: A #Flash.
22967 * @arg_url: Argument to pass with the signal.
22968 * @arg_filename: Argument to pass with the signal.
22969 *
22970 * Emits the <link linkend="gdbus-signal-org-openbmc-Flash.Download">"Download"</link> D-Bus signal.
22971 */
22972void
22973flash_emit_download (
22974 Flash *object,
22975 const gchar *arg_url,
22976 const gchar *arg_filename)
22977{
22978 g_signal_emit_by_name (object, "download", arg_url, arg_filename);
22979}
22980
22981/**
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022982 * flash_call_update:
Norman James362a80f2015-09-14 14:04:39 -050022983 * @proxy: A #FlashProxy.
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022984 * @arg_filename: Argument to pass with the method invocation.
Norman James362a80f2015-09-14 14:04:39 -050022985 * @cancellable: (allow-none): A #GCancellable or %NULL.
22986 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
22987 * @user_data: User data to pass to @callback.
22988 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022989 * 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 -050022990 * When the operation is finished, @callback will be invoked 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 -050022991 * You can then call flash_call_update_finish() to get the result of the operation.
Norman James362a80f2015-09-14 14:04:39 -050022992 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022993 * See flash_call_update_sync() for the synchronous, blocking version of this method.
Norman James362a80f2015-09-14 14:04:39 -050022994 */
22995void
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022996flash_call_update (
Norman James362a80f2015-09-14 14:04:39 -050022997 Flash *proxy,
Norman Jamesdbcffbd2015-10-06 16:53:06 -050022998 const gchar *arg_filename,
Norman James362a80f2015-09-14 14:04:39 -050022999 GCancellable *cancellable,
23000 GAsyncReadyCallback callback,
23001 gpointer user_data)
23002{
23003 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
Norman Jamesdbcffbd2015-10-06 16:53:06 -050023004 "update",
Norman James362a80f2015-09-14 14:04:39 -050023005 g_variant_new ("(s)",
Norman Jamesdbcffbd2015-10-06 16:53:06 -050023006 arg_filename),
Norman James362a80f2015-09-14 14:04:39 -050023007 G_DBUS_CALL_FLAGS_NONE,
23008 -1,
23009 cancellable,
23010 callback,
23011 user_data);
23012}
23013
23014/**
Norman Jamesdbcffbd2015-10-06 16:53:06 -050023015 * flash_call_update_finish:
Norman James362a80f2015-09-14 14:04:39 -050023016 * @proxy: A #FlashProxy.
Norman Jamesdbcffbd2015-10-06 16:53:06 -050023017 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_update().
Norman James362a80f2015-09-14 14:04:39 -050023018 * @error: Return location for error or %NULL.
23019 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050023020 * Finishes an operation started with flash_call_update().
Norman James362a80f2015-09-14 14:04:39 -050023021 *
23022 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
23023 */
23024gboolean
Norman Jamesdbcffbd2015-10-06 16:53:06 -050023025flash_call_update_finish (
Norman James362a80f2015-09-14 14:04:39 -050023026 Flash *proxy,
23027 GAsyncResult *res,
23028 GError **error)
23029{
23030 GVariant *_ret;
23031 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
23032 if (_ret == NULL)
23033 goto _out;
23034 g_variant_get (_ret,
23035 "()");
23036 g_variant_unref (_ret);
23037_out:
23038 return _ret != NULL;
23039}
23040
23041/**
Norman Jamesdbcffbd2015-10-06 16:53:06 -050023042 * flash_call_update_sync:
Norman James362a80f2015-09-14 14:04:39 -050023043 * @proxy: A #FlashProxy.
Norman Jamesdbcffbd2015-10-06 16:53:06 -050023044 * @arg_filename: Argument to pass with the method invocation.
Norman James362a80f2015-09-14 14:04:39 -050023045 * @cancellable: (allow-none): A #GCancellable or %NULL.
23046 * @error: Return location for error or %NULL.
23047 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050023048 * 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 -050023049 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050023050 * See flash_call_update() for the asynchronous version of this method.
Norman James362a80f2015-09-14 14:04:39 -050023051 *
23052 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
23053 */
23054gboolean
Norman Jamesdbcffbd2015-10-06 16:53:06 -050023055flash_call_update_sync (
Norman James362a80f2015-09-14 14:04:39 -050023056 Flash *proxy,
Norman Jamesdbcffbd2015-10-06 16:53:06 -050023057 const gchar *arg_filename,
Norman James362a80f2015-09-14 14:04:39 -050023058 GCancellable *cancellable,
23059 GError **error)
23060{
23061 GVariant *_ret;
23062 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
Norman Jamesdbcffbd2015-10-06 16:53:06 -050023063 "update",
Norman James362a80f2015-09-14 14:04:39 -050023064 g_variant_new ("(s)",
Norman Jamesdbcffbd2015-10-06 16:53:06 -050023065 arg_filename),
Norman James362a80f2015-09-14 14:04:39 -050023066 G_DBUS_CALL_FLAGS_NONE,
23067 -1,
23068 cancellable,
23069 error);
23070 if (_ret == NULL)
23071 goto _out;
23072 g_variant_get (_ret,
23073 "()");
23074 g_variant_unref (_ret);
23075_out:
23076 return _ret != NULL;
23077}
23078
23079/**
Norman James166acf42015-10-22 07:11:51 -050023080 * flash_call_error:
23081 * @proxy: A #FlashProxy.
23082 * @arg_message: Argument to pass with the method invocation.
23083 * @cancellable: (allow-none): A #GCancellable or %NULL.
23084 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
23085 * @user_data: User data to pass to @callback.
23086 *
23087 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.error">error()</link> D-Bus method on @proxy.
23088 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
23089 * You can then call flash_call_error_finish() to get the result of the operation.
23090 *
23091 * See flash_call_error_sync() for the synchronous, blocking version of this method.
23092 */
23093void
23094flash_call_error (
23095 Flash *proxy,
23096 const gchar *arg_message,
23097 GCancellable *cancellable,
23098 GAsyncReadyCallback callback,
23099 gpointer user_data)
23100{
23101 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
23102 "error",
23103 g_variant_new ("(s)",
23104 arg_message),
23105 G_DBUS_CALL_FLAGS_NONE,
23106 -1,
23107 cancellable,
23108 callback,
23109 user_data);
23110}
23111
23112/**
23113 * flash_call_error_finish:
23114 * @proxy: A #FlashProxy.
23115 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_error().
23116 * @error: Return location for error or %NULL.
23117 *
23118 * Finishes an operation started with flash_call_error().
23119 *
23120 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
23121 */
23122gboolean
23123flash_call_error_finish (
23124 Flash *proxy,
23125 GAsyncResult *res,
23126 GError **error)
23127{
23128 GVariant *_ret;
23129 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
23130 if (_ret == NULL)
23131 goto _out;
23132 g_variant_get (_ret,
23133 "()");
23134 g_variant_unref (_ret);
23135_out:
23136 return _ret != NULL;
23137}
23138
23139/**
23140 * flash_call_error_sync:
23141 * @proxy: A #FlashProxy.
23142 * @arg_message: Argument to pass with the method invocation.
23143 * @cancellable: (allow-none): A #GCancellable or %NULL.
23144 * @error: Return location for error or %NULL.
23145 *
23146 * 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.
23147 *
23148 * See flash_call_error() for the asynchronous version of this method.
23149 *
23150 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
23151 */
23152gboolean
23153flash_call_error_sync (
23154 Flash *proxy,
23155 const gchar *arg_message,
23156 GCancellable *cancellable,
23157 GError **error)
23158{
23159 GVariant *_ret;
23160 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
23161 "error",
23162 g_variant_new ("(s)",
23163 arg_message),
23164 G_DBUS_CALL_FLAGS_NONE,
23165 -1,
23166 cancellable,
23167 error);
23168 if (_ret == NULL)
23169 goto _out;
23170 g_variant_get (_ret,
23171 "()");
23172 g_variant_unref (_ret);
23173_out:
23174 return _ret != NULL;
23175}
23176
23177/**
23178 * flash_call_done:
23179 * @proxy: A #FlashProxy.
23180 * @cancellable: (allow-none): A #GCancellable or %NULL.
23181 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
23182 * @user_data: User data to pass to @callback.
23183 *
23184 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.done">done()</link> D-Bus method on @proxy.
23185 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
23186 * You can then call flash_call_done_finish() to get the result of the operation.
23187 *
23188 * See flash_call_done_sync() for the synchronous, blocking version of this method.
23189 */
23190void
23191flash_call_done (
23192 Flash *proxy,
23193 GCancellable *cancellable,
23194 GAsyncReadyCallback callback,
23195 gpointer user_data)
23196{
23197 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
23198 "done",
23199 g_variant_new ("()"),
23200 G_DBUS_CALL_FLAGS_NONE,
23201 -1,
23202 cancellable,
23203 callback,
23204 user_data);
23205}
23206
23207/**
23208 * flash_call_done_finish:
23209 * @proxy: A #FlashProxy.
23210 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_done().
23211 * @error: Return location for error or %NULL.
23212 *
23213 * Finishes an operation started with flash_call_done().
23214 *
23215 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
23216 */
23217gboolean
23218flash_call_done_finish (
23219 Flash *proxy,
23220 GAsyncResult *res,
23221 GError **error)
23222{
23223 GVariant *_ret;
23224 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
23225 if (_ret == NULL)
23226 goto _out;
23227 g_variant_get (_ret,
23228 "()");
23229 g_variant_unref (_ret);
23230_out:
23231 return _ret != NULL;
23232}
23233
23234/**
23235 * flash_call_done_sync:
23236 * @proxy: A #FlashProxy.
23237 * @cancellable: (allow-none): A #GCancellable or %NULL.
23238 * @error: Return location for error or %NULL.
23239 *
23240 * 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.
23241 *
23242 * See flash_call_done() for the asynchronous version of this method.
23243 *
23244 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
23245 */
23246gboolean
23247flash_call_done_sync (
23248 Flash *proxy,
23249 GCancellable *cancellable,
23250 GError **error)
23251{
23252 GVariant *_ret;
23253 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
23254 "done",
23255 g_variant_new ("()"),
23256 G_DBUS_CALL_FLAGS_NONE,
23257 -1,
23258 cancellable,
23259 error);
23260 if (_ret == NULL)
23261 goto _out;
23262 g_variant_get (_ret,
23263 "()");
23264 g_variant_unref (_ret);
23265_out:
23266 return _ret != NULL;
23267}
23268
23269/**
Norman Jamesf066e872015-10-07 15:29:51 -050023270 * flash_call_update_via_tftp:
23271 * @proxy: A #FlashProxy.
23272 * @arg_url: Argument to pass with the method invocation.
23273 * @arg_filename: Argument to pass with the method invocation.
23274 * @cancellable: (allow-none): A #GCancellable or %NULL.
23275 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
23276 * @user_data: User data to pass to @callback.
23277 *
23278 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.updateViaTftp">updateViaTftp()</link> D-Bus method on @proxy.
23279 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
23280 * You can then call flash_call_update_via_tftp_finish() to get the result of the operation.
23281 *
23282 * See flash_call_update_via_tftp_sync() for the synchronous, blocking version of this method.
23283 */
23284void
23285flash_call_update_via_tftp (
23286 Flash *proxy,
23287 const gchar *arg_url,
23288 const gchar *arg_filename,
23289 GCancellable *cancellable,
23290 GAsyncReadyCallback callback,
23291 gpointer user_data)
23292{
23293 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
23294 "updateViaTftp",
23295 g_variant_new ("(ss)",
23296 arg_url,
23297 arg_filename),
23298 G_DBUS_CALL_FLAGS_NONE,
23299 -1,
23300 cancellable,
23301 callback,
23302 user_data);
23303}
23304
23305/**
23306 * flash_call_update_via_tftp_finish:
23307 * @proxy: A #FlashProxy.
23308 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_update_via_tftp().
23309 * @error: Return location for error or %NULL.
23310 *
23311 * Finishes an operation started with flash_call_update_via_tftp().
23312 *
23313 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
23314 */
23315gboolean
23316flash_call_update_via_tftp_finish (
23317 Flash *proxy,
23318 GAsyncResult *res,
23319 GError **error)
23320{
23321 GVariant *_ret;
23322 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
23323 if (_ret == NULL)
23324 goto _out;
23325 g_variant_get (_ret,
23326 "()");
23327 g_variant_unref (_ret);
23328_out:
23329 return _ret != NULL;
23330}
23331
23332/**
23333 * flash_call_update_via_tftp_sync:
23334 * @proxy: A #FlashProxy.
23335 * @arg_url: Argument to pass with the method invocation.
23336 * @arg_filename: Argument to pass with the method invocation.
23337 * @cancellable: (allow-none): A #GCancellable or %NULL.
23338 * @error: Return location for error or %NULL.
23339 *
23340 * 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.
23341 *
23342 * See flash_call_update_via_tftp() for the asynchronous version of this method.
23343 *
23344 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
23345 */
23346gboolean
23347flash_call_update_via_tftp_sync (
23348 Flash *proxy,
23349 const gchar *arg_url,
23350 const gchar *arg_filename,
23351 GCancellable *cancellable,
23352 GError **error)
23353{
23354 GVariant *_ret;
23355 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
23356 "updateViaTftp",
23357 g_variant_new ("(ss)",
23358 arg_url,
23359 arg_filename),
23360 G_DBUS_CALL_FLAGS_NONE,
23361 -1,
23362 cancellable,
23363 error);
23364 if (_ret == NULL)
23365 goto _out;
23366 g_variant_get (_ret,
23367 "()");
23368 g_variant_unref (_ret);
23369_out:
23370 return _ret != NULL;
23371}
23372
23373/**
Norman James362a80f2015-09-14 14:04:39 -050023374 * flash_call_init:
23375 * @proxy: A #FlashProxy.
23376 * @cancellable: (allow-none): A #GCancellable or %NULL.
23377 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
23378 * @user_data: User data to pass to @callback.
23379 *
23380 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.init">init()</link> D-Bus method on @proxy.
23381 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
23382 * You can then call flash_call_init_finish() to get the result of the operation.
23383 *
23384 * See flash_call_init_sync() for the synchronous, blocking version of this method.
23385 */
23386void
23387flash_call_init (
23388 Flash *proxy,
23389 GCancellable *cancellable,
23390 GAsyncReadyCallback callback,
23391 gpointer user_data)
23392{
23393 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
23394 "init",
23395 g_variant_new ("()"),
23396 G_DBUS_CALL_FLAGS_NONE,
23397 -1,
23398 cancellable,
23399 callback,
23400 user_data);
23401}
23402
23403/**
23404 * flash_call_init_finish:
23405 * @proxy: A #FlashProxy.
23406 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_init().
23407 * @error: Return location for error or %NULL.
23408 *
23409 * Finishes an operation started with flash_call_init().
23410 *
23411 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
23412 */
23413gboolean
23414flash_call_init_finish (
23415 Flash *proxy,
23416 GAsyncResult *res,
23417 GError **error)
23418{
23419 GVariant *_ret;
23420 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
23421 if (_ret == NULL)
23422 goto _out;
23423 g_variant_get (_ret,
23424 "()");
23425 g_variant_unref (_ret);
23426_out:
23427 return _ret != NULL;
23428}
23429
23430/**
23431 * flash_call_init_sync:
23432 * @proxy: A #FlashProxy.
23433 * @cancellable: (allow-none): A #GCancellable or %NULL.
23434 * @error: Return location for error or %NULL.
23435 *
23436 * 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.
23437 *
23438 * See flash_call_init() for the asynchronous version of this method.
23439 *
23440 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
23441 */
23442gboolean
23443flash_call_init_sync (
23444 Flash *proxy,
23445 GCancellable *cancellable,
23446 GError **error)
23447{
23448 GVariant *_ret;
23449 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
23450 "init",
23451 g_variant_new ("()"),
23452 G_DBUS_CALL_FLAGS_NONE,
23453 -1,
23454 cancellable,
23455 error);
23456 if (_ret == NULL)
23457 goto _out;
23458 g_variant_get (_ret,
23459 "()");
23460 g_variant_unref (_ret);
23461_out:
23462 return _ret != NULL;
23463}
23464
23465/**
Norman Jamesdbcffbd2015-10-06 16:53:06 -050023466 * flash_complete_update:
Norman James362a80f2015-09-14 14:04:39 -050023467 * @object: A #Flash.
23468 * @invocation: (transfer full): A #GDBusMethodInvocation.
23469 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050023470 * 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 -050023471 *
23472 * This method will free @invocation, you cannot use it afterwards.
23473 */
23474void
Norman Jamesdbcffbd2015-10-06 16:53:06 -050023475flash_complete_update (
Norman James362a80f2015-09-14 14:04:39 -050023476 Flash *object,
23477 GDBusMethodInvocation *invocation)
23478{
23479 g_dbus_method_invocation_return_value (invocation,
23480 g_variant_new ("()"));
23481}
23482
23483/**
Norman James166acf42015-10-22 07:11:51 -050023484 * flash_complete_error:
23485 * @object: A #Flash.
23486 * @invocation: (transfer full): A #GDBusMethodInvocation.
23487 *
23488 * 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.
23489 *
23490 * This method will free @invocation, you cannot use it afterwards.
23491 */
23492void
23493flash_complete_error (
23494 Flash *object,
23495 GDBusMethodInvocation *invocation)
23496{
23497 g_dbus_method_invocation_return_value (invocation,
23498 g_variant_new ("()"));
23499}
23500
23501/**
23502 * flash_complete_done:
23503 * @object: A #Flash.
23504 * @invocation: (transfer full): A #GDBusMethodInvocation.
23505 *
23506 * 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.
23507 *
23508 * This method will free @invocation, you cannot use it afterwards.
23509 */
23510void
23511flash_complete_done (
23512 Flash *object,
23513 GDBusMethodInvocation *invocation)
23514{
23515 g_dbus_method_invocation_return_value (invocation,
23516 g_variant_new ("()"));
23517}
23518
23519/**
Norman Jamesf066e872015-10-07 15:29:51 -050023520 * flash_complete_update_via_tftp:
23521 * @object: A #Flash.
23522 * @invocation: (transfer full): A #GDBusMethodInvocation.
23523 *
23524 * 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.
23525 *
23526 * This method will free @invocation, you cannot use it afterwards.
23527 */
23528void
23529flash_complete_update_via_tftp (
23530 Flash *object,
23531 GDBusMethodInvocation *invocation)
23532{
23533 g_dbus_method_invocation_return_value (invocation,
23534 g_variant_new ("()"));
23535}
23536
23537/**
Norman James362a80f2015-09-14 14:04:39 -050023538 * flash_complete_init:
23539 * @object: A #Flash.
23540 * @invocation: (transfer full): A #GDBusMethodInvocation.
23541 *
23542 * 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.
23543 *
23544 * This method will free @invocation, you cannot use it afterwards.
23545 */
23546void
23547flash_complete_init (
23548 Flash *object,
23549 GDBusMethodInvocation *invocation)
23550{
23551 g_dbus_method_invocation_return_value (invocation,
23552 g_variant_new ("()"));
23553}
23554
23555/* ------------------------------------------------------------------------ */
23556
23557/**
23558 * FlashProxy:
23559 *
23560 * The #FlashProxy structure contains only private data and should only be accessed using the provided API.
23561 */
23562
23563/**
23564 * FlashProxyClass:
23565 * @parent_class: The parent class.
23566 *
23567 * Class structure for #FlashProxy.
23568 */
23569
23570struct _FlashProxyPrivate
23571{
23572 GData *qdata;
23573};
23574
23575static void flash_proxy_iface_init (FlashIface *iface);
23576
23577#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
23578G_DEFINE_TYPE_WITH_CODE (FlashProxy, flash_proxy, G_TYPE_DBUS_PROXY,
23579 G_ADD_PRIVATE (FlashProxy)
23580 G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_proxy_iface_init));
23581
23582#else
23583G_DEFINE_TYPE_WITH_CODE (FlashProxy, flash_proxy, G_TYPE_DBUS_PROXY,
23584 G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_proxy_iface_init));
23585
23586#endif
23587static void
23588flash_proxy_finalize (GObject *object)
23589{
23590 FlashProxy *proxy = FLASH_PROXY (object);
23591 g_datalist_clear (&proxy->priv->qdata);
23592 G_OBJECT_CLASS (flash_proxy_parent_class)->finalize (object);
23593}
23594
23595static void
23596flash_proxy_get_property (GObject *object,
23597 guint prop_id,
23598 GValue *value,
23599 GParamSpec *pspec G_GNUC_UNUSED)
23600{
Norman James18998182015-10-11 21:54:53 -050023601 const _ExtendedGDBusPropertyInfo *info;
23602 GVariant *variant;
Norman James166acf42015-10-22 07:11:51 -050023603 g_assert (prop_id != 0 && prop_id - 1 < 5);
Norman James18998182015-10-11 21:54:53 -050023604 info = _flash_property_info_pointers[prop_id - 1];
23605 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
23606 if (info->use_gvariant)
23607 {
23608 g_value_set_variant (value, variant);
23609 }
23610 else
23611 {
23612 if (variant != NULL)
23613 g_dbus_gvariant_to_gvalue (variant, value);
23614 }
23615 if (variant != NULL)
23616 g_variant_unref (variant);
23617}
23618
23619static void
23620flash_proxy_set_property_cb (GDBusProxy *proxy,
23621 GAsyncResult *res,
23622 gpointer user_data)
23623{
23624 const _ExtendedGDBusPropertyInfo *info = user_data;
23625 GError *error;
23626 GVariant *_ret;
23627 error = NULL;
23628 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
23629 if (!_ret)
23630 {
23631 g_warning ("Error setting property '%s' on interface org.openbmc.Flash: %s (%s, %d)",
23632 info->parent_struct.name,
23633 error->message, g_quark_to_string (error->domain), error->code);
23634 g_error_free (error);
23635 }
23636 else
23637 {
23638 g_variant_unref (_ret);
23639 }
Norman James362a80f2015-09-14 14:04:39 -050023640}
23641
23642static void
23643flash_proxy_set_property (GObject *object,
23644 guint prop_id,
23645 const GValue *value,
23646 GParamSpec *pspec G_GNUC_UNUSED)
23647{
Norman James18998182015-10-11 21:54:53 -050023648 const _ExtendedGDBusPropertyInfo *info;
23649 GVariant *variant;
Norman James166acf42015-10-22 07:11:51 -050023650 g_assert (prop_id != 0 && prop_id - 1 < 5);
Norman James18998182015-10-11 21:54:53 -050023651 info = _flash_property_info_pointers[prop_id - 1];
23652 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
23653 g_dbus_proxy_call (G_DBUS_PROXY (object),
23654 "org.freedesktop.DBus.Properties.Set",
23655 g_variant_new ("(ssv)", "org.openbmc.Flash", info->parent_struct.name, variant),
23656 G_DBUS_CALL_FLAGS_NONE,
23657 -1,
23658 NULL, (GAsyncReadyCallback) flash_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
23659 g_variant_unref (variant);
Norman James362a80f2015-09-14 14:04:39 -050023660}
23661
23662static void
23663flash_proxy_g_signal (GDBusProxy *proxy,
23664 const gchar *sender_name G_GNUC_UNUSED,
23665 const gchar *signal_name,
23666 GVariant *parameters)
23667{
23668 _ExtendedGDBusSignalInfo *info;
23669 GVariantIter iter;
23670 GVariant *child;
23671 GValue *paramv;
23672 guint num_params;
23673 guint n;
23674 guint signal_id;
23675 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, signal_name);
23676 if (info == NULL)
23677 return;
23678 num_params = g_variant_n_children (parameters);
23679 paramv = g_new0 (GValue, num_params + 1);
23680 g_value_init (&paramv[0], TYPE_FLASH);
23681 g_value_set_object (&paramv[0], proxy);
23682 g_variant_iter_init (&iter, parameters);
23683 n = 1;
23684 while ((child = g_variant_iter_next_value (&iter)) != NULL)
23685 {
23686 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
23687 if (arg_info->use_gvariant)
23688 {
23689 g_value_init (&paramv[n], G_TYPE_VARIANT);
23690 g_value_set_variant (&paramv[n], child);
23691 n++;
23692 }
23693 else
23694 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
23695 g_variant_unref (child);
23696 }
23697 signal_id = g_signal_lookup (info->signal_name, TYPE_FLASH);
23698 g_signal_emitv (paramv, signal_id, 0, NULL);
23699 for (n = 0; n < num_params + 1; n++)
23700 g_value_unset (&paramv[n]);
23701 g_free (paramv);
23702}
23703
23704static void
23705flash_proxy_g_properties_changed (GDBusProxy *_proxy,
23706 GVariant *changed_properties,
23707 const gchar *const *invalidated_properties)
23708{
23709 FlashProxy *proxy = FLASH_PROXY (_proxy);
23710 guint n;
23711 const gchar *key;
23712 GVariantIter *iter;
23713 _ExtendedGDBusPropertyInfo *info;
23714 g_variant_get (changed_properties, "a{sv}", &iter);
23715 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
23716 {
23717 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, key);
23718 g_datalist_remove_data (&proxy->priv->qdata, key);
23719 if (info != NULL)
23720 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
23721 }
23722 g_variant_iter_free (iter);
23723 for (n = 0; invalidated_properties[n] != NULL; n++)
23724 {
23725 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, invalidated_properties[n]);
23726 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
23727 if (info != NULL)
23728 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
23729 }
23730}
23731
Norman James18998182015-10-11 21:54:53 -050023732static const gchar *
23733flash_proxy_get_filename (Flash *object)
23734{
23735 FlashProxy *proxy = FLASH_PROXY (object);
23736 GVariant *variant;
23737 const gchar *value = NULL;
23738 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "filename");
23739 if (variant != NULL)
23740 {
23741 value = g_variant_get_string (variant, NULL);
23742 g_variant_unref (variant);
23743 }
23744 return value;
23745}
23746
23747static const gchar *
23748flash_proxy_get_flasher_path (Flash *object)
23749{
23750 FlashProxy *proxy = FLASH_PROXY (object);
23751 GVariant *variant;
23752 const gchar *value = NULL;
23753 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "flasher_path");
23754 if (variant != NULL)
23755 {
23756 value = g_variant_get_string (variant, NULL);
23757 g_variant_unref (variant);
23758 }
23759 return value;
23760}
23761
23762static const gchar *
23763flash_proxy_get_flasher_name (Flash *object)
23764{
23765 FlashProxy *proxy = FLASH_PROXY (object);
23766 GVariant *variant;
23767 const gchar *value = NULL;
23768 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "flasher_name");
23769 if (variant != NULL)
23770 {
23771 value = g_variant_get_string (variant, NULL);
23772 g_variant_unref (variant);
23773 }
23774 return value;
23775}
23776
23777static const gchar *
23778flash_proxy_get_flasher_instance (Flash *object)
23779{
23780 FlashProxy *proxy = FLASH_PROXY (object);
23781 GVariant *variant;
23782 const gchar *value = NULL;
23783 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "flasher_instance");
23784 if (variant != NULL)
23785 {
23786 value = g_variant_get_string (variant, NULL);
23787 g_variant_unref (variant);
23788 }
23789 return value;
23790}
23791
Norman James166acf42015-10-22 07:11:51 -050023792static const gchar *
23793flash_proxy_get_status (Flash *object)
23794{
23795 FlashProxy *proxy = FLASH_PROXY (object);
23796 GVariant *variant;
23797 const gchar *value = NULL;
23798 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "status");
23799 if (variant != NULL)
23800 {
23801 value = g_variant_get_string (variant, NULL);
23802 g_variant_unref (variant);
23803 }
23804 return value;
23805}
23806
Norman James362a80f2015-09-14 14:04:39 -050023807static void
23808flash_proxy_init (FlashProxy *proxy)
23809{
23810#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
23811 proxy->priv = flash_proxy_get_instance_private (proxy);
23812#else
23813 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_FLASH_PROXY, FlashProxyPrivate);
23814#endif
23815
23816 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), flash_interface_info ());
23817}
23818
23819static void
23820flash_proxy_class_init (FlashProxyClass *klass)
23821{
23822 GObjectClass *gobject_class;
23823 GDBusProxyClass *proxy_class;
23824
23825 gobject_class = G_OBJECT_CLASS (klass);
23826 gobject_class->finalize = flash_proxy_finalize;
23827 gobject_class->get_property = flash_proxy_get_property;
23828 gobject_class->set_property = flash_proxy_set_property;
23829
23830 proxy_class = G_DBUS_PROXY_CLASS (klass);
23831 proxy_class->g_signal = flash_proxy_g_signal;
23832 proxy_class->g_properties_changed = flash_proxy_g_properties_changed;
23833
Norman James18998182015-10-11 21:54:53 -050023834 flash_override_properties (gobject_class, 1);
23835
Norman James362a80f2015-09-14 14:04:39 -050023836#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
23837 g_type_class_add_private (klass, sizeof (FlashProxyPrivate));
23838#endif
23839}
23840
23841static void
23842flash_proxy_iface_init (FlashIface *iface)
23843{
Norman James18998182015-10-11 21:54:53 -050023844 iface->get_filename = flash_proxy_get_filename;
23845 iface->get_flasher_path = flash_proxy_get_flasher_path;
23846 iface->get_flasher_name = flash_proxy_get_flasher_name;
23847 iface->get_flasher_instance = flash_proxy_get_flasher_instance;
Norman James166acf42015-10-22 07:11:51 -050023848 iface->get_status = flash_proxy_get_status;
Norman James362a80f2015-09-14 14:04:39 -050023849}
23850
23851/**
23852 * flash_proxy_new:
23853 * @connection: A #GDBusConnection.
23854 * @flags: Flags from the #GDBusProxyFlags enumeration.
23855 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
23856 * @object_path: An object path.
23857 * @cancellable: (allow-none): A #GCancellable or %NULL.
23858 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
23859 * @user_data: User data to pass to @callback.
23860 *
23861 * 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.
23862 *
23863 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
23864 * You can then call flash_proxy_new_finish() to get the result of the operation.
23865 *
23866 * See flash_proxy_new_sync() for the synchronous, blocking version of this constructor.
23867 */
23868void
23869flash_proxy_new (
23870 GDBusConnection *connection,
23871 GDBusProxyFlags flags,
23872 const gchar *name,
23873 const gchar *object_path,
23874 GCancellable *cancellable,
23875 GAsyncReadyCallback callback,
23876 gpointer user_data)
23877{
23878 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);
23879}
23880
23881/**
23882 * flash_proxy_new_finish:
23883 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_proxy_new().
23884 * @error: Return location for error or %NULL
23885 *
23886 * Finishes an operation started with flash_proxy_new().
23887 *
23888 * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set.
23889 */
23890Flash *
23891flash_proxy_new_finish (
23892 GAsyncResult *res,
23893 GError **error)
23894{
23895 GObject *ret;
23896 GObject *source_object;
23897 source_object = g_async_result_get_source_object (res);
23898 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
23899 g_object_unref (source_object);
23900 if (ret != NULL)
23901 return FLASH (ret);
23902 else
23903 return NULL;
23904}
23905
23906/**
23907 * flash_proxy_new_sync:
23908 * @connection: A #GDBusConnection.
23909 * @flags: Flags from the #GDBusProxyFlags enumeration.
23910 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
23911 * @object_path: An object path.
23912 * @cancellable: (allow-none): A #GCancellable or %NULL.
23913 * @error: Return location for error or %NULL
23914 *
23915 * 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.
23916 *
23917 * The calling thread is blocked until a reply is received.
23918 *
23919 * See flash_proxy_new() for the asynchronous version of this constructor.
23920 *
23921 * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set.
23922 */
23923Flash *
23924flash_proxy_new_sync (
23925 GDBusConnection *connection,
23926 GDBusProxyFlags flags,
23927 const gchar *name,
23928 const gchar *object_path,
23929 GCancellable *cancellable,
23930 GError **error)
23931{
23932 GInitable *ret;
23933 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);
23934 if (ret != NULL)
23935 return FLASH (ret);
23936 else
23937 return NULL;
23938}
23939
23940
23941/**
23942 * flash_proxy_new_for_bus:
23943 * @bus_type: A #GBusType.
23944 * @flags: Flags from the #GDBusProxyFlags enumeration.
23945 * @name: A bus name (well-known or unique).
23946 * @object_path: An object path.
23947 * @cancellable: (allow-none): A #GCancellable or %NULL.
23948 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
23949 * @user_data: User data to pass to @callback.
23950 *
23951 * Like flash_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
23952 *
23953 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
23954 * You can then call flash_proxy_new_for_bus_finish() to get the result of the operation.
23955 *
23956 * See flash_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
23957 */
23958void
23959flash_proxy_new_for_bus (
23960 GBusType bus_type,
23961 GDBusProxyFlags flags,
23962 const gchar *name,
23963 const gchar *object_path,
23964 GCancellable *cancellable,
23965 GAsyncReadyCallback callback,
23966 gpointer user_data)
23967{
23968 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);
23969}
23970
23971/**
23972 * flash_proxy_new_for_bus_finish:
23973 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_proxy_new_for_bus().
23974 * @error: Return location for error or %NULL
23975 *
23976 * Finishes an operation started with flash_proxy_new_for_bus().
23977 *
23978 * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set.
23979 */
23980Flash *
23981flash_proxy_new_for_bus_finish (
23982 GAsyncResult *res,
23983 GError **error)
23984{
23985 GObject *ret;
23986 GObject *source_object;
23987 source_object = g_async_result_get_source_object (res);
23988 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
23989 g_object_unref (source_object);
23990 if (ret != NULL)
23991 return FLASH (ret);
23992 else
23993 return NULL;
23994}
23995
23996/**
23997 * flash_proxy_new_for_bus_sync:
23998 * @bus_type: A #GBusType.
23999 * @flags: Flags from the #GDBusProxyFlags enumeration.
24000 * @name: A bus name (well-known or unique).
24001 * @object_path: An object path.
24002 * @cancellable: (allow-none): A #GCancellable or %NULL.
24003 * @error: Return location for error or %NULL
24004 *
24005 * Like flash_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
24006 *
24007 * The calling thread is blocked until a reply is received.
24008 *
24009 * See flash_proxy_new_for_bus() for the asynchronous version of this constructor.
24010 *
24011 * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set.
24012 */
24013Flash *
24014flash_proxy_new_for_bus_sync (
24015 GBusType bus_type,
24016 GDBusProxyFlags flags,
24017 const gchar *name,
24018 const gchar *object_path,
24019 GCancellable *cancellable,
24020 GError **error)
24021{
24022 GInitable *ret;
24023 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);
24024 if (ret != NULL)
24025 return FLASH (ret);
24026 else
24027 return NULL;
24028}
24029
24030
24031/* ------------------------------------------------------------------------ */
24032
24033/**
24034 * FlashSkeleton:
24035 *
24036 * The #FlashSkeleton structure contains only private data and should only be accessed using the provided API.
24037 */
24038
24039/**
24040 * FlashSkeletonClass:
24041 * @parent_class: The parent class.
24042 *
24043 * Class structure for #FlashSkeleton.
24044 */
24045
24046struct _FlashSkeletonPrivate
24047{
24048 GValue *properties;
24049 GList *changed_properties;
24050 GSource *changed_properties_idle_source;
24051 GMainContext *context;
24052 GMutex lock;
24053};
24054
24055static void
24056_flash_skeleton_handle_method_call (
24057 GDBusConnection *connection G_GNUC_UNUSED,
24058 const gchar *sender G_GNUC_UNUSED,
24059 const gchar *object_path G_GNUC_UNUSED,
24060 const gchar *interface_name,
24061 const gchar *method_name,
24062 GVariant *parameters,
24063 GDBusMethodInvocation *invocation,
24064 gpointer user_data)
24065{
24066 FlashSkeleton *skeleton = FLASH_SKELETON (user_data);
24067 _ExtendedGDBusMethodInfo *info;
24068 GVariantIter iter;
24069 GVariant *child;
24070 GValue *paramv;
24071 guint num_params;
24072 guint num_extra;
24073 guint n;
24074 guint signal_id;
24075 GValue return_value = G_VALUE_INIT;
24076 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
24077 g_assert (info != NULL);
24078 num_params = g_variant_n_children (parameters);
24079 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
24080 n = 0;
24081 g_value_init (&paramv[n], TYPE_FLASH);
24082 g_value_set_object (&paramv[n++], skeleton);
24083 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
24084 g_value_set_object (&paramv[n++], invocation);
24085 if (info->pass_fdlist)
24086 {
24087#ifdef G_OS_UNIX
24088 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
24089 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
24090#else
24091 g_assert_not_reached ();
24092#endif
24093 }
24094 g_variant_iter_init (&iter, parameters);
24095 while ((child = g_variant_iter_next_value (&iter)) != NULL)
24096 {
24097 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
24098 if (arg_info->use_gvariant)
24099 {
24100 g_value_init (&paramv[n], G_TYPE_VARIANT);
24101 g_value_set_variant (&paramv[n], child);
24102 n++;
24103 }
24104 else
24105 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
24106 g_variant_unref (child);
24107 }
24108 signal_id = g_signal_lookup (info->signal_name, TYPE_FLASH);
24109 g_value_init (&return_value, G_TYPE_BOOLEAN);
24110 g_signal_emitv (paramv, signal_id, 0, &return_value);
24111 if (!g_value_get_boolean (&return_value))
24112 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);
24113 g_value_unset (&return_value);
24114 for (n = 0; n < num_params + num_extra; n++)
24115 g_value_unset (&paramv[n]);
24116 g_free (paramv);
24117}
24118
24119static GVariant *
24120_flash_skeleton_handle_get_property (
24121 GDBusConnection *connection G_GNUC_UNUSED,
24122 const gchar *sender G_GNUC_UNUSED,
24123 const gchar *object_path G_GNUC_UNUSED,
24124 const gchar *interface_name G_GNUC_UNUSED,
24125 const gchar *property_name,
24126 GError **error,
24127 gpointer user_data)
24128{
24129 FlashSkeleton *skeleton = FLASH_SKELETON (user_data);
24130 GValue value = G_VALUE_INIT;
24131 GParamSpec *pspec;
24132 _ExtendedGDBusPropertyInfo *info;
24133 GVariant *ret;
24134 ret = NULL;
24135 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, property_name);
24136 g_assert (info != NULL);
24137 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
24138 if (pspec == NULL)
24139 {
24140 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
24141 }
24142 else
24143 {
24144 g_value_init (&value, pspec->value_type);
24145 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
24146 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
24147 g_value_unset (&value);
24148 }
24149 return ret;
24150}
24151
24152static gboolean
24153_flash_skeleton_handle_set_property (
24154 GDBusConnection *connection G_GNUC_UNUSED,
24155 const gchar *sender G_GNUC_UNUSED,
24156 const gchar *object_path G_GNUC_UNUSED,
24157 const gchar *interface_name G_GNUC_UNUSED,
24158 const gchar *property_name,
24159 GVariant *variant,
24160 GError **error,
24161 gpointer user_data)
24162{
24163 FlashSkeleton *skeleton = FLASH_SKELETON (user_data);
24164 GValue value = G_VALUE_INIT;
24165 GParamSpec *pspec;
24166 _ExtendedGDBusPropertyInfo *info;
24167 gboolean ret;
24168 ret = FALSE;
24169 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, property_name);
24170 g_assert (info != NULL);
24171 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
24172 if (pspec == NULL)
24173 {
24174 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
24175 }
24176 else
24177 {
24178 if (info->use_gvariant)
24179 g_value_set_variant (&value, variant);
24180 else
24181 g_dbus_gvariant_to_gvalue (variant, &value);
24182 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
24183 g_value_unset (&value);
24184 ret = TRUE;
24185 }
24186 return ret;
24187}
24188
24189static const GDBusInterfaceVTable _flash_skeleton_vtable =
24190{
24191 _flash_skeleton_handle_method_call,
24192 _flash_skeleton_handle_get_property,
24193 _flash_skeleton_handle_set_property,
24194 {NULL}
24195};
24196
24197static GDBusInterfaceInfo *
24198flash_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
24199{
24200 return flash_interface_info ();
24201}
24202
24203static GDBusInterfaceVTable *
24204flash_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
24205{
24206 return (GDBusInterfaceVTable *) &_flash_skeleton_vtable;
24207}
24208
24209static GVariant *
24210flash_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
24211{
24212 FlashSkeleton *skeleton = FLASH_SKELETON (_skeleton);
24213
24214 GVariantBuilder builder;
24215 guint n;
24216 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
24217 if (_flash_interface_info.parent_struct.properties == NULL)
24218 goto out;
24219 for (n = 0; _flash_interface_info.parent_struct.properties[n] != NULL; n++)
24220 {
24221 GDBusPropertyInfo *info = _flash_interface_info.parent_struct.properties[n];
24222 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
24223 {
24224 GVariant *value;
24225 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);
24226 if (value != NULL)
24227 {
24228 g_variant_take_ref (value);
24229 g_variant_builder_add (&builder, "{sv}", info->name, value);
24230 g_variant_unref (value);
24231 }
24232 }
24233 }
24234out:
24235 return g_variant_builder_end (&builder);
24236}
24237
Norman James18998182015-10-11 21:54:53 -050024238static gboolean _flash_emit_changed (gpointer user_data);
24239
Norman James362a80f2015-09-14 14:04:39 -050024240static void
24241flash_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
24242{
Norman James18998182015-10-11 21:54:53 -050024243 FlashSkeleton *skeleton = FLASH_SKELETON (_skeleton);
24244 gboolean emit_changed = FALSE;
24245
24246 g_mutex_lock (&skeleton->priv->lock);
24247 if (skeleton->priv->changed_properties_idle_source != NULL)
24248 {
24249 g_source_destroy (skeleton->priv->changed_properties_idle_source);
24250 skeleton->priv->changed_properties_idle_source = NULL;
24251 emit_changed = TRUE;
24252 }
24253 g_mutex_unlock (&skeleton->priv->lock);
24254
24255 if (emit_changed)
24256 _flash_emit_changed (skeleton);
Norman James362a80f2015-09-14 14:04:39 -050024257}
24258
24259static void
24260_flash_on_signal_updated (
24261 Flash *object)
24262{
24263 FlashSkeleton *skeleton = FLASH_SKELETON (object);
24264
24265 GList *connections, *l;
24266 GVariant *signal_variant;
24267 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
24268
24269 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
24270 for (l = connections; l != NULL; l = l->next)
24271 {
24272 GDBusConnection *connection = l->data;
24273 g_dbus_connection_emit_signal (connection,
24274 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Flash", "Updated",
24275 signal_variant, NULL);
24276 }
24277 g_variant_unref (signal_variant);
24278 g_list_free_full (connections, g_object_unref);
24279}
24280
Norman Jamesf066e872015-10-07 15:29:51 -050024281static void
24282_flash_on_signal_download (
24283 Flash *object,
24284 const gchar *arg_url,
24285 const gchar *arg_filename)
24286{
24287 FlashSkeleton *skeleton = FLASH_SKELETON (object);
24288
24289 GList *connections, *l;
24290 GVariant *signal_variant;
24291 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
24292
24293 signal_variant = g_variant_ref_sink (g_variant_new ("(ss)",
24294 arg_url,
24295 arg_filename));
24296 for (l = connections; l != NULL; l = l->next)
24297 {
24298 GDBusConnection *connection = l->data;
24299 g_dbus_connection_emit_signal (connection,
24300 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Flash", "Download",
24301 signal_variant, NULL);
24302 }
24303 g_variant_unref (signal_variant);
24304 g_list_free_full (connections, g_object_unref);
24305}
24306
Norman James362a80f2015-09-14 14:04:39 -050024307static void flash_skeleton_iface_init (FlashIface *iface);
24308#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
24309G_DEFINE_TYPE_WITH_CODE (FlashSkeleton, flash_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
24310 G_ADD_PRIVATE (FlashSkeleton)
24311 G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_skeleton_iface_init));
24312
24313#else
24314G_DEFINE_TYPE_WITH_CODE (FlashSkeleton, flash_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
24315 G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_skeleton_iface_init));
24316
24317#endif
24318static void
24319flash_skeleton_finalize (GObject *object)
24320{
24321 FlashSkeleton *skeleton = FLASH_SKELETON (object);
Norman James18998182015-10-11 21:54:53 -050024322 guint n;
Norman James166acf42015-10-22 07:11:51 -050024323 for (n = 0; n < 5; n++)
Norman James18998182015-10-11 21:54:53 -050024324 g_value_unset (&skeleton->priv->properties[n]);
24325 g_free (skeleton->priv->properties);
Norman James362a80f2015-09-14 14:04:39 -050024326 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
24327 if (skeleton->priv->changed_properties_idle_source != NULL)
24328 g_source_destroy (skeleton->priv->changed_properties_idle_source);
24329 g_main_context_unref (skeleton->priv->context);
24330 g_mutex_clear (&skeleton->priv->lock);
24331 G_OBJECT_CLASS (flash_skeleton_parent_class)->finalize (object);
24332}
24333
24334static void
Norman James18998182015-10-11 21:54:53 -050024335flash_skeleton_get_property (GObject *object,
24336 guint prop_id,
24337 GValue *value,
24338 GParamSpec *pspec G_GNUC_UNUSED)
24339{
24340 FlashSkeleton *skeleton = FLASH_SKELETON (object);
Norman James166acf42015-10-22 07:11:51 -050024341 g_assert (prop_id != 0 && prop_id - 1 < 5);
Norman James18998182015-10-11 21:54:53 -050024342 g_mutex_lock (&skeleton->priv->lock);
24343 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
24344 g_mutex_unlock (&skeleton->priv->lock);
24345}
24346
24347static gboolean
24348_flash_emit_changed (gpointer user_data)
24349{
24350 FlashSkeleton *skeleton = FLASH_SKELETON (user_data);
24351 GList *l;
24352 GVariantBuilder builder;
24353 GVariantBuilder invalidated_builder;
24354 guint num_changes;
24355
24356 g_mutex_lock (&skeleton->priv->lock);
24357 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
24358 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
24359 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
24360 {
24361 ChangedProperty *cp = l->data;
24362 GVariant *variant;
24363 const GValue *cur_value;
24364
24365 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
24366 if (!_g_value_equal (cur_value, &cp->orig_value))
24367 {
24368 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
24369 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
24370 g_variant_unref (variant);
24371 num_changes++;
24372 }
24373 }
24374 if (num_changes > 0)
24375 {
24376 GList *connections, *ll;
24377 GVariant *signal_variant;
24378 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Flash",
24379 &builder, &invalidated_builder));
24380 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
24381 for (ll = connections; ll != NULL; ll = ll->next)
24382 {
24383 GDBusConnection *connection = ll->data;
24384
24385 g_dbus_connection_emit_signal (connection,
24386 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
24387 "org.freedesktop.DBus.Properties",
24388 "PropertiesChanged",
24389 signal_variant,
24390 NULL);
24391 }
24392 g_variant_unref (signal_variant);
24393 g_list_free_full (connections, g_object_unref);
24394 }
24395 else
24396 {
24397 g_variant_builder_clear (&builder);
24398 g_variant_builder_clear (&invalidated_builder);
24399 }
24400 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
24401 skeleton->priv->changed_properties = NULL;
24402 skeleton->priv->changed_properties_idle_source = NULL;
24403 g_mutex_unlock (&skeleton->priv->lock);
24404 return FALSE;
24405}
24406
24407static void
24408_flash_schedule_emit_changed (FlashSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
24409{
24410 ChangedProperty *cp;
24411 GList *l;
24412 cp = NULL;
24413 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
24414 {
24415 ChangedProperty *i_cp = l->data;
24416 if (i_cp->info == info)
24417 {
24418 cp = i_cp;
24419 break;
24420 }
24421 }
24422 if (cp == NULL)
24423 {
24424 cp = g_new0 (ChangedProperty, 1);
24425 cp->prop_id = prop_id;
24426 cp->info = info;
24427 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
24428 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
24429 g_value_copy (orig_value, &cp->orig_value);
24430 }
24431}
24432
24433static void
24434flash_skeleton_notify (GObject *object,
24435 GParamSpec *pspec G_GNUC_UNUSED)
24436{
24437 FlashSkeleton *skeleton = FLASH_SKELETON (object);
24438 g_mutex_lock (&skeleton->priv->lock);
24439 if (skeleton->priv->changed_properties != NULL &&
24440 skeleton->priv->changed_properties_idle_source == NULL)
24441 {
24442 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
24443 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
24444 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _flash_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
Adriana Kobylakfd778822016-06-16 09:08:37 -050024445 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _flash_emit_changed");
Norman James18998182015-10-11 21:54:53 -050024446 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
24447 g_source_unref (skeleton->priv->changed_properties_idle_source);
24448 }
24449 g_mutex_unlock (&skeleton->priv->lock);
24450}
24451
24452static void
24453flash_skeleton_set_property (GObject *object,
24454 guint prop_id,
24455 const GValue *value,
24456 GParamSpec *pspec)
24457{
24458 FlashSkeleton *skeleton = FLASH_SKELETON (object);
Norman James166acf42015-10-22 07:11:51 -050024459 g_assert (prop_id != 0 && prop_id - 1 < 5);
Norman James18998182015-10-11 21:54:53 -050024460 g_mutex_lock (&skeleton->priv->lock);
24461 g_object_freeze_notify (object);
24462 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
24463 {
24464 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
24465 _flash_schedule_emit_changed (skeleton, _flash_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
24466 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
24467 g_object_notify_by_pspec (object, pspec);
24468 }
24469 g_mutex_unlock (&skeleton->priv->lock);
24470 g_object_thaw_notify (object);
24471}
24472
24473static void
Norman James362a80f2015-09-14 14:04:39 -050024474flash_skeleton_init (FlashSkeleton *skeleton)
24475{
24476#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
24477 skeleton->priv = flash_skeleton_get_instance_private (skeleton);
24478#else
24479 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_FLASH_SKELETON, FlashSkeletonPrivate);
24480#endif
24481
24482 g_mutex_init (&skeleton->priv->lock);
24483 skeleton->priv->context = g_main_context_ref_thread_default ();
Norman James166acf42015-10-22 07:11:51 -050024484 skeleton->priv->properties = g_new0 (GValue, 5);
Norman James18998182015-10-11 21:54:53 -050024485 g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING);
24486 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
24487 g_value_init (&skeleton->priv->properties[2], G_TYPE_STRING);
24488 g_value_init (&skeleton->priv->properties[3], G_TYPE_STRING);
Norman James166acf42015-10-22 07:11:51 -050024489 g_value_init (&skeleton->priv->properties[4], G_TYPE_STRING);
Norman James18998182015-10-11 21:54:53 -050024490}
24491
24492static const gchar *
24493flash_skeleton_get_filename (Flash *object)
24494{
24495 FlashSkeleton *skeleton = FLASH_SKELETON (object);
24496 const gchar *value;
24497 g_mutex_lock (&skeleton->priv->lock);
24498 value = g_value_get_string (&(skeleton->priv->properties[0]));
24499 g_mutex_unlock (&skeleton->priv->lock);
24500 return value;
24501}
24502
24503static const gchar *
24504flash_skeleton_get_flasher_path (Flash *object)
24505{
24506 FlashSkeleton *skeleton = FLASH_SKELETON (object);
24507 const gchar *value;
24508 g_mutex_lock (&skeleton->priv->lock);
24509 value = g_value_get_string (&(skeleton->priv->properties[1]));
24510 g_mutex_unlock (&skeleton->priv->lock);
24511 return value;
24512}
24513
24514static const gchar *
24515flash_skeleton_get_flasher_name (Flash *object)
24516{
24517 FlashSkeleton *skeleton = FLASH_SKELETON (object);
24518 const gchar *value;
24519 g_mutex_lock (&skeleton->priv->lock);
24520 value = g_value_get_string (&(skeleton->priv->properties[2]));
24521 g_mutex_unlock (&skeleton->priv->lock);
24522 return value;
24523}
24524
24525static const gchar *
24526flash_skeleton_get_flasher_instance (Flash *object)
24527{
24528 FlashSkeleton *skeleton = FLASH_SKELETON (object);
24529 const gchar *value;
24530 g_mutex_lock (&skeleton->priv->lock);
24531 value = g_value_get_string (&(skeleton->priv->properties[3]));
24532 g_mutex_unlock (&skeleton->priv->lock);
24533 return value;
Norman James362a80f2015-09-14 14:04:39 -050024534}
24535
Norman James166acf42015-10-22 07:11:51 -050024536static const gchar *
24537flash_skeleton_get_status (Flash *object)
24538{
24539 FlashSkeleton *skeleton = FLASH_SKELETON (object);
24540 const gchar *value;
24541 g_mutex_lock (&skeleton->priv->lock);
24542 value = g_value_get_string (&(skeleton->priv->properties[4]));
24543 g_mutex_unlock (&skeleton->priv->lock);
24544 return value;
24545}
24546
Norman James362a80f2015-09-14 14:04:39 -050024547static void
24548flash_skeleton_class_init (FlashSkeletonClass *klass)
24549{
24550 GObjectClass *gobject_class;
24551 GDBusInterfaceSkeletonClass *skeleton_class;
24552
24553 gobject_class = G_OBJECT_CLASS (klass);
24554 gobject_class->finalize = flash_skeleton_finalize;
Norman James18998182015-10-11 21:54:53 -050024555 gobject_class->get_property = flash_skeleton_get_property;
24556 gobject_class->set_property = flash_skeleton_set_property;
24557 gobject_class->notify = flash_skeleton_notify;
24558
24559
24560 flash_override_properties (gobject_class, 1);
Norman James362a80f2015-09-14 14:04:39 -050024561
24562 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
24563 skeleton_class->get_info = flash_skeleton_dbus_interface_get_info;
24564 skeleton_class->get_properties = flash_skeleton_dbus_interface_get_properties;
24565 skeleton_class->flush = flash_skeleton_dbus_interface_flush;
24566 skeleton_class->get_vtable = flash_skeleton_dbus_interface_get_vtable;
24567
24568#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
24569 g_type_class_add_private (klass, sizeof (FlashSkeletonPrivate));
24570#endif
24571}
24572
24573static void
24574flash_skeleton_iface_init (FlashIface *iface)
24575{
24576 iface->updated = _flash_on_signal_updated;
Norman Jamesf066e872015-10-07 15:29:51 -050024577 iface->download = _flash_on_signal_download;
Norman James18998182015-10-11 21:54:53 -050024578 iface->get_filename = flash_skeleton_get_filename;
24579 iface->get_flasher_path = flash_skeleton_get_flasher_path;
24580 iface->get_flasher_name = flash_skeleton_get_flasher_name;
24581 iface->get_flasher_instance = flash_skeleton_get_flasher_instance;
Norman James166acf42015-10-22 07:11:51 -050024582 iface->get_status = flash_skeleton_get_status;
Norman James362a80f2015-09-14 14:04:39 -050024583}
24584
24585/**
24586 * flash_skeleton_new:
24587 *
24588 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>.
24589 *
24590 * Returns: (transfer full) (type FlashSkeleton): The skeleton object.
24591 */
24592Flash *
24593flash_skeleton_new (void)
24594{
24595 return FLASH (g_object_new (TYPE_FLASH_SKELETON, NULL));
24596}
24597
24598/* ------------------------------------------------------------------------
Norman James18998182015-10-11 21:54:53 -050024599 * Code for interface org.openbmc.FlashControl
24600 * ------------------------------------------------------------------------
24601 */
24602
24603/**
24604 * SECTION:FlashControl
24605 * @title: FlashControl
24606 * @short_description: Generated C code for the org.openbmc.FlashControl D-Bus interface
24607 *
24608 * 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.
24609 */
24610
24611/* ---- Introspection data for org.openbmc.FlashControl ---- */
24612
24613static const _ExtendedGDBusArgInfo _flash_control_method_info_flash_IN_ARG_type =
24614{
24615 {
24616 -1,
24617 (gchar *) "type",
24618 (gchar *) "s",
24619 NULL
24620 },
24621 FALSE
24622};
24623
24624static const _ExtendedGDBusArgInfo _flash_control_method_info_flash_IN_ARG_filename =
24625{
24626 {
24627 -1,
24628 (gchar *) "filename",
24629 (gchar *) "s",
24630 NULL
24631 },
24632 FALSE
24633};
24634
24635static const _ExtendedGDBusArgInfo * const _flash_control_method_info_flash_IN_ARG_pointers[] =
24636{
24637 &_flash_control_method_info_flash_IN_ARG_type,
24638 &_flash_control_method_info_flash_IN_ARG_filename,
24639 NULL
24640};
24641
24642static const _ExtendedGDBusMethodInfo _flash_control_method_info_flash =
24643{
24644 {
24645 -1,
24646 (gchar *) "flash",
24647 (GDBusArgInfo **) &_flash_control_method_info_flash_IN_ARG_pointers,
24648 NULL,
24649 NULL
24650 },
24651 "handle-flash",
24652 FALSE
24653};
24654
24655static const _ExtendedGDBusMethodInfo * const _flash_control_method_info_pointers[] =
24656{
24657 &_flash_control_method_info_flash,
24658 NULL
24659};
24660
24661static const _ExtendedGDBusArgInfo _flash_control_signal_info_done_ARG_filename =
24662{
24663 {
24664 -1,
24665 (gchar *) "filename",
24666 (gchar *) "s",
24667 NULL
24668 },
24669 FALSE
24670};
24671
24672static const _ExtendedGDBusArgInfo * const _flash_control_signal_info_done_ARG_pointers[] =
24673{
24674 &_flash_control_signal_info_done_ARG_filename,
24675 NULL
24676};
24677
24678static const _ExtendedGDBusSignalInfo _flash_control_signal_info_done =
24679{
24680 {
24681 -1,
24682 (gchar *) "Done",
24683 (GDBusArgInfo **) &_flash_control_signal_info_done_ARG_pointers,
24684 NULL
24685 },
24686 "done"
24687};
24688
24689static const _ExtendedGDBusArgInfo _flash_control_signal_info_error_ARG_filename =
24690{
24691 {
24692 -1,
24693 (gchar *) "filename",
24694 (gchar *) "s",
24695 NULL
24696 },
24697 FALSE
24698};
24699
24700static const _ExtendedGDBusArgInfo * const _flash_control_signal_info_error_ARG_pointers[] =
24701{
24702 &_flash_control_signal_info_error_ARG_filename,
24703 NULL
24704};
24705
24706static const _ExtendedGDBusSignalInfo _flash_control_signal_info_error =
24707{
24708 {
24709 -1,
24710 (gchar *) "Error",
24711 (GDBusArgInfo **) &_flash_control_signal_info_error_ARG_pointers,
24712 NULL
24713 },
24714 "error"
24715};
24716
24717static const _ExtendedGDBusArgInfo _flash_control_signal_info_progress_ARG_filename =
24718{
24719 {
24720 -1,
24721 (gchar *) "filename",
24722 (gchar *) "s",
24723 NULL
24724 },
24725 FALSE
24726};
24727
24728static const _ExtendedGDBusArgInfo _flash_control_signal_info_progress_ARG_progress =
24729{
24730 {
24731 -1,
24732 (gchar *) "progress",
24733 (gchar *) "y",
24734 NULL
24735 },
24736 FALSE
24737};
24738
24739static const _ExtendedGDBusArgInfo * const _flash_control_signal_info_progress_ARG_pointers[] =
24740{
24741 &_flash_control_signal_info_progress_ARG_filename,
24742 &_flash_control_signal_info_progress_ARG_progress,
24743 NULL
24744};
24745
24746static const _ExtendedGDBusSignalInfo _flash_control_signal_info_progress =
24747{
24748 {
24749 -1,
24750 (gchar *) "Progress",
24751 (GDBusArgInfo **) &_flash_control_signal_info_progress_ARG_pointers,
24752 NULL
24753 },
24754 "progress"
24755};
24756
24757static const _ExtendedGDBusSignalInfo * const _flash_control_signal_info_pointers[] =
24758{
24759 &_flash_control_signal_info_done,
24760 &_flash_control_signal_info_error,
24761 &_flash_control_signal_info_progress,
24762 NULL
24763};
24764
24765static const _ExtendedGDBusPropertyInfo _flash_control_property_info_filename =
24766{
24767 {
24768 -1,
24769 (gchar *) "filename",
24770 (gchar *) "s",
24771 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
24772 NULL
24773 },
24774 "filename",
24775 FALSE
24776};
24777
24778static const _ExtendedGDBusPropertyInfo _flash_control_property_info_type_ =
24779{
24780 {
24781 -1,
24782 (gchar *) "type",
24783 (gchar *) "s",
24784 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
24785 NULL
24786 },
24787 "type",
24788 FALSE
24789};
24790
24791static const _ExtendedGDBusPropertyInfo * const _flash_control_property_info_pointers[] =
24792{
24793 &_flash_control_property_info_filename,
24794 &_flash_control_property_info_type_,
24795 NULL
24796};
24797
24798static const _ExtendedGDBusInterfaceInfo _flash_control_interface_info =
24799{
24800 {
24801 -1,
24802 (gchar *) "org.openbmc.FlashControl",
24803 (GDBusMethodInfo **) &_flash_control_method_info_pointers,
24804 (GDBusSignalInfo **) &_flash_control_signal_info_pointers,
24805 (GDBusPropertyInfo **) &_flash_control_property_info_pointers,
24806 NULL
24807 },
24808 "flash-control",
24809};
24810
24811
24812/**
24813 * flash_control_interface_info:
24814 *
24815 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link> D-Bus interface.
24816 *
24817 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
24818 */
24819GDBusInterfaceInfo *
24820flash_control_interface_info (void)
24821{
24822 return (GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct;
24823}
24824
24825/**
24826 * flash_control_override_properties:
24827 * @klass: The class structure for a #GObject<!-- -->-derived class.
24828 * @property_id_begin: The property id to assign to the first overridden property.
24829 *
24830 * Overrides all #GObject properties in the #FlashControl interface for a concrete class.
24831 * The properties are overridden in the order they are defined.
24832 *
24833 * Returns: The last property id.
24834 */
24835guint
24836flash_control_override_properties (GObjectClass *klass, guint property_id_begin)
24837{
24838 g_object_class_override_property (klass, property_id_begin++, "filename");
24839 g_object_class_override_property (klass, property_id_begin++, "type");
24840 return property_id_begin - 1;
24841}
24842
24843
24844
24845/**
24846 * FlashControl:
24847 *
24848 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link>.
24849 */
24850
24851/**
24852 * FlashControlIface:
24853 * @parent_iface: The parent interface.
24854 * @handle_flash: Handler for the #FlashControl::handle-flash signal.
24855 * @get_filename: Getter for the #FlashControl:filename property.
24856 * @get_type_: Getter for the #FlashControl:type property.
24857 * @done: Handler for the #FlashControl::done signal.
24858 * @error: Handler for the #FlashControl::error signal.
24859 * @progress: Handler for the #FlashControl::progress signal.
24860 *
24861 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link>.
24862 */
24863
24864typedef FlashControlIface FlashControlInterface;
24865G_DEFINE_INTERFACE (FlashControl, flash_control, G_TYPE_OBJECT);
24866
24867static void
24868flash_control_default_init (FlashControlIface *iface)
24869{
24870 /* GObject signals for incoming D-Bus method calls: */
24871 /**
24872 * FlashControl::handle-flash:
24873 * @object: A #FlashControl.
24874 * @invocation: A #GDBusMethodInvocation.
24875 * @arg_type: Argument passed by remote caller.
24876 * @arg_filename: Argument passed by remote caller.
24877 *
24878 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-FlashControl.flash">flash()</link> D-Bus method.
24879 *
24880 * 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.
24881 *
24882 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
24883 */
24884 g_signal_new ("handle-flash",
24885 G_TYPE_FROM_INTERFACE (iface),
24886 G_SIGNAL_RUN_LAST,
24887 G_STRUCT_OFFSET (FlashControlIface, handle_flash),
24888 g_signal_accumulator_true_handled,
24889 NULL,
24890 g_cclosure_marshal_generic,
24891 G_TYPE_BOOLEAN,
24892 3,
24893 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_STRING);
24894
24895 /* GObject signals for received D-Bus signals: */
24896 /**
24897 * FlashControl::done:
24898 * @object: A #FlashControl.
24899 * @arg_filename: Argument.
24900 *
24901 * 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.
24902 *
24903 * 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.
24904 */
24905 g_signal_new ("done",
24906 G_TYPE_FROM_INTERFACE (iface),
24907 G_SIGNAL_RUN_LAST,
24908 G_STRUCT_OFFSET (FlashControlIface, done),
24909 NULL,
24910 NULL,
24911 g_cclosure_marshal_generic,
24912 G_TYPE_NONE,
24913 1, G_TYPE_STRING);
24914
24915 /**
24916 * FlashControl::error:
24917 * @object: A #FlashControl.
24918 * @arg_filename: Argument.
24919 *
24920 * 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.
24921 *
24922 * 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.
24923 */
24924 g_signal_new ("error",
24925 G_TYPE_FROM_INTERFACE (iface),
24926 G_SIGNAL_RUN_LAST,
24927 G_STRUCT_OFFSET (FlashControlIface, error),
24928 NULL,
24929 NULL,
24930 g_cclosure_marshal_generic,
24931 G_TYPE_NONE,
24932 1, G_TYPE_STRING);
24933
24934 /**
24935 * FlashControl::progress:
24936 * @object: A #FlashControl.
24937 * @arg_filename: Argument.
24938 * @arg_progress: Argument.
24939 *
24940 * 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.
24941 *
24942 * 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.
24943 */
24944 g_signal_new ("progress",
24945 G_TYPE_FROM_INTERFACE (iface),
24946 G_SIGNAL_RUN_LAST,
24947 G_STRUCT_OFFSET (FlashControlIface, progress),
24948 NULL,
24949 NULL,
24950 g_cclosure_marshal_generic,
24951 G_TYPE_NONE,
24952 2, G_TYPE_STRING, G_TYPE_UCHAR);
24953
24954 /* GObject properties for D-Bus properties: */
24955 /**
24956 * FlashControl:filename:
24957 *
24958 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-FlashControl.filename">"filename"</link>.
24959 *
24960 * 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.
24961 */
24962 g_object_interface_install_property (iface,
24963 g_param_spec_string ("filename", "filename", "filename", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
24964 /**
24965 * FlashControl:type:
24966 *
24967 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-FlashControl.type">"type"</link>.
24968 *
24969 * 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.
24970 */
24971 g_object_interface_install_property (iface,
24972 g_param_spec_string ("type", "type", "type", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
24973}
24974
24975/**
24976 * flash_control_get_filename: (skip)
24977 * @object: A #FlashControl.
24978 *
24979 * Gets the value of the <link linkend="gdbus-property-org-openbmc-FlashControl.filename">"filename"</link> D-Bus property.
24980 *
24981 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
24982 *
24983 * <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>
24984 *
24985 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
24986 */
24987const gchar *
24988flash_control_get_filename (FlashControl *object)
24989{
24990 return FLASH_CONTROL_GET_IFACE (object)->get_filename (object);
24991}
24992
24993/**
24994 * flash_control_dup_filename: (skip)
24995 * @object: A #FlashControl.
24996 *
24997 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-FlashControl.filename">"filename"</link> D-Bus property.
24998 *
24999 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
25000 *
25001 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
25002 */
25003gchar *
25004flash_control_dup_filename (FlashControl *object)
25005{
25006 gchar *value;
25007 g_object_get (G_OBJECT (object), "filename", &value, NULL);
25008 return value;
25009}
25010
25011/**
25012 * flash_control_set_filename: (skip)
25013 * @object: A #FlashControl.
25014 * @value: The value to set.
25015 *
25016 * Sets the <link linkend="gdbus-property-org-openbmc-FlashControl.filename">"filename"</link> D-Bus property to @value.
25017 *
25018 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
25019 */
25020void
25021flash_control_set_filename (FlashControl *object, const gchar *value)
25022{
25023 g_object_set (G_OBJECT (object), "filename", value, NULL);
25024}
25025
25026/**
25027 * flash_control_get_type_: (skip)
25028 * @object: A #FlashControl.
25029 *
25030 * Gets the value of the <link linkend="gdbus-property-org-openbmc-FlashControl.type">"type"</link> D-Bus property.
25031 *
25032 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
25033 *
25034 * <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>
25035 *
25036 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
25037 */
25038const gchar *
25039flash_control_get_type_ (FlashControl *object)
25040{
25041 return FLASH_CONTROL_GET_IFACE (object)->get_type_ (object);
25042}
25043
25044/**
25045 * flash_control_dup_type_: (skip)
25046 * @object: A #FlashControl.
25047 *
25048 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-FlashControl.type">"type"</link> D-Bus property.
25049 *
25050 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
25051 *
25052 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
25053 */
25054gchar *
25055flash_control_dup_type_ (FlashControl *object)
25056{
25057 gchar *value;
25058 g_object_get (G_OBJECT (object), "type", &value, NULL);
25059 return value;
25060}
25061
25062/**
25063 * flash_control_set_type_: (skip)
25064 * @object: A #FlashControl.
25065 * @value: The value to set.
25066 *
25067 * Sets the <link linkend="gdbus-property-org-openbmc-FlashControl.type">"type"</link> D-Bus property to @value.
25068 *
25069 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
25070 */
25071void
25072flash_control_set_type_ (FlashControl *object, const gchar *value)
25073{
25074 g_object_set (G_OBJECT (object), "type", value, NULL);
25075}
25076
25077/**
25078 * flash_control_emit_done:
25079 * @object: A #FlashControl.
25080 * @arg_filename: Argument to pass with the signal.
25081 *
25082 * Emits the <link linkend="gdbus-signal-org-openbmc-FlashControl.Done">"Done"</link> D-Bus signal.
25083 */
25084void
25085flash_control_emit_done (
25086 FlashControl *object,
25087 const gchar *arg_filename)
25088{
25089 g_signal_emit_by_name (object, "done", arg_filename);
25090}
25091
25092/**
25093 * flash_control_emit_error:
25094 * @object: A #FlashControl.
25095 * @arg_filename: Argument to pass with the signal.
25096 *
25097 * Emits the <link linkend="gdbus-signal-org-openbmc-FlashControl.Error">"Error"</link> D-Bus signal.
25098 */
25099void
25100flash_control_emit_error (
25101 FlashControl *object,
25102 const gchar *arg_filename)
25103{
25104 g_signal_emit_by_name (object, "error", arg_filename);
25105}
25106
25107/**
25108 * flash_control_emit_progress:
25109 * @object: A #FlashControl.
25110 * @arg_filename: Argument to pass with the signal.
25111 * @arg_progress: Argument to pass with the signal.
25112 *
25113 * Emits the <link linkend="gdbus-signal-org-openbmc-FlashControl.Progress">"Progress"</link> D-Bus signal.
25114 */
25115void
25116flash_control_emit_progress (
25117 FlashControl *object,
25118 const gchar *arg_filename,
25119 guchar arg_progress)
25120{
25121 g_signal_emit_by_name (object, "progress", arg_filename, arg_progress);
25122}
25123
25124/**
25125 * flash_control_call_flash:
25126 * @proxy: A #FlashControlProxy.
25127 * @arg_type: Argument to pass with the method invocation.
25128 * @arg_filename: Argument to pass with the method invocation.
25129 * @cancellable: (allow-none): A #GCancellable or %NULL.
25130 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
25131 * @user_data: User data to pass to @callback.
25132 *
25133 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-FlashControl.flash">flash()</link> D-Bus method on @proxy.
25134 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
25135 * You can then call flash_control_call_flash_finish() to get the result of the operation.
25136 *
25137 * See flash_control_call_flash_sync() for the synchronous, blocking version of this method.
25138 */
25139void
25140flash_control_call_flash (
25141 FlashControl *proxy,
25142 const gchar *arg_type,
25143 const gchar *arg_filename,
25144 GCancellable *cancellable,
25145 GAsyncReadyCallback callback,
25146 gpointer user_data)
25147{
25148 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
25149 "flash",
25150 g_variant_new ("(ss)",
25151 arg_type,
25152 arg_filename),
25153 G_DBUS_CALL_FLAGS_NONE,
25154 -1,
25155 cancellable,
25156 callback,
25157 user_data);
25158}
25159
25160/**
25161 * flash_control_call_flash_finish:
25162 * @proxy: A #FlashControlProxy.
25163 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_control_call_flash().
25164 * @error: Return location for error or %NULL.
25165 *
25166 * Finishes an operation started with flash_control_call_flash().
25167 *
25168 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
25169 */
25170gboolean
25171flash_control_call_flash_finish (
25172 FlashControl *proxy,
25173 GAsyncResult *res,
25174 GError **error)
25175{
25176 GVariant *_ret;
25177 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
25178 if (_ret == NULL)
25179 goto _out;
25180 g_variant_get (_ret,
25181 "()");
25182 g_variant_unref (_ret);
25183_out:
25184 return _ret != NULL;
25185}
25186
25187/**
25188 * flash_control_call_flash_sync:
25189 * @proxy: A #FlashControlProxy.
25190 * @arg_type: Argument to pass with the method invocation.
25191 * @arg_filename: Argument to pass with the method invocation.
25192 * @cancellable: (allow-none): A #GCancellable or %NULL.
25193 * @error: Return location for error or %NULL.
25194 *
25195 * 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.
25196 *
25197 * See flash_control_call_flash() for the asynchronous version of this method.
25198 *
25199 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
25200 */
25201gboolean
25202flash_control_call_flash_sync (
25203 FlashControl *proxy,
25204 const gchar *arg_type,
25205 const gchar *arg_filename,
25206 GCancellable *cancellable,
25207 GError **error)
25208{
25209 GVariant *_ret;
25210 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
25211 "flash",
25212 g_variant_new ("(ss)",
25213 arg_type,
25214 arg_filename),
25215 G_DBUS_CALL_FLAGS_NONE,
25216 -1,
25217 cancellable,
25218 error);
25219 if (_ret == NULL)
25220 goto _out;
25221 g_variant_get (_ret,
25222 "()");
25223 g_variant_unref (_ret);
25224_out:
25225 return _ret != NULL;
25226}
25227
25228/**
25229 * flash_control_complete_flash:
25230 * @object: A #FlashControl.
25231 * @invocation: (transfer full): A #GDBusMethodInvocation.
25232 *
25233 * 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.
25234 *
25235 * This method will free @invocation, you cannot use it afterwards.
25236 */
25237void
25238flash_control_complete_flash (
25239 FlashControl *object,
25240 GDBusMethodInvocation *invocation)
25241{
25242 g_dbus_method_invocation_return_value (invocation,
25243 g_variant_new ("()"));
25244}
25245
25246/* ------------------------------------------------------------------------ */
25247
25248/**
25249 * FlashControlProxy:
25250 *
25251 * The #FlashControlProxy structure contains only private data and should only be accessed using the provided API.
25252 */
25253
25254/**
25255 * FlashControlProxyClass:
25256 * @parent_class: The parent class.
25257 *
25258 * Class structure for #FlashControlProxy.
25259 */
25260
25261struct _FlashControlProxyPrivate
25262{
25263 GData *qdata;
25264};
25265
25266static void flash_control_proxy_iface_init (FlashControlIface *iface);
25267
25268#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
25269G_DEFINE_TYPE_WITH_CODE (FlashControlProxy, flash_control_proxy, G_TYPE_DBUS_PROXY,
25270 G_ADD_PRIVATE (FlashControlProxy)
25271 G_IMPLEMENT_INTERFACE (TYPE_FLASH_CONTROL, flash_control_proxy_iface_init));
25272
25273#else
25274G_DEFINE_TYPE_WITH_CODE (FlashControlProxy, flash_control_proxy, G_TYPE_DBUS_PROXY,
25275 G_IMPLEMENT_INTERFACE (TYPE_FLASH_CONTROL, flash_control_proxy_iface_init));
25276
25277#endif
25278static void
25279flash_control_proxy_finalize (GObject *object)
25280{
25281 FlashControlProxy *proxy = FLASH_CONTROL_PROXY (object);
25282 g_datalist_clear (&proxy->priv->qdata);
25283 G_OBJECT_CLASS (flash_control_proxy_parent_class)->finalize (object);
25284}
25285
25286static void
25287flash_control_proxy_get_property (GObject *object,
25288 guint prop_id,
25289 GValue *value,
25290 GParamSpec *pspec G_GNUC_UNUSED)
25291{
25292 const _ExtendedGDBusPropertyInfo *info;
25293 GVariant *variant;
25294 g_assert (prop_id != 0 && prop_id - 1 < 2);
25295 info = _flash_control_property_info_pointers[prop_id - 1];
25296 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
25297 if (info->use_gvariant)
25298 {
25299 g_value_set_variant (value, variant);
25300 }
25301 else
25302 {
25303 if (variant != NULL)
25304 g_dbus_gvariant_to_gvalue (variant, value);
25305 }
25306 if (variant != NULL)
25307 g_variant_unref (variant);
25308}
25309
25310static void
25311flash_control_proxy_set_property_cb (GDBusProxy *proxy,
25312 GAsyncResult *res,
25313 gpointer user_data)
25314{
25315 const _ExtendedGDBusPropertyInfo *info = user_data;
25316 GError *error;
25317 GVariant *_ret;
25318 error = NULL;
25319 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
25320 if (!_ret)
25321 {
25322 g_warning ("Error setting property '%s' on interface org.openbmc.FlashControl: %s (%s, %d)",
25323 info->parent_struct.name,
25324 error->message, g_quark_to_string (error->domain), error->code);
25325 g_error_free (error);
25326 }
25327 else
25328 {
25329 g_variant_unref (_ret);
25330 }
25331}
25332
25333static void
25334flash_control_proxy_set_property (GObject *object,
25335 guint prop_id,
25336 const GValue *value,
25337 GParamSpec *pspec G_GNUC_UNUSED)
25338{
25339 const _ExtendedGDBusPropertyInfo *info;
25340 GVariant *variant;
25341 g_assert (prop_id != 0 && prop_id - 1 < 2);
25342 info = _flash_control_property_info_pointers[prop_id - 1];
25343 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
25344 g_dbus_proxy_call (G_DBUS_PROXY (object),
25345 "org.freedesktop.DBus.Properties.Set",
25346 g_variant_new ("(ssv)", "org.openbmc.FlashControl", info->parent_struct.name, variant),
25347 G_DBUS_CALL_FLAGS_NONE,
25348 -1,
25349 NULL, (GAsyncReadyCallback) flash_control_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
25350 g_variant_unref (variant);
25351}
25352
25353static void
25354flash_control_proxy_g_signal (GDBusProxy *proxy,
25355 const gchar *sender_name G_GNUC_UNUSED,
25356 const gchar *signal_name,
25357 GVariant *parameters)
25358{
25359 _ExtendedGDBusSignalInfo *info;
25360 GVariantIter iter;
25361 GVariant *child;
25362 GValue *paramv;
25363 guint num_params;
25364 guint n;
25365 guint signal_id;
25366 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct, signal_name);
25367 if (info == NULL)
25368 return;
25369 num_params = g_variant_n_children (parameters);
25370 paramv = g_new0 (GValue, num_params + 1);
25371 g_value_init (&paramv[0], TYPE_FLASH_CONTROL);
25372 g_value_set_object (&paramv[0], proxy);
25373 g_variant_iter_init (&iter, parameters);
25374 n = 1;
25375 while ((child = g_variant_iter_next_value (&iter)) != NULL)
25376 {
25377 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
25378 if (arg_info->use_gvariant)
25379 {
25380 g_value_init (&paramv[n], G_TYPE_VARIANT);
25381 g_value_set_variant (&paramv[n], child);
25382 n++;
25383 }
25384 else
25385 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
25386 g_variant_unref (child);
25387 }
25388 signal_id = g_signal_lookup (info->signal_name, TYPE_FLASH_CONTROL);
25389 g_signal_emitv (paramv, signal_id, 0, NULL);
25390 for (n = 0; n < num_params + 1; n++)
25391 g_value_unset (&paramv[n]);
25392 g_free (paramv);
25393}
25394
25395static void
25396flash_control_proxy_g_properties_changed (GDBusProxy *_proxy,
25397 GVariant *changed_properties,
25398 const gchar *const *invalidated_properties)
25399{
25400 FlashControlProxy *proxy = FLASH_CONTROL_PROXY (_proxy);
25401 guint n;
25402 const gchar *key;
25403 GVariantIter *iter;
25404 _ExtendedGDBusPropertyInfo *info;
25405 g_variant_get (changed_properties, "a{sv}", &iter);
25406 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
25407 {
25408 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct, key);
25409 g_datalist_remove_data (&proxy->priv->qdata, key);
25410 if (info != NULL)
25411 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
25412 }
25413 g_variant_iter_free (iter);
25414 for (n = 0; invalidated_properties[n] != NULL; n++)
25415 {
25416 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct, invalidated_properties[n]);
25417 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
25418 if (info != NULL)
25419 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
25420 }
25421}
25422
25423static const gchar *
25424flash_control_proxy_get_filename (FlashControl *object)
25425{
25426 FlashControlProxy *proxy = FLASH_CONTROL_PROXY (object);
25427 GVariant *variant;
25428 const gchar *value = NULL;
25429 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "filename");
25430 if (variant != NULL)
25431 {
25432 value = g_variant_get_string (variant, NULL);
25433 g_variant_unref (variant);
25434 }
25435 return value;
25436}
25437
25438static const gchar *
25439flash_control_proxy_get_type_ (FlashControl *object)
25440{
25441 FlashControlProxy *proxy = FLASH_CONTROL_PROXY (object);
25442 GVariant *variant;
25443 const gchar *value = NULL;
25444 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "type");
25445 if (variant != NULL)
25446 {
25447 value = g_variant_get_string (variant, NULL);
25448 g_variant_unref (variant);
25449 }
25450 return value;
25451}
25452
25453static void
25454flash_control_proxy_init (FlashControlProxy *proxy)
25455{
25456#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
25457 proxy->priv = flash_control_proxy_get_instance_private (proxy);
25458#else
25459 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_FLASH_CONTROL_PROXY, FlashControlProxyPrivate);
25460#endif
25461
25462 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), flash_control_interface_info ());
25463}
25464
25465static void
25466flash_control_proxy_class_init (FlashControlProxyClass *klass)
25467{
25468 GObjectClass *gobject_class;
25469 GDBusProxyClass *proxy_class;
25470
25471 gobject_class = G_OBJECT_CLASS (klass);
25472 gobject_class->finalize = flash_control_proxy_finalize;
25473 gobject_class->get_property = flash_control_proxy_get_property;
25474 gobject_class->set_property = flash_control_proxy_set_property;
25475
25476 proxy_class = G_DBUS_PROXY_CLASS (klass);
25477 proxy_class->g_signal = flash_control_proxy_g_signal;
25478 proxy_class->g_properties_changed = flash_control_proxy_g_properties_changed;
25479
25480 flash_control_override_properties (gobject_class, 1);
25481
25482#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
25483 g_type_class_add_private (klass, sizeof (FlashControlProxyPrivate));
25484#endif
25485}
25486
25487static void
25488flash_control_proxy_iface_init (FlashControlIface *iface)
25489{
25490 iface->get_filename = flash_control_proxy_get_filename;
25491 iface->get_type_ = flash_control_proxy_get_type_;
25492}
25493
25494/**
25495 * flash_control_proxy_new:
25496 * @connection: A #GDBusConnection.
25497 * @flags: Flags from the #GDBusProxyFlags enumeration.
25498 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
25499 * @object_path: An object path.
25500 * @cancellable: (allow-none): A #GCancellable or %NULL.
25501 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
25502 * @user_data: User data to pass to @callback.
25503 *
25504 * 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.
25505 *
25506 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
25507 * You can then call flash_control_proxy_new_finish() to get the result of the operation.
25508 *
25509 * See flash_control_proxy_new_sync() for the synchronous, blocking version of this constructor.
25510 */
25511void
25512flash_control_proxy_new (
25513 GDBusConnection *connection,
25514 GDBusProxyFlags flags,
25515 const gchar *name,
25516 const gchar *object_path,
25517 GCancellable *cancellable,
25518 GAsyncReadyCallback callback,
25519 gpointer user_data)
25520{
25521 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);
25522}
25523
25524/**
25525 * flash_control_proxy_new_finish:
25526 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_control_proxy_new().
25527 * @error: Return location for error or %NULL
25528 *
25529 * Finishes an operation started with flash_control_proxy_new().
25530 *
25531 * Returns: (transfer full) (type FlashControlProxy): The constructed proxy object or %NULL if @error is set.
25532 */
25533FlashControl *
25534flash_control_proxy_new_finish (
25535 GAsyncResult *res,
25536 GError **error)
25537{
25538 GObject *ret;
25539 GObject *source_object;
25540 source_object = g_async_result_get_source_object (res);
25541 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
25542 g_object_unref (source_object);
25543 if (ret != NULL)
25544 return FLASH_CONTROL (ret);
25545 else
25546 return NULL;
25547}
25548
25549/**
25550 * flash_control_proxy_new_sync:
25551 * @connection: A #GDBusConnection.
25552 * @flags: Flags from the #GDBusProxyFlags enumeration.
25553 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
25554 * @object_path: An object path.
25555 * @cancellable: (allow-none): A #GCancellable or %NULL.
25556 * @error: Return location for error or %NULL
25557 *
25558 * 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.
25559 *
25560 * The calling thread is blocked until a reply is received.
25561 *
25562 * See flash_control_proxy_new() for the asynchronous version of this constructor.
25563 *
25564 * Returns: (transfer full) (type FlashControlProxy): The constructed proxy object or %NULL if @error is set.
25565 */
25566FlashControl *
25567flash_control_proxy_new_sync (
25568 GDBusConnection *connection,
25569 GDBusProxyFlags flags,
25570 const gchar *name,
25571 const gchar *object_path,
25572 GCancellable *cancellable,
25573 GError **error)
25574{
25575 GInitable *ret;
25576 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);
25577 if (ret != NULL)
25578 return FLASH_CONTROL (ret);
25579 else
25580 return NULL;
25581}
25582
25583
25584/**
25585 * flash_control_proxy_new_for_bus:
25586 * @bus_type: A #GBusType.
25587 * @flags: Flags from the #GDBusProxyFlags enumeration.
25588 * @name: A bus name (well-known or unique).
25589 * @object_path: An object path.
25590 * @cancellable: (allow-none): A #GCancellable or %NULL.
25591 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
25592 * @user_data: User data to pass to @callback.
25593 *
25594 * Like flash_control_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
25595 *
25596 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
25597 * You can then call flash_control_proxy_new_for_bus_finish() to get the result of the operation.
25598 *
25599 * See flash_control_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
25600 */
25601void
25602flash_control_proxy_new_for_bus (
25603 GBusType bus_type,
25604 GDBusProxyFlags flags,
25605 const gchar *name,
25606 const gchar *object_path,
25607 GCancellable *cancellable,
25608 GAsyncReadyCallback callback,
25609 gpointer user_data)
25610{
25611 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);
25612}
25613
25614/**
25615 * flash_control_proxy_new_for_bus_finish:
25616 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_control_proxy_new_for_bus().
25617 * @error: Return location for error or %NULL
25618 *
25619 * Finishes an operation started with flash_control_proxy_new_for_bus().
25620 *
25621 * Returns: (transfer full) (type FlashControlProxy): The constructed proxy object or %NULL if @error is set.
25622 */
25623FlashControl *
25624flash_control_proxy_new_for_bus_finish (
25625 GAsyncResult *res,
25626 GError **error)
25627{
25628 GObject *ret;
25629 GObject *source_object;
25630 source_object = g_async_result_get_source_object (res);
25631 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
25632 g_object_unref (source_object);
25633 if (ret != NULL)
25634 return FLASH_CONTROL (ret);
25635 else
25636 return NULL;
25637}
25638
25639/**
25640 * flash_control_proxy_new_for_bus_sync:
25641 * @bus_type: A #GBusType.
25642 * @flags: Flags from the #GDBusProxyFlags enumeration.
25643 * @name: A bus name (well-known or unique).
25644 * @object_path: An object path.
25645 * @cancellable: (allow-none): A #GCancellable or %NULL.
25646 * @error: Return location for error or %NULL
25647 *
25648 * Like flash_control_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
25649 *
25650 * The calling thread is blocked until a reply is received.
25651 *
25652 * See flash_control_proxy_new_for_bus() for the asynchronous version of this constructor.
25653 *
25654 * Returns: (transfer full) (type FlashControlProxy): The constructed proxy object or %NULL if @error is set.
25655 */
25656FlashControl *
25657flash_control_proxy_new_for_bus_sync (
25658 GBusType bus_type,
25659 GDBusProxyFlags flags,
25660 const gchar *name,
25661 const gchar *object_path,
25662 GCancellable *cancellable,
25663 GError **error)
25664{
25665 GInitable *ret;
25666 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);
25667 if (ret != NULL)
25668 return FLASH_CONTROL (ret);
25669 else
25670 return NULL;
25671}
25672
25673
25674/* ------------------------------------------------------------------------ */
25675
25676/**
25677 * FlashControlSkeleton:
25678 *
25679 * The #FlashControlSkeleton structure contains only private data and should only be accessed using the provided API.
25680 */
25681
25682/**
25683 * FlashControlSkeletonClass:
25684 * @parent_class: The parent class.
25685 *
25686 * Class structure for #FlashControlSkeleton.
25687 */
25688
25689struct _FlashControlSkeletonPrivate
25690{
25691 GValue *properties;
25692 GList *changed_properties;
25693 GSource *changed_properties_idle_source;
25694 GMainContext *context;
25695 GMutex lock;
25696};
25697
25698static void
25699_flash_control_skeleton_handle_method_call (
25700 GDBusConnection *connection G_GNUC_UNUSED,
25701 const gchar *sender G_GNUC_UNUSED,
25702 const gchar *object_path G_GNUC_UNUSED,
25703 const gchar *interface_name,
25704 const gchar *method_name,
25705 GVariant *parameters,
25706 GDBusMethodInvocation *invocation,
25707 gpointer user_data)
25708{
25709 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (user_data);
25710 _ExtendedGDBusMethodInfo *info;
25711 GVariantIter iter;
25712 GVariant *child;
25713 GValue *paramv;
25714 guint num_params;
25715 guint num_extra;
25716 guint n;
25717 guint signal_id;
25718 GValue return_value = G_VALUE_INIT;
25719 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
25720 g_assert (info != NULL);
25721 num_params = g_variant_n_children (parameters);
25722 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
25723 n = 0;
25724 g_value_init (&paramv[n], TYPE_FLASH_CONTROL);
25725 g_value_set_object (&paramv[n++], skeleton);
25726 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
25727 g_value_set_object (&paramv[n++], invocation);
25728 if (info->pass_fdlist)
25729 {
25730#ifdef G_OS_UNIX
25731 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
25732 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
25733#else
25734 g_assert_not_reached ();
25735#endif
25736 }
25737 g_variant_iter_init (&iter, parameters);
25738 while ((child = g_variant_iter_next_value (&iter)) != NULL)
25739 {
25740 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
25741 if (arg_info->use_gvariant)
25742 {
25743 g_value_init (&paramv[n], G_TYPE_VARIANT);
25744 g_value_set_variant (&paramv[n], child);
25745 n++;
25746 }
25747 else
25748 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
25749 g_variant_unref (child);
25750 }
25751 signal_id = g_signal_lookup (info->signal_name, TYPE_FLASH_CONTROL);
25752 g_value_init (&return_value, G_TYPE_BOOLEAN);
25753 g_signal_emitv (paramv, signal_id, 0, &return_value);
25754 if (!g_value_get_boolean (&return_value))
25755 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);
25756 g_value_unset (&return_value);
25757 for (n = 0; n < num_params + num_extra; n++)
25758 g_value_unset (&paramv[n]);
25759 g_free (paramv);
25760}
25761
25762static GVariant *
25763_flash_control_skeleton_handle_get_property (
25764 GDBusConnection *connection G_GNUC_UNUSED,
25765 const gchar *sender G_GNUC_UNUSED,
25766 const gchar *object_path G_GNUC_UNUSED,
25767 const gchar *interface_name G_GNUC_UNUSED,
25768 const gchar *property_name,
25769 GError **error,
25770 gpointer user_data)
25771{
25772 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (user_data);
25773 GValue value = G_VALUE_INIT;
25774 GParamSpec *pspec;
25775 _ExtendedGDBusPropertyInfo *info;
25776 GVariant *ret;
25777 ret = NULL;
25778 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct, property_name);
25779 g_assert (info != NULL);
25780 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
25781 if (pspec == NULL)
25782 {
25783 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
25784 }
25785 else
25786 {
25787 g_value_init (&value, pspec->value_type);
25788 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
25789 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
25790 g_value_unset (&value);
25791 }
25792 return ret;
25793}
25794
25795static gboolean
25796_flash_control_skeleton_handle_set_property (
25797 GDBusConnection *connection G_GNUC_UNUSED,
25798 const gchar *sender G_GNUC_UNUSED,
25799 const gchar *object_path G_GNUC_UNUSED,
25800 const gchar *interface_name G_GNUC_UNUSED,
25801 const gchar *property_name,
25802 GVariant *variant,
25803 GError **error,
25804 gpointer user_data)
25805{
25806 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (user_data);
25807 GValue value = G_VALUE_INIT;
25808 GParamSpec *pspec;
25809 _ExtendedGDBusPropertyInfo *info;
25810 gboolean ret;
25811 ret = FALSE;
25812 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct, property_name);
25813 g_assert (info != NULL);
25814 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
25815 if (pspec == NULL)
25816 {
25817 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
25818 }
25819 else
25820 {
25821 if (info->use_gvariant)
25822 g_value_set_variant (&value, variant);
25823 else
25824 g_dbus_gvariant_to_gvalue (variant, &value);
25825 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
25826 g_value_unset (&value);
25827 ret = TRUE;
25828 }
25829 return ret;
25830}
25831
25832static const GDBusInterfaceVTable _flash_control_skeleton_vtable =
25833{
25834 _flash_control_skeleton_handle_method_call,
25835 _flash_control_skeleton_handle_get_property,
25836 _flash_control_skeleton_handle_set_property,
25837 {NULL}
25838};
25839
25840static GDBusInterfaceInfo *
25841flash_control_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
25842{
25843 return flash_control_interface_info ();
25844}
25845
25846static GDBusInterfaceVTable *
25847flash_control_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
25848{
25849 return (GDBusInterfaceVTable *) &_flash_control_skeleton_vtable;
25850}
25851
25852static GVariant *
25853flash_control_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
25854{
25855 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (_skeleton);
25856
25857 GVariantBuilder builder;
25858 guint n;
25859 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
25860 if (_flash_control_interface_info.parent_struct.properties == NULL)
25861 goto out;
25862 for (n = 0; _flash_control_interface_info.parent_struct.properties[n] != NULL; n++)
25863 {
25864 GDBusPropertyInfo *info = _flash_control_interface_info.parent_struct.properties[n];
25865 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
25866 {
25867 GVariant *value;
25868 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);
25869 if (value != NULL)
25870 {
25871 g_variant_take_ref (value);
25872 g_variant_builder_add (&builder, "{sv}", info->name, value);
25873 g_variant_unref (value);
25874 }
25875 }
25876 }
25877out:
25878 return g_variant_builder_end (&builder);
25879}
25880
25881static gboolean _flash_control_emit_changed (gpointer user_data);
25882
25883static void
25884flash_control_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
25885{
25886 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (_skeleton);
25887 gboolean emit_changed = FALSE;
25888
25889 g_mutex_lock (&skeleton->priv->lock);
25890 if (skeleton->priv->changed_properties_idle_source != NULL)
25891 {
25892 g_source_destroy (skeleton->priv->changed_properties_idle_source);
25893 skeleton->priv->changed_properties_idle_source = NULL;
25894 emit_changed = TRUE;
25895 }
25896 g_mutex_unlock (&skeleton->priv->lock);
25897
25898 if (emit_changed)
25899 _flash_control_emit_changed (skeleton);
25900}
25901
25902static void
25903_flash_control_on_signal_done (
25904 FlashControl *object,
25905 const gchar *arg_filename)
25906{
25907 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
25908
25909 GList *connections, *l;
25910 GVariant *signal_variant;
25911 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
25912
25913 signal_variant = g_variant_ref_sink (g_variant_new ("(s)",
25914 arg_filename));
25915 for (l = connections; l != NULL; l = l->next)
25916 {
25917 GDBusConnection *connection = l->data;
25918 g_dbus_connection_emit_signal (connection,
25919 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.FlashControl", "Done",
25920 signal_variant, NULL);
25921 }
25922 g_variant_unref (signal_variant);
25923 g_list_free_full (connections, g_object_unref);
25924}
25925
25926static void
25927_flash_control_on_signal_error (
25928 FlashControl *object,
25929 const gchar *arg_filename)
25930{
25931 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
25932
25933 GList *connections, *l;
25934 GVariant *signal_variant;
25935 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
25936
25937 signal_variant = g_variant_ref_sink (g_variant_new ("(s)",
25938 arg_filename));
25939 for (l = connections; l != NULL; l = l->next)
25940 {
25941 GDBusConnection *connection = l->data;
25942 g_dbus_connection_emit_signal (connection,
25943 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.FlashControl", "Error",
25944 signal_variant, NULL);
25945 }
25946 g_variant_unref (signal_variant);
25947 g_list_free_full (connections, g_object_unref);
25948}
25949
25950static void
25951_flash_control_on_signal_progress (
25952 FlashControl *object,
25953 const gchar *arg_filename,
25954 guchar arg_progress)
25955{
25956 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
25957
25958 GList *connections, *l;
25959 GVariant *signal_variant;
25960 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
25961
25962 signal_variant = g_variant_ref_sink (g_variant_new ("(sy)",
25963 arg_filename,
25964 arg_progress));
25965 for (l = connections; l != NULL; l = l->next)
25966 {
25967 GDBusConnection *connection = l->data;
25968 g_dbus_connection_emit_signal (connection,
25969 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.FlashControl", "Progress",
25970 signal_variant, NULL);
25971 }
25972 g_variant_unref (signal_variant);
25973 g_list_free_full (connections, g_object_unref);
25974}
25975
25976static void flash_control_skeleton_iface_init (FlashControlIface *iface);
25977#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
25978G_DEFINE_TYPE_WITH_CODE (FlashControlSkeleton, flash_control_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
25979 G_ADD_PRIVATE (FlashControlSkeleton)
25980 G_IMPLEMENT_INTERFACE (TYPE_FLASH_CONTROL, flash_control_skeleton_iface_init));
25981
25982#else
25983G_DEFINE_TYPE_WITH_CODE (FlashControlSkeleton, flash_control_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
25984 G_IMPLEMENT_INTERFACE (TYPE_FLASH_CONTROL, flash_control_skeleton_iface_init));
25985
25986#endif
25987static void
25988flash_control_skeleton_finalize (GObject *object)
25989{
25990 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
25991 guint n;
25992 for (n = 0; n < 2; n++)
25993 g_value_unset (&skeleton->priv->properties[n]);
25994 g_free (skeleton->priv->properties);
25995 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
25996 if (skeleton->priv->changed_properties_idle_source != NULL)
25997 g_source_destroy (skeleton->priv->changed_properties_idle_source);
25998 g_main_context_unref (skeleton->priv->context);
25999 g_mutex_clear (&skeleton->priv->lock);
26000 G_OBJECT_CLASS (flash_control_skeleton_parent_class)->finalize (object);
26001}
26002
26003static void
26004flash_control_skeleton_get_property (GObject *object,
26005 guint prop_id,
26006 GValue *value,
26007 GParamSpec *pspec G_GNUC_UNUSED)
26008{
26009 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
26010 g_assert (prop_id != 0 && prop_id - 1 < 2);
26011 g_mutex_lock (&skeleton->priv->lock);
26012 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
26013 g_mutex_unlock (&skeleton->priv->lock);
26014}
26015
26016static gboolean
26017_flash_control_emit_changed (gpointer user_data)
26018{
26019 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (user_data);
26020 GList *l;
26021 GVariantBuilder builder;
26022 GVariantBuilder invalidated_builder;
26023 guint num_changes;
26024
26025 g_mutex_lock (&skeleton->priv->lock);
26026 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
26027 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
26028 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
26029 {
26030 ChangedProperty *cp = l->data;
26031 GVariant *variant;
26032 const GValue *cur_value;
26033
26034 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
26035 if (!_g_value_equal (cur_value, &cp->orig_value))
26036 {
26037 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
26038 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
26039 g_variant_unref (variant);
26040 num_changes++;
26041 }
26042 }
26043 if (num_changes > 0)
26044 {
26045 GList *connections, *ll;
26046 GVariant *signal_variant;
26047 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.FlashControl",
26048 &builder, &invalidated_builder));
26049 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
26050 for (ll = connections; ll != NULL; ll = ll->next)
26051 {
26052 GDBusConnection *connection = ll->data;
26053
26054 g_dbus_connection_emit_signal (connection,
26055 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
26056 "org.freedesktop.DBus.Properties",
26057 "PropertiesChanged",
26058 signal_variant,
26059 NULL);
26060 }
26061 g_variant_unref (signal_variant);
26062 g_list_free_full (connections, g_object_unref);
26063 }
26064 else
26065 {
26066 g_variant_builder_clear (&builder);
26067 g_variant_builder_clear (&invalidated_builder);
26068 }
26069 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
26070 skeleton->priv->changed_properties = NULL;
26071 skeleton->priv->changed_properties_idle_source = NULL;
26072 g_mutex_unlock (&skeleton->priv->lock);
26073 return FALSE;
26074}
26075
26076static void
26077_flash_control_schedule_emit_changed (FlashControlSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
26078{
26079 ChangedProperty *cp;
26080 GList *l;
26081 cp = NULL;
26082 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
26083 {
26084 ChangedProperty *i_cp = l->data;
26085 if (i_cp->info == info)
26086 {
26087 cp = i_cp;
26088 break;
26089 }
26090 }
26091 if (cp == NULL)
26092 {
26093 cp = g_new0 (ChangedProperty, 1);
26094 cp->prop_id = prop_id;
26095 cp->info = info;
26096 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
26097 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
26098 g_value_copy (orig_value, &cp->orig_value);
26099 }
26100}
26101
26102static void
26103flash_control_skeleton_notify (GObject *object,
26104 GParamSpec *pspec G_GNUC_UNUSED)
26105{
26106 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
26107 g_mutex_lock (&skeleton->priv->lock);
26108 if (skeleton->priv->changed_properties != NULL &&
26109 skeleton->priv->changed_properties_idle_source == NULL)
26110 {
26111 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
26112 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
26113 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _flash_control_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
Adriana Kobylakfd778822016-06-16 09:08:37 -050026114 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _flash_control_emit_changed");
Norman James18998182015-10-11 21:54:53 -050026115 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
26116 g_source_unref (skeleton->priv->changed_properties_idle_source);
26117 }
26118 g_mutex_unlock (&skeleton->priv->lock);
26119}
26120
26121static void
26122flash_control_skeleton_set_property (GObject *object,
26123 guint prop_id,
26124 const GValue *value,
26125 GParamSpec *pspec)
26126{
26127 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
26128 g_assert (prop_id != 0 && prop_id - 1 < 2);
26129 g_mutex_lock (&skeleton->priv->lock);
26130 g_object_freeze_notify (object);
26131 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
26132 {
26133 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
26134 _flash_control_schedule_emit_changed (skeleton, _flash_control_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
26135 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
26136 g_object_notify_by_pspec (object, pspec);
26137 }
26138 g_mutex_unlock (&skeleton->priv->lock);
26139 g_object_thaw_notify (object);
26140}
26141
26142static void
26143flash_control_skeleton_init (FlashControlSkeleton *skeleton)
26144{
26145#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
26146 skeleton->priv = flash_control_skeleton_get_instance_private (skeleton);
26147#else
26148 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_FLASH_CONTROL_SKELETON, FlashControlSkeletonPrivate);
26149#endif
26150
26151 g_mutex_init (&skeleton->priv->lock);
26152 skeleton->priv->context = g_main_context_ref_thread_default ();
26153 skeleton->priv->properties = g_new0 (GValue, 2);
26154 g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING);
26155 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
26156}
26157
26158static const gchar *
26159flash_control_skeleton_get_filename (FlashControl *object)
26160{
26161 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
26162 const gchar *value;
26163 g_mutex_lock (&skeleton->priv->lock);
26164 value = g_value_get_string (&(skeleton->priv->properties[0]));
26165 g_mutex_unlock (&skeleton->priv->lock);
26166 return value;
26167}
26168
26169static const gchar *
26170flash_control_skeleton_get_type_ (FlashControl *object)
26171{
26172 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
26173 const gchar *value;
26174 g_mutex_lock (&skeleton->priv->lock);
26175 value = g_value_get_string (&(skeleton->priv->properties[1]));
26176 g_mutex_unlock (&skeleton->priv->lock);
26177 return value;
26178}
26179
26180static void
26181flash_control_skeleton_class_init (FlashControlSkeletonClass *klass)
26182{
26183 GObjectClass *gobject_class;
26184 GDBusInterfaceSkeletonClass *skeleton_class;
26185
26186 gobject_class = G_OBJECT_CLASS (klass);
26187 gobject_class->finalize = flash_control_skeleton_finalize;
26188 gobject_class->get_property = flash_control_skeleton_get_property;
26189 gobject_class->set_property = flash_control_skeleton_set_property;
26190 gobject_class->notify = flash_control_skeleton_notify;
26191
26192
26193 flash_control_override_properties (gobject_class, 1);
26194
26195 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
26196 skeleton_class->get_info = flash_control_skeleton_dbus_interface_get_info;
26197 skeleton_class->get_properties = flash_control_skeleton_dbus_interface_get_properties;
26198 skeleton_class->flush = flash_control_skeleton_dbus_interface_flush;
26199 skeleton_class->get_vtable = flash_control_skeleton_dbus_interface_get_vtable;
26200
26201#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
26202 g_type_class_add_private (klass, sizeof (FlashControlSkeletonPrivate));
26203#endif
26204}
26205
26206static void
26207flash_control_skeleton_iface_init (FlashControlIface *iface)
26208{
26209 iface->done = _flash_control_on_signal_done;
26210 iface->error = _flash_control_on_signal_error;
26211 iface->progress = _flash_control_on_signal_progress;
26212 iface->get_filename = flash_control_skeleton_get_filename;
26213 iface->get_type_ = flash_control_skeleton_get_type_;
26214}
26215
26216/**
26217 * flash_control_skeleton_new:
26218 *
26219 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link>.
26220 *
26221 * Returns: (transfer full) (type FlashControlSkeleton): The skeleton object.
26222 */
26223FlashControl *
26224flash_control_skeleton_new (void)
26225{
26226 return FLASH_CONTROL (g_object_new (TYPE_FLASH_CONTROL_SKELETON, NULL));
26227}
26228
26229/* ------------------------------------------------------------------------
Norman James362a80f2015-09-14 14:04:39 -050026230 * Code for interface org.openbmc.Button
26231 * ------------------------------------------------------------------------
26232 */
26233
26234/**
26235 * SECTION:Button
26236 * @title: Button
26237 * @short_description: Generated C code for the org.openbmc.Button D-Bus interface
26238 *
26239 * 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.
26240 */
26241
26242/* ---- Introspection data for org.openbmc.Button ---- */
26243
26244static const _ExtendedGDBusArgInfo _button_method_info_is_on_OUT_ARG_state =
26245{
26246 {
26247 -1,
26248 (gchar *) "state",
26249 (gchar *) "b",
26250 NULL
26251 },
26252 FALSE
26253};
26254
26255static const _ExtendedGDBusArgInfo * const _button_method_info_is_on_OUT_ARG_pointers[] =
26256{
26257 &_button_method_info_is_on_OUT_ARG_state,
26258 NULL
26259};
26260
26261static const _ExtendedGDBusMethodInfo _button_method_info_is_on =
26262{
26263 {
26264 -1,
26265 (gchar *) "isOn",
26266 NULL,
26267 (GDBusArgInfo **) &_button_method_info_is_on_OUT_ARG_pointers,
26268 NULL
26269 },
26270 "handle-is-on",
26271 FALSE
26272};
26273
Norman James493996c2015-10-31 17:27:13 -050026274static const _ExtendedGDBusMethodInfo _button_method_info_sim_press =
Norman James362a80f2015-09-14 14:04:39 -050026275{
26276 {
26277 -1,
Norman James493996c2015-10-31 17:27:13 -050026278 (gchar *) "simPress",
Norman James362a80f2015-09-14 14:04:39 -050026279 NULL,
26280 NULL,
26281 NULL
26282 },
Norman James493996c2015-10-31 17:27:13 -050026283 "handle-sim-press",
Norman James362a80f2015-09-14 14:04:39 -050026284 FALSE
26285};
26286
Norman James493996c2015-10-31 17:27:13 -050026287static const _ExtendedGDBusMethodInfo _button_method_info_sim_long_press =
Norman James362a80f2015-09-14 14:04:39 -050026288{
26289 {
26290 -1,
Norman James493996c2015-10-31 17:27:13 -050026291 (gchar *) "simLongPress",
Norman James362a80f2015-09-14 14:04:39 -050026292 NULL,
26293 NULL,
26294 NULL
26295 },
Norman James493996c2015-10-31 17:27:13 -050026296 "handle-sim-long-press",
Norman James362a80f2015-09-14 14:04:39 -050026297 FALSE
26298};
26299
26300static const _ExtendedGDBusMethodInfo * const _button_method_info_pointers[] =
26301{
26302 &_button_method_info_is_on,
Norman James493996c2015-10-31 17:27:13 -050026303 &_button_method_info_sim_press,
26304 &_button_method_info_sim_long_press,
Norman James362a80f2015-09-14 14:04:39 -050026305 NULL
26306};
26307
Norman James493996c2015-10-31 17:27:13 -050026308static const _ExtendedGDBusSignalInfo _button_signal_info_released =
Norman James362a80f2015-09-14 14:04:39 -050026309{
26310 {
26311 -1,
Norman James493996c2015-10-31 17:27:13 -050026312 (gchar *) "Released",
Norman James362a80f2015-09-14 14:04:39 -050026313 NULL,
26314 NULL
26315 },
Norman James493996c2015-10-31 17:27:13 -050026316 "released"
Norman James362a80f2015-09-14 14:04:39 -050026317};
26318
Norman James493996c2015-10-31 17:27:13 -050026319static const _ExtendedGDBusSignalInfo _button_signal_info_pressed =
Norman James362a80f2015-09-14 14:04:39 -050026320{
26321 {
26322 -1,
Norman James493996c2015-10-31 17:27:13 -050026323 (gchar *) "Pressed",
Norman James362a80f2015-09-14 14:04:39 -050026324 NULL,
26325 NULL
26326 },
Norman James493996c2015-10-31 17:27:13 -050026327 "pressed"
Norman James362a80f2015-09-14 14:04:39 -050026328};
26329
Norman James493996c2015-10-31 17:27:13 -050026330static const _ExtendedGDBusSignalInfo _button_signal_info_pressed_long =
Norman James362a80f2015-09-14 14:04:39 -050026331{
26332 {
26333 -1,
Norman James493996c2015-10-31 17:27:13 -050026334 (gchar *) "PressedLong",
Norman James362a80f2015-09-14 14:04:39 -050026335 NULL,
26336 NULL
26337 },
Norman James493996c2015-10-31 17:27:13 -050026338 "pressed-long"
Norman James362a80f2015-09-14 14:04:39 -050026339};
26340
26341static const _ExtendedGDBusSignalInfo * const _button_signal_info_pointers[] =
26342{
Norman James493996c2015-10-31 17:27:13 -050026343 &_button_signal_info_released,
26344 &_button_signal_info_pressed,
26345 &_button_signal_info_pressed_long,
Norman James362a80f2015-09-14 14:04:39 -050026346 NULL
26347};
26348
26349static const _ExtendedGDBusPropertyInfo _button_property_info_state =
26350{
26351 {
26352 -1,
26353 (gchar *) "state",
26354 (gchar *) "b",
26355 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
26356 NULL
26357 },
26358 "state",
26359 FALSE
26360};
26361
Norman James493996c2015-10-31 17:27:13 -050026362static const _ExtendedGDBusPropertyInfo _button_property_info_timer =
26363{
26364 {
26365 -1,
26366 (gchar *) "timer",
26367 (gchar *) "t",
26368 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
26369 NULL
26370 },
26371 "timer",
26372 FALSE
26373};
26374
Norman James362a80f2015-09-14 14:04:39 -050026375static const _ExtendedGDBusPropertyInfo * const _button_property_info_pointers[] =
26376{
26377 &_button_property_info_state,
Norman James493996c2015-10-31 17:27:13 -050026378 &_button_property_info_timer,
Norman James362a80f2015-09-14 14:04:39 -050026379 NULL
26380};
26381
26382static const _ExtendedGDBusInterfaceInfo _button_interface_info =
26383{
26384 {
26385 -1,
26386 (gchar *) "org.openbmc.Button",
26387 (GDBusMethodInfo **) &_button_method_info_pointers,
26388 (GDBusSignalInfo **) &_button_signal_info_pointers,
26389 (GDBusPropertyInfo **) &_button_property_info_pointers,
26390 NULL
26391 },
26392 "button",
26393};
26394
26395
26396/**
26397 * button_interface_info:
26398 *
26399 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link> D-Bus interface.
26400 *
26401 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
26402 */
26403GDBusInterfaceInfo *
26404button_interface_info (void)
26405{
26406 return (GDBusInterfaceInfo *) &_button_interface_info.parent_struct;
26407}
26408
26409/**
26410 * button_override_properties:
26411 * @klass: The class structure for a #GObject<!-- -->-derived class.
26412 * @property_id_begin: The property id to assign to the first overridden property.
26413 *
26414 * Overrides all #GObject properties in the #Button interface for a concrete class.
26415 * The properties are overridden in the order they are defined.
26416 *
26417 * Returns: The last property id.
26418 */
26419guint
26420button_override_properties (GObjectClass *klass, guint property_id_begin)
26421{
26422 g_object_class_override_property (klass, property_id_begin++, "state");
Norman James493996c2015-10-31 17:27:13 -050026423 g_object_class_override_property (klass, property_id_begin++, "timer");
Norman James362a80f2015-09-14 14:04:39 -050026424 return property_id_begin - 1;
26425}
26426
26427
26428
26429/**
26430 * Button:
26431 *
26432 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link>.
26433 */
26434
26435/**
26436 * ButtonIface:
26437 * @parent_iface: The parent interface.
26438 * @handle_is_on: Handler for the #Button::handle-is-on signal.
Norman James493996c2015-10-31 17:27:13 -050026439 * @handle_sim_long_press: Handler for the #Button::handle-sim-long-press signal.
26440 * @handle_sim_press: Handler for the #Button::handle-sim-press signal.
Norman James362a80f2015-09-14 14:04:39 -050026441 * @get_state: Getter for the #Button:state property.
Norman James493996c2015-10-31 17:27:13 -050026442 * @get_timer: Getter for the #Button:timer property.
26443 * @pressed: Handler for the #Button::pressed signal.
26444 * @pressed_long: Handler for the #Button::pressed-long signal.
26445 * @released: Handler for the #Button::released signal.
Norman James362a80f2015-09-14 14:04:39 -050026446 *
26447 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link>.
26448 */
26449
26450typedef ButtonIface ButtonInterface;
26451G_DEFINE_INTERFACE (Button, button, G_TYPE_OBJECT);
26452
26453static void
26454button_default_init (ButtonIface *iface)
26455{
26456 /* GObject signals for incoming D-Bus method calls: */
26457 /**
26458 * Button::handle-is-on:
26459 * @object: A #Button.
26460 * @invocation: A #GDBusMethodInvocation.
26461 *
26462 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Button.isOn">isOn()</link> D-Bus method.
26463 *
26464 * 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.
26465 *
26466 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
26467 */
26468 g_signal_new ("handle-is-on",
26469 G_TYPE_FROM_INTERFACE (iface),
26470 G_SIGNAL_RUN_LAST,
26471 G_STRUCT_OFFSET (ButtonIface, handle_is_on),
26472 g_signal_accumulator_true_handled,
26473 NULL,
26474 g_cclosure_marshal_generic,
26475 G_TYPE_BOOLEAN,
26476 1,
26477 G_TYPE_DBUS_METHOD_INVOCATION);
26478
26479 /**
Norman James493996c2015-10-31 17:27:13 -050026480 * Button::handle-sim-press:
Norman James362a80f2015-09-14 14:04:39 -050026481 * @object: A #Button.
26482 * @invocation: A #GDBusMethodInvocation.
26483 *
Norman James493996c2015-10-31 17:27:13 -050026484 * 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 -050026485 *
Norman James493996c2015-10-31 17:27:13 -050026486 * 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 -050026487 *
26488 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
26489 */
Norman James493996c2015-10-31 17:27:13 -050026490 g_signal_new ("handle-sim-press",
Norman James362a80f2015-09-14 14:04:39 -050026491 G_TYPE_FROM_INTERFACE (iface),
26492 G_SIGNAL_RUN_LAST,
Norman James493996c2015-10-31 17:27:13 -050026493 G_STRUCT_OFFSET (ButtonIface, handle_sim_press),
Norman James362a80f2015-09-14 14:04:39 -050026494 g_signal_accumulator_true_handled,
26495 NULL,
26496 g_cclosure_marshal_generic,
26497 G_TYPE_BOOLEAN,
26498 1,
26499 G_TYPE_DBUS_METHOD_INVOCATION);
26500
26501 /**
Norman James493996c2015-10-31 17:27:13 -050026502 * Button::handle-sim-long-press:
Norman James362a80f2015-09-14 14:04:39 -050026503 * @object: A #Button.
26504 * @invocation: A #GDBusMethodInvocation.
26505 *
Norman James493996c2015-10-31 17:27:13 -050026506 * 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 -050026507 *
Norman James493996c2015-10-31 17:27:13 -050026508 * 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 -050026509 *
26510 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
26511 */
Norman James493996c2015-10-31 17:27:13 -050026512 g_signal_new ("handle-sim-long-press",
Norman James362a80f2015-09-14 14:04:39 -050026513 G_TYPE_FROM_INTERFACE (iface),
26514 G_SIGNAL_RUN_LAST,
Norman James493996c2015-10-31 17:27:13 -050026515 G_STRUCT_OFFSET (ButtonIface, handle_sim_long_press),
Norman James362a80f2015-09-14 14:04:39 -050026516 g_signal_accumulator_true_handled,
26517 NULL,
26518 g_cclosure_marshal_generic,
26519 G_TYPE_BOOLEAN,
26520 1,
26521 G_TYPE_DBUS_METHOD_INVOCATION);
26522
26523 /* GObject signals for received D-Bus signals: */
26524 /**
Norman James493996c2015-10-31 17:27:13 -050026525 * Button::released:
Norman James362a80f2015-09-14 14:04:39 -050026526 * @object: A #Button.
26527 *
Norman James493996c2015-10-31 17:27:13 -050026528 * 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 -050026529 *
26530 * 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.
26531 */
Norman James493996c2015-10-31 17:27:13 -050026532 g_signal_new ("released",
Norman James362a80f2015-09-14 14:04:39 -050026533 G_TYPE_FROM_INTERFACE (iface),
26534 G_SIGNAL_RUN_LAST,
Norman James493996c2015-10-31 17:27:13 -050026535 G_STRUCT_OFFSET (ButtonIface, released),
Norman James362a80f2015-09-14 14:04:39 -050026536 NULL,
26537 NULL,
26538 g_cclosure_marshal_generic,
26539 G_TYPE_NONE,
26540 0);
26541
26542 /**
Norman James493996c2015-10-31 17:27:13 -050026543 * Button::pressed:
Norman James362a80f2015-09-14 14:04:39 -050026544 * @object: A #Button.
26545 *
Norman James493996c2015-10-31 17:27:13 -050026546 * 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 -050026547 *
26548 * 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.
26549 */
Norman James493996c2015-10-31 17:27:13 -050026550 g_signal_new ("pressed",
Norman James362a80f2015-09-14 14:04:39 -050026551 G_TYPE_FROM_INTERFACE (iface),
26552 G_SIGNAL_RUN_LAST,
Norman James493996c2015-10-31 17:27:13 -050026553 G_STRUCT_OFFSET (ButtonIface, pressed),
Norman James362a80f2015-09-14 14:04:39 -050026554 NULL,
26555 NULL,
26556 g_cclosure_marshal_generic,
26557 G_TYPE_NONE,
26558 0);
26559
26560 /**
Norman James493996c2015-10-31 17:27:13 -050026561 * Button::pressed-long:
Norman James362a80f2015-09-14 14:04:39 -050026562 * @object: A #Button.
26563 *
Norman James493996c2015-10-31 17:27:13 -050026564 * 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 -050026565 *
26566 * 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.
26567 */
Norman James493996c2015-10-31 17:27:13 -050026568 g_signal_new ("pressed-long",
Norman James362a80f2015-09-14 14:04:39 -050026569 G_TYPE_FROM_INTERFACE (iface),
26570 G_SIGNAL_RUN_LAST,
Norman James493996c2015-10-31 17:27:13 -050026571 G_STRUCT_OFFSET (ButtonIface, pressed_long),
Norman James362a80f2015-09-14 14:04:39 -050026572 NULL,
26573 NULL,
26574 g_cclosure_marshal_generic,
26575 G_TYPE_NONE,
26576 0);
26577
26578 /* GObject properties for D-Bus properties: */
26579 /**
26580 * Button:state:
26581 *
26582 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Button.state">"state"</link>.
26583 *
26584 * 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.
26585 */
26586 g_object_interface_install_property (iface,
26587 g_param_spec_boolean ("state", "state", "state", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Norman James493996c2015-10-31 17:27:13 -050026588 /**
26589 * Button:timer:
26590 *
26591 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Button.timer">"timer"</link>.
26592 *
26593 * 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.
26594 */
26595 g_object_interface_install_property (iface,
26596 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 -050026597}
26598
26599/**
26600 * button_get_state: (skip)
26601 * @object: A #Button.
26602 *
26603 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Button.state">"state"</link> D-Bus property.
26604 *
26605 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
26606 *
26607 * Returns: The property value.
26608 */
26609gboolean
26610button_get_state (Button *object)
26611{
26612 return BUTTON_GET_IFACE (object)->get_state (object);
26613}
26614
26615/**
26616 * button_set_state: (skip)
26617 * @object: A #Button.
26618 * @value: The value to set.
26619 *
26620 * Sets the <link linkend="gdbus-property-org-openbmc-Button.state">"state"</link> D-Bus property to @value.
26621 *
26622 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
26623 */
26624void
26625button_set_state (Button *object, gboolean value)
26626{
26627 g_object_set (G_OBJECT (object), "state", value, NULL);
26628}
26629
26630/**
Norman James493996c2015-10-31 17:27:13 -050026631 * button_get_timer: (skip)
Norman James362a80f2015-09-14 14:04:39 -050026632 * @object: A #Button.
26633 *
Norman James493996c2015-10-31 17:27:13 -050026634 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Button.timer">"timer"</link> D-Bus property.
26635 *
26636 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
26637 *
26638 * Returns: The property value.
Norman James362a80f2015-09-14 14:04:39 -050026639 */
Norman James493996c2015-10-31 17:27:13 -050026640guint64
26641button_get_timer (Button *object)
Norman James362a80f2015-09-14 14:04:39 -050026642{
Norman James493996c2015-10-31 17:27:13 -050026643 return BUTTON_GET_IFACE (object)->get_timer (object);
Norman James362a80f2015-09-14 14:04:39 -050026644}
26645
26646/**
Norman James493996c2015-10-31 17:27:13 -050026647 * button_set_timer: (skip)
Norman James362a80f2015-09-14 14:04:39 -050026648 * @object: A #Button.
Norman James493996c2015-10-31 17:27:13 -050026649 * @value: The value to set.
Norman James362a80f2015-09-14 14:04:39 -050026650 *
Norman James493996c2015-10-31 17:27:13 -050026651 * Sets the <link linkend="gdbus-property-org-openbmc-Button.timer">"timer"</link> D-Bus property to @value.
26652 *
26653 * 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 -050026654 */
26655void
Norman James493996c2015-10-31 17:27:13 -050026656button_set_timer (Button *object, guint64 value)
Norman James362a80f2015-09-14 14:04:39 -050026657{
Norman James493996c2015-10-31 17:27:13 -050026658 g_object_set (G_OBJECT (object), "timer", value, NULL);
Norman James362a80f2015-09-14 14:04:39 -050026659}
26660
26661/**
Norman James493996c2015-10-31 17:27:13 -050026662 * button_emit_released:
Norman James362a80f2015-09-14 14:04:39 -050026663 * @object: A #Button.
26664 *
Norman James493996c2015-10-31 17:27:13 -050026665 * Emits the <link linkend="gdbus-signal-org-openbmc-Button.Released">"Released"</link> D-Bus signal.
Norman James362a80f2015-09-14 14:04:39 -050026666 */
26667void
Norman James493996c2015-10-31 17:27:13 -050026668button_emit_released (
Norman James362a80f2015-09-14 14:04:39 -050026669 Button *object)
26670{
Norman James493996c2015-10-31 17:27:13 -050026671 g_signal_emit_by_name (object, "released");
26672}
26673
26674/**
26675 * button_emit_pressed:
26676 * @object: A #Button.
26677 *
26678 * Emits the <link linkend="gdbus-signal-org-openbmc-Button.Pressed">"Pressed"</link> D-Bus signal.
26679 */
26680void
26681button_emit_pressed (
26682 Button *object)
26683{
26684 g_signal_emit_by_name (object, "pressed");
26685}
26686
26687/**
26688 * button_emit_pressed_long:
26689 * @object: A #Button.
26690 *
26691 * Emits the <link linkend="gdbus-signal-org-openbmc-Button.PressedLong">"PressedLong"</link> D-Bus signal.
26692 */
26693void
26694button_emit_pressed_long (
26695 Button *object)
26696{
26697 g_signal_emit_by_name (object, "pressed-long");
Norman James362a80f2015-09-14 14:04:39 -050026698}
26699
26700/**
26701 * button_call_is_on:
26702 * @proxy: A #ButtonProxy.
26703 * @cancellable: (allow-none): A #GCancellable or %NULL.
26704 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
26705 * @user_data: User data to pass to @callback.
26706 *
26707 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.isOn">isOn()</link> D-Bus method on @proxy.
26708 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
26709 * You can then call button_call_is_on_finish() to get the result of the operation.
26710 *
26711 * See button_call_is_on_sync() for the synchronous, blocking version of this method.
26712 */
26713void
26714button_call_is_on (
26715 Button *proxy,
26716 GCancellable *cancellable,
26717 GAsyncReadyCallback callback,
26718 gpointer user_data)
26719{
26720 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
26721 "isOn",
26722 g_variant_new ("()"),
26723 G_DBUS_CALL_FLAGS_NONE,
26724 -1,
26725 cancellable,
26726 callback,
26727 user_data);
26728}
26729
26730/**
26731 * button_call_is_on_finish:
26732 * @proxy: A #ButtonProxy.
26733 * @out_state: (out): Return location for return parameter or %NULL to ignore.
26734 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_call_is_on().
26735 * @error: Return location for error or %NULL.
26736 *
26737 * Finishes an operation started with button_call_is_on().
26738 *
26739 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
26740 */
26741gboolean
26742button_call_is_on_finish (
26743 Button *proxy,
26744 gboolean *out_state,
26745 GAsyncResult *res,
26746 GError **error)
26747{
26748 GVariant *_ret;
26749 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
26750 if (_ret == NULL)
26751 goto _out;
26752 g_variant_get (_ret,
26753 "(b)",
26754 out_state);
26755 g_variant_unref (_ret);
26756_out:
26757 return _ret != NULL;
26758}
26759
26760/**
26761 * button_call_is_on_sync:
26762 * @proxy: A #ButtonProxy.
26763 * @out_state: (out): Return location for return parameter or %NULL to ignore.
26764 * @cancellable: (allow-none): A #GCancellable or %NULL.
26765 * @error: Return location for error or %NULL.
26766 *
26767 * 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.
26768 *
26769 * See button_call_is_on() for the asynchronous version of this method.
26770 *
26771 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
26772 */
26773gboolean
26774button_call_is_on_sync (
26775 Button *proxy,
26776 gboolean *out_state,
26777 GCancellable *cancellable,
26778 GError **error)
26779{
26780 GVariant *_ret;
26781 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
26782 "isOn",
26783 g_variant_new ("()"),
26784 G_DBUS_CALL_FLAGS_NONE,
26785 -1,
26786 cancellable,
26787 error);
26788 if (_ret == NULL)
26789 goto _out;
26790 g_variant_get (_ret,
26791 "(b)",
26792 out_state);
26793 g_variant_unref (_ret);
26794_out:
26795 return _ret != NULL;
26796}
26797
26798/**
Norman James493996c2015-10-31 17:27:13 -050026799 * button_call_sim_press:
Norman James362a80f2015-09-14 14:04:39 -050026800 * @proxy: A #ButtonProxy.
26801 * @cancellable: (allow-none): A #GCancellable or %NULL.
26802 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
26803 * @user_data: User data to pass to @callback.
26804 *
Norman James493996c2015-10-31 17:27:13 -050026805 * 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 -050026806 * When the operation is finished, @callback will be invoked 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 -050026807 * You can then call button_call_sim_press_finish() to get the result of the operation.
Norman James362a80f2015-09-14 14:04:39 -050026808 *
Norman James493996c2015-10-31 17:27:13 -050026809 * See button_call_sim_press_sync() for the synchronous, blocking version of this method.
Norman James362a80f2015-09-14 14:04:39 -050026810 */
26811void
Norman James493996c2015-10-31 17:27:13 -050026812button_call_sim_press (
Norman James362a80f2015-09-14 14:04:39 -050026813 Button *proxy,
26814 GCancellable *cancellable,
26815 GAsyncReadyCallback callback,
26816 gpointer user_data)
26817{
26818 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
Norman James493996c2015-10-31 17:27:13 -050026819 "simPress",
Norman James362a80f2015-09-14 14:04:39 -050026820 g_variant_new ("()"),
26821 G_DBUS_CALL_FLAGS_NONE,
26822 -1,
26823 cancellable,
26824 callback,
26825 user_data);
26826}
26827
26828/**
Norman James493996c2015-10-31 17:27:13 -050026829 * button_call_sim_press_finish:
Norman James362a80f2015-09-14 14:04:39 -050026830 * @proxy: A #ButtonProxy.
Norman James493996c2015-10-31 17:27:13 -050026831 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_call_sim_press().
Norman James362a80f2015-09-14 14:04:39 -050026832 * @error: Return location for error or %NULL.
26833 *
Norman James493996c2015-10-31 17:27:13 -050026834 * Finishes an operation started with button_call_sim_press().
Norman James362a80f2015-09-14 14:04:39 -050026835 *
26836 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
26837 */
26838gboolean
Norman James493996c2015-10-31 17:27:13 -050026839button_call_sim_press_finish (
Norman James362a80f2015-09-14 14:04:39 -050026840 Button *proxy,
26841 GAsyncResult *res,
26842 GError **error)
26843{
26844 GVariant *_ret;
26845 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
26846 if (_ret == NULL)
26847 goto _out;
26848 g_variant_get (_ret,
26849 "()");
26850 g_variant_unref (_ret);
26851_out:
26852 return _ret != NULL;
26853}
26854
26855/**
Norman James493996c2015-10-31 17:27:13 -050026856 * button_call_sim_press_sync:
Norman James362a80f2015-09-14 14:04:39 -050026857 * @proxy: A #ButtonProxy.
26858 * @cancellable: (allow-none): A #GCancellable or %NULL.
26859 * @error: Return location for error or %NULL.
26860 *
Norman James493996c2015-10-31 17:27:13 -050026861 * 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 -050026862 *
Norman James493996c2015-10-31 17:27:13 -050026863 * See button_call_sim_press() for the asynchronous version of this method.
Norman James362a80f2015-09-14 14:04:39 -050026864 *
26865 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
26866 */
26867gboolean
Norman James493996c2015-10-31 17:27:13 -050026868button_call_sim_press_sync (
Norman James362a80f2015-09-14 14:04:39 -050026869 Button *proxy,
26870 GCancellable *cancellable,
26871 GError **error)
26872{
26873 GVariant *_ret;
26874 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
Norman James493996c2015-10-31 17:27:13 -050026875 "simPress",
Norman James362a80f2015-09-14 14:04:39 -050026876 g_variant_new ("()"),
26877 G_DBUS_CALL_FLAGS_NONE,
26878 -1,
26879 cancellable,
26880 error);
26881 if (_ret == NULL)
26882 goto _out;
26883 g_variant_get (_ret,
26884 "()");
26885 g_variant_unref (_ret);
26886_out:
26887 return _ret != NULL;
26888}
26889
26890/**
Norman James493996c2015-10-31 17:27:13 -050026891 * button_call_sim_long_press:
Norman James362a80f2015-09-14 14:04:39 -050026892 * @proxy: A #ButtonProxy.
26893 * @cancellable: (allow-none): A #GCancellable or %NULL.
26894 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
26895 * @user_data: User data to pass to @callback.
26896 *
Norman James493996c2015-10-31 17:27:13 -050026897 * 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 -050026898 * When the operation is finished, @callback will be invoked 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 -050026899 * You can then call button_call_sim_long_press_finish() to get the result of the operation.
Norman James362a80f2015-09-14 14:04:39 -050026900 *
Norman James493996c2015-10-31 17:27:13 -050026901 * See button_call_sim_long_press_sync() for the synchronous, blocking version of this method.
Norman James362a80f2015-09-14 14:04:39 -050026902 */
26903void
Norman James493996c2015-10-31 17:27:13 -050026904button_call_sim_long_press (
Norman James362a80f2015-09-14 14:04:39 -050026905 Button *proxy,
26906 GCancellable *cancellable,
26907 GAsyncReadyCallback callback,
26908 gpointer user_data)
26909{
26910 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
Norman James493996c2015-10-31 17:27:13 -050026911 "simLongPress",
Norman James362a80f2015-09-14 14:04:39 -050026912 g_variant_new ("()"),
26913 G_DBUS_CALL_FLAGS_NONE,
26914 -1,
26915 cancellable,
26916 callback,
26917 user_data);
26918}
26919
26920/**
Norman James493996c2015-10-31 17:27:13 -050026921 * button_call_sim_long_press_finish:
Norman James362a80f2015-09-14 14:04:39 -050026922 * @proxy: A #ButtonProxy.
Norman James493996c2015-10-31 17:27:13 -050026923 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_call_sim_long_press().
Norman James362a80f2015-09-14 14:04:39 -050026924 * @error: Return location for error or %NULL.
26925 *
Norman James493996c2015-10-31 17:27:13 -050026926 * Finishes an operation started with button_call_sim_long_press().
Norman James362a80f2015-09-14 14:04:39 -050026927 *
26928 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
26929 */
26930gboolean
Norman James493996c2015-10-31 17:27:13 -050026931button_call_sim_long_press_finish (
Norman James362a80f2015-09-14 14:04:39 -050026932 Button *proxy,
26933 GAsyncResult *res,
26934 GError **error)
26935{
26936 GVariant *_ret;
26937 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
26938 if (_ret == NULL)
26939 goto _out;
26940 g_variant_get (_ret,
26941 "()");
26942 g_variant_unref (_ret);
26943_out:
26944 return _ret != NULL;
26945}
26946
26947/**
Norman James493996c2015-10-31 17:27:13 -050026948 * button_call_sim_long_press_sync:
Norman James362a80f2015-09-14 14:04:39 -050026949 * @proxy: A #ButtonProxy.
26950 * @cancellable: (allow-none): A #GCancellable or %NULL.
26951 * @error: Return location for error or %NULL.
26952 *
Norman James493996c2015-10-31 17:27:13 -050026953 * 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 -050026954 *
Norman James493996c2015-10-31 17:27:13 -050026955 * See button_call_sim_long_press() for the asynchronous version of this method.
Norman James362a80f2015-09-14 14:04:39 -050026956 *
26957 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
26958 */
26959gboolean
Norman James493996c2015-10-31 17:27:13 -050026960button_call_sim_long_press_sync (
Norman James362a80f2015-09-14 14:04:39 -050026961 Button *proxy,
26962 GCancellable *cancellable,
26963 GError **error)
26964{
26965 GVariant *_ret;
26966 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
Norman James493996c2015-10-31 17:27:13 -050026967 "simLongPress",
Norman James362a80f2015-09-14 14:04:39 -050026968 g_variant_new ("()"),
26969 G_DBUS_CALL_FLAGS_NONE,
26970 -1,
26971 cancellable,
26972 error);
26973 if (_ret == NULL)
26974 goto _out;
26975 g_variant_get (_ret,
26976 "()");
26977 g_variant_unref (_ret);
26978_out:
26979 return _ret != NULL;
26980}
26981
26982/**
26983 * button_complete_is_on:
26984 * @object: A #Button.
26985 * @invocation: (transfer full): A #GDBusMethodInvocation.
26986 * @state: Parameter to return.
26987 *
26988 * 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.
26989 *
26990 * This method will free @invocation, you cannot use it afterwards.
26991 */
26992void
26993button_complete_is_on (
26994 Button *object,
26995 GDBusMethodInvocation *invocation,
26996 gboolean state)
26997{
26998 g_dbus_method_invocation_return_value (invocation,
26999 g_variant_new ("(b)",
27000 state));
27001}
27002
27003/**
Norman James493996c2015-10-31 17:27:13 -050027004 * button_complete_sim_press:
Norman James362a80f2015-09-14 14:04:39 -050027005 * @object: A #Button.
27006 * @invocation: (transfer full): A #GDBusMethodInvocation.
27007 *
Norman James493996c2015-10-31 17:27:13 -050027008 * 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 -050027009 *
27010 * This method will free @invocation, you cannot use it afterwards.
27011 */
27012void
Norman James493996c2015-10-31 17:27:13 -050027013button_complete_sim_press (
Norman James362a80f2015-09-14 14:04:39 -050027014 Button *object,
27015 GDBusMethodInvocation *invocation)
27016{
27017 g_dbus_method_invocation_return_value (invocation,
27018 g_variant_new ("()"));
27019}
27020
27021/**
Norman James493996c2015-10-31 17:27:13 -050027022 * button_complete_sim_long_press:
Norman James362a80f2015-09-14 14:04:39 -050027023 * @object: A #Button.
27024 * @invocation: (transfer full): A #GDBusMethodInvocation.
27025 *
Norman James493996c2015-10-31 17:27:13 -050027026 * 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 -050027027 *
27028 * This method will free @invocation, you cannot use it afterwards.
27029 */
27030void
Norman James493996c2015-10-31 17:27:13 -050027031button_complete_sim_long_press (
Norman James362a80f2015-09-14 14:04:39 -050027032 Button *object,
27033 GDBusMethodInvocation *invocation)
27034{
27035 g_dbus_method_invocation_return_value (invocation,
27036 g_variant_new ("()"));
27037}
27038
27039/* ------------------------------------------------------------------------ */
27040
27041/**
27042 * ButtonProxy:
27043 *
27044 * The #ButtonProxy structure contains only private data and should only be accessed using the provided API.
27045 */
27046
27047/**
27048 * ButtonProxyClass:
27049 * @parent_class: The parent class.
27050 *
27051 * Class structure for #ButtonProxy.
27052 */
27053
27054struct _ButtonProxyPrivate
27055{
27056 GData *qdata;
27057};
27058
27059static void button_proxy_iface_init (ButtonIface *iface);
27060
27061#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
27062G_DEFINE_TYPE_WITH_CODE (ButtonProxy, button_proxy, G_TYPE_DBUS_PROXY,
27063 G_ADD_PRIVATE (ButtonProxy)
27064 G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_proxy_iface_init));
27065
27066#else
27067G_DEFINE_TYPE_WITH_CODE (ButtonProxy, button_proxy, G_TYPE_DBUS_PROXY,
27068 G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_proxy_iface_init));
27069
27070#endif
27071static void
27072button_proxy_finalize (GObject *object)
27073{
27074 ButtonProxy *proxy = BUTTON_PROXY (object);
27075 g_datalist_clear (&proxy->priv->qdata);
27076 G_OBJECT_CLASS (button_proxy_parent_class)->finalize (object);
27077}
27078
27079static void
27080button_proxy_get_property (GObject *object,
27081 guint prop_id,
27082 GValue *value,
27083 GParamSpec *pspec G_GNUC_UNUSED)
27084{
27085 const _ExtendedGDBusPropertyInfo *info;
27086 GVariant *variant;
Norman James493996c2015-10-31 17:27:13 -050027087 g_assert (prop_id != 0 && prop_id - 1 < 2);
Norman James362a80f2015-09-14 14:04:39 -050027088 info = _button_property_info_pointers[prop_id - 1];
27089 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
27090 if (info->use_gvariant)
27091 {
27092 g_value_set_variant (value, variant);
27093 }
27094 else
27095 {
27096 if (variant != NULL)
27097 g_dbus_gvariant_to_gvalue (variant, value);
27098 }
27099 if (variant != NULL)
27100 g_variant_unref (variant);
27101}
27102
27103static void
27104button_proxy_set_property_cb (GDBusProxy *proxy,
27105 GAsyncResult *res,
27106 gpointer user_data)
27107{
27108 const _ExtendedGDBusPropertyInfo *info = user_data;
27109 GError *error;
27110 GVariant *_ret;
27111 error = NULL;
27112 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
27113 if (!_ret)
27114 {
27115 g_warning ("Error setting property '%s' on interface org.openbmc.Button: %s (%s, %d)",
27116 info->parent_struct.name,
27117 error->message, g_quark_to_string (error->domain), error->code);
27118 g_error_free (error);
27119 }
27120 else
27121 {
27122 g_variant_unref (_ret);
27123 }
27124}
27125
27126static void
27127button_proxy_set_property (GObject *object,
27128 guint prop_id,
27129 const GValue *value,
27130 GParamSpec *pspec G_GNUC_UNUSED)
27131{
27132 const _ExtendedGDBusPropertyInfo *info;
27133 GVariant *variant;
Norman James493996c2015-10-31 17:27:13 -050027134 g_assert (prop_id != 0 && prop_id - 1 < 2);
Norman James362a80f2015-09-14 14:04:39 -050027135 info = _button_property_info_pointers[prop_id - 1];
27136 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
27137 g_dbus_proxy_call (G_DBUS_PROXY (object),
27138 "org.freedesktop.DBus.Properties.Set",
27139 g_variant_new ("(ssv)", "org.openbmc.Button", info->parent_struct.name, variant),
27140 G_DBUS_CALL_FLAGS_NONE,
27141 -1,
27142 NULL, (GAsyncReadyCallback) button_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
27143 g_variant_unref (variant);
27144}
27145
27146static void
27147button_proxy_g_signal (GDBusProxy *proxy,
27148 const gchar *sender_name G_GNUC_UNUSED,
27149 const gchar *signal_name,
27150 GVariant *parameters)
27151{
27152 _ExtendedGDBusSignalInfo *info;
27153 GVariantIter iter;
27154 GVariant *child;
27155 GValue *paramv;
27156 guint num_params;
27157 guint n;
27158 guint signal_id;
27159 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, signal_name);
27160 if (info == NULL)
27161 return;
27162 num_params = g_variant_n_children (parameters);
27163 paramv = g_new0 (GValue, num_params + 1);
27164 g_value_init (&paramv[0], TYPE_BUTTON);
27165 g_value_set_object (&paramv[0], proxy);
27166 g_variant_iter_init (&iter, parameters);
27167 n = 1;
27168 while ((child = g_variant_iter_next_value (&iter)) != NULL)
27169 {
27170 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
27171 if (arg_info->use_gvariant)
27172 {
27173 g_value_init (&paramv[n], G_TYPE_VARIANT);
27174 g_value_set_variant (&paramv[n], child);
27175 n++;
27176 }
27177 else
27178 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
27179 g_variant_unref (child);
27180 }
27181 signal_id = g_signal_lookup (info->signal_name, TYPE_BUTTON);
27182 g_signal_emitv (paramv, signal_id, 0, NULL);
27183 for (n = 0; n < num_params + 1; n++)
27184 g_value_unset (&paramv[n]);
27185 g_free (paramv);
27186}
27187
27188static void
27189button_proxy_g_properties_changed (GDBusProxy *_proxy,
27190 GVariant *changed_properties,
27191 const gchar *const *invalidated_properties)
27192{
27193 ButtonProxy *proxy = BUTTON_PROXY (_proxy);
27194 guint n;
27195 const gchar *key;
27196 GVariantIter *iter;
27197 _ExtendedGDBusPropertyInfo *info;
27198 g_variant_get (changed_properties, "a{sv}", &iter);
27199 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
27200 {
27201 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, key);
27202 g_datalist_remove_data (&proxy->priv->qdata, key);
27203 if (info != NULL)
27204 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
27205 }
27206 g_variant_iter_free (iter);
27207 for (n = 0; invalidated_properties[n] != NULL; n++)
27208 {
27209 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, invalidated_properties[n]);
27210 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
27211 if (info != NULL)
27212 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
27213 }
27214}
27215
27216static gboolean
27217button_proxy_get_state (Button *object)
27218{
27219 ButtonProxy *proxy = BUTTON_PROXY (object);
27220 GVariant *variant;
27221 gboolean value = 0;
27222 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state");
27223 if (variant != NULL)
27224 {
27225 value = g_variant_get_boolean (variant);
27226 g_variant_unref (variant);
27227 }
27228 return value;
27229}
27230
Norman James493996c2015-10-31 17:27:13 -050027231static guint64
27232button_proxy_get_timer (Button *object)
27233{
27234 ButtonProxy *proxy = BUTTON_PROXY (object);
27235 GVariant *variant;
27236 guint64 value = 0;
27237 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "timer");
27238 if (variant != NULL)
27239 {
27240 value = g_variant_get_uint64 (variant);
27241 g_variant_unref (variant);
27242 }
27243 return value;
27244}
27245
Norman James362a80f2015-09-14 14:04:39 -050027246static void
27247button_proxy_init (ButtonProxy *proxy)
27248{
27249#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
27250 proxy->priv = button_proxy_get_instance_private (proxy);
27251#else
27252 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_BUTTON_PROXY, ButtonProxyPrivate);
27253#endif
27254
27255 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), button_interface_info ());
27256}
27257
27258static void
27259button_proxy_class_init (ButtonProxyClass *klass)
27260{
27261 GObjectClass *gobject_class;
27262 GDBusProxyClass *proxy_class;
27263
27264 gobject_class = G_OBJECT_CLASS (klass);
27265 gobject_class->finalize = button_proxy_finalize;
27266 gobject_class->get_property = button_proxy_get_property;
27267 gobject_class->set_property = button_proxy_set_property;
27268
27269 proxy_class = G_DBUS_PROXY_CLASS (klass);
27270 proxy_class->g_signal = button_proxy_g_signal;
27271 proxy_class->g_properties_changed = button_proxy_g_properties_changed;
27272
27273 button_override_properties (gobject_class, 1);
27274
27275#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
27276 g_type_class_add_private (klass, sizeof (ButtonProxyPrivate));
27277#endif
27278}
27279
27280static void
27281button_proxy_iface_init (ButtonIface *iface)
27282{
27283 iface->get_state = button_proxy_get_state;
Norman James493996c2015-10-31 17:27:13 -050027284 iface->get_timer = button_proxy_get_timer;
Norman James362a80f2015-09-14 14:04:39 -050027285}
27286
27287/**
27288 * button_proxy_new:
27289 * @connection: A #GDBusConnection.
27290 * @flags: Flags from the #GDBusProxyFlags enumeration.
27291 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
27292 * @object_path: An object path.
27293 * @cancellable: (allow-none): A #GCancellable or %NULL.
27294 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
27295 * @user_data: User data to pass to @callback.
27296 *
27297 * 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.
27298 *
27299 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
27300 * You can then call button_proxy_new_finish() to get the result of the operation.
27301 *
27302 * See button_proxy_new_sync() for the synchronous, blocking version of this constructor.
27303 */
27304void
27305button_proxy_new (
27306 GDBusConnection *connection,
27307 GDBusProxyFlags flags,
27308 const gchar *name,
27309 const gchar *object_path,
27310 GCancellable *cancellable,
27311 GAsyncReadyCallback callback,
27312 gpointer user_data)
27313{
27314 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);
27315}
27316
27317/**
27318 * button_proxy_new_finish:
27319 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_proxy_new().
27320 * @error: Return location for error or %NULL
27321 *
27322 * Finishes an operation started with button_proxy_new().
27323 *
27324 * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set.
27325 */
27326Button *
27327button_proxy_new_finish (
27328 GAsyncResult *res,
27329 GError **error)
27330{
27331 GObject *ret;
27332 GObject *source_object;
27333 source_object = g_async_result_get_source_object (res);
27334 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
27335 g_object_unref (source_object);
27336 if (ret != NULL)
27337 return BUTTON (ret);
27338 else
27339 return NULL;
27340}
27341
27342/**
27343 * button_proxy_new_sync:
27344 * @connection: A #GDBusConnection.
27345 * @flags: Flags from the #GDBusProxyFlags enumeration.
27346 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
27347 * @object_path: An object path.
27348 * @cancellable: (allow-none): A #GCancellable or %NULL.
27349 * @error: Return location for error or %NULL
27350 *
27351 * 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.
27352 *
27353 * The calling thread is blocked until a reply is received.
27354 *
27355 * See button_proxy_new() for the asynchronous version of this constructor.
27356 *
27357 * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set.
27358 */
27359Button *
27360button_proxy_new_sync (
27361 GDBusConnection *connection,
27362 GDBusProxyFlags flags,
27363 const gchar *name,
27364 const gchar *object_path,
27365 GCancellable *cancellable,
27366 GError **error)
27367{
27368 GInitable *ret;
27369 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);
27370 if (ret != NULL)
27371 return BUTTON (ret);
27372 else
27373 return NULL;
27374}
27375
27376
27377/**
27378 * button_proxy_new_for_bus:
27379 * @bus_type: A #GBusType.
27380 * @flags: Flags from the #GDBusProxyFlags enumeration.
27381 * @name: A bus name (well-known or unique).
27382 * @object_path: An object path.
27383 * @cancellable: (allow-none): A #GCancellable or %NULL.
27384 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
27385 * @user_data: User data to pass to @callback.
27386 *
27387 * Like button_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
27388 *
27389 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
27390 * You can then call button_proxy_new_for_bus_finish() to get the result of the operation.
27391 *
27392 * See button_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
27393 */
27394void
27395button_proxy_new_for_bus (
27396 GBusType bus_type,
27397 GDBusProxyFlags flags,
27398 const gchar *name,
27399 const gchar *object_path,
27400 GCancellable *cancellable,
27401 GAsyncReadyCallback callback,
27402 gpointer user_data)
27403{
27404 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);
27405}
27406
27407/**
27408 * button_proxy_new_for_bus_finish:
27409 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_proxy_new_for_bus().
27410 * @error: Return location for error or %NULL
27411 *
27412 * Finishes an operation started with button_proxy_new_for_bus().
27413 *
27414 * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set.
27415 */
27416Button *
27417button_proxy_new_for_bus_finish (
27418 GAsyncResult *res,
27419 GError **error)
27420{
27421 GObject *ret;
27422 GObject *source_object;
27423 source_object = g_async_result_get_source_object (res);
27424 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
27425 g_object_unref (source_object);
27426 if (ret != NULL)
27427 return BUTTON (ret);
27428 else
27429 return NULL;
27430}
27431
27432/**
27433 * button_proxy_new_for_bus_sync:
27434 * @bus_type: A #GBusType.
27435 * @flags: Flags from the #GDBusProxyFlags enumeration.
27436 * @name: A bus name (well-known or unique).
27437 * @object_path: An object path.
27438 * @cancellable: (allow-none): A #GCancellable or %NULL.
27439 * @error: Return location for error or %NULL
27440 *
27441 * Like button_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
27442 *
27443 * The calling thread is blocked until a reply is received.
27444 *
27445 * See button_proxy_new_for_bus() for the asynchronous version of this constructor.
27446 *
27447 * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set.
27448 */
27449Button *
27450button_proxy_new_for_bus_sync (
27451 GBusType bus_type,
27452 GDBusProxyFlags flags,
27453 const gchar *name,
27454 const gchar *object_path,
27455 GCancellable *cancellable,
27456 GError **error)
27457{
27458 GInitable *ret;
27459 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);
27460 if (ret != NULL)
27461 return BUTTON (ret);
27462 else
27463 return NULL;
27464}
27465
27466
27467/* ------------------------------------------------------------------------ */
27468
27469/**
27470 * ButtonSkeleton:
27471 *
27472 * The #ButtonSkeleton structure contains only private data and should only be accessed using the provided API.
27473 */
27474
27475/**
27476 * ButtonSkeletonClass:
27477 * @parent_class: The parent class.
27478 *
27479 * Class structure for #ButtonSkeleton.
27480 */
27481
27482struct _ButtonSkeletonPrivate
27483{
27484 GValue *properties;
27485 GList *changed_properties;
27486 GSource *changed_properties_idle_source;
27487 GMainContext *context;
27488 GMutex lock;
27489};
27490
27491static void
27492_button_skeleton_handle_method_call (
27493 GDBusConnection *connection G_GNUC_UNUSED,
27494 const gchar *sender G_GNUC_UNUSED,
27495 const gchar *object_path G_GNUC_UNUSED,
27496 const gchar *interface_name,
27497 const gchar *method_name,
27498 GVariant *parameters,
27499 GDBusMethodInvocation *invocation,
27500 gpointer user_data)
27501{
27502 ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data);
27503 _ExtendedGDBusMethodInfo *info;
27504 GVariantIter iter;
27505 GVariant *child;
27506 GValue *paramv;
27507 guint num_params;
27508 guint num_extra;
27509 guint n;
27510 guint signal_id;
27511 GValue return_value = G_VALUE_INIT;
27512 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
27513 g_assert (info != NULL);
27514 num_params = g_variant_n_children (parameters);
27515 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
27516 n = 0;
27517 g_value_init (&paramv[n], TYPE_BUTTON);
27518 g_value_set_object (&paramv[n++], skeleton);
27519 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
27520 g_value_set_object (&paramv[n++], invocation);
27521 if (info->pass_fdlist)
27522 {
27523#ifdef G_OS_UNIX
27524 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
27525 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
27526#else
27527 g_assert_not_reached ();
27528#endif
27529 }
27530 g_variant_iter_init (&iter, parameters);
27531 while ((child = g_variant_iter_next_value (&iter)) != NULL)
27532 {
27533 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
27534 if (arg_info->use_gvariant)
27535 {
27536 g_value_init (&paramv[n], G_TYPE_VARIANT);
27537 g_value_set_variant (&paramv[n], child);
27538 n++;
27539 }
27540 else
27541 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
27542 g_variant_unref (child);
27543 }
27544 signal_id = g_signal_lookup (info->signal_name, TYPE_BUTTON);
27545 g_value_init (&return_value, G_TYPE_BOOLEAN);
27546 g_signal_emitv (paramv, signal_id, 0, &return_value);
27547 if (!g_value_get_boolean (&return_value))
27548 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);
27549 g_value_unset (&return_value);
27550 for (n = 0; n < num_params + num_extra; n++)
27551 g_value_unset (&paramv[n]);
27552 g_free (paramv);
27553}
27554
27555static GVariant *
27556_button_skeleton_handle_get_property (
27557 GDBusConnection *connection G_GNUC_UNUSED,
27558 const gchar *sender G_GNUC_UNUSED,
27559 const gchar *object_path G_GNUC_UNUSED,
27560 const gchar *interface_name G_GNUC_UNUSED,
27561 const gchar *property_name,
27562 GError **error,
27563 gpointer user_data)
27564{
27565 ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data);
27566 GValue value = G_VALUE_INIT;
27567 GParamSpec *pspec;
27568 _ExtendedGDBusPropertyInfo *info;
27569 GVariant *ret;
27570 ret = NULL;
27571 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, property_name);
27572 g_assert (info != NULL);
27573 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
27574 if (pspec == NULL)
27575 {
27576 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
27577 }
27578 else
27579 {
27580 g_value_init (&value, pspec->value_type);
27581 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
27582 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
27583 g_value_unset (&value);
27584 }
27585 return ret;
27586}
27587
27588static gboolean
27589_button_skeleton_handle_set_property (
27590 GDBusConnection *connection G_GNUC_UNUSED,
27591 const gchar *sender G_GNUC_UNUSED,
27592 const gchar *object_path G_GNUC_UNUSED,
27593 const gchar *interface_name G_GNUC_UNUSED,
27594 const gchar *property_name,
27595 GVariant *variant,
27596 GError **error,
27597 gpointer user_data)
27598{
27599 ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data);
27600 GValue value = G_VALUE_INIT;
27601 GParamSpec *pspec;
27602 _ExtendedGDBusPropertyInfo *info;
27603 gboolean ret;
27604 ret = FALSE;
27605 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, property_name);
27606 g_assert (info != NULL);
27607 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
27608 if (pspec == NULL)
27609 {
27610 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
27611 }
27612 else
27613 {
27614 if (info->use_gvariant)
27615 g_value_set_variant (&value, variant);
27616 else
27617 g_dbus_gvariant_to_gvalue (variant, &value);
27618 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
27619 g_value_unset (&value);
27620 ret = TRUE;
27621 }
27622 return ret;
27623}
27624
27625static const GDBusInterfaceVTable _button_skeleton_vtable =
27626{
27627 _button_skeleton_handle_method_call,
27628 _button_skeleton_handle_get_property,
27629 _button_skeleton_handle_set_property,
27630 {NULL}
27631};
27632
27633static GDBusInterfaceInfo *
27634button_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
27635{
27636 return button_interface_info ();
27637}
27638
27639static GDBusInterfaceVTable *
27640button_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
27641{
27642 return (GDBusInterfaceVTable *) &_button_skeleton_vtable;
27643}
27644
27645static GVariant *
27646button_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
27647{
27648 ButtonSkeleton *skeleton = BUTTON_SKELETON (_skeleton);
27649
27650 GVariantBuilder builder;
27651 guint n;
27652 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
27653 if (_button_interface_info.parent_struct.properties == NULL)
27654 goto out;
27655 for (n = 0; _button_interface_info.parent_struct.properties[n] != NULL; n++)
27656 {
27657 GDBusPropertyInfo *info = _button_interface_info.parent_struct.properties[n];
27658 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
27659 {
27660 GVariant *value;
27661 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);
27662 if (value != NULL)
27663 {
27664 g_variant_take_ref (value);
27665 g_variant_builder_add (&builder, "{sv}", info->name, value);
27666 g_variant_unref (value);
27667 }
27668 }
27669 }
27670out:
27671 return g_variant_builder_end (&builder);
27672}
27673
27674static gboolean _button_emit_changed (gpointer user_data);
27675
27676static void
27677button_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
27678{
27679 ButtonSkeleton *skeleton = BUTTON_SKELETON (_skeleton);
27680 gboolean emit_changed = FALSE;
27681
27682 g_mutex_lock (&skeleton->priv->lock);
27683 if (skeleton->priv->changed_properties_idle_source != NULL)
27684 {
27685 g_source_destroy (skeleton->priv->changed_properties_idle_source);
27686 skeleton->priv->changed_properties_idle_source = NULL;
27687 emit_changed = TRUE;
27688 }
27689 g_mutex_unlock (&skeleton->priv->lock);
27690
27691 if (emit_changed)
27692 _button_emit_changed (skeleton);
27693}
27694
27695static void
Norman James493996c2015-10-31 17:27:13 -050027696_button_on_signal_released (
Norman James362a80f2015-09-14 14:04:39 -050027697 Button *object)
27698{
27699 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
27700
27701 GList *connections, *l;
27702 GVariant *signal_variant;
27703 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
27704
27705 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
27706 for (l = connections; l != NULL; l = l->next)
27707 {
27708 GDBusConnection *connection = l->data;
27709 g_dbus_connection_emit_signal (connection,
Norman James493996c2015-10-31 17:27:13 -050027710 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Button", "Released",
Norman James362a80f2015-09-14 14:04:39 -050027711 signal_variant, NULL);
27712 }
27713 g_variant_unref (signal_variant);
27714 g_list_free_full (connections, g_object_unref);
27715}
27716
27717static void
Norman James493996c2015-10-31 17:27:13 -050027718_button_on_signal_pressed (
Norman James362a80f2015-09-14 14:04:39 -050027719 Button *object)
27720{
27721 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
27722
27723 GList *connections, *l;
27724 GVariant *signal_variant;
27725 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
27726
27727 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
27728 for (l = connections; l != NULL; l = l->next)
27729 {
27730 GDBusConnection *connection = l->data;
27731 g_dbus_connection_emit_signal (connection,
Norman James493996c2015-10-31 17:27:13 -050027732 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Button", "Pressed",
Norman James362a80f2015-09-14 14:04:39 -050027733 signal_variant, NULL);
27734 }
27735 g_variant_unref (signal_variant);
27736 g_list_free_full (connections, g_object_unref);
27737}
27738
27739static void
Norman James493996c2015-10-31 17:27:13 -050027740_button_on_signal_pressed_long (
Norman James362a80f2015-09-14 14:04:39 -050027741 Button *object)
27742{
27743 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
27744
27745 GList *connections, *l;
27746 GVariant *signal_variant;
27747 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
27748
27749 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
27750 for (l = connections; l != NULL; l = l->next)
27751 {
27752 GDBusConnection *connection = l->data;
27753 g_dbus_connection_emit_signal (connection,
Norman James493996c2015-10-31 17:27:13 -050027754 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Button", "PressedLong",
Norman James362a80f2015-09-14 14:04:39 -050027755 signal_variant, NULL);
27756 }
27757 g_variant_unref (signal_variant);
27758 g_list_free_full (connections, g_object_unref);
27759}
27760
27761static void button_skeleton_iface_init (ButtonIface *iface);
27762#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
27763G_DEFINE_TYPE_WITH_CODE (ButtonSkeleton, button_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
27764 G_ADD_PRIVATE (ButtonSkeleton)
27765 G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_skeleton_iface_init));
27766
27767#else
27768G_DEFINE_TYPE_WITH_CODE (ButtonSkeleton, button_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
27769 G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_skeleton_iface_init));
27770
27771#endif
27772static void
27773button_skeleton_finalize (GObject *object)
27774{
27775 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
27776 guint n;
Norman James493996c2015-10-31 17:27:13 -050027777 for (n = 0; n < 2; n++)
Norman James362a80f2015-09-14 14:04:39 -050027778 g_value_unset (&skeleton->priv->properties[n]);
27779 g_free (skeleton->priv->properties);
27780 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
27781 if (skeleton->priv->changed_properties_idle_source != NULL)
27782 g_source_destroy (skeleton->priv->changed_properties_idle_source);
27783 g_main_context_unref (skeleton->priv->context);
27784 g_mutex_clear (&skeleton->priv->lock);
27785 G_OBJECT_CLASS (button_skeleton_parent_class)->finalize (object);
27786}
27787
27788static void
27789button_skeleton_get_property (GObject *object,
27790 guint prop_id,
27791 GValue *value,
27792 GParamSpec *pspec G_GNUC_UNUSED)
27793{
27794 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
Norman James493996c2015-10-31 17:27:13 -050027795 g_assert (prop_id != 0 && prop_id - 1 < 2);
Norman James362a80f2015-09-14 14:04:39 -050027796 g_mutex_lock (&skeleton->priv->lock);
27797 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
27798 g_mutex_unlock (&skeleton->priv->lock);
27799}
27800
27801static gboolean
27802_button_emit_changed (gpointer user_data)
27803{
27804 ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data);
27805 GList *l;
27806 GVariantBuilder builder;
27807 GVariantBuilder invalidated_builder;
27808 guint num_changes;
27809
27810 g_mutex_lock (&skeleton->priv->lock);
27811 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
27812 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
27813 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
27814 {
27815 ChangedProperty *cp = l->data;
27816 GVariant *variant;
27817 const GValue *cur_value;
27818
27819 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
27820 if (!_g_value_equal (cur_value, &cp->orig_value))
27821 {
27822 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
27823 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
27824 g_variant_unref (variant);
27825 num_changes++;
27826 }
27827 }
27828 if (num_changes > 0)
27829 {
27830 GList *connections, *ll;
27831 GVariant *signal_variant;
27832 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Button",
27833 &builder, &invalidated_builder));
27834 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
27835 for (ll = connections; ll != NULL; ll = ll->next)
27836 {
27837 GDBusConnection *connection = ll->data;
27838
27839 g_dbus_connection_emit_signal (connection,
27840 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
27841 "org.freedesktop.DBus.Properties",
27842 "PropertiesChanged",
27843 signal_variant,
27844 NULL);
27845 }
27846 g_variant_unref (signal_variant);
27847 g_list_free_full (connections, g_object_unref);
27848 }
27849 else
27850 {
27851 g_variant_builder_clear (&builder);
27852 g_variant_builder_clear (&invalidated_builder);
27853 }
27854 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
27855 skeleton->priv->changed_properties = NULL;
27856 skeleton->priv->changed_properties_idle_source = NULL;
27857 g_mutex_unlock (&skeleton->priv->lock);
27858 return FALSE;
27859}
27860
27861static void
27862_button_schedule_emit_changed (ButtonSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
27863{
27864 ChangedProperty *cp;
27865 GList *l;
27866 cp = NULL;
27867 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
27868 {
27869 ChangedProperty *i_cp = l->data;
27870 if (i_cp->info == info)
27871 {
27872 cp = i_cp;
27873 break;
27874 }
27875 }
27876 if (cp == NULL)
27877 {
27878 cp = g_new0 (ChangedProperty, 1);
27879 cp->prop_id = prop_id;
27880 cp->info = info;
27881 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
27882 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
27883 g_value_copy (orig_value, &cp->orig_value);
27884 }
27885}
27886
27887static void
27888button_skeleton_notify (GObject *object,
27889 GParamSpec *pspec G_GNUC_UNUSED)
27890{
27891 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
27892 g_mutex_lock (&skeleton->priv->lock);
27893 if (skeleton->priv->changed_properties != NULL &&
27894 skeleton->priv->changed_properties_idle_source == NULL)
27895 {
27896 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
27897 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
27898 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _button_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
Adriana Kobylakfd778822016-06-16 09:08:37 -050027899 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _button_emit_changed");
Norman James362a80f2015-09-14 14:04:39 -050027900 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
27901 g_source_unref (skeleton->priv->changed_properties_idle_source);
27902 }
27903 g_mutex_unlock (&skeleton->priv->lock);
27904}
27905
27906static void
27907button_skeleton_set_property (GObject *object,
27908 guint prop_id,
27909 const GValue *value,
27910 GParamSpec *pspec)
27911{
27912 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
Norman James493996c2015-10-31 17:27:13 -050027913 g_assert (prop_id != 0 && prop_id - 1 < 2);
Norman James362a80f2015-09-14 14:04:39 -050027914 g_mutex_lock (&skeleton->priv->lock);
27915 g_object_freeze_notify (object);
27916 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
27917 {
27918 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
27919 _button_schedule_emit_changed (skeleton, _button_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
27920 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
27921 g_object_notify_by_pspec (object, pspec);
27922 }
27923 g_mutex_unlock (&skeleton->priv->lock);
27924 g_object_thaw_notify (object);
27925}
27926
27927static void
27928button_skeleton_init (ButtonSkeleton *skeleton)
27929{
27930#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
27931 skeleton->priv = button_skeleton_get_instance_private (skeleton);
27932#else
27933 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_BUTTON_SKELETON, ButtonSkeletonPrivate);
27934#endif
27935
27936 g_mutex_init (&skeleton->priv->lock);
27937 skeleton->priv->context = g_main_context_ref_thread_default ();
Norman James493996c2015-10-31 17:27:13 -050027938 skeleton->priv->properties = g_new0 (GValue, 2);
Norman James362a80f2015-09-14 14:04:39 -050027939 g_value_init (&skeleton->priv->properties[0], G_TYPE_BOOLEAN);
Norman James493996c2015-10-31 17:27:13 -050027940 g_value_init (&skeleton->priv->properties[1], G_TYPE_UINT64);
Norman James362a80f2015-09-14 14:04:39 -050027941}
27942
27943static gboolean
27944button_skeleton_get_state (Button *object)
27945{
27946 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
27947 gboolean value;
27948 g_mutex_lock (&skeleton->priv->lock);
27949 value = g_value_get_boolean (&(skeleton->priv->properties[0]));
27950 g_mutex_unlock (&skeleton->priv->lock);
27951 return value;
27952}
27953
Norman James493996c2015-10-31 17:27:13 -050027954static guint64
27955button_skeleton_get_timer (Button *object)
27956{
27957 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
27958 guint64 value;
27959 g_mutex_lock (&skeleton->priv->lock);
27960 value = g_value_get_uint64 (&(skeleton->priv->properties[1]));
27961 g_mutex_unlock (&skeleton->priv->lock);
27962 return value;
27963}
27964
Norman James362a80f2015-09-14 14:04:39 -050027965static void
27966button_skeleton_class_init (ButtonSkeletonClass *klass)
27967{
27968 GObjectClass *gobject_class;
27969 GDBusInterfaceSkeletonClass *skeleton_class;
27970
27971 gobject_class = G_OBJECT_CLASS (klass);
27972 gobject_class->finalize = button_skeleton_finalize;
27973 gobject_class->get_property = button_skeleton_get_property;
27974 gobject_class->set_property = button_skeleton_set_property;
27975 gobject_class->notify = button_skeleton_notify;
27976
27977
27978 button_override_properties (gobject_class, 1);
27979
27980 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
27981 skeleton_class->get_info = button_skeleton_dbus_interface_get_info;
27982 skeleton_class->get_properties = button_skeleton_dbus_interface_get_properties;
27983 skeleton_class->flush = button_skeleton_dbus_interface_flush;
27984 skeleton_class->get_vtable = button_skeleton_dbus_interface_get_vtable;
27985
27986#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
27987 g_type_class_add_private (klass, sizeof (ButtonSkeletonPrivate));
27988#endif
27989}
27990
27991static void
27992button_skeleton_iface_init (ButtonIface *iface)
27993{
Norman James493996c2015-10-31 17:27:13 -050027994 iface->released = _button_on_signal_released;
27995 iface->pressed = _button_on_signal_pressed;
27996 iface->pressed_long = _button_on_signal_pressed_long;
Norman James362a80f2015-09-14 14:04:39 -050027997 iface->get_state = button_skeleton_get_state;
Norman James493996c2015-10-31 17:27:13 -050027998 iface->get_timer = button_skeleton_get_timer;
Norman James362a80f2015-09-14 14:04:39 -050027999}
28000
28001/**
28002 * button_skeleton_new:
28003 *
28004 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link>.
28005 *
28006 * Returns: (transfer full) (type ButtonSkeleton): The skeleton object.
28007 */
28008Button *
28009button_skeleton_new (void)
28010{
28011 return BUTTON (g_object_new (TYPE_BUTTON_SKELETON, NULL));
28012}
28013
28014/* ------------------------------------------------------------------------
28015 * Code for interface org.openbmc.Led
28016 * ------------------------------------------------------------------------
28017 */
28018
28019/**
28020 * SECTION:Led
28021 * @title: Led
28022 * @short_description: Generated C code for the org.openbmc.Led D-Bus interface
28023 *
28024 * 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.
28025 */
28026
28027/* ---- Introspection data for org.openbmc.Led ---- */
28028
28029static const _ExtendedGDBusMethodInfo _led_method_info_set_on =
28030{
28031 {
28032 -1,
28033 (gchar *) "setOn",
28034 NULL,
28035 NULL,
28036 NULL
28037 },
28038 "handle-set-on",
28039 FALSE
28040};
28041
28042static const _ExtendedGDBusMethodInfo _led_method_info_set_off =
28043{
28044 {
28045 -1,
28046 (gchar *) "setOff",
28047 NULL,
28048 NULL,
28049 NULL
28050 },
28051 "handle-set-off",
28052 FALSE
28053};
28054
28055static const _ExtendedGDBusMethodInfo _led_method_info_set_blink_slow =
28056{
28057 {
28058 -1,
28059 (gchar *) "setBlinkSlow",
28060 NULL,
28061 NULL,
28062 NULL
28063 },
28064 "handle-set-blink-slow",
28065 FALSE
28066};
28067
28068static const _ExtendedGDBusMethodInfo _led_method_info_set_blink_fast =
28069{
28070 {
28071 -1,
28072 (gchar *) "setBlinkFast",
28073 NULL,
28074 NULL,
28075 NULL
28076 },
28077 "handle-set-blink-fast",
28078 FALSE
28079};
28080
28081static const _ExtendedGDBusMethodInfo * const _led_method_info_pointers[] =
28082{
28083 &_led_method_info_set_on,
28084 &_led_method_info_set_off,
28085 &_led_method_info_set_blink_slow,
28086 &_led_method_info_set_blink_fast,
28087 NULL
28088};
28089
28090static const _ExtendedGDBusPropertyInfo _led_property_info_color =
28091{
28092 {
28093 -1,
28094 (gchar *) "color",
28095 (gchar *) "i",
28096 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
28097 NULL
28098 },
28099 "color",
28100 FALSE
28101};
28102
28103static const _ExtendedGDBusPropertyInfo _led_property_info_function =
28104{
28105 {
28106 -1,
28107 (gchar *) "function",
28108 (gchar *) "s",
28109 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
28110 NULL
28111 },
28112 "function",
28113 FALSE
28114};
28115
Norman James493996c2015-10-31 17:27:13 -050028116static const _ExtendedGDBusPropertyInfo _led_property_info_state =
28117{
28118 {
28119 -1,
28120 (gchar *) "state",
28121 (gchar *) "s",
28122 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
28123 NULL
28124 },
28125 "state",
28126 FALSE
28127};
28128
Norman James362a80f2015-09-14 14:04:39 -050028129static const _ExtendedGDBusPropertyInfo * const _led_property_info_pointers[] =
28130{
28131 &_led_property_info_color,
28132 &_led_property_info_function,
Norman James493996c2015-10-31 17:27:13 -050028133 &_led_property_info_state,
Norman James362a80f2015-09-14 14:04:39 -050028134 NULL
28135};
28136
28137static const _ExtendedGDBusInterfaceInfo _led_interface_info =
28138{
28139 {
28140 -1,
28141 (gchar *) "org.openbmc.Led",
28142 (GDBusMethodInfo **) &_led_method_info_pointers,
28143 NULL,
28144 (GDBusPropertyInfo **) &_led_property_info_pointers,
28145 NULL
28146 },
28147 "led",
28148};
28149
28150
28151/**
28152 * led_interface_info:
28153 *
28154 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link> D-Bus interface.
28155 *
28156 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
28157 */
28158GDBusInterfaceInfo *
28159led_interface_info (void)
28160{
28161 return (GDBusInterfaceInfo *) &_led_interface_info.parent_struct;
28162}
28163
28164/**
28165 * led_override_properties:
28166 * @klass: The class structure for a #GObject<!-- -->-derived class.
28167 * @property_id_begin: The property id to assign to the first overridden property.
28168 *
28169 * Overrides all #GObject properties in the #Led interface for a concrete class.
28170 * The properties are overridden in the order they are defined.
28171 *
28172 * Returns: The last property id.
28173 */
28174guint
28175led_override_properties (GObjectClass *klass, guint property_id_begin)
28176{
28177 g_object_class_override_property (klass, property_id_begin++, "color");
28178 g_object_class_override_property (klass, property_id_begin++, "function");
Norman James493996c2015-10-31 17:27:13 -050028179 g_object_class_override_property (klass, property_id_begin++, "state");
Norman James362a80f2015-09-14 14:04:39 -050028180 return property_id_begin - 1;
28181}
28182
28183
28184
28185/**
28186 * Led:
28187 *
28188 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>.
28189 */
28190
28191/**
28192 * LedIface:
28193 * @parent_iface: The parent interface.
28194 * @handle_set_blink_fast: Handler for the #Led::handle-set-blink-fast signal.
28195 * @handle_set_blink_slow: Handler for the #Led::handle-set-blink-slow signal.
28196 * @handle_set_off: Handler for the #Led::handle-set-off signal.
28197 * @handle_set_on: Handler for the #Led::handle-set-on signal.
28198 * @get_color: Getter for the #Led:color property.
28199 * @get_function: Getter for the #Led:function property.
Norman James493996c2015-10-31 17:27:13 -050028200 * @get_state: Getter for the #Led:state property.
Norman James362a80f2015-09-14 14:04:39 -050028201 *
28202 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>.
28203 */
28204
28205typedef LedIface LedInterface;
28206G_DEFINE_INTERFACE (Led, led, G_TYPE_OBJECT);
28207
28208static void
28209led_default_init (LedIface *iface)
28210{
28211 /* GObject signals for incoming D-Bus method calls: */
28212 /**
28213 * Led::handle-set-on:
28214 * @object: A #Led.
28215 * @invocation: A #GDBusMethodInvocation.
28216 *
28217 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setOn">setOn()</link> D-Bus method.
28218 *
28219 * 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.
28220 *
28221 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
28222 */
28223 g_signal_new ("handle-set-on",
28224 G_TYPE_FROM_INTERFACE (iface),
28225 G_SIGNAL_RUN_LAST,
28226 G_STRUCT_OFFSET (LedIface, handle_set_on),
28227 g_signal_accumulator_true_handled,
28228 NULL,
28229 g_cclosure_marshal_generic,
28230 G_TYPE_BOOLEAN,
28231 1,
28232 G_TYPE_DBUS_METHOD_INVOCATION);
28233
28234 /**
28235 * Led::handle-set-off:
28236 * @object: A #Led.
28237 * @invocation: A #GDBusMethodInvocation.
28238 *
28239 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setOff">setOff()</link> D-Bus method.
28240 *
28241 * 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.
28242 *
28243 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
28244 */
28245 g_signal_new ("handle-set-off",
28246 G_TYPE_FROM_INTERFACE (iface),
28247 G_SIGNAL_RUN_LAST,
28248 G_STRUCT_OFFSET (LedIface, handle_set_off),
28249 g_signal_accumulator_true_handled,
28250 NULL,
28251 g_cclosure_marshal_generic,
28252 G_TYPE_BOOLEAN,
28253 1,
28254 G_TYPE_DBUS_METHOD_INVOCATION);
28255
28256 /**
28257 * Led::handle-set-blink-slow:
28258 * @object: A #Led.
28259 * @invocation: A #GDBusMethodInvocation.
28260 *
28261 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setBlinkSlow">setBlinkSlow()</link> D-Bus method.
28262 *
28263 * 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.
28264 *
28265 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
28266 */
28267 g_signal_new ("handle-set-blink-slow",
28268 G_TYPE_FROM_INTERFACE (iface),
28269 G_SIGNAL_RUN_LAST,
28270 G_STRUCT_OFFSET (LedIface, handle_set_blink_slow),
28271 g_signal_accumulator_true_handled,
28272 NULL,
28273 g_cclosure_marshal_generic,
28274 G_TYPE_BOOLEAN,
28275 1,
28276 G_TYPE_DBUS_METHOD_INVOCATION);
28277
28278 /**
28279 * Led::handle-set-blink-fast:
28280 * @object: A #Led.
28281 * @invocation: A #GDBusMethodInvocation.
28282 *
28283 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setBlinkFast">setBlinkFast()</link> D-Bus method.
28284 *
28285 * 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.
28286 *
28287 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
28288 */
28289 g_signal_new ("handle-set-blink-fast",
28290 G_TYPE_FROM_INTERFACE (iface),
28291 G_SIGNAL_RUN_LAST,
28292 G_STRUCT_OFFSET (LedIface, handle_set_blink_fast),
28293 g_signal_accumulator_true_handled,
28294 NULL,
28295 g_cclosure_marshal_generic,
28296 G_TYPE_BOOLEAN,
28297 1,
28298 G_TYPE_DBUS_METHOD_INVOCATION);
28299
28300 /* GObject properties for D-Bus properties: */
28301 /**
28302 * Led:color:
28303 *
28304 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Led.color">"color"</link>.
28305 *
28306 * 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.
28307 */
28308 g_object_interface_install_property (iface,
28309 g_param_spec_int ("color", "color", "color", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
28310 /**
28311 * Led:function:
28312 *
28313 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link>.
28314 *
28315 * 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.
28316 */
28317 g_object_interface_install_property (iface,
28318 g_param_spec_string ("function", "function", "function", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Norman James493996c2015-10-31 17:27:13 -050028319 /**
28320 * Led:state:
28321 *
28322 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Led.state">"state"</link>.
28323 *
28324 * 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.
28325 */
28326 g_object_interface_install_property (iface,
28327 g_param_spec_string ("state", "state", "state", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Norman James362a80f2015-09-14 14:04:39 -050028328}
28329
28330/**
28331 * led_get_color: (skip)
28332 * @object: A #Led.
28333 *
28334 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Led.color">"color"</link> D-Bus property.
28335 *
28336 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
28337 *
28338 * Returns: The property value.
28339 */
28340gint
28341led_get_color (Led *object)
28342{
28343 return LED_GET_IFACE (object)->get_color (object);
28344}
28345
28346/**
28347 * led_set_color: (skip)
28348 * @object: A #Led.
28349 * @value: The value to set.
28350 *
28351 * Sets the <link linkend="gdbus-property-org-openbmc-Led.color">"color"</link> D-Bus property to @value.
28352 *
28353 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
28354 */
28355void
28356led_set_color (Led *object, gint value)
28357{
28358 g_object_set (G_OBJECT (object), "color", value, NULL);
28359}
28360
28361/**
28362 * led_get_function: (skip)
28363 * @object: A #Led.
28364 *
28365 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link> D-Bus property.
28366 *
28367 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
28368 *
28369 * <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>
28370 *
28371 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
28372 */
28373const gchar *
28374led_get_function (Led *object)
28375{
28376 return LED_GET_IFACE (object)->get_function (object);
28377}
28378
28379/**
28380 * led_dup_function: (skip)
28381 * @object: A #Led.
28382 *
28383 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link> D-Bus property.
28384 *
28385 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
28386 *
28387 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
28388 */
28389gchar *
28390led_dup_function (Led *object)
28391{
28392 gchar *value;
28393 g_object_get (G_OBJECT (object), "function", &value, NULL);
28394 return value;
28395}
28396
28397/**
28398 * led_set_function: (skip)
28399 * @object: A #Led.
28400 * @value: The value to set.
28401 *
28402 * Sets the <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link> D-Bus property to @value.
28403 *
28404 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
28405 */
28406void
28407led_set_function (Led *object, const gchar *value)
28408{
28409 g_object_set (G_OBJECT (object), "function", value, NULL);
28410}
28411
28412/**
Norman James493996c2015-10-31 17:27:13 -050028413 * led_get_state: (skip)
28414 * @object: A #Led.
28415 *
28416 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Led.state">"state"</link> D-Bus property.
28417 *
28418 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
28419 *
28420 * <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>
28421 *
28422 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
28423 */
28424const gchar *
28425led_get_state (Led *object)
28426{
28427 return LED_GET_IFACE (object)->get_state (object);
28428}
28429
28430/**
28431 * led_dup_state: (skip)
28432 * @object: A #Led.
28433 *
28434 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Led.state">"state"</link> D-Bus property.
28435 *
28436 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
28437 *
28438 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
28439 */
28440gchar *
28441led_dup_state (Led *object)
28442{
28443 gchar *value;
28444 g_object_get (G_OBJECT (object), "state", &value, NULL);
28445 return value;
28446}
28447
28448/**
28449 * led_set_state: (skip)
28450 * @object: A #Led.
28451 * @value: The value to set.
28452 *
28453 * Sets the <link linkend="gdbus-property-org-openbmc-Led.state">"state"</link> D-Bus property to @value.
28454 *
28455 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
28456 */
28457void
28458led_set_state (Led *object, const gchar *value)
28459{
28460 g_object_set (G_OBJECT (object), "state", value, NULL);
28461}
28462
28463/**
Norman James362a80f2015-09-14 14:04:39 -050028464 * led_call_set_on:
28465 * @proxy: A #LedProxy.
28466 * @cancellable: (allow-none): A #GCancellable or %NULL.
28467 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
28468 * @user_data: User data to pass to @callback.
28469 *
28470 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setOn">setOn()</link> D-Bus method on @proxy.
28471 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
28472 * You can then call led_call_set_on_finish() to get the result of the operation.
28473 *
28474 * See led_call_set_on_sync() for the synchronous, blocking version of this method.
28475 */
28476void
28477led_call_set_on (
28478 Led *proxy,
28479 GCancellable *cancellable,
28480 GAsyncReadyCallback callback,
28481 gpointer user_data)
28482{
28483 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
28484 "setOn",
28485 g_variant_new ("()"),
28486 G_DBUS_CALL_FLAGS_NONE,
28487 -1,
28488 cancellable,
28489 callback,
28490 user_data);
28491}
28492
28493/**
28494 * led_call_set_on_finish:
28495 * @proxy: A #LedProxy.
28496 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_on().
28497 * @error: Return location for error or %NULL.
28498 *
28499 * Finishes an operation started with led_call_set_on().
28500 *
28501 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
28502 */
28503gboolean
28504led_call_set_on_finish (
28505 Led *proxy,
28506 GAsyncResult *res,
28507 GError **error)
28508{
28509 GVariant *_ret;
28510 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
28511 if (_ret == NULL)
28512 goto _out;
28513 g_variant_get (_ret,
28514 "()");
28515 g_variant_unref (_ret);
28516_out:
28517 return _ret != NULL;
28518}
28519
28520/**
28521 * led_call_set_on_sync:
28522 * @proxy: A #LedProxy.
28523 * @cancellable: (allow-none): A #GCancellable or %NULL.
28524 * @error: Return location for error or %NULL.
28525 *
28526 * 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.
28527 *
28528 * See led_call_set_on() for the asynchronous version of this method.
28529 *
28530 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
28531 */
28532gboolean
28533led_call_set_on_sync (
28534 Led *proxy,
28535 GCancellable *cancellable,
28536 GError **error)
28537{
28538 GVariant *_ret;
28539 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
28540 "setOn",
28541 g_variant_new ("()"),
28542 G_DBUS_CALL_FLAGS_NONE,
28543 -1,
28544 cancellable,
28545 error);
28546 if (_ret == NULL)
28547 goto _out;
28548 g_variant_get (_ret,
28549 "()");
28550 g_variant_unref (_ret);
28551_out:
28552 return _ret != NULL;
28553}
28554
28555/**
28556 * led_call_set_off:
28557 * @proxy: A #LedProxy.
28558 * @cancellable: (allow-none): A #GCancellable or %NULL.
28559 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
28560 * @user_data: User data to pass to @callback.
28561 *
28562 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setOff">setOff()</link> D-Bus method on @proxy.
28563 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
28564 * You can then call led_call_set_off_finish() to get the result of the operation.
28565 *
28566 * See led_call_set_off_sync() for the synchronous, blocking version of this method.
28567 */
28568void
28569led_call_set_off (
28570 Led *proxy,
28571 GCancellable *cancellable,
28572 GAsyncReadyCallback callback,
28573 gpointer user_data)
28574{
28575 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
28576 "setOff",
28577 g_variant_new ("()"),
28578 G_DBUS_CALL_FLAGS_NONE,
28579 -1,
28580 cancellable,
28581 callback,
28582 user_data);
28583}
28584
28585/**
28586 * led_call_set_off_finish:
28587 * @proxy: A #LedProxy.
28588 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_off().
28589 * @error: Return location for error or %NULL.
28590 *
28591 * Finishes an operation started with led_call_set_off().
28592 *
28593 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
28594 */
28595gboolean
28596led_call_set_off_finish (
28597 Led *proxy,
28598 GAsyncResult *res,
28599 GError **error)
28600{
28601 GVariant *_ret;
28602 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
28603 if (_ret == NULL)
28604 goto _out;
28605 g_variant_get (_ret,
28606 "()");
28607 g_variant_unref (_ret);
28608_out:
28609 return _ret != NULL;
28610}
28611
28612/**
28613 * led_call_set_off_sync:
28614 * @proxy: A #LedProxy.
28615 * @cancellable: (allow-none): A #GCancellable or %NULL.
28616 * @error: Return location for error or %NULL.
28617 *
28618 * 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.
28619 *
28620 * See led_call_set_off() for the asynchronous version of this method.
28621 *
28622 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
28623 */
28624gboolean
28625led_call_set_off_sync (
28626 Led *proxy,
28627 GCancellable *cancellable,
28628 GError **error)
28629{
28630 GVariant *_ret;
28631 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
28632 "setOff",
28633 g_variant_new ("()"),
28634 G_DBUS_CALL_FLAGS_NONE,
28635 -1,
28636 cancellable,
28637 error);
28638 if (_ret == NULL)
28639 goto _out;
28640 g_variant_get (_ret,
28641 "()");
28642 g_variant_unref (_ret);
28643_out:
28644 return _ret != NULL;
28645}
28646
28647/**
28648 * led_call_set_blink_slow:
28649 * @proxy: A #LedProxy.
28650 * @cancellable: (allow-none): A #GCancellable or %NULL.
28651 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
28652 * @user_data: User data to pass to @callback.
28653 *
28654 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setBlinkSlow">setBlinkSlow()</link> D-Bus method on @proxy.
28655 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
28656 * You can then call led_call_set_blink_slow_finish() to get the result of the operation.
28657 *
28658 * See led_call_set_blink_slow_sync() for the synchronous, blocking version of this method.
28659 */
28660void
28661led_call_set_blink_slow (
28662 Led *proxy,
28663 GCancellable *cancellable,
28664 GAsyncReadyCallback callback,
28665 gpointer user_data)
28666{
28667 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
28668 "setBlinkSlow",
28669 g_variant_new ("()"),
28670 G_DBUS_CALL_FLAGS_NONE,
28671 -1,
28672 cancellable,
28673 callback,
28674 user_data);
28675}
28676
28677/**
28678 * led_call_set_blink_slow_finish:
28679 * @proxy: A #LedProxy.
28680 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_blink_slow().
28681 * @error: Return location for error or %NULL.
28682 *
28683 * Finishes an operation started with led_call_set_blink_slow().
28684 *
28685 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
28686 */
28687gboolean
28688led_call_set_blink_slow_finish (
28689 Led *proxy,
28690 GAsyncResult *res,
28691 GError **error)
28692{
28693 GVariant *_ret;
28694 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
28695 if (_ret == NULL)
28696 goto _out;
28697 g_variant_get (_ret,
28698 "()");
28699 g_variant_unref (_ret);
28700_out:
28701 return _ret != NULL;
28702}
28703
28704/**
28705 * led_call_set_blink_slow_sync:
28706 * @proxy: A #LedProxy.
28707 * @cancellable: (allow-none): A #GCancellable or %NULL.
28708 * @error: Return location for error or %NULL.
28709 *
28710 * 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.
28711 *
28712 * See led_call_set_blink_slow() for the asynchronous version of this method.
28713 *
28714 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
28715 */
28716gboolean
28717led_call_set_blink_slow_sync (
28718 Led *proxy,
28719 GCancellable *cancellable,
28720 GError **error)
28721{
28722 GVariant *_ret;
28723 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
28724 "setBlinkSlow",
28725 g_variant_new ("()"),
28726 G_DBUS_CALL_FLAGS_NONE,
28727 -1,
28728 cancellable,
28729 error);
28730 if (_ret == NULL)
28731 goto _out;
28732 g_variant_get (_ret,
28733 "()");
28734 g_variant_unref (_ret);
28735_out:
28736 return _ret != NULL;
28737}
28738
28739/**
28740 * led_call_set_blink_fast:
28741 * @proxy: A #LedProxy.
28742 * @cancellable: (allow-none): A #GCancellable or %NULL.
28743 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
28744 * @user_data: User data to pass to @callback.
28745 *
28746 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setBlinkFast">setBlinkFast()</link> D-Bus method on @proxy.
28747 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
28748 * You can then call led_call_set_blink_fast_finish() to get the result of the operation.
28749 *
28750 * See led_call_set_blink_fast_sync() for the synchronous, blocking version of this method.
28751 */
28752void
28753led_call_set_blink_fast (
28754 Led *proxy,
28755 GCancellable *cancellable,
28756 GAsyncReadyCallback callback,
28757 gpointer user_data)
28758{
28759 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
28760 "setBlinkFast",
28761 g_variant_new ("()"),
28762 G_DBUS_CALL_FLAGS_NONE,
28763 -1,
28764 cancellable,
28765 callback,
28766 user_data);
28767}
28768
28769/**
28770 * led_call_set_blink_fast_finish:
28771 * @proxy: A #LedProxy.
28772 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_blink_fast().
28773 * @error: Return location for error or %NULL.
28774 *
28775 * Finishes an operation started with led_call_set_blink_fast().
28776 *
28777 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
28778 */
28779gboolean
28780led_call_set_blink_fast_finish (
28781 Led *proxy,
28782 GAsyncResult *res,
28783 GError **error)
28784{
28785 GVariant *_ret;
28786 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
28787 if (_ret == NULL)
28788 goto _out;
28789 g_variant_get (_ret,
28790 "()");
28791 g_variant_unref (_ret);
28792_out:
28793 return _ret != NULL;
28794}
28795
28796/**
28797 * led_call_set_blink_fast_sync:
28798 * @proxy: A #LedProxy.
28799 * @cancellable: (allow-none): A #GCancellable or %NULL.
28800 * @error: Return location for error or %NULL.
28801 *
28802 * 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.
28803 *
28804 * See led_call_set_blink_fast() for the asynchronous version of this method.
28805 *
28806 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
28807 */
28808gboolean
28809led_call_set_blink_fast_sync (
28810 Led *proxy,
28811 GCancellable *cancellable,
28812 GError **error)
28813{
28814 GVariant *_ret;
28815 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
28816 "setBlinkFast",
28817 g_variant_new ("()"),
28818 G_DBUS_CALL_FLAGS_NONE,
28819 -1,
28820 cancellable,
28821 error);
28822 if (_ret == NULL)
28823 goto _out;
28824 g_variant_get (_ret,
28825 "()");
28826 g_variant_unref (_ret);
28827_out:
28828 return _ret != NULL;
28829}
28830
28831/**
28832 * led_complete_set_on:
28833 * @object: A #Led.
28834 * @invocation: (transfer full): A #GDBusMethodInvocation.
28835 *
28836 * 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.
28837 *
28838 * This method will free @invocation, you cannot use it afterwards.
28839 */
28840void
28841led_complete_set_on (
28842 Led *object,
28843 GDBusMethodInvocation *invocation)
28844{
28845 g_dbus_method_invocation_return_value (invocation,
28846 g_variant_new ("()"));
28847}
28848
28849/**
28850 * led_complete_set_off:
28851 * @object: A #Led.
28852 * @invocation: (transfer full): A #GDBusMethodInvocation.
28853 *
28854 * 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.
28855 *
28856 * This method will free @invocation, you cannot use it afterwards.
28857 */
28858void
28859led_complete_set_off (
28860 Led *object,
28861 GDBusMethodInvocation *invocation)
28862{
28863 g_dbus_method_invocation_return_value (invocation,
28864 g_variant_new ("()"));
28865}
28866
28867/**
28868 * led_complete_set_blink_slow:
28869 * @object: A #Led.
28870 * @invocation: (transfer full): A #GDBusMethodInvocation.
28871 *
28872 * 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.
28873 *
28874 * This method will free @invocation, you cannot use it afterwards.
28875 */
28876void
28877led_complete_set_blink_slow (
28878 Led *object,
28879 GDBusMethodInvocation *invocation)
28880{
28881 g_dbus_method_invocation_return_value (invocation,
28882 g_variant_new ("()"));
28883}
28884
28885/**
28886 * led_complete_set_blink_fast:
28887 * @object: A #Led.
28888 * @invocation: (transfer full): A #GDBusMethodInvocation.
28889 *
28890 * 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.
28891 *
28892 * This method will free @invocation, you cannot use it afterwards.
28893 */
28894void
28895led_complete_set_blink_fast (
28896 Led *object,
28897 GDBusMethodInvocation *invocation)
28898{
28899 g_dbus_method_invocation_return_value (invocation,
28900 g_variant_new ("()"));
28901}
28902
28903/* ------------------------------------------------------------------------ */
28904
28905/**
28906 * LedProxy:
28907 *
28908 * The #LedProxy structure contains only private data and should only be accessed using the provided API.
28909 */
28910
28911/**
28912 * LedProxyClass:
28913 * @parent_class: The parent class.
28914 *
28915 * Class structure for #LedProxy.
28916 */
28917
28918struct _LedProxyPrivate
28919{
28920 GData *qdata;
28921};
28922
28923static void led_proxy_iface_init (LedIface *iface);
28924
28925#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
28926G_DEFINE_TYPE_WITH_CODE (LedProxy, led_proxy, G_TYPE_DBUS_PROXY,
28927 G_ADD_PRIVATE (LedProxy)
28928 G_IMPLEMENT_INTERFACE (TYPE_LED, led_proxy_iface_init));
28929
28930#else
28931G_DEFINE_TYPE_WITH_CODE (LedProxy, led_proxy, G_TYPE_DBUS_PROXY,
28932 G_IMPLEMENT_INTERFACE (TYPE_LED, led_proxy_iface_init));
28933
28934#endif
28935static void
28936led_proxy_finalize (GObject *object)
28937{
28938 LedProxy *proxy = LED_PROXY (object);
28939 g_datalist_clear (&proxy->priv->qdata);
28940 G_OBJECT_CLASS (led_proxy_parent_class)->finalize (object);
28941}
28942
28943static void
28944led_proxy_get_property (GObject *object,
28945 guint prop_id,
28946 GValue *value,
28947 GParamSpec *pspec G_GNUC_UNUSED)
28948{
28949 const _ExtendedGDBusPropertyInfo *info;
28950 GVariant *variant;
Norman James493996c2015-10-31 17:27:13 -050028951 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -050028952 info = _led_property_info_pointers[prop_id - 1];
28953 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
28954 if (info->use_gvariant)
28955 {
28956 g_value_set_variant (value, variant);
28957 }
28958 else
28959 {
28960 if (variant != NULL)
28961 g_dbus_gvariant_to_gvalue (variant, value);
28962 }
28963 if (variant != NULL)
28964 g_variant_unref (variant);
28965}
28966
28967static void
28968led_proxy_set_property_cb (GDBusProxy *proxy,
28969 GAsyncResult *res,
28970 gpointer user_data)
28971{
28972 const _ExtendedGDBusPropertyInfo *info = user_data;
28973 GError *error;
28974 GVariant *_ret;
28975 error = NULL;
28976 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
28977 if (!_ret)
28978 {
28979 g_warning ("Error setting property '%s' on interface org.openbmc.Led: %s (%s, %d)",
28980 info->parent_struct.name,
28981 error->message, g_quark_to_string (error->domain), error->code);
28982 g_error_free (error);
28983 }
28984 else
28985 {
28986 g_variant_unref (_ret);
28987 }
28988}
28989
28990static void
28991led_proxy_set_property (GObject *object,
28992 guint prop_id,
28993 const GValue *value,
28994 GParamSpec *pspec G_GNUC_UNUSED)
28995{
28996 const _ExtendedGDBusPropertyInfo *info;
28997 GVariant *variant;
Norman James493996c2015-10-31 17:27:13 -050028998 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -050028999 info = _led_property_info_pointers[prop_id - 1];
29000 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
29001 g_dbus_proxy_call (G_DBUS_PROXY (object),
29002 "org.freedesktop.DBus.Properties.Set",
29003 g_variant_new ("(ssv)", "org.openbmc.Led", info->parent_struct.name, variant),
29004 G_DBUS_CALL_FLAGS_NONE,
29005 -1,
29006 NULL, (GAsyncReadyCallback) led_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
29007 g_variant_unref (variant);
29008}
29009
29010static void
29011led_proxy_g_signal (GDBusProxy *proxy,
29012 const gchar *sender_name G_GNUC_UNUSED,
29013 const gchar *signal_name,
29014 GVariant *parameters)
29015{
29016 _ExtendedGDBusSignalInfo *info;
29017 GVariantIter iter;
29018 GVariant *child;
29019 GValue *paramv;
29020 guint num_params;
29021 guint n;
29022 guint signal_id;
29023 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, signal_name);
29024 if (info == NULL)
29025 return;
29026 num_params = g_variant_n_children (parameters);
29027 paramv = g_new0 (GValue, num_params + 1);
29028 g_value_init (&paramv[0], TYPE_LED);
29029 g_value_set_object (&paramv[0], proxy);
29030 g_variant_iter_init (&iter, parameters);
29031 n = 1;
29032 while ((child = g_variant_iter_next_value (&iter)) != NULL)
29033 {
29034 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
29035 if (arg_info->use_gvariant)
29036 {
29037 g_value_init (&paramv[n], G_TYPE_VARIANT);
29038 g_value_set_variant (&paramv[n], child);
29039 n++;
29040 }
29041 else
29042 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
29043 g_variant_unref (child);
29044 }
29045 signal_id = g_signal_lookup (info->signal_name, TYPE_LED);
29046 g_signal_emitv (paramv, signal_id, 0, NULL);
29047 for (n = 0; n < num_params + 1; n++)
29048 g_value_unset (&paramv[n]);
29049 g_free (paramv);
29050}
29051
29052static void
29053led_proxy_g_properties_changed (GDBusProxy *_proxy,
29054 GVariant *changed_properties,
29055 const gchar *const *invalidated_properties)
29056{
29057 LedProxy *proxy = LED_PROXY (_proxy);
29058 guint n;
29059 const gchar *key;
29060 GVariantIter *iter;
29061 _ExtendedGDBusPropertyInfo *info;
29062 g_variant_get (changed_properties, "a{sv}", &iter);
29063 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
29064 {
29065 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, key);
29066 g_datalist_remove_data (&proxy->priv->qdata, key);
29067 if (info != NULL)
29068 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
29069 }
29070 g_variant_iter_free (iter);
29071 for (n = 0; invalidated_properties[n] != NULL; n++)
29072 {
29073 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, invalidated_properties[n]);
29074 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
29075 if (info != NULL)
29076 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
29077 }
29078}
29079
29080static gint
29081led_proxy_get_color (Led *object)
29082{
29083 LedProxy *proxy = LED_PROXY (object);
29084 GVariant *variant;
29085 gint value = 0;
29086 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "color");
29087 if (variant != NULL)
29088 {
29089 value = g_variant_get_int32 (variant);
29090 g_variant_unref (variant);
29091 }
29092 return value;
29093}
29094
29095static const gchar *
29096led_proxy_get_function (Led *object)
29097{
29098 LedProxy *proxy = LED_PROXY (object);
29099 GVariant *variant;
29100 const gchar *value = NULL;
29101 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "function");
29102 if (variant != NULL)
29103 {
29104 value = g_variant_get_string (variant, NULL);
29105 g_variant_unref (variant);
29106 }
29107 return value;
29108}
29109
Norman James493996c2015-10-31 17:27:13 -050029110static const gchar *
29111led_proxy_get_state (Led *object)
29112{
29113 LedProxy *proxy = LED_PROXY (object);
29114 GVariant *variant;
29115 const gchar *value = NULL;
29116 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state");
29117 if (variant != NULL)
29118 {
29119 value = g_variant_get_string (variant, NULL);
29120 g_variant_unref (variant);
29121 }
29122 return value;
29123}
29124
Norman James362a80f2015-09-14 14:04:39 -050029125static void
29126led_proxy_init (LedProxy *proxy)
29127{
29128#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
29129 proxy->priv = led_proxy_get_instance_private (proxy);
29130#else
29131 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_LED_PROXY, LedProxyPrivate);
29132#endif
29133
29134 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), led_interface_info ());
29135}
29136
29137static void
29138led_proxy_class_init (LedProxyClass *klass)
29139{
29140 GObjectClass *gobject_class;
29141 GDBusProxyClass *proxy_class;
29142
29143 gobject_class = G_OBJECT_CLASS (klass);
29144 gobject_class->finalize = led_proxy_finalize;
29145 gobject_class->get_property = led_proxy_get_property;
29146 gobject_class->set_property = led_proxy_set_property;
29147
29148 proxy_class = G_DBUS_PROXY_CLASS (klass);
29149 proxy_class->g_signal = led_proxy_g_signal;
29150 proxy_class->g_properties_changed = led_proxy_g_properties_changed;
29151
29152 led_override_properties (gobject_class, 1);
29153
29154#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
29155 g_type_class_add_private (klass, sizeof (LedProxyPrivate));
29156#endif
29157}
29158
29159static void
29160led_proxy_iface_init (LedIface *iface)
29161{
29162 iface->get_color = led_proxy_get_color;
29163 iface->get_function = led_proxy_get_function;
Norman James493996c2015-10-31 17:27:13 -050029164 iface->get_state = led_proxy_get_state;
Norman James362a80f2015-09-14 14:04:39 -050029165}
29166
29167/**
29168 * led_proxy_new:
29169 * @connection: A #GDBusConnection.
29170 * @flags: Flags from the #GDBusProxyFlags enumeration.
29171 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
29172 * @object_path: An object path.
29173 * @cancellable: (allow-none): A #GCancellable or %NULL.
29174 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
29175 * @user_data: User data to pass to @callback.
29176 *
29177 * 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.
29178 *
29179 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
29180 * You can then call led_proxy_new_finish() to get the result of the operation.
29181 *
29182 * See led_proxy_new_sync() for the synchronous, blocking version of this constructor.
29183 */
29184void
29185led_proxy_new (
29186 GDBusConnection *connection,
29187 GDBusProxyFlags flags,
29188 const gchar *name,
29189 const gchar *object_path,
29190 GCancellable *cancellable,
29191 GAsyncReadyCallback callback,
29192 gpointer user_data)
29193{
29194 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);
29195}
29196
29197/**
29198 * led_proxy_new_finish:
29199 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_proxy_new().
29200 * @error: Return location for error or %NULL
29201 *
29202 * Finishes an operation started with led_proxy_new().
29203 *
29204 * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set.
29205 */
29206Led *
29207led_proxy_new_finish (
29208 GAsyncResult *res,
29209 GError **error)
29210{
29211 GObject *ret;
29212 GObject *source_object;
29213 source_object = g_async_result_get_source_object (res);
29214 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
29215 g_object_unref (source_object);
29216 if (ret != NULL)
29217 return LED (ret);
29218 else
29219 return NULL;
29220}
29221
29222/**
29223 * led_proxy_new_sync:
29224 * @connection: A #GDBusConnection.
29225 * @flags: Flags from the #GDBusProxyFlags enumeration.
29226 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
29227 * @object_path: An object path.
29228 * @cancellable: (allow-none): A #GCancellable or %NULL.
29229 * @error: Return location for error or %NULL
29230 *
29231 * 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.
29232 *
29233 * The calling thread is blocked until a reply is received.
29234 *
29235 * See led_proxy_new() for the asynchronous version of this constructor.
29236 *
29237 * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set.
29238 */
29239Led *
29240led_proxy_new_sync (
29241 GDBusConnection *connection,
29242 GDBusProxyFlags flags,
29243 const gchar *name,
29244 const gchar *object_path,
29245 GCancellable *cancellable,
29246 GError **error)
29247{
29248 GInitable *ret;
29249 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);
29250 if (ret != NULL)
29251 return LED (ret);
29252 else
29253 return NULL;
29254}
29255
29256
29257/**
29258 * led_proxy_new_for_bus:
29259 * @bus_type: A #GBusType.
29260 * @flags: Flags from the #GDBusProxyFlags enumeration.
29261 * @name: A bus name (well-known or unique).
29262 * @object_path: An object path.
29263 * @cancellable: (allow-none): A #GCancellable or %NULL.
29264 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
29265 * @user_data: User data to pass to @callback.
29266 *
29267 * Like led_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
29268 *
29269 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
29270 * You can then call led_proxy_new_for_bus_finish() to get the result of the operation.
29271 *
29272 * See led_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
29273 */
29274void
29275led_proxy_new_for_bus (
29276 GBusType bus_type,
29277 GDBusProxyFlags flags,
29278 const gchar *name,
29279 const gchar *object_path,
29280 GCancellable *cancellable,
29281 GAsyncReadyCallback callback,
29282 gpointer user_data)
29283{
29284 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);
29285}
29286
29287/**
29288 * led_proxy_new_for_bus_finish:
29289 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_proxy_new_for_bus().
29290 * @error: Return location for error or %NULL
29291 *
29292 * Finishes an operation started with led_proxy_new_for_bus().
29293 *
29294 * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set.
29295 */
29296Led *
29297led_proxy_new_for_bus_finish (
29298 GAsyncResult *res,
29299 GError **error)
29300{
29301 GObject *ret;
29302 GObject *source_object;
29303 source_object = g_async_result_get_source_object (res);
29304 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
29305 g_object_unref (source_object);
29306 if (ret != NULL)
29307 return LED (ret);
29308 else
29309 return NULL;
29310}
29311
29312/**
29313 * led_proxy_new_for_bus_sync:
29314 * @bus_type: A #GBusType.
29315 * @flags: Flags from the #GDBusProxyFlags enumeration.
29316 * @name: A bus name (well-known or unique).
29317 * @object_path: An object path.
29318 * @cancellable: (allow-none): A #GCancellable or %NULL.
29319 * @error: Return location for error or %NULL
29320 *
29321 * Like led_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
29322 *
29323 * The calling thread is blocked until a reply is received.
29324 *
29325 * See led_proxy_new_for_bus() for the asynchronous version of this constructor.
29326 *
29327 * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set.
29328 */
29329Led *
29330led_proxy_new_for_bus_sync (
29331 GBusType bus_type,
29332 GDBusProxyFlags flags,
29333 const gchar *name,
29334 const gchar *object_path,
29335 GCancellable *cancellable,
29336 GError **error)
29337{
29338 GInitable *ret;
29339 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);
29340 if (ret != NULL)
29341 return LED (ret);
29342 else
29343 return NULL;
29344}
29345
29346
29347/* ------------------------------------------------------------------------ */
29348
29349/**
29350 * LedSkeleton:
29351 *
29352 * The #LedSkeleton structure contains only private data and should only be accessed using the provided API.
29353 */
29354
29355/**
29356 * LedSkeletonClass:
29357 * @parent_class: The parent class.
29358 *
29359 * Class structure for #LedSkeleton.
29360 */
29361
29362struct _LedSkeletonPrivate
29363{
29364 GValue *properties;
29365 GList *changed_properties;
29366 GSource *changed_properties_idle_source;
29367 GMainContext *context;
29368 GMutex lock;
29369};
29370
29371static void
29372_led_skeleton_handle_method_call (
29373 GDBusConnection *connection G_GNUC_UNUSED,
29374 const gchar *sender G_GNUC_UNUSED,
29375 const gchar *object_path G_GNUC_UNUSED,
29376 const gchar *interface_name,
29377 const gchar *method_name,
29378 GVariant *parameters,
29379 GDBusMethodInvocation *invocation,
29380 gpointer user_data)
29381{
29382 LedSkeleton *skeleton = LED_SKELETON (user_data);
29383 _ExtendedGDBusMethodInfo *info;
29384 GVariantIter iter;
29385 GVariant *child;
29386 GValue *paramv;
29387 guint num_params;
29388 guint num_extra;
29389 guint n;
29390 guint signal_id;
29391 GValue return_value = G_VALUE_INIT;
29392 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
29393 g_assert (info != NULL);
29394 num_params = g_variant_n_children (parameters);
29395 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
29396 n = 0;
29397 g_value_init (&paramv[n], TYPE_LED);
29398 g_value_set_object (&paramv[n++], skeleton);
29399 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
29400 g_value_set_object (&paramv[n++], invocation);
29401 if (info->pass_fdlist)
29402 {
29403#ifdef G_OS_UNIX
29404 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
29405 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
29406#else
29407 g_assert_not_reached ();
29408#endif
29409 }
29410 g_variant_iter_init (&iter, parameters);
29411 while ((child = g_variant_iter_next_value (&iter)) != NULL)
29412 {
29413 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
29414 if (arg_info->use_gvariant)
29415 {
29416 g_value_init (&paramv[n], G_TYPE_VARIANT);
29417 g_value_set_variant (&paramv[n], child);
29418 n++;
29419 }
29420 else
29421 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
29422 g_variant_unref (child);
29423 }
29424 signal_id = g_signal_lookup (info->signal_name, TYPE_LED);
29425 g_value_init (&return_value, G_TYPE_BOOLEAN);
29426 g_signal_emitv (paramv, signal_id, 0, &return_value);
29427 if (!g_value_get_boolean (&return_value))
29428 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);
29429 g_value_unset (&return_value);
29430 for (n = 0; n < num_params + num_extra; n++)
29431 g_value_unset (&paramv[n]);
29432 g_free (paramv);
29433}
29434
29435static GVariant *
29436_led_skeleton_handle_get_property (
29437 GDBusConnection *connection G_GNUC_UNUSED,
29438 const gchar *sender G_GNUC_UNUSED,
29439 const gchar *object_path G_GNUC_UNUSED,
29440 const gchar *interface_name G_GNUC_UNUSED,
29441 const gchar *property_name,
29442 GError **error,
29443 gpointer user_data)
29444{
29445 LedSkeleton *skeleton = LED_SKELETON (user_data);
29446 GValue value = G_VALUE_INIT;
29447 GParamSpec *pspec;
29448 _ExtendedGDBusPropertyInfo *info;
29449 GVariant *ret;
29450 ret = NULL;
29451 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, property_name);
29452 g_assert (info != NULL);
29453 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
29454 if (pspec == NULL)
29455 {
29456 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
29457 }
29458 else
29459 {
29460 g_value_init (&value, pspec->value_type);
29461 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
29462 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
29463 g_value_unset (&value);
29464 }
29465 return ret;
29466}
29467
29468static gboolean
29469_led_skeleton_handle_set_property (
29470 GDBusConnection *connection G_GNUC_UNUSED,
29471 const gchar *sender G_GNUC_UNUSED,
29472 const gchar *object_path G_GNUC_UNUSED,
29473 const gchar *interface_name G_GNUC_UNUSED,
29474 const gchar *property_name,
29475 GVariant *variant,
29476 GError **error,
29477 gpointer user_data)
29478{
29479 LedSkeleton *skeleton = LED_SKELETON (user_data);
29480 GValue value = G_VALUE_INIT;
29481 GParamSpec *pspec;
29482 _ExtendedGDBusPropertyInfo *info;
29483 gboolean ret;
29484 ret = FALSE;
29485 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, property_name);
29486 g_assert (info != NULL);
29487 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
29488 if (pspec == NULL)
29489 {
29490 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
29491 }
29492 else
29493 {
29494 if (info->use_gvariant)
29495 g_value_set_variant (&value, variant);
29496 else
29497 g_dbus_gvariant_to_gvalue (variant, &value);
29498 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
29499 g_value_unset (&value);
29500 ret = TRUE;
29501 }
29502 return ret;
29503}
29504
29505static const GDBusInterfaceVTable _led_skeleton_vtable =
29506{
29507 _led_skeleton_handle_method_call,
29508 _led_skeleton_handle_get_property,
29509 _led_skeleton_handle_set_property,
29510 {NULL}
29511};
29512
29513static GDBusInterfaceInfo *
29514led_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
29515{
29516 return led_interface_info ();
29517}
29518
29519static GDBusInterfaceVTable *
29520led_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
29521{
29522 return (GDBusInterfaceVTable *) &_led_skeleton_vtable;
29523}
29524
29525static GVariant *
29526led_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
29527{
29528 LedSkeleton *skeleton = LED_SKELETON (_skeleton);
29529
29530 GVariantBuilder builder;
29531 guint n;
29532 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
29533 if (_led_interface_info.parent_struct.properties == NULL)
29534 goto out;
29535 for (n = 0; _led_interface_info.parent_struct.properties[n] != NULL; n++)
29536 {
29537 GDBusPropertyInfo *info = _led_interface_info.parent_struct.properties[n];
29538 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
29539 {
29540 GVariant *value;
29541 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);
29542 if (value != NULL)
29543 {
29544 g_variant_take_ref (value);
29545 g_variant_builder_add (&builder, "{sv}", info->name, value);
29546 g_variant_unref (value);
29547 }
29548 }
29549 }
29550out:
29551 return g_variant_builder_end (&builder);
29552}
29553
29554static gboolean _led_emit_changed (gpointer user_data);
29555
29556static void
29557led_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
29558{
29559 LedSkeleton *skeleton = LED_SKELETON (_skeleton);
29560 gboolean emit_changed = FALSE;
29561
29562 g_mutex_lock (&skeleton->priv->lock);
29563 if (skeleton->priv->changed_properties_idle_source != NULL)
29564 {
29565 g_source_destroy (skeleton->priv->changed_properties_idle_source);
29566 skeleton->priv->changed_properties_idle_source = NULL;
29567 emit_changed = TRUE;
29568 }
29569 g_mutex_unlock (&skeleton->priv->lock);
29570
29571 if (emit_changed)
29572 _led_emit_changed (skeleton);
29573}
29574
29575static void led_skeleton_iface_init (LedIface *iface);
29576#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
29577G_DEFINE_TYPE_WITH_CODE (LedSkeleton, led_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
29578 G_ADD_PRIVATE (LedSkeleton)
29579 G_IMPLEMENT_INTERFACE (TYPE_LED, led_skeleton_iface_init));
29580
29581#else
29582G_DEFINE_TYPE_WITH_CODE (LedSkeleton, led_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
29583 G_IMPLEMENT_INTERFACE (TYPE_LED, led_skeleton_iface_init));
29584
29585#endif
29586static void
29587led_skeleton_finalize (GObject *object)
29588{
29589 LedSkeleton *skeleton = LED_SKELETON (object);
29590 guint n;
Norman James493996c2015-10-31 17:27:13 -050029591 for (n = 0; n < 3; n++)
Norman James362a80f2015-09-14 14:04:39 -050029592 g_value_unset (&skeleton->priv->properties[n]);
29593 g_free (skeleton->priv->properties);
29594 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
29595 if (skeleton->priv->changed_properties_idle_source != NULL)
29596 g_source_destroy (skeleton->priv->changed_properties_idle_source);
29597 g_main_context_unref (skeleton->priv->context);
29598 g_mutex_clear (&skeleton->priv->lock);
29599 G_OBJECT_CLASS (led_skeleton_parent_class)->finalize (object);
29600}
29601
29602static void
29603led_skeleton_get_property (GObject *object,
29604 guint prop_id,
29605 GValue *value,
29606 GParamSpec *pspec G_GNUC_UNUSED)
29607{
29608 LedSkeleton *skeleton = LED_SKELETON (object);
Norman James493996c2015-10-31 17:27:13 -050029609 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -050029610 g_mutex_lock (&skeleton->priv->lock);
29611 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
29612 g_mutex_unlock (&skeleton->priv->lock);
29613}
29614
29615static gboolean
29616_led_emit_changed (gpointer user_data)
29617{
29618 LedSkeleton *skeleton = LED_SKELETON (user_data);
29619 GList *l;
29620 GVariantBuilder builder;
29621 GVariantBuilder invalidated_builder;
29622 guint num_changes;
29623
29624 g_mutex_lock (&skeleton->priv->lock);
29625 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
29626 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
29627 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
29628 {
29629 ChangedProperty *cp = l->data;
29630 GVariant *variant;
29631 const GValue *cur_value;
29632
29633 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
29634 if (!_g_value_equal (cur_value, &cp->orig_value))
29635 {
29636 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
29637 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
29638 g_variant_unref (variant);
29639 num_changes++;
29640 }
29641 }
29642 if (num_changes > 0)
29643 {
29644 GList *connections, *ll;
29645 GVariant *signal_variant;
29646 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Led",
29647 &builder, &invalidated_builder));
29648 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
29649 for (ll = connections; ll != NULL; ll = ll->next)
29650 {
29651 GDBusConnection *connection = ll->data;
29652
29653 g_dbus_connection_emit_signal (connection,
29654 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
29655 "org.freedesktop.DBus.Properties",
29656 "PropertiesChanged",
29657 signal_variant,
29658 NULL);
29659 }
29660 g_variant_unref (signal_variant);
29661 g_list_free_full (connections, g_object_unref);
29662 }
29663 else
29664 {
29665 g_variant_builder_clear (&builder);
29666 g_variant_builder_clear (&invalidated_builder);
29667 }
29668 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
29669 skeleton->priv->changed_properties = NULL;
29670 skeleton->priv->changed_properties_idle_source = NULL;
29671 g_mutex_unlock (&skeleton->priv->lock);
29672 return FALSE;
29673}
29674
29675static void
29676_led_schedule_emit_changed (LedSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
29677{
29678 ChangedProperty *cp;
29679 GList *l;
29680 cp = NULL;
29681 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
29682 {
29683 ChangedProperty *i_cp = l->data;
29684 if (i_cp->info == info)
29685 {
29686 cp = i_cp;
29687 break;
29688 }
29689 }
29690 if (cp == NULL)
29691 {
29692 cp = g_new0 (ChangedProperty, 1);
29693 cp->prop_id = prop_id;
29694 cp->info = info;
29695 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
29696 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
29697 g_value_copy (orig_value, &cp->orig_value);
29698 }
29699}
29700
29701static void
29702led_skeleton_notify (GObject *object,
29703 GParamSpec *pspec G_GNUC_UNUSED)
29704{
29705 LedSkeleton *skeleton = LED_SKELETON (object);
29706 g_mutex_lock (&skeleton->priv->lock);
29707 if (skeleton->priv->changed_properties != NULL &&
29708 skeleton->priv->changed_properties_idle_source == NULL)
29709 {
29710 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
29711 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
29712 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _led_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
Adriana Kobylakfd778822016-06-16 09:08:37 -050029713 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _led_emit_changed");
Norman James362a80f2015-09-14 14:04:39 -050029714 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
29715 g_source_unref (skeleton->priv->changed_properties_idle_source);
29716 }
29717 g_mutex_unlock (&skeleton->priv->lock);
29718}
29719
29720static void
29721led_skeleton_set_property (GObject *object,
29722 guint prop_id,
29723 const GValue *value,
29724 GParamSpec *pspec)
29725{
29726 LedSkeleton *skeleton = LED_SKELETON (object);
Norman James493996c2015-10-31 17:27:13 -050029727 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -050029728 g_mutex_lock (&skeleton->priv->lock);
29729 g_object_freeze_notify (object);
29730 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
29731 {
29732 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
29733 _led_schedule_emit_changed (skeleton, _led_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
29734 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
29735 g_object_notify_by_pspec (object, pspec);
29736 }
29737 g_mutex_unlock (&skeleton->priv->lock);
29738 g_object_thaw_notify (object);
29739}
29740
29741static void
29742led_skeleton_init (LedSkeleton *skeleton)
29743{
29744#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
29745 skeleton->priv = led_skeleton_get_instance_private (skeleton);
29746#else
29747 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_LED_SKELETON, LedSkeletonPrivate);
29748#endif
29749
29750 g_mutex_init (&skeleton->priv->lock);
29751 skeleton->priv->context = g_main_context_ref_thread_default ();
Norman James493996c2015-10-31 17:27:13 -050029752 skeleton->priv->properties = g_new0 (GValue, 3);
Norman James362a80f2015-09-14 14:04:39 -050029753 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
29754 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
Norman James493996c2015-10-31 17:27:13 -050029755 g_value_init (&skeleton->priv->properties[2], G_TYPE_STRING);
Norman James362a80f2015-09-14 14:04:39 -050029756}
29757
29758static gint
29759led_skeleton_get_color (Led *object)
29760{
29761 LedSkeleton *skeleton = LED_SKELETON (object);
29762 gint value;
29763 g_mutex_lock (&skeleton->priv->lock);
29764 value = g_value_get_int (&(skeleton->priv->properties[0]));
29765 g_mutex_unlock (&skeleton->priv->lock);
29766 return value;
29767}
29768
29769static const gchar *
29770led_skeleton_get_function (Led *object)
29771{
29772 LedSkeleton *skeleton = LED_SKELETON (object);
29773 const gchar *value;
29774 g_mutex_lock (&skeleton->priv->lock);
29775 value = g_value_get_string (&(skeleton->priv->properties[1]));
29776 g_mutex_unlock (&skeleton->priv->lock);
29777 return value;
29778}
29779
Norman James493996c2015-10-31 17:27:13 -050029780static const gchar *
29781led_skeleton_get_state (Led *object)
29782{
29783 LedSkeleton *skeleton = LED_SKELETON (object);
29784 const gchar *value;
29785 g_mutex_lock (&skeleton->priv->lock);
29786 value = g_value_get_string (&(skeleton->priv->properties[2]));
29787 g_mutex_unlock (&skeleton->priv->lock);
29788 return value;
29789}
29790
Norman James362a80f2015-09-14 14:04:39 -050029791static void
29792led_skeleton_class_init (LedSkeletonClass *klass)
29793{
29794 GObjectClass *gobject_class;
29795 GDBusInterfaceSkeletonClass *skeleton_class;
29796
29797 gobject_class = G_OBJECT_CLASS (klass);
29798 gobject_class->finalize = led_skeleton_finalize;
29799 gobject_class->get_property = led_skeleton_get_property;
29800 gobject_class->set_property = led_skeleton_set_property;
29801 gobject_class->notify = led_skeleton_notify;
29802
29803
29804 led_override_properties (gobject_class, 1);
29805
29806 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
29807 skeleton_class->get_info = led_skeleton_dbus_interface_get_info;
29808 skeleton_class->get_properties = led_skeleton_dbus_interface_get_properties;
29809 skeleton_class->flush = led_skeleton_dbus_interface_flush;
29810 skeleton_class->get_vtable = led_skeleton_dbus_interface_get_vtable;
29811
29812#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
29813 g_type_class_add_private (klass, sizeof (LedSkeletonPrivate));
29814#endif
29815}
29816
29817static void
29818led_skeleton_iface_init (LedIface *iface)
29819{
29820 iface->get_color = led_skeleton_get_color;
29821 iface->get_function = led_skeleton_get_function;
Norman James493996c2015-10-31 17:27:13 -050029822 iface->get_state = led_skeleton_get_state;
Norman James362a80f2015-09-14 14:04:39 -050029823}
29824
29825/**
29826 * led_skeleton_new:
29827 *
29828 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>.
29829 *
29830 * Returns: (transfer full) (type LedSkeleton): The skeleton object.
29831 */
29832Led *
29833led_skeleton_new (void)
29834{
29835 return LED (g_object_new (TYPE_LED_SKELETON, NULL));
29836}
29837
29838/* ------------------------------------------------------------------------
Norman Jamesdbcffbd2015-10-06 16:53:06 -050029839 * Code for interface org.openbmc.HostIpmi
29840 * ------------------------------------------------------------------------
29841 */
29842
29843/**
29844 * SECTION:HostIpmi
29845 * @title: HostIpmi
29846 * @short_description: Generated C code for the org.openbmc.HostIpmi D-Bus interface
29847 *
29848 * 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.
29849 */
29850
29851/* ---- Introspection data for org.openbmc.HostIpmi ---- */
29852
29853static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_IN_ARG_seq =
29854{
29855 {
29856 -1,
29857 (gchar *) "seq",
29858 (gchar *) "y",
29859 NULL
29860 },
29861 FALSE
29862};
29863
29864static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_IN_ARG_netfn =
29865{
29866 {
29867 -1,
29868 (gchar *) "netfn",
29869 (gchar *) "y",
29870 NULL
29871 },
29872 FALSE
29873};
29874
29875static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_IN_ARG_cmd =
29876{
29877 {
29878 -1,
29879 (gchar *) "cmd",
29880 (gchar *) "y",
29881 NULL
29882 },
29883 FALSE
29884};
29885
29886static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_IN_ARG_data =
29887{
29888 {
29889 -1,
29890 (gchar *) "data",
29891 (gchar *) "ay",
29892 NULL
29893 },
29894 FALSE
29895};
29896
29897static const _ExtendedGDBusArgInfo * const _host_ipmi_method_info_send_message_IN_ARG_pointers[] =
29898{
29899 &_host_ipmi_method_info_send_message_IN_ARG_seq,
29900 &_host_ipmi_method_info_send_message_IN_ARG_netfn,
29901 &_host_ipmi_method_info_send_message_IN_ARG_cmd,
29902 &_host_ipmi_method_info_send_message_IN_ARG_data,
29903 NULL
29904};
29905
29906static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_OUT_ARG_unnamed_arg4 =
29907{
29908 {
29909 -1,
29910 (gchar *) "unnamed_arg4",
29911 (gchar *) "x",
29912 NULL
29913 },
29914 FALSE
29915};
29916
29917static const _ExtendedGDBusArgInfo * const _host_ipmi_method_info_send_message_OUT_ARG_pointers[] =
29918{
29919 &_host_ipmi_method_info_send_message_OUT_ARG_unnamed_arg4,
29920 NULL
29921};
29922
29923static const _ExtendedGDBusMethodInfo _host_ipmi_method_info_send_message =
29924{
29925 {
29926 -1,
29927 (gchar *) "sendMessage",
29928 (GDBusArgInfo **) &_host_ipmi_method_info_send_message_IN_ARG_pointers,
29929 (GDBusArgInfo **) &_host_ipmi_method_info_send_message_OUT_ARG_pointers,
29930 NULL
29931 },
29932 "handle-send-message",
29933 FALSE
29934};
29935
29936static const _ExtendedGDBusMethodInfo * const _host_ipmi_method_info_pointers[] =
29937{
29938 &_host_ipmi_method_info_send_message,
29939 NULL
29940};
29941
29942static const _ExtendedGDBusArgInfo _host_ipmi_signal_info_received_message_ARG_seq =
29943{
29944 {
29945 -1,
29946 (gchar *) "seq",
29947 (gchar *) "y",
29948 NULL
29949 },
29950 FALSE
29951};
29952
29953static const _ExtendedGDBusArgInfo _host_ipmi_signal_info_received_message_ARG_netfn =
29954{
29955 {
29956 -1,
29957 (gchar *) "netfn",
29958 (gchar *) "y",
29959 NULL
29960 },
29961 FALSE
29962};
29963
29964static const _ExtendedGDBusArgInfo _host_ipmi_signal_info_received_message_ARG_cmd =
29965{
29966 {
29967 -1,
29968 (gchar *) "cmd",
29969 (gchar *) "y",
29970 NULL
29971 },
29972 FALSE
29973};
29974
29975static const _ExtendedGDBusArgInfo _host_ipmi_signal_info_received_message_ARG_data =
29976{
29977 {
29978 -1,
29979 (gchar *) "data",
29980 (gchar *) "ay",
29981 NULL
29982 },
29983 FALSE
29984};
29985
29986static const _ExtendedGDBusArgInfo * const _host_ipmi_signal_info_received_message_ARG_pointers[] =
29987{
29988 &_host_ipmi_signal_info_received_message_ARG_seq,
29989 &_host_ipmi_signal_info_received_message_ARG_netfn,
29990 &_host_ipmi_signal_info_received_message_ARG_cmd,
29991 &_host_ipmi_signal_info_received_message_ARG_data,
29992 NULL
29993};
29994
29995static const _ExtendedGDBusSignalInfo _host_ipmi_signal_info_received_message =
29996{
29997 {
29998 -1,
29999 (gchar *) "ReceivedMessage",
30000 (GDBusArgInfo **) &_host_ipmi_signal_info_received_message_ARG_pointers,
30001 NULL
30002 },
30003 "received-message"
30004};
30005
30006static const _ExtendedGDBusSignalInfo * const _host_ipmi_signal_info_pointers[] =
30007{
30008 &_host_ipmi_signal_info_received_message,
30009 NULL
30010};
30011
30012static const _ExtendedGDBusInterfaceInfo _host_ipmi_interface_info =
30013{
30014 {
30015 -1,
30016 (gchar *) "org.openbmc.HostIpmi",
30017 (GDBusMethodInfo **) &_host_ipmi_method_info_pointers,
30018 (GDBusSignalInfo **) &_host_ipmi_signal_info_pointers,
30019 NULL,
30020 NULL
30021 },
30022 "host-ipmi",
30023};
30024
30025
30026/**
30027 * host_ipmi_interface_info:
30028 *
30029 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link> D-Bus interface.
30030 *
30031 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
30032 */
30033GDBusInterfaceInfo *
30034host_ipmi_interface_info (void)
30035{
30036 return (GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct;
30037}
30038
30039/**
30040 * host_ipmi_override_properties:
30041 * @klass: The class structure for a #GObject<!-- -->-derived class.
30042 * @property_id_begin: The property id to assign to the first overridden property.
30043 *
30044 * Overrides all #GObject properties in the #HostIpmi interface for a concrete class.
30045 * The properties are overridden in the order they are defined.
30046 *
30047 * Returns: The last property id.
30048 */
30049guint
30050host_ipmi_override_properties (GObjectClass *klass, guint property_id_begin)
30051{
30052 return property_id_begin - 1;
30053}
30054
30055
30056
30057/**
30058 * HostIpmi:
30059 *
30060 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link>.
30061 */
30062
30063/**
30064 * HostIpmiIface:
30065 * @parent_iface: The parent interface.
30066 * @handle_send_message: Handler for the #HostIpmi::handle-send-message signal.
30067 * @received_message: Handler for the #HostIpmi::received-message signal.
30068 *
30069 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link>.
30070 */
30071
30072typedef HostIpmiIface HostIpmiInterface;
30073G_DEFINE_INTERFACE (HostIpmi, host_ipmi, G_TYPE_OBJECT);
30074
30075static void
30076host_ipmi_default_init (HostIpmiIface *iface)
30077{
30078 /* GObject signals for incoming D-Bus method calls: */
30079 /**
30080 * HostIpmi::handle-send-message:
30081 * @object: A #HostIpmi.
30082 * @invocation: A #GDBusMethodInvocation.
30083 * @arg_seq: Argument passed by remote caller.
30084 * @arg_netfn: Argument passed by remote caller.
30085 * @arg_cmd: Argument passed by remote caller.
30086 * @arg_data: Argument passed by remote caller.
30087 *
30088 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-HostIpmi.sendMessage">sendMessage()</link> D-Bus method.
30089 *
30090 * 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.
30091 *
30092 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
30093 */
30094 g_signal_new ("handle-send-message",
30095 G_TYPE_FROM_INTERFACE (iface),
30096 G_SIGNAL_RUN_LAST,
30097 G_STRUCT_OFFSET (HostIpmiIface, handle_send_message),
30098 g_signal_accumulator_true_handled,
30099 NULL,
30100 g_cclosure_marshal_generic,
30101 G_TYPE_BOOLEAN,
30102 5,
30103 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_UCHAR, G_TYPE_UCHAR, G_TYPE_UCHAR, G_TYPE_STRING);
30104
30105 /* GObject signals for received D-Bus signals: */
30106 /**
30107 * HostIpmi::received-message:
30108 * @object: A #HostIpmi.
30109 * @arg_seq: Argument.
30110 * @arg_netfn: Argument.
30111 * @arg_cmd: Argument.
30112 * @arg_data: Argument.
30113 *
30114 * 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.
30115 *
30116 * 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.
30117 */
30118 g_signal_new ("received-message",
30119 G_TYPE_FROM_INTERFACE (iface),
30120 G_SIGNAL_RUN_LAST,
30121 G_STRUCT_OFFSET (HostIpmiIface, received_message),
30122 NULL,
30123 NULL,
30124 g_cclosure_marshal_generic,
30125 G_TYPE_NONE,
30126 4, G_TYPE_UCHAR, G_TYPE_UCHAR, G_TYPE_UCHAR, G_TYPE_STRING);
30127
30128}
30129
30130/**
30131 * host_ipmi_emit_received_message:
30132 * @object: A #HostIpmi.
30133 * @arg_seq: Argument to pass with the signal.
30134 * @arg_netfn: Argument to pass with the signal.
30135 * @arg_cmd: Argument to pass with the signal.
30136 * @arg_data: Argument to pass with the signal.
30137 *
30138 * Emits the <link linkend="gdbus-signal-org-openbmc-HostIpmi.ReceivedMessage">"ReceivedMessage"</link> D-Bus signal.
30139 */
30140void
30141host_ipmi_emit_received_message (
30142 HostIpmi *object,
30143 guchar arg_seq,
30144 guchar arg_netfn,
30145 guchar arg_cmd,
30146 const gchar *arg_data)
30147{
30148 g_signal_emit_by_name (object, "received-message", arg_seq, arg_netfn, arg_cmd, arg_data);
30149}
30150
30151/**
30152 * host_ipmi_call_send_message:
30153 * @proxy: A #HostIpmiProxy.
30154 * @arg_seq: Argument to pass with the method invocation.
30155 * @arg_netfn: Argument to pass with the method invocation.
30156 * @arg_cmd: Argument to pass with the method invocation.
30157 * @arg_data: Argument to pass with the method invocation.
30158 * @cancellable: (allow-none): A #GCancellable or %NULL.
30159 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
30160 * @user_data: User data to pass to @callback.
30161 *
30162 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-HostIpmi.sendMessage">sendMessage()</link> D-Bus method on @proxy.
30163 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
30164 * You can then call host_ipmi_call_send_message_finish() to get the result of the operation.
30165 *
30166 * See host_ipmi_call_send_message_sync() for the synchronous, blocking version of this method.
30167 */
30168void
30169host_ipmi_call_send_message (
30170 HostIpmi *proxy,
30171 guchar arg_seq,
30172 guchar arg_netfn,
30173 guchar arg_cmd,
30174 const gchar *arg_data,
30175 GCancellable *cancellable,
30176 GAsyncReadyCallback callback,
30177 gpointer user_data)
30178{
30179 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
30180 "sendMessage",
30181 g_variant_new ("(yyy^ay)",
30182 arg_seq,
30183 arg_netfn,
30184 arg_cmd,
30185 arg_data),
30186 G_DBUS_CALL_FLAGS_NONE,
30187 -1,
30188 cancellable,
30189 callback,
30190 user_data);
30191}
30192
30193/**
30194 * host_ipmi_call_send_message_finish:
30195 * @proxy: A #HostIpmiProxy.
30196 * @out_unnamed_arg4: (out): Return location for return parameter or %NULL to ignore.
30197 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to host_ipmi_call_send_message().
30198 * @error: Return location for error or %NULL.
30199 *
30200 * Finishes an operation started with host_ipmi_call_send_message().
30201 *
30202 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
30203 */
30204gboolean
30205host_ipmi_call_send_message_finish (
30206 HostIpmi *proxy,
30207 gint64 *out_unnamed_arg4,
30208 GAsyncResult *res,
30209 GError **error)
30210{
30211 GVariant *_ret;
30212 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
30213 if (_ret == NULL)
30214 goto _out;
30215 g_variant_get (_ret,
30216 "(x)",
30217 out_unnamed_arg4);
30218 g_variant_unref (_ret);
30219_out:
30220 return _ret != NULL;
30221}
30222
30223/**
30224 * host_ipmi_call_send_message_sync:
30225 * @proxy: A #HostIpmiProxy.
30226 * @arg_seq: Argument to pass with the method invocation.
30227 * @arg_netfn: Argument to pass with the method invocation.
30228 * @arg_cmd: Argument to pass with the method invocation.
30229 * @arg_data: Argument to pass with the method invocation.
30230 * @out_unnamed_arg4: (out): Return location for return parameter or %NULL to ignore.
30231 * @cancellable: (allow-none): A #GCancellable or %NULL.
30232 * @error: Return location for error or %NULL.
30233 *
30234 * 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.
30235 *
30236 * See host_ipmi_call_send_message() for the asynchronous version of this method.
30237 *
30238 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
30239 */
30240gboolean
30241host_ipmi_call_send_message_sync (
30242 HostIpmi *proxy,
30243 guchar arg_seq,
30244 guchar arg_netfn,
30245 guchar arg_cmd,
30246 const gchar *arg_data,
30247 gint64 *out_unnamed_arg4,
30248 GCancellable *cancellable,
30249 GError **error)
30250{
30251 GVariant *_ret;
30252 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
30253 "sendMessage",
30254 g_variant_new ("(yyy^ay)",
30255 arg_seq,
30256 arg_netfn,
30257 arg_cmd,
30258 arg_data),
30259 G_DBUS_CALL_FLAGS_NONE,
30260 -1,
30261 cancellable,
30262 error);
30263 if (_ret == NULL)
30264 goto _out;
30265 g_variant_get (_ret,
30266 "(x)",
30267 out_unnamed_arg4);
30268 g_variant_unref (_ret);
30269_out:
30270 return _ret != NULL;
30271}
30272
30273/**
30274 * host_ipmi_complete_send_message:
30275 * @object: A #HostIpmi.
30276 * @invocation: (transfer full): A #GDBusMethodInvocation.
30277 * @unnamed_arg4: Parameter to return.
30278 *
30279 * 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.
30280 *
30281 * This method will free @invocation, you cannot use it afterwards.
30282 */
30283void
30284host_ipmi_complete_send_message (
30285 HostIpmi *object,
30286 GDBusMethodInvocation *invocation,
30287 gint64 unnamed_arg4)
30288{
30289 g_dbus_method_invocation_return_value (invocation,
30290 g_variant_new ("(x)",
30291 unnamed_arg4));
30292}
30293
30294/* ------------------------------------------------------------------------ */
30295
30296/**
30297 * HostIpmiProxy:
30298 *
30299 * The #HostIpmiProxy structure contains only private data and should only be accessed using the provided API.
30300 */
30301
30302/**
30303 * HostIpmiProxyClass:
30304 * @parent_class: The parent class.
30305 *
30306 * Class structure for #HostIpmiProxy.
30307 */
30308
30309struct _HostIpmiProxyPrivate
30310{
30311 GData *qdata;
30312};
30313
30314static void host_ipmi_proxy_iface_init (HostIpmiIface *iface);
30315
30316#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
30317G_DEFINE_TYPE_WITH_CODE (HostIpmiProxy, host_ipmi_proxy, G_TYPE_DBUS_PROXY,
30318 G_ADD_PRIVATE (HostIpmiProxy)
30319 G_IMPLEMENT_INTERFACE (TYPE_HOST_IPMI, host_ipmi_proxy_iface_init));
30320
30321#else
30322G_DEFINE_TYPE_WITH_CODE (HostIpmiProxy, host_ipmi_proxy, G_TYPE_DBUS_PROXY,
30323 G_IMPLEMENT_INTERFACE (TYPE_HOST_IPMI, host_ipmi_proxy_iface_init));
30324
30325#endif
30326static void
30327host_ipmi_proxy_finalize (GObject *object)
30328{
30329 HostIpmiProxy *proxy = HOST_IPMI_PROXY (object);
30330 g_datalist_clear (&proxy->priv->qdata);
30331 G_OBJECT_CLASS (host_ipmi_proxy_parent_class)->finalize (object);
30332}
30333
30334static void
30335host_ipmi_proxy_get_property (GObject *object,
30336 guint prop_id,
30337 GValue *value,
30338 GParamSpec *pspec G_GNUC_UNUSED)
30339{
30340}
30341
30342static void
30343host_ipmi_proxy_set_property (GObject *object,
30344 guint prop_id,
30345 const GValue *value,
30346 GParamSpec *pspec G_GNUC_UNUSED)
30347{
30348}
30349
30350static void
30351host_ipmi_proxy_g_signal (GDBusProxy *proxy,
30352 const gchar *sender_name G_GNUC_UNUSED,
30353 const gchar *signal_name,
30354 GVariant *parameters)
30355{
30356 _ExtendedGDBusSignalInfo *info;
30357 GVariantIter iter;
30358 GVariant *child;
30359 GValue *paramv;
30360 guint num_params;
30361 guint n;
30362 guint signal_id;
30363 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, signal_name);
30364 if (info == NULL)
30365 return;
30366 num_params = g_variant_n_children (parameters);
30367 paramv = g_new0 (GValue, num_params + 1);
30368 g_value_init (&paramv[0], TYPE_HOST_IPMI);
30369 g_value_set_object (&paramv[0], proxy);
30370 g_variant_iter_init (&iter, parameters);
30371 n = 1;
30372 while ((child = g_variant_iter_next_value (&iter)) != NULL)
30373 {
30374 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
30375 if (arg_info->use_gvariant)
30376 {
30377 g_value_init (&paramv[n], G_TYPE_VARIANT);
30378 g_value_set_variant (&paramv[n], child);
30379 n++;
30380 }
30381 else
30382 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
30383 g_variant_unref (child);
30384 }
30385 signal_id = g_signal_lookup (info->signal_name, TYPE_HOST_IPMI);
30386 g_signal_emitv (paramv, signal_id, 0, NULL);
30387 for (n = 0; n < num_params + 1; n++)
30388 g_value_unset (&paramv[n]);
30389 g_free (paramv);
30390}
30391
30392static void
30393host_ipmi_proxy_g_properties_changed (GDBusProxy *_proxy,
30394 GVariant *changed_properties,
30395 const gchar *const *invalidated_properties)
30396{
30397 HostIpmiProxy *proxy = HOST_IPMI_PROXY (_proxy);
30398 guint n;
30399 const gchar *key;
30400 GVariantIter *iter;
30401 _ExtendedGDBusPropertyInfo *info;
30402 g_variant_get (changed_properties, "a{sv}", &iter);
30403 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
30404 {
30405 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, key);
30406 g_datalist_remove_data (&proxy->priv->qdata, key);
30407 if (info != NULL)
30408 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
30409 }
30410 g_variant_iter_free (iter);
30411 for (n = 0; invalidated_properties[n] != NULL; n++)
30412 {
30413 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, invalidated_properties[n]);
30414 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
30415 if (info != NULL)
30416 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
30417 }
30418}
30419
30420static void
30421host_ipmi_proxy_init (HostIpmiProxy *proxy)
30422{
30423#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
30424 proxy->priv = host_ipmi_proxy_get_instance_private (proxy);
30425#else
30426 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_HOST_IPMI_PROXY, HostIpmiProxyPrivate);
30427#endif
30428
30429 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), host_ipmi_interface_info ());
30430}
30431
30432static void
30433host_ipmi_proxy_class_init (HostIpmiProxyClass *klass)
30434{
30435 GObjectClass *gobject_class;
30436 GDBusProxyClass *proxy_class;
30437
30438 gobject_class = G_OBJECT_CLASS (klass);
30439 gobject_class->finalize = host_ipmi_proxy_finalize;
30440 gobject_class->get_property = host_ipmi_proxy_get_property;
30441 gobject_class->set_property = host_ipmi_proxy_set_property;
30442
30443 proxy_class = G_DBUS_PROXY_CLASS (klass);
30444 proxy_class->g_signal = host_ipmi_proxy_g_signal;
30445 proxy_class->g_properties_changed = host_ipmi_proxy_g_properties_changed;
30446
30447#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
30448 g_type_class_add_private (klass, sizeof (HostIpmiProxyPrivate));
30449#endif
30450}
30451
30452static void
30453host_ipmi_proxy_iface_init (HostIpmiIface *iface)
30454{
30455}
30456
30457/**
30458 * host_ipmi_proxy_new:
30459 * @connection: A #GDBusConnection.
30460 * @flags: Flags from the #GDBusProxyFlags enumeration.
30461 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
30462 * @object_path: An object path.
30463 * @cancellable: (allow-none): A #GCancellable or %NULL.
30464 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
30465 * @user_data: User data to pass to @callback.
30466 *
30467 * 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.
30468 *
30469 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
30470 * You can then call host_ipmi_proxy_new_finish() to get the result of the operation.
30471 *
30472 * See host_ipmi_proxy_new_sync() for the synchronous, blocking version of this constructor.
30473 */
30474void
30475host_ipmi_proxy_new (
30476 GDBusConnection *connection,
30477 GDBusProxyFlags flags,
30478 const gchar *name,
30479 const gchar *object_path,
30480 GCancellable *cancellable,
30481 GAsyncReadyCallback callback,
30482 gpointer user_data)
30483{
30484 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);
30485}
30486
30487/**
30488 * host_ipmi_proxy_new_finish:
30489 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to host_ipmi_proxy_new().
30490 * @error: Return location for error or %NULL
30491 *
30492 * Finishes an operation started with host_ipmi_proxy_new().
30493 *
30494 * Returns: (transfer full) (type HostIpmiProxy): The constructed proxy object or %NULL if @error is set.
30495 */
30496HostIpmi *
30497host_ipmi_proxy_new_finish (
30498 GAsyncResult *res,
30499 GError **error)
30500{
30501 GObject *ret;
30502 GObject *source_object;
30503 source_object = g_async_result_get_source_object (res);
30504 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
30505 g_object_unref (source_object);
30506 if (ret != NULL)
30507 return HOST_IPMI (ret);
30508 else
30509 return NULL;
30510}
30511
30512/**
30513 * host_ipmi_proxy_new_sync:
30514 * @connection: A #GDBusConnection.
30515 * @flags: Flags from the #GDBusProxyFlags enumeration.
30516 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
30517 * @object_path: An object path.
30518 * @cancellable: (allow-none): A #GCancellable or %NULL.
30519 * @error: Return location for error or %NULL
30520 *
30521 * 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.
30522 *
30523 * The calling thread is blocked until a reply is received.
30524 *
30525 * See host_ipmi_proxy_new() for the asynchronous version of this constructor.
30526 *
30527 * Returns: (transfer full) (type HostIpmiProxy): The constructed proxy object or %NULL if @error is set.
30528 */
30529HostIpmi *
30530host_ipmi_proxy_new_sync (
30531 GDBusConnection *connection,
30532 GDBusProxyFlags flags,
30533 const gchar *name,
30534 const gchar *object_path,
30535 GCancellable *cancellable,
30536 GError **error)
30537{
30538 GInitable *ret;
30539 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);
30540 if (ret != NULL)
30541 return HOST_IPMI (ret);
30542 else
30543 return NULL;
30544}
30545
30546
30547/**
30548 * host_ipmi_proxy_new_for_bus:
30549 * @bus_type: A #GBusType.
30550 * @flags: Flags from the #GDBusProxyFlags enumeration.
30551 * @name: A bus name (well-known or unique).
30552 * @object_path: An object path.
30553 * @cancellable: (allow-none): A #GCancellable or %NULL.
30554 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
30555 * @user_data: User data to pass to @callback.
30556 *
30557 * Like host_ipmi_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
30558 *
30559 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
30560 * You can then call host_ipmi_proxy_new_for_bus_finish() to get the result of the operation.
30561 *
30562 * See host_ipmi_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
30563 */
30564void
30565host_ipmi_proxy_new_for_bus (
30566 GBusType bus_type,
30567 GDBusProxyFlags flags,
30568 const gchar *name,
30569 const gchar *object_path,
30570 GCancellable *cancellable,
30571 GAsyncReadyCallback callback,
30572 gpointer user_data)
30573{
30574 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);
30575}
30576
30577/**
30578 * host_ipmi_proxy_new_for_bus_finish:
30579 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to host_ipmi_proxy_new_for_bus().
30580 * @error: Return location for error or %NULL
30581 *
30582 * Finishes an operation started with host_ipmi_proxy_new_for_bus().
30583 *
30584 * Returns: (transfer full) (type HostIpmiProxy): The constructed proxy object or %NULL if @error is set.
30585 */
30586HostIpmi *
30587host_ipmi_proxy_new_for_bus_finish (
30588 GAsyncResult *res,
30589 GError **error)
30590{
30591 GObject *ret;
30592 GObject *source_object;
30593 source_object = g_async_result_get_source_object (res);
30594 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
30595 g_object_unref (source_object);
30596 if (ret != NULL)
30597 return HOST_IPMI (ret);
30598 else
30599 return NULL;
30600}
30601
30602/**
30603 * host_ipmi_proxy_new_for_bus_sync:
30604 * @bus_type: A #GBusType.
30605 * @flags: Flags from the #GDBusProxyFlags enumeration.
30606 * @name: A bus name (well-known or unique).
30607 * @object_path: An object path.
30608 * @cancellable: (allow-none): A #GCancellable or %NULL.
30609 * @error: Return location for error or %NULL
30610 *
30611 * Like host_ipmi_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
30612 *
30613 * The calling thread is blocked until a reply is received.
30614 *
30615 * See host_ipmi_proxy_new_for_bus() for the asynchronous version of this constructor.
30616 *
30617 * Returns: (transfer full) (type HostIpmiProxy): The constructed proxy object or %NULL if @error is set.
30618 */
30619HostIpmi *
30620host_ipmi_proxy_new_for_bus_sync (
30621 GBusType bus_type,
30622 GDBusProxyFlags flags,
30623 const gchar *name,
30624 const gchar *object_path,
30625 GCancellable *cancellable,
30626 GError **error)
30627{
30628 GInitable *ret;
30629 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);
30630 if (ret != NULL)
30631 return HOST_IPMI (ret);
30632 else
30633 return NULL;
30634}
30635
30636
30637/* ------------------------------------------------------------------------ */
30638
30639/**
30640 * HostIpmiSkeleton:
30641 *
30642 * The #HostIpmiSkeleton structure contains only private data and should only be accessed using the provided API.
30643 */
30644
30645/**
30646 * HostIpmiSkeletonClass:
30647 * @parent_class: The parent class.
30648 *
30649 * Class structure for #HostIpmiSkeleton.
30650 */
30651
30652struct _HostIpmiSkeletonPrivate
30653{
30654 GValue *properties;
30655 GList *changed_properties;
30656 GSource *changed_properties_idle_source;
30657 GMainContext *context;
30658 GMutex lock;
30659};
30660
30661static void
30662_host_ipmi_skeleton_handle_method_call (
30663 GDBusConnection *connection G_GNUC_UNUSED,
30664 const gchar *sender G_GNUC_UNUSED,
30665 const gchar *object_path G_GNUC_UNUSED,
30666 const gchar *interface_name,
30667 const gchar *method_name,
30668 GVariant *parameters,
30669 GDBusMethodInvocation *invocation,
30670 gpointer user_data)
30671{
30672 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (user_data);
30673 _ExtendedGDBusMethodInfo *info;
30674 GVariantIter iter;
30675 GVariant *child;
30676 GValue *paramv;
30677 guint num_params;
30678 guint num_extra;
30679 guint n;
30680 guint signal_id;
30681 GValue return_value = G_VALUE_INIT;
30682 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
30683 g_assert (info != NULL);
30684 num_params = g_variant_n_children (parameters);
30685 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
30686 n = 0;
30687 g_value_init (&paramv[n], TYPE_HOST_IPMI);
30688 g_value_set_object (&paramv[n++], skeleton);
30689 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
30690 g_value_set_object (&paramv[n++], invocation);
30691 if (info->pass_fdlist)
30692 {
30693#ifdef G_OS_UNIX
30694 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
30695 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
30696#else
30697 g_assert_not_reached ();
30698#endif
30699 }
30700 g_variant_iter_init (&iter, parameters);
30701 while ((child = g_variant_iter_next_value (&iter)) != NULL)
30702 {
30703 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
30704 if (arg_info->use_gvariant)
30705 {
30706 g_value_init (&paramv[n], G_TYPE_VARIANT);
30707 g_value_set_variant (&paramv[n], child);
30708 n++;
30709 }
30710 else
30711 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
30712 g_variant_unref (child);
30713 }
30714 signal_id = g_signal_lookup (info->signal_name, TYPE_HOST_IPMI);
30715 g_value_init (&return_value, G_TYPE_BOOLEAN);
30716 g_signal_emitv (paramv, signal_id, 0, &return_value);
30717 if (!g_value_get_boolean (&return_value))
30718 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);
30719 g_value_unset (&return_value);
30720 for (n = 0; n < num_params + num_extra; n++)
30721 g_value_unset (&paramv[n]);
30722 g_free (paramv);
30723}
30724
30725static GVariant *
30726_host_ipmi_skeleton_handle_get_property (
30727 GDBusConnection *connection G_GNUC_UNUSED,
30728 const gchar *sender G_GNUC_UNUSED,
30729 const gchar *object_path G_GNUC_UNUSED,
30730 const gchar *interface_name G_GNUC_UNUSED,
30731 const gchar *property_name,
30732 GError **error,
30733 gpointer user_data)
30734{
30735 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (user_data);
30736 GValue value = G_VALUE_INIT;
30737 GParamSpec *pspec;
30738 _ExtendedGDBusPropertyInfo *info;
30739 GVariant *ret;
30740 ret = NULL;
30741 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, property_name);
30742 g_assert (info != NULL);
30743 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
30744 if (pspec == NULL)
30745 {
30746 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
30747 }
30748 else
30749 {
30750 g_value_init (&value, pspec->value_type);
30751 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
30752 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
30753 g_value_unset (&value);
30754 }
30755 return ret;
30756}
30757
30758static gboolean
30759_host_ipmi_skeleton_handle_set_property (
30760 GDBusConnection *connection G_GNUC_UNUSED,
30761 const gchar *sender G_GNUC_UNUSED,
30762 const gchar *object_path G_GNUC_UNUSED,
30763 const gchar *interface_name G_GNUC_UNUSED,
30764 const gchar *property_name,
30765 GVariant *variant,
30766 GError **error,
30767 gpointer user_data)
30768{
30769 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (user_data);
30770 GValue value = G_VALUE_INIT;
30771 GParamSpec *pspec;
30772 _ExtendedGDBusPropertyInfo *info;
30773 gboolean ret;
30774 ret = FALSE;
30775 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, property_name);
30776 g_assert (info != NULL);
30777 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
30778 if (pspec == NULL)
30779 {
30780 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
30781 }
30782 else
30783 {
30784 if (info->use_gvariant)
30785 g_value_set_variant (&value, variant);
30786 else
30787 g_dbus_gvariant_to_gvalue (variant, &value);
30788 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
30789 g_value_unset (&value);
30790 ret = TRUE;
30791 }
30792 return ret;
30793}
30794
30795static const GDBusInterfaceVTable _host_ipmi_skeleton_vtable =
30796{
30797 _host_ipmi_skeleton_handle_method_call,
30798 _host_ipmi_skeleton_handle_get_property,
30799 _host_ipmi_skeleton_handle_set_property,
30800 {NULL}
30801};
30802
30803static GDBusInterfaceInfo *
30804host_ipmi_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
30805{
30806 return host_ipmi_interface_info ();
30807}
30808
30809static GDBusInterfaceVTable *
30810host_ipmi_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
30811{
30812 return (GDBusInterfaceVTable *) &_host_ipmi_skeleton_vtable;
30813}
30814
30815static GVariant *
30816host_ipmi_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
30817{
30818 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (_skeleton);
30819
30820 GVariantBuilder builder;
30821 guint n;
30822 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
30823 if (_host_ipmi_interface_info.parent_struct.properties == NULL)
30824 goto out;
30825 for (n = 0; _host_ipmi_interface_info.parent_struct.properties[n] != NULL; n++)
30826 {
30827 GDBusPropertyInfo *info = _host_ipmi_interface_info.parent_struct.properties[n];
30828 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
30829 {
30830 GVariant *value;
30831 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);
30832 if (value != NULL)
30833 {
30834 g_variant_take_ref (value);
30835 g_variant_builder_add (&builder, "{sv}", info->name, value);
30836 g_variant_unref (value);
30837 }
30838 }
30839 }
30840out:
30841 return g_variant_builder_end (&builder);
30842}
30843
30844static void
30845host_ipmi_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
30846{
30847}
30848
30849static void
30850_host_ipmi_on_signal_received_message (
30851 HostIpmi *object,
30852 guchar arg_seq,
30853 guchar arg_netfn,
30854 guchar arg_cmd,
30855 const gchar *arg_data)
30856{
30857 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (object);
30858
30859 GList *connections, *l;
30860 GVariant *signal_variant;
30861 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
30862
30863 signal_variant = g_variant_ref_sink (g_variant_new ("(yyy^ay)",
30864 arg_seq,
30865 arg_netfn,
30866 arg_cmd,
30867 arg_data));
30868 for (l = connections; l != NULL; l = l->next)
30869 {
30870 GDBusConnection *connection = l->data;
30871 g_dbus_connection_emit_signal (connection,
30872 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.HostIpmi", "ReceivedMessage",
30873 signal_variant, NULL);
30874 }
30875 g_variant_unref (signal_variant);
30876 g_list_free_full (connections, g_object_unref);
30877}
30878
30879static void host_ipmi_skeleton_iface_init (HostIpmiIface *iface);
30880#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
30881G_DEFINE_TYPE_WITH_CODE (HostIpmiSkeleton, host_ipmi_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
30882 G_ADD_PRIVATE (HostIpmiSkeleton)
30883 G_IMPLEMENT_INTERFACE (TYPE_HOST_IPMI, host_ipmi_skeleton_iface_init));
30884
30885#else
30886G_DEFINE_TYPE_WITH_CODE (HostIpmiSkeleton, host_ipmi_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
30887 G_IMPLEMENT_INTERFACE (TYPE_HOST_IPMI, host_ipmi_skeleton_iface_init));
30888
30889#endif
30890static void
30891host_ipmi_skeleton_finalize (GObject *object)
30892{
30893 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (object);
30894 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
30895 if (skeleton->priv->changed_properties_idle_source != NULL)
30896 g_source_destroy (skeleton->priv->changed_properties_idle_source);
30897 g_main_context_unref (skeleton->priv->context);
30898 g_mutex_clear (&skeleton->priv->lock);
30899 G_OBJECT_CLASS (host_ipmi_skeleton_parent_class)->finalize (object);
30900}
30901
30902static void
30903host_ipmi_skeleton_init (HostIpmiSkeleton *skeleton)
30904{
30905#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
30906 skeleton->priv = host_ipmi_skeleton_get_instance_private (skeleton);
30907#else
30908 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_HOST_IPMI_SKELETON, HostIpmiSkeletonPrivate);
30909#endif
30910
30911 g_mutex_init (&skeleton->priv->lock);
30912 skeleton->priv->context = g_main_context_ref_thread_default ();
30913}
30914
30915static void
30916host_ipmi_skeleton_class_init (HostIpmiSkeletonClass *klass)
30917{
30918 GObjectClass *gobject_class;
30919 GDBusInterfaceSkeletonClass *skeleton_class;
30920
30921 gobject_class = G_OBJECT_CLASS (klass);
30922 gobject_class->finalize = host_ipmi_skeleton_finalize;
30923
30924 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
30925 skeleton_class->get_info = host_ipmi_skeleton_dbus_interface_get_info;
30926 skeleton_class->get_properties = host_ipmi_skeleton_dbus_interface_get_properties;
30927 skeleton_class->flush = host_ipmi_skeleton_dbus_interface_flush;
30928 skeleton_class->get_vtable = host_ipmi_skeleton_dbus_interface_get_vtable;
30929
30930#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
30931 g_type_class_add_private (klass, sizeof (HostIpmiSkeletonPrivate));
30932#endif
30933}
30934
30935static void
30936host_ipmi_skeleton_iface_init (HostIpmiIface *iface)
30937{
30938 iface->received_message = _host_ipmi_on_signal_received_message;
30939}
30940
30941/**
30942 * host_ipmi_skeleton_new:
30943 *
30944 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link>.
30945 *
30946 * Returns: (transfer full) (type HostIpmiSkeleton): The skeleton object.
30947 */
30948HostIpmi *
30949host_ipmi_skeleton_new (void)
30950{
30951 return HOST_IPMI (g_object_new (TYPE_HOST_IPMI_SKELETON, NULL));
30952}
30953
30954/* ------------------------------------------------------------------------
Norman James362a80f2015-09-14 14:04:39 -050030955 * Code for Object, ObjectProxy and ObjectSkeleton
30956 * ------------------------------------------------------------------------
30957 */
30958
30959/**
30960 * SECTION:Object
30961 * @title: Object
30962 * @short_description: Specialized GDBusObject types
30963 *
30964 * This section contains the #Object, #ObjectProxy, and #ObjectSkeleton types which make it easier to work with objects implementing generated types for D-Bus interfaces.
30965 */
30966
30967/**
30968 * Object:
30969 *
30970 * The #Object type is a specialized container of interfaces.
30971 */
30972
30973/**
30974 * ObjectIface:
30975 * @parent_iface: The parent interface.
30976 *
30977 * Virtual table for the #Object interface.
30978 */
30979
30980typedef ObjectIface ObjectInterface;
30981G_DEFINE_INTERFACE_WITH_CODE (Object, object, G_TYPE_OBJECT, g_type_interface_add_prerequisite (g_define_type_id, G_TYPE_DBUS_OBJECT));
30982
30983static void
30984object_default_init (ObjectIface *iface)
30985{
30986 /**
Norman James493996c2015-10-31 17:27:13 -050030987 * Object:object-mapper:
30988 *
30989 * 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.
30990 *
30991 * Connect to the #GObject::notify signal to get informed of property changes.
30992 */
30993 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));
30994
30995 /**
Norman James5236a8f2015-11-05 20:39:31 -060030996 * Object:hwmon:
30997 *
30998 * 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.
30999 *
31000 * Connect to the #GObject::notify signal to get informed of property changes.
31001 */
31002 g_object_interface_install_property (iface, g_param_spec_object ("hwmon", "hwmon", "hwmon", TYPE_HWMON, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
31003
31004 /**
Norman James362a80f2015-09-14 14:04:39 -050031005 * Object:fan:
31006 *
31007 * 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.
31008 *
31009 * Connect to the #GObject::notify signal to get informed of property changes.
31010 */
31011 g_object_interface_install_property (iface, g_param_spec_object ("fan", "fan", "fan", TYPE_FAN, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
31012
31013 /**
31014 * Object:sensor-value:
31015 *
31016 * 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.
31017 *
31018 * Connect to the #GObject::notify signal to get informed of property changes.
31019 */
31020 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));
31021
31022 /**
31023 * Object:sensor-threshold:
31024 *
31025 * 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.
31026 *
31027 * Connect to the #GObject::notify signal to get informed of property changes.
31028 */
31029 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));
31030
31031 /**
31032 * Object:sensor-i2c:
31033 *
31034 * 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.
31035 *
31036 * Connect to the #GObject::notify signal to get informed of property changes.
31037 */
31038 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));
31039
31040 /**
31041 * Object:sensor-match:
31042 *
31043 * 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.
31044 *
31045 * Connect to the #GObject::notify signal to get informed of property changes.
31046 */
31047 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));
31048
31049 /**
31050 * Object:process:
31051 *
31052 * 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.
31053 *
31054 * Connect to the #GObject::notify signal to get informed of property changes.
31055 */
31056 g_object_interface_install_property (iface, g_param_spec_object ("process", "process", "process", TYPE_PROCESS, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
31057
31058 /**
Norman James18998182015-10-11 21:54:53 -050031059 * Object:shared-resource:
31060 *
31061 * 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.
31062 *
31063 * Connect to the #GObject::notify signal to get informed of property changes.
31064 */
31065 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));
31066
31067 /**
Norman James362a80f2015-09-14 14:04:39 -050031068 * Object:control:
31069 *
31070 * 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.
31071 *
31072 * Connect to the #GObject::notify signal to get informed of property changes.
31073 */
31074 g_object_interface_install_property (iface, g_param_spec_object ("control", "control", "control", TYPE_CONTROL, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
31075
31076 /**
31077 * Object:control-bmc:
31078 *
31079 * 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.
31080 *
31081 * Connect to the #GObject::notify signal to get informed of property changes.
31082 */
31083 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));
31084
31085 /**
31086 * Object:control-host:
31087 *
31088 * 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.
31089 *
31090 * Connect to the #GObject::notify signal to get informed of property changes.
31091 */
31092 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));
31093
31094 /**
31095 * Object:control-power:
31096 *
31097 * 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.
31098 *
31099 * Connect to the #GObject::notify signal to get informed of property changes.
31100 */
31101 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));
31102
31103 /**
Adriana Kobylakfd778822016-06-16 09:08:37 -050031104 * Object:control-checkstop:
31105 *
31106 * The #ControlCheckstop instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Checkstop.top_of_page">org.openbmc.control.Checkstop</link>, if any.
31107 *
31108 * Connect to the #GObject::notify signal to get informed of property changes.
31109 */
31110 g_object_interface_install_property (iface, g_param_spec_object ("control-checkstop", "control-checkstop", "control-checkstop", TYPE_CONTROL_CHECKSTOP, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
31111
31112 /**
Norman James362a80f2015-09-14 14:04:39 -050031113 * Object:watchdog:
31114 *
31115 * 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.
31116 *
31117 * Connect to the #GObject::notify signal to get informed of property changes.
31118 */
31119 g_object_interface_install_property (iface, g_param_spec_object ("watchdog", "watchdog", "watchdog", TYPE_WATCHDOG, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
31120
31121 /**
31122 * Object:event-log:
31123 *
31124 * 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.
31125 *
31126 * Connect to the #GObject::notify signal to get informed of property changes.
31127 */
31128 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));
31129
31130 /**
31131 * Object:flash:
31132 *
31133 * 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.
31134 *
31135 * Connect to the #GObject::notify signal to get informed of property changes.
31136 */
31137 g_object_interface_install_property (iface, g_param_spec_object ("flash", "flash", "flash", TYPE_FLASH, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
31138
31139 /**
Norman James18998182015-10-11 21:54:53 -050031140 * Object:flash-control:
31141 *
31142 * 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.
31143 *
31144 * Connect to the #GObject::notify signal to get informed of property changes.
31145 */
31146 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));
31147
31148 /**
Norman James362a80f2015-09-14 14:04:39 -050031149 * Object:button:
31150 *
31151 * 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.
31152 *
31153 * Connect to the #GObject::notify signal to get informed of property changes.
31154 */
31155 g_object_interface_install_property (iface, g_param_spec_object ("button", "button", "button", TYPE_BUTTON, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
31156
31157 /**
31158 * Object:led:
31159 *
31160 * 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.
31161 *
31162 * Connect to the #GObject::notify signal to get informed of property changes.
31163 */
31164 g_object_interface_install_property (iface, g_param_spec_object ("led", "led", "led", TYPE_LED, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
31165
Norman Jamesdbcffbd2015-10-06 16:53:06 -050031166 /**
31167 * Object:host-ipmi:
31168 *
31169 * 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.
31170 *
31171 * Connect to the #GObject::notify signal to get informed of property changes.
31172 */
31173 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));
31174
Norman James362a80f2015-09-14 14:04:39 -050031175}
31176
31177/**
Norman James493996c2015-10-31 17:27:13 -050031178 * object_get_object_mapper:
31179 * @object: A #Object.
31180 *
31181 * 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.
31182 *
31183 * Returns: (transfer full): A #ObjectMapper that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
31184 */
31185ObjectMapper *object_get_object_mapper (Object *object)
31186{
31187 GDBusInterface *ret;
31188 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Object.Mapper");
31189 if (ret == NULL)
31190 return NULL;
31191 return OBJECT_MAPPER (ret);
31192}
31193
31194/**
Norman James5236a8f2015-11-05 20:39:31 -060031195 * object_get_hwmon:
31196 * @object: A #Object.
31197 *
31198 * 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.
31199 *
31200 * Returns: (transfer full): A #Hwmon that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
31201 */
31202Hwmon *object_get_hwmon (Object *object)
31203{
31204 GDBusInterface *ret;
31205 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Hwmon");
31206 if (ret == NULL)
31207 return NULL;
31208 return HWMON (ret);
31209}
31210
31211/**
Norman James362a80f2015-09-14 14:04:39 -050031212 * object_get_fan:
31213 * @object: A #Object.
31214 *
31215 * 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.
31216 *
31217 * Returns: (transfer full): A #Fan that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
31218 */
31219Fan *object_get_fan (Object *object)
31220{
31221 GDBusInterface *ret;
31222 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan");
31223 if (ret == NULL)
31224 return NULL;
31225 return FAN (ret);
31226}
31227
31228/**
31229 * object_get_sensor_value:
31230 * @object: A #Object.
31231 *
31232 * 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.
31233 *
31234 * Returns: (transfer full): A #SensorValue that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
31235 */
31236SensorValue *object_get_sensor_value (Object *object)
31237{
31238 GDBusInterface *ret;
31239 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue");
31240 if (ret == NULL)
31241 return NULL;
31242 return SENSOR_VALUE (ret);
31243}
31244
31245/**
31246 * object_get_sensor_threshold:
31247 * @object: A #Object.
31248 *
31249 * 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.
31250 *
31251 * Returns: (transfer full): A #SensorThreshold that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
31252 */
31253SensorThreshold *object_get_sensor_threshold (Object *object)
31254{
31255 GDBusInterface *ret;
31256 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold");
31257 if (ret == NULL)
31258 return NULL;
31259 return SENSOR_THRESHOLD (ret);
31260}
31261
31262/**
31263 * object_get_sensor_i2c:
31264 * @object: A #Object.
31265 *
31266 * 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.
31267 *
31268 * Returns: (transfer full): A #SensorI2c that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
31269 */
31270SensorI2c *object_get_sensor_i2c (Object *object)
31271{
31272 GDBusInterface *ret;
31273 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
31274 if (ret == NULL)
31275 return NULL;
31276 return SENSOR_I2C (ret);
31277}
31278
31279/**
31280 * object_get_sensor_match:
31281 * @object: A #Object.
31282 *
31283 * 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.
31284 *
31285 * Returns: (transfer full): A #SensorMatch that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
31286 */
31287SensorMatch *object_get_sensor_match (Object *object)
31288{
31289 GDBusInterface *ret;
31290 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch");
31291 if (ret == NULL)
31292 return NULL;
31293 return SENSOR_MATCH (ret);
31294}
31295
31296/**
31297 * object_get_process:
31298 * @object: A #Object.
31299 *
31300 * 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.
31301 *
31302 * Returns: (transfer full): A #Process that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
31303 */
31304Process *object_get_process (Object *object)
31305{
31306 GDBusInterface *ret;
31307 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process");
31308 if (ret == NULL)
31309 return NULL;
31310 return PROCESS (ret);
31311}
31312
31313/**
Norman James18998182015-10-11 21:54:53 -050031314 * object_get_shared_resource:
31315 * @object: A #Object.
31316 *
31317 * 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.
31318 *
31319 * Returns: (transfer full): A #SharedResource that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
31320 */
31321SharedResource *object_get_shared_resource (Object *object)
31322{
31323 GDBusInterface *ret;
31324 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SharedResource");
31325 if (ret == NULL)
31326 return NULL;
31327 return SHARED_RESOURCE (ret);
31328}
31329
31330/**
Norman James362a80f2015-09-14 14:04:39 -050031331 * object_get_control:
31332 * @object: A #Object.
31333 *
31334 * 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.
31335 *
31336 * Returns: (transfer full): A #Control that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
31337 */
31338Control *object_get_control (Object *object)
31339{
31340 GDBusInterface *ret;
31341 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control");
31342 if (ret == NULL)
31343 return NULL;
31344 return CONTROL (ret);
31345}
31346
31347/**
31348 * object_get_control_bmc:
31349 * @object: A #Object.
31350 *
31351 * 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.
31352 *
31353 * Returns: (transfer full): A #ControlBmc that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
31354 */
31355ControlBmc *object_get_control_bmc (Object *object)
31356{
31357 GDBusInterface *ret;
31358 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc");
31359 if (ret == NULL)
31360 return NULL;
31361 return CONTROL_BMC (ret);
31362}
31363
31364/**
31365 * object_get_control_host:
31366 * @object: A #Object.
31367 *
31368 * 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.
31369 *
31370 * Returns: (transfer full): A #ControlHost that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
31371 */
31372ControlHost *object_get_control_host (Object *object)
31373{
31374 GDBusInterface *ret;
31375 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
31376 if (ret == NULL)
31377 return NULL;
31378 return CONTROL_HOST (ret);
31379}
31380
31381/**
31382 * object_get_control_power:
31383 * @object: A #Object.
31384 *
31385 * 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.
31386 *
31387 * Returns: (transfer full): A #ControlPower that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
31388 */
31389ControlPower *object_get_control_power (Object *object)
31390{
31391 GDBusInterface *ret;
31392 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power");
31393 if (ret == NULL)
31394 return NULL;
31395 return CONTROL_POWER (ret);
31396}
31397
31398/**
Adriana Kobylakfd778822016-06-16 09:08:37 -050031399 * object_get_control_checkstop:
31400 * @object: A #Object.
31401 *
31402 * Gets the #ControlCheckstop instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Checkstop.top_of_page">org.openbmc.control.Checkstop</link> on @object, if any.
31403 *
31404 * Returns: (transfer full): A #ControlCheckstop that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
31405 */
31406ControlCheckstop *object_get_control_checkstop (Object *object)
31407{
31408 GDBusInterface *ret;
31409 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Checkstop");
31410 if (ret == NULL)
31411 return NULL;
31412 return CONTROL_CHECKSTOP (ret);
31413}
31414
31415/**
Norman James362a80f2015-09-14 14:04:39 -050031416 * object_get_watchdog:
31417 * @object: A #Object.
31418 *
31419 * 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.
31420 *
31421 * Returns: (transfer full): A #Watchdog that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
31422 */
31423Watchdog *object_get_watchdog (Object *object)
31424{
31425 GDBusInterface *ret;
31426 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog");
31427 if (ret == NULL)
31428 return NULL;
31429 return WATCHDOG (ret);
31430}
31431
31432/**
31433 * object_get_event_log:
31434 * @object: A #Object.
31435 *
31436 * 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.
31437 *
31438 * Returns: (transfer full): A #EventLog that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
31439 */
31440EventLog *object_get_event_log (Object *object)
31441{
31442 GDBusInterface *ret;
31443 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
31444 if (ret == NULL)
31445 return NULL;
31446 return EVENT_LOG (ret);
31447}
31448
31449/**
31450 * object_get_flash:
31451 * @object: A #Object.
31452 *
31453 * 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.
31454 *
31455 * Returns: (transfer full): A #Flash that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
31456 */
31457Flash *object_get_flash (Object *object)
31458{
31459 GDBusInterface *ret;
31460 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash");
31461 if (ret == NULL)
31462 return NULL;
31463 return FLASH (ret);
31464}
31465
31466/**
Norman James18998182015-10-11 21:54:53 -050031467 * object_get_flash_control:
31468 * @object: A #Object.
31469 *
31470 * 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.
31471 *
31472 * Returns: (transfer full): A #FlashControl that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
31473 */
31474FlashControl *object_get_flash_control (Object *object)
31475{
31476 GDBusInterface *ret;
31477 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.FlashControl");
31478 if (ret == NULL)
31479 return NULL;
31480 return FLASH_CONTROL (ret);
31481}
31482
31483/**
Norman James362a80f2015-09-14 14:04:39 -050031484 * object_get_button:
31485 * @object: A #Object.
31486 *
31487 * 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.
31488 *
31489 * Returns: (transfer full): A #Button that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
31490 */
31491Button *object_get_button (Object *object)
31492{
31493 GDBusInterface *ret;
31494 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button");
31495 if (ret == NULL)
31496 return NULL;
31497 return BUTTON (ret);
31498}
31499
31500/**
31501 * object_get_led:
31502 * @object: A #Object.
31503 *
31504 * 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.
31505 *
31506 * Returns: (transfer full): A #Led that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
31507 */
31508Led *object_get_led (Object *object)
31509{
31510 GDBusInterface *ret;
31511 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led");
31512 if (ret == NULL)
31513 return NULL;
31514 return LED (ret);
31515}
31516
Norman Jamesdbcffbd2015-10-06 16:53:06 -050031517/**
31518 * object_get_host_ipmi:
31519 * @object: A #Object.
31520 *
31521 * 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.
31522 *
31523 * Returns: (transfer full): A #HostIpmi that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
31524 */
31525HostIpmi *object_get_host_ipmi (Object *object)
31526{
31527 GDBusInterface *ret;
31528 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.HostIpmi");
31529 if (ret == NULL)
31530 return NULL;
31531 return HOST_IPMI (ret);
31532}
31533
Norman James362a80f2015-09-14 14:04:39 -050031534
31535/**
Norman James493996c2015-10-31 17:27:13 -050031536 * object_peek_object_mapper: (skip)
31537 * @object: A #Object.
31538 *
31539 * Like object_get_object_mapper() but doesn't increase the reference count on the returned object.
31540 *
31541 * <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>
31542 *
31543 * 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.
31544 */
31545ObjectMapper *object_peek_object_mapper (Object *object)
31546{
31547 GDBusInterface *ret;
31548 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Object.Mapper");
31549 if (ret == NULL)
31550 return NULL;
31551 g_object_unref (ret);
31552 return OBJECT_MAPPER (ret);
31553}
31554
31555/**
Norman James5236a8f2015-11-05 20:39:31 -060031556 * object_peek_hwmon: (skip)
31557 * @object: A #Object.
31558 *
31559 * Like object_get_hwmon() but doesn't increase the reference count on the returned object.
31560 *
31561 * <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>
31562 *
31563 * 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.
31564 */
31565Hwmon *object_peek_hwmon (Object *object)
31566{
31567 GDBusInterface *ret;
31568 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Hwmon");
31569 if (ret == NULL)
31570 return NULL;
31571 g_object_unref (ret);
31572 return HWMON (ret);
31573}
31574
31575/**
Norman James362a80f2015-09-14 14:04:39 -050031576 * object_peek_fan: (skip)
31577 * @object: A #Object.
31578 *
31579 * Like object_get_fan() but doesn't increase the reference count on the returned object.
31580 *
31581 * <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>
31582 *
31583 * 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.
31584 */
31585Fan *object_peek_fan (Object *object)
31586{
31587 GDBusInterface *ret;
31588 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan");
31589 if (ret == NULL)
31590 return NULL;
31591 g_object_unref (ret);
31592 return FAN (ret);
31593}
31594
31595/**
31596 * object_peek_sensor_value: (skip)
31597 * @object: A #Object.
31598 *
31599 * Like object_get_sensor_value() but doesn't increase the reference count on the returned object.
31600 *
31601 * <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>
31602 *
31603 * 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.
31604 */
31605SensorValue *object_peek_sensor_value (Object *object)
31606{
31607 GDBusInterface *ret;
31608 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue");
31609 if (ret == NULL)
31610 return NULL;
31611 g_object_unref (ret);
31612 return SENSOR_VALUE (ret);
31613}
31614
31615/**
31616 * object_peek_sensor_threshold: (skip)
31617 * @object: A #Object.
31618 *
31619 * Like object_get_sensor_threshold() but doesn't increase the reference count on the returned object.
31620 *
31621 * <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>
31622 *
31623 * 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.
31624 */
31625SensorThreshold *object_peek_sensor_threshold (Object *object)
31626{
31627 GDBusInterface *ret;
31628 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold");
31629 if (ret == NULL)
31630 return NULL;
31631 g_object_unref (ret);
31632 return SENSOR_THRESHOLD (ret);
31633}
31634
31635/**
31636 * object_peek_sensor_i2c: (skip)
31637 * @object: A #Object.
31638 *
31639 * Like object_get_sensor_i2c() but doesn't increase the reference count on the returned object.
31640 *
31641 * <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>
31642 *
31643 * 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.
31644 */
31645SensorI2c *object_peek_sensor_i2c (Object *object)
31646{
31647 GDBusInterface *ret;
31648 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
31649 if (ret == NULL)
31650 return NULL;
31651 g_object_unref (ret);
31652 return SENSOR_I2C (ret);
31653}
31654
31655/**
31656 * object_peek_sensor_match: (skip)
31657 * @object: A #Object.
31658 *
31659 * Like object_get_sensor_match() but doesn't increase the reference count on the returned object.
31660 *
31661 * <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>
31662 *
31663 * 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.
31664 */
31665SensorMatch *object_peek_sensor_match (Object *object)
31666{
31667 GDBusInterface *ret;
31668 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch");
31669 if (ret == NULL)
31670 return NULL;
31671 g_object_unref (ret);
31672 return SENSOR_MATCH (ret);
31673}
31674
31675/**
31676 * object_peek_process: (skip)
31677 * @object: A #Object.
31678 *
31679 * Like object_get_process() but doesn't increase the reference count on the returned object.
31680 *
31681 * <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>
31682 *
31683 * 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.
31684 */
31685Process *object_peek_process (Object *object)
31686{
31687 GDBusInterface *ret;
31688 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process");
31689 if (ret == NULL)
31690 return NULL;
31691 g_object_unref (ret);
31692 return PROCESS (ret);
31693}
31694
31695/**
Norman James18998182015-10-11 21:54:53 -050031696 * object_peek_shared_resource: (skip)
31697 * @object: A #Object.
31698 *
31699 * Like object_get_shared_resource() but doesn't increase the reference count on the returned object.
31700 *
31701 * <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>
31702 *
31703 * 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.
31704 */
31705SharedResource *object_peek_shared_resource (Object *object)
31706{
31707 GDBusInterface *ret;
31708 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SharedResource");
31709 if (ret == NULL)
31710 return NULL;
31711 g_object_unref (ret);
31712 return SHARED_RESOURCE (ret);
31713}
31714
31715/**
Norman James362a80f2015-09-14 14:04:39 -050031716 * object_peek_control: (skip)
31717 * @object: A #Object.
31718 *
31719 * Like object_get_control() but doesn't increase the reference count on the returned object.
31720 *
31721 * <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>
31722 *
31723 * 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.
31724 */
31725Control *object_peek_control (Object *object)
31726{
31727 GDBusInterface *ret;
31728 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control");
31729 if (ret == NULL)
31730 return NULL;
31731 g_object_unref (ret);
31732 return CONTROL (ret);
31733}
31734
31735/**
31736 * object_peek_control_bmc: (skip)
31737 * @object: A #Object.
31738 *
31739 * Like object_get_control_bmc() but doesn't increase the reference count on the returned object.
31740 *
31741 * <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>
31742 *
31743 * 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.
31744 */
31745ControlBmc *object_peek_control_bmc (Object *object)
31746{
31747 GDBusInterface *ret;
31748 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc");
31749 if (ret == NULL)
31750 return NULL;
31751 g_object_unref (ret);
31752 return CONTROL_BMC (ret);
31753}
31754
31755/**
31756 * object_peek_control_host: (skip)
31757 * @object: A #Object.
31758 *
31759 * Like object_get_control_host() but doesn't increase the reference count on the returned object.
31760 *
31761 * <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>
31762 *
31763 * 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.
31764 */
31765ControlHost *object_peek_control_host (Object *object)
31766{
31767 GDBusInterface *ret;
31768 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
31769 if (ret == NULL)
31770 return NULL;
31771 g_object_unref (ret);
31772 return CONTROL_HOST (ret);
31773}
31774
31775/**
31776 * object_peek_control_power: (skip)
31777 * @object: A #Object.
31778 *
31779 * Like object_get_control_power() but doesn't increase the reference count on the returned object.
31780 *
31781 * <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>
31782 *
31783 * 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.
31784 */
31785ControlPower *object_peek_control_power (Object *object)
31786{
31787 GDBusInterface *ret;
31788 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power");
31789 if (ret == NULL)
31790 return NULL;
31791 g_object_unref (ret);
31792 return CONTROL_POWER (ret);
31793}
31794
31795/**
Adriana Kobylakfd778822016-06-16 09:08:37 -050031796 * object_peek_control_checkstop: (skip)
31797 * @object: A #Object.
31798 *
31799 * Like object_get_control_checkstop() but doesn't increase the reference count on the returned object.
31800 *
31801 * <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>
31802 *
31803 * Returns: (transfer none): A #ControlCheckstop or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
31804 */
31805ControlCheckstop *object_peek_control_checkstop (Object *object)
31806{
31807 GDBusInterface *ret;
31808 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Checkstop");
31809 if (ret == NULL)
31810 return NULL;
31811 g_object_unref (ret);
31812 return CONTROL_CHECKSTOP (ret);
31813}
31814
31815/**
Norman James362a80f2015-09-14 14:04:39 -050031816 * object_peek_watchdog: (skip)
31817 * @object: A #Object.
31818 *
31819 * Like object_get_watchdog() but doesn't increase the reference count on the returned object.
31820 *
31821 * <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>
31822 *
31823 * 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.
31824 */
31825Watchdog *object_peek_watchdog (Object *object)
31826{
31827 GDBusInterface *ret;
31828 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog");
31829 if (ret == NULL)
31830 return NULL;
31831 g_object_unref (ret);
31832 return WATCHDOG (ret);
31833}
31834
31835/**
31836 * object_peek_event_log: (skip)
31837 * @object: A #Object.
31838 *
31839 * Like object_get_event_log() but doesn't increase the reference count on the returned object.
31840 *
31841 * <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>
31842 *
31843 * 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.
31844 */
31845EventLog *object_peek_event_log (Object *object)
31846{
31847 GDBusInterface *ret;
31848 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
31849 if (ret == NULL)
31850 return NULL;
31851 g_object_unref (ret);
31852 return EVENT_LOG (ret);
31853}
31854
31855/**
31856 * object_peek_flash: (skip)
31857 * @object: A #Object.
31858 *
31859 * Like object_get_flash() but doesn't increase the reference count on the returned object.
31860 *
31861 * <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>
31862 *
31863 * 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.
31864 */
31865Flash *object_peek_flash (Object *object)
31866{
31867 GDBusInterface *ret;
31868 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash");
31869 if (ret == NULL)
31870 return NULL;
31871 g_object_unref (ret);
31872 return FLASH (ret);
31873}
31874
31875/**
Norman James18998182015-10-11 21:54:53 -050031876 * object_peek_flash_control: (skip)
31877 * @object: A #Object.
31878 *
31879 * Like object_get_flash_control() but doesn't increase the reference count on the returned object.
31880 *
31881 * <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>
31882 *
31883 * 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.
31884 */
31885FlashControl *object_peek_flash_control (Object *object)
31886{
31887 GDBusInterface *ret;
31888 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.FlashControl");
31889 if (ret == NULL)
31890 return NULL;
31891 g_object_unref (ret);
31892 return FLASH_CONTROL (ret);
31893}
31894
31895/**
Norman James362a80f2015-09-14 14:04:39 -050031896 * object_peek_button: (skip)
31897 * @object: A #Object.
31898 *
31899 * Like object_get_button() but doesn't increase the reference count on the returned object.
31900 *
31901 * <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>
31902 *
31903 * 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.
31904 */
31905Button *object_peek_button (Object *object)
31906{
31907 GDBusInterface *ret;
31908 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button");
31909 if (ret == NULL)
31910 return NULL;
31911 g_object_unref (ret);
31912 return BUTTON (ret);
31913}
31914
31915/**
31916 * object_peek_led: (skip)
31917 * @object: A #Object.
31918 *
31919 * Like object_get_led() but doesn't increase the reference count on the returned object.
31920 *
31921 * <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>
31922 *
31923 * 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.
31924 */
31925Led *object_peek_led (Object *object)
31926{
31927 GDBusInterface *ret;
31928 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led");
31929 if (ret == NULL)
31930 return NULL;
31931 g_object_unref (ret);
31932 return LED (ret);
31933}
31934
Norman Jamesdbcffbd2015-10-06 16:53:06 -050031935/**
31936 * object_peek_host_ipmi: (skip)
31937 * @object: A #Object.
31938 *
31939 * Like object_get_host_ipmi() but doesn't increase the reference count on the returned object.
31940 *
31941 * <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>
31942 *
31943 * 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.
31944 */
31945HostIpmi *object_peek_host_ipmi (Object *object)
31946{
31947 GDBusInterface *ret;
31948 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.HostIpmi");
31949 if (ret == NULL)
31950 return NULL;
31951 g_object_unref (ret);
31952 return HOST_IPMI (ret);
31953}
31954
Norman James362a80f2015-09-14 14:04:39 -050031955
31956static void
31957object_notify (GDBusObject *object, GDBusInterface *interface)
31958{
31959 _ExtendedGDBusInterfaceInfo *info = (_ExtendedGDBusInterfaceInfo *) g_dbus_interface_get_info (interface);
31960 /* info can be NULL if the other end is using a D-Bus interface we don't know
31961 * anything about, for example old generated code in this process talking to
31962 * newer generated code in the other process. */
31963 if (info != NULL)
31964 g_object_notify (G_OBJECT (object), info->hyphen_name);
31965}
31966
31967/**
31968 * ObjectProxy:
31969 *
31970 * The #ObjectProxy structure contains only private data and should only be accessed using the provided API.
31971 */
31972
31973/**
31974 * ObjectProxyClass:
31975 * @parent_class: The parent class.
31976 *
31977 * Class structure for #ObjectProxy.
31978 */
31979
31980static void
31981object_proxy__object_iface_init (ObjectIface *iface G_GNUC_UNUSED)
31982{
31983}
31984
31985static void
31986object_proxy__g_dbus_object_iface_init (GDBusObjectIface *iface)
31987{
31988 iface->interface_added = object_notify;
31989 iface->interface_removed = object_notify;
31990}
31991
31992
31993G_DEFINE_TYPE_WITH_CODE (ObjectProxy, object_proxy, G_TYPE_DBUS_OBJECT_PROXY,
31994 G_IMPLEMENT_INTERFACE (TYPE_OBJECT, object_proxy__object_iface_init)
31995 G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, object_proxy__g_dbus_object_iface_init));
31996
31997static void
31998object_proxy_init (ObjectProxy *object G_GNUC_UNUSED)
31999{
32000}
32001
32002static void
32003object_proxy_set_property (GObject *gobject,
32004 guint prop_id,
32005 const GValue *value G_GNUC_UNUSED,
32006 GParamSpec *pspec)
32007{
32008 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
32009}
32010
32011static void
32012object_proxy_get_property (GObject *gobject,
32013 guint prop_id,
32014 GValue *value,
32015 GParamSpec *pspec)
32016{
32017 ObjectProxy *object = OBJECT_PROXY (gobject);
32018 GDBusInterface *interface;
32019
32020 switch (prop_id)
32021 {
32022 case 1:
Norman James493996c2015-10-31 17:27:13 -050032023 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Object.Mapper");
Norman James362a80f2015-09-14 14:04:39 -050032024 g_value_take_object (value, interface);
32025 break;
32026
Norman Jamesa3e47c42015-10-18 14:43:10 -050032027 case 2:
Norman James5236a8f2015-11-05 20:39:31 -060032028 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Hwmon");
Norman James362a80f2015-09-14 14:04:39 -050032029 g_value_take_object (value, interface);
32030 break;
32031
Norman Jamesa3e47c42015-10-18 14:43:10 -050032032 case 3:
Norman James5236a8f2015-11-05 20:39:31 -060032033 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan");
Norman James362a80f2015-09-14 14:04:39 -050032034 g_value_take_object (value, interface);
32035 break;
32036
Norman Jamesa3e47c42015-10-18 14:43:10 -050032037 case 4:
Norman James5236a8f2015-11-05 20:39:31 -060032038 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue");
Norman James362a80f2015-09-14 14:04:39 -050032039 g_value_take_object (value, interface);
32040 break;
32041
Norman Jamesa3e47c42015-10-18 14:43:10 -050032042 case 5:
Norman James5236a8f2015-11-05 20:39:31 -060032043 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold");
Norman James362a80f2015-09-14 14:04:39 -050032044 g_value_take_object (value, interface);
32045 break;
32046
Norman Jamesa3e47c42015-10-18 14:43:10 -050032047 case 6:
Norman James5236a8f2015-11-05 20:39:31 -060032048 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
Norman James362a80f2015-09-14 14:04:39 -050032049 g_value_take_object (value, interface);
32050 break;
32051
Norman Jamesa3e47c42015-10-18 14:43:10 -050032052 case 7:
Norman James5236a8f2015-11-05 20:39:31 -060032053 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch");
Norman James362a80f2015-09-14 14:04:39 -050032054 g_value_take_object (value, interface);
32055 break;
32056
Norman Jamesa3e47c42015-10-18 14:43:10 -050032057 case 8:
Norman James5236a8f2015-11-05 20:39:31 -060032058 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process");
Norman James362a80f2015-09-14 14:04:39 -050032059 g_value_take_object (value, interface);
32060 break;
32061
Norman Jamesa3e47c42015-10-18 14:43:10 -050032062 case 9:
Norman James5236a8f2015-11-05 20:39:31 -060032063 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SharedResource");
Norman James362a80f2015-09-14 14:04:39 -050032064 g_value_take_object (value, interface);
32065 break;
32066
Norman Jamesa3e47c42015-10-18 14:43:10 -050032067 case 10:
Norman James5236a8f2015-11-05 20:39:31 -060032068 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control");
Norman James362a80f2015-09-14 14:04:39 -050032069 g_value_take_object (value, interface);
32070 break;
32071
Norman Jamesa3e47c42015-10-18 14:43:10 -050032072 case 11:
Norman James5236a8f2015-11-05 20:39:31 -060032073 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc");
Norman James362a80f2015-09-14 14:04:39 -050032074 g_value_take_object (value, interface);
32075 break;
32076
Norman Jamesa3e47c42015-10-18 14:43:10 -050032077 case 12:
Norman James5236a8f2015-11-05 20:39:31 -060032078 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
Norman James362a80f2015-09-14 14:04:39 -050032079 g_value_take_object (value, interface);
32080 break;
32081
Norman Jamesa3e47c42015-10-18 14:43:10 -050032082 case 13:
Norman James5236a8f2015-11-05 20:39:31 -060032083 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power");
Norman James362a80f2015-09-14 14:04:39 -050032084 g_value_take_object (value, interface);
32085 break;
32086
Norman Jamesa3e47c42015-10-18 14:43:10 -050032087 case 14:
Adriana Kobylakfd778822016-06-16 09:08:37 -050032088 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Checkstop");
Norman Jamesdfdaca92015-09-27 22:11:15 -050032089 g_value_take_object (value, interface);
32090 break;
32091
Norman Jamesa3e47c42015-10-18 14:43:10 -050032092 case 15:
Adriana Kobylakfd778822016-06-16 09:08:37 -050032093 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog");
Norman James362a80f2015-09-14 14:04:39 -050032094 g_value_take_object (value, interface);
32095 break;
32096
Norman Jamesa3e47c42015-10-18 14:43:10 -050032097 case 16:
Adriana Kobylakfd778822016-06-16 09:08:37 -050032098 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
Norman James18998182015-10-11 21:54:53 -050032099 g_value_take_object (value, interface);
32100 break;
32101
Norman Jamesa3e47c42015-10-18 14:43:10 -050032102 case 17:
Adriana Kobylakfd778822016-06-16 09:08:37 -050032103 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash");
Norman James18998182015-10-11 21:54:53 -050032104 g_value_take_object (value, interface);
32105 break;
32106
Norman Jamesa3e47c42015-10-18 14:43:10 -050032107 case 18:
Adriana Kobylakfd778822016-06-16 09:08:37 -050032108 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.FlashControl");
Norman James493996c2015-10-31 17:27:13 -050032109 g_value_take_object (value, interface);
32110 break;
32111
32112 case 19:
Adriana Kobylakfd778822016-06-16 09:08:37 -050032113 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button");
Norman James5236a8f2015-11-05 20:39:31 -060032114 g_value_take_object (value, interface);
32115 break;
32116
32117 case 20:
Adriana Kobylakfd778822016-06-16 09:08:37 -050032118 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led");
32119 g_value_take_object (value, interface);
32120 break;
32121
32122 case 21:
Norman Jamesdbcffbd2015-10-06 16:53:06 -050032123 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.HostIpmi");
32124 g_value_take_object (value, interface);
32125 break;
32126
Norman James362a80f2015-09-14 14:04:39 -050032127 default:
32128 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
32129 break;
32130 }
32131}
32132
32133static void
32134object_proxy_class_init (ObjectProxyClass *klass)
32135{
32136 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
32137
32138 gobject_class->set_property = object_proxy_set_property;
32139 gobject_class->get_property = object_proxy_get_property;
32140
Norman James493996c2015-10-31 17:27:13 -050032141 g_object_class_override_property (gobject_class, 1, "object-mapper");
Norman James5236a8f2015-11-05 20:39:31 -060032142 g_object_class_override_property (gobject_class, 2, "hwmon");
32143 g_object_class_override_property (gobject_class, 3, "fan");
32144 g_object_class_override_property (gobject_class, 4, "sensor-value");
32145 g_object_class_override_property (gobject_class, 5, "sensor-threshold");
32146 g_object_class_override_property (gobject_class, 6, "sensor-i2c");
32147 g_object_class_override_property (gobject_class, 7, "sensor-match");
32148 g_object_class_override_property (gobject_class, 8, "process");
32149 g_object_class_override_property (gobject_class, 9, "shared-resource");
32150 g_object_class_override_property (gobject_class, 10, "control");
32151 g_object_class_override_property (gobject_class, 11, "control-bmc");
32152 g_object_class_override_property (gobject_class, 12, "control-host");
32153 g_object_class_override_property (gobject_class, 13, "control-power");
Adriana Kobylakfd778822016-06-16 09:08:37 -050032154 g_object_class_override_property (gobject_class, 14, "control-checkstop");
32155 g_object_class_override_property (gobject_class, 15, "watchdog");
32156 g_object_class_override_property (gobject_class, 16, "event-log");
32157 g_object_class_override_property (gobject_class, 17, "flash");
32158 g_object_class_override_property (gobject_class, 18, "flash-control");
32159 g_object_class_override_property (gobject_class, 19, "button");
32160 g_object_class_override_property (gobject_class, 20, "led");
32161 g_object_class_override_property (gobject_class, 21, "host-ipmi");
Norman James362a80f2015-09-14 14:04:39 -050032162}
32163
32164/**
32165 * object_proxy_new:
32166 * @connection: A #GDBusConnection.
32167 * @object_path: An object path.
32168 *
32169 * Creates a new proxy object.
32170 *
32171 * Returns: (transfer full): The proxy object.
32172 */
32173ObjectProxy *
32174object_proxy_new (GDBusConnection *connection,
32175 const gchar *object_path)
32176{
32177 g_return_val_if_fail (G_IS_DBUS_CONNECTION (connection), NULL);
32178 g_return_val_if_fail (g_variant_is_object_path (object_path), NULL);
32179 return OBJECT_PROXY (g_object_new (TYPE_OBJECT_PROXY, "g-connection", connection, "g-object-path", object_path, NULL));
32180}
32181
32182/**
32183 * ObjectSkeleton:
32184 *
32185 * The #ObjectSkeleton structure contains only private data and should only be accessed using the provided API.
32186 */
32187
32188/**
32189 * ObjectSkeletonClass:
32190 * @parent_class: The parent class.
32191 *
32192 * Class structure for #ObjectSkeleton.
32193 */
32194
32195static void
32196object_skeleton__object_iface_init (ObjectIface *iface G_GNUC_UNUSED)
32197{
32198}
32199
32200
32201static void
32202object_skeleton__g_dbus_object_iface_init (GDBusObjectIface *iface)
32203{
32204 iface->interface_added = object_notify;
32205 iface->interface_removed = object_notify;
32206}
32207
32208G_DEFINE_TYPE_WITH_CODE (ObjectSkeleton, object_skeleton, G_TYPE_DBUS_OBJECT_SKELETON,
32209 G_IMPLEMENT_INTERFACE (TYPE_OBJECT, object_skeleton__object_iface_init)
32210 G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, object_skeleton__g_dbus_object_iface_init));
32211
32212static void
32213object_skeleton_init (ObjectSkeleton *object G_GNUC_UNUSED)
32214{
32215}
32216
32217static void
32218object_skeleton_set_property (GObject *gobject,
32219 guint prop_id,
32220 const GValue *value,
32221 GParamSpec *pspec)
32222{
32223 ObjectSkeleton *object = OBJECT_SKELETON (gobject);
32224 GDBusInterfaceSkeleton *interface;
32225
32226 switch (prop_id)
32227 {
32228 case 1:
32229 interface = g_value_get_object (value);
32230 if (interface != NULL)
32231 {
Norman James493996c2015-10-31 17:27:13 -050032232 g_warn_if_fail (IS_OBJECT_MAPPER (interface));
32233 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
32234 }
32235 else
32236 {
32237 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Object.Mapper");
32238 }
32239 break;
32240
32241 case 2:
32242 interface = g_value_get_object (value);
32243 if (interface != NULL)
32244 {
Norman James5236a8f2015-11-05 20:39:31 -060032245 g_warn_if_fail (IS_HWMON (interface));
32246 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
32247 }
32248 else
32249 {
32250 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Hwmon");
32251 }
32252 break;
32253
32254 case 3:
32255 interface = g_value_get_object (value);
32256 if (interface != NULL)
32257 {
Norman James362a80f2015-09-14 14:04:39 -050032258 g_warn_if_fail (IS_FAN (interface));
32259 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
32260 }
32261 else
32262 {
32263 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Fan");
32264 }
32265 break;
32266
Norman James5236a8f2015-11-05 20:39:31 -060032267 case 4:
Norman James362a80f2015-09-14 14:04:39 -050032268 interface = g_value_get_object (value);
32269 if (interface != NULL)
32270 {
32271 g_warn_if_fail (IS_SENSOR_VALUE (interface));
32272 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
32273 }
32274 else
32275 {
32276 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorValue");
32277 }
32278 break;
32279
Norman James5236a8f2015-11-05 20:39:31 -060032280 case 5:
Norman James362a80f2015-09-14 14:04:39 -050032281 interface = g_value_get_object (value);
32282 if (interface != NULL)
32283 {
32284 g_warn_if_fail (IS_SENSOR_THRESHOLD (interface));
32285 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
32286 }
32287 else
32288 {
32289 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorThreshold");
32290 }
32291 break;
32292
Norman James5236a8f2015-11-05 20:39:31 -060032293 case 6:
Norman James362a80f2015-09-14 14:04:39 -050032294 interface = g_value_get_object (value);
32295 if (interface != NULL)
32296 {
32297 g_warn_if_fail (IS_SENSOR_I2C (interface));
32298 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
32299 }
32300 else
32301 {
32302 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorI2c");
32303 }
32304 break;
32305
Norman James5236a8f2015-11-05 20:39:31 -060032306 case 7:
Norman James362a80f2015-09-14 14:04:39 -050032307 interface = g_value_get_object (value);
32308 if (interface != NULL)
32309 {
32310 g_warn_if_fail (IS_SENSOR_MATCH (interface));
32311 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
32312 }
32313 else
32314 {
32315 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorMatch");
32316 }
32317 break;
32318
Norman James5236a8f2015-11-05 20:39:31 -060032319 case 8:
Norman James362a80f2015-09-14 14:04:39 -050032320 interface = g_value_get_object (value);
32321 if (interface != NULL)
32322 {
32323 g_warn_if_fail (IS_PROCESS (interface));
32324 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
32325 }
32326 else
32327 {
32328 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Process");
32329 }
32330 break;
32331
Norman James5236a8f2015-11-05 20:39:31 -060032332 case 9:
Norman James362a80f2015-09-14 14:04:39 -050032333 interface = g_value_get_object (value);
32334 if (interface != NULL)
32335 {
Norman James18998182015-10-11 21:54:53 -050032336 g_warn_if_fail (IS_SHARED_RESOURCE (interface));
32337 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
32338 }
32339 else
32340 {
32341 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SharedResource");
32342 }
32343 break;
32344
Norman James5236a8f2015-11-05 20:39:31 -060032345 case 10:
Norman James18998182015-10-11 21:54:53 -050032346 interface = g_value_get_object (value);
32347 if (interface != NULL)
32348 {
Norman James362a80f2015-09-14 14:04:39 -050032349 g_warn_if_fail (IS_CONTROL (interface));
32350 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
32351 }
32352 else
32353 {
32354 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Control");
32355 }
32356 break;
32357
Norman James5236a8f2015-11-05 20:39:31 -060032358 case 11:
Norman James362a80f2015-09-14 14:04:39 -050032359 interface = g_value_get_object (value);
32360 if (interface != NULL)
32361 {
32362 g_warn_if_fail (IS_CONTROL_BMC (interface));
32363 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
32364 }
32365 else
32366 {
32367 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.control.Bmc");
32368 }
32369 break;
32370
Norman James5236a8f2015-11-05 20:39:31 -060032371 case 12:
Norman James362a80f2015-09-14 14:04:39 -050032372 interface = g_value_get_object (value);
32373 if (interface != NULL)
32374 {
32375 g_warn_if_fail (IS_CONTROL_HOST (interface));
32376 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
32377 }
32378 else
32379 {
32380 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.control.Host");
32381 }
32382 break;
32383
Norman James5236a8f2015-11-05 20:39:31 -060032384 case 13:
Norman James362a80f2015-09-14 14:04:39 -050032385 interface = g_value_get_object (value);
32386 if (interface != NULL)
32387 {
32388 g_warn_if_fail (IS_CONTROL_POWER (interface));
32389 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
32390 }
32391 else
32392 {
32393 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.control.Power");
32394 }
32395 break;
32396
Norman James5236a8f2015-11-05 20:39:31 -060032397 case 14:
Norman James362a80f2015-09-14 14:04:39 -050032398 interface = g_value_get_object (value);
32399 if (interface != NULL)
32400 {
Adriana Kobylakfd778822016-06-16 09:08:37 -050032401 g_warn_if_fail (IS_CONTROL_CHECKSTOP (interface));
32402 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
32403 }
32404 else
32405 {
32406 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.control.Checkstop");
32407 }
32408 break;
32409
32410 case 15:
32411 interface = g_value_get_object (value);
32412 if (interface != NULL)
32413 {
Norman James362a80f2015-09-14 14:04:39 -050032414 g_warn_if_fail (IS_WATCHDOG (interface));
32415 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
32416 }
32417 else
32418 {
32419 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Watchdog");
32420 }
32421 break;
32422
Adriana Kobylakfd778822016-06-16 09:08:37 -050032423 case 16:
Norman James362a80f2015-09-14 14:04:39 -050032424 interface = g_value_get_object (value);
32425 if (interface != NULL)
32426 {
32427 g_warn_if_fail (IS_EVENT_LOG (interface));
32428 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
32429 }
32430 else
32431 {
32432 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.EventLog");
32433 }
32434 break;
32435
Adriana Kobylakfd778822016-06-16 09:08:37 -050032436 case 17:
Norman James362a80f2015-09-14 14:04:39 -050032437 interface = g_value_get_object (value);
32438 if (interface != NULL)
32439 {
32440 g_warn_if_fail (IS_FLASH (interface));
32441 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
32442 }
32443 else
32444 {
32445 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Flash");
32446 }
32447 break;
32448
Adriana Kobylakfd778822016-06-16 09:08:37 -050032449 case 18:
Norman James18998182015-10-11 21:54:53 -050032450 interface = g_value_get_object (value);
32451 if (interface != NULL)
32452 {
32453 g_warn_if_fail (IS_FLASH_CONTROL (interface));
32454 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
32455 }
32456 else
32457 {
32458 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.FlashControl");
32459 }
32460 break;
32461
Adriana Kobylakfd778822016-06-16 09:08:37 -050032462 case 19:
Norman James362a80f2015-09-14 14:04:39 -050032463 interface = g_value_get_object (value);
32464 if (interface != NULL)
32465 {
32466 g_warn_if_fail (IS_BUTTON (interface));
32467 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
32468 }
32469 else
32470 {
32471 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Button");
32472 }
32473 break;
32474
Adriana Kobylakfd778822016-06-16 09:08:37 -050032475 case 20:
Norman James362a80f2015-09-14 14:04:39 -050032476 interface = g_value_get_object (value);
32477 if (interface != NULL)
32478 {
32479 g_warn_if_fail (IS_LED (interface));
32480 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
32481 }
32482 else
32483 {
32484 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Led");
32485 }
32486 break;
32487
Adriana Kobylakfd778822016-06-16 09:08:37 -050032488 case 21:
Norman Jamesdbcffbd2015-10-06 16:53:06 -050032489 interface = g_value_get_object (value);
32490 if (interface != NULL)
32491 {
32492 g_warn_if_fail (IS_HOST_IPMI (interface));
32493 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
32494 }
32495 else
32496 {
32497 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.HostIpmi");
32498 }
32499 break;
32500
Norman James362a80f2015-09-14 14:04:39 -050032501 default:
32502 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
32503 break;
32504 }
32505}
32506
32507static void
32508object_skeleton_get_property (GObject *gobject,
32509 guint prop_id,
32510 GValue *value,
32511 GParamSpec *pspec)
32512{
32513 ObjectSkeleton *object = OBJECT_SKELETON (gobject);
32514 GDBusInterface *interface;
32515
32516 switch (prop_id)
32517 {
32518 case 1:
Norman James493996c2015-10-31 17:27:13 -050032519 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Object.Mapper");
Norman James362a80f2015-09-14 14:04:39 -050032520 g_value_take_object (value, interface);
32521 break;
32522
Norman Jamesa3e47c42015-10-18 14:43:10 -050032523 case 2:
Norman James5236a8f2015-11-05 20:39:31 -060032524 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Hwmon");
Norman James362a80f2015-09-14 14:04:39 -050032525 g_value_take_object (value, interface);
32526 break;
32527
Norman Jamesa3e47c42015-10-18 14:43:10 -050032528 case 3:
Norman James5236a8f2015-11-05 20:39:31 -060032529 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan");
Norman James362a80f2015-09-14 14:04:39 -050032530 g_value_take_object (value, interface);
32531 break;
32532
Norman Jamesa3e47c42015-10-18 14:43:10 -050032533 case 4:
Norman James5236a8f2015-11-05 20:39:31 -060032534 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue");
Norman James362a80f2015-09-14 14:04:39 -050032535 g_value_take_object (value, interface);
32536 break;
32537
Norman Jamesa3e47c42015-10-18 14:43:10 -050032538 case 5:
Norman James5236a8f2015-11-05 20:39:31 -060032539 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold");
Norman James362a80f2015-09-14 14:04:39 -050032540 g_value_take_object (value, interface);
32541 break;
32542
Norman Jamesa3e47c42015-10-18 14:43:10 -050032543 case 6:
Norman James5236a8f2015-11-05 20:39:31 -060032544 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
Norman James362a80f2015-09-14 14:04:39 -050032545 g_value_take_object (value, interface);
32546 break;
32547
Norman Jamesa3e47c42015-10-18 14:43:10 -050032548 case 7:
Norman James5236a8f2015-11-05 20:39:31 -060032549 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch");
Norman James362a80f2015-09-14 14:04:39 -050032550 g_value_take_object (value, interface);
32551 break;
32552
Norman Jamesa3e47c42015-10-18 14:43:10 -050032553 case 8:
Norman James5236a8f2015-11-05 20:39:31 -060032554 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process");
Norman James362a80f2015-09-14 14:04:39 -050032555 g_value_take_object (value, interface);
32556 break;
32557
Norman Jamesa3e47c42015-10-18 14:43:10 -050032558 case 9:
Norman James5236a8f2015-11-05 20:39:31 -060032559 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SharedResource");
Norman James362a80f2015-09-14 14:04:39 -050032560 g_value_take_object (value, interface);
32561 break;
32562
Norman Jamesa3e47c42015-10-18 14:43:10 -050032563 case 10:
Norman James5236a8f2015-11-05 20:39:31 -060032564 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control");
Norman James362a80f2015-09-14 14:04:39 -050032565 g_value_take_object (value, interface);
32566 break;
32567
Norman Jamesa3e47c42015-10-18 14:43:10 -050032568 case 11:
Norman James5236a8f2015-11-05 20:39:31 -060032569 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc");
Norman James362a80f2015-09-14 14:04:39 -050032570 g_value_take_object (value, interface);
32571 break;
32572
Norman Jamesa3e47c42015-10-18 14:43:10 -050032573 case 12:
Norman James5236a8f2015-11-05 20:39:31 -060032574 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
Norman James362a80f2015-09-14 14:04:39 -050032575 g_value_take_object (value, interface);
32576 break;
32577
Norman Jamesa3e47c42015-10-18 14:43:10 -050032578 case 13:
Norman James5236a8f2015-11-05 20:39:31 -060032579 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power");
Norman James362a80f2015-09-14 14:04:39 -050032580 g_value_take_object (value, interface);
32581 break;
32582
Norman Jamesa3e47c42015-10-18 14:43:10 -050032583 case 14:
Adriana Kobylakfd778822016-06-16 09:08:37 -050032584 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Checkstop");
Norman Jamesdfdaca92015-09-27 22:11:15 -050032585 g_value_take_object (value, interface);
32586 break;
32587
Norman Jamesa3e47c42015-10-18 14:43:10 -050032588 case 15:
Adriana Kobylakfd778822016-06-16 09:08:37 -050032589 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog");
Norman James362a80f2015-09-14 14:04:39 -050032590 g_value_take_object (value, interface);
32591 break;
32592
Norman Jamesa3e47c42015-10-18 14:43:10 -050032593 case 16:
Adriana Kobylakfd778822016-06-16 09:08:37 -050032594 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
Norman James18998182015-10-11 21:54:53 -050032595 g_value_take_object (value, interface);
32596 break;
32597
Norman Jamesa3e47c42015-10-18 14:43:10 -050032598 case 17:
Adriana Kobylakfd778822016-06-16 09:08:37 -050032599 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash");
Norman James18998182015-10-11 21:54:53 -050032600 g_value_take_object (value, interface);
32601 break;
32602
Norman Jamesa3e47c42015-10-18 14:43:10 -050032603 case 18:
Adriana Kobylakfd778822016-06-16 09:08:37 -050032604 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.FlashControl");
Norman James493996c2015-10-31 17:27:13 -050032605 g_value_take_object (value, interface);
32606 break;
32607
32608 case 19:
Adriana Kobylakfd778822016-06-16 09:08:37 -050032609 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button");
Norman James5236a8f2015-11-05 20:39:31 -060032610 g_value_take_object (value, interface);
32611 break;
32612
32613 case 20:
Adriana Kobylakfd778822016-06-16 09:08:37 -050032614 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led");
32615 g_value_take_object (value, interface);
32616 break;
32617
32618 case 21:
Norman Jamesdbcffbd2015-10-06 16:53:06 -050032619 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.HostIpmi");
32620 g_value_take_object (value, interface);
32621 break;
32622
Norman James362a80f2015-09-14 14:04:39 -050032623 default:
32624 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
32625 break;
32626 }
32627}
32628
32629static void
32630object_skeleton_class_init (ObjectSkeletonClass *klass)
32631{
32632 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
32633
32634 gobject_class->set_property = object_skeleton_set_property;
32635 gobject_class->get_property = object_skeleton_get_property;
32636
Norman James493996c2015-10-31 17:27:13 -050032637 g_object_class_override_property (gobject_class, 1, "object-mapper");
Norman James5236a8f2015-11-05 20:39:31 -060032638 g_object_class_override_property (gobject_class, 2, "hwmon");
32639 g_object_class_override_property (gobject_class, 3, "fan");
32640 g_object_class_override_property (gobject_class, 4, "sensor-value");
32641 g_object_class_override_property (gobject_class, 5, "sensor-threshold");
32642 g_object_class_override_property (gobject_class, 6, "sensor-i2c");
32643 g_object_class_override_property (gobject_class, 7, "sensor-match");
32644 g_object_class_override_property (gobject_class, 8, "process");
32645 g_object_class_override_property (gobject_class, 9, "shared-resource");
32646 g_object_class_override_property (gobject_class, 10, "control");
32647 g_object_class_override_property (gobject_class, 11, "control-bmc");
32648 g_object_class_override_property (gobject_class, 12, "control-host");
32649 g_object_class_override_property (gobject_class, 13, "control-power");
Adriana Kobylakfd778822016-06-16 09:08:37 -050032650 g_object_class_override_property (gobject_class, 14, "control-checkstop");
32651 g_object_class_override_property (gobject_class, 15, "watchdog");
32652 g_object_class_override_property (gobject_class, 16, "event-log");
32653 g_object_class_override_property (gobject_class, 17, "flash");
32654 g_object_class_override_property (gobject_class, 18, "flash-control");
32655 g_object_class_override_property (gobject_class, 19, "button");
32656 g_object_class_override_property (gobject_class, 20, "led");
32657 g_object_class_override_property (gobject_class, 21, "host-ipmi");
Norman James362a80f2015-09-14 14:04:39 -050032658}
32659
32660/**
32661 * object_skeleton_new:
32662 * @object_path: An object path.
32663 *
32664 * Creates a new skeleton object.
32665 *
32666 * Returns: (transfer full): The skeleton object.
32667 */
32668ObjectSkeleton *
32669object_skeleton_new (const gchar *object_path)
32670{
32671 g_return_val_if_fail (g_variant_is_object_path (object_path), NULL);
32672 return OBJECT_SKELETON (g_object_new (TYPE_OBJECT_SKELETON, "g-object-path", object_path, NULL));
32673}
32674
32675/**
Norman James493996c2015-10-31 17:27:13 -050032676 * object_skeleton_set_object_mapper:
32677 * @object: A #ObjectSkeleton.
32678 * @interface_: (allow-none): A #ObjectMapper or %NULL to clear the interface.
32679 *
32680 * 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.
32681 */
32682void object_skeleton_set_object_mapper (ObjectSkeleton *object, ObjectMapper *interface_)
32683{
32684 g_object_set (G_OBJECT (object), "object-mapper", interface_, NULL);
32685}
32686
32687/**
Norman James5236a8f2015-11-05 20:39:31 -060032688 * object_skeleton_set_hwmon:
32689 * @object: A #ObjectSkeleton.
32690 * @interface_: (allow-none): A #Hwmon or %NULL to clear the interface.
32691 *
32692 * 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.
32693 */
32694void object_skeleton_set_hwmon (ObjectSkeleton *object, Hwmon *interface_)
32695{
32696 g_object_set (G_OBJECT (object), "hwmon", interface_, NULL);
32697}
32698
32699/**
Norman James362a80f2015-09-14 14:04:39 -050032700 * object_skeleton_set_fan:
32701 * @object: A #ObjectSkeleton.
32702 * @interface_: (allow-none): A #Fan or %NULL to clear the interface.
32703 *
32704 * 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.
32705 */
32706void object_skeleton_set_fan (ObjectSkeleton *object, Fan *interface_)
32707{
32708 g_object_set (G_OBJECT (object), "fan", interface_, NULL);
32709}
32710
32711/**
32712 * object_skeleton_set_sensor_value:
32713 * @object: A #ObjectSkeleton.
32714 * @interface_: (allow-none): A #SensorValue or %NULL to clear the interface.
32715 *
32716 * 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.
32717 */
32718void object_skeleton_set_sensor_value (ObjectSkeleton *object, SensorValue *interface_)
32719{
32720 g_object_set (G_OBJECT (object), "sensor-value", interface_, NULL);
32721}
32722
32723/**
32724 * object_skeleton_set_sensor_threshold:
32725 * @object: A #ObjectSkeleton.
32726 * @interface_: (allow-none): A #SensorThreshold or %NULL to clear the interface.
32727 *
32728 * 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.
32729 */
32730void object_skeleton_set_sensor_threshold (ObjectSkeleton *object, SensorThreshold *interface_)
32731{
32732 g_object_set (G_OBJECT (object), "sensor-threshold", interface_, NULL);
32733}
32734
32735/**
32736 * object_skeleton_set_sensor_i2c:
32737 * @object: A #ObjectSkeleton.
32738 * @interface_: (allow-none): A #SensorI2c or %NULL to clear the interface.
32739 *
32740 * 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.
32741 */
32742void object_skeleton_set_sensor_i2c (ObjectSkeleton *object, SensorI2c *interface_)
32743{
32744 g_object_set (G_OBJECT (object), "sensor-i2c", interface_, NULL);
32745}
32746
32747/**
32748 * object_skeleton_set_sensor_match:
32749 * @object: A #ObjectSkeleton.
32750 * @interface_: (allow-none): A #SensorMatch or %NULL to clear the interface.
32751 *
32752 * 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.
32753 */
32754void object_skeleton_set_sensor_match (ObjectSkeleton *object, SensorMatch *interface_)
32755{
32756 g_object_set (G_OBJECT (object), "sensor-match", interface_, NULL);
32757}
32758
32759/**
32760 * object_skeleton_set_process:
32761 * @object: A #ObjectSkeleton.
32762 * @interface_: (allow-none): A #Process or %NULL to clear the interface.
32763 *
32764 * 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.
32765 */
32766void object_skeleton_set_process (ObjectSkeleton *object, Process *interface_)
32767{
32768 g_object_set (G_OBJECT (object), "process", interface_, NULL);
32769}
32770
32771/**
Norman James18998182015-10-11 21:54:53 -050032772 * object_skeleton_set_shared_resource:
32773 * @object: A #ObjectSkeleton.
32774 * @interface_: (allow-none): A #SharedResource or %NULL to clear the interface.
32775 *
32776 * 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.
32777 */
32778void object_skeleton_set_shared_resource (ObjectSkeleton *object, SharedResource *interface_)
32779{
32780 g_object_set (G_OBJECT (object), "shared-resource", interface_, NULL);
32781}
32782
32783/**
Norman James362a80f2015-09-14 14:04:39 -050032784 * object_skeleton_set_control:
32785 * @object: A #ObjectSkeleton.
32786 * @interface_: (allow-none): A #Control or %NULL to clear the interface.
32787 *
32788 * 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.
32789 */
32790void object_skeleton_set_control (ObjectSkeleton *object, Control *interface_)
32791{
32792 g_object_set (G_OBJECT (object), "control", interface_, NULL);
32793}
32794
32795/**
32796 * object_skeleton_set_control_bmc:
32797 * @object: A #ObjectSkeleton.
32798 * @interface_: (allow-none): A #ControlBmc or %NULL to clear the interface.
32799 *
32800 * 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.
32801 */
32802void object_skeleton_set_control_bmc (ObjectSkeleton *object, ControlBmc *interface_)
32803{
32804 g_object_set (G_OBJECT (object), "control-bmc", interface_, NULL);
32805}
32806
32807/**
32808 * object_skeleton_set_control_host:
32809 * @object: A #ObjectSkeleton.
32810 * @interface_: (allow-none): A #ControlHost or %NULL to clear the interface.
32811 *
32812 * 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.
32813 */
32814void object_skeleton_set_control_host (ObjectSkeleton *object, ControlHost *interface_)
32815{
32816 g_object_set (G_OBJECT (object), "control-host", interface_, NULL);
32817}
32818
32819/**
32820 * object_skeleton_set_control_power:
32821 * @object: A #ObjectSkeleton.
32822 * @interface_: (allow-none): A #ControlPower or %NULL to clear the interface.
32823 *
32824 * 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.
32825 */
32826void object_skeleton_set_control_power (ObjectSkeleton *object, ControlPower *interface_)
32827{
32828 g_object_set (G_OBJECT (object), "control-power", interface_, NULL);
32829}
32830
32831/**
Adriana Kobylakfd778822016-06-16 09:08:37 -050032832 * object_skeleton_set_control_checkstop:
32833 * @object: A #ObjectSkeleton.
32834 * @interface_: (allow-none): A #ControlCheckstop or %NULL to clear the interface.
32835 *
32836 * Sets the #ControlCheckstop instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Checkstop.top_of_page">org.openbmc.control.Checkstop</link> on @object.
32837 */
32838void object_skeleton_set_control_checkstop (ObjectSkeleton *object, ControlCheckstop *interface_)
32839{
32840 g_object_set (G_OBJECT (object), "control-checkstop", interface_, NULL);
32841}
32842
32843/**
Norman James362a80f2015-09-14 14:04:39 -050032844 * object_skeleton_set_watchdog:
32845 * @object: A #ObjectSkeleton.
32846 * @interface_: (allow-none): A #Watchdog or %NULL to clear the interface.
32847 *
32848 * 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.
32849 */
32850void object_skeleton_set_watchdog (ObjectSkeleton *object, Watchdog *interface_)
32851{
32852 g_object_set (G_OBJECT (object), "watchdog", interface_, NULL);
32853}
32854
32855/**
32856 * object_skeleton_set_event_log:
32857 * @object: A #ObjectSkeleton.
32858 * @interface_: (allow-none): A #EventLog or %NULL to clear the interface.
32859 *
32860 * 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.
32861 */
32862void object_skeleton_set_event_log (ObjectSkeleton *object, EventLog *interface_)
32863{
32864 g_object_set (G_OBJECT (object), "event-log", interface_, NULL);
32865}
32866
32867/**
32868 * object_skeleton_set_flash:
32869 * @object: A #ObjectSkeleton.
32870 * @interface_: (allow-none): A #Flash or %NULL to clear the interface.
32871 *
32872 * 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.
32873 */
32874void object_skeleton_set_flash (ObjectSkeleton *object, Flash *interface_)
32875{
32876 g_object_set (G_OBJECT (object), "flash", interface_, NULL);
32877}
32878
32879/**
Norman James18998182015-10-11 21:54:53 -050032880 * object_skeleton_set_flash_control:
32881 * @object: A #ObjectSkeleton.
32882 * @interface_: (allow-none): A #FlashControl or %NULL to clear the interface.
32883 *
32884 * 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.
32885 */
32886void object_skeleton_set_flash_control (ObjectSkeleton *object, FlashControl *interface_)
32887{
32888 g_object_set (G_OBJECT (object), "flash-control", interface_, NULL);
32889}
32890
32891/**
Norman James362a80f2015-09-14 14:04:39 -050032892 * object_skeleton_set_button:
32893 * @object: A #ObjectSkeleton.
32894 * @interface_: (allow-none): A #Button or %NULL to clear the interface.
32895 *
32896 * 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.
32897 */
32898void object_skeleton_set_button (ObjectSkeleton *object, Button *interface_)
32899{
32900 g_object_set (G_OBJECT (object), "button", interface_, NULL);
32901}
32902
32903/**
32904 * object_skeleton_set_led:
32905 * @object: A #ObjectSkeleton.
32906 * @interface_: (allow-none): A #Led or %NULL to clear the interface.
32907 *
32908 * 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.
32909 */
32910void object_skeleton_set_led (ObjectSkeleton *object, Led *interface_)
32911{
32912 g_object_set (G_OBJECT (object), "led", interface_, NULL);
32913}
32914
Norman Jamesdbcffbd2015-10-06 16:53:06 -050032915/**
32916 * object_skeleton_set_host_ipmi:
32917 * @object: A #ObjectSkeleton.
32918 * @interface_: (allow-none): A #HostIpmi or %NULL to clear the interface.
32919 *
32920 * 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.
32921 */
32922void object_skeleton_set_host_ipmi (ObjectSkeleton *object, HostIpmi *interface_)
32923{
32924 g_object_set (G_OBJECT (object), "host-ipmi", interface_, NULL);
32925}
32926
Norman James362a80f2015-09-14 14:04:39 -050032927
32928/* ------------------------------------------------------------------------
32929 * Code for ObjectManager client
32930 * ------------------------------------------------------------------------
32931 */
32932
32933/**
32934 * SECTION:ObjectManagerClient
32935 * @title: ObjectManagerClient
32936 * @short_description: Generated GDBusObjectManagerClient type
32937 *
32938 * This section contains a #GDBusObjectManagerClient that uses object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc.
32939 */
32940
32941/**
32942 * ObjectManagerClient:
32943 *
32944 * The #ObjectManagerClient structure contains only private data and should only be accessed using the provided API.
32945 */
32946
32947/**
32948 * ObjectManagerClientClass:
32949 * @parent_class: The parent class.
32950 *
32951 * Class structure for #ObjectManagerClient.
32952 */
32953
32954G_DEFINE_TYPE (ObjectManagerClient, object_manager_client, G_TYPE_DBUS_OBJECT_MANAGER_CLIENT);
32955
32956static void
32957object_manager_client_init (ObjectManagerClient *manager G_GNUC_UNUSED)
32958{
32959}
32960
32961static void
32962object_manager_client_class_init (ObjectManagerClientClass *klass G_GNUC_UNUSED)
32963{
32964}
32965
32966/**
32967 * object_manager_client_get_proxy_type:
32968 * @manager: A #GDBusObjectManagerClient.
32969 * @object_path: The object path of the remote object (unused).
32970 * @interface_name: (allow-none): Interface name of the remote object or %NULL to get the object proxy #GType.
32971 * @user_data: User data (unused).
32972 *
32973 * A #GDBusProxyTypeFunc that maps @interface_name to the generated #GDBusObjectProxy<!-- -->- and #GDBusProxy<!-- -->-derived types.
32974 *
32975 * Returns: A #GDBusProxy<!-- -->-derived #GType if @interface_name is not %NULL, otherwise the #GType for #ObjectProxy.
32976 */
32977GType
32978object_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)
32979{
32980 static gsize once_init_value = 0;
32981 static GHashTable *lookup_hash;
32982 GType ret;
32983
32984 if (interface_name == NULL)
32985 return TYPE_OBJECT_PROXY;
32986 if (g_once_init_enter (&once_init_value))
32987 {
32988 lookup_hash = g_hash_table_new (g_str_hash, g_str_equal);
Norman James493996c2015-10-31 17:27:13 -050032989 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 -060032990 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Hwmon", GSIZE_TO_POINTER (TYPE_HWMON_PROXY));
Norman James362a80f2015-09-14 14:04:39 -050032991 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Fan", GSIZE_TO_POINTER (TYPE_FAN_PROXY));
32992 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorValue", GSIZE_TO_POINTER (TYPE_SENSOR_VALUE_PROXY));
Norman James362a80f2015-09-14 14:04:39 -050032993 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorThreshold", GSIZE_TO_POINTER (TYPE_SENSOR_THRESHOLD_PROXY));
32994 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorI2c", GSIZE_TO_POINTER (TYPE_SENSOR_I2C_PROXY));
32995 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorMatch", GSIZE_TO_POINTER (TYPE_SENSOR_MATCH_PROXY));
32996 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Process", GSIZE_TO_POINTER (TYPE_PROCESS_PROXY));
Norman James18998182015-10-11 21:54:53 -050032997 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SharedResource", GSIZE_TO_POINTER (TYPE_SHARED_RESOURCE_PROXY));
Norman James362a80f2015-09-14 14:04:39 -050032998 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Control", GSIZE_TO_POINTER (TYPE_CONTROL_PROXY));
32999 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.control.Bmc", GSIZE_TO_POINTER (TYPE_CONTROL_BMC_PROXY));
33000 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.control.Host", GSIZE_TO_POINTER (TYPE_CONTROL_HOST_PROXY));
33001 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.control.Power", GSIZE_TO_POINTER (TYPE_CONTROL_POWER_PROXY));
Adriana Kobylakfd778822016-06-16 09:08:37 -050033002 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.control.Checkstop", GSIZE_TO_POINTER (TYPE_CONTROL_CHECKSTOP_PROXY));
Norman James362a80f2015-09-14 14:04:39 -050033003 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Watchdog", GSIZE_TO_POINTER (TYPE_WATCHDOG_PROXY));
33004 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.EventLog", GSIZE_TO_POINTER (TYPE_EVENT_LOG_PROXY));
33005 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Flash", GSIZE_TO_POINTER (TYPE_FLASH_PROXY));
Norman James18998182015-10-11 21:54:53 -050033006 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.FlashControl", GSIZE_TO_POINTER (TYPE_FLASH_CONTROL_PROXY));
Norman James362a80f2015-09-14 14:04:39 -050033007 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Button", GSIZE_TO_POINTER (TYPE_BUTTON_PROXY));
33008 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Led", GSIZE_TO_POINTER (TYPE_LED_PROXY));
Norman Jamesdbcffbd2015-10-06 16:53:06 -050033009 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.HostIpmi", GSIZE_TO_POINTER (TYPE_HOST_IPMI_PROXY));
Norman James362a80f2015-09-14 14:04:39 -050033010 g_once_init_leave (&once_init_value, 1);
33011 }
33012 ret = (GType) GPOINTER_TO_SIZE (g_hash_table_lookup (lookup_hash, interface_name));
33013 if (ret == (GType) 0)
33014 ret = G_TYPE_DBUS_PROXY;
33015 return ret;
33016}
33017
33018/**
33019 * object_manager_client_new:
33020 * @connection: A #GDBusConnection.
33021 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
33022 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
33023 * @object_path: An object path.
33024 * @cancellable: (allow-none): A #GCancellable or %NULL.
33025 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
33026 * @user_data: User data to pass to @callback.
33027 *
33028 * Asynchronously creates #GDBusObjectManagerClient using object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new() for more details.
33029 *
33030 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
33031 * You can then call object_manager_client_new_finish() to get the result of the operation.
33032 *
33033 * See object_manager_client_new_sync() for the synchronous, blocking version of this constructor.
33034 */
33035void
33036object_manager_client_new (
33037 GDBusConnection *connection,
33038 GDBusObjectManagerClientFlags flags,
33039 const gchar *name,
33040 const gchar *object_path,
33041 GCancellable *cancellable,
33042 GAsyncReadyCallback callback,
33043 gpointer user_data)
33044{
33045 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);
33046}
33047
33048/**
33049 * object_manager_client_new_finish:
33050 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_manager_client_new().
33051 * @error: Return location for error or %NULL
33052 *
33053 * Finishes an operation started with object_manager_client_new().
33054 *
33055 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
33056 */
33057GDBusObjectManager *
33058object_manager_client_new_finish (
33059 GAsyncResult *res,
33060 GError **error)
33061{
33062 GObject *ret;
33063 GObject *source_object;
33064 source_object = g_async_result_get_source_object (res);
33065 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
33066 g_object_unref (source_object);
33067 if (ret != NULL)
33068 return G_DBUS_OBJECT_MANAGER (ret);
33069 else
33070 return NULL;
33071}
33072
33073/**
33074 * object_manager_client_new_sync:
33075 * @connection: A #GDBusConnection.
33076 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
33077 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
33078 * @object_path: An object path.
33079 * @cancellable: (allow-none): A #GCancellable or %NULL.
33080 * @error: Return location for error or %NULL
33081 *
33082 * Synchronously creates #GDBusObjectManagerClient using object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new_sync() for more details.
33083 *
33084 * The calling thread is blocked until a reply is received.
33085 *
33086 * See object_manager_client_new() for the asynchronous version of this constructor.
33087 *
33088 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
33089 */
33090GDBusObjectManager *
33091object_manager_client_new_sync (
33092 GDBusConnection *connection,
33093 GDBusObjectManagerClientFlags flags,
33094 const gchar *name,
33095 const gchar *object_path,
33096 GCancellable *cancellable,
33097 GError **error)
33098{
33099 GInitable *ret;
33100 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);
33101 if (ret != NULL)
33102 return G_DBUS_OBJECT_MANAGER (ret);
33103 else
33104 return NULL;
33105}
33106
33107
33108/**
33109 * object_manager_client_new_for_bus:
33110 * @bus_type: A #GBusType.
33111 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
33112 * @name: A bus name (well-known or unique).
33113 * @object_path: An object path.
33114 * @cancellable: (allow-none): A #GCancellable or %NULL.
33115 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
33116 * @user_data: User data to pass to @callback.
33117 *
33118 * Like object_manager_client_new() but takes a #GBusType instead of a #GDBusConnection.
33119 *
33120 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
33121 * You can then call object_manager_client_new_for_bus_finish() to get the result of the operation.
33122 *
33123 * See object_manager_client_new_for_bus_sync() for the synchronous, blocking version of this constructor.
33124 */
33125void
33126object_manager_client_new_for_bus (
33127 GBusType bus_type,
33128 GDBusObjectManagerClientFlags flags,
33129 const gchar *name,
33130 const gchar *object_path,
33131 GCancellable *cancellable,
33132 GAsyncReadyCallback callback,
33133 gpointer user_data)
33134{
33135 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);
33136}
33137
33138/**
33139 * object_manager_client_new_for_bus_finish:
33140 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_manager_client_new_for_bus().
33141 * @error: Return location for error or %NULL
33142 *
33143 * Finishes an operation started with object_manager_client_new_for_bus().
33144 *
33145 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
33146 */
33147GDBusObjectManager *
33148object_manager_client_new_for_bus_finish (
33149 GAsyncResult *res,
33150 GError **error)
33151{
33152 GObject *ret;
33153 GObject *source_object;
33154 source_object = g_async_result_get_source_object (res);
33155 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
33156 g_object_unref (source_object);
33157 if (ret != NULL)
33158 return G_DBUS_OBJECT_MANAGER (ret);
33159 else
33160 return NULL;
33161}
33162
33163/**
33164 * object_manager_client_new_for_bus_sync:
33165 * @bus_type: A #GBusType.
33166 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
33167 * @name: A bus name (well-known or unique).
33168 * @object_path: An object path.
33169 * @cancellable: (allow-none): A #GCancellable or %NULL.
33170 * @error: Return location for error or %NULL
33171 *
33172 * Like object_manager_client_new_sync() but takes a #GBusType instead of a #GDBusConnection.
33173 *
33174 * The calling thread is blocked until a reply is received.
33175 *
33176 * See object_manager_client_new_for_bus() for the asynchronous version of this constructor.
33177 *
33178 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
33179 */
33180GDBusObjectManager *
33181object_manager_client_new_for_bus_sync (
33182 GBusType bus_type,
33183 GDBusObjectManagerClientFlags flags,
33184 const gchar *name,
33185 const gchar *object_path,
33186 GCancellable *cancellable,
33187 GError **error)
33188{
33189 GInitable *ret;
33190 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);
33191 if (ret != NULL)
33192 return G_DBUS_OBJECT_MANAGER (ret);
33193 else
33194 return NULL;
33195}
33196
33197