blob: 1e163d5d85fdeabb65cf31a60eb4d7703af65f50 [file] [log] [blame]
Norman James362a80f2015-09-14 14:04:39 -05001/*
Adriana Kobylak2cb27752015-10-19 16:23:14 -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/* ------------------------------------------------------------------------
152 * Code for interface org.openbmc.Occ
153 * ------------------------------------------------------------------------
154 */
155
156/**
157 * SECTION:Occ
158 * @title: Occ
159 * @short_description: Generated C code for the org.openbmc.Occ D-Bus interface
160 *
161 * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-Occ.top_of_page">org.openbmc.Occ</link> D-Bus interface in C.
162 */
163
164/* ---- Introspection data for org.openbmc.Occ ---- */
165
166static const _ExtendedGDBusMethodInfo _occ_method_info_init =
167{
168 {
169 -1,
170 (gchar *) "init",
171 NULL,
172 NULL,
173 NULL
174 },
175 "handle-init",
176 FALSE
177};
178
179static const _ExtendedGDBusMethodInfo _occ_method_info_collect =
180{
181 {
182 -1,
183 (gchar *) "collect",
184 NULL,
185 NULL,
186 NULL
187 },
188 "handle-collect",
189 FALSE
190};
191
192static const _ExtendedGDBusMethodInfo * const _occ_method_info_pointers[] =
193{
194 &_occ_method_info_init,
195 &_occ_method_info_collect,
196 NULL
197};
198
199static const _ExtendedGDBusPropertyInfo _occ_property_info_state =
200{
201 {
202 -1,
203 (gchar *) "state",
204 (gchar *) "s",
205 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
206 NULL
207 },
208 "state",
209 FALSE
210};
211
Norman James2d1ee892015-09-16 23:13:45 -0500212static const _ExtendedGDBusPropertyInfo _occ_property_info_instance_name =
213{
214 {
215 -1,
216 (gchar *) "instance_name",
217 (gchar *) "s",
218 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
219 NULL
220 },
221 "instance-name",
222 FALSE
223};
224
Norman James362a80f2015-09-14 14:04:39 -0500225static const _ExtendedGDBusPropertyInfo _occ_property_info_poll_interval =
226{
227 {
228 -1,
229 (gchar *) "poll_interval",
230 (gchar *) "i",
231 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
232 NULL
233 },
234 "poll-interval",
235 FALSE
236};
237
238static const _ExtendedGDBusPropertyInfo * const _occ_property_info_pointers[] =
239{
240 &_occ_property_info_state,
Norman James2d1ee892015-09-16 23:13:45 -0500241 &_occ_property_info_instance_name,
Norman James362a80f2015-09-14 14:04:39 -0500242 &_occ_property_info_poll_interval,
243 NULL
244};
245
246static const _ExtendedGDBusInterfaceInfo _occ_interface_info =
247{
248 {
249 -1,
250 (gchar *) "org.openbmc.Occ",
251 (GDBusMethodInfo **) &_occ_method_info_pointers,
252 NULL,
253 (GDBusPropertyInfo **) &_occ_property_info_pointers,
254 NULL
255 },
256 "occ",
257};
258
259
260/**
261 * occ_interface_info:
262 *
263 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Occ.top_of_page">org.openbmc.Occ</link> D-Bus interface.
264 *
265 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
266 */
267GDBusInterfaceInfo *
268occ_interface_info (void)
269{
270 return (GDBusInterfaceInfo *) &_occ_interface_info.parent_struct;
271}
272
273/**
274 * occ_override_properties:
275 * @klass: The class structure for a #GObject<!-- -->-derived class.
276 * @property_id_begin: The property id to assign to the first overridden property.
277 *
278 * Overrides all #GObject properties in the #Occ interface for a concrete class.
279 * The properties are overridden in the order they are defined.
280 *
281 * Returns: The last property id.
282 */
283guint
284occ_override_properties (GObjectClass *klass, guint property_id_begin)
285{
286 g_object_class_override_property (klass, property_id_begin++, "state");
Norman James2d1ee892015-09-16 23:13:45 -0500287 g_object_class_override_property (klass, property_id_begin++, "instance-name");
Norman James362a80f2015-09-14 14:04:39 -0500288 g_object_class_override_property (klass, property_id_begin++, "poll-interval");
289 return property_id_begin - 1;
290}
291
292
293
294/**
295 * Occ:
296 *
297 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Occ.top_of_page">org.openbmc.Occ</link>.
298 */
299
300/**
301 * OccIface:
302 * @parent_iface: The parent interface.
303 * @handle_collect: Handler for the #Occ::handle-collect signal.
304 * @handle_init: Handler for the #Occ::handle-init signal.
Norman James2d1ee892015-09-16 23:13:45 -0500305 * @get_instance_name: Getter for the #Occ:instance-name property.
Norman James362a80f2015-09-14 14:04:39 -0500306 * @get_poll_interval: Getter for the #Occ:poll-interval property.
307 * @get_state: Getter for the #Occ:state property.
308 *
309 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Occ.top_of_page">org.openbmc.Occ</link>.
310 */
311
312typedef OccIface OccInterface;
313G_DEFINE_INTERFACE (Occ, occ, G_TYPE_OBJECT);
314
315static void
316occ_default_init (OccIface *iface)
317{
318 /* GObject signals for incoming D-Bus method calls: */
319 /**
320 * Occ::handle-init:
321 * @object: A #Occ.
322 * @invocation: A #GDBusMethodInvocation.
323 *
324 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Occ.init">init()</link> D-Bus method.
325 *
326 * 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 occ_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.
327 *
328 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
329 */
330 g_signal_new ("handle-init",
331 G_TYPE_FROM_INTERFACE (iface),
332 G_SIGNAL_RUN_LAST,
333 G_STRUCT_OFFSET (OccIface, handle_init),
334 g_signal_accumulator_true_handled,
335 NULL,
336 g_cclosure_marshal_generic,
337 G_TYPE_BOOLEAN,
338 1,
339 G_TYPE_DBUS_METHOD_INVOCATION);
340
341 /**
342 * Occ::handle-collect:
343 * @object: A #Occ.
344 * @invocation: A #GDBusMethodInvocation.
345 *
346 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Occ.collect">collect()</link> D-Bus method.
347 *
348 * 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 occ_complete_collect() 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.
349 *
350 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
351 */
352 g_signal_new ("handle-collect",
353 G_TYPE_FROM_INTERFACE (iface),
354 G_SIGNAL_RUN_LAST,
355 G_STRUCT_OFFSET (OccIface, handle_collect),
356 g_signal_accumulator_true_handled,
357 NULL,
358 g_cclosure_marshal_generic,
359 G_TYPE_BOOLEAN,
360 1,
361 G_TYPE_DBUS_METHOD_INVOCATION);
362
363 /* GObject properties for D-Bus properties: */
364 /**
365 * Occ:state:
366 *
367 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Occ.state">"state"</link>.
368 *
369 * 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.
370 */
371 g_object_interface_install_property (iface,
372 g_param_spec_string ("state", "state", "state", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
373 /**
Norman James2d1ee892015-09-16 23:13:45 -0500374 * Occ:instance-name:
375 *
376 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Occ.instance_name">"instance_name"</link>.
377 *
378 * 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.
379 */
380 g_object_interface_install_property (iface,
381 g_param_spec_string ("instance-name", "instance_name", "instance_name", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
382 /**
Norman James362a80f2015-09-14 14:04:39 -0500383 * Occ:poll-interval:
384 *
385 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Occ.poll_interval">"poll_interval"</link>.
386 *
387 * 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.
388 */
389 g_object_interface_install_property (iface,
390 g_param_spec_int ("poll-interval", "poll_interval", "poll_interval", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
391}
392
393/**
394 * occ_get_state: (skip)
395 * @object: A #Occ.
396 *
397 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Occ.state">"state"</link> D-Bus property.
398 *
399 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
400 *
401 * <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 occ_dup_state() if on another thread.</warning>
402 *
403 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
404 */
405const gchar *
406occ_get_state (Occ *object)
407{
408 return OCC_GET_IFACE (object)->get_state (object);
409}
410
411/**
412 * occ_dup_state: (skip)
413 * @object: A #Occ.
414 *
415 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Occ.state">"state"</link> D-Bus property.
416 *
417 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
418 *
419 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
420 */
421gchar *
422occ_dup_state (Occ *object)
423{
424 gchar *value;
425 g_object_get (G_OBJECT (object), "state", &value, NULL);
426 return value;
427}
428
429/**
430 * occ_set_state: (skip)
431 * @object: A #Occ.
432 * @value: The value to set.
433 *
434 * Sets the <link linkend="gdbus-property-org-openbmc-Occ.state">"state"</link> D-Bus property to @value.
435 *
436 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
437 */
438void
439occ_set_state (Occ *object, const gchar *value)
440{
441 g_object_set (G_OBJECT (object), "state", value, NULL);
442}
443
444/**
Norman James2d1ee892015-09-16 23:13:45 -0500445 * occ_get_instance_name: (skip)
446 * @object: A #Occ.
447 *
448 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Occ.instance_name">"instance_name"</link> D-Bus property.
449 *
450 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
451 *
452 * <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 occ_dup_instance_name() if on another thread.</warning>
453 *
454 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
455 */
456const gchar *
457occ_get_instance_name (Occ *object)
458{
459 return OCC_GET_IFACE (object)->get_instance_name (object);
460}
461
462/**
463 * occ_dup_instance_name: (skip)
464 * @object: A #Occ.
465 *
466 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Occ.instance_name">"instance_name"</link> D-Bus property.
467 *
468 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
469 *
470 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
471 */
472gchar *
473occ_dup_instance_name (Occ *object)
474{
475 gchar *value;
476 g_object_get (G_OBJECT (object), "instance-name", &value, NULL);
477 return value;
478}
479
480/**
481 * occ_set_instance_name: (skip)
482 * @object: A #Occ.
483 * @value: The value to set.
484 *
485 * Sets the <link linkend="gdbus-property-org-openbmc-Occ.instance_name">"instance_name"</link> D-Bus property to @value.
486 *
487 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
488 */
489void
490occ_set_instance_name (Occ *object, const gchar *value)
491{
492 g_object_set (G_OBJECT (object), "instance-name", value, NULL);
493}
494
495/**
Norman James362a80f2015-09-14 14:04:39 -0500496 * occ_get_poll_interval: (skip)
497 * @object: A #Occ.
498 *
499 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Occ.poll_interval">"poll_interval"</link> D-Bus property.
500 *
501 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
502 *
503 * Returns: The property value.
504 */
505gint
506occ_get_poll_interval (Occ *object)
507{
508 return OCC_GET_IFACE (object)->get_poll_interval (object);
509}
510
511/**
512 * occ_set_poll_interval: (skip)
513 * @object: A #Occ.
514 * @value: The value to set.
515 *
516 * Sets the <link linkend="gdbus-property-org-openbmc-Occ.poll_interval">"poll_interval"</link> D-Bus property to @value.
517 *
518 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
519 */
520void
521occ_set_poll_interval (Occ *object, gint value)
522{
523 g_object_set (G_OBJECT (object), "poll-interval", value, NULL);
524}
525
526/**
527 * occ_call_init:
528 * @proxy: A #OccProxy.
529 * @cancellable: (allow-none): A #GCancellable or %NULL.
530 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
531 * @user_data: User data to pass to @callback.
532 *
533 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Occ.init">init()</link> D-Bus method on @proxy.
534 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
535 * You can then call occ_call_init_finish() to get the result of the operation.
536 *
537 * See occ_call_init_sync() for the synchronous, blocking version of this method.
538 */
539void
540occ_call_init (
541 Occ *proxy,
542 GCancellable *cancellable,
543 GAsyncReadyCallback callback,
544 gpointer user_data)
545{
546 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
547 "init",
548 g_variant_new ("()"),
549 G_DBUS_CALL_FLAGS_NONE,
550 -1,
551 cancellable,
552 callback,
553 user_data);
554}
555
556/**
557 * occ_call_init_finish:
558 * @proxy: A #OccProxy.
559 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to occ_call_init().
560 * @error: Return location for error or %NULL.
561 *
562 * Finishes an operation started with occ_call_init().
563 *
564 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
565 */
566gboolean
567occ_call_init_finish (
568 Occ *proxy,
569 GAsyncResult *res,
570 GError **error)
571{
572 GVariant *_ret;
573 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
574 if (_ret == NULL)
575 goto _out;
576 g_variant_get (_ret,
577 "()");
578 g_variant_unref (_ret);
579_out:
580 return _ret != NULL;
581}
582
583/**
584 * occ_call_init_sync:
585 * @proxy: A #OccProxy.
586 * @cancellable: (allow-none): A #GCancellable or %NULL.
587 * @error: Return location for error or %NULL.
588 *
589 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Occ.init">init()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
590 *
591 * See occ_call_init() for the asynchronous version of this method.
592 *
593 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
594 */
595gboolean
596occ_call_init_sync (
597 Occ *proxy,
598 GCancellable *cancellable,
599 GError **error)
600{
601 GVariant *_ret;
602 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
603 "init",
604 g_variant_new ("()"),
605 G_DBUS_CALL_FLAGS_NONE,
606 -1,
607 cancellable,
608 error);
609 if (_ret == NULL)
610 goto _out;
611 g_variant_get (_ret,
612 "()");
613 g_variant_unref (_ret);
614_out:
615 return _ret != NULL;
616}
617
618/**
619 * occ_call_collect:
620 * @proxy: A #OccProxy.
621 * @cancellable: (allow-none): A #GCancellable or %NULL.
622 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
623 * @user_data: User data to pass to @callback.
624 *
625 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Occ.collect">collect()</link> D-Bus method on @proxy.
626 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
627 * You can then call occ_call_collect_finish() to get the result of the operation.
628 *
629 * See occ_call_collect_sync() for the synchronous, blocking version of this method.
630 */
631void
632occ_call_collect (
633 Occ *proxy,
634 GCancellable *cancellable,
635 GAsyncReadyCallback callback,
636 gpointer user_data)
637{
638 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
639 "collect",
640 g_variant_new ("()"),
641 G_DBUS_CALL_FLAGS_NONE,
642 -1,
643 cancellable,
644 callback,
645 user_data);
646}
647
648/**
649 * occ_call_collect_finish:
650 * @proxy: A #OccProxy.
651 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to occ_call_collect().
652 * @error: Return location for error or %NULL.
653 *
654 * Finishes an operation started with occ_call_collect().
655 *
656 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
657 */
658gboolean
659occ_call_collect_finish (
660 Occ *proxy,
661 GAsyncResult *res,
662 GError **error)
663{
664 GVariant *_ret;
665 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
666 if (_ret == NULL)
667 goto _out;
668 g_variant_get (_ret,
669 "()");
670 g_variant_unref (_ret);
671_out:
672 return _ret != NULL;
673}
674
675/**
676 * occ_call_collect_sync:
677 * @proxy: A #OccProxy.
678 * @cancellable: (allow-none): A #GCancellable or %NULL.
679 * @error: Return location for error or %NULL.
680 *
681 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Occ.collect">collect()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
682 *
683 * See occ_call_collect() for the asynchronous version of this method.
684 *
685 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
686 */
687gboolean
688occ_call_collect_sync (
689 Occ *proxy,
690 GCancellable *cancellable,
691 GError **error)
692{
693 GVariant *_ret;
694 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
695 "collect",
696 g_variant_new ("()"),
697 G_DBUS_CALL_FLAGS_NONE,
698 -1,
699 cancellable,
700 error);
701 if (_ret == NULL)
702 goto _out;
703 g_variant_get (_ret,
704 "()");
705 g_variant_unref (_ret);
706_out:
707 return _ret != NULL;
708}
709
710/**
711 * occ_complete_init:
712 * @object: A #Occ.
713 * @invocation: (transfer full): A #GDBusMethodInvocation.
714 *
715 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Occ.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.
716 *
717 * This method will free @invocation, you cannot use it afterwards.
718 */
719void
720occ_complete_init (
721 Occ *object,
722 GDBusMethodInvocation *invocation)
723{
724 g_dbus_method_invocation_return_value (invocation,
725 g_variant_new ("()"));
726}
727
728/**
729 * occ_complete_collect:
730 * @object: A #Occ.
731 * @invocation: (transfer full): A #GDBusMethodInvocation.
732 *
733 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Occ.collect">collect()</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.
734 *
735 * This method will free @invocation, you cannot use it afterwards.
736 */
737void
738occ_complete_collect (
739 Occ *object,
740 GDBusMethodInvocation *invocation)
741{
742 g_dbus_method_invocation_return_value (invocation,
743 g_variant_new ("()"));
744}
745
746/* ------------------------------------------------------------------------ */
747
748/**
749 * OccProxy:
750 *
751 * The #OccProxy structure contains only private data and should only be accessed using the provided API.
752 */
753
754/**
755 * OccProxyClass:
756 * @parent_class: The parent class.
757 *
758 * Class structure for #OccProxy.
759 */
760
761struct _OccProxyPrivate
762{
763 GData *qdata;
764};
765
766static void occ_proxy_iface_init (OccIface *iface);
767
768#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
769G_DEFINE_TYPE_WITH_CODE (OccProxy, occ_proxy, G_TYPE_DBUS_PROXY,
770 G_ADD_PRIVATE (OccProxy)
771 G_IMPLEMENT_INTERFACE (TYPE_OCC, occ_proxy_iface_init));
772
773#else
774G_DEFINE_TYPE_WITH_CODE (OccProxy, occ_proxy, G_TYPE_DBUS_PROXY,
775 G_IMPLEMENT_INTERFACE (TYPE_OCC, occ_proxy_iface_init));
776
777#endif
778static void
779occ_proxy_finalize (GObject *object)
780{
781 OccProxy *proxy = OCC_PROXY (object);
782 g_datalist_clear (&proxy->priv->qdata);
783 G_OBJECT_CLASS (occ_proxy_parent_class)->finalize (object);
784}
785
786static void
787occ_proxy_get_property (GObject *object,
788 guint prop_id,
789 GValue *value,
790 GParamSpec *pspec G_GNUC_UNUSED)
791{
792 const _ExtendedGDBusPropertyInfo *info;
793 GVariant *variant;
Norman James2d1ee892015-09-16 23:13:45 -0500794 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -0500795 info = _occ_property_info_pointers[prop_id - 1];
796 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
797 if (info->use_gvariant)
798 {
799 g_value_set_variant (value, variant);
800 }
801 else
802 {
803 if (variant != NULL)
804 g_dbus_gvariant_to_gvalue (variant, value);
805 }
806 if (variant != NULL)
807 g_variant_unref (variant);
808}
809
810static void
811occ_proxy_set_property_cb (GDBusProxy *proxy,
812 GAsyncResult *res,
813 gpointer user_data)
814{
815 const _ExtendedGDBusPropertyInfo *info = user_data;
816 GError *error;
817 GVariant *_ret;
818 error = NULL;
819 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
820 if (!_ret)
821 {
822 g_warning ("Error setting property '%s' on interface org.openbmc.Occ: %s (%s, %d)",
823 info->parent_struct.name,
824 error->message, g_quark_to_string (error->domain), error->code);
825 g_error_free (error);
826 }
827 else
828 {
829 g_variant_unref (_ret);
830 }
831}
832
833static void
834occ_proxy_set_property (GObject *object,
835 guint prop_id,
836 const GValue *value,
837 GParamSpec *pspec G_GNUC_UNUSED)
838{
839 const _ExtendedGDBusPropertyInfo *info;
840 GVariant *variant;
Norman James2d1ee892015-09-16 23:13:45 -0500841 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -0500842 info = _occ_property_info_pointers[prop_id - 1];
843 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
844 g_dbus_proxy_call (G_DBUS_PROXY (object),
845 "org.freedesktop.DBus.Properties.Set",
846 g_variant_new ("(ssv)", "org.openbmc.Occ", info->parent_struct.name, variant),
847 G_DBUS_CALL_FLAGS_NONE,
848 -1,
849 NULL, (GAsyncReadyCallback) occ_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
850 g_variant_unref (variant);
851}
852
853static void
854occ_proxy_g_signal (GDBusProxy *proxy,
855 const gchar *sender_name G_GNUC_UNUSED,
856 const gchar *signal_name,
857 GVariant *parameters)
858{
859 _ExtendedGDBusSignalInfo *info;
860 GVariantIter iter;
861 GVariant *child;
862 GValue *paramv;
863 guint num_params;
864 guint n;
865 guint signal_id;
866 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_occ_interface_info.parent_struct, signal_name);
867 if (info == NULL)
868 return;
869 num_params = g_variant_n_children (parameters);
870 paramv = g_new0 (GValue, num_params + 1);
871 g_value_init (&paramv[0], TYPE_OCC);
872 g_value_set_object (&paramv[0], proxy);
873 g_variant_iter_init (&iter, parameters);
874 n = 1;
875 while ((child = g_variant_iter_next_value (&iter)) != NULL)
876 {
877 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
878 if (arg_info->use_gvariant)
879 {
880 g_value_init (&paramv[n], G_TYPE_VARIANT);
881 g_value_set_variant (&paramv[n], child);
882 n++;
883 }
884 else
885 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
886 g_variant_unref (child);
887 }
888 signal_id = g_signal_lookup (info->signal_name, TYPE_OCC);
889 g_signal_emitv (paramv, signal_id, 0, NULL);
890 for (n = 0; n < num_params + 1; n++)
891 g_value_unset (&paramv[n]);
892 g_free (paramv);
893}
894
895static void
896occ_proxy_g_properties_changed (GDBusProxy *_proxy,
897 GVariant *changed_properties,
898 const gchar *const *invalidated_properties)
899{
900 OccProxy *proxy = OCC_PROXY (_proxy);
901 guint n;
902 const gchar *key;
903 GVariantIter *iter;
904 _ExtendedGDBusPropertyInfo *info;
905 g_variant_get (changed_properties, "a{sv}", &iter);
906 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
907 {
908 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_occ_interface_info.parent_struct, key);
909 g_datalist_remove_data (&proxy->priv->qdata, key);
910 if (info != NULL)
911 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
912 }
913 g_variant_iter_free (iter);
914 for (n = 0; invalidated_properties[n] != NULL; n++)
915 {
916 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_occ_interface_info.parent_struct, invalidated_properties[n]);
917 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
918 if (info != NULL)
919 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
920 }
921}
922
923static const gchar *
924occ_proxy_get_state (Occ *object)
925{
926 OccProxy *proxy = OCC_PROXY (object);
927 GVariant *variant;
928 const gchar *value = NULL;
929 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state");
930 if (variant != NULL)
931 {
932 value = g_variant_get_string (variant, NULL);
933 g_variant_unref (variant);
934 }
935 return value;
936}
937
Norman James2d1ee892015-09-16 23:13:45 -0500938static const gchar *
939occ_proxy_get_instance_name (Occ *object)
940{
941 OccProxy *proxy = OCC_PROXY (object);
942 GVariant *variant;
943 const gchar *value = NULL;
944 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "instance_name");
945 if (variant != NULL)
946 {
947 value = g_variant_get_string (variant, NULL);
948 g_variant_unref (variant);
949 }
950 return value;
951}
952
Norman James362a80f2015-09-14 14:04:39 -0500953static gint
954occ_proxy_get_poll_interval (Occ *object)
955{
956 OccProxy *proxy = OCC_PROXY (object);
957 GVariant *variant;
958 gint value = 0;
959 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "poll_interval");
960 if (variant != NULL)
961 {
962 value = g_variant_get_int32 (variant);
963 g_variant_unref (variant);
964 }
965 return value;
966}
967
968static void
969occ_proxy_init (OccProxy *proxy)
970{
971#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
972 proxy->priv = occ_proxy_get_instance_private (proxy);
973#else
974 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_OCC_PROXY, OccProxyPrivate);
975#endif
976
977 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), occ_interface_info ());
978}
979
980static void
981occ_proxy_class_init (OccProxyClass *klass)
982{
983 GObjectClass *gobject_class;
984 GDBusProxyClass *proxy_class;
985
986 gobject_class = G_OBJECT_CLASS (klass);
987 gobject_class->finalize = occ_proxy_finalize;
988 gobject_class->get_property = occ_proxy_get_property;
989 gobject_class->set_property = occ_proxy_set_property;
990
991 proxy_class = G_DBUS_PROXY_CLASS (klass);
992 proxy_class->g_signal = occ_proxy_g_signal;
993 proxy_class->g_properties_changed = occ_proxy_g_properties_changed;
994
995 occ_override_properties (gobject_class, 1);
996
997#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
998 g_type_class_add_private (klass, sizeof (OccProxyPrivate));
999#endif
1000}
1001
1002static void
1003occ_proxy_iface_init (OccIface *iface)
1004{
1005 iface->get_state = occ_proxy_get_state;
Norman James2d1ee892015-09-16 23:13:45 -05001006 iface->get_instance_name = occ_proxy_get_instance_name;
Norman James362a80f2015-09-14 14:04:39 -05001007 iface->get_poll_interval = occ_proxy_get_poll_interval;
1008}
1009
1010/**
1011 * occ_proxy_new:
1012 * @connection: A #GDBusConnection.
1013 * @flags: Flags from the #GDBusProxyFlags enumeration.
1014 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
1015 * @object_path: An object path.
1016 * @cancellable: (allow-none): A #GCancellable or %NULL.
1017 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
1018 * @user_data: User data to pass to @callback.
1019 *
1020 * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Occ.top_of_page">org.openbmc.Occ</link>. See g_dbus_proxy_new() for more details.
1021 *
1022 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
1023 * You can then call occ_proxy_new_finish() to get the result of the operation.
1024 *
1025 * See occ_proxy_new_sync() for the synchronous, blocking version of this constructor.
1026 */
1027void
1028occ_proxy_new (
1029 GDBusConnection *connection,
1030 GDBusProxyFlags flags,
1031 const gchar *name,
1032 const gchar *object_path,
1033 GCancellable *cancellable,
1034 GAsyncReadyCallback callback,
1035 gpointer user_data)
1036{
1037 g_async_initable_new_async (TYPE_OCC_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.Occ", NULL);
1038}
1039
1040/**
1041 * occ_proxy_new_finish:
1042 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to occ_proxy_new().
1043 * @error: Return location for error or %NULL
1044 *
1045 * Finishes an operation started with occ_proxy_new().
1046 *
1047 * Returns: (transfer full) (type OccProxy): The constructed proxy object or %NULL if @error is set.
1048 */
1049Occ *
1050occ_proxy_new_finish (
1051 GAsyncResult *res,
1052 GError **error)
1053{
1054 GObject *ret;
1055 GObject *source_object;
1056 source_object = g_async_result_get_source_object (res);
1057 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
1058 g_object_unref (source_object);
1059 if (ret != NULL)
1060 return OCC (ret);
1061 else
1062 return NULL;
1063}
1064
1065/**
1066 * occ_proxy_new_sync:
1067 * @connection: A #GDBusConnection.
1068 * @flags: Flags from the #GDBusProxyFlags enumeration.
1069 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
1070 * @object_path: An object path.
1071 * @cancellable: (allow-none): A #GCancellable or %NULL.
1072 * @error: Return location for error or %NULL
1073 *
1074 * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Occ.top_of_page">org.openbmc.Occ</link>. See g_dbus_proxy_new_sync() for more details.
1075 *
1076 * The calling thread is blocked until a reply is received.
1077 *
1078 * See occ_proxy_new() for the asynchronous version of this constructor.
1079 *
1080 * Returns: (transfer full) (type OccProxy): The constructed proxy object or %NULL if @error is set.
1081 */
1082Occ *
1083occ_proxy_new_sync (
1084 GDBusConnection *connection,
1085 GDBusProxyFlags flags,
1086 const gchar *name,
1087 const gchar *object_path,
1088 GCancellable *cancellable,
1089 GError **error)
1090{
1091 GInitable *ret;
1092 ret = g_initable_new (TYPE_OCC_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.Occ", NULL);
1093 if (ret != NULL)
1094 return OCC (ret);
1095 else
1096 return NULL;
1097}
1098
1099
1100/**
1101 * occ_proxy_new_for_bus:
1102 * @bus_type: A #GBusType.
1103 * @flags: Flags from the #GDBusProxyFlags enumeration.
1104 * @name: A bus name (well-known or unique).
1105 * @object_path: An object path.
1106 * @cancellable: (allow-none): A #GCancellable or %NULL.
1107 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
1108 * @user_data: User data to pass to @callback.
1109 *
1110 * Like occ_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
1111 *
1112 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
1113 * You can then call occ_proxy_new_for_bus_finish() to get the result of the operation.
1114 *
1115 * See occ_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
1116 */
1117void
1118occ_proxy_new_for_bus (
1119 GBusType bus_type,
1120 GDBusProxyFlags flags,
1121 const gchar *name,
1122 const gchar *object_path,
1123 GCancellable *cancellable,
1124 GAsyncReadyCallback callback,
1125 gpointer user_data)
1126{
1127 g_async_initable_new_async (TYPE_OCC_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.Occ", NULL);
1128}
1129
1130/**
1131 * occ_proxy_new_for_bus_finish:
1132 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to occ_proxy_new_for_bus().
1133 * @error: Return location for error or %NULL
1134 *
1135 * Finishes an operation started with occ_proxy_new_for_bus().
1136 *
1137 * Returns: (transfer full) (type OccProxy): The constructed proxy object or %NULL if @error is set.
1138 */
1139Occ *
1140occ_proxy_new_for_bus_finish (
1141 GAsyncResult *res,
1142 GError **error)
1143{
1144 GObject *ret;
1145 GObject *source_object;
1146 source_object = g_async_result_get_source_object (res);
1147 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
1148 g_object_unref (source_object);
1149 if (ret != NULL)
1150 return OCC (ret);
1151 else
1152 return NULL;
1153}
1154
1155/**
1156 * occ_proxy_new_for_bus_sync:
1157 * @bus_type: A #GBusType.
1158 * @flags: Flags from the #GDBusProxyFlags enumeration.
1159 * @name: A bus name (well-known or unique).
1160 * @object_path: An object path.
1161 * @cancellable: (allow-none): A #GCancellable or %NULL.
1162 * @error: Return location for error or %NULL
1163 *
1164 * Like occ_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
1165 *
1166 * The calling thread is blocked until a reply is received.
1167 *
1168 * See occ_proxy_new_for_bus() for the asynchronous version of this constructor.
1169 *
1170 * Returns: (transfer full) (type OccProxy): The constructed proxy object or %NULL if @error is set.
1171 */
1172Occ *
1173occ_proxy_new_for_bus_sync (
1174 GBusType bus_type,
1175 GDBusProxyFlags flags,
1176 const gchar *name,
1177 const gchar *object_path,
1178 GCancellable *cancellable,
1179 GError **error)
1180{
1181 GInitable *ret;
1182 ret = g_initable_new (TYPE_OCC_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.Occ", NULL);
1183 if (ret != NULL)
1184 return OCC (ret);
1185 else
1186 return NULL;
1187}
1188
1189
1190/* ------------------------------------------------------------------------ */
1191
1192/**
1193 * OccSkeleton:
1194 *
1195 * The #OccSkeleton structure contains only private data and should only be accessed using the provided API.
1196 */
1197
1198/**
1199 * OccSkeletonClass:
1200 * @parent_class: The parent class.
1201 *
1202 * Class structure for #OccSkeleton.
1203 */
1204
1205struct _OccSkeletonPrivate
1206{
1207 GValue *properties;
1208 GList *changed_properties;
1209 GSource *changed_properties_idle_source;
1210 GMainContext *context;
1211 GMutex lock;
1212};
1213
1214static void
1215_occ_skeleton_handle_method_call (
1216 GDBusConnection *connection G_GNUC_UNUSED,
1217 const gchar *sender G_GNUC_UNUSED,
1218 const gchar *object_path G_GNUC_UNUSED,
1219 const gchar *interface_name,
1220 const gchar *method_name,
1221 GVariant *parameters,
1222 GDBusMethodInvocation *invocation,
1223 gpointer user_data)
1224{
1225 OccSkeleton *skeleton = OCC_SKELETON (user_data);
1226 _ExtendedGDBusMethodInfo *info;
1227 GVariantIter iter;
1228 GVariant *child;
1229 GValue *paramv;
1230 guint num_params;
1231 guint num_extra;
1232 guint n;
1233 guint signal_id;
1234 GValue return_value = G_VALUE_INIT;
1235 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
1236 g_assert (info != NULL);
1237 num_params = g_variant_n_children (parameters);
1238 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
1239 n = 0;
1240 g_value_init (&paramv[n], TYPE_OCC);
1241 g_value_set_object (&paramv[n++], skeleton);
1242 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
1243 g_value_set_object (&paramv[n++], invocation);
1244 if (info->pass_fdlist)
1245 {
1246#ifdef G_OS_UNIX
1247 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
1248 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
1249#else
1250 g_assert_not_reached ();
1251#endif
1252 }
1253 g_variant_iter_init (&iter, parameters);
1254 while ((child = g_variant_iter_next_value (&iter)) != NULL)
1255 {
1256 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
1257 if (arg_info->use_gvariant)
1258 {
1259 g_value_init (&paramv[n], G_TYPE_VARIANT);
1260 g_value_set_variant (&paramv[n], child);
1261 n++;
1262 }
1263 else
1264 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
1265 g_variant_unref (child);
1266 }
1267 signal_id = g_signal_lookup (info->signal_name, TYPE_OCC);
1268 g_value_init (&return_value, G_TYPE_BOOLEAN);
1269 g_signal_emitv (paramv, signal_id, 0, &return_value);
1270 if (!g_value_get_boolean (&return_value))
1271 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);
1272 g_value_unset (&return_value);
1273 for (n = 0; n < num_params + num_extra; n++)
1274 g_value_unset (&paramv[n]);
1275 g_free (paramv);
1276}
1277
1278static GVariant *
1279_occ_skeleton_handle_get_property (
1280 GDBusConnection *connection G_GNUC_UNUSED,
1281 const gchar *sender G_GNUC_UNUSED,
1282 const gchar *object_path G_GNUC_UNUSED,
1283 const gchar *interface_name G_GNUC_UNUSED,
1284 const gchar *property_name,
1285 GError **error,
1286 gpointer user_data)
1287{
1288 OccSkeleton *skeleton = OCC_SKELETON (user_data);
1289 GValue value = G_VALUE_INIT;
1290 GParamSpec *pspec;
1291 _ExtendedGDBusPropertyInfo *info;
1292 GVariant *ret;
1293 ret = NULL;
1294 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_occ_interface_info.parent_struct, property_name);
1295 g_assert (info != NULL);
1296 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
1297 if (pspec == NULL)
1298 {
1299 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
1300 }
1301 else
1302 {
1303 g_value_init (&value, pspec->value_type);
1304 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
1305 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
1306 g_value_unset (&value);
1307 }
1308 return ret;
1309}
1310
1311static gboolean
1312_occ_skeleton_handle_set_property (
1313 GDBusConnection *connection G_GNUC_UNUSED,
1314 const gchar *sender G_GNUC_UNUSED,
1315 const gchar *object_path G_GNUC_UNUSED,
1316 const gchar *interface_name G_GNUC_UNUSED,
1317 const gchar *property_name,
1318 GVariant *variant,
1319 GError **error,
1320 gpointer user_data)
1321{
1322 OccSkeleton *skeleton = OCC_SKELETON (user_data);
1323 GValue value = G_VALUE_INIT;
1324 GParamSpec *pspec;
1325 _ExtendedGDBusPropertyInfo *info;
1326 gboolean ret;
1327 ret = FALSE;
1328 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_occ_interface_info.parent_struct, property_name);
1329 g_assert (info != NULL);
1330 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
1331 if (pspec == NULL)
1332 {
1333 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
1334 }
1335 else
1336 {
1337 if (info->use_gvariant)
1338 g_value_set_variant (&value, variant);
1339 else
1340 g_dbus_gvariant_to_gvalue (variant, &value);
1341 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
1342 g_value_unset (&value);
1343 ret = TRUE;
1344 }
1345 return ret;
1346}
1347
1348static const GDBusInterfaceVTable _occ_skeleton_vtable =
1349{
1350 _occ_skeleton_handle_method_call,
1351 _occ_skeleton_handle_get_property,
1352 _occ_skeleton_handle_set_property,
1353 {NULL}
1354};
1355
1356static GDBusInterfaceInfo *
1357occ_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
1358{
1359 return occ_interface_info ();
1360}
1361
1362static GDBusInterfaceVTable *
1363occ_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
1364{
1365 return (GDBusInterfaceVTable *) &_occ_skeleton_vtable;
1366}
1367
1368static GVariant *
1369occ_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
1370{
1371 OccSkeleton *skeleton = OCC_SKELETON (_skeleton);
1372
1373 GVariantBuilder builder;
1374 guint n;
1375 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
1376 if (_occ_interface_info.parent_struct.properties == NULL)
1377 goto out;
1378 for (n = 0; _occ_interface_info.parent_struct.properties[n] != NULL; n++)
1379 {
1380 GDBusPropertyInfo *info = _occ_interface_info.parent_struct.properties[n];
1381 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
1382 {
1383 GVariant *value;
1384 value = _occ_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.Occ", info->name, NULL, skeleton);
1385 if (value != NULL)
1386 {
1387 g_variant_take_ref (value);
1388 g_variant_builder_add (&builder, "{sv}", info->name, value);
1389 g_variant_unref (value);
1390 }
1391 }
1392 }
1393out:
1394 return g_variant_builder_end (&builder);
1395}
1396
1397static gboolean _occ_emit_changed (gpointer user_data);
1398
1399static void
1400occ_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
1401{
1402 OccSkeleton *skeleton = OCC_SKELETON (_skeleton);
1403 gboolean emit_changed = FALSE;
1404
1405 g_mutex_lock (&skeleton->priv->lock);
1406 if (skeleton->priv->changed_properties_idle_source != NULL)
1407 {
1408 g_source_destroy (skeleton->priv->changed_properties_idle_source);
1409 skeleton->priv->changed_properties_idle_source = NULL;
1410 emit_changed = TRUE;
1411 }
1412 g_mutex_unlock (&skeleton->priv->lock);
1413
1414 if (emit_changed)
1415 _occ_emit_changed (skeleton);
1416}
1417
1418static void occ_skeleton_iface_init (OccIface *iface);
1419#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
1420G_DEFINE_TYPE_WITH_CODE (OccSkeleton, occ_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
1421 G_ADD_PRIVATE (OccSkeleton)
1422 G_IMPLEMENT_INTERFACE (TYPE_OCC, occ_skeleton_iface_init));
1423
1424#else
1425G_DEFINE_TYPE_WITH_CODE (OccSkeleton, occ_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
1426 G_IMPLEMENT_INTERFACE (TYPE_OCC, occ_skeleton_iface_init));
1427
1428#endif
1429static void
1430occ_skeleton_finalize (GObject *object)
1431{
1432 OccSkeleton *skeleton = OCC_SKELETON (object);
1433 guint n;
Norman James2d1ee892015-09-16 23:13:45 -05001434 for (n = 0; n < 3; n++)
Norman James362a80f2015-09-14 14:04:39 -05001435 g_value_unset (&skeleton->priv->properties[n]);
1436 g_free (skeleton->priv->properties);
1437 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
1438 if (skeleton->priv->changed_properties_idle_source != NULL)
1439 g_source_destroy (skeleton->priv->changed_properties_idle_source);
1440 g_main_context_unref (skeleton->priv->context);
1441 g_mutex_clear (&skeleton->priv->lock);
1442 G_OBJECT_CLASS (occ_skeleton_parent_class)->finalize (object);
1443}
1444
1445static void
1446occ_skeleton_get_property (GObject *object,
1447 guint prop_id,
1448 GValue *value,
1449 GParamSpec *pspec G_GNUC_UNUSED)
1450{
1451 OccSkeleton *skeleton = OCC_SKELETON (object);
Norman James2d1ee892015-09-16 23:13:45 -05001452 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -05001453 g_mutex_lock (&skeleton->priv->lock);
1454 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
1455 g_mutex_unlock (&skeleton->priv->lock);
1456}
1457
1458static gboolean
1459_occ_emit_changed (gpointer user_data)
1460{
1461 OccSkeleton *skeleton = OCC_SKELETON (user_data);
1462 GList *l;
1463 GVariantBuilder builder;
1464 GVariantBuilder invalidated_builder;
1465 guint num_changes;
1466
1467 g_mutex_lock (&skeleton->priv->lock);
1468 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
1469 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
1470 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
1471 {
1472 ChangedProperty *cp = l->data;
1473 GVariant *variant;
1474 const GValue *cur_value;
1475
1476 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
1477 if (!_g_value_equal (cur_value, &cp->orig_value))
1478 {
1479 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
1480 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
1481 g_variant_unref (variant);
1482 num_changes++;
1483 }
1484 }
1485 if (num_changes > 0)
1486 {
1487 GList *connections, *ll;
1488 GVariant *signal_variant;
1489 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Occ",
1490 &builder, &invalidated_builder));
1491 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
1492 for (ll = connections; ll != NULL; ll = ll->next)
1493 {
1494 GDBusConnection *connection = ll->data;
1495
1496 g_dbus_connection_emit_signal (connection,
1497 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
1498 "org.freedesktop.DBus.Properties",
1499 "PropertiesChanged",
1500 signal_variant,
1501 NULL);
1502 }
1503 g_variant_unref (signal_variant);
1504 g_list_free_full (connections, g_object_unref);
1505 }
1506 else
1507 {
1508 g_variant_builder_clear (&builder);
1509 g_variant_builder_clear (&invalidated_builder);
1510 }
1511 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
1512 skeleton->priv->changed_properties = NULL;
1513 skeleton->priv->changed_properties_idle_source = NULL;
1514 g_mutex_unlock (&skeleton->priv->lock);
1515 return FALSE;
1516}
1517
1518static void
1519_occ_schedule_emit_changed (OccSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
1520{
1521 ChangedProperty *cp;
1522 GList *l;
1523 cp = NULL;
1524 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
1525 {
1526 ChangedProperty *i_cp = l->data;
1527 if (i_cp->info == info)
1528 {
1529 cp = i_cp;
1530 break;
1531 }
1532 }
1533 if (cp == NULL)
1534 {
1535 cp = g_new0 (ChangedProperty, 1);
1536 cp->prop_id = prop_id;
1537 cp->info = info;
1538 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
1539 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
1540 g_value_copy (orig_value, &cp->orig_value);
1541 }
1542}
1543
1544static void
1545occ_skeleton_notify (GObject *object,
1546 GParamSpec *pspec G_GNUC_UNUSED)
1547{
1548 OccSkeleton *skeleton = OCC_SKELETON (object);
1549 g_mutex_lock (&skeleton->priv->lock);
1550 if (skeleton->priv->changed_properties != NULL &&
1551 skeleton->priv->changed_properties_idle_source == NULL)
1552 {
1553 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
1554 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
1555 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _occ_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
Adriana Kobylak2cb27752015-10-19 16:23:14 -05001556 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _occ_emit_changed");
Norman James362a80f2015-09-14 14:04:39 -05001557 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
1558 g_source_unref (skeleton->priv->changed_properties_idle_source);
1559 }
1560 g_mutex_unlock (&skeleton->priv->lock);
1561}
1562
1563static void
1564occ_skeleton_set_property (GObject *object,
1565 guint prop_id,
1566 const GValue *value,
1567 GParamSpec *pspec)
1568{
1569 OccSkeleton *skeleton = OCC_SKELETON (object);
Norman James2d1ee892015-09-16 23:13:45 -05001570 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -05001571 g_mutex_lock (&skeleton->priv->lock);
1572 g_object_freeze_notify (object);
1573 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
1574 {
1575 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
1576 _occ_schedule_emit_changed (skeleton, _occ_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
1577 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
1578 g_object_notify_by_pspec (object, pspec);
1579 }
1580 g_mutex_unlock (&skeleton->priv->lock);
1581 g_object_thaw_notify (object);
1582}
1583
1584static void
1585occ_skeleton_init (OccSkeleton *skeleton)
1586{
1587#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
1588 skeleton->priv = occ_skeleton_get_instance_private (skeleton);
1589#else
1590 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_OCC_SKELETON, OccSkeletonPrivate);
1591#endif
1592
1593 g_mutex_init (&skeleton->priv->lock);
1594 skeleton->priv->context = g_main_context_ref_thread_default ();
Norman James2d1ee892015-09-16 23:13:45 -05001595 skeleton->priv->properties = g_new0 (GValue, 3);
Norman James362a80f2015-09-14 14:04:39 -05001596 g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING);
Norman James2d1ee892015-09-16 23:13:45 -05001597 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
1598 g_value_init (&skeleton->priv->properties[2], G_TYPE_INT);
Norman James362a80f2015-09-14 14:04:39 -05001599}
1600
1601static const gchar *
1602occ_skeleton_get_state (Occ *object)
1603{
1604 OccSkeleton *skeleton = OCC_SKELETON (object);
1605 const gchar *value;
1606 g_mutex_lock (&skeleton->priv->lock);
1607 value = g_value_get_string (&(skeleton->priv->properties[0]));
1608 g_mutex_unlock (&skeleton->priv->lock);
1609 return value;
1610}
1611
Norman James2d1ee892015-09-16 23:13:45 -05001612static const gchar *
1613occ_skeleton_get_instance_name (Occ *object)
1614{
1615 OccSkeleton *skeleton = OCC_SKELETON (object);
1616 const gchar *value;
1617 g_mutex_lock (&skeleton->priv->lock);
1618 value = g_value_get_string (&(skeleton->priv->properties[1]));
1619 g_mutex_unlock (&skeleton->priv->lock);
1620 return value;
1621}
1622
Norman James362a80f2015-09-14 14:04:39 -05001623static gint
1624occ_skeleton_get_poll_interval (Occ *object)
1625{
1626 OccSkeleton *skeleton = OCC_SKELETON (object);
1627 gint value;
1628 g_mutex_lock (&skeleton->priv->lock);
Norman James2d1ee892015-09-16 23:13:45 -05001629 value = g_value_get_int (&(skeleton->priv->properties[2]));
Norman James362a80f2015-09-14 14:04:39 -05001630 g_mutex_unlock (&skeleton->priv->lock);
1631 return value;
1632}
1633
1634static void
1635occ_skeleton_class_init (OccSkeletonClass *klass)
1636{
1637 GObjectClass *gobject_class;
1638 GDBusInterfaceSkeletonClass *skeleton_class;
1639
1640 gobject_class = G_OBJECT_CLASS (klass);
1641 gobject_class->finalize = occ_skeleton_finalize;
1642 gobject_class->get_property = occ_skeleton_get_property;
1643 gobject_class->set_property = occ_skeleton_set_property;
1644 gobject_class->notify = occ_skeleton_notify;
1645
1646
1647 occ_override_properties (gobject_class, 1);
1648
1649 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
1650 skeleton_class->get_info = occ_skeleton_dbus_interface_get_info;
1651 skeleton_class->get_properties = occ_skeleton_dbus_interface_get_properties;
1652 skeleton_class->flush = occ_skeleton_dbus_interface_flush;
1653 skeleton_class->get_vtable = occ_skeleton_dbus_interface_get_vtable;
1654
1655#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
1656 g_type_class_add_private (klass, sizeof (OccSkeletonPrivate));
1657#endif
1658}
1659
1660static void
1661occ_skeleton_iface_init (OccIface *iface)
1662{
1663 iface->get_state = occ_skeleton_get_state;
Norman James2d1ee892015-09-16 23:13:45 -05001664 iface->get_instance_name = occ_skeleton_get_instance_name;
Norman James362a80f2015-09-14 14:04:39 -05001665 iface->get_poll_interval = occ_skeleton_get_poll_interval;
1666}
1667
1668/**
1669 * occ_skeleton_new:
1670 *
1671 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Occ.top_of_page">org.openbmc.Occ</link>.
1672 *
1673 * Returns: (transfer full) (type OccSkeleton): The skeleton object.
1674 */
1675Occ *
1676occ_skeleton_new (void)
1677{
1678 return OCC (g_object_new (TYPE_OCC_SKELETON, NULL));
1679}
1680
1681/* ------------------------------------------------------------------------
1682 * Code for interface org.openbmc.Fan
1683 * ------------------------------------------------------------------------
1684 */
1685
1686/**
1687 * SECTION:Fan
1688 * @title: Fan
1689 * @short_description: Generated C code for the org.openbmc.Fan D-Bus interface
1690 *
1691 * 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.
1692 */
1693
1694/* ---- Introspection data for org.openbmc.Fan ---- */
1695
1696static const _ExtendedGDBusArgInfo _fan_method_info_set_cooling_zone_IN_ARG_cooling_zone =
1697{
1698 {
1699 -1,
1700 (gchar *) "cooling_zone",
1701 (gchar *) "i",
1702 NULL
1703 },
1704 FALSE
1705};
1706
1707static const _ExtendedGDBusArgInfo * const _fan_method_info_set_cooling_zone_IN_ARG_pointers[] =
1708{
1709 &_fan_method_info_set_cooling_zone_IN_ARG_cooling_zone,
1710 NULL
1711};
1712
1713static const _ExtendedGDBusMethodInfo _fan_method_info_set_cooling_zone =
1714{
1715 {
1716 -1,
1717 (gchar *) "setCoolingZone",
1718 (GDBusArgInfo **) &_fan_method_info_set_cooling_zone_IN_ARG_pointers,
1719 NULL,
1720 NULL
1721 },
1722 "handle-set-cooling-zone",
1723 FALSE
1724};
1725
1726static const _ExtendedGDBusArgInfo _fan_method_info_get_speed_OUT_ARG_speed =
1727{
1728 {
1729 -1,
1730 (gchar *) "speed",
1731 (gchar *) "i",
1732 NULL
1733 },
1734 FALSE
1735};
1736
1737static const _ExtendedGDBusArgInfo * const _fan_method_info_get_speed_OUT_ARG_pointers[] =
1738{
1739 &_fan_method_info_get_speed_OUT_ARG_speed,
1740 NULL
1741};
1742
1743static const _ExtendedGDBusMethodInfo _fan_method_info_get_speed =
1744{
1745 {
1746 -1,
1747 (gchar *) "getSpeed",
1748 NULL,
1749 (GDBusArgInfo **) &_fan_method_info_get_speed_OUT_ARG_pointers,
1750 NULL
1751 },
1752 "handle-get-speed",
1753 FALSE
1754};
1755
1756static const _ExtendedGDBusArgInfo _fan_method_info_set_speed_IN_ARG_speed =
1757{
1758 {
1759 -1,
1760 (gchar *) "speed",
1761 (gchar *) "i",
1762 NULL
1763 },
1764 FALSE
1765};
1766
1767static const _ExtendedGDBusArgInfo * const _fan_method_info_set_speed_IN_ARG_pointers[] =
1768{
1769 &_fan_method_info_set_speed_IN_ARG_speed,
1770 NULL
1771};
1772
1773static const _ExtendedGDBusMethodInfo _fan_method_info_set_speed =
1774{
1775 {
1776 -1,
1777 (gchar *) "setSpeed",
1778 (GDBusArgInfo **) &_fan_method_info_set_speed_IN_ARG_pointers,
1779 NULL,
1780 NULL
1781 },
1782 "handle-set-speed",
1783 FALSE
1784};
1785
1786static const _ExtendedGDBusMethodInfo * const _fan_method_info_pointers[] =
1787{
1788 &_fan_method_info_set_cooling_zone,
1789 &_fan_method_info_get_speed,
1790 &_fan_method_info_set_speed,
1791 NULL
1792};
1793
1794static const _ExtendedGDBusArgInfo _fan_signal_info_speed_changed_ARG_speed =
1795{
1796 {
1797 -1,
1798 (gchar *) "speed",
1799 (gchar *) "i",
1800 NULL
1801 },
1802 FALSE
1803};
1804
1805static const _ExtendedGDBusArgInfo * const _fan_signal_info_speed_changed_ARG_pointers[] =
1806{
1807 &_fan_signal_info_speed_changed_ARG_speed,
1808 NULL
1809};
1810
1811static const _ExtendedGDBusSignalInfo _fan_signal_info_speed_changed =
1812{
1813 {
1814 -1,
1815 (gchar *) "SpeedChanged",
1816 (GDBusArgInfo **) &_fan_signal_info_speed_changed_ARG_pointers,
1817 NULL
1818 },
1819 "speed-changed"
1820};
1821
1822static const _ExtendedGDBusSignalInfo _fan_signal_info_tach_error =
1823{
1824 {
1825 -1,
1826 (gchar *) "TachError",
1827 NULL,
1828 NULL
1829 },
1830 "tach-error"
1831};
1832
1833static const _ExtendedGDBusSignalInfo * const _fan_signal_info_pointers[] =
1834{
1835 &_fan_signal_info_speed_changed,
1836 &_fan_signal_info_tach_error,
1837 NULL
1838};
1839
1840static const _ExtendedGDBusPropertyInfo _fan_property_info_speed =
1841{
1842 {
1843 -1,
1844 (gchar *) "speed",
1845 (gchar *) "i",
1846 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
1847 NULL
1848 },
1849 "speed",
1850 FALSE
1851};
1852
1853static const _ExtendedGDBusPropertyInfo _fan_property_info_cooling_zone =
1854{
1855 {
1856 -1,
1857 (gchar *) "cooling_zone",
1858 (gchar *) "i",
1859 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
1860 NULL
1861 },
1862 "cooling-zone",
1863 FALSE
1864};
1865
1866static const _ExtendedGDBusPropertyInfo _fan_property_info_pwm_num =
1867{
1868 {
1869 -1,
1870 (gchar *) "pwm_num",
1871 (gchar *) "i",
1872 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
1873 NULL
1874 },
1875 "pwm-num",
1876 FALSE
1877};
1878
1879static const _ExtendedGDBusPropertyInfo * const _fan_property_info_pointers[] =
1880{
1881 &_fan_property_info_speed,
1882 &_fan_property_info_cooling_zone,
1883 &_fan_property_info_pwm_num,
1884 NULL
1885};
1886
1887static const _ExtendedGDBusInterfaceInfo _fan_interface_info =
1888{
1889 {
1890 -1,
1891 (gchar *) "org.openbmc.Fan",
1892 (GDBusMethodInfo **) &_fan_method_info_pointers,
1893 (GDBusSignalInfo **) &_fan_signal_info_pointers,
1894 (GDBusPropertyInfo **) &_fan_property_info_pointers,
1895 NULL
1896 },
1897 "fan",
1898};
1899
1900
1901/**
1902 * fan_interface_info:
1903 *
1904 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link> D-Bus interface.
1905 *
1906 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
1907 */
1908GDBusInterfaceInfo *
1909fan_interface_info (void)
1910{
1911 return (GDBusInterfaceInfo *) &_fan_interface_info.parent_struct;
1912}
1913
1914/**
1915 * fan_override_properties:
1916 * @klass: The class structure for a #GObject<!-- -->-derived class.
1917 * @property_id_begin: The property id to assign to the first overridden property.
1918 *
1919 * Overrides all #GObject properties in the #Fan interface for a concrete class.
1920 * The properties are overridden in the order they are defined.
1921 *
1922 * Returns: The last property id.
1923 */
1924guint
1925fan_override_properties (GObjectClass *klass, guint property_id_begin)
1926{
1927 g_object_class_override_property (klass, property_id_begin++, "speed");
1928 g_object_class_override_property (klass, property_id_begin++, "cooling-zone");
1929 g_object_class_override_property (klass, property_id_begin++, "pwm-num");
1930 return property_id_begin - 1;
1931}
1932
1933
1934
1935/**
1936 * Fan:
1937 *
1938 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link>.
1939 */
1940
1941/**
1942 * FanIface:
1943 * @parent_iface: The parent interface.
1944 * @handle_get_speed: Handler for the #Fan::handle-get-speed signal.
1945 * @handle_set_cooling_zone: Handler for the #Fan::handle-set-cooling-zone signal.
1946 * @handle_set_speed: Handler for the #Fan::handle-set-speed signal.
1947 * @get_cooling_zone: Getter for the #Fan:cooling-zone property.
1948 * @get_pwm_num: Getter for the #Fan:pwm-num property.
1949 * @get_speed: Getter for the #Fan:speed property.
1950 * @speed_changed: Handler for the #Fan::speed-changed signal.
1951 * @tach_error: Handler for the #Fan::tach-error signal.
1952 *
1953 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link>.
1954 */
1955
1956typedef FanIface FanInterface;
1957G_DEFINE_INTERFACE (Fan, fan, G_TYPE_OBJECT);
1958
1959static void
1960fan_default_init (FanIface *iface)
1961{
1962 /* GObject signals for incoming D-Bus method calls: */
1963 /**
1964 * Fan::handle-set-cooling-zone:
1965 * @object: A #Fan.
1966 * @invocation: A #GDBusMethodInvocation.
1967 * @arg_cooling_zone: Argument passed by remote caller.
1968 *
1969 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Fan.setCoolingZone">setCoolingZone()</link> D-Bus method.
1970 *
1971 * 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.
1972 *
1973 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
1974 */
1975 g_signal_new ("handle-set-cooling-zone",
1976 G_TYPE_FROM_INTERFACE (iface),
1977 G_SIGNAL_RUN_LAST,
1978 G_STRUCT_OFFSET (FanIface, handle_set_cooling_zone),
1979 g_signal_accumulator_true_handled,
1980 NULL,
1981 g_cclosure_marshal_generic,
1982 G_TYPE_BOOLEAN,
1983 2,
1984 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT);
1985
1986 /**
1987 * Fan::handle-get-speed:
1988 * @object: A #Fan.
1989 * @invocation: A #GDBusMethodInvocation.
1990 *
1991 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Fan.getSpeed">getSpeed()</link> D-Bus method.
1992 *
1993 * 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.
1994 *
1995 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
1996 */
1997 g_signal_new ("handle-get-speed",
1998 G_TYPE_FROM_INTERFACE (iface),
1999 G_SIGNAL_RUN_LAST,
2000 G_STRUCT_OFFSET (FanIface, handle_get_speed),
2001 g_signal_accumulator_true_handled,
2002 NULL,
2003 g_cclosure_marshal_generic,
2004 G_TYPE_BOOLEAN,
2005 1,
2006 G_TYPE_DBUS_METHOD_INVOCATION);
2007
2008 /**
2009 * Fan::handle-set-speed:
2010 * @object: A #Fan.
2011 * @invocation: A #GDBusMethodInvocation.
2012 * @arg_speed: Argument passed by remote caller.
2013 *
2014 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Fan.setSpeed">setSpeed()</link> D-Bus method.
2015 *
2016 * 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.
2017 *
2018 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
2019 */
2020 g_signal_new ("handle-set-speed",
2021 G_TYPE_FROM_INTERFACE (iface),
2022 G_SIGNAL_RUN_LAST,
2023 G_STRUCT_OFFSET (FanIface, handle_set_speed),
2024 g_signal_accumulator_true_handled,
2025 NULL,
2026 g_cclosure_marshal_generic,
2027 G_TYPE_BOOLEAN,
2028 2,
2029 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT);
2030
2031 /* GObject signals for received D-Bus signals: */
2032 /**
2033 * Fan::speed-changed:
2034 * @object: A #Fan.
2035 * @arg_speed: Argument.
2036 *
2037 * 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.
2038 *
2039 * 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.
2040 */
2041 g_signal_new ("speed-changed",
2042 G_TYPE_FROM_INTERFACE (iface),
2043 G_SIGNAL_RUN_LAST,
2044 G_STRUCT_OFFSET (FanIface, speed_changed),
2045 NULL,
2046 NULL,
2047 g_cclosure_marshal_generic,
2048 G_TYPE_NONE,
2049 1, G_TYPE_INT);
2050
2051 /**
2052 * Fan::tach-error:
2053 * @object: A #Fan.
2054 *
2055 * 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.
2056 *
2057 * 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.
2058 */
2059 g_signal_new ("tach-error",
2060 G_TYPE_FROM_INTERFACE (iface),
2061 G_SIGNAL_RUN_LAST,
2062 G_STRUCT_OFFSET (FanIface, tach_error),
2063 NULL,
2064 NULL,
2065 g_cclosure_marshal_generic,
2066 G_TYPE_NONE,
2067 0);
2068
2069 /* GObject properties for D-Bus properties: */
2070 /**
2071 * Fan:speed:
2072 *
2073 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fan.speed">"speed"</link>.
2074 *
2075 * 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.
2076 */
2077 g_object_interface_install_property (iface,
2078 g_param_spec_int ("speed", "speed", "speed", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
2079 /**
2080 * Fan:cooling-zone:
2081 *
2082 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fan.cooling_zone">"cooling_zone"</link>.
2083 *
2084 * 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.
2085 */
2086 g_object_interface_install_property (iface,
2087 g_param_spec_int ("cooling-zone", "cooling_zone", "cooling_zone", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
2088 /**
2089 * Fan:pwm-num:
2090 *
2091 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Fan.pwm_num">"pwm_num"</link>.
2092 *
2093 * 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.
2094 */
2095 g_object_interface_install_property (iface,
2096 g_param_spec_int ("pwm-num", "pwm_num", "pwm_num", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
2097}
2098
2099/**
2100 * fan_get_speed: (skip)
2101 * @object: A #Fan.
2102 *
2103 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fan.speed">"speed"</link> D-Bus property.
2104 *
2105 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
2106 *
2107 * Returns: The property value.
2108 */
2109gint
2110fan_get_speed (Fan *object)
2111{
2112 return FAN_GET_IFACE (object)->get_speed (object);
2113}
2114
2115/**
2116 * fan_set_speed: (skip)
2117 * @object: A #Fan.
2118 * @value: The value to set.
2119 *
2120 * Sets the <link linkend="gdbus-property-org-openbmc-Fan.speed">"speed"</link> D-Bus property to @value.
2121 *
2122 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
2123 */
2124void
2125fan_set_speed (Fan *object, gint value)
2126{
2127 g_object_set (G_OBJECT (object), "speed", value, NULL);
2128}
2129
2130/**
2131 * fan_get_cooling_zone: (skip)
2132 * @object: A #Fan.
2133 *
2134 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fan.cooling_zone">"cooling_zone"</link> D-Bus property.
2135 *
2136 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
2137 *
2138 * Returns: The property value.
2139 */
2140gint
2141fan_get_cooling_zone (Fan *object)
2142{
2143 return FAN_GET_IFACE (object)->get_cooling_zone (object);
2144}
2145
2146/**
2147 * fan_set_cooling_zone: (skip)
2148 * @object: A #Fan.
2149 * @value: The value to set.
2150 *
2151 * Sets the <link linkend="gdbus-property-org-openbmc-Fan.cooling_zone">"cooling_zone"</link> D-Bus property to @value.
2152 *
2153 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
2154 */
2155void
2156fan_set_cooling_zone (Fan *object, gint value)
2157{
2158 g_object_set (G_OBJECT (object), "cooling-zone", value, NULL);
2159}
2160
2161/**
2162 * fan_get_pwm_num: (skip)
2163 * @object: A #Fan.
2164 *
2165 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Fan.pwm_num">"pwm_num"</link> D-Bus property.
2166 *
2167 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
2168 *
2169 * Returns: The property value.
2170 */
2171gint
2172fan_get_pwm_num (Fan *object)
2173{
2174 return FAN_GET_IFACE (object)->get_pwm_num (object);
2175}
2176
2177/**
2178 * fan_set_pwm_num: (skip)
2179 * @object: A #Fan.
2180 * @value: The value to set.
2181 *
2182 * Sets the <link linkend="gdbus-property-org-openbmc-Fan.pwm_num">"pwm_num"</link> D-Bus property to @value.
2183 *
2184 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
2185 */
2186void
2187fan_set_pwm_num (Fan *object, gint value)
2188{
2189 g_object_set (G_OBJECT (object), "pwm-num", value, NULL);
2190}
2191
2192/**
2193 * fan_emit_speed_changed:
2194 * @object: A #Fan.
2195 * @arg_speed: Argument to pass with the signal.
2196 *
2197 * Emits the <link linkend="gdbus-signal-org-openbmc-Fan.SpeedChanged">"SpeedChanged"</link> D-Bus signal.
2198 */
2199void
2200fan_emit_speed_changed (
2201 Fan *object,
2202 gint arg_speed)
2203{
2204 g_signal_emit_by_name (object, "speed-changed", arg_speed);
2205}
2206
2207/**
2208 * fan_emit_tach_error:
2209 * @object: A #Fan.
2210 *
2211 * Emits the <link linkend="gdbus-signal-org-openbmc-Fan.TachError">"TachError"</link> D-Bus signal.
2212 */
2213void
2214fan_emit_tach_error (
2215 Fan *object)
2216{
2217 g_signal_emit_by_name (object, "tach-error");
2218}
2219
2220/**
2221 * fan_call_set_cooling_zone:
2222 * @proxy: A #FanProxy.
2223 * @arg_cooling_zone: Argument to pass with the method invocation.
2224 * @cancellable: (allow-none): A #GCancellable or %NULL.
2225 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
2226 * @user_data: User data to pass to @callback.
2227 *
2228 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Fan.setCoolingZone">setCoolingZone()</link> D-Bus method on @proxy.
2229 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
2230 * You can then call fan_call_set_cooling_zone_finish() to get the result of the operation.
2231 *
2232 * See fan_call_set_cooling_zone_sync() for the synchronous, blocking version of this method.
2233 */
2234void
2235fan_call_set_cooling_zone (
2236 Fan *proxy,
2237 gint arg_cooling_zone,
2238 GCancellable *cancellable,
2239 GAsyncReadyCallback callback,
2240 gpointer user_data)
2241{
2242 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
2243 "setCoolingZone",
2244 g_variant_new ("(i)",
2245 arg_cooling_zone),
2246 G_DBUS_CALL_FLAGS_NONE,
2247 -1,
2248 cancellable,
2249 callback,
2250 user_data);
2251}
2252
2253/**
2254 * fan_call_set_cooling_zone_finish:
2255 * @proxy: A #FanProxy.
2256 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_call_set_cooling_zone().
2257 * @error: Return location for error or %NULL.
2258 *
2259 * Finishes an operation started with fan_call_set_cooling_zone().
2260 *
2261 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
2262 */
2263gboolean
2264fan_call_set_cooling_zone_finish (
2265 Fan *proxy,
2266 GAsyncResult *res,
2267 GError **error)
2268{
2269 GVariant *_ret;
2270 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
2271 if (_ret == NULL)
2272 goto _out;
2273 g_variant_get (_ret,
2274 "()");
2275 g_variant_unref (_ret);
2276_out:
2277 return _ret != NULL;
2278}
2279
2280/**
2281 * fan_call_set_cooling_zone_sync:
2282 * @proxy: A #FanProxy.
2283 * @arg_cooling_zone: Argument to pass with the method invocation.
2284 * @cancellable: (allow-none): A #GCancellable or %NULL.
2285 * @error: Return location for error or %NULL.
2286 *
2287 * 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.
2288 *
2289 * See fan_call_set_cooling_zone() for the asynchronous version of this method.
2290 *
2291 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
2292 */
2293gboolean
2294fan_call_set_cooling_zone_sync (
2295 Fan *proxy,
2296 gint arg_cooling_zone,
2297 GCancellable *cancellable,
2298 GError **error)
2299{
2300 GVariant *_ret;
2301 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
2302 "setCoolingZone",
2303 g_variant_new ("(i)",
2304 arg_cooling_zone),
2305 G_DBUS_CALL_FLAGS_NONE,
2306 -1,
2307 cancellable,
2308 error);
2309 if (_ret == NULL)
2310 goto _out;
2311 g_variant_get (_ret,
2312 "()");
2313 g_variant_unref (_ret);
2314_out:
2315 return _ret != NULL;
2316}
2317
2318/**
2319 * fan_call_get_speed:
2320 * @proxy: A #FanProxy.
2321 * @cancellable: (allow-none): A #GCancellable or %NULL.
2322 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
2323 * @user_data: User data to pass to @callback.
2324 *
2325 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Fan.getSpeed">getSpeed()</link> D-Bus method on @proxy.
2326 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
2327 * You can then call fan_call_get_speed_finish() to get the result of the operation.
2328 *
2329 * See fan_call_get_speed_sync() for the synchronous, blocking version of this method.
2330 */
2331void
2332fan_call_get_speed (
2333 Fan *proxy,
2334 GCancellable *cancellable,
2335 GAsyncReadyCallback callback,
2336 gpointer user_data)
2337{
2338 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
2339 "getSpeed",
2340 g_variant_new ("()"),
2341 G_DBUS_CALL_FLAGS_NONE,
2342 -1,
2343 cancellable,
2344 callback,
2345 user_data);
2346}
2347
2348/**
2349 * fan_call_get_speed_finish:
2350 * @proxy: A #FanProxy.
2351 * @out_speed: (out): Return location for return parameter or %NULL to ignore.
2352 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_call_get_speed().
2353 * @error: Return location for error or %NULL.
2354 *
2355 * Finishes an operation started with fan_call_get_speed().
2356 *
2357 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
2358 */
2359gboolean
2360fan_call_get_speed_finish (
2361 Fan *proxy,
2362 gint *out_speed,
2363 GAsyncResult *res,
2364 GError **error)
2365{
2366 GVariant *_ret;
2367 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
2368 if (_ret == NULL)
2369 goto _out;
2370 g_variant_get (_ret,
2371 "(i)",
2372 out_speed);
2373 g_variant_unref (_ret);
2374_out:
2375 return _ret != NULL;
2376}
2377
2378/**
2379 * fan_call_get_speed_sync:
2380 * @proxy: A #FanProxy.
2381 * @out_speed: (out): Return location for return parameter or %NULL to ignore.
2382 * @cancellable: (allow-none): A #GCancellable or %NULL.
2383 * @error: Return location for error or %NULL.
2384 *
2385 * 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.
2386 *
2387 * See fan_call_get_speed() for the asynchronous version of this method.
2388 *
2389 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
2390 */
2391gboolean
2392fan_call_get_speed_sync (
2393 Fan *proxy,
2394 gint *out_speed,
2395 GCancellable *cancellable,
2396 GError **error)
2397{
2398 GVariant *_ret;
2399 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
2400 "getSpeed",
2401 g_variant_new ("()"),
2402 G_DBUS_CALL_FLAGS_NONE,
2403 -1,
2404 cancellable,
2405 error);
2406 if (_ret == NULL)
2407 goto _out;
2408 g_variant_get (_ret,
2409 "(i)",
2410 out_speed);
2411 g_variant_unref (_ret);
2412_out:
2413 return _ret != NULL;
2414}
2415
2416/**
2417 * fan_call_set_speed:
2418 * @proxy: A #FanProxy.
2419 * @arg_speed: Argument to pass with the method invocation.
2420 * @cancellable: (allow-none): A #GCancellable or %NULL.
2421 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
2422 * @user_data: User data to pass to @callback.
2423 *
2424 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Fan.setSpeed">setSpeed()</link> D-Bus method on @proxy.
2425 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
2426 * You can then call fan_call_set_speed_finish() to get the result of the operation.
2427 *
2428 * See fan_call_set_speed_sync() for the synchronous, blocking version of this method.
2429 */
2430void
2431fan_call_set_speed (
2432 Fan *proxy,
2433 gint arg_speed,
2434 GCancellable *cancellable,
2435 GAsyncReadyCallback callback,
2436 gpointer user_data)
2437{
2438 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
2439 "setSpeed",
2440 g_variant_new ("(i)",
2441 arg_speed),
2442 G_DBUS_CALL_FLAGS_NONE,
2443 -1,
2444 cancellable,
2445 callback,
2446 user_data);
2447}
2448
2449/**
2450 * fan_call_set_speed_finish:
2451 * @proxy: A #FanProxy.
2452 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_call_set_speed().
2453 * @error: Return location for error or %NULL.
2454 *
2455 * Finishes an operation started with fan_call_set_speed().
2456 *
2457 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
2458 */
2459gboolean
2460fan_call_set_speed_finish (
2461 Fan *proxy,
2462 GAsyncResult *res,
2463 GError **error)
2464{
2465 GVariant *_ret;
2466 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
2467 if (_ret == NULL)
2468 goto _out;
2469 g_variant_get (_ret,
2470 "()");
2471 g_variant_unref (_ret);
2472_out:
2473 return _ret != NULL;
2474}
2475
2476/**
2477 * fan_call_set_speed_sync:
2478 * @proxy: A #FanProxy.
2479 * @arg_speed: Argument to pass with the method invocation.
2480 * @cancellable: (allow-none): A #GCancellable or %NULL.
2481 * @error: Return location for error or %NULL.
2482 *
2483 * 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.
2484 *
2485 * See fan_call_set_speed() for the asynchronous version of this method.
2486 *
2487 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
2488 */
2489gboolean
2490fan_call_set_speed_sync (
2491 Fan *proxy,
2492 gint arg_speed,
2493 GCancellable *cancellable,
2494 GError **error)
2495{
2496 GVariant *_ret;
2497 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
2498 "setSpeed",
2499 g_variant_new ("(i)",
2500 arg_speed),
2501 G_DBUS_CALL_FLAGS_NONE,
2502 -1,
2503 cancellable,
2504 error);
2505 if (_ret == NULL)
2506 goto _out;
2507 g_variant_get (_ret,
2508 "()");
2509 g_variant_unref (_ret);
2510_out:
2511 return _ret != NULL;
2512}
2513
2514/**
2515 * fan_complete_set_cooling_zone:
2516 * @object: A #Fan.
2517 * @invocation: (transfer full): A #GDBusMethodInvocation.
2518 *
2519 * 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.
2520 *
2521 * This method will free @invocation, you cannot use it afterwards.
2522 */
2523void
2524fan_complete_set_cooling_zone (
2525 Fan *object,
2526 GDBusMethodInvocation *invocation)
2527{
2528 g_dbus_method_invocation_return_value (invocation,
2529 g_variant_new ("()"));
2530}
2531
2532/**
2533 * fan_complete_get_speed:
2534 * @object: A #Fan.
2535 * @invocation: (transfer full): A #GDBusMethodInvocation.
2536 * @speed: Parameter to return.
2537 *
2538 * 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.
2539 *
2540 * This method will free @invocation, you cannot use it afterwards.
2541 */
2542void
2543fan_complete_get_speed (
2544 Fan *object,
2545 GDBusMethodInvocation *invocation,
2546 gint speed)
2547{
2548 g_dbus_method_invocation_return_value (invocation,
2549 g_variant_new ("(i)",
2550 speed));
2551}
2552
2553/**
2554 * fan_complete_set_speed:
2555 * @object: A #Fan.
2556 * @invocation: (transfer full): A #GDBusMethodInvocation.
2557 *
2558 * 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.
2559 *
2560 * This method will free @invocation, you cannot use it afterwards.
2561 */
2562void
2563fan_complete_set_speed (
2564 Fan *object,
2565 GDBusMethodInvocation *invocation)
2566{
2567 g_dbus_method_invocation_return_value (invocation,
2568 g_variant_new ("()"));
2569}
2570
2571/* ------------------------------------------------------------------------ */
2572
2573/**
2574 * FanProxy:
2575 *
2576 * The #FanProxy structure contains only private data and should only be accessed using the provided API.
2577 */
2578
2579/**
2580 * FanProxyClass:
2581 * @parent_class: The parent class.
2582 *
2583 * Class structure for #FanProxy.
2584 */
2585
2586struct _FanProxyPrivate
2587{
2588 GData *qdata;
2589};
2590
2591static void fan_proxy_iface_init (FanIface *iface);
2592
2593#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
2594G_DEFINE_TYPE_WITH_CODE (FanProxy, fan_proxy, G_TYPE_DBUS_PROXY,
2595 G_ADD_PRIVATE (FanProxy)
2596 G_IMPLEMENT_INTERFACE (TYPE_FAN, fan_proxy_iface_init));
2597
2598#else
2599G_DEFINE_TYPE_WITH_CODE (FanProxy, fan_proxy, G_TYPE_DBUS_PROXY,
2600 G_IMPLEMENT_INTERFACE (TYPE_FAN, fan_proxy_iface_init));
2601
2602#endif
2603static void
2604fan_proxy_finalize (GObject *object)
2605{
2606 FanProxy *proxy = FAN_PROXY (object);
2607 g_datalist_clear (&proxy->priv->qdata);
2608 G_OBJECT_CLASS (fan_proxy_parent_class)->finalize (object);
2609}
2610
2611static void
2612fan_proxy_get_property (GObject *object,
2613 guint prop_id,
2614 GValue *value,
2615 GParamSpec *pspec G_GNUC_UNUSED)
2616{
2617 const _ExtendedGDBusPropertyInfo *info;
2618 GVariant *variant;
2619 g_assert (prop_id != 0 && prop_id - 1 < 3);
2620 info = _fan_property_info_pointers[prop_id - 1];
2621 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
2622 if (info->use_gvariant)
2623 {
2624 g_value_set_variant (value, variant);
2625 }
2626 else
2627 {
2628 if (variant != NULL)
2629 g_dbus_gvariant_to_gvalue (variant, value);
2630 }
2631 if (variant != NULL)
2632 g_variant_unref (variant);
2633}
2634
2635static void
2636fan_proxy_set_property_cb (GDBusProxy *proxy,
2637 GAsyncResult *res,
2638 gpointer user_data)
2639{
2640 const _ExtendedGDBusPropertyInfo *info = user_data;
2641 GError *error;
2642 GVariant *_ret;
2643 error = NULL;
2644 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
2645 if (!_ret)
2646 {
2647 g_warning ("Error setting property '%s' on interface org.openbmc.Fan: %s (%s, %d)",
2648 info->parent_struct.name,
2649 error->message, g_quark_to_string (error->domain), error->code);
2650 g_error_free (error);
2651 }
2652 else
2653 {
2654 g_variant_unref (_ret);
2655 }
2656}
2657
2658static void
2659fan_proxy_set_property (GObject *object,
2660 guint prop_id,
2661 const GValue *value,
2662 GParamSpec *pspec G_GNUC_UNUSED)
2663{
2664 const _ExtendedGDBusPropertyInfo *info;
2665 GVariant *variant;
2666 g_assert (prop_id != 0 && prop_id - 1 < 3);
2667 info = _fan_property_info_pointers[prop_id - 1];
2668 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
2669 g_dbus_proxy_call (G_DBUS_PROXY (object),
2670 "org.freedesktop.DBus.Properties.Set",
2671 g_variant_new ("(ssv)", "org.openbmc.Fan", info->parent_struct.name, variant),
2672 G_DBUS_CALL_FLAGS_NONE,
2673 -1,
2674 NULL, (GAsyncReadyCallback) fan_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
2675 g_variant_unref (variant);
2676}
2677
2678static void
2679fan_proxy_g_signal (GDBusProxy *proxy,
2680 const gchar *sender_name G_GNUC_UNUSED,
2681 const gchar *signal_name,
2682 GVariant *parameters)
2683{
2684 _ExtendedGDBusSignalInfo *info;
2685 GVariantIter iter;
2686 GVariant *child;
2687 GValue *paramv;
2688 guint num_params;
2689 guint n;
2690 guint signal_id;
2691 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, signal_name);
2692 if (info == NULL)
2693 return;
2694 num_params = g_variant_n_children (parameters);
2695 paramv = g_new0 (GValue, num_params + 1);
2696 g_value_init (&paramv[0], TYPE_FAN);
2697 g_value_set_object (&paramv[0], proxy);
2698 g_variant_iter_init (&iter, parameters);
2699 n = 1;
2700 while ((child = g_variant_iter_next_value (&iter)) != NULL)
2701 {
2702 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
2703 if (arg_info->use_gvariant)
2704 {
2705 g_value_init (&paramv[n], G_TYPE_VARIANT);
2706 g_value_set_variant (&paramv[n], child);
2707 n++;
2708 }
2709 else
2710 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
2711 g_variant_unref (child);
2712 }
2713 signal_id = g_signal_lookup (info->signal_name, TYPE_FAN);
2714 g_signal_emitv (paramv, signal_id, 0, NULL);
2715 for (n = 0; n < num_params + 1; n++)
2716 g_value_unset (&paramv[n]);
2717 g_free (paramv);
2718}
2719
2720static void
2721fan_proxy_g_properties_changed (GDBusProxy *_proxy,
2722 GVariant *changed_properties,
2723 const gchar *const *invalidated_properties)
2724{
2725 FanProxy *proxy = FAN_PROXY (_proxy);
2726 guint n;
2727 const gchar *key;
2728 GVariantIter *iter;
2729 _ExtendedGDBusPropertyInfo *info;
2730 g_variant_get (changed_properties, "a{sv}", &iter);
2731 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
2732 {
2733 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, key);
2734 g_datalist_remove_data (&proxy->priv->qdata, key);
2735 if (info != NULL)
2736 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
2737 }
2738 g_variant_iter_free (iter);
2739 for (n = 0; invalidated_properties[n] != NULL; n++)
2740 {
2741 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, invalidated_properties[n]);
2742 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
2743 if (info != NULL)
2744 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
2745 }
2746}
2747
2748static gint
2749fan_proxy_get_speed (Fan *object)
2750{
2751 FanProxy *proxy = FAN_PROXY (object);
2752 GVariant *variant;
2753 gint value = 0;
2754 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "speed");
2755 if (variant != NULL)
2756 {
2757 value = g_variant_get_int32 (variant);
2758 g_variant_unref (variant);
2759 }
2760 return value;
2761}
2762
2763static gint
2764fan_proxy_get_cooling_zone (Fan *object)
2765{
2766 FanProxy *proxy = FAN_PROXY (object);
2767 GVariant *variant;
2768 gint value = 0;
2769 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "cooling_zone");
2770 if (variant != NULL)
2771 {
2772 value = g_variant_get_int32 (variant);
2773 g_variant_unref (variant);
2774 }
2775 return value;
2776}
2777
2778static gint
2779fan_proxy_get_pwm_num (Fan *object)
2780{
2781 FanProxy *proxy = FAN_PROXY (object);
2782 GVariant *variant;
2783 gint value = 0;
2784 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "pwm_num");
2785 if (variant != NULL)
2786 {
2787 value = g_variant_get_int32 (variant);
2788 g_variant_unref (variant);
2789 }
2790 return value;
2791}
2792
2793static void
2794fan_proxy_init (FanProxy *proxy)
2795{
2796#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
2797 proxy->priv = fan_proxy_get_instance_private (proxy);
2798#else
2799 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_FAN_PROXY, FanProxyPrivate);
2800#endif
2801
2802 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), fan_interface_info ());
2803}
2804
2805static void
2806fan_proxy_class_init (FanProxyClass *klass)
2807{
2808 GObjectClass *gobject_class;
2809 GDBusProxyClass *proxy_class;
2810
2811 gobject_class = G_OBJECT_CLASS (klass);
2812 gobject_class->finalize = fan_proxy_finalize;
2813 gobject_class->get_property = fan_proxy_get_property;
2814 gobject_class->set_property = fan_proxy_set_property;
2815
2816 proxy_class = G_DBUS_PROXY_CLASS (klass);
2817 proxy_class->g_signal = fan_proxy_g_signal;
2818 proxy_class->g_properties_changed = fan_proxy_g_properties_changed;
2819
2820 fan_override_properties (gobject_class, 1);
2821
2822#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
2823 g_type_class_add_private (klass, sizeof (FanProxyPrivate));
2824#endif
2825}
2826
2827static void
2828fan_proxy_iface_init (FanIface *iface)
2829{
2830 iface->get_speed = fan_proxy_get_speed;
2831 iface->get_cooling_zone = fan_proxy_get_cooling_zone;
2832 iface->get_pwm_num = fan_proxy_get_pwm_num;
2833}
2834
2835/**
2836 * fan_proxy_new:
2837 * @connection: A #GDBusConnection.
2838 * @flags: Flags from the #GDBusProxyFlags enumeration.
2839 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
2840 * @object_path: An object path.
2841 * @cancellable: (allow-none): A #GCancellable or %NULL.
2842 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
2843 * @user_data: User data to pass to @callback.
2844 *
2845 * 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.
2846 *
2847 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
2848 * You can then call fan_proxy_new_finish() to get the result of the operation.
2849 *
2850 * See fan_proxy_new_sync() for the synchronous, blocking version of this constructor.
2851 */
2852void
2853fan_proxy_new (
2854 GDBusConnection *connection,
2855 GDBusProxyFlags flags,
2856 const gchar *name,
2857 const gchar *object_path,
2858 GCancellable *cancellable,
2859 GAsyncReadyCallback callback,
2860 gpointer user_data)
2861{
2862 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);
2863}
2864
2865/**
2866 * fan_proxy_new_finish:
2867 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_proxy_new().
2868 * @error: Return location for error or %NULL
2869 *
2870 * Finishes an operation started with fan_proxy_new().
2871 *
2872 * Returns: (transfer full) (type FanProxy): The constructed proxy object or %NULL if @error is set.
2873 */
2874Fan *
2875fan_proxy_new_finish (
2876 GAsyncResult *res,
2877 GError **error)
2878{
2879 GObject *ret;
2880 GObject *source_object;
2881 source_object = g_async_result_get_source_object (res);
2882 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
2883 g_object_unref (source_object);
2884 if (ret != NULL)
2885 return FAN (ret);
2886 else
2887 return NULL;
2888}
2889
2890/**
2891 * fan_proxy_new_sync:
2892 * @connection: A #GDBusConnection.
2893 * @flags: Flags from the #GDBusProxyFlags enumeration.
2894 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
2895 * @object_path: An object path.
2896 * @cancellable: (allow-none): A #GCancellable or %NULL.
2897 * @error: Return location for error or %NULL
2898 *
2899 * 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.
2900 *
2901 * The calling thread is blocked until a reply is received.
2902 *
2903 * See fan_proxy_new() for the asynchronous version of this constructor.
2904 *
2905 * Returns: (transfer full) (type FanProxy): The constructed proxy object or %NULL if @error is set.
2906 */
2907Fan *
2908fan_proxy_new_sync (
2909 GDBusConnection *connection,
2910 GDBusProxyFlags flags,
2911 const gchar *name,
2912 const gchar *object_path,
2913 GCancellable *cancellable,
2914 GError **error)
2915{
2916 GInitable *ret;
2917 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);
2918 if (ret != NULL)
2919 return FAN (ret);
2920 else
2921 return NULL;
2922}
2923
2924
2925/**
2926 * fan_proxy_new_for_bus:
2927 * @bus_type: A #GBusType.
2928 * @flags: Flags from the #GDBusProxyFlags enumeration.
2929 * @name: A bus name (well-known or unique).
2930 * @object_path: An object path.
2931 * @cancellable: (allow-none): A #GCancellable or %NULL.
2932 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
2933 * @user_data: User data to pass to @callback.
2934 *
2935 * Like fan_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
2936 *
2937 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
2938 * You can then call fan_proxy_new_for_bus_finish() to get the result of the operation.
2939 *
2940 * See fan_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
2941 */
2942void
2943fan_proxy_new_for_bus (
2944 GBusType bus_type,
2945 GDBusProxyFlags flags,
2946 const gchar *name,
2947 const gchar *object_path,
2948 GCancellable *cancellable,
2949 GAsyncReadyCallback callback,
2950 gpointer user_data)
2951{
2952 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);
2953}
2954
2955/**
2956 * fan_proxy_new_for_bus_finish:
2957 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to fan_proxy_new_for_bus().
2958 * @error: Return location for error or %NULL
2959 *
2960 * Finishes an operation started with fan_proxy_new_for_bus().
2961 *
2962 * Returns: (transfer full) (type FanProxy): The constructed proxy object or %NULL if @error is set.
2963 */
2964Fan *
2965fan_proxy_new_for_bus_finish (
2966 GAsyncResult *res,
2967 GError **error)
2968{
2969 GObject *ret;
2970 GObject *source_object;
2971 source_object = g_async_result_get_source_object (res);
2972 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
2973 g_object_unref (source_object);
2974 if (ret != NULL)
2975 return FAN (ret);
2976 else
2977 return NULL;
2978}
2979
2980/**
2981 * fan_proxy_new_for_bus_sync:
2982 * @bus_type: A #GBusType.
2983 * @flags: Flags from the #GDBusProxyFlags enumeration.
2984 * @name: A bus name (well-known or unique).
2985 * @object_path: An object path.
2986 * @cancellable: (allow-none): A #GCancellable or %NULL.
2987 * @error: Return location for error or %NULL
2988 *
2989 * Like fan_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
2990 *
2991 * The calling thread is blocked until a reply is received.
2992 *
2993 * See fan_proxy_new_for_bus() for the asynchronous version of this constructor.
2994 *
2995 * Returns: (transfer full) (type FanProxy): The constructed proxy object or %NULL if @error is set.
2996 */
2997Fan *
2998fan_proxy_new_for_bus_sync (
2999 GBusType bus_type,
3000 GDBusProxyFlags flags,
3001 const gchar *name,
3002 const gchar *object_path,
3003 GCancellable *cancellable,
3004 GError **error)
3005{
3006 GInitable *ret;
3007 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);
3008 if (ret != NULL)
3009 return FAN (ret);
3010 else
3011 return NULL;
3012}
3013
3014
3015/* ------------------------------------------------------------------------ */
3016
3017/**
3018 * FanSkeleton:
3019 *
3020 * The #FanSkeleton structure contains only private data and should only be accessed using the provided API.
3021 */
3022
3023/**
3024 * FanSkeletonClass:
3025 * @parent_class: The parent class.
3026 *
3027 * Class structure for #FanSkeleton.
3028 */
3029
3030struct _FanSkeletonPrivate
3031{
3032 GValue *properties;
3033 GList *changed_properties;
3034 GSource *changed_properties_idle_source;
3035 GMainContext *context;
3036 GMutex lock;
3037};
3038
3039static void
3040_fan_skeleton_handle_method_call (
3041 GDBusConnection *connection G_GNUC_UNUSED,
3042 const gchar *sender G_GNUC_UNUSED,
3043 const gchar *object_path G_GNUC_UNUSED,
3044 const gchar *interface_name,
3045 const gchar *method_name,
3046 GVariant *parameters,
3047 GDBusMethodInvocation *invocation,
3048 gpointer user_data)
3049{
3050 FanSkeleton *skeleton = FAN_SKELETON (user_data);
3051 _ExtendedGDBusMethodInfo *info;
3052 GVariantIter iter;
3053 GVariant *child;
3054 GValue *paramv;
3055 guint num_params;
3056 guint num_extra;
3057 guint n;
3058 guint signal_id;
3059 GValue return_value = G_VALUE_INIT;
3060 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
3061 g_assert (info != NULL);
3062 num_params = g_variant_n_children (parameters);
3063 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
3064 n = 0;
3065 g_value_init (&paramv[n], TYPE_FAN);
3066 g_value_set_object (&paramv[n++], skeleton);
3067 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
3068 g_value_set_object (&paramv[n++], invocation);
3069 if (info->pass_fdlist)
3070 {
3071#ifdef G_OS_UNIX
3072 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
3073 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
3074#else
3075 g_assert_not_reached ();
3076#endif
3077 }
3078 g_variant_iter_init (&iter, parameters);
3079 while ((child = g_variant_iter_next_value (&iter)) != NULL)
3080 {
3081 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
3082 if (arg_info->use_gvariant)
3083 {
3084 g_value_init (&paramv[n], G_TYPE_VARIANT);
3085 g_value_set_variant (&paramv[n], child);
3086 n++;
3087 }
3088 else
3089 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
3090 g_variant_unref (child);
3091 }
3092 signal_id = g_signal_lookup (info->signal_name, TYPE_FAN);
3093 g_value_init (&return_value, G_TYPE_BOOLEAN);
3094 g_signal_emitv (paramv, signal_id, 0, &return_value);
3095 if (!g_value_get_boolean (&return_value))
3096 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);
3097 g_value_unset (&return_value);
3098 for (n = 0; n < num_params + num_extra; n++)
3099 g_value_unset (&paramv[n]);
3100 g_free (paramv);
3101}
3102
3103static GVariant *
3104_fan_skeleton_handle_get_property (
3105 GDBusConnection *connection G_GNUC_UNUSED,
3106 const gchar *sender G_GNUC_UNUSED,
3107 const gchar *object_path G_GNUC_UNUSED,
3108 const gchar *interface_name G_GNUC_UNUSED,
3109 const gchar *property_name,
3110 GError **error,
3111 gpointer user_data)
3112{
3113 FanSkeleton *skeleton = FAN_SKELETON (user_data);
3114 GValue value = G_VALUE_INIT;
3115 GParamSpec *pspec;
3116 _ExtendedGDBusPropertyInfo *info;
3117 GVariant *ret;
3118 ret = NULL;
3119 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, property_name);
3120 g_assert (info != NULL);
3121 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
3122 if (pspec == NULL)
3123 {
3124 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
3125 }
3126 else
3127 {
3128 g_value_init (&value, pspec->value_type);
3129 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
3130 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
3131 g_value_unset (&value);
3132 }
3133 return ret;
3134}
3135
3136static gboolean
3137_fan_skeleton_handle_set_property (
3138 GDBusConnection *connection G_GNUC_UNUSED,
3139 const gchar *sender G_GNUC_UNUSED,
3140 const gchar *object_path G_GNUC_UNUSED,
3141 const gchar *interface_name G_GNUC_UNUSED,
3142 const gchar *property_name,
3143 GVariant *variant,
3144 GError **error,
3145 gpointer user_data)
3146{
3147 FanSkeleton *skeleton = FAN_SKELETON (user_data);
3148 GValue value = G_VALUE_INIT;
3149 GParamSpec *pspec;
3150 _ExtendedGDBusPropertyInfo *info;
3151 gboolean ret;
3152 ret = FALSE;
3153 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_fan_interface_info.parent_struct, property_name);
3154 g_assert (info != NULL);
3155 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
3156 if (pspec == NULL)
3157 {
3158 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
3159 }
3160 else
3161 {
3162 if (info->use_gvariant)
3163 g_value_set_variant (&value, variant);
3164 else
3165 g_dbus_gvariant_to_gvalue (variant, &value);
3166 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
3167 g_value_unset (&value);
3168 ret = TRUE;
3169 }
3170 return ret;
3171}
3172
3173static const GDBusInterfaceVTable _fan_skeleton_vtable =
3174{
3175 _fan_skeleton_handle_method_call,
3176 _fan_skeleton_handle_get_property,
3177 _fan_skeleton_handle_set_property,
3178 {NULL}
3179};
3180
3181static GDBusInterfaceInfo *
3182fan_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
3183{
3184 return fan_interface_info ();
3185}
3186
3187static GDBusInterfaceVTable *
3188fan_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
3189{
3190 return (GDBusInterfaceVTable *) &_fan_skeleton_vtable;
3191}
3192
3193static GVariant *
3194fan_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
3195{
3196 FanSkeleton *skeleton = FAN_SKELETON (_skeleton);
3197
3198 GVariantBuilder builder;
3199 guint n;
3200 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
3201 if (_fan_interface_info.parent_struct.properties == NULL)
3202 goto out;
3203 for (n = 0; _fan_interface_info.parent_struct.properties[n] != NULL; n++)
3204 {
3205 GDBusPropertyInfo *info = _fan_interface_info.parent_struct.properties[n];
3206 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
3207 {
3208 GVariant *value;
3209 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);
3210 if (value != NULL)
3211 {
3212 g_variant_take_ref (value);
3213 g_variant_builder_add (&builder, "{sv}", info->name, value);
3214 g_variant_unref (value);
3215 }
3216 }
3217 }
3218out:
3219 return g_variant_builder_end (&builder);
3220}
3221
3222static gboolean _fan_emit_changed (gpointer user_data);
3223
3224static void
3225fan_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
3226{
3227 FanSkeleton *skeleton = FAN_SKELETON (_skeleton);
3228 gboolean emit_changed = FALSE;
3229
3230 g_mutex_lock (&skeleton->priv->lock);
3231 if (skeleton->priv->changed_properties_idle_source != NULL)
3232 {
3233 g_source_destroy (skeleton->priv->changed_properties_idle_source);
3234 skeleton->priv->changed_properties_idle_source = NULL;
3235 emit_changed = TRUE;
3236 }
3237 g_mutex_unlock (&skeleton->priv->lock);
3238
3239 if (emit_changed)
3240 _fan_emit_changed (skeleton);
3241}
3242
3243static void
3244_fan_on_signal_speed_changed (
3245 Fan *object,
3246 gint arg_speed)
3247{
3248 FanSkeleton *skeleton = FAN_SKELETON (object);
3249
3250 GList *connections, *l;
3251 GVariant *signal_variant;
3252 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
3253
3254 signal_variant = g_variant_ref_sink (g_variant_new ("(i)",
3255 arg_speed));
3256 for (l = connections; l != NULL; l = l->next)
3257 {
3258 GDBusConnection *connection = l->data;
3259 g_dbus_connection_emit_signal (connection,
3260 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Fan", "SpeedChanged",
3261 signal_variant, NULL);
3262 }
3263 g_variant_unref (signal_variant);
3264 g_list_free_full (connections, g_object_unref);
3265}
3266
3267static void
3268_fan_on_signal_tach_error (
3269 Fan *object)
3270{
3271 FanSkeleton *skeleton = FAN_SKELETON (object);
3272
3273 GList *connections, *l;
3274 GVariant *signal_variant;
3275 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
3276
3277 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
3278 for (l = connections; l != NULL; l = l->next)
3279 {
3280 GDBusConnection *connection = l->data;
3281 g_dbus_connection_emit_signal (connection,
3282 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Fan", "TachError",
3283 signal_variant, NULL);
3284 }
3285 g_variant_unref (signal_variant);
3286 g_list_free_full (connections, g_object_unref);
3287}
3288
3289static void fan_skeleton_iface_init (FanIface *iface);
3290#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
3291G_DEFINE_TYPE_WITH_CODE (FanSkeleton, fan_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
3292 G_ADD_PRIVATE (FanSkeleton)
3293 G_IMPLEMENT_INTERFACE (TYPE_FAN, fan_skeleton_iface_init));
3294
3295#else
3296G_DEFINE_TYPE_WITH_CODE (FanSkeleton, fan_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
3297 G_IMPLEMENT_INTERFACE (TYPE_FAN, fan_skeleton_iface_init));
3298
3299#endif
3300static void
3301fan_skeleton_finalize (GObject *object)
3302{
3303 FanSkeleton *skeleton = FAN_SKELETON (object);
3304 guint n;
3305 for (n = 0; n < 3; n++)
3306 g_value_unset (&skeleton->priv->properties[n]);
3307 g_free (skeleton->priv->properties);
3308 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
3309 if (skeleton->priv->changed_properties_idle_source != NULL)
3310 g_source_destroy (skeleton->priv->changed_properties_idle_source);
3311 g_main_context_unref (skeleton->priv->context);
3312 g_mutex_clear (&skeleton->priv->lock);
3313 G_OBJECT_CLASS (fan_skeleton_parent_class)->finalize (object);
3314}
3315
3316static void
3317fan_skeleton_get_property (GObject *object,
3318 guint prop_id,
3319 GValue *value,
3320 GParamSpec *pspec G_GNUC_UNUSED)
3321{
3322 FanSkeleton *skeleton = FAN_SKELETON (object);
3323 g_assert (prop_id != 0 && prop_id - 1 < 3);
3324 g_mutex_lock (&skeleton->priv->lock);
3325 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
3326 g_mutex_unlock (&skeleton->priv->lock);
3327}
3328
3329static gboolean
3330_fan_emit_changed (gpointer user_data)
3331{
3332 FanSkeleton *skeleton = FAN_SKELETON (user_data);
3333 GList *l;
3334 GVariantBuilder builder;
3335 GVariantBuilder invalidated_builder;
3336 guint num_changes;
3337
3338 g_mutex_lock (&skeleton->priv->lock);
3339 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
3340 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
3341 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
3342 {
3343 ChangedProperty *cp = l->data;
3344 GVariant *variant;
3345 const GValue *cur_value;
3346
3347 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
3348 if (!_g_value_equal (cur_value, &cp->orig_value))
3349 {
3350 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
3351 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
3352 g_variant_unref (variant);
3353 num_changes++;
3354 }
3355 }
3356 if (num_changes > 0)
3357 {
3358 GList *connections, *ll;
3359 GVariant *signal_variant;
3360 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Fan",
3361 &builder, &invalidated_builder));
3362 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
3363 for (ll = connections; ll != NULL; ll = ll->next)
3364 {
3365 GDBusConnection *connection = ll->data;
3366
3367 g_dbus_connection_emit_signal (connection,
3368 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
3369 "org.freedesktop.DBus.Properties",
3370 "PropertiesChanged",
3371 signal_variant,
3372 NULL);
3373 }
3374 g_variant_unref (signal_variant);
3375 g_list_free_full (connections, g_object_unref);
3376 }
3377 else
3378 {
3379 g_variant_builder_clear (&builder);
3380 g_variant_builder_clear (&invalidated_builder);
3381 }
3382 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
3383 skeleton->priv->changed_properties = NULL;
3384 skeleton->priv->changed_properties_idle_source = NULL;
3385 g_mutex_unlock (&skeleton->priv->lock);
3386 return FALSE;
3387}
3388
3389static void
3390_fan_schedule_emit_changed (FanSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
3391{
3392 ChangedProperty *cp;
3393 GList *l;
3394 cp = NULL;
3395 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
3396 {
3397 ChangedProperty *i_cp = l->data;
3398 if (i_cp->info == info)
3399 {
3400 cp = i_cp;
3401 break;
3402 }
3403 }
3404 if (cp == NULL)
3405 {
3406 cp = g_new0 (ChangedProperty, 1);
3407 cp->prop_id = prop_id;
3408 cp->info = info;
3409 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
3410 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
3411 g_value_copy (orig_value, &cp->orig_value);
3412 }
3413}
3414
3415static void
3416fan_skeleton_notify (GObject *object,
3417 GParamSpec *pspec G_GNUC_UNUSED)
3418{
3419 FanSkeleton *skeleton = FAN_SKELETON (object);
3420 g_mutex_lock (&skeleton->priv->lock);
3421 if (skeleton->priv->changed_properties != NULL &&
3422 skeleton->priv->changed_properties_idle_source == NULL)
3423 {
3424 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
3425 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
3426 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _fan_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
Adriana Kobylak2cb27752015-10-19 16:23:14 -05003427 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _fan_emit_changed");
Norman James362a80f2015-09-14 14:04:39 -05003428 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
3429 g_source_unref (skeleton->priv->changed_properties_idle_source);
3430 }
3431 g_mutex_unlock (&skeleton->priv->lock);
3432}
3433
3434static void
3435fan_skeleton_set_property (GObject *object,
3436 guint prop_id,
3437 const GValue *value,
3438 GParamSpec *pspec)
3439{
3440 FanSkeleton *skeleton = FAN_SKELETON (object);
3441 g_assert (prop_id != 0 && prop_id - 1 < 3);
3442 g_mutex_lock (&skeleton->priv->lock);
3443 g_object_freeze_notify (object);
3444 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
3445 {
3446 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
3447 _fan_schedule_emit_changed (skeleton, _fan_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
3448 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
3449 g_object_notify_by_pspec (object, pspec);
3450 }
3451 g_mutex_unlock (&skeleton->priv->lock);
3452 g_object_thaw_notify (object);
3453}
3454
3455static void
3456fan_skeleton_init (FanSkeleton *skeleton)
3457{
3458#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
3459 skeleton->priv = fan_skeleton_get_instance_private (skeleton);
3460#else
3461 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_FAN_SKELETON, FanSkeletonPrivate);
3462#endif
3463
3464 g_mutex_init (&skeleton->priv->lock);
3465 skeleton->priv->context = g_main_context_ref_thread_default ();
3466 skeleton->priv->properties = g_new0 (GValue, 3);
3467 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
3468 g_value_init (&skeleton->priv->properties[1], G_TYPE_INT);
3469 g_value_init (&skeleton->priv->properties[2], G_TYPE_INT);
3470}
3471
3472static gint
3473fan_skeleton_get_speed (Fan *object)
3474{
3475 FanSkeleton *skeleton = FAN_SKELETON (object);
3476 gint value;
3477 g_mutex_lock (&skeleton->priv->lock);
3478 value = g_value_get_int (&(skeleton->priv->properties[0]));
3479 g_mutex_unlock (&skeleton->priv->lock);
3480 return value;
3481}
3482
3483static gint
3484fan_skeleton_get_cooling_zone (Fan *object)
3485{
3486 FanSkeleton *skeleton = FAN_SKELETON (object);
3487 gint value;
3488 g_mutex_lock (&skeleton->priv->lock);
3489 value = g_value_get_int (&(skeleton->priv->properties[1]));
3490 g_mutex_unlock (&skeleton->priv->lock);
3491 return value;
3492}
3493
3494static gint
3495fan_skeleton_get_pwm_num (Fan *object)
3496{
3497 FanSkeleton *skeleton = FAN_SKELETON (object);
3498 gint value;
3499 g_mutex_lock (&skeleton->priv->lock);
3500 value = g_value_get_int (&(skeleton->priv->properties[2]));
3501 g_mutex_unlock (&skeleton->priv->lock);
3502 return value;
3503}
3504
3505static void
3506fan_skeleton_class_init (FanSkeletonClass *klass)
3507{
3508 GObjectClass *gobject_class;
3509 GDBusInterfaceSkeletonClass *skeleton_class;
3510
3511 gobject_class = G_OBJECT_CLASS (klass);
3512 gobject_class->finalize = fan_skeleton_finalize;
3513 gobject_class->get_property = fan_skeleton_get_property;
3514 gobject_class->set_property = fan_skeleton_set_property;
3515 gobject_class->notify = fan_skeleton_notify;
3516
3517
3518 fan_override_properties (gobject_class, 1);
3519
3520 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
3521 skeleton_class->get_info = fan_skeleton_dbus_interface_get_info;
3522 skeleton_class->get_properties = fan_skeleton_dbus_interface_get_properties;
3523 skeleton_class->flush = fan_skeleton_dbus_interface_flush;
3524 skeleton_class->get_vtable = fan_skeleton_dbus_interface_get_vtable;
3525
3526#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
3527 g_type_class_add_private (klass, sizeof (FanSkeletonPrivate));
3528#endif
3529}
3530
3531static void
3532fan_skeleton_iface_init (FanIface *iface)
3533{
3534 iface->speed_changed = _fan_on_signal_speed_changed;
3535 iface->tach_error = _fan_on_signal_tach_error;
3536 iface->get_speed = fan_skeleton_get_speed;
3537 iface->get_cooling_zone = fan_skeleton_get_cooling_zone;
3538 iface->get_pwm_num = fan_skeleton_get_pwm_num;
3539}
3540
3541/**
3542 * fan_skeleton_new:
3543 *
3544 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link>.
3545 *
3546 * Returns: (transfer full) (type FanSkeleton): The skeleton object.
3547 */
3548Fan *
3549fan_skeleton_new (void)
3550{
3551 return FAN (g_object_new (TYPE_FAN_SKELETON, NULL));
3552}
3553
3554/* ------------------------------------------------------------------------
3555 * Code for interface org.openbmc.SensorValue
3556 * ------------------------------------------------------------------------
3557 */
3558
3559/**
3560 * SECTION:SensorValue
3561 * @title: SensorValue
3562 * @short_description: Generated C code for the org.openbmc.SensorValue D-Bus interface
3563 *
3564 * 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.
3565 */
3566
3567/* ---- Introspection data for org.openbmc.SensorValue ---- */
3568
3569static const _ExtendedGDBusMethodInfo _sensor_value_method_info_init =
3570{
3571 {
3572 -1,
3573 (gchar *) "init",
3574 NULL,
3575 NULL,
3576 NULL
3577 },
3578 "handle-init",
3579 FALSE
3580};
3581
3582static const _ExtendedGDBusArgInfo _sensor_value_method_info_get_value_OUT_ARG_value =
3583{
3584 {
3585 -1,
3586 (gchar *) "value",
3587 (gchar *) "v",
3588 NULL
3589 },
3590 FALSE
3591};
3592
3593static const _ExtendedGDBusArgInfo * const _sensor_value_method_info_get_value_OUT_ARG_pointers[] =
3594{
3595 &_sensor_value_method_info_get_value_OUT_ARG_value,
3596 NULL
3597};
3598
3599static const _ExtendedGDBusMethodInfo _sensor_value_method_info_get_value =
3600{
3601 {
3602 -1,
3603 (gchar *) "getValue",
3604 NULL,
3605 (GDBusArgInfo **) &_sensor_value_method_info_get_value_OUT_ARG_pointers,
3606 NULL
3607 },
3608 "handle-get-value",
3609 FALSE
3610};
3611
Norman James19e45912015-10-04 20:19:41 -05003612static const _ExtendedGDBusArgInfo _sensor_value_method_info_set_value_IN_ARG_value =
3613{
3614 {
3615 -1,
3616 (gchar *) "value",
3617 (gchar *) "v",
3618 NULL
3619 },
3620 FALSE
3621};
3622
3623static const _ExtendedGDBusArgInfo * const _sensor_value_method_info_set_value_IN_ARG_pointers[] =
3624{
3625 &_sensor_value_method_info_set_value_IN_ARG_value,
3626 NULL
3627};
3628
3629static const _ExtendedGDBusMethodInfo _sensor_value_method_info_set_value =
3630{
3631 {
3632 -1,
3633 (gchar *) "setValue",
3634 (GDBusArgInfo **) &_sensor_value_method_info_set_value_IN_ARG_pointers,
3635 NULL,
3636 NULL
3637 },
3638 "handle-set-value",
3639 FALSE
3640};
3641
Norman James362a80f2015-09-14 14:04:39 -05003642static const _ExtendedGDBusMethodInfo * const _sensor_value_method_info_pointers[] =
3643{
3644 &_sensor_value_method_info_init,
3645 &_sensor_value_method_info_get_value,
Norman James19e45912015-10-04 20:19:41 -05003646 &_sensor_value_method_info_set_value,
Norman James362a80f2015-09-14 14:04:39 -05003647 NULL
3648};
3649
3650static const _ExtendedGDBusArgInfo _sensor_value_signal_info_changed_ARG_value =
3651{
3652 {
3653 -1,
3654 (gchar *) "value",
3655 (gchar *) "v",
3656 NULL
3657 },
3658 FALSE
3659};
3660
3661static const _ExtendedGDBusArgInfo _sensor_value_signal_info_changed_ARG_units =
3662{
3663 {
3664 -1,
3665 (gchar *) "units",
3666 (gchar *) "s",
3667 NULL
3668 },
3669 FALSE
3670};
3671
3672static const _ExtendedGDBusArgInfo * const _sensor_value_signal_info_changed_ARG_pointers[] =
3673{
3674 &_sensor_value_signal_info_changed_ARG_value,
3675 &_sensor_value_signal_info_changed_ARG_units,
3676 NULL
3677};
3678
3679static const _ExtendedGDBusSignalInfo _sensor_value_signal_info_changed =
3680{
3681 {
3682 -1,
3683 (gchar *) "Changed",
3684 (GDBusArgInfo **) &_sensor_value_signal_info_changed_ARG_pointers,
3685 NULL
3686 },
3687 "changed"
3688};
3689
Norman James32e74e22015-09-15 21:28:06 -05003690static const _ExtendedGDBusSignalInfo _sensor_value_signal_info_error =
3691{
3692 {
3693 -1,
3694 (gchar *) "Error",
3695 NULL,
3696 NULL
3697 },
3698 "error"
3699};
3700
Norman James362a80f2015-09-14 14:04:39 -05003701static const _ExtendedGDBusArgInfo _sensor_value_signal_info_heartbeat_ARG_bus_name =
3702{
3703 {
3704 -1,
3705 (gchar *) "bus_name",
3706 (gchar *) "s",
3707 NULL
3708 },
3709 FALSE
3710};
3711
3712static const _ExtendedGDBusArgInfo * const _sensor_value_signal_info_heartbeat_ARG_pointers[] =
3713{
3714 &_sensor_value_signal_info_heartbeat_ARG_bus_name,
3715 NULL
3716};
3717
3718static const _ExtendedGDBusSignalInfo _sensor_value_signal_info_heartbeat =
3719{
3720 {
3721 -1,
3722 (gchar *) "Heartbeat",
3723 (GDBusArgInfo **) &_sensor_value_signal_info_heartbeat_ARG_pointers,
3724 NULL
3725 },
3726 "heartbeat"
3727};
3728
3729static const _ExtendedGDBusSignalInfo * const _sensor_value_signal_info_pointers[] =
3730{
3731 &_sensor_value_signal_info_changed,
Norman James32e74e22015-09-15 21:28:06 -05003732 &_sensor_value_signal_info_error,
Norman James362a80f2015-09-14 14:04:39 -05003733 &_sensor_value_signal_info_heartbeat,
3734 NULL
3735};
3736
3737static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_value =
3738{
3739 {
3740 -1,
3741 (gchar *) "value",
3742 (gchar *) "v",
3743 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
3744 NULL
3745 },
3746 "value",
3747 FALSE
3748};
3749
3750static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_units =
3751{
3752 {
3753 -1,
3754 (gchar *) "units",
3755 (gchar *) "s",
3756 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
3757 NULL
3758 },
3759 "units",
3760 FALSE
3761};
3762
3763static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_poll_interval =
3764{
3765 {
3766 -1,
3767 (gchar *) "poll_interval",
3768 (gchar *) "i",
3769 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
3770 NULL
3771 },
3772 "poll-interval",
3773 FALSE
3774};
3775
3776static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_heatbeat =
3777{
3778 {
3779 -1,
3780 (gchar *) "heatbeat",
3781 (gchar *) "i",
3782 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
3783 NULL
3784 },
3785 "heatbeat",
3786 FALSE
3787};
3788
3789static const _ExtendedGDBusPropertyInfo _sensor_value_property_info_settable =
3790{
3791 {
3792 -1,
3793 (gchar *) "settable",
3794 (gchar *) "b",
3795 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
3796 NULL
3797 },
3798 "settable",
3799 FALSE
3800};
3801
Norman James362a80f2015-09-14 14:04:39 -05003802static const _ExtendedGDBusPropertyInfo * const _sensor_value_property_info_pointers[] =
3803{
3804 &_sensor_value_property_info_value,
3805 &_sensor_value_property_info_units,
3806 &_sensor_value_property_info_poll_interval,
3807 &_sensor_value_property_info_heatbeat,
3808 &_sensor_value_property_info_settable,
Norman James362a80f2015-09-14 14:04:39 -05003809 NULL
3810};
3811
3812static const _ExtendedGDBusInterfaceInfo _sensor_value_interface_info =
3813{
3814 {
3815 -1,
3816 (gchar *) "org.openbmc.SensorValue",
3817 (GDBusMethodInfo **) &_sensor_value_method_info_pointers,
3818 (GDBusSignalInfo **) &_sensor_value_signal_info_pointers,
3819 (GDBusPropertyInfo **) &_sensor_value_property_info_pointers,
3820 NULL
3821 },
3822 "sensor-value",
3823};
3824
3825
3826/**
3827 * sensor_value_interface_info:
3828 *
3829 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link> D-Bus interface.
3830 *
3831 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
3832 */
3833GDBusInterfaceInfo *
3834sensor_value_interface_info (void)
3835{
3836 return (GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct;
3837}
3838
3839/**
3840 * sensor_value_override_properties:
3841 * @klass: The class structure for a #GObject<!-- -->-derived class.
3842 * @property_id_begin: The property id to assign to the first overridden property.
3843 *
3844 * Overrides all #GObject properties in the #SensorValue interface for a concrete class.
3845 * The properties are overridden in the order they are defined.
3846 *
3847 * Returns: The last property id.
3848 */
3849guint
3850sensor_value_override_properties (GObjectClass *klass, guint property_id_begin)
3851{
3852 g_object_class_override_property (klass, property_id_begin++, "value");
3853 g_object_class_override_property (klass, property_id_begin++, "units");
3854 g_object_class_override_property (klass, property_id_begin++, "poll-interval");
3855 g_object_class_override_property (klass, property_id_begin++, "heatbeat");
3856 g_object_class_override_property (klass, property_id_begin++, "settable");
Norman James362a80f2015-09-14 14:04:39 -05003857 return property_id_begin - 1;
3858}
3859
3860
3861
3862/**
3863 * SensorValue:
3864 *
3865 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link>.
3866 */
3867
3868/**
3869 * SensorValueIface:
3870 * @parent_iface: The parent interface.
3871 * @handle_get_value: Handler for the #SensorValue::handle-get-value signal.
3872 * @handle_init: Handler for the #SensorValue::handle-init signal.
Norman James19e45912015-10-04 20:19:41 -05003873 * @handle_set_value: Handler for the #SensorValue::handle-set-value signal.
Norman James362a80f2015-09-14 14:04:39 -05003874 * @get_heatbeat: Getter for the #SensorValue:heatbeat property.
Norman James362a80f2015-09-14 14:04:39 -05003875 * @get_poll_interval: Getter for the #SensorValue:poll-interval property.
3876 * @get_settable: Getter for the #SensorValue:settable property.
3877 * @get_units: Getter for the #SensorValue:units property.
3878 * @get_value: Getter for the #SensorValue:value property.
3879 * @changed: Handler for the #SensorValue::changed signal.
Norman James32e74e22015-09-15 21:28:06 -05003880 * @error: Handler for the #SensorValue::error signal.
Norman James362a80f2015-09-14 14:04:39 -05003881 * @heartbeat: Handler for the #SensorValue::heartbeat signal.
3882 *
3883 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link>.
3884 */
3885
3886typedef SensorValueIface SensorValueInterface;
3887G_DEFINE_INTERFACE (SensorValue, sensor_value, G_TYPE_OBJECT);
3888
3889static void
3890sensor_value_default_init (SensorValueIface *iface)
3891{
3892 /* GObject signals for incoming D-Bus method calls: */
3893 /**
3894 * SensorValue::handle-init:
3895 * @object: A #SensorValue.
3896 * @invocation: A #GDBusMethodInvocation.
3897 *
3898 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorValue.init">init()</link> D-Bus method.
3899 *
3900 * 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.
3901 *
3902 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
3903 */
3904 g_signal_new ("handle-init",
3905 G_TYPE_FROM_INTERFACE (iface),
3906 G_SIGNAL_RUN_LAST,
3907 G_STRUCT_OFFSET (SensorValueIface, handle_init),
3908 g_signal_accumulator_true_handled,
3909 NULL,
3910 g_cclosure_marshal_generic,
3911 G_TYPE_BOOLEAN,
3912 1,
3913 G_TYPE_DBUS_METHOD_INVOCATION);
3914
3915 /**
3916 * SensorValue::handle-get-value:
3917 * @object: A #SensorValue.
3918 * @invocation: A #GDBusMethodInvocation.
3919 *
3920 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorValue.getValue">getValue()</link> D-Bus method.
3921 *
3922 * 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.
3923 *
3924 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
3925 */
3926 g_signal_new ("handle-get-value",
3927 G_TYPE_FROM_INTERFACE (iface),
3928 G_SIGNAL_RUN_LAST,
3929 G_STRUCT_OFFSET (SensorValueIface, handle_get_value),
3930 g_signal_accumulator_true_handled,
3931 NULL,
3932 g_cclosure_marshal_generic,
3933 G_TYPE_BOOLEAN,
3934 1,
3935 G_TYPE_DBUS_METHOD_INVOCATION);
3936
Norman James19e45912015-10-04 20:19:41 -05003937 /**
3938 * SensorValue::handle-set-value:
3939 * @object: A #SensorValue.
3940 * @invocation: A #GDBusMethodInvocation.
3941 * @arg_value: Argument passed by remote caller.
3942 *
3943 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorValue.setValue">setValue()</link> D-Bus method.
3944 *
3945 * 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.
3946 *
3947 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
3948 */
3949 g_signal_new ("handle-set-value",
3950 G_TYPE_FROM_INTERFACE (iface),
3951 G_SIGNAL_RUN_LAST,
3952 G_STRUCT_OFFSET (SensorValueIface, handle_set_value),
3953 g_signal_accumulator_true_handled,
3954 NULL,
3955 g_cclosure_marshal_generic,
3956 G_TYPE_BOOLEAN,
3957 2,
3958 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_VARIANT);
3959
Norman James362a80f2015-09-14 14:04:39 -05003960 /* GObject signals for received D-Bus signals: */
3961 /**
3962 * SensorValue::changed:
3963 * @object: A #SensorValue.
3964 * @arg_value: Argument.
3965 * @arg_units: Argument.
3966 *
3967 * 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.
3968 *
3969 * 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.
3970 */
3971 g_signal_new ("changed",
3972 G_TYPE_FROM_INTERFACE (iface),
3973 G_SIGNAL_RUN_LAST,
3974 G_STRUCT_OFFSET (SensorValueIface, changed),
3975 NULL,
3976 NULL,
3977 g_cclosure_marshal_generic,
3978 G_TYPE_NONE,
3979 2, G_TYPE_VARIANT, G_TYPE_STRING);
3980
3981 /**
Norman James32e74e22015-09-15 21:28:06 -05003982 * SensorValue::error:
3983 * @object: A #SensorValue.
3984 *
3985 * 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.
3986 *
3987 * 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.
3988 */
3989 g_signal_new ("error",
3990 G_TYPE_FROM_INTERFACE (iface),
3991 G_SIGNAL_RUN_LAST,
3992 G_STRUCT_OFFSET (SensorValueIface, error),
3993 NULL,
3994 NULL,
3995 g_cclosure_marshal_generic,
3996 G_TYPE_NONE,
3997 0);
3998
3999 /**
Norman James362a80f2015-09-14 14:04:39 -05004000 * SensorValue::heartbeat:
4001 * @object: A #SensorValue.
4002 * @arg_bus_name: Argument.
4003 *
4004 * 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.
4005 *
4006 * 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.
4007 */
4008 g_signal_new ("heartbeat",
4009 G_TYPE_FROM_INTERFACE (iface),
4010 G_SIGNAL_RUN_LAST,
4011 G_STRUCT_OFFSET (SensorValueIface, heartbeat),
4012 NULL,
4013 NULL,
4014 g_cclosure_marshal_generic,
4015 G_TYPE_NONE,
4016 1, G_TYPE_STRING);
4017
4018 /* GObject properties for D-Bus properties: */
4019 /**
4020 * SensorValue:value:
4021 *
4022 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link>.
4023 *
4024 * 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.
4025 */
4026 g_object_interface_install_property (iface,
4027 g_param_spec_variant ("value", "value", "value", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
4028 /**
4029 * SensorValue:units:
4030 *
4031 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link>.
4032 *
4033 * 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.
4034 */
4035 g_object_interface_install_property (iface,
4036 g_param_spec_string ("units", "units", "units", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
4037 /**
4038 * SensorValue:poll-interval:
4039 *
4040 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.poll_interval">"poll_interval"</link>.
4041 *
4042 * 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.
4043 */
4044 g_object_interface_install_property (iface,
4045 g_param_spec_int ("poll-interval", "poll_interval", "poll_interval", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
4046 /**
4047 * SensorValue:heatbeat:
4048 *
4049 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.heatbeat">"heatbeat"</link>.
4050 *
4051 * 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.
4052 */
4053 g_object_interface_install_property (iface,
4054 g_param_spec_int ("heatbeat", "heatbeat", "heatbeat", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
4055 /**
4056 * SensorValue:settable:
4057 *
4058 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorValue.settable">"settable"</link>.
4059 *
4060 * 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.
4061 */
4062 g_object_interface_install_property (iface,
4063 g_param_spec_boolean ("settable", "settable", "settable", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
Norman James362a80f2015-09-14 14:04:39 -05004064}
4065
4066/**
4067 * sensor_value_get_value: (skip)
4068 * @object: A #SensorValue.
4069 *
4070 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link> D-Bus property.
4071 *
4072 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4073 *
4074 * <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>
4075 *
4076 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
4077 */
4078GVariant *
4079sensor_value_get_value (SensorValue *object)
4080{
4081 return SENSOR_VALUE_GET_IFACE (object)->get_value (object);
4082}
4083
4084/**
4085 * sensor_value_dup_value: (skip)
4086 * @object: A #SensorValue.
4087 *
4088 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link> D-Bus property.
4089 *
4090 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4091 *
4092 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
4093 */
4094GVariant *
4095sensor_value_dup_value (SensorValue *object)
4096{
4097 GVariant *value;
4098 g_object_get (G_OBJECT (object), "value", &value, NULL);
4099 return value;
4100}
4101
4102/**
4103 * sensor_value_set_value: (skip)
4104 * @object: A #SensorValue.
4105 * @value: The value to set.
4106 *
4107 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.value">"value"</link> D-Bus property to @value.
4108 *
4109 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
4110 */
4111void
4112sensor_value_set_value (SensorValue *object, GVariant *value)
4113{
4114 g_object_set (G_OBJECT (object), "value", value, NULL);
4115}
4116
4117/**
4118 * sensor_value_get_units: (skip)
4119 * @object: A #SensorValue.
4120 *
4121 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link> D-Bus property.
4122 *
4123 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4124 *
4125 * <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>
4126 *
4127 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
4128 */
4129const gchar *
4130sensor_value_get_units (SensorValue *object)
4131{
4132 return SENSOR_VALUE_GET_IFACE (object)->get_units (object);
4133}
4134
4135/**
4136 * sensor_value_dup_units: (skip)
4137 * @object: A #SensorValue.
4138 *
4139 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link> D-Bus property.
4140 *
4141 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4142 *
4143 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
4144 */
4145gchar *
4146sensor_value_dup_units (SensorValue *object)
4147{
4148 gchar *value;
4149 g_object_get (G_OBJECT (object), "units", &value, NULL);
4150 return value;
4151}
4152
4153/**
4154 * sensor_value_set_units: (skip)
4155 * @object: A #SensorValue.
4156 * @value: The value to set.
4157 *
4158 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.units">"units"</link> D-Bus property to @value.
4159 *
4160 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
4161 */
4162void
4163sensor_value_set_units (SensorValue *object, const gchar *value)
4164{
4165 g_object_set (G_OBJECT (object), "units", value, NULL);
4166}
4167
4168/**
4169 * sensor_value_get_poll_interval: (skip)
4170 * @object: A #SensorValue.
4171 *
4172 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.poll_interval">"poll_interval"</link> D-Bus property.
4173 *
4174 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
4175 *
4176 * Returns: The property value.
4177 */
4178gint
4179sensor_value_get_poll_interval (SensorValue *object)
4180{
4181 return SENSOR_VALUE_GET_IFACE (object)->get_poll_interval (object);
4182}
4183
4184/**
4185 * sensor_value_set_poll_interval: (skip)
4186 * @object: A #SensorValue.
4187 * @value: The value to set.
4188 *
4189 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.poll_interval">"poll_interval"</link> D-Bus property to @value.
4190 *
4191 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
4192 */
4193void
4194sensor_value_set_poll_interval (SensorValue *object, gint value)
4195{
4196 g_object_set (G_OBJECT (object), "poll-interval", value, NULL);
4197}
4198
4199/**
4200 * sensor_value_get_heatbeat: (skip)
4201 * @object: A #SensorValue.
4202 *
4203 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.heatbeat">"heatbeat"</link> D-Bus property.
4204 *
4205 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4206 *
4207 * Returns: The property value.
4208 */
4209gint
4210sensor_value_get_heatbeat (SensorValue *object)
4211{
4212 return SENSOR_VALUE_GET_IFACE (object)->get_heatbeat (object);
4213}
4214
4215/**
4216 * sensor_value_set_heatbeat: (skip)
4217 * @object: A #SensorValue.
4218 * @value: The value to set.
4219 *
4220 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.heatbeat">"heatbeat"</link> D-Bus property to @value.
4221 *
4222 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
4223 */
4224void
4225sensor_value_set_heatbeat (SensorValue *object, gint value)
4226{
4227 g_object_set (G_OBJECT (object), "heatbeat", value, NULL);
4228}
4229
4230/**
4231 * sensor_value_get_settable: (skip)
4232 * @object: A #SensorValue.
4233 *
4234 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorValue.settable">"settable"</link> D-Bus property.
4235 *
4236 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
4237 *
4238 * Returns: The property value.
4239 */
4240gboolean
4241sensor_value_get_settable (SensorValue *object)
4242{
4243 return SENSOR_VALUE_GET_IFACE (object)->get_settable (object);
4244}
4245
4246/**
4247 * sensor_value_set_settable: (skip)
4248 * @object: A #SensorValue.
4249 * @value: The value to set.
4250 *
4251 * Sets the <link linkend="gdbus-property-org-openbmc-SensorValue.settable">"settable"</link> D-Bus property to @value.
4252 *
4253 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
4254 */
4255void
4256sensor_value_set_settable (SensorValue *object, gboolean value)
4257{
4258 g_object_set (G_OBJECT (object), "settable", value, NULL);
4259}
4260
4261/**
Norman James362a80f2015-09-14 14:04:39 -05004262 * sensor_value_emit_changed:
4263 * @object: A #SensorValue.
4264 * @arg_value: Argument to pass with the signal.
4265 * @arg_units: Argument to pass with the signal.
4266 *
4267 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorValue.Changed">"Changed"</link> D-Bus signal.
4268 */
4269void
4270sensor_value_emit_changed (
4271 SensorValue *object,
4272 GVariant *arg_value,
4273 const gchar *arg_units)
4274{
4275 g_signal_emit_by_name (object, "changed", arg_value, arg_units);
4276}
4277
4278/**
Norman James32e74e22015-09-15 21:28:06 -05004279 * sensor_value_emit_error:
4280 * @object: A #SensorValue.
4281 *
4282 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorValue.Error">"Error"</link> D-Bus signal.
4283 */
4284void
4285sensor_value_emit_error (
4286 SensorValue *object)
4287{
4288 g_signal_emit_by_name (object, "error");
4289}
4290
4291/**
Norman James362a80f2015-09-14 14:04:39 -05004292 * sensor_value_emit_heartbeat:
4293 * @object: A #SensorValue.
4294 * @arg_bus_name: Argument to pass with the signal.
4295 *
4296 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorValue.Heartbeat">"Heartbeat"</link> D-Bus signal.
4297 */
4298void
4299sensor_value_emit_heartbeat (
4300 SensorValue *object,
4301 const gchar *arg_bus_name)
4302{
4303 g_signal_emit_by_name (object, "heartbeat", arg_bus_name);
4304}
4305
4306/**
4307 * sensor_value_call_init:
4308 * @proxy: A #SensorValueProxy.
4309 * @cancellable: (allow-none): A #GCancellable or %NULL.
4310 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
4311 * @user_data: User data to pass to @callback.
4312 *
4313 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorValue.init">init()</link> D-Bus method on @proxy.
4314 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
4315 * You can then call sensor_value_call_init_finish() to get the result of the operation.
4316 *
4317 * See sensor_value_call_init_sync() for the synchronous, blocking version of this method.
4318 */
4319void
4320sensor_value_call_init (
4321 SensorValue *proxy,
4322 GCancellable *cancellable,
4323 GAsyncReadyCallback callback,
4324 gpointer user_data)
4325{
4326 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
4327 "init",
4328 g_variant_new ("()"),
4329 G_DBUS_CALL_FLAGS_NONE,
4330 -1,
4331 cancellable,
4332 callback,
4333 user_data);
4334}
4335
4336/**
4337 * sensor_value_call_init_finish:
4338 * @proxy: A #SensorValueProxy.
4339 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_call_init().
4340 * @error: Return location for error or %NULL.
4341 *
4342 * Finishes an operation started with sensor_value_call_init().
4343 *
4344 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
4345 */
4346gboolean
4347sensor_value_call_init_finish (
4348 SensorValue *proxy,
4349 GAsyncResult *res,
4350 GError **error)
4351{
4352 GVariant *_ret;
4353 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
4354 if (_ret == NULL)
4355 goto _out;
4356 g_variant_get (_ret,
4357 "()");
4358 g_variant_unref (_ret);
4359_out:
4360 return _ret != NULL;
4361}
4362
4363/**
4364 * sensor_value_call_init_sync:
4365 * @proxy: A #SensorValueProxy.
4366 * @cancellable: (allow-none): A #GCancellable or %NULL.
4367 * @error: Return location for error or %NULL.
4368 *
4369 * 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.
4370 *
4371 * See sensor_value_call_init() for the asynchronous version of this method.
4372 *
4373 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
4374 */
4375gboolean
4376sensor_value_call_init_sync (
4377 SensorValue *proxy,
4378 GCancellable *cancellable,
4379 GError **error)
4380{
4381 GVariant *_ret;
4382 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
4383 "init",
4384 g_variant_new ("()"),
4385 G_DBUS_CALL_FLAGS_NONE,
4386 -1,
4387 cancellable,
4388 error);
4389 if (_ret == NULL)
4390 goto _out;
4391 g_variant_get (_ret,
4392 "()");
4393 g_variant_unref (_ret);
4394_out:
4395 return _ret != NULL;
4396}
4397
4398/**
4399 * sensor_value_call_get_value:
4400 * @proxy: A #SensorValueProxy.
4401 * @cancellable: (allow-none): A #GCancellable or %NULL.
4402 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
4403 * @user_data: User data to pass to @callback.
4404 *
4405 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorValue.getValue">getValue()</link> D-Bus method on @proxy.
4406 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
4407 * You can then call sensor_value_call_get_value_finish() to get the result of the operation.
4408 *
4409 * See sensor_value_call_get_value_sync() for the synchronous, blocking version of this method.
4410 */
4411void
4412sensor_value_call_get_value (
4413 SensorValue *proxy,
4414 GCancellable *cancellable,
4415 GAsyncReadyCallback callback,
4416 gpointer user_data)
4417{
4418 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
4419 "getValue",
4420 g_variant_new ("()"),
4421 G_DBUS_CALL_FLAGS_NONE,
4422 -1,
4423 cancellable,
4424 callback,
4425 user_data);
4426}
4427
4428/**
4429 * sensor_value_call_get_value_finish:
4430 * @proxy: A #SensorValueProxy.
4431 * @out_value: (out): Return location for return parameter or %NULL to ignore.
4432 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_call_get_value().
4433 * @error: Return location for error or %NULL.
4434 *
4435 * Finishes an operation started with sensor_value_call_get_value().
4436 *
4437 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
4438 */
4439gboolean
4440sensor_value_call_get_value_finish (
4441 SensorValue *proxy,
4442 GVariant **out_value,
4443 GAsyncResult *res,
4444 GError **error)
4445{
4446 GVariant *_ret;
4447 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
4448 if (_ret == NULL)
4449 goto _out;
4450 g_variant_get (_ret,
4451 "(@v)",
4452 out_value);
4453 g_variant_unref (_ret);
4454_out:
4455 return _ret != NULL;
4456}
4457
4458/**
4459 * sensor_value_call_get_value_sync:
4460 * @proxy: A #SensorValueProxy.
4461 * @out_value: (out): Return location for return parameter or %NULL to ignore.
4462 * @cancellable: (allow-none): A #GCancellable or %NULL.
4463 * @error: Return location for error or %NULL.
4464 *
4465 * 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.
4466 *
4467 * See sensor_value_call_get_value() for the asynchronous version of this method.
4468 *
4469 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
4470 */
4471gboolean
4472sensor_value_call_get_value_sync (
4473 SensorValue *proxy,
4474 GVariant **out_value,
4475 GCancellable *cancellable,
4476 GError **error)
4477{
4478 GVariant *_ret;
4479 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
4480 "getValue",
4481 g_variant_new ("()"),
4482 G_DBUS_CALL_FLAGS_NONE,
4483 -1,
4484 cancellable,
4485 error);
4486 if (_ret == NULL)
4487 goto _out;
4488 g_variant_get (_ret,
4489 "(@v)",
4490 out_value);
4491 g_variant_unref (_ret);
4492_out:
4493 return _ret != NULL;
4494}
4495
4496/**
Norman James19e45912015-10-04 20:19:41 -05004497 * sensor_value_call_set_value:
4498 * @proxy: A #SensorValueProxy.
4499 * @arg_value: Argument to pass with the method invocation.
4500 * @cancellable: (allow-none): A #GCancellable or %NULL.
4501 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
4502 * @user_data: User data to pass to @callback.
4503 *
4504 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorValue.setValue">setValue()</link> D-Bus method on @proxy.
4505 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
4506 * You can then call sensor_value_call_set_value_finish() to get the result of the operation.
4507 *
4508 * See sensor_value_call_set_value_sync() for the synchronous, blocking version of this method.
4509 */
4510void
4511sensor_value_call_set_value (
4512 SensorValue *proxy,
4513 GVariant *arg_value,
4514 GCancellable *cancellable,
4515 GAsyncReadyCallback callback,
4516 gpointer user_data)
4517{
4518 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
4519 "setValue",
4520 g_variant_new ("(@v)",
4521 arg_value),
4522 G_DBUS_CALL_FLAGS_NONE,
4523 -1,
4524 cancellable,
4525 callback,
4526 user_data);
4527}
4528
4529/**
4530 * sensor_value_call_set_value_finish:
4531 * @proxy: A #SensorValueProxy.
4532 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_call_set_value().
4533 * @error: Return location for error or %NULL.
4534 *
4535 * Finishes an operation started with sensor_value_call_set_value().
4536 *
4537 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
4538 */
4539gboolean
4540sensor_value_call_set_value_finish (
4541 SensorValue *proxy,
4542 GAsyncResult *res,
4543 GError **error)
4544{
4545 GVariant *_ret;
4546 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
4547 if (_ret == NULL)
4548 goto _out;
4549 g_variant_get (_ret,
4550 "()");
4551 g_variant_unref (_ret);
4552_out:
4553 return _ret != NULL;
4554}
4555
4556/**
4557 * sensor_value_call_set_value_sync:
4558 * @proxy: A #SensorValueProxy.
4559 * @arg_value: Argument to pass with the method invocation.
4560 * @cancellable: (allow-none): A #GCancellable or %NULL.
4561 * @error: Return location for error or %NULL.
4562 *
4563 * 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.
4564 *
4565 * See sensor_value_call_set_value() for the asynchronous version of this method.
4566 *
4567 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
4568 */
4569gboolean
4570sensor_value_call_set_value_sync (
4571 SensorValue *proxy,
4572 GVariant *arg_value,
4573 GCancellable *cancellable,
4574 GError **error)
4575{
4576 GVariant *_ret;
4577 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
4578 "setValue",
4579 g_variant_new ("(@v)",
4580 arg_value),
4581 G_DBUS_CALL_FLAGS_NONE,
4582 -1,
4583 cancellable,
4584 error);
4585 if (_ret == NULL)
4586 goto _out;
4587 g_variant_get (_ret,
4588 "()");
4589 g_variant_unref (_ret);
4590_out:
4591 return _ret != NULL;
4592}
4593
4594/**
Norman James362a80f2015-09-14 14:04:39 -05004595 * sensor_value_complete_init:
4596 * @object: A #SensorValue.
4597 * @invocation: (transfer full): A #GDBusMethodInvocation.
4598 *
4599 * 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.
4600 *
4601 * This method will free @invocation, you cannot use it afterwards.
4602 */
4603void
4604sensor_value_complete_init (
4605 SensorValue *object,
4606 GDBusMethodInvocation *invocation)
4607{
4608 g_dbus_method_invocation_return_value (invocation,
4609 g_variant_new ("()"));
4610}
4611
4612/**
4613 * sensor_value_complete_get_value:
4614 * @object: A #SensorValue.
4615 * @invocation: (transfer full): A #GDBusMethodInvocation.
4616 * @value: Parameter to return.
4617 *
4618 * 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.
4619 *
4620 * This method will free @invocation, you cannot use it afterwards.
4621 */
4622void
4623sensor_value_complete_get_value (
4624 SensorValue *object,
4625 GDBusMethodInvocation *invocation,
4626 GVariant *value)
4627{
4628 g_dbus_method_invocation_return_value (invocation,
4629 g_variant_new ("(@v)",
4630 value));
4631}
4632
Norman James19e45912015-10-04 20:19:41 -05004633/**
4634 * sensor_value_complete_set_value:
4635 * @object: A #SensorValue.
4636 * @invocation: (transfer full): A #GDBusMethodInvocation.
4637 *
4638 * 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.
4639 *
4640 * This method will free @invocation, you cannot use it afterwards.
4641 */
4642void
4643sensor_value_complete_set_value (
4644 SensorValue *object,
4645 GDBusMethodInvocation *invocation)
4646{
4647 g_dbus_method_invocation_return_value (invocation,
4648 g_variant_new ("()"));
4649}
4650
Norman James362a80f2015-09-14 14:04:39 -05004651/* ------------------------------------------------------------------------ */
4652
4653/**
4654 * SensorValueProxy:
4655 *
4656 * The #SensorValueProxy structure contains only private data and should only be accessed using the provided API.
4657 */
4658
4659/**
4660 * SensorValueProxyClass:
4661 * @parent_class: The parent class.
4662 *
4663 * Class structure for #SensorValueProxy.
4664 */
4665
4666struct _SensorValueProxyPrivate
4667{
4668 GData *qdata;
4669};
4670
4671static void sensor_value_proxy_iface_init (SensorValueIface *iface);
4672
4673#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
4674G_DEFINE_TYPE_WITH_CODE (SensorValueProxy, sensor_value_proxy, G_TYPE_DBUS_PROXY,
4675 G_ADD_PRIVATE (SensorValueProxy)
4676 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_proxy_iface_init));
4677
4678#else
4679G_DEFINE_TYPE_WITH_CODE (SensorValueProxy, sensor_value_proxy, G_TYPE_DBUS_PROXY,
4680 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_proxy_iface_init));
4681
4682#endif
4683static void
4684sensor_value_proxy_finalize (GObject *object)
4685{
4686 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
4687 g_datalist_clear (&proxy->priv->qdata);
4688 G_OBJECT_CLASS (sensor_value_proxy_parent_class)->finalize (object);
4689}
4690
4691static void
4692sensor_value_proxy_get_property (GObject *object,
4693 guint prop_id,
4694 GValue *value,
4695 GParamSpec *pspec G_GNUC_UNUSED)
4696{
4697 const _ExtendedGDBusPropertyInfo *info;
4698 GVariant *variant;
Norman Jamesdfdaca92015-09-27 22:11:15 -05004699 g_assert (prop_id != 0 && prop_id - 1 < 5);
Norman James362a80f2015-09-14 14:04:39 -05004700 info = _sensor_value_property_info_pointers[prop_id - 1];
4701 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
4702 if (info->use_gvariant)
4703 {
4704 g_value_set_variant (value, variant);
4705 }
4706 else
4707 {
4708 if (variant != NULL)
4709 g_dbus_gvariant_to_gvalue (variant, value);
4710 }
4711 if (variant != NULL)
4712 g_variant_unref (variant);
4713}
4714
4715static void
4716sensor_value_proxy_set_property_cb (GDBusProxy *proxy,
4717 GAsyncResult *res,
4718 gpointer user_data)
4719{
4720 const _ExtendedGDBusPropertyInfo *info = user_data;
4721 GError *error;
4722 GVariant *_ret;
4723 error = NULL;
4724 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
4725 if (!_ret)
4726 {
4727 g_warning ("Error setting property '%s' on interface org.openbmc.SensorValue: %s (%s, %d)",
4728 info->parent_struct.name,
4729 error->message, g_quark_to_string (error->domain), error->code);
4730 g_error_free (error);
4731 }
4732 else
4733 {
4734 g_variant_unref (_ret);
4735 }
4736}
4737
4738static void
4739sensor_value_proxy_set_property (GObject *object,
4740 guint prop_id,
4741 const GValue *value,
4742 GParamSpec *pspec G_GNUC_UNUSED)
4743{
4744 const _ExtendedGDBusPropertyInfo *info;
4745 GVariant *variant;
Norman Jamesdfdaca92015-09-27 22:11:15 -05004746 g_assert (prop_id != 0 && prop_id - 1 < 5);
Norman James362a80f2015-09-14 14:04:39 -05004747 info = _sensor_value_property_info_pointers[prop_id - 1];
4748 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
4749 g_dbus_proxy_call (G_DBUS_PROXY (object),
4750 "org.freedesktop.DBus.Properties.Set",
4751 g_variant_new ("(ssv)", "org.openbmc.SensorValue", info->parent_struct.name, variant),
4752 G_DBUS_CALL_FLAGS_NONE,
4753 -1,
4754 NULL, (GAsyncReadyCallback) sensor_value_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
4755 g_variant_unref (variant);
4756}
4757
4758static void
4759sensor_value_proxy_g_signal (GDBusProxy *proxy,
4760 const gchar *sender_name G_GNUC_UNUSED,
4761 const gchar *signal_name,
4762 GVariant *parameters)
4763{
4764 _ExtendedGDBusSignalInfo *info;
4765 GVariantIter iter;
4766 GVariant *child;
4767 GValue *paramv;
4768 guint num_params;
4769 guint n;
4770 guint signal_id;
4771 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, signal_name);
4772 if (info == NULL)
4773 return;
4774 num_params = g_variant_n_children (parameters);
4775 paramv = g_new0 (GValue, num_params + 1);
4776 g_value_init (&paramv[0], TYPE_SENSOR_VALUE);
4777 g_value_set_object (&paramv[0], proxy);
4778 g_variant_iter_init (&iter, parameters);
4779 n = 1;
4780 while ((child = g_variant_iter_next_value (&iter)) != NULL)
4781 {
4782 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
4783 if (arg_info->use_gvariant)
4784 {
4785 g_value_init (&paramv[n], G_TYPE_VARIANT);
4786 g_value_set_variant (&paramv[n], child);
4787 n++;
4788 }
4789 else
4790 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
4791 g_variant_unref (child);
4792 }
4793 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_VALUE);
4794 g_signal_emitv (paramv, signal_id, 0, NULL);
4795 for (n = 0; n < num_params + 1; n++)
4796 g_value_unset (&paramv[n]);
4797 g_free (paramv);
4798}
4799
4800static void
4801sensor_value_proxy_g_properties_changed (GDBusProxy *_proxy,
4802 GVariant *changed_properties,
4803 const gchar *const *invalidated_properties)
4804{
4805 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (_proxy);
4806 guint n;
4807 const gchar *key;
4808 GVariantIter *iter;
4809 _ExtendedGDBusPropertyInfo *info;
4810 g_variant_get (changed_properties, "a{sv}", &iter);
4811 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
4812 {
4813 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, key);
4814 g_datalist_remove_data (&proxy->priv->qdata, key);
4815 if (info != NULL)
4816 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
4817 }
4818 g_variant_iter_free (iter);
4819 for (n = 0; invalidated_properties[n] != NULL; n++)
4820 {
4821 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, invalidated_properties[n]);
4822 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
4823 if (info != NULL)
4824 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
4825 }
4826}
4827
4828static GVariant *
4829sensor_value_proxy_get_value (SensorValue *object)
4830{
4831 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
4832 GVariant *variant;
4833 GVariant *value = NULL;
4834 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "value");
4835 value = variant;
4836 if (variant != NULL)
4837 g_variant_unref (variant);
4838 return value;
4839}
4840
4841static const gchar *
4842sensor_value_proxy_get_units (SensorValue *object)
4843{
4844 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
4845 GVariant *variant;
4846 const gchar *value = NULL;
4847 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "units");
4848 if (variant != NULL)
4849 {
4850 value = g_variant_get_string (variant, NULL);
4851 g_variant_unref (variant);
4852 }
4853 return value;
4854}
4855
4856static gint
4857sensor_value_proxy_get_poll_interval (SensorValue *object)
4858{
4859 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
4860 GVariant *variant;
4861 gint value = 0;
4862 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "poll_interval");
4863 if (variant != NULL)
4864 {
4865 value = g_variant_get_int32 (variant);
4866 g_variant_unref (variant);
4867 }
4868 return value;
4869}
4870
4871static gint
4872sensor_value_proxy_get_heatbeat (SensorValue *object)
4873{
4874 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
4875 GVariant *variant;
4876 gint value = 0;
4877 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "heatbeat");
4878 if (variant != NULL)
4879 {
4880 value = g_variant_get_int32 (variant);
4881 g_variant_unref (variant);
4882 }
4883 return value;
4884}
4885
4886static gboolean
4887sensor_value_proxy_get_settable (SensorValue *object)
4888{
4889 SensorValueProxy *proxy = SENSOR_VALUE_PROXY (object);
4890 GVariant *variant;
4891 gboolean value = 0;
4892 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "settable");
4893 if (variant != NULL)
4894 {
4895 value = g_variant_get_boolean (variant);
4896 g_variant_unref (variant);
4897 }
4898 return value;
4899}
4900
Norman James362a80f2015-09-14 14:04:39 -05004901static void
4902sensor_value_proxy_init (SensorValueProxy *proxy)
4903{
4904#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
4905 proxy->priv = sensor_value_proxy_get_instance_private (proxy);
4906#else
4907 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_VALUE_PROXY, SensorValueProxyPrivate);
4908#endif
4909
4910 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_value_interface_info ());
4911}
4912
4913static void
4914sensor_value_proxy_class_init (SensorValueProxyClass *klass)
4915{
4916 GObjectClass *gobject_class;
4917 GDBusProxyClass *proxy_class;
4918
4919 gobject_class = G_OBJECT_CLASS (klass);
4920 gobject_class->finalize = sensor_value_proxy_finalize;
4921 gobject_class->get_property = sensor_value_proxy_get_property;
4922 gobject_class->set_property = sensor_value_proxy_set_property;
4923
4924 proxy_class = G_DBUS_PROXY_CLASS (klass);
4925 proxy_class->g_signal = sensor_value_proxy_g_signal;
4926 proxy_class->g_properties_changed = sensor_value_proxy_g_properties_changed;
4927
4928 sensor_value_override_properties (gobject_class, 1);
4929
4930#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
4931 g_type_class_add_private (klass, sizeof (SensorValueProxyPrivate));
4932#endif
4933}
4934
4935static void
4936sensor_value_proxy_iface_init (SensorValueIface *iface)
4937{
4938 iface->get_value = sensor_value_proxy_get_value;
4939 iface->get_units = sensor_value_proxy_get_units;
4940 iface->get_poll_interval = sensor_value_proxy_get_poll_interval;
4941 iface->get_heatbeat = sensor_value_proxy_get_heatbeat;
4942 iface->get_settable = sensor_value_proxy_get_settable;
Norman James362a80f2015-09-14 14:04:39 -05004943}
4944
4945/**
4946 * sensor_value_proxy_new:
4947 * @connection: A #GDBusConnection.
4948 * @flags: Flags from the #GDBusProxyFlags enumeration.
4949 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
4950 * @object_path: An object path.
4951 * @cancellable: (allow-none): A #GCancellable or %NULL.
4952 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
4953 * @user_data: User data to pass to @callback.
4954 *
4955 * 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.
4956 *
4957 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
4958 * You can then call sensor_value_proxy_new_finish() to get the result of the operation.
4959 *
4960 * See sensor_value_proxy_new_sync() for the synchronous, blocking version of this constructor.
4961 */
4962void
4963sensor_value_proxy_new (
4964 GDBusConnection *connection,
4965 GDBusProxyFlags flags,
4966 const gchar *name,
4967 const gchar *object_path,
4968 GCancellable *cancellable,
4969 GAsyncReadyCallback callback,
4970 gpointer user_data)
4971{
4972 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);
4973}
4974
4975/**
4976 * sensor_value_proxy_new_finish:
4977 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_proxy_new().
4978 * @error: Return location for error or %NULL
4979 *
4980 * Finishes an operation started with sensor_value_proxy_new().
4981 *
4982 * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set.
4983 */
4984SensorValue *
4985sensor_value_proxy_new_finish (
4986 GAsyncResult *res,
4987 GError **error)
4988{
4989 GObject *ret;
4990 GObject *source_object;
4991 source_object = g_async_result_get_source_object (res);
4992 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
4993 g_object_unref (source_object);
4994 if (ret != NULL)
4995 return SENSOR_VALUE (ret);
4996 else
4997 return NULL;
4998}
4999
5000/**
5001 * sensor_value_proxy_new_sync:
5002 * @connection: A #GDBusConnection.
5003 * @flags: Flags from the #GDBusProxyFlags enumeration.
5004 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
5005 * @object_path: An object path.
5006 * @cancellable: (allow-none): A #GCancellable or %NULL.
5007 * @error: Return location for error or %NULL
5008 *
5009 * 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.
5010 *
5011 * The calling thread is blocked until a reply is received.
5012 *
5013 * See sensor_value_proxy_new() for the asynchronous version of this constructor.
5014 *
5015 * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set.
5016 */
5017SensorValue *
5018sensor_value_proxy_new_sync (
5019 GDBusConnection *connection,
5020 GDBusProxyFlags flags,
5021 const gchar *name,
5022 const gchar *object_path,
5023 GCancellable *cancellable,
5024 GError **error)
5025{
5026 GInitable *ret;
5027 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);
5028 if (ret != NULL)
5029 return SENSOR_VALUE (ret);
5030 else
5031 return NULL;
5032}
5033
5034
5035/**
5036 * sensor_value_proxy_new_for_bus:
5037 * @bus_type: A #GBusType.
5038 * @flags: Flags from the #GDBusProxyFlags enumeration.
5039 * @name: A bus name (well-known or unique).
5040 * @object_path: An object path.
5041 * @cancellable: (allow-none): A #GCancellable or %NULL.
5042 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
5043 * @user_data: User data to pass to @callback.
5044 *
5045 * Like sensor_value_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
5046 *
5047 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
5048 * You can then call sensor_value_proxy_new_for_bus_finish() to get the result of the operation.
5049 *
5050 * See sensor_value_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
5051 */
5052void
5053sensor_value_proxy_new_for_bus (
5054 GBusType bus_type,
5055 GDBusProxyFlags flags,
5056 const gchar *name,
5057 const gchar *object_path,
5058 GCancellable *cancellable,
5059 GAsyncReadyCallback callback,
5060 gpointer user_data)
5061{
5062 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);
5063}
5064
5065/**
5066 * sensor_value_proxy_new_for_bus_finish:
5067 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_value_proxy_new_for_bus().
5068 * @error: Return location for error or %NULL
5069 *
5070 * Finishes an operation started with sensor_value_proxy_new_for_bus().
5071 *
5072 * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set.
5073 */
5074SensorValue *
5075sensor_value_proxy_new_for_bus_finish (
5076 GAsyncResult *res,
5077 GError **error)
5078{
5079 GObject *ret;
5080 GObject *source_object;
5081 source_object = g_async_result_get_source_object (res);
5082 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
5083 g_object_unref (source_object);
5084 if (ret != NULL)
5085 return SENSOR_VALUE (ret);
5086 else
5087 return NULL;
5088}
5089
5090/**
5091 * sensor_value_proxy_new_for_bus_sync:
5092 * @bus_type: A #GBusType.
5093 * @flags: Flags from the #GDBusProxyFlags enumeration.
5094 * @name: A bus name (well-known or unique).
5095 * @object_path: An object path.
5096 * @cancellable: (allow-none): A #GCancellable or %NULL.
5097 * @error: Return location for error or %NULL
5098 *
5099 * Like sensor_value_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
5100 *
5101 * The calling thread is blocked until a reply is received.
5102 *
5103 * See sensor_value_proxy_new_for_bus() for the asynchronous version of this constructor.
5104 *
5105 * Returns: (transfer full) (type SensorValueProxy): The constructed proxy object or %NULL if @error is set.
5106 */
5107SensorValue *
5108sensor_value_proxy_new_for_bus_sync (
5109 GBusType bus_type,
5110 GDBusProxyFlags flags,
5111 const gchar *name,
5112 const gchar *object_path,
5113 GCancellable *cancellable,
5114 GError **error)
5115{
5116 GInitable *ret;
5117 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);
5118 if (ret != NULL)
5119 return SENSOR_VALUE (ret);
5120 else
5121 return NULL;
5122}
5123
5124
5125/* ------------------------------------------------------------------------ */
5126
5127/**
5128 * SensorValueSkeleton:
5129 *
5130 * The #SensorValueSkeleton structure contains only private data and should only be accessed using the provided API.
5131 */
5132
5133/**
5134 * SensorValueSkeletonClass:
5135 * @parent_class: The parent class.
5136 *
5137 * Class structure for #SensorValueSkeleton.
5138 */
5139
5140struct _SensorValueSkeletonPrivate
5141{
5142 GValue *properties;
5143 GList *changed_properties;
5144 GSource *changed_properties_idle_source;
5145 GMainContext *context;
5146 GMutex lock;
5147};
5148
5149static void
5150_sensor_value_skeleton_handle_method_call (
5151 GDBusConnection *connection G_GNUC_UNUSED,
5152 const gchar *sender G_GNUC_UNUSED,
5153 const gchar *object_path G_GNUC_UNUSED,
5154 const gchar *interface_name,
5155 const gchar *method_name,
5156 GVariant *parameters,
5157 GDBusMethodInvocation *invocation,
5158 gpointer user_data)
5159{
5160 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data);
5161 _ExtendedGDBusMethodInfo *info;
5162 GVariantIter iter;
5163 GVariant *child;
5164 GValue *paramv;
5165 guint num_params;
5166 guint num_extra;
5167 guint n;
5168 guint signal_id;
5169 GValue return_value = G_VALUE_INIT;
5170 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
5171 g_assert (info != NULL);
5172 num_params = g_variant_n_children (parameters);
5173 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
5174 n = 0;
5175 g_value_init (&paramv[n], TYPE_SENSOR_VALUE);
5176 g_value_set_object (&paramv[n++], skeleton);
5177 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
5178 g_value_set_object (&paramv[n++], invocation);
5179 if (info->pass_fdlist)
5180 {
5181#ifdef G_OS_UNIX
5182 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
5183 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
5184#else
5185 g_assert_not_reached ();
5186#endif
5187 }
5188 g_variant_iter_init (&iter, parameters);
5189 while ((child = g_variant_iter_next_value (&iter)) != NULL)
5190 {
5191 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
5192 if (arg_info->use_gvariant)
5193 {
5194 g_value_init (&paramv[n], G_TYPE_VARIANT);
5195 g_value_set_variant (&paramv[n], child);
5196 n++;
5197 }
5198 else
5199 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
5200 g_variant_unref (child);
5201 }
5202 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_VALUE);
5203 g_value_init (&return_value, G_TYPE_BOOLEAN);
5204 g_signal_emitv (paramv, signal_id, 0, &return_value);
5205 if (!g_value_get_boolean (&return_value))
5206 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);
5207 g_value_unset (&return_value);
5208 for (n = 0; n < num_params + num_extra; n++)
5209 g_value_unset (&paramv[n]);
5210 g_free (paramv);
5211}
5212
5213static GVariant *
5214_sensor_value_skeleton_handle_get_property (
5215 GDBusConnection *connection G_GNUC_UNUSED,
5216 const gchar *sender G_GNUC_UNUSED,
5217 const gchar *object_path G_GNUC_UNUSED,
5218 const gchar *interface_name G_GNUC_UNUSED,
5219 const gchar *property_name,
5220 GError **error,
5221 gpointer user_data)
5222{
5223 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data);
5224 GValue value = G_VALUE_INIT;
5225 GParamSpec *pspec;
5226 _ExtendedGDBusPropertyInfo *info;
5227 GVariant *ret;
5228 ret = NULL;
5229 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, property_name);
5230 g_assert (info != NULL);
5231 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
5232 if (pspec == NULL)
5233 {
5234 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
5235 }
5236 else
5237 {
5238 g_value_init (&value, pspec->value_type);
5239 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
5240 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
5241 g_value_unset (&value);
5242 }
5243 return ret;
5244}
5245
5246static gboolean
5247_sensor_value_skeleton_handle_set_property (
5248 GDBusConnection *connection G_GNUC_UNUSED,
5249 const gchar *sender G_GNUC_UNUSED,
5250 const gchar *object_path G_GNUC_UNUSED,
5251 const gchar *interface_name G_GNUC_UNUSED,
5252 const gchar *property_name,
5253 GVariant *variant,
5254 GError **error,
5255 gpointer user_data)
5256{
5257 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data);
5258 GValue value = G_VALUE_INIT;
5259 GParamSpec *pspec;
5260 _ExtendedGDBusPropertyInfo *info;
5261 gboolean ret;
5262 ret = FALSE;
5263 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_value_interface_info.parent_struct, property_name);
5264 g_assert (info != NULL);
5265 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
5266 if (pspec == NULL)
5267 {
5268 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
5269 }
5270 else
5271 {
5272 if (info->use_gvariant)
5273 g_value_set_variant (&value, variant);
5274 else
5275 g_dbus_gvariant_to_gvalue (variant, &value);
5276 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
5277 g_value_unset (&value);
5278 ret = TRUE;
5279 }
5280 return ret;
5281}
5282
5283static const GDBusInterfaceVTable _sensor_value_skeleton_vtable =
5284{
5285 _sensor_value_skeleton_handle_method_call,
5286 _sensor_value_skeleton_handle_get_property,
5287 _sensor_value_skeleton_handle_set_property,
5288 {NULL}
5289};
5290
5291static GDBusInterfaceInfo *
5292sensor_value_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
5293{
5294 return sensor_value_interface_info ();
5295}
5296
5297static GDBusInterfaceVTable *
5298sensor_value_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
5299{
5300 return (GDBusInterfaceVTable *) &_sensor_value_skeleton_vtable;
5301}
5302
5303static GVariant *
5304sensor_value_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
5305{
5306 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (_skeleton);
5307
5308 GVariantBuilder builder;
5309 guint n;
5310 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
5311 if (_sensor_value_interface_info.parent_struct.properties == NULL)
5312 goto out;
5313 for (n = 0; _sensor_value_interface_info.parent_struct.properties[n] != NULL; n++)
5314 {
5315 GDBusPropertyInfo *info = _sensor_value_interface_info.parent_struct.properties[n];
5316 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
5317 {
5318 GVariant *value;
5319 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);
5320 if (value != NULL)
5321 {
5322 g_variant_take_ref (value);
5323 g_variant_builder_add (&builder, "{sv}", info->name, value);
5324 g_variant_unref (value);
5325 }
5326 }
5327 }
5328out:
5329 return g_variant_builder_end (&builder);
5330}
5331
5332static gboolean _sensor_value_emit_changed (gpointer user_data);
5333
5334static void
5335sensor_value_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
5336{
5337 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (_skeleton);
5338 gboolean emit_changed = FALSE;
5339
5340 g_mutex_lock (&skeleton->priv->lock);
5341 if (skeleton->priv->changed_properties_idle_source != NULL)
5342 {
5343 g_source_destroy (skeleton->priv->changed_properties_idle_source);
5344 skeleton->priv->changed_properties_idle_source = NULL;
5345 emit_changed = TRUE;
5346 }
5347 g_mutex_unlock (&skeleton->priv->lock);
5348
5349 if (emit_changed)
5350 _sensor_value_emit_changed (skeleton);
5351}
5352
5353static void
5354_sensor_value_on_signal_changed (
5355 SensorValue *object,
5356 GVariant *arg_value,
5357 const gchar *arg_units)
5358{
5359 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5360
5361 GList *connections, *l;
5362 GVariant *signal_variant;
5363 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
5364
5365 signal_variant = g_variant_ref_sink (g_variant_new ("(@vs)",
5366 arg_value,
5367 arg_units));
5368 for (l = connections; l != NULL; l = l->next)
5369 {
5370 GDBusConnection *connection = l->data;
5371 g_dbus_connection_emit_signal (connection,
5372 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorValue", "Changed",
5373 signal_variant, NULL);
5374 }
5375 g_variant_unref (signal_variant);
5376 g_list_free_full (connections, g_object_unref);
5377}
5378
5379static void
Norman James32e74e22015-09-15 21:28:06 -05005380_sensor_value_on_signal_error (
5381 SensorValue *object)
5382{
5383 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5384
5385 GList *connections, *l;
5386 GVariant *signal_variant;
5387 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
5388
5389 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
5390 for (l = connections; l != NULL; l = l->next)
5391 {
5392 GDBusConnection *connection = l->data;
5393 g_dbus_connection_emit_signal (connection,
5394 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorValue", "Error",
5395 signal_variant, NULL);
5396 }
5397 g_variant_unref (signal_variant);
5398 g_list_free_full (connections, g_object_unref);
5399}
5400
5401static void
Norman James362a80f2015-09-14 14:04:39 -05005402_sensor_value_on_signal_heartbeat (
5403 SensorValue *object,
5404 const gchar *arg_bus_name)
5405{
5406 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5407
5408 GList *connections, *l;
5409 GVariant *signal_variant;
5410 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
5411
5412 signal_variant = g_variant_ref_sink (g_variant_new ("(s)",
5413 arg_bus_name));
5414 for (l = connections; l != NULL; l = l->next)
5415 {
5416 GDBusConnection *connection = l->data;
5417 g_dbus_connection_emit_signal (connection,
5418 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorValue", "Heartbeat",
5419 signal_variant, NULL);
5420 }
5421 g_variant_unref (signal_variant);
5422 g_list_free_full (connections, g_object_unref);
5423}
5424
5425static void sensor_value_skeleton_iface_init (SensorValueIface *iface);
5426#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
5427G_DEFINE_TYPE_WITH_CODE (SensorValueSkeleton, sensor_value_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
5428 G_ADD_PRIVATE (SensorValueSkeleton)
5429 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_skeleton_iface_init));
5430
5431#else
5432G_DEFINE_TYPE_WITH_CODE (SensorValueSkeleton, sensor_value_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
5433 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_VALUE, sensor_value_skeleton_iface_init));
5434
5435#endif
5436static void
5437sensor_value_skeleton_finalize (GObject *object)
5438{
5439 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5440 guint n;
Norman Jamesdfdaca92015-09-27 22:11:15 -05005441 for (n = 0; n < 5; n++)
Norman James362a80f2015-09-14 14:04:39 -05005442 g_value_unset (&skeleton->priv->properties[n]);
5443 g_free (skeleton->priv->properties);
5444 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
5445 if (skeleton->priv->changed_properties_idle_source != NULL)
5446 g_source_destroy (skeleton->priv->changed_properties_idle_source);
5447 g_main_context_unref (skeleton->priv->context);
5448 g_mutex_clear (&skeleton->priv->lock);
5449 G_OBJECT_CLASS (sensor_value_skeleton_parent_class)->finalize (object);
5450}
5451
5452static void
5453sensor_value_skeleton_get_property (GObject *object,
5454 guint prop_id,
5455 GValue *value,
5456 GParamSpec *pspec G_GNUC_UNUSED)
5457{
5458 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
Norman Jamesdfdaca92015-09-27 22:11:15 -05005459 g_assert (prop_id != 0 && prop_id - 1 < 5);
Norman James362a80f2015-09-14 14:04:39 -05005460 g_mutex_lock (&skeleton->priv->lock);
5461 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
5462 g_mutex_unlock (&skeleton->priv->lock);
5463}
5464
5465static gboolean
5466_sensor_value_emit_changed (gpointer user_data)
5467{
5468 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (user_data);
5469 GList *l;
5470 GVariantBuilder builder;
5471 GVariantBuilder invalidated_builder;
5472 guint num_changes;
5473
5474 g_mutex_lock (&skeleton->priv->lock);
5475 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
5476 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
5477 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
5478 {
5479 ChangedProperty *cp = l->data;
5480 GVariant *variant;
5481 const GValue *cur_value;
5482
5483 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
5484 if (!_g_value_equal (cur_value, &cp->orig_value))
5485 {
5486 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
5487 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
5488 g_variant_unref (variant);
5489 num_changes++;
5490 }
5491 }
5492 if (num_changes > 0)
5493 {
5494 GList *connections, *ll;
5495 GVariant *signal_variant;
5496 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorValue",
5497 &builder, &invalidated_builder));
5498 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
5499 for (ll = connections; ll != NULL; ll = ll->next)
5500 {
5501 GDBusConnection *connection = ll->data;
5502
5503 g_dbus_connection_emit_signal (connection,
5504 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
5505 "org.freedesktop.DBus.Properties",
5506 "PropertiesChanged",
5507 signal_variant,
5508 NULL);
5509 }
5510 g_variant_unref (signal_variant);
5511 g_list_free_full (connections, g_object_unref);
5512 }
5513 else
5514 {
5515 g_variant_builder_clear (&builder);
5516 g_variant_builder_clear (&invalidated_builder);
5517 }
5518 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
5519 skeleton->priv->changed_properties = NULL;
5520 skeleton->priv->changed_properties_idle_source = NULL;
5521 g_mutex_unlock (&skeleton->priv->lock);
5522 return FALSE;
5523}
5524
5525static void
5526_sensor_value_schedule_emit_changed (SensorValueSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
5527{
5528 ChangedProperty *cp;
5529 GList *l;
5530 cp = NULL;
5531 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
5532 {
5533 ChangedProperty *i_cp = l->data;
5534 if (i_cp->info == info)
5535 {
5536 cp = i_cp;
5537 break;
5538 }
5539 }
5540 if (cp == NULL)
5541 {
5542 cp = g_new0 (ChangedProperty, 1);
5543 cp->prop_id = prop_id;
5544 cp->info = info;
5545 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
5546 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
5547 g_value_copy (orig_value, &cp->orig_value);
5548 }
5549}
5550
5551static void
5552sensor_value_skeleton_notify (GObject *object,
5553 GParamSpec *pspec G_GNUC_UNUSED)
5554{
5555 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5556 g_mutex_lock (&skeleton->priv->lock);
5557 if (skeleton->priv->changed_properties != NULL &&
5558 skeleton->priv->changed_properties_idle_source == NULL)
5559 {
5560 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
5561 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
5562 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_value_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
Adriana Kobylak2cb27752015-10-19 16:23:14 -05005563 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _sensor_value_emit_changed");
Norman James362a80f2015-09-14 14:04:39 -05005564 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
5565 g_source_unref (skeleton->priv->changed_properties_idle_source);
5566 }
5567 g_mutex_unlock (&skeleton->priv->lock);
5568}
5569
5570static void
5571sensor_value_skeleton_set_property (GObject *object,
5572 guint prop_id,
5573 const GValue *value,
5574 GParamSpec *pspec)
5575{
5576 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
Norman Jamesdfdaca92015-09-27 22:11:15 -05005577 g_assert (prop_id != 0 && prop_id - 1 < 5);
Norman James362a80f2015-09-14 14:04:39 -05005578 g_mutex_lock (&skeleton->priv->lock);
5579 g_object_freeze_notify (object);
5580 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
5581 {
5582 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
5583 _sensor_value_schedule_emit_changed (skeleton, _sensor_value_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
5584 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
5585 g_object_notify_by_pspec (object, pspec);
5586 }
5587 g_mutex_unlock (&skeleton->priv->lock);
5588 g_object_thaw_notify (object);
5589}
5590
5591static void
5592sensor_value_skeleton_init (SensorValueSkeleton *skeleton)
5593{
5594#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
5595 skeleton->priv = sensor_value_skeleton_get_instance_private (skeleton);
5596#else
5597 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_VALUE_SKELETON, SensorValueSkeletonPrivate);
5598#endif
5599
5600 g_mutex_init (&skeleton->priv->lock);
5601 skeleton->priv->context = g_main_context_ref_thread_default ();
Norman Jamesdfdaca92015-09-27 22:11:15 -05005602 skeleton->priv->properties = g_new0 (GValue, 5);
Norman James362a80f2015-09-14 14:04:39 -05005603 g_value_init (&skeleton->priv->properties[0], G_TYPE_VARIANT);
5604 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
5605 g_value_init (&skeleton->priv->properties[2], G_TYPE_INT);
5606 g_value_init (&skeleton->priv->properties[3], G_TYPE_INT);
5607 g_value_init (&skeleton->priv->properties[4], G_TYPE_BOOLEAN);
Norman James362a80f2015-09-14 14:04:39 -05005608}
5609
5610static GVariant *
5611sensor_value_skeleton_get_value (SensorValue *object)
5612{
5613 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5614 GVariant *value;
5615 g_mutex_lock (&skeleton->priv->lock);
5616 value = g_value_get_variant (&(skeleton->priv->properties[0]));
5617 g_mutex_unlock (&skeleton->priv->lock);
5618 return value;
5619}
5620
5621static const gchar *
5622sensor_value_skeleton_get_units (SensorValue *object)
5623{
5624 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5625 const gchar *value;
5626 g_mutex_lock (&skeleton->priv->lock);
5627 value = g_value_get_string (&(skeleton->priv->properties[1]));
5628 g_mutex_unlock (&skeleton->priv->lock);
5629 return value;
5630}
5631
5632static gint
5633sensor_value_skeleton_get_poll_interval (SensorValue *object)
5634{
5635 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5636 gint value;
5637 g_mutex_lock (&skeleton->priv->lock);
5638 value = g_value_get_int (&(skeleton->priv->properties[2]));
5639 g_mutex_unlock (&skeleton->priv->lock);
5640 return value;
5641}
5642
5643static gint
5644sensor_value_skeleton_get_heatbeat (SensorValue *object)
5645{
5646 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5647 gint value;
5648 g_mutex_lock (&skeleton->priv->lock);
5649 value = g_value_get_int (&(skeleton->priv->properties[3]));
5650 g_mutex_unlock (&skeleton->priv->lock);
5651 return value;
5652}
5653
5654static gboolean
5655sensor_value_skeleton_get_settable (SensorValue *object)
5656{
5657 SensorValueSkeleton *skeleton = SENSOR_VALUE_SKELETON (object);
5658 gboolean value;
5659 g_mutex_lock (&skeleton->priv->lock);
5660 value = g_value_get_boolean (&(skeleton->priv->properties[4]));
5661 g_mutex_unlock (&skeleton->priv->lock);
5662 return value;
5663}
5664
Norman James362a80f2015-09-14 14:04:39 -05005665static void
5666sensor_value_skeleton_class_init (SensorValueSkeletonClass *klass)
5667{
5668 GObjectClass *gobject_class;
5669 GDBusInterfaceSkeletonClass *skeleton_class;
5670
5671 gobject_class = G_OBJECT_CLASS (klass);
5672 gobject_class->finalize = sensor_value_skeleton_finalize;
5673 gobject_class->get_property = sensor_value_skeleton_get_property;
5674 gobject_class->set_property = sensor_value_skeleton_set_property;
5675 gobject_class->notify = sensor_value_skeleton_notify;
5676
5677
5678 sensor_value_override_properties (gobject_class, 1);
5679
5680 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
5681 skeleton_class->get_info = sensor_value_skeleton_dbus_interface_get_info;
5682 skeleton_class->get_properties = sensor_value_skeleton_dbus_interface_get_properties;
5683 skeleton_class->flush = sensor_value_skeleton_dbus_interface_flush;
5684 skeleton_class->get_vtable = sensor_value_skeleton_dbus_interface_get_vtable;
5685
5686#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
5687 g_type_class_add_private (klass, sizeof (SensorValueSkeletonPrivate));
5688#endif
5689}
5690
5691static void
5692sensor_value_skeleton_iface_init (SensorValueIface *iface)
5693{
5694 iface->changed = _sensor_value_on_signal_changed;
Norman James32e74e22015-09-15 21:28:06 -05005695 iface->error = _sensor_value_on_signal_error;
Norman James362a80f2015-09-14 14:04:39 -05005696 iface->heartbeat = _sensor_value_on_signal_heartbeat;
5697 iface->get_value = sensor_value_skeleton_get_value;
5698 iface->get_units = sensor_value_skeleton_get_units;
5699 iface->get_poll_interval = sensor_value_skeleton_get_poll_interval;
5700 iface->get_heatbeat = sensor_value_skeleton_get_heatbeat;
5701 iface->get_settable = sensor_value_skeleton_get_settable;
Norman James362a80f2015-09-14 14:04:39 -05005702}
5703
5704/**
5705 * sensor_value_skeleton_new:
5706 *
5707 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorValue.top_of_page">org.openbmc.SensorValue</link>.
5708 *
5709 * Returns: (transfer full) (type SensorValueSkeleton): The skeleton object.
5710 */
5711SensorValue *
5712sensor_value_skeleton_new (void)
5713{
5714 return SENSOR_VALUE (g_object_new (TYPE_SENSOR_VALUE_SKELETON, NULL));
5715}
5716
5717/* ------------------------------------------------------------------------
5718 * Code for interface org.openbmc.SensorThreshold
5719 * ------------------------------------------------------------------------
5720 */
5721
5722/**
5723 * SECTION:SensorThreshold
5724 * @title: SensorThreshold
5725 * @short_description: Generated C code for the org.openbmc.SensorThreshold D-Bus interface
5726 *
5727 * 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.
5728 */
5729
5730/* ---- Introspection data for org.openbmc.SensorThreshold ---- */
5731
5732static const _ExtendedGDBusArgInfo _sensor_threshold_method_info_get_state_OUT_ARG_state =
5733{
5734 {
5735 -1,
5736 (gchar *) "state",
5737 (gchar *) "y",
5738 NULL
5739 },
5740 FALSE
5741};
5742
5743static const _ExtendedGDBusArgInfo * const _sensor_threshold_method_info_get_state_OUT_ARG_pointers[] =
5744{
5745 &_sensor_threshold_method_info_get_state_OUT_ARG_state,
5746 NULL
5747};
5748
5749static const _ExtendedGDBusMethodInfo _sensor_threshold_method_info_get_state =
5750{
5751 {
5752 -1,
5753 (gchar *) "getState",
5754 NULL,
5755 (GDBusArgInfo **) &_sensor_threshold_method_info_get_state_OUT_ARG_pointers,
5756 NULL
5757 },
5758 "handle-get-state",
5759 FALSE
5760};
5761
5762static const _ExtendedGDBusMethodInfo * const _sensor_threshold_method_info_pointers[] =
5763{
5764 &_sensor_threshold_method_info_get_state,
5765 NULL
5766};
5767
5768static const _ExtendedGDBusSignalInfo _sensor_threshold_signal_info_warning =
5769{
5770 {
5771 -1,
5772 (gchar *) "Warning",
5773 NULL,
5774 NULL
5775 },
5776 "warning"
5777};
5778
5779static const _ExtendedGDBusSignalInfo _sensor_threshold_signal_info_critical =
5780{
5781 {
5782 -1,
5783 (gchar *) "Critical",
5784 NULL,
5785 NULL
5786 },
5787 "critical"
5788};
5789
5790static const _ExtendedGDBusSignalInfo _sensor_threshold_signal_info_normal =
5791{
5792 {
5793 -1,
5794 (gchar *) "Normal",
5795 NULL,
5796 NULL
5797 },
5798 "normal"
5799};
5800
5801static const _ExtendedGDBusSignalInfo * const _sensor_threshold_signal_info_pointers[] =
5802{
5803 &_sensor_threshold_signal_info_warning,
5804 &_sensor_threshold_signal_info_critical,
5805 &_sensor_threshold_signal_info_normal,
5806 NULL
5807};
5808
5809static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_lower_critical =
5810{
5811 {
5812 -1,
5813 (gchar *) "lower_critical",
5814 (gchar *) "v",
5815 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
5816 NULL
5817 },
5818 "lower-critical",
5819 FALSE
5820};
5821
5822static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_lower_warning =
5823{
5824 {
5825 -1,
5826 (gchar *) "lower_warning",
5827 (gchar *) "v",
5828 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
5829 NULL
5830 },
5831 "lower-warning",
5832 FALSE
5833};
5834
5835static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_upper_warning =
5836{
5837 {
5838 -1,
5839 (gchar *) "upper_warning",
5840 (gchar *) "v",
5841 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
5842 NULL
5843 },
5844 "upper-warning",
5845 FALSE
5846};
5847
5848static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_upper_critical =
5849{
5850 {
5851 -1,
5852 (gchar *) "upper_critical",
5853 (gchar *) "v",
5854 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
5855 NULL
5856 },
5857 "upper-critical",
5858 FALSE
5859};
5860
5861static const _ExtendedGDBusPropertyInfo _sensor_threshold_property_info_state =
5862{
5863 {
5864 -1,
5865 (gchar *) "state",
5866 (gchar *) "y",
5867 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
5868 NULL
5869 },
5870 "state",
5871 FALSE
5872};
5873
5874static const _ExtendedGDBusPropertyInfo * const _sensor_threshold_property_info_pointers[] =
5875{
5876 &_sensor_threshold_property_info_lower_critical,
5877 &_sensor_threshold_property_info_lower_warning,
5878 &_sensor_threshold_property_info_upper_warning,
5879 &_sensor_threshold_property_info_upper_critical,
5880 &_sensor_threshold_property_info_state,
5881 NULL
5882};
5883
5884static const _ExtendedGDBusInterfaceInfo _sensor_threshold_interface_info =
5885{
5886 {
5887 -1,
5888 (gchar *) "org.openbmc.SensorThreshold",
5889 (GDBusMethodInfo **) &_sensor_threshold_method_info_pointers,
5890 (GDBusSignalInfo **) &_sensor_threshold_signal_info_pointers,
5891 (GDBusPropertyInfo **) &_sensor_threshold_property_info_pointers,
5892 NULL
5893 },
5894 "sensor-threshold",
5895};
5896
5897
5898/**
5899 * sensor_threshold_interface_info:
5900 *
5901 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link> D-Bus interface.
5902 *
5903 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
5904 */
5905GDBusInterfaceInfo *
5906sensor_threshold_interface_info (void)
5907{
5908 return (GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct;
5909}
5910
5911/**
5912 * sensor_threshold_override_properties:
5913 * @klass: The class structure for a #GObject<!-- -->-derived class.
5914 * @property_id_begin: The property id to assign to the first overridden property.
5915 *
5916 * Overrides all #GObject properties in the #SensorThreshold interface for a concrete class.
5917 * The properties are overridden in the order they are defined.
5918 *
5919 * Returns: The last property id.
5920 */
5921guint
5922sensor_threshold_override_properties (GObjectClass *klass, guint property_id_begin)
5923{
5924 g_object_class_override_property (klass, property_id_begin++, "lower-critical");
5925 g_object_class_override_property (klass, property_id_begin++, "lower-warning");
5926 g_object_class_override_property (klass, property_id_begin++, "upper-warning");
5927 g_object_class_override_property (klass, property_id_begin++, "upper-critical");
5928 g_object_class_override_property (klass, property_id_begin++, "state");
5929 return property_id_begin - 1;
5930}
5931
5932
5933
5934/**
5935 * SensorThreshold:
5936 *
5937 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link>.
5938 */
5939
5940/**
5941 * SensorThresholdIface:
5942 * @parent_iface: The parent interface.
5943 * @handle_get_state: Handler for the #SensorThreshold::handle-get-state signal.
5944 * @get_lower_critical: Getter for the #SensorThreshold:lower-critical property.
5945 * @get_lower_warning: Getter for the #SensorThreshold:lower-warning property.
5946 * @get_state: Getter for the #SensorThreshold:state property.
5947 * @get_upper_critical: Getter for the #SensorThreshold:upper-critical property.
5948 * @get_upper_warning: Getter for the #SensorThreshold:upper-warning property.
5949 * @critical: Handler for the #SensorThreshold::critical signal.
5950 * @normal: Handler for the #SensorThreshold::normal signal.
5951 * @warning: Handler for the #SensorThreshold::warning signal.
5952 *
5953 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link>.
5954 */
5955
5956typedef SensorThresholdIface SensorThresholdInterface;
5957G_DEFINE_INTERFACE (SensorThreshold, sensor_threshold, G_TYPE_OBJECT);
5958
5959static void
5960sensor_threshold_default_init (SensorThresholdIface *iface)
5961{
5962 /* GObject signals for incoming D-Bus method calls: */
5963 /**
5964 * SensorThreshold::handle-get-state:
5965 * @object: A #SensorThreshold.
5966 * @invocation: A #GDBusMethodInvocation.
5967 *
5968 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SensorThreshold.getState">getState()</link> D-Bus method.
5969 *
5970 * 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.
5971 *
5972 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
5973 */
5974 g_signal_new ("handle-get-state",
5975 G_TYPE_FROM_INTERFACE (iface),
5976 G_SIGNAL_RUN_LAST,
5977 G_STRUCT_OFFSET (SensorThresholdIface, handle_get_state),
5978 g_signal_accumulator_true_handled,
5979 NULL,
5980 g_cclosure_marshal_generic,
5981 G_TYPE_BOOLEAN,
5982 1,
5983 G_TYPE_DBUS_METHOD_INVOCATION);
5984
5985 /* GObject signals for received D-Bus signals: */
5986 /**
5987 * SensorThreshold::warning:
5988 * @object: A #SensorThreshold.
5989 *
5990 * 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.
5991 *
5992 * 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.
5993 */
5994 g_signal_new ("warning",
5995 G_TYPE_FROM_INTERFACE (iface),
5996 G_SIGNAL_RUN_LAST,
5997 G_STRUCT_OFFSET (SensorThresholdIface, warning),
5998 NULL,
5999 NULL,
6000 g_cclosure_marshal_generic,
6001 G_TYPE_NONE,
6002 0);
6003
6004 /**
6005 * SensorThreshold::critical:
6006 * @object: A #SensorThreshold.
6007 *
6008 * 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.
6009 *
6010 * 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.
6011 */
6012 g_signal_new ("critical",
6013 G_TYPE_FROM_INTERFACE (iface),
6014 G_SIGNAL_RUN_LAST,
6015 G_STRUCT_OFFSET (SensorThresholdIface, critical),
6016 NULL,
6017 NULL,
6018 g_cclosure_marshal_generic,
6019 G_TYPE_NONE,
6020 0);
6021
6022 /**
6023 * SensorThreshold::normal:
6024 * @object: A #SensorThreshold.
6025 *
6026 * 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.
6027 *
6028 * 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.
6029 */
6030 g_signal_new ("normal",
6031 G_TYPE_FROM_INTERFACE (iface),
6032 G_SIGNAL_RUN_LAST,
6033 G_STRUCT_OFFSET (SensorThresholdIface, normal),
6034 NULL,
6035 NULL,
6036 g_cclosure_marshal_generic,
6037 G_TYPE_NONE,
6038 0);
6039
6040 /* GObject properties for D-Bus properties: */
6041 /**
6042 * SensorThreshold:lower-critical:
6043 *
6044 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link>.
6045 *
6046 * 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.
6047 */
6048 g_object_interface_install_property (iface,
6049 g_param_spec_variant ("lower-critical", "lower_critical", "lower_critical", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
6050 /**
6051 * SensorThreshold:lower-warning:
6052 *
6053 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link>.
6054 *
6055 * 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.
6056 */
6057 g_object_interface_install_property (iface,
6058 g_param_spec_variant ("lower-warning", "lower_warning", "lower_warning", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
6059 /**
6060 * SensorThreshold:upper-warning:
6061 *
6062 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link>.
6063 *
6064 * 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.
6065 */
6066 g_object_interface_install_property (iface,
6067 g_param_spec_variant ("upper-warning", "upper_warning", "upper_warning", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
6068 /**
6069 * SensorThreshold:upper-critical:
6070 *
6071 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link>.
6072 *
6073 * 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.
6074 */
6075 g_object_interface_install_property (iface,
6076 g_param_spec_variant ("upper-critical", "upper_critical", "upper_critical", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
6077 /**
6078 * SensorThreshold:state:
6079 *
6080 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorThreshold.state">"state"</link>.
6081 *
6082 * 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.
6083 */
6084 g_object_interface_install_property (iface,
6085 g_param_spec_uchar ("state", "state", "state", 0, 255, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
6086}
6087
6088/**
6089 * sensor_threshold_get_lower_critical: (skip)
6090 * @object: A #SensorThreshold.
6091 *
6092 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link> D-Bus property.
6093 *
6094 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6095 *
6096 * <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>
6097 *
6098 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
6099 */
6100GVariant *
6101sensor_threshold_get_lower_critical (SensorThreshold *object)
6102{
6103 return SENSOR_THRESHOLD_GET_IFACE (object)->get_lower_critical (object);
6104}
6105
6106/**
6107 * sensor_threshold_dup_lower_critical: (skip)
6108 * @object: A #SensorThreshold.
6109 *
6110 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link> D-Bus property.
6111 *
6112 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6113 *
6114 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
6115 */
6116GVariant *
6117sensor_threshold_dup_lower_critical (SensorThreshold *object)
6118{
6119 GVariant *value;
6120 g_object_get (G_OBJECT (object), "lower-critical", &value, NULL);
6121 return value;
6122}
6123
6124/**
6125 * sensor_threshold_set_lower_critical: (skip)
6126 * @object: A #SensorThreshold.
6127 * @value: The value to set.
6128 *
6129 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_critical">"lower_critical"</link> D-Bus property to @value.
6130 *
6131 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6132 */
6133void
6134sensor_threshold_set_lower_critical (SensorThreshold *object, GVariant *value)
6135{
6136 g_object_set (G_OBJECT (object), "lower-critical", value, NULL);
6137}
6138
6139/**
6140 * sensor_threshold_get_lower_warning: (skip)
6141 * @object: A #SensorThreshold.
6142 *
6143 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link> D-Bus property.
6144 *
6145 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6146 *
6147 * <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>
6148 *
6149 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
6150 */
6151GVariant *
6152sensor_threshold_get_lower_warning (SensorThreshold *object)
6153{
6154 return SENSOR_THRESHOLD_GET_IFACE (object)->get_lower_warning (object);
6155}
6156
6157/**
6158 * sensor_threshold_dup_lower_warning: (skip)
6159 * @object: A #SensorThreshold.
6160 *
6161 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link> D-Bus property.
6162 *
6163 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6164 *
6165 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
6166 */
6167GVariant *
6168sensor_threshold_dup_lower_warning (SensorThreshold *object)
6169{
6170 GVariant *value;
6171 g_object_get (G_OBJECT (object), "lower-warning", &value, NULL);
6172 return value;
6173}
6174
6175/**
6176 * sensor_threshold_set_lower_warning: (skip)
6177 * @object: A #SensorThreshold.
6178 * @value: The value to set.
6179 *
6180 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.lower_warning">"lower_warning"</link> D-Bus property to @value.
6181 *
6182 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6183 */
6184void
6185sensor_threshold_set_lower_warning (SensorThreshold *object, GVariant *value)
6186{
6187 g_object_set (G_OBJECT (object), "lower-warning", value, NULL);
6188}
6189
6190/**
6191 * sensor_threshold_get_upper_warning: (skip)
6192 * @object: A #SensorThreshold.
6193 *
6194 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link> D-Bus property.
6195 *
6196 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6197 *
6198 * <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>
6199 *
6200 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
6201 */
6202GVariant *
6203sensor_threshold_get_upper_warning (SensorThreshold *object)
6204{
6205 return SENSOR_THRESHOLD_GET_IFACE (object)->get_upper_warning (object);
6206}
6207
6208/**
6209 * sensor_threshold_dup_upper_warning: (skip)
6210 * @object: A #SensorThreshold.
6211 *
6212 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link> D-Bus property.
6213 *
6214 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6215 *
6216 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
6217 */
6218GVariant *
6219sensor_threshold_dup_upper_warning (SensorThreshold *object)
6220{
6221 GVariant *value;
6222 g_object_get (G_OBJECT (object), "upper-warning", &value, NULL);
6223 return value;
6224}
6225
6226/**
6227 * sensor_threshold_set_upper_warning: (skip)
6228 * @object: A #SensorThreshold.
6229 * @value: The value to set.
6230 *
6231 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_warning">"upper_warning"</link> D-Bus property to @value.
6232 *
6233 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6234 */
6235void
6236sensor_threshold_set_upper_warning (SensorThreshold *object, GVariant *value)
6237{
6238 g_object_set (G_OBJECT (object), "upper-warning", value, NULL);
6239}
6240
6241/**
6242 * sensor_threshold_get_upper_critical: (skip)
6243 * @object: A #SensorThreshold.
6244 *
6245 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link> D-Bus property.
6246 *
6247 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6248 *
6249 * <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>
6250 *
6251 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
6252 */
6253GVariant *
6254sensor_threshold_get_upper_critical (SensorThreshold *object)
6255{
6256 return SENSOR_THRESHOLD_GET_IFACE (object)->get_upper_critical (object);
6257}
6258
6259/**
6260 * sensor_threshold_dup_upper_critical: (skip)
6261 * @object: A #SensorThreshold.
6262 *
6263 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link> D-Bus property.
6264 *
6265 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6266 *
6267 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
6268 */
6269GVariant *
6270sensor_threshold_dup_upper_critical (SensorThreshold *object)
6271{
6272 GVariant *value;
6273 g_object_get (G_OBJECT (object), "upper-critical", &value, NULL);
6274 return value;
6275}
6276
6277/**
6278 * sensor_threshold_set_upper_critical: (skip)
6279 * @object: A #SensorThreshold.
6280 * @value: The value to set.
6281 *
6282 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.upper_critical">"upper_critical"</link> D-Bus property to @value.
6283 *
6284 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
6285 */
6286void
6287sensor_threshold_set_upper_critical (SensorThreshold *object, GVariant *value)
6288{
6289 g_object_set (G_OBJECT (object), "upper-critical", value, NULL);
6290}
6291
6292/**
6293 * sensor_threshold_get_state: (skip)
6294 * @object: A #SensorThreshold.
6295 *
6296 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorThreshold.state">"state"</link> D-Bus property.
6297 *
6298 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
6299 *
6300 * Returns: The property value.
6301 */
6302guchar
6303sensor_threshold_get_state (SensorThreshold *object)
6304{
6305 return SENSOR_THRESHOLD_GET_IFACE (object)->get_state (object);
6306}
6307
6308/**
6309 * sensor_threshold_set_state: (skip)
6310 * @object: A #SensorThreshold.
6311 * @value: The value to set.
6312 *
6313 * Sets the <link linkend="gdbus-property-org-openbmc-SensorThreshold.state">"state"</link> D-Bus property to @value.
6314 *
6315 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
6316 */
6317void
6318sensor_threshold_set_state (SensorThreshold *object, guchar value)
6319{
6320 g_object_set (G_OBJECT (object), "state", value, NULL);
6321}
6322
6323/**
6324 * sensor_threshold_emit_warning:
6325 * @object: A #SensorThreshold.
6326 *
6327 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorThreshold.Warning">"Warning"</link> D-Bus signal.
6328 */
6329void
6330sensor_threshold_emit_warning (
6331 SensorThreshold *object)
6332{
6333 g_signal_emit_by_name (object, "warning");
6334}
6335
6336/**
6337 * sensor_threshold_emit_critical:
6338 * @object: A #SensorThreshold.
6339 *
6340 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorThreshold.Critical">"Critical"</link> D-Bus signal.
6341 */
6342void
6343sensor_threshold_emit_critical (
6344 SensorThreshold *object)
6345{
6346 g_signal_emit_by_name (object, "critical");
6347}
6348
6349/**
6350 * sensor_threshold_emit_normal:
6351 * @object: A #SensorThreshold.
6352 *
6353 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorThreshold.Normal">"Normal"</link> D-Bus signal.
6354 */
6355void
6356sensor_threshold_emit_normal (
6357 SensorThreshold *object)
6358{
6359 g_signal_emit_by_name (object, "normal");
6360}
6361
6362/**
6363 * sensor_threshold_call_get_state:
6364 * @proxy: A #SensorThresholdProxy.
6365 * @cancellable: (allow-none): A #GCancellable or %NULL.
6366 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
6367 * @user_data: User data to pass to @callback.
6368 *
6369 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SensorThreshold.getState">getState()</link> D-Bus method on @proxy.
6370 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
6371 * You can then call sensor_threshold_call_get_state_finish() to get the result of the operation.
6372 *
6373 * See sensor_threshold_call_get_state_sync() for the synchronous, blocking version of this method.
6374 */
6375void
6376sensor_threshold_call_get_state (
6377 SensorThreshold *proxy,
6378 GCancellable *cancellable,
6379 GAsyncReadyCallback callback,
6380 gpointer user_data)
6381{
6382 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
6383 "getState",
6384 g_variant_new ("()"),
6385 G_DBUS_CALL_FLAGS_NONE,
6386 -1,
6387 cancellable,
6388 callback,
6389 user_data);
6390}
6391
6392/**
6393 * sensor_threshold_call_get_state_finish:
6394 * @proxy: A #SensorThresholdProxy.
6395 * @out_state: (out): Return location for return parameter or %NULL to ignore.
6396 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_threshold_call_get_state().
6397 * @error: Return location for error or %NULL.
6398 *
6399 * Finishes an operation started with sensor_threshold_call_get_state().
6400 *
6401 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
6402 */
6403gboolean
6404sensor_threshold_call_get_state_finish (
6405 SensorThreshold *proxy,
6406 guchar *out_state,
6407 GAsyncResult *res,
6408 GError **error)
6409{
6410 GVariant *_ret;
6411 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
6412 if (_ret == NULL)
6413 goto _out;
6414 g_variant_get (_ret,
6415 "(y)",
6416 out_state);
6417 g_variant_unref (_ret);
6418_out:
6419 return _ret != NULL;
6420}
6421
6422/**
6423 * sensor_threshold_call_get_state_sync:
6424 * @proxy: A #SensorThresholdProxy.
6425 * @out_state: (out): Return location for return parameter or %NULL to ignore.
6426 * @cancellable: (allow-none): A #GCancellable or %NULL.
6427 * @error: Return location for error or %NULL.
6428 *
6429 * 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.
6430 *
6431 * See sensor_threshold_call_get_state() for the asynchronous version of this method.
6432 *
6433 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
6434 */
6435gboolean
6436sensor_threshold_call_get_state_sync (
6437 SensorThreshold *proxy,
6438 guchar *out_state,
6439 GCancellable *cancellable,
6440 GError **error)
6441{
6442 GVariant *_ret;
6443 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
6444 "getState",
6445 g_variant_new ("()"),
6446 G_DBUS_CALL_FLAGS_NONE,
6447 -1,
6448 cancellable,
6449 error);
6450 if (_ret == NULL)
6451 goto _out;
6452 g_variant_get (_ret,
6453 "(y)",
6454 out_state);
6455 g_variant_unref (_ret);
6456_out:
6457 return _ret != NULL;
6458}
6459
6460/**
6461 * sensor_threshold_complete_get_state:
6462 * @object: A #SensorThreshold.
6463 * @invocation: (transfer full): A #GDBusMethodInvocation.
6464 * @state: Parameter to return.
6465 *
6466 * 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.
6467 *
6468 * This method will free @invocation, you cannot use it afterwards.
6469 */
6470void
6471sensor_threshold_complete_get_state (
6472 SensorThreshold *object,
6473 GDBusMethodInvocation *invocation,
6474 guchar state)
6475{
6476 g_dbus_method_invocation_return_value (invocation,
6477 g_variant_new ("(y)",
6478 state));
6479}
6480
6481/* ------------------------------------------------------------------------ */
6482
6483/**
6484 * SensorThresholdProxy:
6485 *
6486 * The #SensorThresholdProxy structure contains only private data and should only be accessed using the provided API.
6487 */
6488
6489/**
6490 * SensorThresholdProxyClass:
6491 * @parent_class: The parent class.
6492 *
6493 * Class structure for #SensorThresholdProxy.
6494 */
6495
6496struct _SensorThresholdProxyPrivate
6497{
6498 GData *qdata;
6499};
6500
6501static void sensor_threshold_proxy_iface_init (SensorThresholdIface *iface);
6502
6503#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
6504G_DEFINE_TYPE_WITH_CODE (SensorThresholdProxy, sensor_threshold_proxy, G_TYPE_DBUS_PROXY,
6505 G_ADD_PRIVATE (SensorThresholdProxy)
6506 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_proxy_iface_init));
6507
6508#else
6509G_DEFINE_TYPE_WITH_CODE (SensorThresholdProxy, sensor_threshold_proxy, G_TYPE_DBUS_PROXY,
6510 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_proxy_iface_init));
6511
6512#endif
6513static void
6514sensor_threshold_proxy_finalize (GObject *object)
6515{
6516 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
6517 g_datalist_clear (&proxy->priv->qdata);
6518 G_OBJECT_CLASS (sensor_threshold_proxy_parent_class)->finalize (object);
6519}
6520
6521static void
6522sensor_threshold_proxy_get_property (GObject *object,
6523 guint prop_id,
6524 GValue *value,
6525 GParamSpec *pspec G_GNUC_UNUSED)
6526{
6527 const _ExtendedGDBusPropertyInfo *info;
6528 GVariant *variant;
6529 g_assert (prop_id != 0 && prop_id - 1 < 5);
6530 info = _sensor_threshold_property_info_pointers[prop_id - 1];
6531 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
6532 if (info->use_gvariant)
6533 {
6534 g_value_set_variant (value, variant);
6535 }
6536 else
6537 {
6538 if (variant != NULL)
6539 g_dbus_gvariant_to_gvalue (variant, value);
6540 }
6541 if (variant != NULL)
6542 g_variant_unref (variant);
6543}
6544
6545static void
6546sensor_threshold_proxy_set_property_cb (GDBusProxy *proxy,
6547 GAsyncResult *res,
6548 gpointer user_data)
6549{
6550 const _ExtendedGDBusPropertyInfo *info = user_data;
6551 GError *error;
6552 GVariant *_ret;
6553 error = NULL;
6554 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
6555 if (!_ret)
6556 {
6557 g_warning ("Error setting property '%s' on interface org.openbmc.SensorThreshold: %s (%s, %d)",
6558 info->parent_struct.name,
6559 error->message, g_quark_to_string (error->domain), error->code);
6560 g_error_free (error);
6561 }
6562 else
6563 {
6564 g_variant_unref (_ret);
6565 }
6566}
6567
6568static void
6569sensor_threshold_proxy_set_property (GObject *object,
6570 guint prop_id,
6571 const GValue *value,
6572 GParamSpec *pspec G_GNUC_UNUSED)
6573{
6574 const _ExtendedGDBusPropertyInfo *info;
6575 GVariant *variant;
6576 g_assert (prop_id != 0 && prop_id - 1 < 5);
6577 info = _sensor_threshold_property_info_pointers[prop_id - 1];
6578 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
6579 g_dbus_proxy_call (G_DBUS_PROXY (object),
6580 "org.freedesktop.DBus.Properties.Set",
6581 g_variant_new ("(ssv)", "org.openbmc.SensorThreshold", info->parent_struct.name, variant),
6582 G_DBUS_CALL_FLAGS_NONE,
6583 -1,
6584 NULL, (GAsyncReadyCallback) sensor_threshold_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
6585 g_variant_unref (variant);
6586}
6587
6588static void
6589sensor_threshold_proxy_g_signal (GDBusProxy *proxy,
6590 const gchar *sender_name G_GNUC_UNUSED,
6591 const gchar *signal_name,
6592 GVariant *parameters)
6593{
6594 _ExtendedGDBusSignalInfo *info;
6595 GVariantIter iter;
6596 GVariant *child;
6597 GValue *paramv;
6598 guint num_params;
6599 guint n;
6600 guint signal_id;
6601 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, signal_name);
6602 if (info == NULL)
6603 return;
6604 num_params = g_variant_n_children (parameters);
6605 paramv = g_new0 (GValue, num_params + 1);
6606 g_value_init (&paramv[0], TYPE_SENSOR_THRESHOLD);
6607 g_value_set_object (&paramv[0], proxy);
6608 g_variant_iter_init (&iter, parameters);
6609 n = 1;
6610 while ((child = g_variant_iter_next_value (&iter)) != NULL)
6611 {
6612 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
6613 if (arg_info->use_gvariant)
6614 {
6615 g_value_init (&paramv[n], G_TYPE_VARIANT);
6616 g_value_set_variant (&paramv[n], child);
6617 n++;
6618 }
6619 else
6620 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
6621 g_variant_unref (child);
6622 }
6623 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_THRESHOLD);
6624 g_signal_emitv (paramv, signal_id, 0, NULL);
6625 for (n = 0; n < num_params + 1; n++)
6626 g_value_unset (&paramv[n]);
6627 g_free (paramv);
6628}
6629
6630static void
6631sensor_threshold_proxy_g_properties_changed (GDBusProxy *_proxy,
6632 GVariant *changed_properties,
6633 const gchar *const *invalidated_properties)
6634{
6635 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (_proxy);
6636 guint n;
6637 const gchar *key;
6638 GVariantIter *iter;
6639 _ExtendedGDBusPropertyInfo *info;
6640 g_variant_get (changed_properties, "a{sv}", &iter);
6641 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
6642 {
6643 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, key);
6644 g_datalist_remove_data (&proxy->priv->qdata, key);
6645 if (info != NULL)
6646 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
6647 }
6648 g_variant_iter_free (iter);
6649 for (n = 0; invalidated_properties[n] != NULL; n++)
6650 {
6651 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, invalidated_properties[n]);
6652 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
6653 if (info != NULL)
6654 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
6655 }
6656}
6657
6658static GVariant *
6659sensor_threshold_proxy_get_lower_critical (SensorThreshold *object)
6660{
6661 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
6662 GVariant *variant;
6663 GVariant *value = NULL;
6664 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "lower_critical");
6665 value = variant;
6666 if (variant != NULL)
6667 g_variant_unref (variant);
6668 return value;
6669}
6670
6671static GVariant *
6672sensor_threshold_proxy_get_lower_warning (SensorThreshold *object)
6673{
6674 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
6675 GVariant *variant;
6676 GVariant *value = NULL;
6677 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "lower_warning");
6678 value = variant;
6679 if (variant != NULL)
6680 g_variant_unref (variant);
6681 return value;
6682}
6683
6684static GVariant *
6685sensor_threshold_proxy_get_upper_warning (SensorThreshold *object)
6686{
6687 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
6688 GVariant *variant;
6689 GVariant *value = NULL;
6690 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "upper_warning");
6691 value = variant;
6692 if (variant != NULL)
6693 g_variant_unref (variant);
6694 return value;
6695}
6696
6697static GVariant *
6698sensor_threshold_proxy_get_upper_critical (SensorThreshold *object)
6699{
6700 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
6701 GVariant *variant;
6702 GVariant *value = NULL;
6703 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "upper_critical");
6704 value = variant;
6705 if (variant != NULL)
6706 g_variant_unref (variant);
6707 return value;
6708}
6709
6710static guchar
6711sensor_threshold_proxy_get_state (SensorThreshold *object)
6712{
6713 SensorThresholdProxy *proxy = SENSOR_THRESHOLD_PROXY (object);
6714 GVariant *variant;
6715 guchar value = 0;
6716 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state");
6717 if (variant != NULL)
6718 {
6719 value = g_variant_get_byte (variant);
6720 g_variant_unref (variant);
6721 }
6722 return value;
6723}
6724
6725static void
6726sensor_threshold_proxy_init (SensorThresholdProxy *proxy)
6727{
6728#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
6729 proxy->priv = sensor_threshold_proxy_get_instance_private (proxy);
6730#else
6731 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_THRESHOLD_PROXY, SensorThresholdProxyPrivate);
6732#endif
6733
6734 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_threshold_interface_info ());
6735}
6736
6737static void
6738sensor_threshold_proxy_class_init (SensorThresholdProxyClass *klass)
6739{
6740 GObjectClass *gobject_class;
6741 GDBusProxyClass *proxy_class;
6742
6743 gobject_class = G_OBJECT_CLASS (klass);
6744 gobject_class->finalize = sensor_threshold_proxy_finalize;
6745 gobject_class->get_property = sensor_threshold_proxy_get_property;
6746 gobject_class->set_property = sensor_threshold_proxy_set_property;
6747
6748 proxy_class = G_DBUS_PROXY_CLASS (klass);
6749 proxy_class->g_signal = sensor_threshold_proxy_g_signal;
6750 proxy_class->g_properties_changed = sensor_threshold_proxy_g_properties_changed;
6751
6752 sensor_threshold_override_properties (gobject_class, 1);
6753
6754#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
6755 g_type_class_add_private (klass, sizeof (SensorThresholdProxyPrivate));
6756#endif
6757}
6758
6759static void
6760sensor_threshold_proxy_iface_init (SensorThresholdIface *iface)
6761{
6762 iface->get_lower_critical = sensor_threshold_proxy_get_lower_critical;
6763 iface->get_lower_warning = sensor_threshold_proxy_get_lower_warning;
6764 iface->get_upper_warning = sensor_threshold_proxy_get_upper_warning;
6765 iface->get_upper_critical = sensor_threshold_proxy_get_upper_critical;
6766 iface->get_state = sensor_threshold_proxy_get_state;
6767}
6768
6769/**
6770 * sensor_threshold_proxy_new:
6771 * @connection: A #GDBusConnection.
6772 * @flags: Flags from the #GDBusProxyFlags enumeration.
6773 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
6774 * @object_path: An object path.
6775 * @cancellable: (allow-none): A #GCancellable or %NULL.
6776 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
6777 * @user_data: User data to pass to @callback.
6778 *
6779 * 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.
6780 *
6781 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
6782 * You can then call sensor_threshold_proxy_new_finish() to get the result of the operation.
6783 *
6784 * See sensor_threshold_proxy_new_sync() for the synchronous, blocking version of this constructor.
6785 */
6786void
6787sensor_threshold_proxy_new (
6788 GDBusConnection *connection,
6789 GDBusProxyFlags flags,
6790 const gchar *name,
6791 const gchar *object_path,
6792 GCancellable *cancellable,
6793 GAsyncReadyCallback callback,
6794 gpointer user_data)
6795{
6796 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);
6797}
6798
6799/**
6800 * sensor_threshold_proxy_new_finish:
6801 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_threshold_proxy_new().
6802 * @error: Return location for error or %NULL
6803 *
6804 * Finishes an operation started with sensor_threshold_proxy_new().
6805 *
6806 * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set.
6807 */
6808SensorThreshold *
6809sensor_threshold_proxy_new_finish (
6810 GAsyncResult *res,
6811 GError **error)
6812{
6813 GObject *ret;
6814 GObject *source_object;
6815 source_object = g_async_result_get_source_object (res);
6816 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
6817 g_object_unref (source_object);
6818 if (ret != NULL)
6819 return SENSOR_THRESHOLD (ret);
6820 else
6821 return NULL;
6822}
6823
6824/**
6825 * sensor_threshold_proxy_new_sync:
6826 * @connection: A #GDBusConnection.
6827 * @flags: Flags from the #GDBusProxyFlags enumeration.
6828 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
6829 * @object_path: An object path.
6830 * @cancellable: (allow-none): A #GCancellable or %NULL.
6831 * @error: Return location for error or %NULL
6832 *
6833 * 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.
6834 *
6835 * The calling thread is blocked until a reply is received.
6836 *
6837 * See sensor_threshold_proxy_new() for the asynchronous version of this constructor.
6838 *
6839 * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set.
6840 */
6841SensorThreshold *
6842sensor_threshold_proxy_new_sync (
6843 GDBusConnection *connection,
6844 GDBusProxyFlags flags,
6845 const gchar *name,
6846 const gchar *object_path,
6847 GCancellable *cancellable,
6848 GError **error)
6849{
6850 GInitable *ret;
6851 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);
6852 if (ret != NULL)
6853 return SENSOR_THRESHOLD (ret);
6854 else
6855 return NULL;
6856}
6857
6858
6859/**
6860 * sensor_threshold_proxy_new_for_bus:
6861 * @bus_type: A #GBusType.
6862 * @flags: Flags from the #GDBusProxyFlags enumeration.
6863 * @name: A bus name (well-known or unique).
6864 * @object_path: An object path.
6865 * @cancellable: (allow-none): A #GCancellable or %NULL.
6866 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
6867 * @user_data: User data to pass to @callback.
6868 *
6869 * Like sensor_threshold_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
6870 *
6871 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
6872 * You can then call sensor_threshold_proxy_new_for_bus_finish() to get the result of the operation.
6873 *
6874 * See sensor_threshold_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
6875 */
6876void
6877sensor_threshold_proxy_new_for_bus (
6878 GBusType bus_type,
6879 GDBusProxyFlags flags,
6880 const gchar *name,
6881 const gchar *object_path,
6882 GCancellable *cancellable,
6883 GAsyncReadyCallback callback,
6884 gpointer user_data)
6885{
6886 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);
6887}
6888
6889/**
6890 * sensor_threshold_proxy_new_for_bus_finish:
6891 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_threshold_proxy_new_for_bus().
6892 * @error: Return location for error or %NULL
6893 *
6894 * Finishes an operation started with sensor_threshold_proxy_new_for_bus().
6895 *
6896 * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set.
6897 */
6898SensorThreshold *
6899sensor_threshold_proxy_new_for_bus_finish (
6900 GAsyncResult *res,
6901 GError **error)
6902{
6903 GObject *ret;
6904 GObject *source_object;
6905 source_object = g_async_result_get_source_object (res);
6906 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
6907 g_object_unref (source_object);
6908 if (ret != NULL)
6909 return SENSOR_THRESHOLD (ret);
6910 else
6911 return NULL;
6912}
6913
6914/**
6915 * sensor_threshold_proxy_new_for_bus_sync:
6916 * @bus_type: A #GBusType.
6917 * @flags: Flags from the #GDBusProxyFlags enumeration.
6918 * @name: A bus name (well-known or unique).
6919 * @object_path: An object path.
6920 * @cancellable: (allow-none): A #GCancellable or %NULL.
6921 * @error: Return location for error or %NULL
6922 *
6923 * Like sensor_threshold_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
6924 *
6925 * The calling thread is blocked until a reply is received.
6926 *
6927 * See sensor_threshold_proxy_new_for_bus() for the asynchronous version of this constructor.
6928 *
6929 * Returns: (transfer full) (type SensorThresholdProxy): The constructed proxy object or %NULL if @error is set.
6930 */
6931SensorThreshold *
6932sensor_threshold_proxy_new_for_bus_sync (
6933 GBusType bus_type,
6934 GDBusProxyFlags flags,
6935 const gchar *name,
6936 const gchar *object_path,
6937 GCancellable *cancellable,
6938 GError **error)
6939{
6940 GInitable *ret;
6941 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);
6942 if (ret != NULL)
6943 return SENSOR_THRESHOLD (ret);
6944 else
6945 return NULL;
6946}
6947
6948
6949/* ------------------------------------------------------------------------ */
6950
6951/**
6952 * SensorThresholdSkeleton:
6953 *
6954 * The #SensorThresholdSkeleton structure contains only private data and should only be accessed using the provided API.
6955 */
6956
6957/**
6958 * SensorThresholdSkeletonClass:
6959 * @parent_class: The parent class.
6960 *
6961 * Class structure for #SensorThresholdSkeleton.
6962 */
6963
6964struct _SensorThresholdSkeletonPrivate
6965{
6966 GValue *properties;
6967 GList *changed_properties;
6968 GSource *changed_properties_idle_source;
6969 GMainContext *context;
6970 GMutex lock;
6971};
6972
6973static void
6974_sensor_threshold_skeleton_handle_method_call (
6975 GDBusConnection *connection G_GNUC_UNUSED,
6976 const gchar *sender G_GNUC_UNUSED,
6977 const gchar *object_path G_GNUC_UNUSED,
6978 const gchar *interface_name,
6979 const gchar *method_name,
6980 GVariant *parameters,
6981 GDBusMethodInvocation *invocation,
6982 gpointer user_data)
6983{
6984 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data);
6985 _ExtendedGDBusMethodInfo *info;
6986 GVariantIter iter;
6987 GVariant *child;
6988 GValue *paramv;
6989 guint num_params;
6990 guint num_extra;
6991 guint n;
6992 guint signal_id;
6993 GValue return_value = G_VALUE_INIT;
6994 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
6995 g_assert (info != NULL);
6996 num_params = g_variant_n_children (parameters);
6997 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
6998 n = 0;
6999 g_value_init (&paramv[n], TYPE_SENSOR_THRESHOLD);
7000 g_value_set_object (&paramv[n++], skeleton);
7001 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
7002 g_value_set_object (&paramv[n++], invocation);
7003 if (info->pass_fdlist)
7004 {
7005#ifdef G_OS_UNIX
7006 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
7007 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
7008#else
7009 g_assert_not_reached ();
7010#endif
7011 }
7012 g_variant_iter_init (&iter, parameters);
7013 while ((child = g_variant_iter_next_value (&iter)) != NULL)
7014 {
7015 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
7016 if (arg_info->use_gvariant)
7017 {
7018 g_value_init (&paramv[n], G_TYPE_VARIANT);
7019 g_value_set_variant (&paramv[n], child);
7020 n++;
7021 }
7022 else
7023 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
7024 g_variant_unref (child);
7025 }
7026 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_THRESHOLD);
7027 g_value_init (&return_value, G_TYPE_BOOLEAN);
7028 g_signal_emitv (paramv, signal_id, 0, &return_value);
7029 if (!g_value_get_boolean (&return_value))
7030 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);
7031 g_value_unset (&return_value);
7032 for (n = 0; n < num_params + num_extra; n++)
7033 g_value_unset (&paramv[n]);
7034 g_free (paramv);
7035}
7036
7037static GVariant *
7038_sensor_threshold_skeleton_handle_get_property (
7039 GDBusConnection *connection G_GNUC_UNUSED,
7040 const gchar *sender G_GNUC_UNUSED,
7041 const gchar *object_path G_GNUC_UNUSED,
7042 const gchar *interface_name G_GNUC_UNUSED,
7043 const gchar *property_name,
7044 GError **error,
7045 gpointer user_data)
7046{
7047 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data);
7048 GValue value = G_VALUE_INIT;
7049 GParamSpec *pspec;
7050 _ExtendedGDBusPropertyInfo *info;
7051 GVariant *ret;
7052 ret = NULL;
7053 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, property_name);
7054 g_assert (info != NULL);
7055 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
7056 if (pspec == NULL)
7057 {
7058 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
7059 }
7060 else
7061 {
7062 g_value_init (&value, pspec->value_type);
7063 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
7064 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
7065 g_value_unset (&value);
7066 }
7067 return ret;
7068}
7069
7070static gboolean
7071_sensor_threshold_skeleton_handle_set_property (
7072 GDBusConnection *connection G_GNUC_UNUSED,
7073 const gchar *sender G_GNUC_UNUSED,
7074 const gchar *object_path G_GNUC_UNUSED,
7075 const gchar *interface_name G_GNUC_UNUSED,
7076 const gchar *property_name,
7077 GVariant *variant,
7078 GError **error,
7079 gpointer user_data)
7080{
7081 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data);
7082 GValue value = G_VALUE_INIT;
7083 GParamSpec *pspec;
7084 _ExtendedGDBusPropertyInfo *info;
7085 gboolean ret;
7086 ret = FALSE;
7087 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_threshold_interface_info.parent_struct, property_name);
7088 g_assert (info != NULL);
7089 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
7090 if (pspec == NULL)
7091 {
7092 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
7093 }
7094 else
7095 {
7096 if (info->use_gvariant)
7097 g_value_set_variant (&value, variant);
7098 else
7099 g_dbus_gvariant_to_gvalue (variant, &value);
7100 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
7101 g_value_unset (&value);
7102 ret = TRUE;
7103 }
7104 return ret;
7105}
7106
7107static const GDBusInterfaceVTable _sensor_threshold_skeleton_vtable =
7108{
7109 _sensor_threshold_skeleton_handle_method_call,
7110 _sensor_threshold_skeleton_handle_get_property,
7111 _sensor_threshold_skeleton_handle_set_property,
7112 {NULL}
7113};
7114
7115static GDBusInterfaceInfo *
7116sensor_threshold_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
7117{
7118 return sensor_threshold_interface_info ();
7119}
7120
7121static GDBusInterfaceVTable *
7122sensor_threshold_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
7123{
7124 return (GDBusInterfaceVTable *) &_sensor_threshold_skeleton_vtable;
7125}
7126
7127static GVariant *
7128sensor_threshold_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
7129{
7130 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (_skeleton);
7131
7132 GVariantBuilder builder;
7133 guint n;
7134 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
7135 if (_sensor_threshold_interface_info.parent_struct.properties == NULL)
7136 goto out;
7137 for (n = 0; _sensor_threshold_interface_info.parent_struct.properties[n] != NULL; n++)
7138 {
7139 GDBusPropertyInfo *info = _sensor_threshold_interface_info.parent_struct.properties[n];
7140 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
7141 {
7142 GVariant *value;
7143 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);
7144 if (value != NULL)
7145 {
7146 g_variant_take_ref (value);
7147 g_variant_builder_add (&builder, "{sv}", info->name, value);
7148 g_variant_unref (value);
7149 }
7150 }
7151 }
7152out:
7153 return g_variant_builder_end (&builder);
7154}
7155
7156static gboolean _sensor_threshold_emit_changed (gpointer user_data);
7157
7158static void
7159sensor_threshold_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
7160{
7161 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (_skeleton);
7162 gboolean emit_changed = FALSE;
7163
7164 g_mutex_lock (&skeleton->priv->lock);
7165 if (skeleton->priv->changed_properties_idle_source != NULL)
7166 {
7167 g_source_destroy (skeleton->priv->changed_properties_idle_source);
7168 skeleton->priv->changed_properties_idle_source = NULL;
7169 emit_changed = TRUE;
7170 }
7171 g_mutex_unlock (&skeleton->priv->lock);
7172
7173 if (emit_changed)
7174 _sensor_threshold_emit_changed (skeleton);
7175}
7176
7177static void
7178_sensor_threshold_on_signal_warning (
7179 SensorThreshold *object)
7180{
7181 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7182
7183 GList *connections, *l;
7184 GVariant *signal_variant;
7185 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
7186
7187 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
7188 for (l = connections; l != NULL; l = l->next)
7189 {
7190 GDBusConnection *connection = l->data;
7191 g_dbus_connection_emit_signal (connection,
7192 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorThreshold", "Warning",
7193 signal_variant, NULL);
7194 }
7195 g_variant_unref (signal_variant);
7196 g_list_free_full (connections, g_object_unref);
7197}
7198
7199static void
7200_sensor_threshold_on_signal_critical (
7201 SensorThreshold *object)
7202{
7203 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7204
7205 GList *connections, *l;
7206 GVariant *signal_variant;
7207 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
7208
7209 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
7210 for (l = connections; l != NULL; l = l->next)
7211 {
7212 GDBusConnection *connection = l->data;
7213 g_dbus_connection_emit_signal (connection,
7214 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorThreshold", "Critical",
7215 signal_variant, NULL);
7216 }
7217 g_variant_unref (signal_variant);
7218 g_list_free_full (connections, g_object_unref);
7219}
7220
7221static void
7222_sensor_threshold_on_signal_normal (
7223 SensorThreshold *object)
7224{
7225 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7226
7227 GList *connections, *l;
7228 GVariant *signal_variant;
7229 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
7230
7231 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
7232 for (l = connections; l != NULL; l = l->next)
7233 {
7234 GDBusConnection *connection = l->data;
7235 g_dbus_connection_emit_signal (connection,
7236 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorThreshold", "Normal",
7237 signal_variant, NULL);
7238 }
7239 g_variant_unref (signal_variant);
7240 g_list_free_full (connections, g_object_unref);
7241}
7242
7243static void sensor_threshold_skeleton_iface_init (SensorThresholdIface *iface);
7244#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
7245G_DEFINE_TYPE_WITH_CODE (SensorThresholdSkeleton, sensor_threshold_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
7246 G_ADD_PRIVATE (SensorThresholdSkeleton)
7247 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_skeleton_iface_init));
7248
7249#else
7250G_DEFINE_TYPE_WITH_CODE (SensorThresholdSkeleton, sensor_threshold_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
7251 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_THRESHOLD, sensor_threshold_skeleton_iface_init));
7252
7253#endif
7254static void
7255sensor_threshold_skeleton_finalize (GObject *object)
7256{
7257 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7258 guint n;
7259 for (n = 0; n < 5; n++)
7260 g_value_unset (&skeleton->priv->properties[n]);
7261 g_free (skeleton->priv->properties);
7262 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
7263 if (skeleton->priv->changed_properties_idle_source != NULL)
7264 g_source_destroy (skeleton->priv->changed_properties_idle_source);
7265 g_main_context_unref (skeleton->priv->context);
7266 g_mutex_clear (&skeleton->priv->lock);
7267 G_OBJECT_CLASS (sensor_threshold_skeleton_parent_class)->finalize (object);
7268}
7269
7270static void
7271sensor_threshold_skeleton_get_property (GObject *object,
7272 guint prop_id,
7273 GValue *value,
7274 GParamSpec *pspec G_GNUC_UNUSED)
7275{
7276 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7277 g_assert (prop_id != 0 && prop_id - 1 < 5);
7278 g_mutex_lock (&skeleton->priv->lock);
7279 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
7280 g_mutex_unlock (&skeleton->priv->lock);
7281}
7282
7283static gboolean
7284_sensor_threshold_emit_changed (gpointer user_data)
7285{
7286 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (user_data);
7287 GList *l;
7288 GVariantBuilder builder;
7289 GVariantBuilder invalidated_builder;
7290 guint num_changes;
7291
7292 g_mutex_lock (&skeleton->priv->lock);
7293 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
7294 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
7295 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
7296 {
7297 ChangedProperty *cp = l->data;
7298 GVariant *variant;
7299 const GValue *cur_value;
7300
7301 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
7302 if (!_g_value_equal (cur_value, &cp->orig_value))
7303 {
7304 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
7305 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
7306 g_variant_unref (variant);
7307 num_changes++;
7308 }
7309 }
7310 if (num_changes > 0)
7311 {
7312 GList *connections, *ll;
7313 GVariant *signal_variant;
7314 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorThreshold",
7315 &builder, &invalidated_builder));
7316 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
7317 for (ll = connections; ll != NULL; ll = ll->next)
7318 {
7319 GDBusConnection *connection = ll->data;
7320
7321 g_dbus_connection_emit_signal (connection,
7322 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
7323 "org.freedesktop.DBus.Properties",
7324 "PropertiesChanged",
7325 signal_variant,
7326 NULL);
7327 }
7328 g_variant_unref (signal_variant);
7329 g_list_free_full (connections, g_object_unref);
7330 }
7331 else
7332 {
7333 g_variant_builder_clear (&builder);
7334 g_variant_builder_clear (&invalidated_builder);
7335 }
7336 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
7337 skeleton->priv->changed_properties = NULL;
7338 skeleton->priv->changed_properties_idle_source = NULL;
7339 g_mutex_unlock (&skeleton->priv->lock);
7340 return FALSE;
7341}
7342
7343static void
7344_sensor_threshold_schedule_emit_changed (SensorThresholdSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
7345{
7346 ChangedProperty *cp;
7347 GList *l;
7348 cp = NULL;
7349 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
7350 {
7351 ChangedProperty *i_cp = l->data;
7352 if (i_cp->info == info)
7353 {
7354 cp = i_cp;
7355 break;
7356 }
7357 }
7358 if (cp == NULL)
7359 {
7360 cp = g_new0 (ChangedProperty, 1);
7361 cp->prop_id = prop_id;
7362 cp->info = info;
7363 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
7364 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
7365 g_value_copy (orig_value, &cp->orig_value);
7366 }
7367}
7368
7369static void
7370sensor_threshold_skeleton_notify (GObject *object,
7371 GParamSpec *pspec G_GNUC_UNUSED)
7372{
7373 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7374 g_mutex_lock (&skeleton->priv->lock);
7375 if (skeleton->priv->changed_properties != NULL &&
7376 skeleton->priv->changed_properties_idle_source == NULL)
7377 {
7378 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
7379 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
7380 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_threshold_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
Adriana Kobylak2cb27752015-10-19 16:23:14 -05007381 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _sensor_threshold_emit_changed");
Norman James362a80f2015-09-14 14:04:39 -05007382 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
7383 g_source_unref (skeleton->priv->changed_properties_idle_source);
7384 }
7385 g_mutex_unlock (&skeleton->priv->lock);
7386}
7387
7388static void
7389sensor_threshold_skeleton_set_property (GObject *object,
7390 guint prop_id,
7391 const GValue *value,
7392 GParamSpec *pspec)
7393{
7394 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7395 g_assert (prop_id != 0 && prop_id - 1 < 5);
7396 g_mutex_lock (&skeleton->priv->lock);
7397 g_object_freeze_notify (object);
7398 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
7399 {
7400 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
7401 _sensor_threshold_schedule_emit_changed (skeleton, _sensor_threshold_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
7402 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
7403 g_object_notify_by_pspec (object, pspec);
7404 }
7405 g_mutex_unlock (&skeleton->priv->lock);
7406 g_object_thaw_notify (object);
7407}
7408
7409static void
7410sensor_threshold_skeleton_init (SensorThresholdSkeleton *skeleton)
7411{
7412#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
7413 skeleton->priv = sensor_threshold_skeleton_get_instance_private (skeleton);
7414#else
7415 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_THRESHOLD_SKELETON, SensorThresholdSkeletonPrivate);
7416#endif
7417
7418 g_mutex_init (&skeleton->priv->lock);
7419 skeleton->priv->context = g_main_context_ref_thread_default ();
7420 skeleton->priv->properties = g_new0 (GValue, 5);
7421 g_value_init (&skeleton->priv->properties[0], G_TYPE_VARIANT);
7422 g_value_init (&skeleton->priv->properties[1], G_TYPE_VARIANT);
7423 g_value_init (&skeleton->priv->properties[2], G_TYPE_VARIANT);
7424 g_value_init (&skeleton->priv->properties[3], G_TYPE_VARIANT);
7425 g_value_init (&skeleton->priv->properties[4], G_TYPE_UCHAR);
7426}
7427
7428static GVariant *
7429sensor_threshold_skeleton_get_lower_critical (SensorThreshold *object)
7430{
7431 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7432 GVariant *value;
7433 g_mutex_lock (&skeleton->priv->lock);
7434 value = g_value_get_variant (&(skeleton->priv->properties[0]));
7435 g_mutex_unlock (&skeleton->priv->lock);
7436 return value;
7437}
7438
7439static GVariant *
7440sensor_threshold_skeleton_get_lower_warning (SensorThreshold *object)
7441{
7442 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7443 GVariant *value;
7444 g_mutex_lock (&skeleton->priv->lock);
7445 value = g_value_get_variant (&(skeleton->priv->properties[1]));
7446 g_mutex_unlock (&skeleton->priv->lock);
7447 return value;
7448}
7449
7450static GVariant *
7451sensor_threshold_skeleton_get_upper_warning (SensorThreshold *object)
7452{
7453 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7454 GVariant *value;
7455 g_mutex_lock (&skeleton->priv->lock);
7456 value = g_value_get_variant (&(skeleton->priv->properties[2]));
7457 g_mutex_unlock (&skeleton->priv->lock);
7458 return value;
7459}
7460
7461static GVariant *
7462sensor_threshold_skeleton_get_upper_critical (SensorThreshold *object)
7463{
7464 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7465 GVariant *value;
7466 g_mutex_lock (&skeleton->priv->lock);
7467 value = g_value_get_variant (&(skeleton->priv->properties[3]));
7468 g_mutex_unlock (&skeleton->priv->lock);
7469 return value;
7470}
7471
7472static guchar
7473sensor_threshold_skeleton_get_state (SensorThreshold *object)
7474{
7475 SensorThresholdSkeleton *skeleton = SENSOR_THRESHOLD_SKELETON (object);
7476 guchar value;
7477 g_mutex_lock (&skeleton->priv->lock);
7478 value = g_value_get_uchar (&(skeleton->priv->properties[4]));
7479 g_mutex_unlock (&skeleton->priv->lock);
7480 return value;
7481}
7482
7483static void
7484sensor_threshold_skeleton_class_init (SensorThresholdSkeletonClass *klass)
7485{
7486 GObjectClass *gobject_class;
7487 GDBusInterfaceSkeletonClass *skeleton_class;
7488
7489 gobject_class = G_OBJECT_CLASS (klass);
7490 gobject_class->finalize = sensor_threshold_skeleton_finalize;
7491 gobject_class->get_property = sensor_threshold_skeleton_get_property;
7492 gobject_class->set_property = sensor_threshold_skeleton_set_property;
7493 gobject_class->notify = sensor_threshold_skeleton_notify;
7494
7495
7496 sensor_threshold_override_properties (gobject_class, 1);
7497
7498 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
7499 skeleton_class->get_info = sensor_threshold_skeleton_dbus_interface_get_info;
7500 skeleton_class->get_properties = sensor_threshold_skeleton_dbus_interface_get_properties;
7501 skeleton_class->flush = sensor_threshold_skeleton_dbus_interface_flush;
7502 skeleton_class->get_vtable = sensor_threshold_skeleton_dbus_interface_get_vtable;
7503
7504#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
7505 g_type_class_add_private (klass, sizeof (SensorThresholdSkeletonPrivate));
7506#endif
7507}
7508
7509static void
7510sensor_threshold_skeleton_iface_init (SensorThresholdIface *iface)
7511{
7512 iface->warning = _sensor_threshold_on_signal_warning;
7513 iface->critical = _sensor_threshold_on_signal_critical;
7514 iface->normal = _sensor_threshold_on_signal_normal;
7515 iface->get_lower_critical = sensor_threshold_skeleton_get_lower_critical;
7516 iface->get_lower_warning = sensor_threshold_skeleton_get_lower_warning;
7517 iface->get_upper_warning = sensor_threshold_skeleton_get_upper_warning;
7518 iface->get_upper_critical = sensor_threshold_skeleton_get_upper_critical;
7519 iface->get_state = sensor_threshold_skeleton_get_state;
7520}
7521
7522/**
7523 * sensor_threshold_skeleton_new:
7524 *
7525 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorThreshold.top_of_page">org.openbmc.SensorThreshold</link>.
7526 *
7527 * Returns: (transfer full) (type SensorThresholdSkeleton): The skeleton object.
7528 */
7529SensorThreshold *
7530sensor_threshold_skeleton_new (void)
7531{
7532 return SENSOR_THRESHOLD (g_object_new (TYPE_SENSOR_THRESHOLD_SKELETON, NULL));
7533}
7534
7535/* ------------------------------------------------------------------------
7536 * Code for interface org.openbmc.SensorI2c
7537 * ------------------------------------------------------------------------
7538 */
7539
7540/**
7541 * SECTION:SensorI2c
7542 * @title: SensorI2c
7543 * @short_description: Generated C code for the org.openbmc.SensorI2c D-Bus interface
7544 *
7545 * 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.
7546 */
7547
7548/* ---- Introspection data for org.openbmc.SensorI2c ---- */
7549
7550static const _ExtendedGDBusPropertyInfo _sensor_i2c_property_info_dev_path =
7551{
7552 {
7553 -1,
7554 (gchar *) "dev_path",
7555 (gchar *) "s",
7556 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
7557 NULL
7558 },
7559 "dev-path",
7560 FALSE
7561};
7562
7563static const _ExtendedGDBusPropertyInfo _sensor_i2c_property_info_address =
7564{
7565 {
7566 -1,
7567 (gchar *) "address",
7568 (gchar *) "s",
7569 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
7570 NULL
7571 },
7572 "address",
7573 FALSE
7574};
7575
7576static const _ExtendedGDBusPropertyInfo * const _sensor_i2c_property_info_pointers[] =
7577{
7578 &_sensor_i2c_property_info_dev_path,
7579 &_sensor_i2c_property_info_address,
7580 NULL
7581};
7582
7583static const _ExtendedGDBusInterfaceInfo _sensor_i2c_interface_info =
7584{
7585 {
7586 -1,
7587 (gchar *) "org.openbmc.SensorI2c",
7588 NULL,
7589 NULL,
7590 (GDBusPropertyInfo **) &_sensor_i2c_property_info_pointers,
7591 NULL
7592 },
7593 "sensor-i2c",
7594};
7595
7596
7597/**
7598 * sensor_i2c_interface_info:
7599 *
7600 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link> D-Bus interface.
7601 *
7602 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
7603 */
7604GDBusInterfaceInfo *
7605sensor_i2c_interface_info (void)
7606{
7607 return (GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct;
7608}
7609
7610/**
7611 * sensor_i2c_override_properties:
7612 * @klass: The class structure for a #GObject<!-- -->-derived class.
7613 * @property_id_begin: The property id to assign to the first overridden property.
7614 *
7615 * Overrides all #GObject properties in the #SensorI2c interface for a concrete class.
7616 * The properties are overridden in the order they are defined.
7617 *
7618 * Returns: The last property id.
7619 */
7620guint
7621sensor_i2c_override_properties (GObjectClass *klass, guint property_id_begin)
7622{
7623 g_object_class_override_property (klass, property_id_begin++, "dev-path");
7624 g_object_class_override_property (klass, property_id_begin++, "address");
7625 return property_id_begin - 1;
7626}
7627
7628
7629
7630/**
7631 * SensorI2c:
7632 *
7633 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>.
7634 */
7635
7636/**
7637 * SensorI2cIface:
7638 * @parent_iface: The parent interface.
7639 * @get_address: Getter for the #SensorI2c:address property.
7640 * @get_dev_path: Getter for the #SensorI2c:dev-path property.
7641 *
7642 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>.
7643 */
7644
7645typedef SensorI2cIface SensorI2cInterface;
7646G_DEFINE_INTERFACE (SensorI2c, sensor_i2c, G_TYPE_OBJECT);
7647
7648static void
7649sensor_i2c_default_init (SensorI2cIface *iface)
7650{
7651 /* GObject properties for D-Bus properties: */
7652 /**
7653 * SensorI2c:dev-path:
7654 *
7655 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link>.
7656 *
7657 * 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.
7658 */
7659 g_object_interface_install_property (iface,
7660 g_param_spec_string ("dev-path", "dev_path", "dev_path", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
7661 /**
7662 * SensorI2c:address:
7663 *
7664 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link>.
7665 *
7666 * 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.
7667 */
7668 g_object_interface_install_property (iface,
7669 g_param_spec_string ("address", "address", "address", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
7670}
7671
7672/**
7673 * sensor_i2c_get_dev_path: (skip)
7674 * @object: A #SensorI2c.
7675 *
7676 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link> D-Bus property.
7677 *
7678 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
7679 *
7680 * <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>
7681 *
7682 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
7683 */
7684const gchar *
7685sensor_i2c_get_dev_path (SensorI2c *object)
7686{
7687 return SENSOR_I2C_GET_IFACE (object)->get_dev_path (object);
7688}
7689
7690/**
7691 * sensor_i2c_dup_dev_path: (skip)
7692 * @object: A #SensorI2c.
7693 *
7694 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link> D-Bus property.
7695 *
7696 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
7697 *
7698 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
7699 */
7700gchar *
7701sensor_i2c_dup_dev_path (SensorI2c *object)
7702{
7703 gchar *value;
7704 g_object_get (G_OBJECT (object), "dev-path", &value, NULL);
7705 return value;
7706}
7707
7708/**
7709 * sensor_i2c_set_dev_path: (skip)
7710 * @object: A #SensorI2c.
7711 * @value: The value to set.
7712 *
7713 * Sets the <link linkend="gdbus-property-org-openbmc-SensorI2c.dev_path">"dev_path"</link> D-Bus property to @value.
7714 *
7715 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
7716 */
7717void
7718sensor_i2c_set_dev_path (SensorI2c *object, const gchar *value)
7719{
7720 g_object_set (G_OBJECT (object), "dev-path", value, NULL);
7721}
7722
7723/**
7724 * sensor_i2c_get_address: (skip)
7725 * @object: A #SensorI2c.
7726 *
7727 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link> D-Bus property.
7728 *
7729 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
7730 *
7731 * <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>
7732 *
7733 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
7734 */
7735const gchar *
7736sensor_i2c_get_address (SensorI2c *object)
7737{
7738 return SENSOR_I2C_GET_IFACE (object)->get_address (object);
7739}
7740
7741/**
7742 * sensor_i2c_dup_address: (skip)
7743 * @object: A #SensorI2c.
7744 *
7745 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link> D-Bus property.
7746 *
7747 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
7748 *
7749 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
7750 */
7751gchar *
7752sensor_i2c_dup_address (SensorI2c *object)
7753{
7754 gchar *value;
7755 g_object_get (G_OBJECT (object), "address", &value, NULL);
7756 return value;
7757}
7758
7759/**
7760 * sensor_i2c_set_address: (skip)
7761 * @object: A #SensorI2c.
7762 * @value: The value to set.
7763 *
7764 * Sets the <link linkend="gdbus-property-org-openbmc-SensorI2c.address">"address"</link> D-Bus property to @value.
7765 *
7766 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
7767 */
7768void
7769sensor_i2c_set_address (SensorI2c *object, const gchar *value)
7770{
7771 g_object_set (G_OBJECT (object), "address", value, NULL);
7772}
7773
7774/* ------------------------------------------------------------------------ */
7775
7776/**
7777 * SensorI2cProxy:
7778 *
7779 * The #SensorI2cProxy structure contains only private data and should only be accessed using the provided API.
7780 */
7781
7782/**
7783 * SensorI2cProxyClass:
7784 * @parent_class: The parent class.
7785 *
7786 * Class structure for #SensorI2cProxy.
7787 */
7788
7789struct _SensorI2cProxyPrivate
7790{
7791 GData *qdata;
7792};
7793
7794static void sensor_i2c_proxy_iface_init (SensorI2cIface *iface);
7795
7796#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
7797G_DEFINE_TYPE_WITH_CODE (SensorI2cProxy, sensor_i2c_proxy, G_TYPE_DBUS_PROXY,
7798 G_ADD_PRIVATE (SensorI2cProxy)
7799 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_proxy_iface_init));
7800
7801#else
7802G_DEFINE_TYPE_WITH_CODE (SensorI2cProxy, sensor_i2c_proxy, G_TYPE_DBUS_PROXY,
7803 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_proxy_iface_init));
7804
7805#endif
7806static void
7807sensor_i2c_proxy_finalize (GObject *object)
7808{
7809 SensorI2cProxy *proxy = SENSOR_I2C_PROXY (object);
7810 g_datalist_clear (&proxy->priv->qdata);
7811 G_OBJECT_CLASS (sensor_i2c_proxy_parent_class)->finalize (object);
7812}
7813
7814static void
7815sensor_i2c_proxy_get_property (GObject *object,
7816 guint prop_id,
7817 GValue *value,
7818 GParamSpec *pspec G_GNUC_UNUSED)
7819{
7820 const _ExtendedGDBusPropertyInfo *info;
7821 GVariant *variant;
7822 g_assert (prop_id != 0 && prop_id - 1 < 2);
7823 info = _sensor_i2c_property_info_pointers[prop_id - 1];
7824 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
7825 if (info->use_gvariant)
7826 {
7827 g_value_set_variant (value, variant);
7828 }
7829 else
7830 {
7831 if (variant != NULL)
7832 g_dbus_gvariant_to_gvalue (variant, value);
7833 }
7834 if (variant != NULL)
7835 g_variant_unref (variant);
7836}
7837
7838static void
7839sensor_i2c_proxy_set_property_cb (GDBusProxy *proxy,
7840 GAsyncResult *res,
7841 gpointer user_data)
7842{
7843 const _ExtendedGDBusPropertyInfo *info = user_data;
7844 GError *error;
7845 GVariant *_ret;
7846 error = NULL;
7847 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
7848 if (!_ret)
7849 {
7850 g_warning ("Error setting property '%s' on interface org.openbmc.SensorI2c: %s (%s, %d)",
7851 info->parent_struct.name,
7852 error->message, g_quark_to_string (error->domain), error->code);
7853 g_error_free (error);
7854 }
7855 else
7856 {
7857 g_variant_unref (_ret);
7858 }
7859}
7860
7861static void
7862sensor_i2c_proxy_set_property (GObject *object,
7863 guint prop_id,
7864 const GValue *value,
7865 GParamSpec *pspec G_GNUC_UNUSED)
7866{
7867 const _ExtendedGDBusPropertyInfo *info;
7868 GVariant *variant;
7869 g_assert (prop_id != 0 && prop_id - 1 < 2);
7870 info = _sensor_i2c_property_info_pointers[prop_id - 1];
7871 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
7872 g_dbus_proxy_call (G_DBUS_PROXY (object),
7873 "org.freedesktop.DBus.Properties.Set",
7874 g_variant_new ("(ssv)", "org.openbmc.SensorI2c", info->parent_struct.name, variant),
7875 G_DBUS_CALL_FLAGS_NONE,
7876 -1,
7877 NULL, (GAsyncReadyCallback) sensor_i2c_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
7878 g_variant_unref (variant);
7879}
7880
7881static void
7882sensor_i2c_proxy_g_signal (GDBusProxy *proxy,
7883 const gchar *sender_name G_GNUC_UNUSED,
7884 const gchar *signal_name,
7885 GVariant *parameters)
7886{
7887 _ExtendedGDBusSignalInfo *info;
7888 GVariantIter iter;
7889 GVariant *child;
7890 GValue *paramv;
7891 guint num_params;
7892 guint n;
7893 guint signal_id;
7894 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, signal_name);
7895 if (info == NULL)
7896 return;
7897 num_params = g_variant_n_children (parameters);
7898 paramv = g_new0 (GValue, num_params + 1);
7899 g_value_init (&paramv[0], TYPE_SENSOR_I2C);
7900 g_value_set_object (&paramv[0], proxy);
7901 g_variant_iter_init (&iter, parameters);
7902 n = 1;
7903 while ((child = g_variant_iter_next_value (&iter)) != NULL)
7904 {
7905 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
7906 if (arg_info->use_gvariant)
7907 {
7908 g_value_init (&paramv[n], G_TYPE_VARIANT);
7909 g_value_set_variant (&paramv[n], child);
7910 n++;
7911 }
7912 else
7913 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
7914 g_variant_unref (child);
7915 }
7916 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_I2C);
7917 g_signal_emitv (paramv, signal_id, 0, NULL);
7918 for (n = 0; n < num_params + 1; n++)
7919 g_value_unset (&paramv[n]);
7920 g_free (paramv);
7921}
7922
7923static void
7924sensor_i2c_proxy_g_properties_changed (GDBusProxy *_proxy,
7925 GVariant *changed_properties,
7926 const gchar *const *invalidated_properties)
7927{
7928 SensorI2cProxy *proxy = SENSOR_I2C_PROXY (_proxy);
7929 guint n;
7930 const gchar *key;
7931 GVariantIter *iter;
7932 _ExtendedGDBusPropertyInfo *info;
7933 g_variant_get (changed_properties, "a{sv}", &iter);
7934 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
7935 {
7936 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, key);
7937 g_datalist_remove_data (&proxy->priv->qdata, key);
7938 if (info != NULL)
7939 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
7940 }
7941 g_variant_iter_free (iter);
7942 for (n = 0; invalidated_properties[n] != NULL; n++)
7943 {
7944 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, invalidated_properties[n]);
7945 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
7946 if (info != NULL)
7947 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
7948 }
7949}
7950
7951static const gchar *
7952sensor_i2c_proxy_get_dev_path (SensorI2c *object)
7953{
7954 SensorI2cProxy *proxy = SENSOR_I2C_PROXY (object);
7955 GVariant *variant;
7956 const gchar *value = NULL;
7957 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "dev_path");
7958 if (variant != NULL)
7959 {
7960 value = g_variant_get_string (variant, NULL);
7961 g_variant_unref (variant);
7962 }
7963 return value;
7964}
7965
7966static const gchar *
7967sensor_i2c_proxy_get_address (SensorI2c *object)
7968{
7969 SensorI2cProxy *proxy = SENSOR_I2C_PROXY (object);
7970 GVariant *variant;
7971 const gchar *value = NULL;
7972 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "address");
7973 if (variant != NULL)
7974 {
7975 value = g_variant_get_string (variant, NULL);
7976 g_variant_unref (variant);
7977 }
7978 return value;
7979}
7980
7981static void
7982sensor_i2c_proxy_init (SensorI2cProxy *proxy)
7983{
7984#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
7985 proxy->priv = sensor_i2c_proxy_get_instance_private (proxy);
7986#else
7987 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_I2C_PROXY, SensorI2cProxyPrivate);
7988#endif
7989
7990 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_i2c_interface_info ());
7991}
7992
7993static void
7994sensor_i2c_proxy_class_init (SensorI2cProxyClass *klass)
7995{
7996 GObjectClass *gobject_class;
7997 GDBusProxyClass *proxy_class;
7998
7999 gobject_class = G_OBJECT_CLASS (klass);
8000 gobject_class->finalize = sensor_i2c_proxy_finalize;
8001 gobject_class->get_property = sensor_i2c_proxy_get_property;
8002 gobject_class->set_property = sensor_i2c_proxy_set_property;
8003
8004 proxy_class = G_DBUS_PROXY_CLASS (klass);
8005 proxy_class->g_signal = sensor_i2c_proxy_g_signal;
8006 proxy_class->g_properties_changed = sensor_i2c_proxy_g_properties_changed;
8007
8008 sensor_i2c_override_properties (gobject_class, 1);
8009
8010#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
8011 g_type_class_add_private (klass, sizeof (SensorI2cProxyPrivate));
8012#endif
8013}
8014
8015static void
8016sensor_i2c_proxy_iface_init (SensorI2cIface *iface)
8017{
8018 iface->get_dev_path = sensor_i2c_proxy_get_dev_path;
8019 iface->get_address = sensor_i2c_proxy_get_address;
8020}
8021
8022/**
8023 * sensor_i2c_proxy_new:
8024 * @connection: A #GDBusConnection.
8025 * @flags: Flags from the #GDBusProxyFlags enumeration.
8026 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
8027 * @object_path: An object path.
8028 * @cancellable: (allow-none): A #GCancellable or %NULL.
8029 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
8030 * @user_data: User data to pass to @callback.
8031 *
8032 * 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.
8033 *
8034 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
8035 * You can then call sensor_i2c_proxy_new_finish() to get the result of the operation.
8036 *
8037 * See sensor_i2c_proxy_new_sync() for the synchronous, blocking version of this constructor.
8038 */
8039void
8040sensor_i2c_proxy_new (
8041 GDBusConnection *connection,
8042 GDBusProxyFlags flags,
8043 const gchar *name,
8044 const gchar *object_path,
8045 GCancellable *cancellable,
8046 GAsyncReadyCallback callback,
8047 gpointer user_data)
8048{
8049 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);
8050}
8051
8052/**
8053 * sensor_i2c_proxy_new_finish:
8054 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_i2c_proxy_new().
8055 * @error: Return location for error or %NULL
8056 *
8057 * Finishes an operation started with sensor_i2c_proxy_new().
8058 *
8059 * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set.
8060 */
8061SensorI2c *
8062sensor_i2c_proxy_new_finish (
8063 GAsyncResult *res,
8064 GError **error)
8065{
8066 GObject *ret;
8067 GObject *source_object;
8068 source_object = g_async_result_get_source_object (res);
8069 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
8070 g_object_unref (source_object);
8071 if (ret != NULL)
8072 return SENSOR_I2C (ret);
8073 else
8074 return NULL;
8075}
8076
8077/**
8078 * sensor_i2c_proxy_new_sync:
8079 * @connection: A #GDBusConnection.
8080 * @flags: Flags from the #GDBusProxyFlags enumeration.
8081 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
8082 * @object_path: An object path.
8083 * @cancellable: (allow-none): A #GCancellable or %NULL.
8084 * @error: Return location for error or %NULL
8085 *
8086 * 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.
8087 *
8088 * The calling thread is blocked until a reply is received.
8089 *
8090 * See sensor_i2c_proxy_new() for the asynchronous version of this constructor.
8091 *
8092 * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set.
8093 */
8094SensorI2c *
8095sensor_i2c_proxy_new_sync (
8096 GDBusConnection *connection,
8097 GDBusProxyFlags flags,
8098 const gchar *name,
8099 const gchar *object_path,
8100 GCancellable *cancellable,
8101 GError **error)
8102{
8103 GInitable *ret;
8104 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);
8105 if (ret != NULL)
8106 return SENSOR_I2C (ret);
8107 else
8108 return NULL;
8109}
8110
8111
8112/**
8113 * sensor_i2c_proxy_new_for_bus:
8114 * @bus_type: A #GBusType.
8115 * @flags: Flags from the #GDBusProxyFlags enumeration.
8116 * @name: A bus name (well-known or unique).
8117 * @object_path: An object path.
8118 * @cancellable: (allow-none): A #GCancellable or %NULL.
8119 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
8120 * @user_data: User data to pass to @callback.
8121 *
8122 * Like sensor_i2c_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
8123 *
8124 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
8125 * You can then call sensor_i2c_proxy_new_for_bus_finish() to get the result of the operation.
8126 *
8127 * See sensor_i2c_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
8128 */
8129void
8130sensor_i2c_proxy_new_for_bus (
8131 GBusType bus_type,
8132 GDBusProxyFlags flags,
8133 const gchar *name,
8134 const gchar *object_path,
8135 GCancellable *cancellable,
8136 GAsyncReadyCallback callback,
8137 gpointer user_data)
8138{
8139 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);
8140}
8141
8142/**
8143 * sensor_i2c_proxy_new_for_bus_finish:
8144 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_i2c_proxy_new_for_bus().
8145 * @error: Return location for error or %NULL
8146 *
8147 * Finishes an operation started with sensor_i2c_proxy_new_for_bus().
8148 *
8149 * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set.
8150 */
8151SensorI2c *
8152sensor_i2c_proxy_new_for_bus_finish (
8153 GAsyncResult *res,
8154 GError **error)
8155{
8156 GObject *ret;
8157 GObject *source_object;
8158 source_object = g_async_result_get_source_object (res);
8159 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
8160 g_object_unref (source_object);
8161 if (ret != NULL)
8162 return SENSOR_I2C (ret);
8163 else
8164 return NULL;
8165}
8166
8167/**
8168 * sensor_i2c_proxy_new_for_bus_sync:
8169 * @bus_type: A #GBusType.
8170 * @flags: Flags from the #GDBusProxyFlags enumeration.
8171 * @name: A bus name (well-known or unique).
8172 * @object_path: An object path.
8173 * @cancellable: (allow-none): A #GCancellable or %NULL.
8174 * @error: Return location for error or %NULL
8175 *
8176 * Like sensor_i2c_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
8177 *
8178 * The calling thread is blocked until a reply is received.
8179 *
8180 * See sensor_i2c_proxy_new_for_bus() for the asynchronous version of this constructor.
8181 *
8182 * Returns: (transfer full) (type SensorI2cProxy): The constructed proxy object or %NULL if @error is set.
8183 */
8184SensorI2c *
8185sensor_i2c_proxy_new_for_bus_sync (
8186 GBusType bus_type,
8187 GDBusProxyFlags flags,
8188 const gchar *name,
8189 const gchar *object_path,
8190 GCancellable *cancellable,
8191 GError **error)
8192{
8193 GInitable *ret;
8194 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);
8195 if (ret != NULL)
8196 return SENSOR_I2C (ret);
8197 else
8198 return NULL;
8199}
8200
8201
8202/* ------------------------------------------------------------------------ */
8203
8204/**
8205 * SensorI2cSkeleton:
8206 *
8207 * The #SensorI2cSkeleton structure contains only private data and should only be accessed using the provided API.
8208 */
8209
8210/**
8211 * SensorI2cSkeletonClass:
8212 * @parent_class: The parent class.
8213 *
8214 * Class structure for #SensorI2cSkeleton.
8215 */
8216
8217struct _SensorI2cSkeletonPrivate
8218{
8219 GValue *properties;
8220 GList *changed_properties;
8221 GSource *changed_properties_idle_source;
8222 GMainContext *context;
8223 GMutex lock;
8224};
8225
8226static void
8227_sensor_i2c_skeleton_handle_method_call (
8228 GDBusConnection *connection G_GNUC_UNUSED,
8229 const gchar *sender G_GNUC_UNUSED,
8230 const gchar *object_path G_GNUC_UNUSED,
8231 const gchar *interface_name,
8232 const gchar *method_name,
8233 GVariant *parameters,
8234 GDBusMethodInvocation *invocation,
8235 gpointer user_data)
8236{
8237 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data);
8238 _ExtendedGDBusMethodInfo *info;
8239 GVariantIter iter;
8240 GVariant *child;
8241 GValue *paramv;
8242 guint num_params;
8243 guint num_extra;
8244 guint n;
8245 guint signal_id;
8246 GValue return_value = G_VALUE_INIT;
8247 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
8248 g_assert (info != NULL);
8249 num_params = g_variant_n_children (parameters);
8250 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
8251 n = 0;
8252 g_value_init (&paramv[n], TYPE_SENSOR_I2C);
8253 g_value_set_object (&paramv[n++], skeleton);
8254 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
8255 g_value_set_object (&paramv[n++], invocation);
8256 if (info->pass_fdlist)
8257 {
8258#ifdef G_OS_UNIX
8259 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
8260 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
8261#else
8262 g_assert_not_reached ();
8263#endif
8264 }
8265 g_variant_iter_init (&iter, parameters);
8266 while ((child = g_variant_iter_next_value (&iter)) != NULL)
8267 {
8268 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
8269 if (arg_info->use_gvariant)
8270 {
8271 g_value_init (&paramv[n], G_TYPE_VARIANT);
8272 g_value_set_variant (&paramv[n], child);
8273 n++;
8274 }
8275 else
8276 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
8277 g_variant_unref (child);
8278 }
8279 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_I2C);
8280 g_value_init (&return_value, G_TYPE_BOOLEAN);
8281 g_signal_emitv (paramv, signal_id, 0, &return_value);
8282 if (!g_value_get_boolean (&return_value))
8283 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);
8284 g_value_unset (&return_value);
8285 for (n = 0; n < num_params + num_extra; n++)
8286 g_value_unset (&paramv[n]);
8287 g_free (paramv);
8288}
8289
8290static GVariant *
8291_sensor_i2c_skeleton_handle_get_property (
8292 GDBusConnection *connection G_GNUC_UNUSED,
8293 const gchar *sender G_GNUC_UNUSED,
8294 const gchar *object_path G_GNUC_UNUSED,
8295 const gchar *interface_name G_GNUC_UNUSED,
8296 const gchar *property_name,
8297 GError **error,
8298 gpointer user_data)
8299{
8300 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data);
8301 GValue value = G_VALUE_INIT;
8302 GParamSpec *pspec;
8303 _ExtendedGDBusPropertyInfo *info;
8304 GVariant *ret;
8305 ret = NULL;
8306 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, property_name);
8307 g_assert (info != NULL);
8308 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
8309 if (pspec == NULL)
8310 {
8311 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
8312 }
8313 else
8314 {
8315 g_value_init (&value, pspec->value_type);
8316 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
8317 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
8318 g_value_unset (&value);
8319 }
8320 return ret;
8321}
8322
8323static gboolean
8324_sensor_i2c_skeleton_handle_set_property (
8325 GDBusConnection *connection G_GNUC_UNUSED,
8326 const gchar *sender G_GNUC_UNUSED,
8327 const gchar *object_path G_GNUC_UNUSED,
8328 const gchar *interface_name G_GNUC_UNUSED,
8329 const gchar *property_name,
8330 GVariant *variant,
8331 GError **error,
8332 gpointer user_data)
8333{
8334 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data);
8335 GValue value = G_VALUE_INIT;
8336 GParamSpec *pspec;
8337 _ExtendedGDBusPropertyInfo *info;
8338 gboolean ret;
8339 ret = FALSE;
8340 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_i2c_interface_info.parent_struct, property_name);
8341 g_assert (info != NULL);
8342 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
8343 if (pspec == NULL)
8344 {
8345 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
8346 }
8347 else
8348 {
8349 if (info->use_gvariant)
8350 g_value_set_variant (&value, variant);
8351 else
8352 g_dbus_gvariant_to_gvalue (variant, &value);
8353 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
8354 g_value_unset (&value);
8355 ret = TRUE;
8356 }
8357 return ret;
8358}
8359
8360static const GDBusInterfaceVTable _sensor_i2c_skeleton_vtable =
8361{
8362 _sensor_i2c_skeleton_handle_method_call,
8363 _sensor_i2c_skeleton_handle_get_property,
8364 _sensor_i2c_skeleton_handle_set_property,
8365 {NULL}
8366};
8367
8368static GDBusInterfaceInfo *
8369sensor_i2c_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
8370{
8371 return sensor_i2c_interface_info ();
8372}
8373
8374static GDBusInterfaceVTable *
8375sensor_i2c_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
8376{
8377 return (GDBusInterfaceVTable *) &_sensor_i2c_skeleton_vtable;
8378}
8379
8380static GVariant *
8381sensor_i2c_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
8382{
8383 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (_skeleton);
8384
8385 GVariantBuilder builder;
8386 guint n;
8387 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
8388 if (_sensor_i2c_interface_info.parent_struct.properties == NULL)
8389 goto out;
8390 for (n = 0; _sensor_i2c_interface_info.parent_struct.properties[n] != NULL; n++)
8391 {
8392 GDBusPropertyInfo *info = _sensor_i2c_interface_info.parent_struct.properties[n];
8393 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
8394 {
8395 GVariant *value;
8396 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);
8397 if (value != NULL)
8398 {
8399 g_variant_take_ref (value);
8400 g_variant_builder_add (&builder, "{sv}", info->name, value);
8401 g_variant_unref (value);
8402 }
8403 }
8404 }
8405out:
8406 return g_variant_builder_end (&builder);
8407}
8408
8409static gboolean _sensor_i2c_emit_changed (gpointer user_data);
8410
8411static void
8412sensor_i2c_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
8413{
8414 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (_skeleton);
8415 gboolean emit_changed = FALSE;
8416
8417 g_mutex_lock (&skeleton->priv->lock);
8418 if (skeleton->priv->changed_properties_idle_source != NULL)
8419 {
8420 g_source_destroy (skeleton->priv->changed_properties_idle_source);
8421 skeleton->priv->changed_properties_idle_source = NULL;
8422 emit_changed = TRUE;
8423 }
8424 g_mutex_unlock (&skeleton->priv->lock);
8425
8426 if (emit_changed)
8427 _sensor_i2c_emit_changed (skeleton);
8428}
8429
8430static void sensor_i2c_skeleton_iface_init (SensorI2cIface *iface);
8431#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
8432G_DEFINE_TYPE_WITH_CODE (SensorI2cSkeleton, sensor_i2c_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
8433 G_ADD_PRIVATE (SensorI2cSkeleton)
8434 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_skeleton_iface_init));
8435
8436#else
8437G_DEFINE_TYPE_WITH_CODE (SensorI2cSkeleton, sensor_i2c_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
8438 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_I2C, sensor_i2c_skeleton_iface_init));
8439
8440#endif
8441static void
8442sensor_i2c_skeleton_finalize (GObject *object)
8443{
8444 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
8445 guint n;
8446 for (n = 0; n < 2; n++)
8447 g_value_unset (&skeleton->priv->properties[n]);
8448 g_free (skeleton->priv->properties);
8449 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
8450 if (skeleton->priv->changed_properties_idle_source != NULL)
8451 g_source_destroy (skeleton->priv->changed_properties_idle_source);
8452 g_main_context_unref (skeleton->priv->context);
8453 g_mutex_clear (&skeleton->priv->lock);
8454 G_OBJECT_CLASS (sensor_i2c_skeleton_parent_class)->finalize (object);
8455}
8456
8457static void
8458sensor_i2c_skeleton_get_property (GObject *object,
8459 guint prop_id,
8460 GValue *value,
8461 GParamSpec *pspec G_GNUC_UNUSED)
8462{
8463 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
8464 g_assert (prop_id != 0 && prop_id - 1 < 2);
8465 g_mutex_lock (&skeleton->priv->lock);
8466 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
8467 g_mutex_unlock (&skeleton->priv->lock);
8468}
8469
8470static gboolean
8471_sensor_i2c_emit_changed (gpointer user_data)
8472{
8473 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (user_data);
8474 GList *l;
8475 GVariantBuilder builder;
8476 GVariantBuilder invalidated_builder;
8477 guint num_changes;
8478
8479 g_mutex_lock (&skeleton->priv->lock);
8480 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
8481 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
8482 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
8483 {
8484 ChangedProperty *cp = l->data;
8485 GVariant *variant;
8486 const GValue *cur_value;
8487
8488 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
8489 if (!_g_value_equal (cur_value, &cp->orig_value))
8490 {
8491 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
8492 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
8493 g_variant_unref (variant);
8494 num_changes++;
8495 }
8496 }
8497 if (num_changes > 0)
8498 {
8499 GList *connections, *ll;
8500 GVariant *signal_variant;
8501 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorI2c",
8502 &builder, &invalidated_builder));
8503 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
8504 for (ll = connections; ll != NULL; ll = ll->next)
8505 {
8506 GDBusConnection *connection = ll->data;
8507
8508 g_dbus_connection_emit_signal (connection,
8509 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
8510 "org.freedesktop.DBus.Properties",
8511 "PropertiesChanged",
8512 signal_variant,
8513 NULL);
8514 }
8515 g_variant_unref (signal_variant);
8516 g_list_free_full (connections, g_object_unref);
8517 }
8518 else
8519 {
8520 g_variant_builder_clear (&builder);
8521 g_variant_builder_clear (&invalidated_builder);
8522 }
8523 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
8524 skeleton->priv->changed_properties = NULL;
8525 skeleton->priv->changed_properties_idle_source = NULL;
8526 g_mutex_unlock (&skeleton->priv->lock);
8527 return FALSE;
8528}
8529
8530static void
8531_sensor_i2c_schedule_emit_changed (SensorI2cSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
8532{
8533 ChangedProperty *cp;
8534 GList *l;
8535 cp = NULL;
8536 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
8537 {
8538 ChangedProperty *i_cp = l->data;
8539 if (i_cp->info == info)
8540 {
8541 cp = i_cp;
8542 break;
8543 }
8544 }
8545 if (cp == NULL)
8546 {
8547 cp = g_new0 (ChangedProperty, 1);
8548 cp->prop_id = prop_id;
8549 cp->info = info;
8550 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
8551 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
8552 g_value_copy (orig_value, &cp->orig_value);
8553 }
8554}
8555
8556static void
8557sensor_i2c_skeleton_notify (GObject *object,
8558 GParamSpec *pspec G_GNUC_UNUSED)
8559{
8560 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
8561 g_mutex_lock (&skeleton->priv->lock);
8562 if (skeleton->priv->changed_properties != NULL &&
8563 skeleton->priv->changed_properties_idle_source == NULL)
8564 {
8565 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
8566 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
8567 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_i2c_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
Adriana Kobylak2cb27752015-10-19 16:23:14 -05008568 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _sensor_i2c_emit_changed");
Norman James362a80f2015-09-14 14:04:39 -05008569 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
8570 g_source_unref (skeleton->priv->changed_properties_idle_source);
8571 }
8572 g_mutex_unlock (&skeleton->priv->lock);
8573}
8574
8575static void
8576sensor_i2c_skeleton_set_property (GObject *object,
8577 guint prop_id,
8578 const GValue *value,
8579 GParamSpec *pspec)
8580{
8581 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
8582 g_assert (prop_id != 0 && prop_id - 1 < 2);
8583 g_mutex_lock (&skeleton->priv->lock);
8584 g_object_freeze_notify (object);
8585 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
8586 {
8587 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
8588 _sensor_i2c_schedule_emit_changed (skeleton, _sensor_i2c_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
8589 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
8590 g_object_notify_by_pspec (object, pspec);
8591 }
8592 g_mutex_unlock (&skeleton->priv->lock);
8593 g_object_thaw_notify (object);
8594}
8595
8596static void
8597sensor_i2c_skeleton_init (SensorI2cSkeleton *skeleton)
8598{
8599#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
8600 skeleton->priv = sensor_i2c_skeleton_get_instance_private (skeleton);
8601#else
8602 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_I2C_SKELETON, SensorI2cSkeletonPrivate);
8603#endif
8604
8605 g_mutex_init (&skeleton->priv->lock);
8606 skeleton->priv->context = g_main_context_ref_thread_default ();
8607 skeleton->priv->properties = g_new0 (GValue, 2);
8608 g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING);
8609 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
8610}
8611
8612static const gchar *
8613sensor_i2c_skeleton_get_dev_path (SensorI2c *object)
8614{
8615 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
8616 const gchar *value;
8617 g_mutex_lock (&skeleton->priv->lock);
8618 value = g_value_get_string (&(skeleton->priv->properties[0]));
8619 g_mutex_unlock (&skeleton->priv->lock);
8620 return value;
8621}
8622
8623static const gchar *
8624sensor_i2c_skeleton_get_address (SensorI2c *object)
8625{
8626 SensorI2cSkeleton *skeleton = SENSOR_I2C_SKELETON (object);
8627 const gchar *value;
8628 g_mutex_lock (&skeleton->priv->lock);
8629 value = g_value_get_string (&(skeleton->priv->properties[1]));
8630 g_mutex_unlock (&skeleton->priv->lock);
8631 return value;
8632}
8633
8634static void
8635sensor_i2c_skeleton_class_init (SensorI2cSkeletonClass *klass)
8636{
8637 GObjectClass *gobject_class;
8638 GDBusInterfaceSkeletonClass *skeleton_class;
8639
8640 gobject_class = G_OBJECT_CLASS (klass);
8641 gobject_class->finalize = sensor_i2c_skeleton_finalize;
8642 gobject_class->get_property = sensor_i2c_skeleton_get_property;
8643 gobject_class->set_property = sensor_i2c_skeleton_set_property;
8644 gobject_class->notify = sensor_i2c_skeleton_notify;
8645
8646
8647 sensor_i2c_override_properties (gobject_class, 1);
8648
8649 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
8650 skeleton_class->get_info = sensor_i2c_skeleton_dbus_interface_get_info;
8651 skeleton_class->get_properties = sensor_i2c_skeleton_dbus_interface_get_properties;
8652 skeleton_class->flush = sensor_i2c_skeleton_dbus_interface_flush;
8653 skeleton_class->get_vtable = sensor_i2c_skeleton_dbus_interface_get_vtable;
8654
8655#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
8656 g_type_class_add_private (klass, sizeof (SensorI2cSkeletonPrivate));
8657#endif
8658}
8659
8660static void
8661sensor_i2c_skeleton_iface_init (SensorI2cIface *iface)
8662{
8663 iface->get_dev_path = sensor_i2c_skeleton_get_dev_path;
8664 iface->get_address = sensor_i2c_skeleton_get_address;
8665}
8666
8667/**
8668 * sensor_i2c_skeleton_new:
8669 *
8670 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorI2c.top_of_page">org.openbmc.SensorI2c</link>.
8671 *
8672 * Returns: (transfer full) (type SensorI2cSkeleton): The skeleton object.
8673 */
8674SensorI2c *
8675sensor_i2c_skeleton_new (void)
8676{
8677 return SENSOR_I2C (g_object_new (TYPE_SENSOR_I2C_SKELETON, NULL));
8678}
8679
8680/* ------------------------------------------------------------------------
8681 * Code for interface org.openbmc.SensorMatch
8682 * ------------------------------------------------------------------------
8683 */
8684
8685/**
8686 * SECTION:SensorMatch
8687 * @title: SensorMatch
8688 * @short_description: Generated C code for the org.openbmc.SensorMatch D-Bus interface
8689 *
8690 * 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.
8691 */
8692
8693/* ---- Introspection data for org.openbmc.SensorMatch ---- */
8694
8695static const _ExtendedGDBusArgInfo _sensor_match_signal_info_sensor_match_ARG_state =
8696{
8697 {
8698 -1,
8699 (gchar *) "state",
8700 (gchar *) "y",
8701 NULL
8702 },
8703 FALSE
8704};
8705
8706static const _ExtendedGDBusArgInfo * const _sensor_match_signal_info_sensor_match_ARG_pointers[] =
8707{
8708 &_sensor_match_signal_info_sensor_match_ARG_state,
8709 NULL
8710};
8711
8712static const _ExtendedGDBusSignalInfo _sensor_match_signal_info_sensor_match =
8713{
8714 {
8715 -1,
8716 (gchar *) "SensorMatch",
8717 (GDBusArgInfo **) &_sensor_match_signal_info_sensor_match_ARG_pointers,
8718 NULL
8719 },
8720 "sensor-match"
8721};
8722
8723static const _ExtendedGDBusSignalInfo * const _sensor_match_signal_info_pointers[] =
8724{
8725 &_sensor_match_signal_info_sensor_match,
8726 NULL
8727};
8728
8729static const _ExtendedGDBusPropertyInfo _sensor_match_property_info_match_value =
8730{
8731 {
8732 -1,
8733 (gchar *) "match_value",
8734 (gchar *) "v",
8735 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
8736 NULL
8737 },
8738 "match-value",
8739 FALSE
8740};
8741
8742static const _ExtendedGDBusPropertyInfo _sensor_match_property_info_state =
8743{
8744 {
8745 -1,
8746 (gchar *) "state",
8747 (gchar *) "y",
8748 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
8749 NULL
8750 },
8751 "state",
8752 FALSE
8753};
8754
8755static const _ExtendedGDBusPropertyInfo * const _sensor_match_property_info_pointers[] =
8756{
8757 &_sensor_match_property_info_match_value,
8758 &_sensor_match_property_info_state,
8759 NULL
8760};
8761
8762static const _ExtendedGDBusInterfaceInfo _sensor_match_interface_info =
8763{
8764 {
8765 -1,
8766 (gchar *) "org.openbmc.SensorMatch",
8767 NULL,
8768 (GDBusSignalInfo **) &_sensor_match_signal_info_pointers,
8769 (GDBusPropertyInfo **) &_sensor_match_property_info_pointers,
8770 NULL
8771 },
8772 "sensor-match",
8773};
8774
8775
8776/**
8777 * sensor_match_interface_info:
8778 *
8779 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link> D-Bus interface.
8780 *
8781 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
8782 */
8783GDBusInterfaceInfo *
8784sensor_match_interface_info (void)
8785{
8786 return (GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct;
8787}
8788
8789/**
8790 * sensor_match_override_properties:
8791 * @klass: The class structure for a #GObject<!-- -->-derived class.
8792 * @property_id_begin: The property id to assign to the first overridden property.
8793 *
8794 * Overrides all #GObject properties in the #SensorMatch interface for a concrete class.
8795 * The properties are overridden in the order they are defined.
8796 *
8797 * Returns: The last property id.
8798 */
8799guint
8800sensor_match_override_properties (GObjectClass *klass, guint property_id_begin)
8801{
8802 g_object_class_override_property (klass, property_id_begin++, "match-value");
8803 g_object_class_override_property (klass, property_id_begin++, "state");
8804 return property_id_begin - 1;
8805}
8806
8807
8808
8809/**
8810 * SensorMatch:
8811 *
8812 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>.
8813 */
8814
8815/**
8816 * SensorMatchIface:
8817 * @parent_iface: The parent interface.
8818 * @get_match_value: Getter for the #SensorMatch:match-value property.
8819 * @get_state: Getter for the #SensorMatch:state property.
8820 * @sensor_match: Handler for the #SensorMatch::sensor-match signal.
8821 *
8822 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>.
8823 */
8824
8825typedef SensorMatchIface SensorMatchInterface;
8826G_DEFINE_INTERFACE (SensorMatch, sensor_match, G_TYPE_OBJECT);
8827
8828static void
8829sensor_match_default_init (SensorMatchIface *iface)
8830{
8831 /* GObject signals for received D-Bus signals: */
8832 /**
8833 * SensorMatch::sensor-match:
8834 * @object: A #SensorMatch.
8835 * @arg_state: Argument.
8836 *
8837 * 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.
8838 *
8839 * 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.
8840 */
8841 g_signal_new ("sensor-match",
8842 G_TYPE_FROM_INTERFACE (iface),
8843 G_SIGNAL_RUN_LAST,
8844 G_STRUCT_OFFSET (SensorMatchIface, sensor_match),
8845 NULL,
8846 NULL,
8847 g_cclosure_marshal_generic,
8848 G_TYPE_NONE,
8849 1, G_TYPE_UCHAR);
8850
8851 /* GObject properties for D-Bus properties: */
8852 /**
8853 * SensorMatch:match-value:
8854 *
8855 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link>.
8856 *
8857 * 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.
8858 */
8859 g_object_interface_install_property (iface,
8860 g_param_spec_variant ("match-value", "match_value", "match_value", G_VARIANT_TYPE ("v"), NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
8861 /**
8862 * SensorMatch:state:
8863 *
8864 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SensorMatch.state">"state"</link>.
8865 *
8866 * 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.
8867 */
8868 g_object_interface_install_property (iface,
8869 g_param_spec_uchar ("state", "state", "state", 0, 255, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
8870}
8871
8872/**
8873 * sensor_match_get_match_value: (skip)
8874 * @object: A #SensorMatch.
8875 *
8876 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link> D-Bus property.
8877 *
8878 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
8879 *
8880 * <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>
8881 *
8882 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
8883 */
8884GVariant *
8885sensor_match_get_match_value (SensorMatch *object)
8886{
8887 return SENSOR_MATCH_GET_IFACE (object)->get_match_value (object);
8888}
8889
8890/**
8891 * sensor_match_dup_match_value: (skip)
8892 * @object: A #SensorMatch.
8893 *
8894 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link> D-Bus property.
8895 *
8896 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
8897 *
8898 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_variant_unref().
8899 */
8900GVariant *
8901sensor_match_dup_match_value (SensorMatch *object)
8902{
8903 GVariant *value;
8904 g_object_get (G_OBJECT (object), "match-value", &value, NULL);
8905 return value;
8906}
8907
8908/**
8909 * sensor_match_set_match_value: (skip)
8910 * @object: A #SensorMatch.
8911 * @value: The value to set.
8912 *
8913 * Sets the <link linkend="gdbus-property-org-openbmc-SensorMatch.match_value">"match_value"</link> D-Bus property to @value.
8914 *
8915 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
8916 */
8917void
8918sensor_match_set_match_value (SensorMatch *object, GVariant *value)
8919{
8920 g_object_set (G_OBJECT (object), "match-value", value, NULL);
8921}
8922
8923/**
8924 * sensor_match_get_state: (skip)
8925 * @object: A #SensorMatch.
8926 *
8927 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SensorMatch.state">"state"</link> D-Bus property.
8928 *
8929 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
8930 *
8931 * Returns: The property value.
8932 */
8933guchar
8934sensor_match_get_state (SensorMatch *object)
8935{
8936 return SENSOR_MATCH_GET_IFACE (object)->get_state (object);
8937}
8938
8939/**
8940 * sensor_match_set_state: (skip)
8941 * @object: A #SensorMatch.
8942 * @value: The value to set.
8943 *
8944 * Sets the <link linkend="gdbus-property-org-openbmc-SensorMatch.state">"state"</link> D-Bus property to @value.
8945 *
8946 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
8947 */
8948void
8949sensor_match_set_state (SensorMatch *object, guchar value)
8950{
8951 g_object_set (G_OBJECT (object), "state", value, NULL);
8952}
8953
8954/**
8955 * sensor_match_emit_sensor_match:
8956 * @object: A #SensorMatch.
8957 * @arg_state: Argument to pass with the signal.
8958 *
8959 * Emits the <link linkend="gdbus-signal-org-openbmc-SensorMatch.SensorMatch">"SensorMatch"</link> D-Bus signal.
8960 */
8961void
8962sensor_match_emit_sensor_match (
8963 SensorMatch *object,
8964 guchar arg_state)
8965{
8966 g_signal_emit_by_name (object, "sensor-match", arg_state);
8967}
8968
8969/* ------------------------------------------------------------------------ */
8970
8971/**
8972 * SensorMatchProxy:
8973 *
8974 * The #SensorMatchProxy structure contains only private data and should only be accessed using the provided API.
8975 */
8976
8977/**
8978 * SensorMatchProxyClass:
8979 * @parent_class: The parent class.
8980 *
8981 * Class structure for #SensorMatchProxy.
8982 */
8983
8984struct _SensorMatchProxyPrivate
8985{
8986 GData *qdata;
8987};
8988
8989static void sensor_match_proxy_iface_init (SensorMatchIface *iface);
8990
8991#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
8992G_DEFINE_TYPE_WITH_CODE (SensorMatchProxy, sensor_match_proxy, G_TYPE_DBUS_PROXY,
8993 G_ADD_PRIVATE (SensorMatchProxy)
8994 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_proxy_iface_init));
8995
8996#else
8997G_DEFINE_TYPE_WITH_CODE (SensorMatchProxy, sensor_match_proxy, G_TYPE_DBUS_PROXY,
8998 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_proxy_iface_init));
8999
9000#endif
9001static void
9002sensor_match_proxy_finalize (GObject *object)
9003{
9004 SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (object);
9005 g_datalist_clear (&proxy->priv->qdata);
9006 G_OBJECT_CLASS (sensor_match_proxy_parent_class)->finalize (object);
9007}
9008
9009static void
9010sensor_match_proxy_get_property (GObject *object,
9011 guint prop_id,
9012 GValue *value,
9013 GParamSpec *pspec G_GNUC_UNUSED)
9014{
9015 const _ExtendedGDBusPropertyInfo *info;
9016 GVariant *variant;
9017 g_assert (prop_id != 0 && prop_id - 1 < 2);
9018 info = _sensor_match_property_info_pointers[prop_id - 1];
9019 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
9020 if (info->use_gvariant)
9021 {
9022 g_value_set_variant (value, variant);
9023 }
9024 else
9025 {
9026 if (variant != NULL)
9027 g_dbus_gvariant_to_gvalue (variant, value);
9028 }
9029 if (variant != NULL)
9030 g_variant_unref (variant);
9031}
9032
9033static void
9034sensor_match_proxy_set_property_cb (GDBusProxy *proxy,
9035 GAsyncResult *res,
9036 gpointer user_data)
9037{
9038 const _ExtendedGDBusPropertyInfo *info = user_data;
9039 GError *error;
9040 GVariant *_ret;
9041 error = NULL;
9042 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
9043 if (!_ret)
9044 {
9045 g_warning ("Error setting property '%s' on interface org.openbmc.SensorMatch: %s (%s, %d)",
9046 info->parent_struct.name,
9047 error->message, g_quark_to_string (error->domain), error->code);
9048 g_error_free (error);
9049 }
9050 else
9051 {
9052 g_variant_unref (_ret);
9053 }
9054}
9055
9056static void
9057sensor_match_proxy_set_property (GObject *object,
9058 guint prop_id,
9059 const GValue *value,
9060 GParamSpec *pspec G_GNUC_UNUSED)
9061{
9062 const _ExtendedGDBusPropertyInfo *info;
9063 GVariant *variant;
9064 g_assert (prop_id != 0 && prop_id - 1 < 2);
9065 info = _sensor_match_property_info_pointers[prop_id - 1];
9066 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
9067 g_dbus_proxy_call (G_DBUS_PROXY (object),
9068 "org.freedesktop.DBus.Properties.Set",
9069 g_variant_new ("(ssv)", "org.openbmc.SensorMatch", info->parent_struct.name, variant),
9070 G_DBUS_CALL_FLAGS_NONE,
9071 -1,
9072 NULL, (GAsyncReadyCallback) sensor_match_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
9073 g_variant_unref (variant);
9074}
9075
9076static void
9077sensor_match_proxy_g_signal (GDBusProxy *proxy,
9078 const gchar *sender_name G_GNUC_UNUSED,
9079 const gchar *signal_name,
9080 GVariant *parameters)
9081{
9082 _ExtendedGDBusSignalInfo *info;
9083 GVariantIter iter;
9084 GVariant *child;
9085 GValue *paramv;
9086 guint num_params;
9087 guint n;
9088 guint signal_id;
9089 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, signal_name);
9090 if (info == NULL)
9091 return;
9092 num_params = g_variant_n_children (parameters);
9093 paramv = g_new0 (GValue, num_params + 1);
9094 g_value_init (&paramv[0], TYPE_SENSOR_MATCH);
9095 g_value_set_object (&paramv[0], proxy);
9096 g_variant_iter_init (&iter, parameters);
9097 n = 1;
9098 while ((child = g_variant_iter_next_value (&iter)) != NULL)
9099 {
9100 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
9101 if (arg_info->use_gvariant)
9102 {
9103 g_value_init (&paramv[n], G_TYPE_VARIANT);
9104 g_value_set_variant (&paramv[n], child);
9105 n++;
9106 }
9107 else
9108 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
9109 g_variant_unref (child);
9110 }
9111 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_MATCH);
9112 g_signal_emitv (paramv, signal_id, 0, NULL);
9113 for (n = 0; n < num_params + 1; n++)
9114 g_value_unset (&paramv[n]);
9115 g_free (paramv);
9116}
9117
9118static void
9119sensor_match_proxy_g_properties_changed (GDBusProxy *_proxy,
9120 GVariant *changed_properties,
9121 const gchar *const *invalidated_properties)
9122{
9123 SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (_proxy);
9124 guint n;
9125 const gchar *key;
9126 GVariantIter *iter;
9127 _ExtendedGDBusPropertyInfo *info;
9128 g_variant_get (changed_properties, "a{sv}", &iter);
9129 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
9130 {
9131 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, key);
9132 g_datalist_remove_data (&proxy->priv->qdata, key);
9133 if (info != NULL)
9134 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
9135 }
9136 g_variant_iter_free (iter);
9137 for (n = 0; invalidated_properties[n] != NULL; n++)
9138 {
9139 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, invalidated_properties[n]);
9140 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
9141 if (info != NULL)
9142 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
9143 }
9144}
9145
9146static GVariant *
9147sensor_match_proxy_get_match_value (SensorMatch *object)
9148{
9149 SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (object);
9150 GVariant *variant;
9151 GVariant *value = NULL;
9152 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "match_value");
9153 value = variant;
9154 if (variant != NULL)
9155 g_variant_unref (variant);
9156 return value;
9157}
9158
9159static guchar
9160sensor_match_proxy_get_state (SensorMatch *object)
9161{
9162 SensorMatchProxy *proxy = SENSOR_MATCH_PROXY (object);
9163 GVariant *variant;
9164 guchar value = 0;
9165 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state");
9166 if (variant != NULL)
9167 {
9168 value = g_variant_get_byte (variant);
9169 g_variant_unref (variant);
9170 }
9171 return value;
9172}
9173
9174static void
9175sensor_match_proxy_init (SensorMatchProxy *proxy)
9176{
9177#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
9178 proxy->priv = sensor_match_proxy_get_instance_private (proxy);
9179#else
9180 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SENSOR_MATCH_PROXY, SensorMatchProxyPrivate);
9181#endif
9182
9183 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), sensor_match_interface_info ());
9184}
9185
9186static void
9187sensor_match_proxy_class_init (SensorMatchProxyClass *klass)
9188{
9189 GObjectClass *gobject_class;
9190 GDBusProxyClass *proxy_class;
9191
9192 gobject_class = G_OBJECT_CLASS (klass);
9193 gobject_class->finalize = sensor_match_proxy_finalize;
9194 gobject_class->get_property = sensor_match_proxy_get_property;
9195 gobject_class->set_property = sensor_match_proxy_set_property;
9196
9197 proxy_class = G_DBUS_PROXY_CLASS (klass);
9198 proxy_class->g_signal = sensor_match_proxy_g_signal;
9199 proxy_class->g_properties_changed = sensor_match_proxy_g_properties_changed;
9200
9201 sensor_match_override_properties (gobject_class, 1);
9202
9203#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
9204 g_type_class_add_private (klass, sizeof (SensorMatchProxyPrivate));
9205#endif
9206}
9207
9208static void
9209sensor_match_proxy_iface_init (SensorMatchIface *iface)
9210{
9211 iface->get_match_value = sensor_match_proxy_get_match_value;
9212 iface->get_state = sensor_match_proxy_get_state;
9213}
9214
9215/**
9216 * sensor_match_proxy_new:
9217 * @connection: A #GDBusConnection.
9218 * @flags: Flags from the #GDBusProxyFlags enumeration.
9219 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
9220 * @object_path: An object path.
9221 * @cancellable: (allow-none): A #GCancellable or %NULL.
9222 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
9223 * @user_data: User data to pass to @callback.
9224 *
9225 * 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.
9226 *
9227 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
9228 * You can then call sensor_match_proxy_new_finish() to get the result of the operation.
9229 *
9230 * See sensor_match_proxy_new_sync() for the synchronous, blocking version of this constructor.
9231 */
9232void
9233sensor_match_proxy_new (
9234 GDBusConnection *connection,
9235 GDBusProxyFlags flags,
9236 const gchar *name,
9237 const gchar *object_path,
9238 GCancellable *cancellable,
9239 GAsyncReadyCallback callback,
9240 gpointer user_data)
9241{
9242 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);
9243}
9244
9245/**
9246 * sensor_match_proxy_new_finish:
9247 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_match_proxy_new().
9248 * @error: Return location for error or %NULL
9249 *
9250 * Finishes an operation started with sensor_match_proxy_new().
9251 *
9252 * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set.
9253 */
9254SensorMatch *
9255sensor_match_proxy_new_finish (
9256 GAsyncResult *res,
9257 GError **error)
9258{
9259 GObject *ret;
9260 GObject *source_object;
9261 source_object = g_async_result_get_source_object (res);
9262 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
9263 g_object_unref (source_object);
9264 if (ret != NULL)
9265 return SENSOR_MATCH (ret);
9266 else
9267 return NULL;
9268}
9269
9270/**
9271 * sensor_match_proxy_new_sync:
9272 * @connection: A #GDBusConnection.
9273 * @flags: Flags from the #GDBusProxyFlags enumeration.
9274 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
9275 * @object_path: An object path.
9276 * @cancellable: (allow-none): A #GCancellable or %NULL.
9277 * @error: Return location for error or %NULL
9278 *
9279 * 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.
9280 *
9281 * The calling thread is blocked until a reply is received.
9282 *
9283 * See sensor_match_proxy_new() for the asynchronous version of this constructor.
9284 *
9285 * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set.
9286 */
9287SensorMatch *
9288sensor_match_proxy_new_sync (
9289 GDBusConnection *connection,
9290 GDBusProxyFlags flags,
9291 const gchar *name,
9292 const gchar *object_path,
9293 GCancellable *cancellable,
9294 GError **error)
9295{
9296 GInitable *ret;
9297 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);
9298 if (ret != NULL)
9299 return SENSOR_MATCH (ret);
9300 else
9301 return NULL;
9302}
9303
9304
9305/**
9306 * sensor_match_proxy_new_for_bus:
9307 * @bus_type: A #GBusType.
9308 * @flags: Flags from the #GDBusProxyFlags enumeration.
9309 * @name: A bus name (well-known or unique).
9310 * @object_path: An object path.
9311 * @cancellable: (allow-none): A #GCancellable or %NULL.
9312 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
9313 * @user_data: User data to pass to @callback.
9314 *
9315 * Like sensor_match_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
9316 *
9317 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
9318 * You can then call sensor_match_proxy_new_for_bus_finish() to get the result of the operation.
9319 *
9320 * See sensor_match_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
9321 */
9322void
9323sensor_match_proxy_new_for_bus (
9324 GBusType bus_type,
9325 GDBusProxyFlags flags,
9326 const gchar *name,
9327 const gchar *object_path,
9328 GCancellable *cancellable,
9329 GAsyncReadyCallback callback,
9330 gpointer user_data)
9331{
9332 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);
9333}
9334
9335/**
9336 * sensor_match_proxy_new_for_bus_finish:
9337 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to sensor_match_proxy_new_for_bus().
9338 * @error: Return location for error or %NULL
9339 *
9340 * Finishes an operation started with sensor_match_proxy_new_for_bus().
9341 *
9342 * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set.
9343 */
9344SensorMatch *
9345sensor_match_proxy_new_for_bus_finish (
9346 GAsyncResult *res,
9347 GError **error)
9348{
9349 GObject *ret;
9350 GObject *source_object;
9351 source_object = g_async_result_get_source_object (res);
9352 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
9353 g_object_unref (source_object);
9354 if (ret != NULL)
9355 return SENSOR_MATCH (ret);
9356 else
9357 return NULL;
9358}
9359
9360/**
9361 * sensor_match_proxy_new_for_bus_sync:
9362 * @bus_type: A #GBusType.
9363 * @flags: Flags from the #GDBusProxyFlags enumeration.
9364 * @name: A bus name (well-known or unique).
9365 * @object_path: An object path.
9366 * @cancellable: (allow-none): A #GCancellable or %NULL.
9367 * @error: Return location for error or %NULL
9368 *
9369 * Like sensor_match_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
9370 *
9371 * The calling thread is blocked until a reply is received.
9372 *
9373 * See sensor_match_proxy_new_for_bus() for the asynchronous version of this constructor.
9374 *
9375 * Returns: (transfer full) (type SensorMatchProxy): The constructed proxy object or %NULL if @error is set.
9376 */
9377SensorMatch *
9378sensor_match_proxy_new_for_bus_sync (
9379 GBusType bus_type,
9380 GDBusProxyFlags flags,
9381 const gchar *name,
9382 const gchar *object_path,
9383 GCancellable *cancellable,
9384 GError **error)
9385{
9386 GInitable *ret;
9387 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);
9388 if (ret != NULL)
9389 return SENSOR_MATCH (ret);
9390 else
9391 return NULL;
9392}
9393
9394
9395/* ------------------------------------------------------------------------ */
9396
9397/**
9398 * SensorMatchSkeleton:
9399 *
9400 * The #SensorMatchSkeleton structure contains only private data and should only be accessed using the provided API.
9401 */
9402
9403/**
9404 * SensorMatchSkeletonClass:
9405 * @parent_class: The parent class.
9406 *
9407 * Class structure for #SensorMatchSkeleton.
9408 */
9409
9410struct _SensorMatchSkeletonPrivate
9411{
9412 GValue *properties;
9413 GList *changed_properties;
9414 GSource *changed_properties_idle_source;
9415 GMainContext *context;
9416 GMutex lock;
9417};
9418
9419static void
9420_sensor_match_skeleton_handle_method_call (
9421 GDBusConnection *connection G_GNUC_UNUSED,
9422 const gchar *sender G_GNUC_UNUSED,
9423 const gchar *object_path G_GNUC_UNUSED,
9424 const gchar *interface_name,
9425 const gchar *method_name,
9426 GVariant *parameters,
9427 GDBusMethodInvocation *invocation,
9428 gpointer user_data)
9429{
9430 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data);
9431 _ExtendedGDBusMethodInfo *info;
9432 GVariantIter iter;
9433 GVariant *child;
9434 GValue *paramv;
9435 guint num_params;
9436 guint num_extra;
9437 guint n;
9438 guint signal_id;
9439 GValue return_value = G_VALUE_INIT;
9440 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
9441 g_assert (info != NULL);
9442 num_params = g_variant_n_children (parameters);
9443 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
9444 n = 0;
9445 g_value_init (&paramv[n], TYPE_SENSOR_MATCH);
9446 g_value_set_object (&paramv[n++], skeleton);
9447 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
9448 g_value_set_object (&paramv[n++], invocation);
9449 if (info->pass_fdlist)
9450 {
9451#ifdef G_OS_UNIX
9452 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
9453 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
9454#else
9455 g_assert_not_reached ();
9456#endif
9457 }
9458 g_variant_iter_init (&iter, parameters);
9459 while ((child = g_variant_iter_next_value (&iter)) != NULL)
9460 {
9461 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
9462 if (arg_info->use_gvariant)
9463 {
9464 g_value_init (&paramv[n], G_TYPE_VARIANT);
9465 g_value_set_variant (&paramv[n], child);
9466 n++;
9467 }
9468 else
9469 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
9470 g_variant_unref (child);
9471 }
9472 signal_id = g_signal_lookup (info->signal_name, TYPE_SENSOR_MATCH);
9473 g_value_init (&return_value, G_TYPE_BOOLEAN);
9474 g_signal_emitv (paramv, signal_id, 0, &return_value);
9475 if (!g_value_get_boolean (&return_value))
9476 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);
9477 g_value_unset (&return_value);
9478 for (n = 0; n < num_params + num_extra; n++)
9479 g_value_unset (&paramv[n]);
9480 g_free (paramv);
9481}
9482
9483static GVariant *
9484_sensor_match_skeleton_handle_get_property (
9485 GDBusConnection *connection G_GNUC_UNUSED,
9486 const gchar *sender G_GNUC_UNUSED,
9487 const gchar *object_path G_GNUC_UNUSED,
9488 const gchar *interface_name G_GNUC_UNUSED,
9489 const gchar *property_name,
9490 GError **error,
9491 gpointer user_data)
9492{
9493 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data);
9494 GValue value = G_VALUE_INIT;
9495 GParamSpec *pspec;
9496 _ExtendedGDBusPropertyInfo *info;
9497 GVariant *ret;
9498 ret = NULL;
9499 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, property_name);
9500 g_assert (info != NULL);
9501 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
9502 if (pspec == NULL)
9503 {
9504 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
9505 }
9506 else
9507 {
9508 g_value_init (&value, pspec->value_type);
9509 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
9510 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
9511 g_value_unset (&value);
9512 }
9513 return ret;
9514}
9515
9516static gboolean
9517_sensor_match_skeleton_handle_set_property (
9518 GDBusConnection *connection G_GNUC_UNUSED,
9519 const gchar *sender G_GNUC_UNUSED,
9520 const gchar *object_path G_GNUC_UNUSED,
9521 const gchar *interface_name G_GNUC_UNUSED,
9522 const gchar *property_name,
9523 GVariant *variant,
9524 GError **error,
9525 gpointer user_data)
9526{
9527 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data);
9528 GValue value = G_VALUE_INIT;
9529 GParamSpec *pspec;
9530 _ExtendedGDBusPropertyInfo *info;
9531 gboolean ret;
9532 ret = FALSE;
9533 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_sensor_match_interface_info.parent_struct, property_name);
9534 g_assert (info != NULL);
9535 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
9536 if (pspec == NULL)
9537 {
9538 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
9539 }
9540 else
9541 {
9542 if (info->use_gvariant)
9543 g_value_set_variant (&value, variant);
9544 else
9545 g_dbus_gvariant_to_gvalue (variant, &value);
9546 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
9547 g_value_unset (&value);
9548 ret = TRUE;
9549 }
9550 return ret;
9551}
9552
9553static const GDBusInterfaceVTable _sensor_match_skeleton_vtable =
9554{
9555 _sensor_match_skeleton_handle_method_call,
9556 _sensor_match_skeleton_handle_get_property,
9557 _sensor_match_skeleton_handle_set_property,
9558 {NULL}
9559};
9560
9561static GDBusInterfaceInfo *
9562sensor_match_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
9563{
9564 return sensor_match_interface_info ();
9565}
9566
9567static GDBusInterfaceVTable *
9568sensor_match_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
9569{
9570 return (GDBusInterfaceVTable *) &_sensor_match_skeleton_vtable;
9571}
9572
9573static GVariant *
9574sensor_match_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
9575{
9576 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (_skeleton);
9577
9578 GVariantBuilder builder;
9579 guint n;
9580 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
9581 if (_sensor_match_interface_info.parent_struct.properties == NULL)
9582 goto out;
9583 for (n = 0; _sensor_match_interface_info.parent_struct.properties[n] != NULL; n++)
9584 {
9585 GDBusPropertyInfo *info = _sensor_match_interface_info.parent_struct.properties[n];
9586 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
9587 {
9588 GVariant *value;
9589 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);
9590 if (value != NULL)
9591 {
9592 g_variant_take_ref (value);
9593 g_variant_builder_add (&builder, "{sv}", info->name, value);
9594 g_variant_unref (value);
9595 }
9596 }
9597 }
9598out:
9599 return g_variant_builder_end (&builder);
9600}
9601
9602static gboolean _sensor_match_emit_changed (gpointer user_data);
9603
9604static void
9605sensor_match_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
9606{
9607 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (_skeleton);
9608 gboolean emit_changed = FALSE;
9609
9610 g_mutex_lock (&skeleton->priv->lock);
9611 if (skeleton->priv->changed_properties_idle_source != NULL)
9612 {
9613 g_source_destroy (skeleton->priv->changed_properties_idle_source);
9614 skeleton->priv->changed_properties_idle_source = NULL;
9615 emit_changed = TRUE;
9616 }
9617 g_mutex_unlock (&skeleton->priv->lock);
9618
9619 if (emit_changed)
9620 _sensor_match_emit_changed (skeleton);
9621}
9622
9623static void
9624_sensor_match_on_signal_sensor_match (
9625 SensorMatch *object,
9626 guchar arg_state)
9627{
9628 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
9629
9630 GList *connections, *l;
9631 GVariant *signal_variant;
9632 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
9633
9634 signal_variant = g_variant_ref_sink (g_variant_new ("(y)",
9635 arg_state));
9636 for (l = connections; l != NULL; l = l->next)
9637 {
9638 GDBusConnection *connection = l->data;
9639 g_dbus_connection_emit_signal (connection,
9640 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.SensorMatch", "SensorMatch",
9641 signal_variant, NULL);
9642 }
9643 g_variant_unref (signal_variant);
9644 g_list_free_full (connections, g_object_unref);
9645}
9646
9647static void sensor_match_skeleton_iface_init (SensorMatchIface *iface);
9648#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
9649G_DEFINE_TYPE_WITH_CODE (SensorMatchSkeleton, sensor_match_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
9650 G_ADD_PRIVATE (SensorMatchSkeleton)
9651 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_skeleton_iface_init));
9652
9653#else
9654G_DEFINE_TYPE_WITH_CODE (SensorMatchSkeleton, sensor_match_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
9655 G_IMPLEMENT_INTERFACE (TYPE_SENSOR_MATCH, sensor_match_skeleton_iface_init));
9656
9657#endif
9658static void
9659sensor_match_skeleton_finalize (GObject *object)
9660{
9661 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
9662 guint n;
9663 for (n = 0; n < 2; n++)
9664 g_value_unset (&skeleton->priv->properties[n]);
9665 g_free (skeleton->priv->properties);
9666 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
9667 if (skeleton->priv->changed_properties_idle_source != NULL)
9668 g_source_destroy (skeleton->priv->changed_properties_idle_source);
9669 g_main_context_unref (skeleton->priv->context);
9670 g_mutex_clear (&skeleton->priv->lock);
9671 G_OBJECT_CLASS (sensor_match_skeleton_parent_class)->finalize (object);
9672}
9673
9674static void
9675sensor_match_skeleton_get_property (GObject *object,
9676 guint prop_id,
9677 GValue *value,
9678 GParamSpec *pspec G_GNUC_UNUSED)
9679{
9680 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
9681 g_assert (prop_id != 0 && prop_id - 1 < 2);
9682 g_mutex_lock (&skeleton->priv->lock);
9683 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
9684 g_mutex_unlock (&skeleton->priv->lock);
9685}
9686
9687static gboolean
9688_sensor_match_emit_changed (gpointer user_data)
9689{
9690 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (user_data);
9691 GList *l;
9692 GVariantBuilder builder;
9693 GVariantBuilder invalidated_builder;
9694 guint num_changes;
9695
9696 g_mutex_lock (&skeleton->priv->lock);
9697 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
9698 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
9699 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
9700 {
9701 ChangedProperty *cp = l->data;
9702 GVariant *variant;
9703 const GValue *cur_value;
9704
9705 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
9706 if (!_g_value_equal (cur_value, &cp->orig_value))
9707 {
9708 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
9709 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
9710 g_variant_unref (variant);
9711 num_changes++;
9712 }
9713 }
9714 if (num_changes > 0)
9715 {
9716 GList *connections, *ll;
9717 GVariant *signal_variant;
9718 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SensorMatch",
9719 &builder, &invalidated_builder));
9720 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
9721 for (ll = connections; ll != NULL; ll = ll->next)
9722 {
9723 GDBusConnection *connection = ll->data;
9724
9725 g_dbus_connection_emit_signal (connection,
9726 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
9727 "org.freedesktop.DBus.Properties",
9728 "PropertiesChanged",
9729 signal_variant,
9730 NULL);
9731 }
9732 g_variant_unref (signal_variant);
9733 g_list_free_full (connections, g_object_unref);
9734 }
9735 else
9736 {
9737 g_variant_builder_clear (&builder);
9738 g_variant_builder_clear (&invalidated_builder);
9739 }
9740 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
9741 skeleton->priv->changed_properties = NULL;
9742 skeleton->priv->changed_properties_idle_source = NULL;
9743 g_mutex_unlock (&skeleton->priv->lock);
9744 return FALSE;
9745}
9746
9747static void
9748_sensor_match_schedule_emit_changed (SensorMatchSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
9749{
9750 ChangedProperty *cp;
9751 GList *l;
9752 cp = NULL;
9753 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
9754 {
9755 ChangedProperty *i_cp = l->data;
9756 if (i_cp->info == info)
9757 {
9758 cp = i_cp;
9759 break;
9760 }
9761 }
9762 if (cp == NULL)
9763 {
9764 cp = g_new0 (ChangedProperty, 1);
9765 cp->prop_id = prop_id;
9766 cp->info = info;
9767 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
9768 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
9769 g_value_copy (orig_value, &cp->orig_value);
9770 }
9771}
9772
9773static void
9774sensor_match_skeleton_notify (GObject *object,
9775 GParamSpec *pspec G_GNUC_UNUSED)
9776{
9777 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
9778 g_mutex_lock (&skeleton->priv->lock);
9779 if (skeleton->priv->changed_properties != NULL &&
9780 skeleton->priv->changed_properties_idle_source == NULL)
9781 {
9782 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
9783 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
9784 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _sensor_match_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
Adriana Kobylak2cb27752015-10-19 16:23:14 -05009785 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _sensor_match_emit_changed");
Norman James362a80f2015-09-14 14:04:39 -05009786 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
9787 g_source_unref (skeleton->priv->changed_properties_idle_source);
9788 }
9789 g_mutex_unlock (&skeleton->priv->lock);
9790}
9791
9792static void
9793sensor_match_skeleton_set_property (GObject *object,
9794 guint prop_id,
9795 const GValue *value,
9796 GParamSpec *pspec)
9797{
9798 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
9799 g_assert (prop_id != 0 && prop_id - 1 < 2);
9800 g_mutex_lock (&skeleton->priv->lock);
9801 g_object_freeze_notify (object);
9802 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
9803 {
9804 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
9805 _sensor_match_schedule_emit_changed (skeleton, _sensor_match_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
9806 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
9807 g_object_notify_by_pspec (object, pspec);
9808 }
9809 g_mutex_unlock (&skeleton->priv->lock);
9810 g_object_thaw_notify (object);
9811}
9812
9813static void
9814sensor_match_skeleton_init (SensorMatchSkeleton *skeleton)
9815{
9816#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
9817 skeleton->priv = sensor_match_skeleton_get_instance_private (skeleton);
9818#else
9819 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SENSOR_MATCH_SKELETON, SensorMatchSkeletonPrivate);
9820#endif
9821
9822 g_mutex_init (&skeleton->priv->lock);
9823 skeleton->priv->context = g_main_context_ref_thread_default ();
9824 skeleton->priv->properties = g_new0 (GValue, 2);
9825 g_value_init (&skeleton->priv->properties[0], G_TYPE_VARIANT);
9826 g_value_init (&skeleton->priv->properties[1], G_TYPE_UCHAR);
9827}
9828
9829static GVariant *
9830sensor_match_skeleton_get_match_value (SensorMatch *object)
9831{
9832 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
9833 GVariant *value;
9834 g_mutex_lock (&skeleton->priv->lock);
9835 value = g_value_get_variant (&(skeleton->priv->properties[0]));
9836 g_mutex_unlock (&skeleton->priv->lock);
9837 return value;
9838}
9839
9840static guchar
9841sensor_match_skeleton_get_state (SensorMatch *object)
9842{
9843 SensorMatchSkeleton *skeleton = SENSOR_MATCH_SKELETON (object);
9844 guchar value;
9845 g_mutex_lock (&skeleton->priv->lock);
9846 value = g_value_get_uchar (&(skeleton->priv->properties[1]));
9847 g_mutex_unlock (&skeleton->priv->lock);
9848 return value;
9849}
9850
9851static void
9852sensor_match_skeleton_class_init (SensorMatchSkeletonClass *klass)
9853{
9854 GObjectClass *gobject_class;
9855 GDBusInterfaceSkeletonClass *skeleton_class;
9856
9857 gobject_class = G_OBJECT_CLASS (klass);
9858 gobject_class->finalize = sensor_match_skeleton_finalize;
9859 gobject_class->get_property = sensor_match_skeleton_get_property;
9860 gobject_class->set_property = sensor_match_skeleton_set_property;
9861 gobject_class->notify = sensor_match_skeleton_notify;
9862
9863
9864 sensor_match_override_properties (gobject_class, 1);
9865
9866 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
9867 skeleton_class->get_info = sensor_match_skeleton_dbus_interface_get_info;
9868 skeleton_class->get_properties = sensor_match_skeleton_dbus_interface_get_properties;
9869 skeleton_class->flush = sensor_match_skeleton_dbus_interface_flush;
9870 skeleton_class->get_vtable = sensor_match_skeleton_dbus_interface_get_vtable;
9871
9872#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
9873 g_type_class_add_private (klass, sizeof (SensorMatchSkeletonPrivate));
9874#endif
9875}
9876
9877static void
9878sensor_match_skeleton_iface_init (SensorMatchIface *iface)
9879{
9880 iface->sensor_match = _sensor_match_on_signal_sensor_match;
9881 iface->get_match_value = sensor_match_skeleton_get_match_value;
9882 iface->get_state = sensor_match_skeleton_get_state;
9883}
9884
9885/**
9886 * sensor_match_skeleton_new:
9887 *
9888 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SensorMatch.top_of_page">org.openbmc.SensorMatch</link>.
9889 *
9890 * Returns: (transfer full) (type SensorMatchSkeleton): The skeleton object.
9891 */
9892SensorMatch *
9893sensor_match_skeleton_new (void)
9894{
9895 return SENSOR_MATCH (g_object_new (TYPE_SENSOR_MATCH_SKELETON, NULL));
9896}
9897
9898/* ------------------------------------------------------------------------
9899 * Code for interface org.openbmc.Process
9900 * ------------------------------------------------------------------------
9901 */
9902
9903/**
9904 * SECTION:Process
9905 * @title: Process
9906 * @short_description: Generated C code for the org.openbmc.Process D-Bus interface
9907 *
9908 * 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.
9909 */
9910
9911/* ---- Introspection data for org.openbmc.Process ---- */
9912
9913static const _ExtendedGDBusMethodInfo _process_method_info_stop =
9914{
9915 {
9916 -1,
9917 (gchar *) "stop",
9918 NULL,
9919 NULL,
9920 NULL
9921 },
9922 "handle-stop",
9923 FALSE
9924};
9925
9926static const _ExtendedGDBusMethodInfo * const _process_method_info_pointers[] =
9927{
9928 &_process_method_info_stop,
9929 NULL
9930};
9931
9932static const _ExtendedGDBusInterfaceInfo _process_interface_info =
9933{
9934 {
9935 -1,
9936 (gchar *) "org.openbmc.Process",
9937 (GDBusMethodInfo **) &_process_method_info_pointers,
9938 NULL,
9939 NULL,
9940 NULL
9941 },
9942 "process",
9943};
9944
9945
9946/**
9947 * process_interface_info:
9948 *
9949 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link> D-Bus interface.
9950 *
9951 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
9952 */
9953GDBusInterfaceInfo *
9954process_interface_info (void)
9955{
9956 return (GDBusInterfaceInfo *) &_process_interface_info.parent_struct;
9957}
9958
9959/**
9960 * process_override_properties:
9961 * @klass: The class structure for a #GObject<!-- -->-derived class.
9962 * @property_id_begin: The property id to assign to the first overridden property.
9963 *
9964 * Overrides all #GObject properties in the #Process interface for a concrete class.
9965 * The properties are overridden in the order they are defined.
9966 *
9967 * Returns: The last property id.
9968 */
9969guint
9970process_override_properties (GObjectClass *klass, guint property_id_begin)
9971{
9972 return property_id_begin - 1;
9973}
9974
9975
9976
9977/**
9978 * Process:
9979 *
9980 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link>.
9981 */
9982
9983/**
9984 * ProcessIface:
9985 * @parent_iface: The parent interface.
9986 * @handle_stop: Handler for the #Process::handle-stop signal.
9987 *
9988 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link>.
9989 */
9990
9991typedef ProcessIface ProcessInterface;
9992G_DEFINE_INTERFACE (Process, process, G_TYPE_OBJECT);
9993
9994static void
9995process_default_init (ProcessIface *iface)
9996{
9997 /* GObject signals for incoming D-Bus method calls: */
9998 /**
9999 * Process::handle-stop:
10000 * @object: A #Process.
10001 * @invocation: A #GDBusMethodInvocation.
10002 *
10003 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Process.stop">stop()</link> D-Bus method.
10004 *
10005 * 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.
10006 *
10007 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
10008 */
10009 g_signal_new ("handle-stop",
10010 G_TYPE_FROM_INTERFACE (iface),
10011 G_SIGNAL_RUN_LAST,
10012 G_STRUCT_OFFSET (ProcessIface, handle_stop),
10013 g_signal_accumulator_true_handled,
10014 NULL,
10015 g_cclosure_marshal_generic,
10016 G_TYPE_BOOLEAN,
10017 1,
10018 G_TYPE_DBUS_METHOD_INVOCATION);
10019
10020}
10021
10022/**
10023 * process_call_stop:
10024 * @proxy: A #ProcessProxy.
10025 * @cancellable: (allow-none): A #GCancellable or %NULL.
10026 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
10027 * @user_data: User data to pass to @callback.
10028 *
10029 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Process.stop">stop()</link> D-Bus method on @proxy.
10030 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
10031 * You can then call process_call_stop_finish() to get the result of the operation.
10032 *
10033 * See process_call_stop_sync() for the synchronous, blocking version of this method.
10034 */
10035void
10036process_call_stop (
10037 Process *proxy,
10038 GCancellable *cancellable,
10039 GAsyncReadyCallback callback,
10040 gpointer user_data)
10041{
10042 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
10043 "stop",
10044 g_variant_new ("()"),
10045 G_DBUS_CALL_FLAGS_NONE,
10046 -1,
10047 cancellable,
10048 callback,
10049 user_data);
10050}
10051
10052/**
10053 * process_call_stop_finish:
10054 * @proxy: A #ProcessProxy.
10055 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to process_call_stop().
10056 * @error: Return location for error or %NULL.
10057 *
10058 * Finishes an operation started with process_call_stop().
10059 *
10060 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
10061 */
10062gboolean
10063process_call_stop_finish (
10064 Process *proxy,
10065 GAsyncResult *res,
10066 GError **error)
10067{
10068 GVariant *_ret;
10069 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
10070 if (_ret == NULL)
10071 goto _out;
10072 g_variant_get (_ret,
10073 "()");
10074 g_variant_unref (_ret);
10075_out:
10076 return _ret != NULL;
10077}
10078
10079/**
10080 * process_call_stop_sync:
10081 * @proxy: A #ProcessProxy.
10082 * @cancellable: (allow-none): A #GCancellable or %NULL.
10083 * @error: Return location for error or %NULL.
10084 *
10085 * 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.
10086 *
10087 * See process_call_stop() for the asynchronous version of this method.
10088 *
10089 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
10090 */
10091gboolean
10092process_call_stop_sync (
10093 Process *proxy,
10094 GCancellable *cancellable,
10095 GError **error)
10096{
10097 GVariant *_ret;
10098 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
10099 "stop",
10100 g_variant_new ("()"),
10101 G_DBUS_CALL_FLAGS_NONE,
10102 -1,
10103 cancellable,
10104 error);
10105 if (_ret == NULL)
10106 goto _out;
10107 g_variant_get (_ret,
10108 "()");
10109 g_variant_unref (_ret);
10110_out:
10111 return _ret != NULL;
10112}
10113
10114/**
10115 * process_complete_stop:
10116 * @object: A #Process.
10117 * @invocation: (transfer full): A #GDBusMethodInvocation.
10118 *
10119 * 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.
10120 *
10121 * This method will free @invocation, you cannot use it afterwards.
10122 */
10123void
10124process_complete_stop (
10125 Process *object,
10126 GDBusMethodInvocation *invocation)
10127{
10128 g_dbus_method_invocation_return_value (invocation,
10129 g_variant_new ("()"));
10130}
10131
10132/* ------------------------------------------------------------------------ */
10133
10134/**
10135 * ProcessProxy:
10136 *
10137 * The #ProcessProxy structure contains only private data and should only be accessed using the provided API.
10138 */
10139
10140/**
10141 * ProcessProxyClass:
10142 * @parent_class: The parent class.
10143 *
10144 * Class structure for #ProcessProxy.
10145 */
10146
10147struct _ProcessProxyPrivate
10148{
10149 GData *qdata;
10150};
10151
10152static void process_proxy_iface_init (ProcessIface *iface);
10153
10154#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
10155G_DEFINE_TYPE_WITH_CODE (ProcessProxy, process_proxy, G_TYPE_DBUS_PROXY,
10156 G_ADD_PRIVATE (ProcessProxy)
10157 G_IMPLEMENT_INTERFACE (TYPE_PROCESS, process_proxy_iface_init));
10158
10159#else
10160G_DEFINE_TYPE_WITH_CODE (ProcessProxy, process_proxy, G_TYPE_DBUS_PROXY,
10161 G_IMPLEMENT_INTERFACE (TYPE_PROCESS, process_proxy_iface_init));
10162
10163#endif
10164static void
10165process_proxy_finalize (GObject *object)
10166{
10167 ProcessProxy *proxy = PROCESS_PROXY (object);
10168 g_datalist_clear (&proxy->priv->qdata);
10169 G_OBJECT_CLASS (process_proxy_parent_class)->finalize (object);
10170}
10171
10172static void
10173process_proxy_get_property (GObject *object,
10174 guint prop_id,
10175 GValue *value,
10176 GParamSpec *pspec G_GNUC_UNUSED)
10177{
10178}
10179
10180static void
10181process_proxy_set_property (GObject *object,
10182 guint prop_id,
10183 const GValue *value,
10184 GParamSpec *pspec G_GNUC_UNUSED)
10185{
10186}
10187
10188static void
10189process_proxy_g_signal (GDBusProxy *proxy,
10190 const gchar *sender_name G_GNUC_UNUSED,
10191 const gchar *signal_name,
10192 GVariant *parameters)
10193{
10194 _ExtendedGDBusSignalInfo *info;
10195 GVariantIter iter;
10196 GVariant *child;
10197 GValue *paramv;
10198 guint num_params;
10199 guint n;
10200 guint signal_id;
10201 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, signal_name);
10202 if (info == NULL)
10203 return;
10204 num_params = g_variant_n_children (parameters);
10205 paramv = g_new0 (GValue, num_params + 1);
10206 g_value_init (&paramv[0], TYPE_PROCESS);
10207 g_value_set_object (&paramv[0], proxy);
10208 g_variant_iter_init (&iter, parameters);
10209 n = 1;
10210 while ((child = g_variant_iter_next_value (&iter)) != NULL)
10211 {
10212 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
10213 if (arg_info->use_gvariant)
10214 {
10215 g_value_init (&paramv[n], G_TYPE_VARIANT);
10216 g_value_set_variant (&paramv[n], child);
10217 n++;
10218 }
10219 else
10220 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
10221 g_variant_unref (child);
10222 }
10223 signal_id = g_signal_lookup (info->signal_name, TYPE_PROCESS);
10224 g_signal_emitv (paramv, signal_id, 0, NULL);
10225 for (n = 0; n < num_params + 1; n++)
10226 g_value_unset (&paramv[n]);
10227 g_free (paramv);
10228}
10229
10230static void
10231process_proxy_g_properties_changed (GDBusProxy *_proxy,
10232 GVariant *changed_properties,
10233 const gchar *const *invalidated_properties)
10234{
10235 ProcessProxy *proxy = PROCESS_PROXY (_proxy);
10236 guint n;
10237 const gchar *key;
10238 GVariantIter *iter;
10239 _ExtendedGDBusPropertyInfo *info;
10240 g_variant_get (changed_properties, "a{sv}", &iter);
10241 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
10242 {
10243 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, key);
10244 g_datalist_remove_data (&proxy->priv->qdata, key);
10245 if (info != NULL)
10246 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
10247 }
10248 g_variant_iter_free (iter);
10249 for (n = 0; invalidated_properties[n] != NULL; n++)
10250 {
10251 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, invalidated_properties[n]);
10252 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
10253 if (info != NULL)
10254 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
10255 }
10256}
10257
10258static void
10259process_proxy_init (ProcessProxy *proxy)
10260{
10261#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
10262 proxy->priv = process_proxy_get_instance_private (proxy);
10263#else
10264 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_PROCESS_PROXY, ProcessProxyPrivate);
10265#endif
10266
10267 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), process_interface_info ());
10268}
10269
10270static void
10271process_proxy_class_init (ProcessProxyClass *klass)
10272{
10273 GObjectClass *gobject_class;
10274 GDBusProxyClass *proxy_class;
10275
10276 gobject_class = G_OBJECT_CLASS (klass);
10277 gobject_class->finalize = process_proxy_finalize;
10278 gobject_class->get_property = process_proxy_get_property;
10279 gobject_class->set_property = process_proxy_set_property;
10280
10281 proxy_class = G_DBUS_PROXY_CLASS (klass);
10282 proxy_class->g_signal = process_proxy_g_signal;
10283 proxy_class->g_properties_changed = process_proxy_g_properties_changed;
10284
10285#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
10286 g_type_class_add_private (klass, sizeof (ProcessProxyPrivate));
10287#endif
10288}
10289
10290static void
10291process_proxy_iface_init (ProcessIface *iface)
10292{
10293}
10294
10295/**
10296 * process_proxy_new:
10297 * @connection: A #GDBusConnection.
10298 * @flags: Flags from the #GDBusProxyFlags enumeration.
10299 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
10300 * @object_path: An object path.
10301 * @cancellable: (allow-none): A #GCancellable or %NULL.
10302 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
10303 * @user_data: User data to pass to @callback.
10304 *
10305 * 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.
10306 *
10307 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
10308 * You can then call process_proxy_new_finish() to get the result of the operation.
10309 *
10310 * See process_proxy_new_sync() for the synchronous, blocking version of this constructor.
10311 */
10312void
10313process_proxy_new (
10314 GDBusConnection *connection,
10315 GDBusProxyFlags flags,
10316 const gchar *name,
10317 const gchar *object_path,
10318 GCancellable *cancellable,
10319 GAsyncReadyCallback callback,
10320 gpointer user_data)
10321{
10322 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);
10323}
10324
10325/**
10326 * process_proxy_new_finish:
10327 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to process_proxy_new().
10328 * @error: Return location for error or %NULL
10329 *
10330 * Finishes an operation started with process_proxy_new().
10331 *
10332 * Returns: (transfer full) (type ProcessProxy): The constructed proxy object or %NULL if @error is set.
10333 */
10334Process *
10335process_proxy_new_finish (
10336 GAsyncResult *res,
10337 GError **error)
10338{
10339 GObject *ret;
10340 GObject *source_object;
10341 source_object = g_async_result_get_source_object (res);
10342 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
10343 g_object_unref (source_object);
10344 if (ret != NULL)
10345 return PROCESS (ret);
10346 else
10347 return NULL;
10348}
10349
10350/**
10351 * process_proxy_new_sync:
10352 * @connection: A #GDBusConnection.
10353 * @flags: Flags from the #GDBusProxyFlags enumeration.
10354 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
10355 * @object_path: An object path.
10356 * @cancellable: (allow-none): A #GCancellable or %NULL.
10357 * @error: Return location for error or %NULL
10358 *
10359 * 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.
10360 *
10361 * The calling thread is blocked until a reply is received.
10362 *
10363 * See process_proxy_new() for the asynchronous version of this constructor.
10364 *
10365 * Returns: (transfer full) (type ProcessProxy): The constructed proxy object or %NULL if @error is set.
10366 */
10367Process *
10368process_proxy_new_sync (
10369 GDBusConnection *connection,
10370 GDBusProxyFlags flags,
10371 const gchar *name,
10372 const gchar *object_path,
10373 GCancellable *cancellable,
10374 GError **error)
10375{
10376 GInitable *ret;
10377 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);
10378 if (ret != NULL)
10379 return PROCESS (ret);
10380 else
10381 return NULL;
10382}
10383
10384
10385/**
10386 * process_proxy_new_for_bus:
10387 * @bus_type: A #GBusType.
10388 * @flags: Flags from the #GDBusProxyFlags enumeration.
10389 * @name: A bus name (well-known or unique).
10390 * @object_path: An object path.
10391 * @cancellable: (allow-none): A #GCancellable or %NULL.
10392 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
10393 * @user_data: User data to pass to @callback.
10394 *
10395 * Like process_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
10396 *
10397 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
10398 * You can then call process_proxy_new_for_bus_finish() to get the result of the operation.
10399 *
10400 * See process_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
10401 */
10402void
10403process_proxy_new_for_bus (
10404 GBusType bus_type,
10405 GDBusProxyFlags flags,
10406 const gchar *name,
10407 const gchar *object_path,
10408 GCancellable *cancellable,
10409 GAsyncReadyCallback callback,
10410 gpointer user_data)
10411{
10412 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);
10413}
10414
10415/**
10416 * process_proxy_new_for_bus_finish:
10417 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to process_proxy_new_for_bus().
10418 * @error: Return location for error or %NULL
10419 *
10420 * Finishes an operation started with process_proxy_new_for_bus().
10421 *
10422 * Returns: (transfer full) (type ProcessProxy): The constructed proxy object or %NULL if @error is set.
10423 */
10424Process *
10425process_proxy_new_for_bus_finish (
10426 GAsyncResult *res,
10427 GError **error)
10428{
10429 GObject *ret;
10430 GObject *source_object;
10431 source_object = g_async_result_get_source_object (res);
10432 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
10433 g_object_unref (source_object);
10434 if (ret != NULL)
10435 return PROCESS (ret);
10436 else
10437 return NULL;
10438}
10439
10440/**
10441 * process_proxy_new_for_bus_sync:
10442 * @bus_type: A #GBusType.
10443 * @flags: Flags from the #GDBusProxyFlags enumeration.
10444 * @name: A bus name (well-known or unique).
10445 * @object_path: An object path.
10446 * @cancellable: (allow-none): A #GCancellable or %NULL.
10447 * @error: Return location for error or %NULL
10448 *
10449 * Like process_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
10450 *
10451 * The calling thread is blocked until a reply is received.
10452 *
10453 * See process_proxy_new_for_bus() for the asynchronous version of this constructor.
10454 *
10455 * Returns: (transfer full) (type ProcessProxy): The constructed proxy object or %NULL if @error is set.
10456 */
10457Process *
10458process_proxy_new_for_bus_sync (
10459 GBusType bus_type,
10460 GDBusProxyFlags flags,
10461 const gchar *name,
10462 const gchar *object_path,
10463 GCancellable *cancellable,
10464 GError **error)
10465{
10466 GInitable *ret;
10467 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);
10468 if (ret != NULL)
10469 return PROCESS (ret);
10470 else
10471 return NULL;
10472}
10473
10474
10475/* ------------------------------------------------------------------------ */
10476
10477/**
10478 * ProcessSkeleton:
10479 *
10480 * The #ProcessSkeleton structure contains only private data and should only be accessed using the provided API.
10481 */
10482
10483/**
10484 * ProcessSkeletonClass:
10485 * @parent_class: The parent class.
10486 *
10487 * Class structure for #ProcessSkeleton.
10488 */
10489
10490struct _ProcessSkeletonPrivate
10491{
10492 GValue *properties;
10493 GList *changed_properties;
10494 GSource *changed_properties_idle_source;
10495 GMainContext *context;
10496 GMutex lock;
10497};
10498
10499static void
10500_process_skeleton_handle_method_call (
10501 GDBusConnection *connection G_GNUC_UNUSED,
10502 const gchar *sender G_GNUC_UNUSED,
10503 const gchar *object_path G_GNUC_UNUSED,
10504 const gchar *interface_name,
10505 const gchar *method_name,
10506 GVariant *parameters,
10507 GDBusMethodInvocation *invocation,
10508 gpointer user_data)
10509{
10510 ProcessSkeleton *skeleton = PROCESS_SKELETON (user_data);
10511 _ExtendedGDBusMethodInfo *info;
10512 GVariantIter iter;
10513 GVariant *child;
10514 GValue *paramv;
10515 guint num_params;
10516 guint num_extra;
10517 guint n;
10518 guint signal_id;
10519 GValue return_value = G_VALUE_INIT;
10520 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
10521 g_assert (info != NULL);
10522 num_params = g_variant_n_children (parameters);
10523 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
10524 n = 0;
10525 g_value_init (&paramv[n], TYPE_PROCESS);
10526 g_value_set_object (&paramv[n++], skeleton);
10527 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
10528 g_value_set_object (&paramv[n++], invocation);
10529 if (info->pass_fdlist)
10530 {
10531#ifdef G_OS_UNIX
10532 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
10533 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
10534#else
10535 g_assert_not_reached ();
10536#endif
10537 }
10538 g_variant_iter_init (&iter, parameters);
10539 while ((child = g_variant_iter_next_value (&iter)) != NULL)
10540 {
10541 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
10542 if (arg_info->use_gvariant)
10543 {
10544 g_value_init (&paramv[n], G_TYPE_VARIANT);
10545 g_value_set_variant (&paramv[n], child);
10546 n++;
10547 }
10548 else
10549 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
10550 g_variant_unref (child);
10551 }
10552 signal_id = g_signal_lookup (info->signal_name, TYPE_PROCESS);
10553 g_value_init (&return_value, G_TYPE_BOOLEAN);
10554 g_signal_emitv (paramv, signal_id, 0, &return_value);
10555 if (!g_value_get_boolean (&return_value))
10556 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);
10557 g_value_unset (&return_value);
10558 for (n = 0; n < num_params + num_extra; n++)
10559 g_value_unset (&paramv[n]);
10560 g_free (paramv);
10561}
10562
10563static GVariant *
10564_process_skeleton_handle_get_property (
10565 GDBusConnection *connection G_GNUC_UNUSED,
10566 const gchar *sender G_GNUC_UNUSED,
10567 const gchar *object_path G_GNUC_UNUSED,
10568 const gchar *interface_name G_GNUC_UNUSED,
10569 const gchar *property_name,
10570 GError **error,
10571 gpointer user_data)
10572{
10573 ProcessSkeleton *skeleton = PROCESS_SKELETON (user_data);
10574 GValue value = G_VALUE_INIT;
10575 GParamSpec *pspec;
10576 _ExtendedGDBusPropertyInfo *info;
10577 GVariant *ret;
10578 ret = NULL;
10579 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, property_name);
10580 g_assert (info != NULL);
10581 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
10582 if (pspec == NULL)
10583 {
10584 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
10585 }
10586 else
10587 {
10588 g_value_init (&value, pspec->value_type);
10589 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
10590 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
10591 g_value_unset (&value);
10592 }
10593 return ret;
10594}
10595
10596static gboolean
10597_process_skeleton_handle_set_property (
10598 GDBusConnection *connection G_GNUC_UNUSED,
10599 const gchar *sender G_GNUC_UNUSED,
10600 const gchar *object_path G_GNUC_UNUSED,
10601 const gchar *interface_name G_GNUC_UNUSED,
10602 const gchar *property_name,
10603 GVariant *variant,
10604 GError **error,
10605 gpointer user_data)
10606{
10607 ProcessSkeleton *skeleton = PROCESS_SKELETON (user_data);
10608 GValue value = G_VALUE_INIT;
10609 GParamSpec *pspec;
10610 _ExtendedGDBusPropertyInfo *info;
10611 gboolean ret;
10612 ret = FALSE;
10613 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_process_interface_info.parent_struct, property_name);
10614 g_assert (info != NULL);
10615 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
10616 if (pspec == NULL)
10617 {
10618 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
10619 }
10620 else
10621 {
10622 if (info->use_gvariant)
10623 g_value_set_variant (&value, variant);
10624 else
10625 g_dbus_gvariant_to_gvalue (variant, &value);
10626 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
10627 g_value_unset (&value);
10628 ret = TRUE;
10629 }
10630 return ret;
10631}
10632
10633static const GDBusInterfaceVTable _process_skeleton_vtable =
10634{
10635 _process_skeleton_handle_method_call,
10636 _process_skeleton_handle_get_property,
10637 _process_skeleton_handle_set_property,
10638 {NULL}
10639};
10640
10641static GDBusInterfaceInfo *
10642process_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
10643{
10644 return process_interface_info ();
10645}
10646
10647static GDBusInterfaceVTable *
10648process_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
10649{
10650 return (GDBusInterfaceVTable *) &_process_skeleton_vtable;
10651}
10652
10653static GVariant *
10654process_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
10655{
10656 ProcessSkeleton *skeleton = PROCESS_SKELETON (_skeleton);
10657
10658 GVariantBuilder builder;
10659 guint n;
10660 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
10661 if (_process_interface_info.parent_struct.properties == NULL)
10662 goto out;
10663 for (n = 0; _process_interface_info.parent_struct.properties[n] != NULL; n++)
10664 {
10665 GDBusPropertyInfo *info = _process_interface_info.parent_struct.properties[n];
10666 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
10667 {
10668 GVariant *value;
10669 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);
10670 if (value != NULL)
10671 {
10672 g_variant_take_ref (value);
10673 g_variant_builder_add (&builder, "{sv}", info->name, value);
10674 g_variant_unref (value);
10675 }
10676 }
10677 }
10678out:
10679 return g_variant_builder_end (&builder);
10680}
10681
10682static void
10683process_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
10684{
10685}
10686
10687static void process_skeleton_iface_init (ProcessIface *iface);
10688#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
10689G_DEFINE_TYPE_WITH_CODE (ProcessSkeleton, process_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
10690 G_ADD_PRIVATE (ProcessSkeleton)
10691 G_IMPLEMENT_INTERFACE (TYPE_PROCESS, process_skeleton_iface_init));
10692
10693#else
10694G_DEFINE_TYPE_WITH_CODE (ProcessSkeleton, process_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
10695 G_IMPLEMENT_INTERFACE (TYPE_PROCESS, process_skeleton_iface_init));
10696
10697#endif
10698static void
10699process_skeleton_finalize (GObject *object)
10700{
10701 ProcessSkeleton *skeleton = PROCESS_SKELETON (object);
10702 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
10703 if (skeleton->priv->changed_properties_idle_source != NULL)
10704 g_source_destroy (skeleton->priv->changed_properties_idle_source);
10705 g_main_context_unref (skeleton->priv->context);
10706 g_mutex_clear (&skeleton->priv->lock);
10707 G_OBJECT_CLASS (process_skeleton_parent_class)->finalize (object);
10708}
10709
10710static void
10711process_skeleton_init (ProcessSkeleton *skeleton)
10712{
10713#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
10714 skeleton->priv = process_skeleton_get_instance_private (skeleton);
10715#else
10716 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_PROCESS_SKELETON, ProcessSkeletonPrivate);
10717#endif
10718
10719 g_mutex_init (&skeleton->priv->lock);
10720 skeleton->priv->context = g_main_context_ref_thread_default ();
10721}
10722
10723static void
10724process_skeleton_class_init (ProcessSkeletonClass *klass)
10725{
10726 GObjectClass *gobject_class;
10727 GDBusInterfaceSkeletonClass *skeleton_class;
10728
10729 gobject_class = G_OBJECT_CLASS (klass);
10730 gobject_class->finalize = process_skeleton_finalize;
10731
10732 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
10733 skeleton_class->get_info = process_skeleton_dbus_interface_get_info;
10734 skeleton_class->get_properties = process_skeleton_dbus_interface_get_properties;
10735 skeleton_class->flush = process_skeleton_dbus_interface_flush;
10736 skeleton_class->get_vtable = process_skeleton_dbus_interface_get_vtable;
10737
10738#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
10739 g_type_class_add_private (klass, sizeof (ProcessSkeletonPrivate));
10740#endif
10741}
10742
10743static void
10744process_skeleton_iface_init (ProcessIface *iface)
10745{
10746}
10747
10748/**
10749 * process_skeleton_new:
10750 *
10751 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Process.top_of_page">org.openbmc.Process</link>.
10752 *
10753 * Returns: (transfer full) (type ProcessSkeleton): The skeleton object.
10754 */
10755Process *
10756process_skeleton_new (void)
10757{
10758 return PROCESS (g_object_new (TYPE_PROCESS_SKELETON, NULL));
10759}
10760
10761/* ------------------------------------------------------------------------
Norman James18998182015-10-11 21:54:53 -050010762 * Code for interface org.openbmc.SharedResource
10763 * ------------------------------------------------------------------------
10764 */
10765
10766/**
10767 * SECTION:SharedResource
10768 * @title: SharedResource
10769 * @short_description: Generated C code for the org.openbmc.SharedResource D-Bus interface
10770 *
10771 * 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.
10772 */
10773
10774/* ---- Introspection data for org.openbmc.SharedResource ---- */
10775
10776static const _ExtendedGDBusArgInfo _shared_resource_method_info_lock_IN_ARG_name =
10777{
10778 {
10779 -1,
10780 (gchar *) "name",
10781 (gchar *) "s",
10782 NULL
10783 },
10784 FALSE
10785};
10786
10787static const _ExtendedGDBusArgInfo * const _shared_resource_method_info_lock_IN_ARG_pointers[] =
10788{
10789 &_shared_resource_method_info_lock_IN_ARG_name,
10790 NULL
10791};
10792
10793static const _ExtendedGDBusMethodInfo _shared_resource_method_info_lock =
10794{
10795 {
10796 -1,
10797 (gchar *) "lock",
10798 (GDBusArgInfo **) &_shared_resource_method_info_lock_IN_ARG_pointers,
10799 NULL,
10800 NULL
10801 },
10802 "handle-lock",
10803 FALSE
10804};
10805
10806static const _ExtendedGDBusMethodInfo _shared_resource_method_info_unlock =
10807{
10808 {
10809 -1,
10810 (gchar *) "unlock",
10811 NULL,
10812 NULL,
10813 NULL
10814 },
10815 "handle-unlock",
10816 FALSE
10817};
10818
10819static const _ExtendedGDBusArgInfo _shared_resource_method_info_is_locked_OUT_ARG_lock =
10820{
10821 {
10822 -1,
10823 (gchar *) "lock",
10824 (gchar *) "b",
10825 NULL
10826 },
10827 FALSE
10828};
10829
10830static const _ExtendedGDBusArgInfo _shared_resource_method_info_is_locked_OUT_ARG_name =
10831{
10832 {
10833 -1,
10834 (gchar *) "name",
10835 (gchar *) "s",
10836 NULL
10837 },
10838 FALSE
10839};
10840
10841static const _ExtendedGDBusArgInfo * const _shared_resource_method_info_is_locked_OUT_ARG_pointers[] =
10842{
10843 &_shared_resource_method_info_is_locked_OUT_ARG_lock,
10844 &_shared_resource_method_info_is_locked_OUT_ARG_name,
10845 NULL
10846};
10847
10848static const _ExtendedGDBusMethodInfo _shared_resource_method_info_is_locked =
10849{
10850 {
10851 -1,
10852 (gchar *) "isLocked",
10853 NULL,
10854 (GDBusArgInfo **) &_shared_resource_method_info_is_locked_OUT_ARG_pointers,
10855 NULL
10856 },
10857 "handle-is-locked",
10858 FALSE
10859};
10860
10861static const _ExtendedGDBusMethodInfo * const _shared_resource_method_info_pointers[] =
10862{
10863 &_shared_resource_method_info_lock,
10864 &_shared_resource_method_info_unlock,
10865 &_shared_resource_method_info_is_locked,
10866 NULL
10867};
10868
10869static const _ExtendedGDBusPropertyInfo _shared_resource_property_info_lock =
10870{
10871 {
10872 -1,
10873 (gchar *) "lock",
10874 (gchar *) "b",
10875 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
10876 NULL
10877 },
10878 "lock",
10879 FALSE
10880};
10881
10882static const _ExtendedGDBusPropertyInfo _shared_resource_property_info_name =
10883{
10884 {
10885 -1,
10886 (gchar *) "name",
10887 (gchar *) "s",
10888 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
10889 NULL
10890 },
10891 "name",
10892 FALSE
10893};
10894
10895static const _ExtendedGDBusPropertyInfo * const _shared_resource_property_info_pointers[] =
10896{
10897 &_shared_resource_property_info_lock,
10898 &_shared_resource_property_info_name,
10899 NULL
10900};
10901
10902static const _ExtendedGDBusInterfaceInfo _shared_resource_interface_info =
10903{
10904 {
10905 -1,
10906 (gchar *) "org.openbmc.SharedResource",
10907 (GDBusMethodInfo **) &_shared_resource_method_info_pointers,
10908 NULL,
10909 (GDBusPropertyInfo **) &_shared_resource_property_info_pointers,
10910 NULL
10911 },
10912 "shared-resource",
10913};
10914
10915
10916/**
10917 * shared_resource_interface_info:
10918 *
10919 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link> D-Bus interface.
10920 *
10921 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
10922 */
10923GDBusInterfaceInfo *
10924shared_resource_interface_info (void)
10925{
10926 return (GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct;
10927}
10928
10929/**
10930 * shared_resource_override_properties:
10931 * @klass: The class structure for a #GObject<!-- -->-derived class.
10932 * @property_id_begin: The property id to assign to the first overridden property.
10933 *
10934 * Overrides all #GObject properties in the #SharedResource interface for a concrete class.
10935 * The properties are overridden in the order they are defined.
10936 *
10937 * Returns: The last property id.
10938 */
10939guint
10940shared_resource_override_properties (GObjectClass *klass, guint property_id_begin)
10941{
10942 g_object_class_override_property (klass, property_id_begin++, "lock");
10943 g_object_class_override_property (klass, property_id_begin++, "name");
10944 return property_id_begin - 1;
10945}
10946
10947
10948
10949/**
10950 * SharedResource:
10951 *
10952 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link>.
10953 */
10954
10955/**
10956 * SharedResourceIface:
10957 * @parent_iface: The parent interface.
10958 * @handle_is_locked: Handler for the #SharedResource::handle-is-locked signal.
10959 * @handle_lock: Handler for the #SharedResource::handle-lock signal.
10960 * @handle_unlock: Handler for the #SharedResource::handle-unlock signal.
10961 * @get_lock: Getter for the #SharedResource:lock property.
10962 * @get_name: Getter for the #SharedResource:name property.
10963 *
10964 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link>.
10965 */
10966
10967typedef SharedResourceIface SharedResourceInterface;
10968G_DEFINE_INTERFACE (SharedResource, shared_resource, G_TYPE_OBJECT);
10969
10970static void
10971shared_resource_default_init (SharedResourceIface *iface)
10972{
10973 /* GObject signals for incoming D-Bus method calls: */
10974 /**
10975 * SharedResource::handle-lock:
10976 * @object: A #SharedResource.
10977 * @invocation: A #GDBusMethodInvocation.
10978 * @arg_name: Argument passed by remote caller.
10979 *
10980 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SharedResource.lock">lock()</link> D-Bus method.
10981 *
10982 * 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.
10983 *
10984 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
10985 */
10986 g_signal_new ("handle-lock",
10987 G_TYPE_FROM_INTERFACE (iface),
10988 G_SIGNAL_RUN_LAST,
10989 G_STRUCT_OFFSET (SharedResourceIface, handle_lock),
10990 g_signal_accumulator_true_handled,
10991 NULL,
10992 g_cclosure_marshal_generic,
10993 G_TYPE_BOOLEAN,
10994 2,
10995 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING);
10996
10997 /**
10998 * SharedResource::handle-unlock:
10999 * @object: A #SharedResource.
11000 * @invocation: A #GDBusMethodInvocation.
11001 *
11002 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SharedResource.unlock">unlock()</link> D-Bus method.
11003 *
11004 * 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.
11005 *
11006 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
11007 */
11008 g_signal_new ("handle-unlock",
11009 G_TYPE_FROM_INTERFACE (iface),
11010 G_SIGNAL_RUN_LAST,
11011 G_STRUCT_OFFSET (SharedResourceIface, handle_unlock),
11012 g_signal_accumulator_true_handled,
11013 NULL,
11014 g_cclosure_marshal_generic,
11015 G_TYPE_BOOLEAN,
11016 1,
11017 G_TYPE_DBUS_METHOD_INVOCATION);
11018
11019 /**
11020 * SharedResource::handle-is-locked:
11021 * @object: A #SharedResource.
11022 * @invocation: A #GDBusMethodInvocation.
11023 *
11024 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-SharedResource.isLocked">isLocked()</link> D-Bus method.
11025 *
11026 * 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.
11027 *
11028 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
11029 */
11030 g_signal_new ("handle-is-locked",
11031 G_TYPE_FROM_INTERFACE (iface),
11032 G_SIGNAL_RUN_LAST,
11033 G_STRUCT_OFFSET (SharedResourceIface, handle_is_locked),
11034 g_signal_accumulator_true_handled,
11035 NULL,
11036 g_cclosure_marshal_generic,
11037 G_TYPE_BOOLEAN,
11038 1,
11039 G_TYPE_DBUS_METHOD_INVOCATION);
11040
11041 /* GObject properties for D-Bus properties: */
11042 /**
11043 * SharedResource:lock:
11044 *
11045 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SharedResource.lock">"lock"</link>.
11046 *
11047 * 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.
11048 */
11049 g_object_interface_install_property (iface,
11050 g_param_spec_boolean ("lock", "lock", "lock", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
11051 /**
11052 * SharedResource:name:
11053 *
11054 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-SharedResource.name">"name"</link>.
11055 *
11056 * 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.
11057 */
11058 g_object_interface_install_property (iface,
11059 g_param_spec_string ("name", "name", "name", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
11060}
11061
11062/**
11063 * shared_resource_get_lock: (skip)
11064 * @object: A #SharedResource.
11065 *
11066 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SharedResource.lock">"lock"</link> D-Bus property.
11067 *
11068 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
11069 *
11070 * Returns: The property value.
11071 */
11072gboolean
11073shared_resource_get_lock (SharedResource *object)
11074{
11075 return SHARED_RESOURCE_GET_IFACE (object)->get_lock (object);
11076}
11077
11078/**
11079 * shared_resource_set_lock: (skip)
11080 * @object: A #SharedResource.
11081 * @value: The value to set.
11082 *
11083 * Sets the <link linkend="gdbus-property-org-openbmc-SharedResource.lock">"lock"</link> D-Bus property to @value.
11084 *
11085 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
11086 */
11087void
11088shared_resource_set_lock (SharedResource *object, gboolean value)
11089{
11090 g_object_set (G_OBJECT (object), "lock", value, NULL);
11091}
11092
11093/**
11094 * shared_resource_get_name: (skip)
11095 * @object: A #SharedResource.
11096 *
11097 * Gets the value of the <link linkend="gdbus-property-org-openbmc-SharedResource.name">"name"</link> D-Bus property.
11098 *
11099 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
11100 *
11101 * <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>
11102 *
11103 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
11104 */
11105const gchar *
11106shared_resource_get_name (SharedResource *object)
11107{
11108 return SHARED_RESOURCE_GET_IFACE (object)->get_name (object);
11109}
11110
11111/**
11112 * shared_resource_dup_name: (skip)
11113 * @object: A #SharedResource.
11114 *
11115 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-SharedResource.name">"name"</link> D-Bus property.
11116 *
11117 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
11118 *
11119 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
11120 */
11121gchar *
11122shared_resource_dup_name (SharedResource *object)
11123{
11124 gchar *value;
11125 g_object_get (G_OBJECT (object), "name", &value, NULL);
11126 return value;
11127}
11128
11129/**
11130 * shared_resource_set_name: (skip)
11131 * @object: A #SharedResource.
11132 * @value: The value to set.
11133 *
11134 * Sets the <link linkend="gdbus-property-org-openbmc-SharedResource.name">"name"</link> D-Bus property to @value.
11135 *
11136 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
11137 */
11138void
11139shared_resource_set_name (SharedResource *object, const gchar *value)
11140{
11141 g_object_set (G_OBJECT (object), "name", value, NULL);
11142}
11143
11144/**
11145 * shared_resource_call_lock:
11146 * @proxy: A #SharedResourceProxy.
11147 * @arg_name: Argument to pass with the method invocation.
11148 * @cancellable: (allow-none): A #GCancellable or %NULL.
11149 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
11150 * @user_data: User data to pass to @callback.
11151 *
11152 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SharedResource.lock">lock()</link> D-Bus method on @proxy.
11153 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
11154 * You can then call shared_resource_call_lock_finish() to get the result of the operation.
11155 *
11156 * See shared_resource_call_lock_sync() for the synchronous, blocking version of this method.
11157 */
11158void
11159shared_resource_call_lock (
11160 SharedResource *proxy,
11161 const gchar *arg_name,
11162 GCancellable *cancellable,
11163 GAsyncReadyCallback callback,
11164 gpointer user_data)
11165{
11166 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
11167 "lock",
11168 g_variant_new ("(s)",
11169 arg_name),
11170 G_DBUS_CALL_FLAGS_NONE,
11171 -1,
11172 cancellable,
11173 callback,
11174 user_data);
11175}
11176
11177/**
11178 * shared_resource_call_lock_finish:
11179 * @proxy: A #SharedResourceProxy.
11180 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to shared_resource_call_lock().
11181 * @error: Return location for error or %NULL.
11182 *
11183 * Finishes an operation started with shared_resource_call_lock().
11184 *
11185 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
11186 */
11187gboolean
11188shared_resource_call_lock_finish (
11189 SharedResource *proxy,
11190 GAsyncResult *res,
11191 GError **error)
11192{
11193 GVariant *_ret;
11194 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
11195 if (_ret == NULL)
11196 goto _out;
11197 g_variant_get (_ret,
11198 "()");
11199 g_variant_unref (_ret);
11200_out:
11201 return _ret != NULL;
11202}
11203
11204/**
11205 * shared_resource_call_lock_sync:
11206 * @proxy: A #SharedResourceProxy.
11207 * @arg_name: Argument to pass with the method invocation.
11208 * @cancellable: (allow-none): A #GCancellable or %NULL.
11209 * @error: Return location for error or %NULL.
11210 *
11211 * 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.
11212 *
11213 * See shared_resource_call_lock() for the asynchronous version of this method.
11214 *
11215 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
11216 */
11217gboolean
11218shared_resource_call_lock_sync (
11219 SharedResource *proxy,
11220 const gchar *arg_name,
11221 GCancellable *cancellable,
11222 GError **error)
11223{
11224 GVariant *_ret;
11225 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
11226 "lock",
11227 g_variant_new ("(s)",
11228 arg_name),
11229 G_DBUS_CALL_FLAGS_NONE,
11230 -1,
11231 cancellable,
11232 error);
11233 if (_ret == NULL)
11234 goto _out;
11235 g_variant_get (_ret,
11236 "()");
11237 g_variant_unref (_ret);
11238_out:
11239 return _ret != NULL;
11240}
11241
11242/**
11243 * shared_resource_call_unlock:
11244 * @proxy: A #SharedResourceProxy.
11245 * @cancellable: (allow-none): A #GCancellable or %NULL.
11246 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
11247 * @user_data: User data to pass to @callback.
11248 *
11249 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SharedResource.unlock">unlock()</link> D-Bus method on @proxy.
11250 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
11251 * You can then call shared_resource_call_unlock_finish() to get the result of the operation.
11252 *
11253 * See shared_resource_call_unlock_sync() for the synchronous, blocking version of this method.
11254 */
11255void
11256shared_resource_call_unlock (
11257 SharedResource *proxy,
11258 GCancellable *cancellable,
11259 GAsyncReadyCallback callback,
11260 gpointer user_data)
11261{
11262 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
11263 "unlock",
11264 g_variant_new ("()"),
11265 G_DBUS_CALL_FLAGS_NONE,
11266 -1,
11267 cancellable,
11268 callback,
11269 user_data);
11270}
11271
11272/**
11273 * shared_resource_call_unlock_finish:
11274 * @proxy: A #SharedResourceProxy.
11275 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to shared_resource_call_unlock().
11276 * @error: Return location for error or %NULL.
11277 *
11278 * Finishes an operation started with shared_resource_call_unlock().
11279 *
11280 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
11281 */
11282gboolean
11283shared_resource_call_unlock_finish (
11284 SharedResource *proxy,
11285 GAsyncResult *res,
11286 GError **error)
11287{
11288 GVariant *_ret;
11289 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
11290 if (_ret == NULL)
11291 goto _out;
11292 g_variant_get (_ret,
11293 "()");
11294 g_variant_unref (_ret);
11295_out:
11296 return _ret != NULL;
11297}
11298
11299/**
11300 * shared_resource_call_unlock_sync:
11301 * @proxy: A #SharedResourceProxy.
11302 * @cancellable: (allow-none): A #GCancellable or %NULL.
11303 * @error: Return location for error or %NULL.
11304 *
11305 * 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.
11306 *
11307 * See shared_resource_call_unlock() for the asynchronous version of this method.
11308 *
11309 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
11310 */
11311gboolean
11312shared_resource_call_unlock_sync (
11313 SharedResource *proxy,
11314 GCancellable *cancellable,
11315 GError **error)
11316{
11317 GVariant *_ret;
11318 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
11319 "unlock",
11320 g_variant_new ("()"),
11321 G_DBUS_CALL_FLAGS_NONE,
11322 -1,
11323 cancellable,
11324 error);
11325 if (_ret == NULL)
11326 goto _out;
11327 g_variant_get (_ret,
11328 "()");
11329 g_variant_unref (_ret);
11330_out:
11331 return _ret != NULL;
11332}
11333
11334/**
11335 * shared_resource_call_is_locked:
11336 * @proxy: A #SharedResourceProxy.
11337 * @cancellable: (allow-none): A #GCancellable or %NULL.
11338 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
11339 * @user_data: User data to pass to @callback.
11340 *
11341 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-SharedResource.isLocked">isLocked()</link> D-Bus method on @proxy.
11342 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
11343 * You can then call shared_resource_call_is_locked_finish() to get the result of the operation.
11344 *
11345 * See shared_resource_call_is_locked_sync() for the synchronous, blocking version of this method.
11346 */
11347void
11348shared_resource_call_is_locked (
11349 SharedResource *proxy,
11350 GCancellable *cancellable,
11351 GAsyncReadyCallback callback,
11352 gpointer user_data)
11353{
11354 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
11355 "isLocked",
11356 g_variant_new ("()"),
11357 G_DBUS_CALL_FLAGS_NONE,
11358 -1,
11359 cancellable,
11360 callback,
11361 user_data);
11362}
11363
11364/**
11365 * shared_resource_call_is_locked_finish:
11366 * @proxy: A #SharedResourceProxy.
11367 * @out_lock: (out): Return location for return parameter or %NULL to ignore.
11368 * @out_name: (out): Return location for return parameter or %NULL to ignore.
11369 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to shared_resource_call_is_locked().
11370 * @error: Return location for error or %NULL.
11371 *
11372 * Finishes an operation started with shared_resource_call_is_locked().
11373 *
11374 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
11375 */
11376gboolean
11377shared_resource_call_is_locked_finish (
11378 SharedResource *proxy,
11379 gboolean *out_lock,
11380 gchar **out_name,
11381 GAsyncResult *res,
11382 GError **error)
11383{
11384 GVariant *_ret;
11385 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
11386 if (_ret == NULL)
11387 goto _out;
11388 g_variant_get (_ret,
11389 "(bs)",
11390 out_lock,
11391 out_name);
11392 g_variant_unref (_ret);
11393_out:
11394 return _ret != NULL;
11395}
11396
11397/**
11398 * shared_resource_call_is_locked_sync:
11399 * @proxy: A #SharedResourceProxy.
11400 * @out_lock: (out): Return location for return parameter or %NULL to ignore.
11401 * @out_name: (out): Return location for return parameter or %NULL to ignore.
11402 * @cancellable: (allow-none): A #GCancellable or %NULL.
11403 * @error: Return location for error or %NULL.
11404 *
11405 * 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.
11406 *
11407 * See shared_resource_call_is_locked() for the asynchronous version of this method.
11408 *
11409 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
11410 */
11411gboolean
11412shared_resource_call_is_locked_sync (
11413 SharedResource *proxy,
11414 gboolean *out_lock,
11415 gchar **out_name,
11416 GCancellable *cancellable,
11417 GError **error)
11418{
11419 GVariant *_ret;
11420 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
11421 "isLocked",
11422 g_variant_new ("()"),
11423 G_DBUS_CALL_FLAGS_NONE,
11424 -1,
11425 cancellable,
11426 error);
11427 if (_ret == NULL)
11428 goto _out;
11429 g_variant_get (_ret,
11430 "(bs)",
11431 out_lock,
11432 out_name);
11433 g_variant_unref (_ret);
11434_out:
11435 return _ret != NULL;
11436}
11437
11438/**
11439 * shared_resource_complete_lock:
11440 * @object: A #SharedResource.
11441 * @invocation: (transfer full): A #GDBusMethodInvocation.
11442 *
11443 * 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.
11444 *
11445 * This method will free @invocation, you cannot use it afterwards.
11446 */
11447void
11448shared_resource_complete_lock (
11449 SharedResource *object,
11450 GDBusMethodInvocation *invocation)
11451{
11452 g_dbus_method_invocation_return_value (invocation,
11453 g_variant_new ("()"));
11454}
11455
11456/**
11457 * shared_resource_complete_unlock:
11458 * @object: A #SharedResource.
11459 * @invocation: (transfer full): A #GDBusMethodInvocation.
11460 *
11461 * 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.
11462 *
11463 * This method will free @invocation, you cannot use it afterwards.
11464 */
11465void
11466shared_resource_complete_unlock (
11467 SharedResource *object,
11468 GDBusMethodInvocation *invocation)
11469{
11470 g_dbus_method_invocation_return_value (invocation,
11471 g_variant_new ("()"));
11472}
11473
11474/**
11475 * shared_resource_complete_is_locked:
11476 * @object: A #SharedResource.
11477 * @invocation: (transfer full): A #GDBusMethodInvocation.
11478 * @lock: Parameter to return.
11479 * @name: Parameter to return.
11480 *
11481 * 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.
11482 *
11483 * This method will free @invocation, you cannot use it afterwards.
11484 */
11485void
11486shared_resource_complete_is_locked (
11487 SharedResource *object,
11488 GDBusMethodInvocation *invocation,
11489 gboolean lock,
11490 const gchar *name)
11491{
11492 g_dbus_method_invocation_return_value (invocation,
11493 g_variant_new ("(bs)",
11494 lock,
11495 name));
11496}
11497
11498/* ------------------------------------------------------------------------ */
11499
11500/**
11501 * SharedResourceProxy:
11502 *
11503 * The #SharedResourceProxy structure contains only private data and should only be accessed using the provided API.
11504 */
11505
11506/**
11507 * SharedResourceProxyClass:
11508 * @parent_class: The parent class.
11509 *
11510 * Class structure for #SharedResourceProxy.
11511 */
11512
11513struct _SharedResourceProxyPrivate
11514{
11515 GData *qdata;
11516};
11517
11518static void shared_resource_proxy_iface_init (SharedResourceIface *iface);
11519
11520#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
11521G_DEFINE_TYPE_WITH_CODE (SharedResourceProxy, shared_resource_proxy, G_TYPE_DBUS_PROXY,
11522 G_ADD_PRIVATE (SharedResourceProxy)
11523 G_IMPLEMENT_INTERFACE (TYPE_SHARED_RESOURCE, shared_resource_proxy_iface_init));
11524
11525#else
11526G_DEFINE_TYPE_WITH_CODE (SharedResourceProxy, shared_resource_proxy, G_TYPE_DBUS_PROXY,
11527 G_IMPLEMENT_INTERFACE (TYPE_SHARED_RESOURCE, shared_resource_proxy_iface_init));
11528
11529#endif
11530static void
11531shared_resource_proxy_finalize (GObject *object)
11532{
11533 SharedResourceProxy *proxy = SHARED_RESOURCE_PROXY (object);
11534 g_datalist_clear (&proxy->priv->qdata);
11535 G_OBJECT_CLASS (shared_resource_proxy_parent_class)->finalize (object);
11536}
11537
11538static void
11539shared_resource_proxy_get_property (GObject *object,
11540 guint prop_id,
11541 GValue *value,
11542 GParamSpec *pspec G_GNUC_UNUSED)
11543{
11544 const _ExtendedGDBusPropertyInfo *info;
11545 GVariant *variant;
11546 g_assert (prop_id != 0 && prop_id - 1 < 2);
11547 info = _shared_resource_property_info_pointers[prop_id - 1];
11548 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
11549 if (info->use_gvariant)
11550 {
11551 g_value_set_variant (value, variant);
11552 }
11553 else
11554 {
11555 if (variant != NULL)
11556 g_dbus_gvariant_to_gvalue (variant, value);
11557 }
11558 if (variant != NULL)
11559 g_variant_unref (variant);
11560}
11561
11562static void
11563shared_resource_proxy_set_property_cb (GDBusProxy *proxy,
11564 GAsyncResult *res,
11565 gpointer user_data)
11566{
11567 const _ExtendedGDBusPropertyInfo *info = user_data;
11568 GError *error;
11569 GVariant *_ret;
11570 error = NULL;
11571 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
11572 if (!_ret)
11573 {
11574 g_warning ("Error setting property '%s' on interface org.openbmc.SharedResource: %s (%s, %d)",
11575 info->parent_struct.name,
11576 error->message, g_quark_to_string (error->domain), error->code);
11577 g_error_free (error);
11578 }
11579 else
11580 {
11581 g_variant_unref (_ret);
11582 }
11583}
11584
11585static void
11586shared_resource_proxy_set_property (GObject *object,
11587 guint prop_id,
11588 const GValue *value,
11589 GParamSpec *pspec G_GNUC_UNUSED)
11590{
11591 const _ExtendedGDBusPropertyInfo *info;
11592 GVariant *variant;
11593 g_assert (prop_id != 0 && prop_id - 1 < 2);
11594 info = _shared_resource_property_info_pointers[prop_id - 1];
11595 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
11596 g_dbus_proxy_call (G_DBUS_PROXY (object),
11597 "org.freedesktop.DBus.Properties.Set",
11598 g_variant_new ("(ssv)", "org.openbmc.SharedResource", info->parent_struct.name, variant),
11599 G_DBUS_CALL_FLAGS_NONE,
11600 -1,
11601 NULL, (GAsyncReadyCallback) shared_resource_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
11602 g_variant_unref (variant);
11603}
11604
11605static void
11606shared_resource_proxy_g_signal (GDBusProxy *proxy,
11607 const gchar *sender_name G_GNUC_UNUSED,
11608 const gchar *signal_name,
11609 GVariant *parameters)
11610{
11611 _ExtendedGDBusSignalInfo *info;
11612 GVariantIter iter;
11613 GVariant *child;
11614 GValue *paramv;
11615 guint num_params;
11616 guint n;
11617 guint signal_id;
11618 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct, signal_name);
11619 if (info == NULL)
11620 return;
11621 num_params = g_variant_n_children (parameters);
11622 paramv = g_new0 (GValue, num_params + 1);
11623 g_value_init (&paramv[0], TYPE_SHARED_RESOURCE);
11624 g_value_set_object (&paramv[0], proxy);
11625 g_variant_iter_init (&iter, parameters);
11626 n = 1;
11627 while ((child = g_variant_iter_next_value (&iter)) != NULL)
11628 {
11629 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
11630 if (arg_info->use_gvariant)
11631 {
11632 g_value_init (&paramv[n], G_TYPE_VARIANT);
11633 g_value_set_variant (&paramv[n], child);
11634 n++;
11635 }
11636 else
11637 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
11638 g_variant_unref (child);
11639 }
11640 signal_id = g_signal_lookup (info->signal_name, TYPE_SHARED_RESOURCE);
11641 g_signal_emitv (paramv, signal_id, 0, NULL);
11642 for (n = 0; n < num_params + 1; n++)
11643 g_value_unset (&paramv[n]);
11644 g_free (paramv);
11645}
11646
11647static void
11648shared_resource_proxy_g_properties_changed (GDBusProxy *_proxy,
11649 GVariant *changed_properties,
11650 const gchar *const *invalidated_properties)
11651{
11652 SharedResourceProxy *proxy = SHARED_RESOURCE_PROXY (_proxy);
11653 guint n;
11654 const gchar *key;
11655 GVariantIter *iter;
11656 _ExtendedGDBusPropertyInfo *info;
11657 g_variant_get (changed_properties, "a{sv}", &iter);
11658 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
11659 {
11660 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct, key);
11661 g_datalist_remove_data (&proxy->priv->qdata, key);
11662 if (info != NULL)
11663 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
11664 }
11665 g_variant_iter_free (iter);
11666 for (n = 0; invalidated_properties[n] != NULL; n++)
11667 {
11668 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct, invalidated_properties[n]);
11669 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
11670 if (info != NULL)
11671 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
11672 }
11673}
11674
11675static gboolean
11676shared_resource_proxy_get_lock (SharedResource *object)
11677{
11678 SharedResourceProxy *proxy = SHARED_RESOURCE_PROXY (object);
11679 GVariant *variant;
11680 gboolean value = 0;
11681 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "lock");
11682 if (variant != NULL)
11683 {
11684 value = g_variant_get_boolean (variant);
11685 g_variant_unref (variant);
11686 }
11687 return value;
11688}
11689
11690static const gchar *
11691shared_resource_proxy_get_name (SharedResource *object)
11692{
11693 SharedResourceProxy *proxy = SHARED_RESOURCE_PROXY (object);
11694 GVariant *variant;
11695 const gchar *value = NULL;
11696 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "name");
11697 if (variant != NULL)
11698 {
11699 value = g_variant_get_string (variant, NULL);
11700 g_variant_unref (variant);
11701 }
11702 return value;
11703}
11704
11705static void
11706shared_resource_proxy_init (SharedResourceProxy *proxy)
11707{
11708#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
11709 proxy->priv = shared_resource_proxy_get_instance_private (proxy);
11710#else
11711 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_SHARED_RESOURCE_PROXY, SharedResourceProxyPrivate);
11712#endif
11713
11714 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), shared_resource_interface_info ());
11715}
11716
11717static void
11718shared_resource_proxy_class_init (SharedResourceProxyClass *klass)
11719{
11720 GObjectClass *gobject_class;
11721 GDBusProxyClass *proxy_class;
11722
11723 gobject_class = G_OBJECT_CLASS (klass);
11724 gobject_class->finalize = shared_resource_proxy_finalize;
11725 gobject_class->get_property = shared_resource_proxy_get_property;
11726 gobject_class->set_property = shared_resource_proxy_set_property;
11727
11728 proxy_class = G_DBUS_PROXY_CLASS (klass);
11729 proxy_class->g_signal = shared_resource_proxy_g_signal;
11730 proxy_class->g_properties_changed = shared_resource_proxy_g_properties_changed;
11731
11732 shared_resource_override_properties (gobject_class, 1);
11733
11734#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
11735 g_type_class_add_private (klass, sizeof (SharedResourceProxyPrivate));
11736#endif
11737}
11738
11739static void
11740shared_resource_proxy_iface_init (SharedResourceIface *iface)
11741{
11742 iface->get_lock = shared_resource_proxy_get_lock;
11743 iface->get_name = shared_resource_proxy_get_name;
11744}
11745
11746/**
11747 * shared_resource_proxy_new:
11748 * @connection: A #GDBusConnection.
11749 * @flags: Flags from the #GDBusProxyFlags enumeration.
11750 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
11751 * @object_path: An object path.
11752 * @cancellable: (allow-none): A #GCancellable or %NULL.
11753 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
11754 * @user_data: User data to pass to @callback.
11755 *
11756 * 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.
11757 *
11758 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
11759 * You can then call shared_resource_proxy_new_finish() to get the result of the operation.
11760 *
11761 * See shared_resource_proxy_new_sync() for the synchronous, blocking version of this constructor.
11762 */
11763void
11764shared_resource_proxy_new (
11765 GDBusConnection *connection,
11766 GDBusProxyFlags flags,
11767 const gchar *name,
11768 const gchar *object_path,
11769 GCancellable *cancellable,
11770 GAsyncReadyCallback callback,
11771 gpointer user_data)
11772{
11773 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);
11774}
11775
11776/**
11777 * shared_resource_proxy_new_finish:
11778 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to shared_resource_proxy_new().
11779 * @error: Return location for error or %NULL
11780 *
11781 * Finishes an operation started with shared_resource_proxy_new().
11782 *
11783 * Returns: (transfer full) (type SharedResourceProxy): The constructed proxy object or %NULL if @error is set.
11784 */
11785SharedResource *
11786shared_resource_proxy_new_finish (
11787 GAsyncResult *res,
11788 GError **error)
11789{
11790 GObject *ret;
11791 GObject *source_object;
11792 source_object = g_async_result_get_source_object (res);
11793 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
11794 g_object_unref (source_object);
11795 if (ret != NULL)
11796 return SHARED_RESOURCE (ret);
11797 else
11798 return NULL;
11799}
11800
11801/**
11802 * shared_resource_proxy_new_sync:
11803 * @connection: A #GDBusConnection.
11804 * @flags: Flags from the #GDBusProxyFlags enumeration.
11805 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
11806 * @object_path: An object path.
11807 * @cancellable: (allow-none): A #GCancellable or %NULL.
11808 * @error: Return location for error or %NULL
11809 *
11810 * 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.
11811 *
11812 * The calling thread is blocked until a reply is received.
11813 *
11814 * See shared_resource_proxy_new() for the asynchronous version of this constructor.
11815 *
11816 * Returns: (transfer full) (type SharedResourceProxy): The constructed proxy object or %NULL if @error is set.
11817 */
11818SharedResource *
11819shared_resource_proxy_new_sync (
11820 GDBusConnection *connection,
11821 GDBusProxyFlags flags,
11822 const gchar *name,
11823 const gchar *object_path,
11824 GCancellable *cancellable,
11825 GError **error)
11826{
11827 GInitable *ret;
11828 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);
11829 if (ret != NULL)
11830 return SHARED_RESOURCE (ret);
11831 else
11832 return NULL;
11833}
11834
11835
11836/**
11837 * shared_resource_proxy_new_for_bus:
11838 * @bus_type: A #GBusType.
11839 * @flags: Flags from the #GDBusProxyFlags enumeration.
11840 * @name: A bus name (well-known or unique).
11841 * @object_path: An object path.
11842 * @cancellable: (allow-none): A #GCancellable or %NULL.
11843 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
11844 * @user_data: User data to pass to @callback.
11845 *
11846 * Like shared_resource_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
11847 *
11848 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
11849 * You can then call shared_resource_proxy_new_for_bus_finish() to get the result of the operation.
11850 *
11851 * See shared_resource_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
11852 */
11853void
11854shared_resource_proxy_new_for_bus (
11855 GBusType bus_type,
11856 GDBusProxyFlags flags,
11857 const gchar *name,
11858 const gchar *object_path,
11859 GCancellable *cancellable,
11860 GAsyncReadyCallback callback,
11861 gpointer user_data)
11862{
11863 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);
11864}
11865
11866/**
11867 * shared_resource_proxy_new_for_bus_finish:
11868 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to shared_resource_proxy_new_for_bus().
11869 * @error: Return location for error or %NULL
11870 *
11871 * Finishes an operation started with shared_resource_proxy_new_for_bus().
11872 *
11873 * Returns: (transfer full) (type SharedResourceProxy): The constructed proxy object or %NULL if @error is set.
11874 */
11875SharedResource *
11876shared_resource_proxy_new_for_bus_finish (
11877 GAsyncResult *res,
11878 GError **error)
11879{
11880 GObject *ret;
11881 GObject *source_object;
11882 source_object = g_async_result_get_source_object (res);
11883 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
11884 g_object_unref (source_object);
11885 if (ret != NULL)
11886 return SHARED_RESOURCE (ret);
11887 else
11888 return NULL;
11889}
11890
11891/**
11892 * shared_resource_proxy_new_for_bus_sync:
11893 * @bus_type: A #GBusType.
11894 * @flags: Flags from the #GDBusProxyFlags enumeration.
11895 * @name: A bus name (well-known or unique).
11896 * @object_path: An object path.
11897 * @cancellable: (allow-none): A #GCancellable or %NULL.
11898 * @error: Return location for error or %NULL
11899 *
11900 * Like shared_resource_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
11901 *
11902 * The calling thread is blocked until a reply is received.
11903 *
11904 * See shared_resource_proxy_new_for_bus() for the asynchronous version of this constructor.
11905 *
11906 * Returns: (transfer full) (type SharedResourceProxy): The constructed proxy object or %NULL if @error is set.
11907 */
11908SharedResource *
11909shared_resource_proxy_new_for_bus_sync (
11910 GBusType bus_type,
11911 GDBusProxyFlags flags,
11912 const gchar *name,
11913 const gchar *object_path,
11914 GCancellable *cancellable,
11915 GError **error)
11916{
11917 GInitable *ret;
11918 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);
11919 if (ret != NULL)
11920 return SHARED_RESOURCE (ret);
11921 else
11922 return NULL;
11923}
11924
11925
11926/* ------------------------------------------------------------------------ */
11927
11928/**
11929 * SharedResourceSkeleton:
11930 *
11931 * The #SharedResourceSkeleton structure contains only private data and should only be accessed using the provided API.
11932 */
11933
11934/**
11935 * SharedResourceSkeletonClass:
11936 * @parent_class: The parent class.
11937 *
11938 * Class structure for #SharedResourceSkeleton.
11939 */
11940
11941struct _SharedResourceSkeletonPrivate
11942{
11943 GValue *properties;
11944 GList *changed_properties;
11945 GSource *changed_properties_idle_source;
11946 GMainContext *context;
11947 GMutex lock;
11948};
11949
11950static void
11951_shared_resource_skeleton_handle_method_call (
11952 GDBusConnection *connection G_GNUC_UNUSED,
11953 const gchar *sender G_GNUC_UNUSED,
11954 const gchar *object_path G_GNUC_UNUSED,
11955 const gchar *interface_name,
11956 const gchar *method_name,
11957 GVariant *parameters,
11958 GDBusMethodInvocation *invocation,
11959 gpointer user_data)
11960{
11961 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (user_data);
11962 _ExtendedGDBusMethodInfo *info;
11963 GVariantIter iter;
11964 GVariant *child;
11965 GValue *paramv;
11966 guint num_params;
11967 guint num_extra;
11968 guint n;
11969 guint signal_id;
11970 GValue return_value = G_VALUE_INIT;
11971 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
11972 g_assert (info != NULL);
11973 num_params = g_variant_n_children (parameters);
11974 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
11975 n = 0;
11976 g_value_init (&paramv[n], TYPE_SHARED_RESOURCE);
11977 g_value_set_object (&paramv[n++], skeleton);
11978 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
11979 g_value_set_object (&paramv[n++], invocation);
11980 if (info->pass_fdlist)
11981 {
11982#ifdef G_OS_UNIX
11983 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
11984 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
11985#else
11986 g_assert_not_reached ();
11987#endif
11988 }
11989 g_variant_iter_init (&iter, parameters);
11990 while ((child = g_variant_iter_next_value (&iter)) != NULL)
11991 {
11992 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
11993 if (arg_info->use_gvariant)
11994 {
11995 g_value_init (&paramv[n], G_TYPE_VARIANT);
11996 g_value_set_variant (&paramv[n], child);
11997 n++;
11998 }
11999 else
12000 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
12001 g_variant_unref (child);
12002 }
12003 signal_id = g_signal_lookup (info->signal_name, TYPE_SHARED_RESOURCE);
12004 g_value_init (&return_value, G_TYPE_BOOLEAN);
12005 g_signal_emitv (paramv, signal_id, 0, &return_value);
12006 if (!g_value_get_boolean (&return_value))
12007 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);
12008 g_value_unset (&return_value);
12009 for (n = 0; n < num_params + num_extra; n++)
12010 g_value_unset (&paramv[n]);
12011 g_free (paramv);
12012}
12013
12014static GVariant *
12015_shared_resource_skeleton_handle_get_property (
12016 GDBusConnection *connection G_GNUC_UNUSED,
12017 const gchar *sender G_GNUC_UNUSED,
12018 const gchar *object_path G_GNUC_UNUSED,
12019 const gchar *interface_name G_GNUC_UNUSED,
12020 const gchar *property_name,
12021 GError **error,
12022 gpointer user_data)
12023{
12024 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (user_data);
12025 GValue value = G_VALUE_INIT;
12026 GParamSpec *pspec;
12027 _ExtendedGDBusPropertyInfo *info;
12028 GVariant *ret;
12029 ret = NULL;
12030 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct, property_name);
12031 g_assert (info != NULL);
12032 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
12033 if (pspec == NULL)
12034 {
12035 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
12036 }
12037 else
12038 {
12039 g_value_init (&value, pspec->value_type);
12040 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
12041 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
12042 g_value_unset (&value);
12043 }
12044 return ret;
12045}
12046
12047static gboolean
12048_shared_resource_skeleton_handle_set_property (
12049 GDBusConnection *connection G_GNUC_UNUSED,
12050 const gchar *sender G_GNUC_UNUSED,
12051 const gchar *object_path G_GNUC_UNUSED,
12052 const gchar *interface_name G_GNUC_UNUSED,
12053 const gchar *property_name,
12054 GVariant *variant,
12055 GError **error,
12056 gpointer user_data)
12057{
12058 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (user_data);
12059 GValue value = G_VALUE_INIT;
12060 GParamSpec *pspec;
12061 _ExtendedGDBusPropertyInfo *info;
12062 gboolean ret;
12063 ret = FALSE;
12064 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_shared_resource_interface_info.parent_struct, property_name);
12065 g_assert (info != NULL);
12066 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
12067 if (pspec == NULL)
12068 {
12069 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
12070 }
12071 else
12072 {
12073 if (info->use_gvariant)
12074 g_value_set_variant (&value, variant);
12075 else
12076 g_dbus_gvariant_to_gvalue (variant, &value);
12077 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
12078 g_value_unset (&value);
12079 ret = TRUE;
12080 }
12081 return ret;
12082}
12083
12084static const GDBusInterfaceVTable _shared_resource_skeleton_vtable =
12085{
12086 _shared_resource_skeleton_handle_method_call,
12087 _shared_resource_skeleton_handle_get_property,
12088 _shared_resource_skeleton_handle_set_property,
12089 {NULL}
12090};
12091
12092static GDBusInterfaceInfo *
12093shared_resource_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
12094{
12095 return shared_resource_interface_info ();
12096}
12097
12098static GDBusInterfaceVTable *
12099shared_resource_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
12100{
12101 return (GDBusInterfaceVTable *) &_shared_resource_skeleton_vtable;
12102}
12103
12104static GVariant *
12105shared_resource_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
12106{
12107 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (_skeleton);
12108
12109 GVariantBuilder builder;
12110 guint n;
12111 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
12112 if (_shared_resource_interface_info.parent_struct.properties == NULL)
12113 goto out;
12114 for (n = 0; _shared_resource_interface_info.parent_struct.properties[n] != NULL; n++)
12115 {
12116 GDBusPropertyInfo *info = _shared_resource_interface_info.parent_struct.properties[n];
12117 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
12118 {
12119 GVariant *value;
12120 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);
12121 if (value != NULL)
12122 {
12123 g_variant_take_ref (value);
12124 g_variant_builder_add (&builder, "{sv}", info->name, value);
12125 g_variant_unref (value);
12126 }
12127 }
12128 }
12129out:
12130 return g_variant_builder_end (&builder);
12131}
12132
12133static gboolean _shared_resource_emit_changed (gpointer user_data);
12134
12135static void
12136shared_resource_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
12137{
12138 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (_skeleton);
12139 gboolean emit_changed = FALSE;
12140
12141 g_mutex_lock (&skeleton->priv->lock);
12142 if (skeleton->priv->changed_properties_idle_source != NULL)
12143 {
12144 g_source_destroy (skeleton->priv->changed_properties_idle_source);
12145 skeleton->priv->changed_properties_idle_source = NULL;
12146 emit_changed = TRUE;
12147 }
12148 g_mutex_unlock (&skeleton->priv->lock);
12149
12150 if (emit_changed)
12151 _shared_resource_emit_changed (skeleton);
12152}
12153
12154static void shared_resource_skeleton_iface_init (SharedResourceIface *iface);
12155#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
12156G_DEFINE_TYPE_WITH_CODE (SharedResourceSkeleton, shared_resource_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
12157 G_ADD_PRIVATE (SharedResourceSkeleton)
12158 G_IMPLEMENT_INTERFACE (TYPE_SHARED_RESOURCE, shared_resource_skeleton_iface_init));
12159
12160#else
12161G_DEFINE_TYPE_WITH_CODE (SharedResourceSkeleton, shared_resource_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
12162 G_IMPLEMENT_INTERFACE (TYPE_SHARED_RESOURCE, shared_resource_skeleton_iface_init));
12163
12164#endif
12165static void
12166shared_resource_skeleton_finalize (GObject *object)
12167{
12168 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object);
12169 guint n;
12170 for (n = 0; n < 2; n++)
12171 g_value_unset (&skeleton->priv->properties[n]);
12172 g_free (skeleton->priv->properties);
12173 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
12174 if (skeleton->priv->changed_properties_idle_source != NULL)
12175 g_source_destroy (skeleton->priv->changed_properties_idle_source);
12176 g_main_context_unref (skeleton->priv->context);
12177 g_mutex_clear (&skeleton->priv->lock);
12178 G_OBJECT_CLASS (shared_resource_skeleton_parent_class)->finalize (object);
12179}
12180
12181static void
12182shared_resource_skeleton_get_property (GObject *object,
12183 guint prop_id,
12184 GValue *value,
12185 GParamSpec *pspec G_GNUC_UNUSED)
12186{
12187 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object);
12188 g_assert (prop_id != 0 && prop_id - 1 < 2);
12189 g_mutex_lock (&skeleton->priv->lock);
12190 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
12191 g_mutex_unlock (&skeleton->priv->lock);
12192}
12193
12194static gboolean
12195_shared_resource_emit_changed (gpointer user_data)
12196{
12197 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (user_data);
12198 GList *l;
12199 GVariantBuilder builder;
12200 GVariantBuilder invalidated_builder;
12201 guint num_changes;
12202
12203 g_mutex_lock (&skeleton->priv->lock);
12204 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
12205 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
12206 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
12207 {
12208 ChangedProperty *cp = l->data;
12209 GVariant *variant;
12210 const GValue *cur_value;
12211
12212 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
12213 if (!_g_value_equal (cur_value, &cp->orig_value))
12214 {
12215 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
12216 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
12217 g_variant_unref (variant);
12218 num_changes++;
12219 }
12220 }
12221 if (num_changes > 0)
12222 {
12223 GList *connections, *ll;
12224 GVariant *signal_variant;
12225 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.SharedResource",
12226 &builder, &invalidated_builder));
12227 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
12228 for (ll = connections; ll != NULL; ll = ll->next)
12229 {
12230 GDBusConnection *connection = ll->data;
12231
12232 g_dbus_connection_emit_signal (connection,
12233 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
12234 "org.freedesktop.DBus.Properties",
12235 "PropertiesChanged",
12236 signal_variant,
12237 NULL);
12238 }
12239 g_variant_unref (signal_variant);
12240 g_list_free_full (connections, g_object_unref);
12241 }
12242 else
12243 {
12244 g_variant_builder_clear (&builder);
12245 g_variant_builder_clear (&invalidated_builder);
12246 }
12247 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
12248 skeleton->priv->changed_properties = NULL;
12249 skeleton->priv->changed_properties_idle_source = NULL;
12250 g_mutex_unlock (&skeleton->priv->lock);
12251 return FALSE;
12252}
12253
12254static void
12255_shared_resource_schedule_emit_changed (SharedResourceSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
12256{
12257 ChangedProperty *cp;
12258 GList *l;
12259 cp = NULL;
12260 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
12261 {
12262 ChangedProperty *i_cp = l->data;
12263 if (i_cp->info == info)
12264 {
12265 cp = i_cp;
12266 break;
12267 }
12268 }
12269 if (cp == NULL)
12270 {
12271 cp = g_new0 (ChangedProperty, 1);
12272 cp->prop_id = prop_id;
12273 cp->info = info;
12274 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
12275 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
12276 g_value_copy (orig_value, &cp->orig_value);
12277 }
12278}
12279
12280static void
12281shared_resource_skeleton_notify (GObject *object,
12282 GParamSpec *pspec G_GNUC_UNUSED)
12283{
12284 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object);
12285 g_mutex_lock (&skeleton->priv->lock);
12286 if (skeleton->priv->changed_properties != NULL &&
12287 skeleton->priv->changed_properties_idle_source == NULL)
12288 {
12289 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
12290 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
12291 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _shared_resource_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
Adriana Kobylak2cb27752015-10-19 16:23:14 -050012292 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _shared_resource_emit_changed");
Norman James18998182015-10-11 21:54:53 -050012293 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
12294 g_source_unref (skeleton->priv->changed_properties_idle_source);
12295 }
12296 g_mutex_unlock (&skeleton->priv->lock);
12297}
12298
12299static void
12300shared_resource_skeleton_set_property (GObject *object,
12301 guint prop_id,
12302 const GValue *value,
12303 GParamSpec *pspec)
12304{
12305 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object);
12306 g_assert (prop_id != 0 && prop_id - 1 < 2);
12307 g_mutex_lock (&skeleton->priv->lock);
12308 g_object_freeze_notify (object);
12309 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
12310 {
12311 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
12312 _shared_resource_schedule_emit_changed (skeleton, _shared_resource_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
12313 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
12314 g_object_notify_by_pspec (object, pspec);
12315 }
12316 g_mutex_unlock (&skeleton->priv->lock);
12317 g_object_thaw_notify (object);
12318}
12319
12320static void
12321shared_resource_skeleton_init (SharedResourceSkeleton *skeleton)
12322{
12323#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
12324 skeleton->priv = shared_resource_skeleton_get_instance_private (skeleton);
12325#else
12326 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_SHARED_RESOURCE_SKELETON, SharedResourceSkeletonPrivate);
12327#endif
12328
12329 g_mutex_init (&skeleton->priv->lock);
12330 skeleton->priv->context = g_main_context_ref_thread_default ();
12331 skeleton->priv->properties = g_new0 (GValue, 2);
12332 g_value_init (&skeleton->priv->properties[0], G_TYPE_BOOLEAN);
12333 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
12334}
12335
12336static gboolean
12337shared_resource_skeleton_get_lock (SharedResource *object)
12338{
12339 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object);
12340 gboolean value;
12341 g_mutex_lock (&skeleton->priv->lock);
12342 value = g_value_get_boolean (&(skeleton->priv->properties[0]));
12343 g_mutex_unlock (&skeleton->priv->lock);
12344 return value;
12345}
12346
12347static const gchar *
12348shared_resource_skeleton_get_name (SharedResource *object)
12349{
12350 SharedResourceSkeleton *skeleton = SHARED_RESOURCE_SKELETON (object);
12351 const gchar *value;
12352 g_mutex_lock (&skeleton->priv->lock);
12353 value = g_value_get_string (&(skeleton->priv->properties[1]));
12354 g_mutex_unlock (&skeleton->priv->lock);
12355 return value;
12356}
12357
12358static void
12359shared_resource_skeleton_class_init (SharedResourceSkeletonClass *klass)
12360{
12361 GObjectClass *gobject_class;
12362 GDBusInterfaceSkeletonClass *skeleton_class;
12363
12364 gobject_class = G_OBJECT_CLASS (klass);
12365 gobject_class->finalize = shared_resource_skeleton_finalize;
12366 gobject_class->get_property = shared_resource_skeleton_get_property;
12367 gobject_class->set_property = shared_resource_skeleton_set_property;
12368 gobject_class->notify = shared_resource_skeleton_notify;
12369
12370
12371 shared_resource_override_properties (gobject_class, 1);
12372
12373 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
12374 skeleton_class->get_info = shared_resource_skeleton_dbus_interface_get_info;
12375 skeleton_class->get_properties = shared_resource_skeleton_dbus_interface_get_properties;
12376 skeleton_class->flush = shared_resource_skeleton_dbus_interface_flush;
12377 skeleton_class->get_vtable = shared_resource_skeleton_dbus_interface_get_vtable;
12378
12379#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
12380 g_type_class_add_private (klass, sizeof (SharedResourceSkeletonPrivate));
12381#endif
12382}
12383
12384static void
12385shared_resource_skeleton_iface_init (SharedResourceIface *iface)
12386{
12387 iface->get_lock = shared_resource_skeleton_get_lock;
12388 iface->get_name = shared_resource_skeleton_get_name;
12389}
12390
12391/**
12392 * shared_resource_skeleton_new:
12393 *
12394 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-SharedResource.top_of_page">org.openbmc.SharedResource</link>.
12395 *
12396 * Returns: (transfer full) (type SharedResourceSkeleton): The skeleton object.
12397 */
12398SharedResource *
12399shared_resource_skeleton_new (void)
12400{
12401 return SHARED_RESOURCE (g_object_new (TYPE_SHARED_RESOURCE_SKELETON, NULL));
12402}
12403
12404/* ------------------------------------------------------------------------
Norman James362a80f2015-09-14 14:04:39 -050012405 * Code for interface org.openbmc.Control
12406 * ------------------------------------------------------------------------
12407 */
12408
12409/**
12410 * SECTION:Control
12411 * @title: Control
12412 * @short_description: Generated C code for the org.openbmc.Control D-Bus interface
12413 *
12414 * 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.
12415 */
12416
12417/* ---- Introspection data for org.openbmc.Control ---- */
12418
12419static const _ExtendedGDBusMethodInfo _control_method_info_init =
12420{
12421 {
12422 -1,
12423 (gchar *) "init",
12424 NULL,
12425 NULL,
12426 NULL
12427 },
12428 "handle-init",
12429 FALSE
12430};
12431
12432static const _ExtendedGDBusMethodInfo * const _control_method_info_pointers[] =
12433{
12434 &_control_method_info_init,
12435 NULL
12436};
12437
12438static const _ExtendedGDBusArgInfo _control_signal_info_heartbeat_ARG_bus_name =
12439{
12440 {
12441 -1,
12442 (gchar *) "bus_name",
12443 (gchar *) "s",
12444 NULL
12445 },
12446 FALSE
12447};
12448
12449static const _ExtendedGDBusArgInfo * const _control_signal_info_heartbeat_ARG_pointers[] =
12450{
12451 &_control_signal_info_heartbeat_ARG_bus_name,
12452 NULL
12453};
12454
12455static const _ExtendedGDBusSignalInfo _control_signal_info_heartbeat =
12456{
12457 {
12458 -1,
12459 (gchar *) "Heartbeat",
12460 (GDBusArgInfo **) &_control_signal_info_heartbeat_ARG_pointers,
12461 NULL
12462 },
12463 "heartbeat"
12464};
12465
12466static const _ExtendedGDBusArgInfo _control_signal_info_goto_system_state_ARG_state_name =
12467{
12468 {
12469 -1,
12470 (gchar *) "state_name",
12471 (gchar *) "s",
12472 NULL
12473 },
12474 FALSE
12475};
12476
12477static const _ExtendedGDBusArgInfo * const _control_signal_info_goto_system_state_ARG_pointers[] =
12478{
12479 &_control_signal_info_goto_system_state_ARG_state_name,
12480 NULL
12481};
12482
12483static const _ExtendedGDBusSignalInfo _control_signal_info_goto_system_state =
12484{
12485 {
12486 -1,
12487 (gchar *) "GotoSystemState",
12488 (GDBusArgInfo **) &_control_signal_info_goto_system_state_ARG_pointers,
12489 NULL
12490 },
12491 "goto-system-state"
12492};
12493
12494static const _ExtendedGDBusSignalInfo * const _control_signal_info_pointers[] =
12495{
12496 &_control_signal_info_heartbeat,
12497 &_control_signal_info_goto_system_state,
12498 NULL
12499};
12500
12501static const _ExtendedGDBusPropertyInfo _control_property_info_poll_interval =
12502{
12503 {
12504 -1,
12505 (gchar *) "poll_interval",
12506 (gchar *) "i",
12507 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
12508 NULL
12509 },
12510 "poll-interval",
12511 FALSE
12512};
12513
12514static const _ExtendedGDBusPropertyInfo _control_property_info_heatbeat =
12515{
12516 {
12517 -1,
12518 (gchar *) "heatbeat",
12519 (gchar *) "i",
12520 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
12521 NULL
12522 },
12523 "heatbeat",
12524 FALSE
12525};
12526
12527static const _ExtendedGDBusPropertyInfo * const _control_property_info_pointers[] =
12528{
12529 &_control_property_info_poll_interval,
12530 &_control_property_info_heatbeat,
12531 NULL
12532};
12533
12534static const _ExtendedGDBusInterfaceInfo _control_interface_info =
12535{
12536 {
12537 -1,
12538 (gchar *) "org.openbmc.Control",
12539 (GDBusMethodInfo **) &_control_method_info_pointers,
12540 (GDBusSignalInfo **) &_control_signal_info_pointers,
12541 (GDBusPropertyInfo **) &_control_property_info_pointers,
12542 NULL
12543 },
12544 "control",
12545};
12546
12547
12548/**
12549 * control_interface_info:
12550 *
12551 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link> D-Bus interface.
12552 *
12553 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
12554 */
12555GDBusInterfaceInfo *
12556control_interface_info (void)
12557{
12558 return (GDBusInterfaceInfo *) &_control_interface_info.parent_struct;
12559}
12560
12561/**
12562 * control_override_properties:
12563 * @klass: The class structure for a #GObject<!-- -->-derived class.
12564 * @property_id_begin: The property id to assign to the first overridden property.
12565 *
12566 * Overrides all #GObject properties in the #Control interface for a concrete class.
12567 * The properties are overridden in the order they are defined.
12568 *
12569 * Returns: The last property id.
12570 */
12571guint
12572control_override_properties (GObjectClass *klass, guint property_id_begin)
12573{
12574 g_object_class_override_property (klass, property_id_begin++, "poll-interval");
12575 g_object_class_override_property (klass, property_id_begin++, "heatbeat");
12576 return property_id_begin - 1;
12577}
12578
12579
12580
12581/**
12582 * Control:
12583 *
12584 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link>.
12585 */
12586
12587/**
12588 * ControlIface:
12589 * @parent_iface: The parent interface.
12590 * @handle_init: Handler for the #Control::handle-init signal.
12591 * @get_heatbeat: Getter for the #Control:heatbeat property.
12592 * @get_poll_interval: Getter for the #Control:poll-interval property.
12593 * @goto_system_state: Handler for the #Control::goto-system-state signal.
12594 * @heartbeat: Handler for the #Control::heartbeat signal.
12595 *
12596 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link>.
12597 */
12598
12599typedef ControlIface ControlInterface;
12600G_DEFINE_INTERFACE (Control, control, G_TYPE_OBJECT);
12601
12602static void
12603control_default_init (ControlIface *iface)
12604{
12605 /* GObject signals for incoming D-Bus method calls: */
12606 /**
12607 * Control::handle-init:
12608 * @object: A #Control.
12609 * @invocation: A #GDBusMethodInvocation.
12610 *
12611 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Control.init">init()</link> D-Bus method.
12612 *
12613 * 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.
12614 *
12615 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
12616 */
12617 g_signal_new ("handle-init",
12618 G_TYPE_FROM_INTERFACE (iface),
12619 G_SIGNAL_RUN_LAST,
12620 G_STRUCT_OFFSET (ControlIface, handle_init),
12621 g_signal_accumulator_true_handled,
12622 NULL,
12623 g_cclosure_marshal_generic,
12624 G_TYPE_BOOLEAN,
12625 1,
12626 G_TYPE_DBUS_METHOD_INVOCATION);
12627
12628 /* GObject signals for received D-Bus signals: */
12629 /**
12630 * Control::heartbeat:
12631 * @object: A #Control.
12632 * @arg_bus_name: Argument.
12633 *
12634 * 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.
12635 *
12636 * 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.
12637 */
12638 g_signal_new ("heartbeat",
12639 G_TYPE_FROM_INTERFACE (iface),
12640 G_SIGNAL_RUN_LAST,
12641 G_STRUCT_OFFSET (ControlIface, heartbeat),
12642 NULL,
12643 NULL,
12644 g_cclosure_marshal_generic,
12645 G_TYPE_NONE,
12646 1, G_TYPE_STRING);
12647
12648 /**
12649 * Control::goto-system-state:
12650 * @object: A #Control.
12651 * @arg_state_name: Argument.
12652 *
12653 * 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.
12654 *
12655 * 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.
12656 */
12657 g_signal_new ("goto-system-state",
12658 G_TYPE_FROM_INTERFACE (iface),
12659 G_SIGNAL_RUN_LAST,
12660 G_STRUCT_OFFSET (ControlIface, goto_system_state),
12661 NULL,
12662 NULL,
12663 g_cclosure_marshal_generic,
12664 G_TYPE_NONE,
12665 1, G_TYPE_STRING);
12666
12667 /* GObject properties for D-Bus properties: */
12668 /**
12669 * Control:poll-interval:
12670 *
12671 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Control.poll_interval">"poll_interval"</link>.
12672 *
12673 * 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.
12674 */
12675 g_object_interface_install_property (iface,
12676 g_param_spec_int ("poll-interval", "poll_interval", "poll_interval", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
12677 /**
12678 * Control:heatbeat:
12679 *
12680 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Control.heatbeat">"heatbeat"</link>.
12681 *
12682 * 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.
12683 */
12684 g_object_interface_install_property (iface,
12685 g_param_spec_int ("heatbeat", "heatbeat", "heatbeat", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
12686}
12687
12688/**
12689 * control_get_poll_interval: (skip)
12690 * @object: A #Control.
12691 *
12692 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Control.poll_interval">"poll_interval"</link> D-Bus property.
12693 *
12694 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
12695 *
12696 * Returns: The property value.
12697 */
12698gint
12699control_get_poll_interval (Control *object)
12700{
12701 return CONTROL_GET_IFACE (object)->get_poll_interval (object);
12702}
12703
12704/**
12705 * control_set_poll_interval: (skip)
12706 * @object: A #Control.
12707 * @value: The value to set.
12708 *
12709 * Sets the <link linkend="gdbus-property-org-openbmc-Control.poll_interval">"poll_interval"</link> D-Bus property to @value.
12710 *
12711 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
12712 */
12713void
12714control_set_poll_interval (Control *object, gint value)
12715{
12716 g_object_set (G_OBJECT (object), "poll-interval", value, NULL);
12717}
12718
12719/**
12720 * control_get_heatbeat: (skip)
12721 * @object: A #Control.
12722 *
12723 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Control.heatbeat">"heatbeat"</link> D-Bus property.
12724 *
12725 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
12726 *
12727 * Returns: The property value.
12728 */
12729gint
12730control_get_heatbeat (Control *object)
12731{
12732 return CONTROL_GET_IFACE (object)->get_heatbeat (object);
12733}
12734
12735/**
12736 * control_set_heatbeat: (skip)
12737 * @object: A #Control.
12738 * @value: The value to set.
12739 *
12740 * Sets the <link linkend="gdbus-property-org-openbmc-Control.heatbeat">"heatbeat"</link> D-Bus property to @value.
12741 *
12742 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
12743 */
12744void
12745control_set_heatbeat (Control *object, gint value)
12746{
12747 g_object_set (G_OBJECT (object), "heatbeat", value, NULL);
12748}
12749
12750/**
12751 * control_emit_heartbeat:
12752 * @object: A #Control.
12753 * @arg_bus_name: Argument to pass with the signal.
12754 *
12755 * Emits the <link linkend="gdbus-signal-org-openbmc-Control.Heartbeat">"Heartbeat"</link> D-Bus signal.
12756 */
12757void
12758control_emit_heartbeat (
12759 Control *object,
12760 const gchar *arg_bus_name)
12761{
12762 g_signal_emit_by_name (object, "heartbeat", arg_bus_name);
12763}
12764
12765/**
12766 * control_emit_goto_system_state:
12767 * @object: A #Control.
12768 * @arg_state_name: Argument to pass with the signal.
12769 *
12770 * Emits the <link linkend="gdbus-signal-org-openbmc-Control.GotoSystemState">"GotoSystemState"</link> D-Bus signal.
12771 */
12772void
12773control_emit_goto_system_state (
12774 Control *object,
12775 const gchar *arg_state_name)
12776{
12777 g_signal_emit_by_name (object, "goto-system-state", arg_state_name);
12778}
12779
12780/**
12781 * control_call_init:
12782 * @proxy: A #ControlProxy.
12783 * @cancellable: (allow-none): A #GCancellable or %NULL.
12784 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
12785 * @user_data: User data to pass to @callback.
12786 *
12787 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Control.init">init()</link> D-Bus method on @proxy.
12788 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
12789 * You can then call control_call_init_finish() to get the result of the operation.
12790 *
12791 * See control_call_init_sync() for the synchronous, blocking version of this method.
12792 */
12793void
12794control_call_init (
12795 Control *proxy,
12796 GCancellable *cancellable,
12797 GAsyncReadyCallback callback,
12798 gpointer user_data)
12799{
12800 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
12801 "init",
12802 g_variant_new ("()"),
12803 G_DBUS_CALL_FLAGS_NONE,
12804 -1,
12805 cancellable,
12806 callback,
12807 user_data);
12808}
12809
12810/**
12811 * control_call_init_finish:
12812 * @proxy: A #ControlProxy.
12813 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_call_init().
12814 * @error: Return location for error or %NULL.
12815 *
12816 * Finishes an operation started with control_call_init().
12817 *
12818 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
12819 */
12820gboolean
12821control_call_init_finish (
12822 Control *proxy,
12823 GAsyncResult *res,
12824 GError **error)
12825{
12826 GVariant *_ret;
12827 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
12828 if (_ret == NULL)
12829 goto _out;
12830 g_variant_get (_ret,
12831 "()");
12832 g_variant_unref (_ret);
12833_out:
12834 return _ret != NULL;
12835}
12836
12837/**
12838 * control_call_init_sync:
12839 * @proxy: A #ControlProxy.
12840 * @cancellable: (allow-none): A #GCancellable or %NULL.
12841 * @error: Return location for error or %NULL.
12842 *
12843 * 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.
12844 *
12845 * See control_call_init() for the asynchronous version of this method.
12846 *
12847 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
12848 */
12849gboolean
12850control_call_init_sync (
12851 Control *proxy,
12852 GCancellable *cancellable,
12853 GError **error)
12854{
12855 GVariant *_ret;
12856 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
12857 "init",
12858 g_variant_new ("()"),
12859 G_DBUS_CALL_FLAGS_NONE,
12860 -1,
12861 cancellable,
12862 error);
12863 if (_ret == NULL)
12864 goto _out;
12865 g_variant_get (_ret,
12866 "()");
12867 g_variant_unref (_ret);
12868_out:
12869 return _ret != NULL;
12870}
12871
12872/**
12873 * control_complete_init:
12874 * @object: A #Control.
12875 * @invocation: (transfer full): A #GDBusMethodInvocation.
12876 *
12877 * 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.
12878 *
12879 * This method will free @invocation, you cannot use it afterwards.
12880 */
12881void
12882control_complete_init (
12883 Control *object,
12884 GDBusMethodInvocation *invocation)
12885{
12886 g_dbus_method_invocation_return_value (invocation,
12887 g_variant_new ("()"));
12888}
12889
12890/* ------------------------------------------------------------------------ */
12891
12892/**
12893 * ControlProxy:
12894 *
12895 * The #ControlProxy structure contains only private data and should only be accessed using the provided API.
12896 */
12897
12898/**
12899 * ControlProxyClass:
12900 * @parent_class: The parent class.
12901 *
12902 * Class structure for #ControlProxy.
12903 */
12904
12905struct _ControlProxyPrivate
12906{
12907 GData *qdata;
12908};
12909
12910static void control_proxy_iface_init (ControlIface *iface);
12911
12912#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
12913G_DEFINE_TYPE_WITH_CODE (ControlProxy, control_proxy, G_TYPE_DBUS_PROXY,
12914 G_ADD_PRIVATE (ControlProxy)
12915 G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_proxy_iface_init));
12916
12917#else
12918G_DEFINE_TYPE_WITH_CODE (ControlProxy, control_proxy, G_TYPE_DBUS_PROXY,
12919 G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_proxy_iface_init));
12920
12921#endif
12922static void
12923control_proxy_finalize (GObject *object)
12924{
12925 ControlProxy *proxy = CONTROL_PROXY (object);
12926 g_datalist_clear (&proxy->priv->qdata);
12927 G_OBJECT_CLASS (control_proxy_parent_class)->finalize (object);
12928}
12929
12930static void
12931control_proxy_get_property (GObject *object,
12932 guint prop_id,
12933 GValue *value,
12934 GParamSpec *pspec G_GNUC_UNUSED)
12935{
12936 const _ExtendedGDBusPropertyInfo *info;
12937 GVariant *variant;
12938 g_assert (prop_id != 0 && prop_id - 1 < 2);
12939 info = _control_property_info_pointers[prop_id - 1];
12940 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
12941 if (info->use_gvariant)
12942 {
12943 g_value_set_variant (value, variant);
12944 }
12945 else
12946 {
12947 if (variant != NULL)
12948 g_dbus_gvariant_to_gvalue (variant, value);
12949 }
12950 if (variant != NULL)
12951 g_variant_unref (variant);
12952}
12953
12954static void
12955control_proxy_set_property_cb (GDBusProxy *proxy,
12956 GAsyncResult *res,
12957 gpointer user_data)
12958{
12959 const _ExtendedGDBusPropertyInfo *info = user_data;
12960 GError *error;
12961 GVariant *_ret;
12962 error = NULL;
12963 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
12964 if (!_ret)
12965 {
12966 g_warning ("Error setting property '%s' on interface org.openbmc.Control: %s (%s, %d)",
12967 info->parent_struct.name,
12968 error->message, g_quark_to_string (error->domain), error->code);
12969 g_error_free (error);
12970 }
12971 else
12972 {
12973 g_variant_unref (_ret);
12974 }
12975}
12976
12977static void
12978control_proxy_set_property (GObject *object,
12979 guint prop_id,
12980 const GValue *value,
12981 GParamSpec *pspec G_GNUC_UNUSED)
12982{
12983 const _ExtendedGDBusPropertyInfo *info;
12984 GVariant *variant;
12985 g_assert (prop_id != 0 && prop_id - 1 < 2);
12986 info = _control_property_info_pointers[prop_id - 1];
12987 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
12988 g_dbus_proxy_call (G_DBUS_PROXY (object),
12989 "org.freedesktop.DBus.Properties.Set",
12990 g_variant_new ("(ssv)", "org.openbmc.Control", info->parent_struct.name, variant),
12991 G_DBUS_CALL_FLAGS_NONE,
12992 -1,
12993 NULL, (GAsyncReadyCallback) control_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
12994 g_variant_unref (variant);
12995}
12996
12997static void
12998control_proxy_g_signal (GDBusProxy *proxy,
12999 const gchar *sender_name G_GNUC_UNUSED,
13000 const gchar *signal_name,
13001 GVariant *parameters)
13002{
13003 _ExtendedGDBusSignalInfo *info;
13004 GVariantIter iter;
13005 GVariant *child;
13006 GValue *paramv;
13007 guint num_params;
13008 guint n;
13009 guint signal_id;
13010 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, signal_name);
13011 if (info == NULL)
13012 return;
13013 num_params = g_variant_n_children (parameters);
13014 paramv = g_new0 (GValue, num_params + 1);
13015 g_value_init (&paramv[0], TYPE_CONTROL);
13016 g_value_set_object (&paramv[0], proxy);
13017 g_variant_iter_init (&iter, parameters);
13018 n = 1;
13019 while ((child = g_variant_iter_next_value (&iter)) != NULL)
13020 {
13021 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
13022 if (arg_info->use_gvariant)
13023 {
13024 g_value_init (&paramv[n], G_TYPE_VARIANT);
13025 g_value_set_variant (&paramv[n], child);
13026 n++;
13027 }
13028 else
13029 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
13030 g_variant_unref (child);
13031 }
13032 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL);
13033 g_signal_emitv (paramv, signal_id, 0, NULL);
13034 for (n = 0; n < num_params + 1; n++)
13035 g_value_unset (&paramv[n]);
13036 g_free (paramv);
13037}
13038
13039static void
13040control_proxy_g_properties_changed (GDBusProxy *_proxy,
13041 GVariant *changed_properties,
13042 const gchar *const *invalidated_properties)
13043{
13044 ControlProxy *proxy = CONTROL_PROXY (_proxy);
13045 guint n;
13046 const gchar *key;
13047 GVariantIter *iter;
13048 _ExtendedGDBusPropertyInfo *info;
13049 g_variant_get (changed_properties, "a{sv}", &iter);
13050 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
13051 {
13052 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, key);
13053 g_datalist_remove_data (&proxy->priv->qdata, key);
13054 if (info != NULL)
13055 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
13056 }
13057 g_variant_iter_free (iter);
13058 for (n = 0; invalidated_properties[n] != NULL; n++)
13059 {
13060 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, invalidated_properties[n]);
13061 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
13062 if (info != NULL)
13063 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
13064 }
13065}
13066
13067static gint
13068control_proxy_get_poll_interval (Control *object)
13069{
13070 ControlProxy *proxy = CONTROL_PROXY (object);
13071 GVariant *variant;
13072 gint value = 0;
13073 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "poll_interval");
13074 if (variant != NULL)
13075 {
13076 value = g_variant_get_int32 (variant);
13077 g_variant_unref (variant);
13078 }
13079 return value;
13080}
13081
13082static gint
13083control_proxy_get_heatbeat (Control *object)
13084{
13085 ControlProxy *proxy = CONTROL_PROXY (object);
13086 GVariant *variant;
13087 gint value = 0;
13088 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "heatbeat");
13089 if (variant != NULL)
13090 {
13091 value = g_variant_get_int32 (variant);
13092 g_variant_unref (variant);
13093 }
13094 return value;
13095}
13096
13097static void
13098control_proxy_init (ControlProxy *proxy)
13099{
13100#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
13101 proxy->priv = control_proxy_get_instance_private (proxy);
13102#else
13103 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_PROXY, ControlProxyPrivate);
13104#endif
13105
13106 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_interface_info ());
13107}
13108
13109static void
13110control_proxy_class_init (ControlProxyClass *klass)
13111{
13112 GObjectClass *gobject_class;
13113 GDBusProxyClass *proxy_class;
13114
13115 gobject_class = G_OBJECT_CLASS (klass);
13116 gobject_class->finalize = control_proxy_finalize;
13117 gobject_class->get_property = control_proxy_get_property;
13118 gobject_class->set_property = control_proxy_set_property;
13119
13120 proxy_class = G_DBUS_PROXY_CLASS (klass);
13121 proxy_class->g_signal = control_proxy_g_signal;
13122 proxy_class->g_properties_changed = control_proxy_g_properties_changed;
13123
13124 control_override_properties (gobject_class, 1);
13125
13126#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
13127 g_type_class_add_private (klass, sizeof (ControlProxyPrivate));
13128#endif
13129}
13130
13131static void
13132control_proxy_iface_init (ControlIface *iface)
13133{
13134 iface->get_poll_interval = control_proxy_get_poll_interval;
13135 iface->get_heatbeat = control_proxy_get_heatbeat;
13136}
13137
13138/**
13139 * control_proxy_new:
13140 * @connection: A #GDBusConnection.
13141 * @flags: Flags from the #GDBusProxyFlags enumeration.
13142 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
13143 * @object_path: An object path.
13144 * @cancellable: (allow-none): A #GCancellable or %NULL.
13145 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
13146 * @user_data: User data to pass to @callback.
13147 *
13148 * 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.
13149 *
13150 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
13151 * You can then call control_proxy_new_finish() to get the result of the operation.
13152 *
13153 * See control_proxy_new_sync() for the synchronous, blocking version of this constructor.
13154 */
13155void
13156control_proxy_new (
13157 GDBusConnection *connection,
13158 GDBusProxyFlags flags,
13159 const gchar *name,
13160 const gchar *object_path,
13161 GCancellable *cancellable,
13162 GAsyncReadyCallback callback,
13163 gpointer user_data)
13164{
13165 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);
13166}
13167
13168/**
13169 * control_proxy_new_finish:
13170 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_proxy_new().
13171 * @error: Return location for error or %NULL
13172 *
13173 * Finishes an operation started with control_proxy_new().
13174 *
13175 * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set.
13176 */
13177Control *
13178control_proxy_new_finish (
13179 GAsyncResult *res,
13180 GError **error)
13181{
13182 GObject *ret;
13183 GObject *source_object;
13184 source_object = g_async_result_get_source_object (res);
13185 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
13186 g_object_unref (source_object);
13187 if (ret != NULL)
13188 return CONTROL (ret);
13189 else
13190 return NULL;
13191}
13192
13193/**
13194 * control_proxy_new_sync:
13195 * @connection: A #GDBusConnection.
13196 * @flags: Flags from the #GDBusProxyFlags enumeration.
13197 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
13198 * @object_path: An object path.
13199 * @cancellable: (allow-none): A #GCancellable or %NULL.
13200 * @error: Return location for error or %NULL
13201 *
13202 * 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.
13203 *
13204 * The calling thread is blocked until a reply is received.
13205 *
13206 * See control_proxy_new() for the asynchronous version of this constructor.
13207 *
13208 * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set.
13209 */
13210Control *
13211control_proxy_new_sync (
13212 GDBusConnection *connection,
13213 GDBusProxyFlags flags,
13214 const gchar *name,
13215 const gchar *object_path,
13216 GCancellable *cancellable,
13217 GError **error)
13218{
13219 GInitable *ret;
13220 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);
13221 if (ret != NULL)
13222 return CONTROL (ret);
13223 else
13224 return NULL;
13225}
13226
13227
13228/**
13229 * control_proxy_new_for_bus:
13230 * @bus_type: A #GBusType.
13231 * @flags: Flags from the #GDBusProxyFlags enumeration.
13232 * @name: A bus name (well-known or unique).
13233 * @object_path: An object path.
13234 * @cancellable: (allow-none): A #GCancellable or %NULL.
13235 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
13236 * @user_data: User data to pass to @callback.
13237 *
13238 * Like control_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
13239 *
13240 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
13241 * You can then call control_proxy_new_for_bus_finish() to get the result of the operation.
13242 *
13243 * See control_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
13244 */
13245void
13246control_proxy_new_for_bus (
13247 GBusType bus_type,
13248 GDBusProxyFlags flags,
13249 const gchar *name,
13250 const gchar *object_path,
13251 GCancellable *cancellable,
13252 GAsyncReadyCallback callback,
13253 gpointer user_data)
13254{
13255 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);
13256}
13257
13258/**
13259 * control_proxy_new_for_bus_finish:
13260 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_proxy_new_for_bus().
13261 * @error: Return location for error or %NULL
13262 *
13263 * Finishes an operation started with control_proxy_new_for_bus().
13264 *
13265 * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set.
13266 */
13267Control *
13268control_proxy_new_for_bus_finish (
13269 GAsyncResult *res,
13270 GError **error)
13271{
13272 GObject *ret;
13273 GObject *source_object;
13274 source_object = g_async_result_get_source_object (res);
13275 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
13276 g_object_unref (source_object);
13277 if (ret != NULL)
13278 return CONTROL (ret);
13279 else
13280 return NULL;
13281}
13282
13283/**
13284 * control_proxy_new_for_bus_sync:
13285 * @bus_type: A #GBusType.
13286 * @flags: Flags from the #GDBusProxyFlags enumeration.
13287 * @name: A bus name (well-known or unique).
13288 * @object_path: An object path.
13289 * @cancellable: (allow-none): A #GCancellable or %NULL.
13290 * @error: Return location for error or %NULL
13291 *
13292 * Like control_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
13293 *
13294 * The calling thread is blocked until a reply is received.
13295 *
13296 * See control_proxy_new_for_bus() for the asynchronous version of this constructor.
13297 *
13298 * Returns: (transfer full) (type ControlProxy): The constructed proxy object or %NULL if @error is set.
13299 */
13300Control *
13301control_proxy_new_for_bus_sync (
13302 GBusType bus_type,
13303 GDBusProxyFlags flags,
13304 const gchar *name,
13305 const gchar *object_path,
13306 GCancellable *cancellable,
13307 GError **error)
13308{
13309 GInitable *ret;
13310 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);
13311 if (ret != NULL)
13312 return CONTROL (ret);
13313 else
13314 return NULL;
13315}
13316
13317
13318/* ------------------------------------------------------------------------ */
13319
13320/**
13321 * ControlSkeleton:
13322 *
13323 * The #ControlSkeleton structure contains only private data and should only be accessed using the provided API.
13324 */
13325
13326/**
13327 * ControlSkeletonClass:
13328 * @parent_class: The parent class.
13329 *
13330 * Class structure for #ControlSkeleton.
13331 */
13332
13333struct _ControlSkeletonPrivate
13334{
13335 GValue *properties;
13336 GList *changed_properties;
13337 GSource *changed_properties_idle_source;
13338 GMainContext *context;
13339 GMutex lock;
13340};
13341
13342static void
13343_control_skeleton_handle_method_call (
13344 GDBusConnection *connection G_GNUC_UNUSED,
13345 const gchar *sender G_GNUC_UNUSED,
13346 const gchar *object_path G_GNUC_UNUSED,
13347 const gchar *interface_name,
13348 const gchar *method_name,
13349 GVariant *parameters,
13350 GDBusMethodInvocation *invocation,
13351 gpointer user_data)
13352{
13353 ControlSkeleton *skeleton = CONTROL_SKELETON (user_data);
13354 _ExtendedGDBusMethodInfo *info;
13355 GVariantIter iter;
13356 GVariant *child;
13357 GValue *paramv;
13358 guint num_params;
13359 guint num_extra;
13360 guint n;
13361 guint signal_id;
13362 GValue return_value = G_VALUE_INIT;
13363 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
13364 g_assert (info != NULL);
13365 num_params = g_variant_n_children (parameters);
13366 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
13367 n = 0;
13368 g_value_init (&paramv[n], TYPE_CONTROL);
13369 g_value_set_object (&paramv[n++], skeleton);
13370 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
13371 g_value_set_object (&paramv[n++], invocation);
13372 if (info->pass_fdlist)
13373 {
13374#ifdef G_OS_UNIX
13375 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
13376 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
13377#else
13378 g_assert_not_reached ();
13379#endif
13380 }
13381 g_variant_iter_init (&iter, parameters);
13382 while ((child = g_variant_iter_next_value (&iter)) != NULL)
13383 {
13384 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
13385 if (arg_info->use_gvariant)
13386 {
13387 g_value_init (&paramv[n], G_TYPE_VARIANT);
13388 g_value_set_variant (&paramv[n], child);
13389 n++;
13390 }
13391 else
13392 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
13393 g_variant_unref (child);
13394 }
13395 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL);
13396 g_value_init (&return_value, G_TYPE_BOOLEAN);
13397 g_signal_emitv (paramv, signal_id, 0, &return_value);
13398 if (!g_value_get_boolean (&return_value))
13399 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);
13400 g_value_unset (&return_value);
13401 for (n = 0; n < num_params + num_extra; n++)
13402 g_value_unset (&paramv[n]);
13403 g_free (paramv);
13404}
13405
13406static GVariant *
13407_control_skeleton_handle_get_property (
13408 GDBusConnection *connection G_GNUC_UNUSED,
13409 const gchar *sender G_GNUC_UNUSED,
13410 const gchar *object_path G_GNUC_UNUSED,
13411 const gchar *interface_name G_GNUC_UNUSED,
13412 const gchar *property_name,
13413 GError **error,
13414 gpointer user_data)
13415{
13416 ControlSkeleton *skeleton = CONTROL_SKELETON (user_data);
13417 GValue value = G_VALUE_INIT;
13418 GParamSpec *pspec;
13419 _ExtendedGDBusPropertyInfo *info;
13420 GVariant *ret;
13421 ret = NULL;
13422 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, property_name);
13423 g_assert (info != NULL);
13424 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
13425 if (pspec == NULL)
13426 {
13427 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
13428 }
13429 else
13430 {
13431 g_value_init (&value, pspec->value_type);
13432 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
13433 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
13434 g_value_unset (&value);
13435 }
13436 return ret;
13437}
13438
13439static gboolean
13440_control_skeleton_handle_set_property (
13441 GDBusConnection *connection G_GNUC_UNUSED,
13442 const gchar *sender G_GNUC_UNUSED,
13443 const gchar *object_path G_GNUC_UNUSED,
13444 const gchar *interface_name G_GNUC_UNUSED,
13445 const gchar *property_name,
13446 GVariant *variant,
13447 GError **error,
13448 gpointer user_data)
13449{
13450 ControlSkeleton *skeleton = CONTROL_SKELETON (user_data);
13451 GValue value = G_VALUE_INIT;
13452 GParamSpec *pspec;
13453 _ExtendedGDBusPropertyInfo *info;
13454 gboolean ret;
13455 ret = FALSE;
13456 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_interface_info.parent_struct, property_name);
13457 g_assert (info != NULL);
13458 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
13459 if (pspec == NULL)
13460 {
13461 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
13462 }
13463 else
13464 {
13465 if (info->use_gvariant)
13466 g_value_set_variant (&value, variant);
13467 else
13468 g_dbus_gvariant_to_gvalue (variant, &value);
13469 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
13470 g_value_unset (&value);
13471 ret = TRUE;
13472 }
13473 return ret;
13474}
13475
13476static const GDBusInterfaceVTable _control_skeleton_vtable =
13477{
13478 _control_skeleton_handle_method_call,
13479 _control_skeleton_handle_get_property,
13480 _control_skeleton_handle_set_property,
13481 {NULL}
13482};
13483
13484static GDBusInterfaceInfo *
13485control_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
13486{
13487 return control_interface_info ();
13488}
13489
13490static GDBusInterfaceVTable *
13491control_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
13492{
13493 return (GDBusInterfaceVTable *) &_control_skeleton_vtable;
13494}
13495
13496static GVariant *
13497control_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
13498{
13499 ControlSkeleton *skeleton = CONTROL_SKELETON (_skeleton);
13500
13501 GVariantBuilder builder;
13502 guint n;
13503 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
13504 if (_control_interface_info.parent_struct.properties == NULL)
13505 goto out;
13506 for (n = 0; _control_interface_info.parent_struct.properties[n] != NULL; n++)
13507 {
13508 GDBusPropertyInfo *info = _control_interface_info.parent_struct.properties[n];
13509 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
13510 {
13511 GVariant *value;
13512 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);
13513 if (value != NULL)
13514 {
13515 g_variant_take_ref (value);
13516 g_variant_builder_add (&builder, "{sv}", info->name, value);
13517 g_variant_unref (value);
13518 }
13519 }
13520 }
13521out:
13522 return g_variant_builder_end (&builder);
13523}
13524
13525static gboolean _control_emit_changed (gpointer user_data);
13526
13527static void
13528control_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
13529{
13530 ControlSkeleton *skeleton = CONTROL_SKELETON (_skeleton);
13531 gboolean emit_changed = FALSE;
13532
13533 g_mutex_lock (&skeleton->priv->lock);
13534 if (skeleton->priv->changed_properties_idle_source != NULL)
13535 {
13536 g_source_destroy (skeleton->priv->changed_properties_idle_source);
13537 skeleton->priv->changed_properties_idle_source = NULL;
13538 emit_changed = TRUE;
13539 }
13540 g_mutex_unlock (&skeleton->priv->lock);
13541
13542 if (emit_changed)
13543 _control_emit_changed (skeleton);
13544}
13545
13546static void
13547_control_on_signal_heartbeat (
13548 Control *object,
13549 const gchar *arg_bus_name)
13550{
13551 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
13552
13553 GList *connections, *l;
13554 GVariant *signal_variant;
13555 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
13556
13557 signal_variant = g_variant_ref_sink (g_variant_new ("(s)",
13558 arg_bus_name));
13559 for (l = connections; l != NULL; l = l->next)
13560 {
13561 GDBusConnection *connection = l->data;
13562 g_dbus_connection_emit_signal (connection,
13563 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Control", "Heartbeat",
13564 signal_variant, NULL);
13565 }
13566 g_variant_unref (signal_variant);
13567 g_list_free_full (connections, g_object_unref);
13568}
13569
13570static void
13571_control_on_signal_goto_system_state (
13572 Control *object,
13573 const gchar *arg_state_name)
13574{
13575 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
13576
13577 GList *connections, *l;
13578 GVariant *signal_variant;
13579 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
13580
13581 signal_variant = g_variant_ref_sink (g_variant_new ("(s)",
13582 arg_state_name));
13583 for (l = connections; l != NULL; l = l->next)
13584 {
13585 GDBusConnection *connection = l->data;
13586 g_dbus_connection_emit_signal (connection,
13587 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Control", "GotoSystemState",
13588 signal_variant, NULL);
13589 }
13590 g_variant_unref (signal_variant);
13591 g_list_free_full (connections, g_object_unref);
13592}
13593
13594static void control_skeleton_iface_init (ControlIface *iface);
13595#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
13596G_DEFINE_TYPE_WITH_CODE (ControlSkeleton, control_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
13597 G_ADD_PRIVATE (ControlSkeleton)
13598 G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_skeleton_iface_init));
13599
13600#else
13601G_DEFINE_TYPE_WITH_CODE (ControlSkeleton, control_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
13602 G_IMPLEMENT_INTERFACE (TYPE_CONTROL, control_skeleton_iface_init));
13603
13604#endif
13605static void
13606control_skeleton_finalize (GObject *object)
13607{
13608 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
13609 guint n;
13610 for (n = 0; n < 2; n++)
13611 g_value_unset (&skeleton->priv->properties[n]);
13612 g_free (skeleton->priv->properties);
13613 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
13614 if (skeleton->priv->changed_properties_idle_source != NULL)
13615 g_source_destroy (skeleton->priv->changed_properties_idle_source);
13616 g_main_context_unref (skeleton->priv->context);
13617 g_mutex_clear (&skeleton->priv->lock);
13618 G_OBJECT_CLASS (control_skeleton_parent_class)->finalize (object);
13619}
13620
13621static void
13622control_skeleton_get_property (GObject *object,
13623 guint prop_id,
13624 GValue *value,
13625 GParamSpec *pspec G_GNUC_UNUSED)
13626{
13627 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
13628 g_assert (prop_id != 0 && prop_id - 1 < 2);
13629 g_mutex_lock (&skeleton->priv->lock);
13630 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
13631 g_mutex_unlock (&skeleton->priv->lock);
13632}
13633
13634static gboolean
13635_control_emit_changed (gpointer user_data)
13636{
13637 ControlSkeleton *skeleton = CONTROL_SKELETON (user_data);
13638 GList *l;
13639 GVariantBuilder builder;
13640 GVariantBuilder invalidated_builder;
13641 guint num_changes;
13642
13643 g_mutex_lock (&skeleton->priv->lock);
13644 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
13645 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
13646 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
13647 {
13648 ChangedProperty *cp = l->data;
13649 GVariant *variant;
13650 const GValue *cur_value;
13651
13652 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
13653 if (!_g_value_equal (cur_value, &cp->orig_value))
13654 {
13655 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
13656 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
13657 g_variant_unref (variant);
13658 num_changes++;
13659 }
13660 }
13661 if (num_changes > 0)
13662 {
13663 GList *connections, *ll;
13664 GVariant *signal_variant;
13665 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Control",
13666 &builder, &invalidated_builder));
13667 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
13668 for (ll = connections; ll != NULL; ll = ll->next)
13669 {
13670 GDBusConnection *connection = ll->data;
13671
13672 g_dbus_connection_emit_signal (connection,
13673 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
13674 "org.freedesktop.DBus.Properties",
13675 "PropertiesChanged",
13676 signal_variant,
13677 NULL);
13678 }
13679 g_variant_unref (signal_variant);
13680 g_list_free_full (connections, g_object_unref);
13681 }
13682 else
13683 {
13684 g_variant_builder_clear (&builder);
13685 g_variant_builder_clear (&invalidated_builder);
13686 }
13687 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
13688 skeleton->priv->changed_properties = NULL;
13689 skeleton->priv->changed_properties_idle_source = NULL;
13690 g_mutex_unlock (&skeleton->priv->lock);
13691 return FALSE;
13692}
13693
13694static void
13695_control_schedule_emit_changed (ControlSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
13696{
13697 ChangedProperty *cp;
13698 GList *l;
13699 cp = NULL;
13700 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
13701 {
13702 ChangedProperty *i_cp = l->data;
13703 if (i_cp->info == info)
13704 {
13705 cp = i_cp;
13706 break;
13707 }
13708 }
13709 if (cp == NULL)
13710 {
13711 cp = g_new0 (ChangedProperty, 1);
13712 cp->prop_id = prop_id;
13713 cp->info = info;
13714 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
13715 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
13716 g_value_copy (orig_value, &cp->orig_value);
13717 }
13718}
13719
13720static void
13721control_skeleton_notify (GObject *object,
13722 GParamSpec *pspec G_GNUC_UNUSED)
13723{
13724 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
13725 g_mutex_lock (&skeleton->priv->lock);
13726 if (skeleton->priv->changed_properties != NULL &&
13727 skeleton->priv->changed_properties_idle_source == NULL)
13728 {
13729 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
13730 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
13731 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _control_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
Adriana Kobylak2cb27752015-10-19 16:23:14 -050013732 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _control_emit_changed");
Norman James362a80f2015-09-14 14:04:39 -050013733 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
13734 g_source_unref (skeleton->priv->changed_properties_idle_source);
13735 }
13736 g_mutex_unlock (&skeleton->priv->lock);
13737}
13738
13739static void
13740control_skeleton_set_property (GObject *object,
13741 guint prop_id,
13742 const GValue *value,
13743 GParamSpec *pspec)
13744{
13745 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
13746 g_assert (prop_id != 0 && prop_id - 1 < 2);
13747 g_mutex_lock (&skeleton->priv->lock);
13748 g_object_freeze_notify (object);
13749 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
13750 {
13751 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
13752 _control_schedule_emit_changed (skeleton, _control_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
13753 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
13754 g_object_notify_by_pspec (object, pspec);
13755 }
13756 g_mutex_unlock (&skeleton->priv->lock);
13757 g_object_thaw_notify (object);
13758}
13759
13760static void
13761control_skeleton_init (ControlSkeleton *skeleton)
13762{
13763#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
13764 skeleton->priv = control_skeleton_get_instance_private (skeleton);
13765#else
13766 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_SKELETON, ControlSkeletonPrivate);
13767#endif
13768
13769 g_mutex_init (&skeleton->priv->lock);
13770 skeleton->priv->context = g_main_context_ref_thread_default ();
13771 skeleton->priv->properties = g_new0 (GValue, 2);
13772 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
13773 g_value_init (&skeleton->priv->properties[1], G_TYPE_INT);
13774}
13775
13776static gint
13777control_skeleton_get_poll_interval (Control *object)
13778{
13779 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
13780 gint value;
13781 g_mutex_lock (&skeleton->priv->lock);
13782 value = g_value_get_int (&(skeleton->priv->properties[0]));
13783 g_mutex_unlock (&skeleton->priv->lock);
13784 return value;
13785}
13786
13787static gint
13788control_skeleton_get_heatbeat (Control *object)
13789{
13790 ControlSkeleton *skeleton = CONTROL_SKELETON (object);
13791 gint value;
13792 g_mutex_lock (&skeleton->priv->lock);
13793 value = g_value_get_int (&(skeleton->priv->properties[1]));
13794 g_mutex_unlock (&skeleton->priv->lock);
13795 return value;
13796}
13797
13798static void
13799control_skeleton_class_init (ControlSkeletonClass *klass)
13800{
13801 GObjectClass *gobject_class;
13802 GDBusInterfaceSkeletonClass *skeleton_class;
13803
13804 gobject_class = G_OBJECT_CLASS (klass);
13805 gobject_class->finalize = control_skeleton_finalize;
13806 gobject_class->get_property = control_skeleton_get_property;
13807 gobject_class->set_property = control_skeleton_set_property;
13808 gobject_class->notify = control_skeleton_notify;
13809
13810
13811 control_override_properties (gobject_class, 1);
13812
13813 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
13814 skeleton_class->get_info = control_skeleton_dbus_interface_get_info;
13815 skeleton_class->get_properties = control_skeleton_dbus_interface_get_properties;
13816 skeleton_class->flush = control_skeleton_dbus_interface_flush;
13817 skeleton_class->get_vtable = control_skeleton_dbus_interface_get_vtable;
13818
13819#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
13820 g_type_class_add_private (klass, sizeof (ControlSkeletonPrivate));
13821#endif
13822}
13823
13824static void
13825control_skeleton_iface_init (ControlIface *iface)
13826{
13827 iface->heartbeat = _control_on_signal_heartbeat;
13828 iface->goto_system_state = _control_on_signal_goto_system_state;
13829 iface->get_poll_interval = control_skeleton_get_poll_interval;
13830 iface->get_heatbeat = control_skeleton_get_heatbeat;
13831}
13832
13833/**
13834 * control_skeleton_new:
13835 *
13836 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Control.top_of_page">org.openbmc.Control</link>.
13837 *
13838 * Returns: (transfer full) (type ControlSkeleton): The skeleton object.
13839 */
13840Control *
13841control_skeleton_new (void)
13842{
13843 return CONTROL (g_object_new (TYPE_CONTROL_SKELETON, NULL));
13844}
13845
13846/* ------------------------------------------------------------------------
13847 * Code for interface org.openbmc.control.Bmc
13848 * ------------------------------------------------------------------------
13849 */
13850
13851/**
13852 * SECTION:ControlBmc
13853 * @title: ControlBmc
13854 * @short_description: Generated C code for the org.openbmc.control.Bmc D-Bus interface
13855 *
13856 * 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.
13857 */
13858
13859/* ---- Introspection data for org.openbmc.control.Bmc ---- */
13860
13861static const _ExtendedGDBusMethodInfo _control_bmc_method_info_place_holder =
13862{
13863 {
13864 -1,
13865 (gchar *) "place_holder",
13866 NULL,
13867 NULL,
13868 NULL
13869 },
13870 "handle-place-holder",
13871 FALSE
13872};
13873
13874static const _ExtendedGDBusMethodInfo * const _control_bmc_method_info_pointers[] =
13875{
13876 &_control_bmc_method_info_place_holder,
13877 NULL
13878};
13879
13880static const _ExtendedGDBusInterfaceInfo _control_bmc_interface_info =
13881{
13882 {
13883 -1,
13884 (gchar *) "org.openbmc.control.Bmc",
13885 (GDBusMethodInfo **) &_control_bmc_method_info_pointers,
13886 NULL,
13887 NULL,
13888 NULL
13889 },
13890 "control-bmc",
13891};
13892
13893
13894/**
13895 * control_bmc_interface_info:
13896 *
13897 * 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.
13898 *
13899 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
13900 */
13901GDBusInterfaceInfo *
13902control_bmc_interface_info (void)
13903{
13904 return (GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct;
13905}
13906
13907/**
13908 * control_bmc_override_properties:
13909 * @klass: The class structure for a #GObject<!-- -->-derived class.
13910 * @property_id_begin: The property id to assign to the first overridden property.
13911 *
13912 * Overrides all #GObject properties in the #ControlBmc interface for a concrete class.
13913 * The properties are overridden in the order they are defined.
13914 *
13915 * Returns: The last property id.
13916 */
13917guint
13918control_bmc_override_properties (GObjectClass *klass, guint property_id_begin)
13919{
13920 return property_id_begin - 1;
13921}
13922
13923
13924
13925/**
13926 * ControlBmc:
13927 *
13928 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Bmc.top_of_page">org.openbmc.control.Bmc</link>.
13929 */
13930
13931/**
13932 * ControlBmcIface:
13933 * @parent_iface: The parent interface.
13934 * @handle_place_holder: Handler for the #ControlBmc::handle-place-holder signal.
13935 *
13936 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Bmc.top_of_page">org.openbmc.control.Bmc</link>.
13937 */
13938
13939typedef ControlBmcIface ControlBmcInterface;
13940G_DEFINE_INTERFACE (ControlBmc, control_bmc, G_TYPE_OBJECT);
13941
13942static void
13943control_bmc_default_init (ControlBmcIface *iface)
13944{
13945 /* GObject signals for incoming D-Bus method calls: */
13946 /**
13947 * ControlBmc::handle-place-holder:
13948 * @object: A #ControlBmc.
13949 * @invocation: A #GDBusMethodInvocation.
13950 *
13951 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Bmc.place_holder">place_holder()</link> D-Bus method.
13952 *
13953 * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call control_bmc_complete_place_holder() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
13954 *
13955 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
13956 */
13957 g_signal_new ("handle-place-holder",
13958 G_TYPE_FROM_INTERFACE (iface),
13959 G_SIGNAL_RUN_LAST,
13960 G_STRUCT_OFFSET (ControlBmcIface, handle_place_holder),
13961 g_signal_accumulator_true_handled,
13962 NULL,
13963 g_cclosure_marshal_generic,
13964 G_TYPE_BOOLEAN,
13965 1,
13966 G_TYPE_DBUS_METHOD_INVOCATION);
13967
13968}
13969
13970/**
13971 * control_bmc_call_place_holder:
13972 * @proxy: A #ControlBmcProxy.
13973 * @cancellable: (allow-none): A #GCancellable or %NULL.
13974 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
13975 * @user_data: User data to pass to @callback.
13976 *
13977 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Bmc.place_holder">place_holder()</link> D-Bus method on @proxy.
13978 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
13979 * You can then call control_bmc_call_place_holder_finish() to get the result of the operation.
13980 *
13981 * See control_bmc_call_place_holder_sync() for the synchronous, blocking version of this method.
13982 */
13983void
13984control_bmc_call_place_holder (
13985 ControlBmc *proxy,
13986 GCancellable *cancellable,
13987 GAsyncReadyCallback callback,
13988 gpointer user_data)
13989{
13990 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
13991 "place_holder",
13992 g_variant_new ("()"),
13993 G_DBUS_CALL_FLAGS_NONE,
13994 -1,
13995 cancellable,
13996 callback,
13997 user_data);
13998}
13999
14000/**
14001 * control_bmc_call_place_holder_finish:
14002 * @proxy: A #ControlBmcProxy.
14003 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_bmc_call_place_holder().
14004 * @error: Return location for error or %NULL.
14005 *
14006 * Finishes an operation started with control_bmc_call_place_holder().
14007 *
14008 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
14009 */
14010gboolean
14011control_bmc_call_place_holder_finish (
14012 ControlBmc *proxy,
14013 GAsyncResult *res,
14014 GError **error)
14015{
14016 GVariant *_ret;
14017 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
14018 if (_ret == NULL)
14019 goto _out;
14020 g_variant_get (_ret,
14021 "()");
14022 g_variant_unref (_ret);
14023_out:
14024 return _ret != NULL;
14025}
14026
14027/**
14028 * control_bmc_call_place_holder_sync:
14029 * @proxy: A #ControlBmcProxy.
14030 * @cancellable: (allow-none): A #GCancellable or %NULL.
14031 * @error: Return location for error or %NULL.
14032 *
14033 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Bmc.place_holder">place_holder()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
14034 *
14035 * See control_bmc_call_place_holder() for the asynchronous version of this method.
14036 *
14037 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
14038 */
14039gboolean
14040control_bmc_call_place_holder_sync (
14041 ControlBmc *proxy,
14042 GCancellable *cancellable,
14043 GError **error)
14044{
14045 GVariant *_ret;
14046 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
14047 "place_holder",
14048 g_variant_new ("()"),
14049 G_DBUS_CALL_FLAGS_NONE,
14050 -1,
14051 cancellable,
14052 error);
14053 if (_ret == NULL)
14054 goto _out;
14055 g_variant_get (_ret,
14056 "()");
14057 g_variant_unref (_ret);
14058_out:
14059 return _ret != NULL;
14060}
14061
14062/**
14063 * control_bmc_complete_place_holder:
14064 * @object: A #ControlBmc.
14065 * @invocation: (transfer full): A #GDBusMethodInvocation.
14066 *
14067 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-control-Bmc.place_holder">place_holder()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
14068 *
14069 * This method will free @invocation, you cannot use it afterwards.
14070 */
14071void
14072control_bmc_complete_place_holder (
14073 ControlBmc *object,
14074 GDBusMethodInvocation *invocation)
14075{
14076 g_dbus_method_invocation_return_value (invocation,
14077 g_variant_new ("()"));
14078}
14079
14080/* ------------------------------------------------------------------------ */
14081
14082/**
14083 * ControlBmcProxy:
14084 *
14085 * The #ControlBmcProxy structure contains only private data and should only be accessed using the provided API.
14086 */
14087
14088/**
14089 * ControlBmcProxyClass:
14090 * @parent_class: The parent class.
14091 *
14092 * Class structure for #ControlBmcProxy.
14093 */
14094
14095struct _ControlBmcProxyPrivate
14096{
14097 GData *qdata;
14098};
14099
14100static void control_bmc_proxy_iface_init (ControlBmcIface *iface);
14101
14102#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
14103G_DEFINE_TYPE_WITH_CODE (ControlBmcProxy, control_bmc_proxy, G_TYPE_DBUS_PROXY,
14104 G_ADD_PRIVATE (ControlBmcProxy)
14105 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_BMC, control_bmc_proxy_iface_init));
14106
14107#else
14108G_DEFINE_TYPE_WITH_CODE (ControlBmcProxy, control_bmc_proxy, G_TYPE_DBUS_PROXY,
14109 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_BMC, control_bmc_proxy_iface_init));
14110
14111#endif
14112static void
14113control_bmc_proxy_finalize (GObject *object)
14114{
14115 ControlBmcProxy *proxy = CONTROL_BMC_PROXY (object);
14116 g_datalist_clear (&proxy->priv->qdata);
14117 G_OBJECT_CLASS (control_bmc_proxy_parent_class)->finalize (object);
14118}
14119
14120static void
14121control_bmc_proxy_get_property (GObject *object,
14122 guint prop_id,
14123 GValue *value,
14124 GParamSpec *pspec G_GNUC_UNUSED)
14125{
14126}
14127
14128static void
14129control_bmc_proxy_set_property (GObject *object,
14130 guint prop_id,
14131 const GValue *value,
14132 GParamSpec *pspec G_GNUC_UNUSED)
14133{
14134}
14135
14136static void
14137control_bmc_proxy_g_signal (GDBusProxy *proxy,
14138 const gchar *sender_name G_GNUC_UNUSED,
14139 const gchar *signal_name,
14140 GVariant *parameters)
14141{
14142 _ExtendedGDBusSignalInfo *info;
14143 GVariantIter iter;
14144 GVariant *child;
14145 GValue *paramv;
14146 guint num_params;
14147 guint n;
14148 guint signal_id;
14149 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, signal_name);
14150 if (info == NULL)
14151 return;
14152 num_params = g_variant_n_children (parameters);
14153 paramv = g_new0 (GValue, num_params + 1);
14154 g_value_init (&paramv[0], TYPE_CONTROL_BMC);
14155 g_value_set_object (&paramv[0], proxy);
14156 g_variant_iter_init (&iter, parameters);
14157 n = 1;
14158 while ((child = g_variant_iter_next_value (&iter)) != NULL)
14159 {
14160 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
14161 if (arg_info->use_gvariant)
14162 {
14163 g_value_init (&paramv[n], G_TYPE_VARIANT);
14164 g_value_set_variant (&paramv[n], child);
14165 n++;
14166 }
14167 else
14168 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
14169 g_variant_unref (child);
14170 }
14171 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_BMC);
14172 g_signal_emitv (paramv, signal_id, 0, NULL);
14173 for (n = 0; n < num_params + 1; n++)
14174 g_value_unset (&paramv[n]);
14175 g_free (paramv);
14176}
14177
14178static void
14179control_bmc_proxy_g_properties_changed (GDBusProxy *_proxy,
14180 GVariant *changed_properties,
14181 const gchar *const *invalidated_properties)
14182{
14183 ControlBmcProxy *proxy = CONTROL_BMC_PROXY (_proxy);
14184 guint n;
14185 const gchar *key;
14186 GVariantIter *iter;
14187 _ExtendedGDBusPropertyInfo *info;
14188 g_variant_get (changed_properties, "a{sv}", &iter);
14189 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
14190 {
14191 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, key);
14192 g_datalist_remove_data (&proxy->priv->qdata, key);
14193 if (info != NULL)
14194 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
14195 }
14196 g_variant_iter_free (iter);
14197 for (n = 0; invalidated_properties[n] != NULL; n++)
14198 {
14199 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, invalidated_properties[n]);
14200 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
14201 if (info != NULL)
14202 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
14203 }
14204}
14205
14206static void
14207control_bmc_proxy_init (ControlBmcProxy *proxy)
14208{
14209#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
14210 proxy->priv = control_bmc_proxy_get_instance_private (proxy);
14211#else
14212 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_BMC_PROXY, ControlBmcProxyPrivate);
14213#endif
14214
14215 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_bmc_interface_info ());
14216}
14217
14218static void
14219control_bmc_proxy_class_init (ControlBmcProxyClass *klass)
14220{
14221 GObjectClass *gobject_class;
14222 GDBusProxyClass *proxy_class;
14223
14224 gobject_class = G_OBJECT_CLASS (klass);
14225 gobject_class->finalize = control_bmc_proxy_finalize;
14226 gobject_class->get_property = control_bmc_proxy_get_property;
14227 gobject_class->set_property = control_bmc_proxy_set_property;
14228
14229 proxy_class = G_DBUS_PROXY_CLASS (klass);
14230 proxy_class->g_signal = control_bmc_proxy_g_signal;
14231 proxy_class->g_properties_changed = control_bmc_proxy_g_properties_changed;
14232
14233#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
14234 g_type_class_add_private (klass, sizeof (ControlBmcProxyPrivate));
14235#endif
14236}
14237
14238static void
14239control_bmc_proxy_iface_init (ControlBmcIface *iface)
14240{
14241}
14242
14243/**
14244 * control_bmc_proxy_new:
14245 * @connection: A #GDBusConnection.
14246 * @flags: Flags from the #GDBusProxyFlags enumeration.
14247 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
14248 * @object_path: An object path.
14249 * @cancellable: (allow-none): A #GCancellable or %NULL.
14250 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
14251 * @user_data: User data to pass to @callback.
14252 *
14253 * 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.
14254 *
14255 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
14256 * You can then call control_bmc_proxy_new_finish() to get the result of the operation.
14257 *
14258 * See control_bmc_proxy_new_sync() for the synchronous, blocking version of this constructor.
14259 */
14260void
14261control_bmc_proxy_new (
14262 GDBusConnection *connection,
14263 GDBusProxyFlags flags,
14264 const gchar *name,
14265 const gchar *object_path,
14266 GCancellable *cancellable,
14267 GAsyncReadyCallback callback,
14268 gpointer user_data)
14269{
14270 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);
14271}
14272
14273/**
14274 * control_bmc_proxy_new_finish:
14275 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_bmc_proxy_new().
14276 * @error: Return location for error or %NULL
14277 *
14278 * Finishes an operation started with control_bmc_proxy_new().
14279 *
14280 * Returns: (transfer full) (type ControlBmcProxy): The constructed proxy object or %NULL if @error is set.
14281 */
14282ControlBmc *
14283control_bmc_proxy_new_finish (
14284 GAsyncResult *res,
14285 GError **error)
14286{
14287 GObject *ret;
14288 GObject *source_object;
14289 source_object = g_async_result_get_source_object (res);
14290 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
14291 g_object_unref (source_object);
14292 if (ret != NULL)
14293 return CONTROL_BMC (ret);
14294 else
14295 return NULL;
14296}
14297
14298/**
14299 * control_bmc_proxy_new_sync:
14300 * @connection: A #GDBusConnection.
14301 * @flags: Flags from the #GDBusProxyFlags enumeration.
14302 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
14303 * @object_path: An object path.
14304 * @cancellable: (allow-none): A #GCancellable or %NULL.
14305 * @error: Return location for error or %NULL
14306 *
14307 * 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.
14308 *
14309 * The calling thread is blocked until a reply is received.
14310 *
14311 * See control_bmc_proxy_new() for the asynchronous version of this constructor.
14312 *
14313 * Returns: (transfer full) (type ControlBmcProxy): The constructed proxy object or %NULL if @error is set.
14314 */
14315ControlBmc *
14316control_bmc_proxy_new_sync (
14317 GDBusConnection *connection,
14318 GDBusProxyFlags flags,
14319 const gchar *name,
14320 const gchar *object_path,
14321 GCancellable *cancellable,
14322 GError **error)
14323{
14324 GInitable *ret;
14325 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);
14326 if (ret != NULL)
14327 return CONTROL_BMC (ret);
14328 else
14329 return NULL;
14330}
14331
14332
14333/**
14334 * control_bmc_proxy_new_for_bus:
14335 * @bus_type: A #GBusType.
14336 * @flags: Flags from the #GDBusProxyFlags enumeration.
14337 * @name: A bus name (well-known or unique).
14338 * @object_path: An object path.
14339 * @cancellable: (allow-none): A #GCancellable or %NULL.
14340 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
14341 * @user_data: User data to pass to @callback.
14342 *
14343 * Like control_bmc_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
14344 *
14345 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
14346 * You can then call control_bmc_proxy_new_for_bus_finish() to get the result of the operation.
14347 *
14348 * See control_bmc_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
14349 */
14350void
14351control_bmc_proxy_new_for_bus (
14352 GBusType bus_type,
14353 GDBusProxyFlags flags,
14354 const gchar *name,
14355 const gchar *object_path,
14356 GCancellable *cancellable,
14357 GAsyncReadyCallback callback,
14358 gpointer user_data)
14359{
14360 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);
14361}
14362
14363/**
14364 * control_bmc_proxy_new_for_bus_finish:
14365 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_bmc_proxy_new_for_bus().
14366 * @error: Return location for error or %NULL
14367 *
14368 * Finishes an operation started with control_bmc_proxy_new_for_bus().
14369 *
14370 * Returns: (transfer full) (type ControlBmcProxy): The constructed proxy object or %NULL if @error is set.
14371 */
14372ControlBmc *
14373control_bmc_proxy_new_for_bus_finish (
14374 GAsyncResult *res,
14375 GError **error)
14376{
14377 GObject *ret;
14378 GObject *source_object;
14379 source_object = g_async_result_get_source_object (res);
14380 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
14381 g_object_unref (source_object);
14382 if (ret != NULL)
14383 return CONTROL_BMC (ret);
14384 else
14385 return NULL;
14386}
14387
14388/**
14389 * control_bmc_proxy_new_for_bus_sync:
14390 * @bus_type: A #GBusType.
14391 * @flags: Flags from the #GDBusProxyFlags enumeration.
14392 * @name: A bus name (well-known or unique).
14393 * @object_path: An object path.
14394 * @cancellable: (allow-none): A #GCancellable or %NULL.
14395 * @error: Return location for error or %NULL
14396 *
14397 * Like control_bmc_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
14398 *
14399 * The calling thread is blocked until a reply is received.
14400 *
14401 * See control_bmc_proxy_new_for_bus() for the asynchronous version of this constructor.
14402 *
14403 * Returns: (transfer full) (type ControlBmcProxy): The constructed proxy object or %NULL if @error is set.
14404 */
14405ControlBmc *
14406control_bmc_proxy_new_for_bus_sync (
14407 GBusType bus_type,
14408 GDBusProxyFlags flags,
14409 const gchar *name,
14410 const gchar *object_path,
14411 GCancellable *cancellable,
14412 GError **error)
14413{
14414 GInitable *ret;
14415 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);
14416 if (ret != NULL)
14417 return CONTROL_BMC (ret);
14418 else
14419 return NULL;
14420}
14421
14422
14423/* ------------------------------------------------------------------------ */
14424
14425/**
14426 * ControlBmcSkeleton:
14427 *
14428 * The #ControlBmcSkeleton structure contains only private data and should only be accessed using the provided API.
14429 */
14430
14431/**
14432 * ControlBmcSkeletonClass:
14433 * @parent_class: The parent class.
14434 *
14435 * Class structure for #ControlBmcSkeleton.
14436 */
14437
14438struct _ControlBmcSkeletonPrivate
14439{
14440 GValue *properties;
14441 GList *changed_properties;
14442 GSource *changed_properties_idle_source;
14443 GMainContext *context;
14444 GMutex lock;
14445};
14446
14447static void
14448_control_bmc_skeleton_handle_method_call (
14449 GDBusConnection *connection G_GNUC_UNUSED,
14450 const gchar *sender G_GNUC_UNUSED,
14451 const gchar *object_path G_GNUC_UNUSED,
14452 const gchar *interface_name,
14453 const gchar *method_name,
14454 GVariant *parameters,
14455 GDBusMethodInvocation *invocation,
14456 gpointer user_data)
14457{
14458 ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (user_data);
14459 _ExtendedGDBusMethodInfo *info;
14460 GVariantIter iter;
14461 GVariant *child;
14462 GValue *paramv;
14463 guint num_params;
14464 guint num_extra;
14465 guint n;
14466 guint signal_id;
14467 GValue return_value = G_VALUE_INIT;
14468 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
14469 g_assert (info != NULL);
14470 num_params = g_variant_n_children (parameters);
14471 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
14472 n = 0;
14473 g_value_init (&paramv[n], TYPE_CONTROL_BMC);
14474 g_value_set_object (&paramv[n++], skeleton);
14475 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
14476 g_value_set_object (&paramv[n++], invocation);
14477 if (info->pass_fdlist)
14478 {
14479#ifdef G_OS_UNIX
14480 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
14481 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
14482#else
14483 g_assert_not_reached ();
14484#endif
14485 }
14486 g_variant_iter_init (&iter, parameters);
14487 while ((child = g_variant_iter_next_value (&iter)) != NULL)
14488 {
14489 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
14490 if (arg_info->use_gvariant)
14491 {
14492 g_value_init (&paramv[n], G_TYPE_VARIANT);
14493 g_value_set_variant (&paramv[n], child);
14494 n++;
14495 }
14496 else
14497 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
14498 g_variant_unref (child);
14499 }
14500 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_BMC);
14501 g_value_init (&return_value, G_TYPE_BOOLEAN);
14502 g_signal_emitv (paramv, signal_id, 0, &return_value);
14503 if (!g_value_get_boolean (&return_value))
14504 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);
14505 g_value_unset (&return_value);
14506 for (n = 0; n < num_params + num_extra; n++)
14507 g_value_unset (&paramv[n]);
14508 g_free (paramv);
14509}
14510
14511static GVariant *
14512_control_bmc_skeleton_handle_get_property (
14513 GDBusConnection *connection G_GNUC_UNUSED,
14514 const gchar *sender G_GNUC_UNUSED,
14515 const gchar *object_path G_GNUC_UNUSED,
14516 const gchar *interface_name G_GNUC_UNUSED,
14517 const gchar *property_name,
14518 GError **error,
14519 gpointer user_data)
14520{
14521 ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (user_data);
14522 GValue value = G_VALUE_INIT;
14523 GParamSpec *pspec;
14524 _ExtendedGDBusPropertyInfo *info;
14525 GVariant *ret;
14526 ret = NULL;
14527 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, property_name);
14528 g_assert (info != NULL);
14529 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
14530 if (pspec == NULL)
14531 {
14532 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
14533 }
14534 else
14535 {
14536 g_value_init (&value, pspec->value_type);
14537 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
14538 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
14539 g_value_unset (&value);
14540 }
14541 return ret;
14542}
14543
14544static gboolean
14545_control_bmc_skeleton_handle_set_property (
14546 GDBusConnection *connection G_GNUC_UNUSED,
14547 const gchar *sender G_GNUC_UNUSED,
14548 const gchar *object_path G_GNUC_UNUSED,
14549 const gchar *interface_name G_GNUC_UNUSED,
14550 const gchar *property_name,
14551 GVariant *variant,
14552 GError **error,
14553 gpointer user_data)
14554{
14555 ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (user_data);
14556 GValue value = G_VALUE_INIT;
14557 GParamSpec *pspec;
14558 _ExtendedGDBusPropertyInfo *info;
14559 gboolean ret;
14560 ret = FALSE;
14561 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_bmc_interface_info.parent_struct, property_name);
14562 g_assert (info != NULL);
14563 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
14564 if (pspec == NULL)
14565 {
14566 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
14567 }
14568 else
14569 {
14570 if (info->use_gvariant)
14571 g_value_set_variant (&value, variant);
14572 else
14573 g_dbus_gvariant_to_gvalue (variant, &value);
14574 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
14575 g_value_unset (&value);
14576 ret = TRUE;
14577 }
14578 return ret;
14579}
14580
14581static const GDBusInterfaceVTable _control_bmc_skeleton_vtable =
14582{
14583 _control_bmc_skeleton_handle_method_call,
14584 _control_bmc_skeleton_handle_get_property,
14585 _control_bmc_skeleton_handle_set_property,
14586 {NULL}
14587};
14588
14589static GDBusInterfaceInfo *
14590control_bmc_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
14591{
14592 return control_bmc_interface_info ();
14593}
14594
14595static GDBusInterfaceVTable *
14596control_bmc_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
14597{
14598 return (GDBusInterfaceVTable *) &_control_bmc_skeleton_vtable;
14599}
14600
14601static GVariant *
14602control_bmc_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
14603{
14604 ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (_skeleton);
14605
14606 GVariantBuilder builder;
14607 guint n;
14608 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
14609 if (_control_bmc_interface_info.parent_struct.properties == NULL)
14610 goto out;
14611 for (n = 0; _control_bmc_interface_info.parent_struct.properties[n] != NULL; n++)
14612 {
14613 GDBusPropertyInfo *info = _control_bmc_interface_info.parent_struct.properties[n];
14614 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
14615 {
14616 GVariant *value;
14617 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);
14618 if (value != NULL)
14619 {
14620 g_variant_take_ref (value);
14621 g_variant_builder_add (&builder, "{sv}", info->name, value);
14622 g_variant_unref (value);
14623 }
14624 }
14625 }
14626out:
14627 return g_variant_builder_end (&builder);
14628}
14629
14630static void
14631control_bmc_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
14632{
14633}
14634
14635static void control_bmc_skeleton_iface_init (ControlBmcIface *iface);
14636#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
14637G_DEFINE_TYPE_WITH_CODE (ControlBmcSkeleton, control_bmc_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
14638 G_ADD_PRIVATE (ControlBmcSkeleton)
14639 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_BMC, control_bmc_skeleton_iface_init));
14640
14641#else
14642G_DEFINE_TYPE_WITH_CODE (ControlBmcSkeleton, control_bmc_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
14643 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_BMC, control_bmc_skeleton_iface_init));
14644
14645#endif
14646static void
14647control_bmc_skeleton_finalize (GObject *object)
14648{
14649 ControlBmcSkeleton *skeleton = CONTROL_BMC_SKELETON (object);
14650 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
14651 if (skeleton->priv->changed_properties_idle_source != NULL)
14652 g_source_destroy (skeleton->priv->changed_properties_idle_source);
14653 g_main_context_unref (skeleton->priv->context);
14654 g_mutex_clear (&skeleton->priv->lock);
14655 G_OBJECT_CLASS (control_bmc_skeleton_parent_class)->finalize (object);
14656}
14657
14658static void
14659control_bmc_skeleton_init (ControlBmcSkeleton *skeleton)
14660{
14661#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
14662 skeleton->priv = control_bmc_skeleton_get_instance_private (skeleton);
14663#else
14664 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_BMC_SKELETON, ControlBmcSkeletonPrivate);
14665#endif
14666
14667 g_mutex_init (&skeleton->priv->lock);
14668 skeleton->priv->context = g_main_context_ref_thread_default ();
14669}
14670
14671static void
14672control_bmc_skeleton_class_init (ControlBmcSkeletonClass *klass)
14673{
14674 GObjectClass *gobject_class;
14675 GDBusInterfaceSkeletonClass *skeleton_class;
14676
14677 gobject_class = G_OBJECT_CLASS (klass);
14678 gobject_class->finalize = control_bmc_skeleton_finalize;
14679
14680 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
14681 skeleton_class->get_info = control_bmc_skeleton_dbus_interface_get_info;
14682 skeleton_class->get_properties = control_bmc_skeleton_dbus_interface_get_properties;
14683 skeleton_class->flush = control_bmc_skeleton_dbus_interface_flush;
14684 skeleton_class->get_vtable = control_bmc_skeleton_dbus_interface_get_vtable;
14685
14686#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
14687 g_type_class_add_private (klass, sizeof (ControlBmcSkeletonPrivate));
14688#endif
14689}
14690
14691static void
14692control_bmc_skeleton_iface_init (ControlBmcIface *iface)
14693{
14694}
14695
14696/**
14697 * control_bmc_skeleton_new:
14698 *
14699 * 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>.
14700 *
14701 * Returns: (transfer full) (type ControlBmcSkeleton): The skeleton object.
14702 */
14703ControlBmc *
14704control_bmc_skeleton_new (void)
14705{
14706 return CONTROL_BMC (g_object_new (TYPE_CONTROL_BMC_SKELETON, NULL));
14707}
14708
14709/* ------------------------------------------------------------------------
14710 * Code for interface org.openbmc.control.Host
14711 * ------------------------------------------------------------------------
14712 */
14713
14714/**
14715 * SECTION:ControlHost
14716 * @title: ControlHost
14717 * @short_description: Generated C code for the org.openbmc.control.Host D-Bus interface
14718 *
14719 * 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.
14720 */
14721
14722/* ---- Introspection data for org.openbmc.control.Host ---- */
14723
14724static const _ExtendedGDBusMethodInfo _control_host_method_info_boot =
14725{
14726 {
14727 -1,
14728 (gchar *) "boot",
14729 NULL,
14730 NULL,
14731 NULL
14732 },
14733 "handle-boot",
14734 FALSE
14735};
14736
14737static const _ExtendedGDBusMethodInfo _control_host_method_info_shutdown =
14738{
14739 {
14740 -1,
14741 (gchar *) "shutdown",
14742 NULL,
14743 NULL,
14744 NULL
14745 },
14746 "handle-shutdown",
14747 FALSE
14748};
14749
14750static const _ExtendedGDBusMethodInfo _control_host_method_info_reboot =
14751{
14752 {
14753 -1,
14754 (gchar *) "reboot",
14755 NULL,
14756 NULL,
14757 NULL
14758 },
14759 "handle-reboot",
14760 FALSE
14761};
14762
14763static const _ExtendedGDBusMethodInfo * const _control_host_method_info_pointers[] =
14764{
14765 &_control_host_method_info_boot,
14766 &_control_host_method_info_shutdown,
14767 &_control_host_method_info_reboot,
14768 NULL
14769};
14770
14771static const _ExtendedGDBusSignalInfo _control_host_signal_info_booted =
14772{
14773 {
14774 -1,
14775 (gchar *) "Booted",
14776 NULL,
14777 NULL
14778 },
14779 "booted"
14780};
14781
14782static const _ExtendedGDBusSignalInfo * const _control_host_signal_info_pointers[] =
14783{
14784 &_control_host_signal_info_booted,
14785 NULL
14786};
14787
14788static const _ExtendedGDBusInterfaceInfo _control_host_interface_info =
14789{
14790 {
14791 -1,
14792 (gchar *) "org.openbmc.control.Host",
14793 (GDBusMethodInfo **) &_control_host_method_info_pointers,
14794 (GDBusSignalInfo **) &_control_host_signal_info_pointers,
14795 NULL,
14796 NULL
14797 },
14798 "control-host",
14799};
14800
14801
14802/**
14803 * control_host_interface_info:
14804 *
14805 * 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.
14806 *
14807 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
14808 */
14809GDBusInterfaceInfo *
14810control_host_interface_info (void)
14811{
14812 return (GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct;
14813}
14814
14815/**
14816 * control_host_override_properties:
14817 * @klass: The class structure for a #GObject<!-- -->-derived class.
14818 * @property_id_begin: The property id to assign to the first overridden property.
14819 *
14820 * Overrides all #GObject properties in the #ControlHost interface for a concrete class.
14821 * The properties are overridden in the order they are defined.
14822 *
14823 * Returns: The last property id.
14824 */
14825guint
14826control_host_override_properties (GObjectClass *klass, guint property_id_begin)
14827{
14828 return property_id_begin - 1;
14829}
14830
14831
14832
14833/**
14834 * ControlHost:
14835 *
14836 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link>.
14837 */
14838
14839/**
14840 * ControlHostIface:
14841 * @parent_iface: The parent interface.
14842 * @handle_boot: Handler for the #ControlHost::handle-boot signal.
14843 * @handle_reboot: Handler for the #ControlHost::handle-reboot signal.
14844 * @handle_shutdown: Handler for the #ControlHost::handle-shutdown signal.
14845 * @booted: Handler for the #ControlHost::booted signal.
14846 *
14847 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link>.
14848 */
14849
14850typedef ControlHostIface ControlHostInterface;
14851G_DEFINE_INTERFACE (ControlHost, control_host, G_TYPE_OBJECT);
14852
14853static void
14854control_host_default_init (ControlHostIface *iface)
14855{
14856 /* GObject signals for incoming D-Bus method calls: */
14857 /**
14858 * ControlHost::handle-boot:
14859 * @object: A #ControlHost.
14860 * @invocation: A #GDBusMethodInvocation.
14861 *
14862 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Host.boot">boot()</link> D-Bus method.
14863 *
14864 * 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.
14865 *
14866 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
14867 */
14868 g_signal_new ("handle-boot",
14869 G_TYPE_FROM_INTERFACE (iface),
14870 G_SIGNAL_RUN_LAST,
14871 G_STRUCT_OFFSET (ControlHostIface, handle_boot),
14872 g_signal_accumulator_true_handled,
14873 NULL,
14874 g_cclosure_marshal_generic,
14875 G_TYPE_BOOLEAN,
14876 1,
14877 G_TYPE_DBUS_METHOD_INVOCATION);
14878
14879 /**
14880 * ControlHost::handle-shutdown:
14881 * @object: A #ControlHost.
14882 * @invocation: A #GDBusMethodInvocation.
14883 *
14884 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Host.shutdown">shutdown()</link> D-Bus method.
14885 *
14886 * 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.
14887 *
14888 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
14889 */
14890 g_signal_new ("handle-shutdown",
14891 G_TYPE_FROM_INTERFACE (iface),
14892 G_SIGNAL_RUN_LAST,
14893 G_STRUCT_OFFSET (ControlHostIface, handle_shutdown),
14894 g_signal_accumulator_true_handled,
14895 NULL,
14896 g_cclosure_marshal_generic,
14897 G_TYPE_BOOLEAN,
14898 1,
14899 G_TYPE_DBUS_METHOD_INVOCATION);
14900
14901 /**
14902 * ControlHost::handle-reboot:
14903 * @object: A #ControlHost.
14904 * @invocation: A #GDBusMethodInvocation.
14905 *
14906 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Host.reboot">reboot()</link> D-Bus method.
14907 *
14908 * 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.
14909 *
14910 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
14911 */
14912 g_signal_new ("handle-reboot",
14913 G_TYPE_FROM_INTERFACE (iface),
14914 G_SIGNAL_RUN_LAST,
14915 G_STRUCT_OFFSET (ControlHostIface, handle_reboot),
14916 g_signal_accumulator_true_handled,
14917 NULL,
14918 g_cclosure_marshal_generic,
14919 G_TYPE_BOOLEAN,
14920 1,
14921 G_TYPE_DBUS_METHOD_INVOCATION);
14922
14923 /* GObject signals for received D-Bus signals: */
14924 /**
14925 * ControlHost::booted:
14926 * @object: A #ControlHost.
14927 *
14928 * 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.
14929 *
14930 * 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.
14931 */
14932 g_signal_new ("booted",
14933 G_TYPE_FROM_INTERFACE (iface),
14934 G_SIGNAL_RUN_LAST,
14935 G_STRUCT_OFFSET (ControlHostIface, booted),
14936 NULL,
14937 NULL,
14938 g_cclosure_marshal_generic,
14939 G_TYPE_NONE,
14940 0);
14941
14942}
14943
14944/**
14945 * control_host_emit_booted:
14946 * @object: A #ControlHost.
14947 *
14948 * Emits the <link linkend="gdbus-signal-org-openbmc-control-Host.Booted">"Booted"</link> D-Bus signal.
14949 */
14950void
14951control_host_emit_booted (
14952 ControlHost *object)
14953{
14954 g_signal_emit_by_name (object, "booted");
14955}
14956
14957/**
14958 * control_host_call_boot:
14959 * @proxy: A #ControlHostProxy.
14960 * @cancellable: (allow-none): A #GCancellable or %NULL.
14961 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
14962 * @user_data: User data to pass to @callback.
14963 *
14964 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Host.boot">boot()</link> D-Bus method on @proxy.
14965 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
14966 * You can then call control_host_call_boot_finish() to get the result of the operation.
14967 *
14968 * See control_host_call_boot_sync() for the synchronous, blocking version of this method.
14969 */
14970void
14971control_host_call_boot (
14972 ControlHost *proxy,
14973 GCancellable *cancellable,
14974 GAsyncReadyCallback callback,
14975 gpointer user_data)
14976{
14977 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
14978 "boot",
14979 g_variant_new ("()"),
14980 G_DBUS_CALL_FLAGS_NONE,
14981 -1,
14982 cancellable,
14983 callback,
14984 user_data);
14985}
14986
14987/**
14988 * control_host_call_boot_finish:
14989 * @proxy: A #ControlHostProxy.
14990 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_call_boot().
14991 * @error: Return location for error or %NULL.
14992 *
14993 * Finishes an operation started with control_host_call_boot().
14994 *
14995 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
14996 */
14997gboolean
14998control_host_call_boot_finish (
14999 ControlHost *proxy,
15000 GAsyncResult *res,
15001 GError **error)
15002{
15003 GVariant *_ret;
15004 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
15005 if (_ret == NULL)
15006 goto _out;
15007 g_variant_get (_ret,
15008 "()");
15009 g_variant_unref (_ret);
15010_out:
15011 return _ret != NULL;
15012}
15013
15014/**
15015 * control_host_call_boot_sync:
15016 * @proxy: A #ControlHostProxy.
15017 * @cancellable: (allow-none): A #GCancellable or %NULL.
15018 * @error: Return location for error or %NULL.
15019 *
15020 * 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.
15021 *
15022 * See control_host_call_boot() for the asynchronous version of this method.
15023 *
15024 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
15025 */
15026gboolean
15027control_host_call_boot_sync (
15028 ControlHost *proxy,
15029 GCancellable *cancellable,
15030 GError **error)
15031{
15032 GVariant *_ret;
15033 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
15034 "boot",
15035 g_variant_new ("()"),
15036 G_DBUS_CALL_FLAGS_NONE,
15037 -1,
15038 cancellable,
15039 error);
15040 if (_ret == NULL)
15041 goto _out;
15042 g_variant_get (_ret,
15043 "()");
15044 g_variant_unref (_ret);
15045_out:
15046 return _ret != NULL;
15047}
15048
15049/**
15050 * control_host_call_shutdown:
15051 * @proxy: A #ControlHostProxy.
15052 * @cancellable: (allow-none): A #GCancellable or %NULL.
15053 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
15054 * @user_data: User data to pass to @callback.
15055 *
15056 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Host.shutdown">shutdown()</link> D-Bus method on @proxy.
15057 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
15058 * You can then call control_host_call_shutdown_finish() to get the result of the operation.
15059 *
15060 * See control_host_call_shutdown_sync() for the synchronous, blocking version of this method.
15061 */
15062void
15063control_host_call_shutdown (
15064 ControlHost *proxy,
15065 GCancellable *cancellable,
15066 GAsyncReadyCallback callback,
15067 gpointer user_data)
15068{
15069 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
15070 "shutdown",
15071 g_variant_new ("()"),
15072 G_DBUS_CALL_FLAGS_NONE,
15073 -1,
15074 cancellable,
15075 callback,
15076 user_data);
15077}
15078
15079/**
15080 * control_host_call_shutdown_finish:
15081 * @proxy: A #ControlHostProxy.
15082 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_call_shutdown().
15083 * @error: Return location for error or %NULL.
15084 *
15085 * Finishes an operation started with control_host_call_shutdown().
15086 *
15087 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
15088 */
15089gboolean
15090control_host_call_shutdown_finish (
15091 ControlHost *proxy,
15092 GAsyncResult *res,
15093 GError **error)
15094{
15095 GVariant *_ret;
15096 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
15097 if (_ret == NULL)
15098 goto _out;
15099 g_variant_get (_ret,
15100 "()");
15101 g_variant_unref (_ret);
15102_out:
15103 return _ret != NULL;
15104}
15105
15106/**
15107 * control_host_call_shutdown_sync:
15108 * @proxy: A #ControlHostProxy.
15109 * @cancellable: (allow-none): A #GCancellable or %NULL.
15110 * @error: Return location for error or %NULL.
15111 *
15112 * 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.
15113 *
15114 * See control_host_call_shutdown() for the asynchronous version of this method.
15115 *
15116 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
15117 */
15118gboolean
15119control_host_call_shutdown_sync (
15120 ControlHost *proxy,
15121 GCancellable *cancellable,
15122 GError **error)
15123{
15124 GVariant *_ret;
15125 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
15126 "shutdown",
15127 g_variant_new ("()"),
15128 G_DBUS_CALL_FLAGS_NONE,
15129 -1,
15130 cancellable,
15131 error);
15132 if (_ret == NULL)
15133 goto _out;
15134 g_variant_get (_ret,
15135 "()");
15136 g_variant_unref (_ret);
15137_out:
15138 return _ret != NULL;
15139}
15140
15141/**
15142 * control_host_call_reboot:
15143 * @proxy: A #ControlHostProxy.
15144 * @cancellable: (allow-none): A #GCancellable or %NULL.
15145 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
15146 * @user_data: User data to pass to @callback.
15147 *
15148 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Host.reboot">reboot()</link> D-Bus method on @proxy.
15149 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
15150 * You can then call control_host_call_reboot_finish() to get the result of the operation.
15151 *
15152 * See control_host_call_reboot_sync() for the synchronous, blocking version of this method.
15153 */
15154void
15155control_host_call_reboot (
15156 ControlHost *proxy,
15157 GCancellable *cancellable,
15158 GAsyncReadyCallback callback,
15159 gpointer user_data)
15160{
15161 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
15162 "reboot",
15163 g_variant_new ("()"),
15164 G_DBUS_CALL_FLAGS_NONE,
15165 -1,
15166 cancellable,
15167 callback,
15168 user_data);
15169}
15170
15171/**
15172 * control_host_call_reboot_finish:
15173 * @proxy: A #ControlHostProxy.
15174 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_call_reboot().
15175 * @error: Return location for error or %NULL.
15176 *
15177 * Finishes an operation started with control_host_call_reboot().
15178 *
15179 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
15180 */
15181gboolean
15182control_host_call_reboot_finish (
15183 ControlHost *proxy,
15184 GAsyncResult *res,
15185 GError **error)
15186{
15187 GVariant *_ret;
15188 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
15189 if (_ret == NULL)
15190 goto _out;
15191 g_variant_get (_ret,
15192 "()");
15193 g_variant_unref (_ret);
15194_out:
15195 return _ret != NULL;
15196}
15197
15198/**
15199 * control_host_call_reboot_sync:
15200 * @proxy: A #ControlHostProxy.
15201 * @cancellable: (allow-none): A #GCancellable or %NULL.
15202 * @error: Return location for error or %NULL.
15203 *
15204 * 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.
15205 *
15206 * See control_host_call_reboot() for the asynchronous version of this method.
15207 *
15208 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
15209 */
15210gboolean
15211control_host_call_reboot_sync (
15212 ControlHost *proxy,
15213 GCancellable *cancellable,
15214 GError **error)
15215{
15216 GVariant *_ret;
15217 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
15218 "reboot",
15219 g_variant_new ("()"),
15220 G_DBUS_CALL_FLAGS_NONE,
15221 -1,
15222 cancellable,
15223 error);
15224 if (_ret == NULL)
15225 goto _out;
15226 g_variant_get (_ret,
15227 "()");
15228 g_variant_unref (_ret);
15229_out:
15230 return _ret != NULL;
15231}
15232
15233/**
15234 * control_host_complete_boot:
15235 * @object: A #ControlHost.
15236 * @invocation: (transfer full): A #GDBusMethodInvocation.
15237 *
15238 * 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.
15239 *
15240 * This method will free @invocation, you cannot use it afterwards.
15241 */
15242void
15243control_host_complete_boot (
15244 ControlHost *object,
15245 GDBusMethodInvocation *invocation)
15246{
15247 g_dbus_method_invocation_return_value (invocation,
15248 g_variant_new ("()"));
15249}
15250
15251/**
15252 * control_host_complete_shutdown:
15253 * @object: A #ControlHost.
15254 * @invocation: (transfer full): A #GDBusMethodInvocation.
15255 *
15256 * 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.
15257 *
15258 * This method will free @invocation, you cannot use it afterwards.
15259 */
15260void
15261control_host_complete_shutdown (
15262 ControlHost *object,
15263 GDBusMethodInvocation *invocation)
15264{
15265 g_dbus_method_invocation_return_value (invocation,
15266 g_variant_new ("()"));
15267}
15268
15269/**
15270 * control_host_complete_reboot:
15271 * @object: A #ControlHost.
15272 * @invocation: (transfer full): A #GDBusMethodInvocation.
15273 *
15274 * 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.
15275 *
15276 * This method will free @invocation, you cannot use it afterwards.
15277 */
15278void
15279control_host_complete_reboot (
15280 ControlHost *object,
15281 GDBusMethodInvocation *invocation)
15282{
15283 g_dbus_method_invocation_return_value (invocation,
15284 g_variant_new ("()"));
15285}
15286
15287/* ------------------------------------------------------------------------ */
15288
15289/**
15290 * ControlHostProxy:
15291 *
15292 * The #ControlHostProxy structure contains only private data and should only be accessed using the provided API.
15293 */
15294
15295/**
15296 * ControlHostProxyClass:
15297 * @parent_class: The parent class.
15298 *
15299 * Class structure for #ControlHostProxy.
15300 */
15301
15302struct _ControlHostProxyPrivate
15303{
15304 GData *qdata;
15305};
15306
15307static void control_host_proxy_iface_init (ControlHostIface *iface);
15308
15309#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
15310G_DEFINE_TYPE_WITH_CODE (ControlHostProxy, control_host_proxy, G_TYPE_DBUS_PROXY,
15311 G_ADD_PRIVATE (ControlHostProxy)
15312 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_proxy_iface_init));
15313
15314#else
15315G_DEFINE_TYPE_WITH_CODE (ControlHostProxy, control_host_proxy, G_TYPE_DBUS_PROXY,
15316 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_proxy_iface_init));
15317
15318#endif
15319static void
15320control_host_proxy_finalize (GObject *object)
15321{
15322 ControlHostProxy *proxy = CONTROL_HOST_PROXY (object);
15323 g_datalist_clear (&proxy->priv->qdata);
15324 G_OBJECT_CLASS (control_host_proxy_parent_class)->finalize (object);
15325}
15326
15327static void
15328control_host_proxy_get_property (GObject *object,
15329 guint prop_id,
15330 GValue *value,
15331 GParamSpec *pspec G_GNUC_UNUSED)
15332{
15333}
15334
15335static void
15336control_host_proxy_set_property (GObject *object,
15337 guint prop_id,
15338 const GValue *value,
15339 GParamSpec *pspec G_GNUC_UNUSED)
15340{
15341}
15342
15343static void
15344control_host_proxy_g_signal (GDBusProxy *proxy,
15345 const gchar *sender_name G_GNUC_UNUSED,
15346 const gchar *signal_name,
15347 GVariant *parameters)
15348{
15349 _ExtendedGDBusSignalInfo *info;
15350 GVariantIter iter;
15351 GVariant *child;
15352 GValue *paramv;
15353 guint num_params;
15354 guint n;
15355 guint signal_id;
15356 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, signal_name);
15357 if (info == NULL)
15358 return;
15359 num_params = g_variant_n_children (parameters);
15360 paramv = g_new0 (GValue, num_params + 1);
15361 g_value_init (&paramv[0], TYPE_CONTROL_HOST);
15362 g_value_set_object (&paramv[0], proxy);
15363 g_variant_iter_init (&iter, parameters);
15364 n = 1;
15365 while ((child = g_variant_iter_next_value (&iter)) != NULL)
15366 {
15367 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
15368 if (arg_info->use_gvariant)
15369 {
15370 g_value_init (&paramv[n], G_TYPE_VARIANT);
15371 g_value_set_variant (&paramv[n], child);
15372 n++;
15373 }
15374 else
15375 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
15376 g_variant_unref (child);
15377 }
15378 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_HOST);
15379 g_signal_emitv (paramv, signal_id, 0, NULL);
15380 for (n = 0; n < num_params + 1; n++)
15381 g_value_unset (&paramv[n]);
15382 g_free (paramv);
15383}
15384
15385static void
15386control_host_proxy_g_properties_changed (GDBusProxy *_proxy,
15387 GVariant *changed_properties,
15388 const gchar *const *invalidated_properties)
15389{
15390 ControlHostProxy *proxy = CONTROL_HOST_PROXY (_proxy);
15391 guint n;
15392 const gchar *key;
15393 GVariantIter *iter;
15394 _ExtendedGDBusPropertyInfo *info;
15395 g_variant_get (changed_properties, "a{sv}", &iter);
15396 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
15397 {
15398 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, key);
15399 g_datalist_remove_data (&proxy->priv->qdata, key);
15400 if (info != NULL)
15401 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
15402 }
15403 g_variant_iter_free (iter);
15404 for (n = 0; invalidated_properties[n] != NULL; n++)
15405 {
15406 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, invalidated_properties[n]);
15407 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
15408 if (info != NULL)
15409 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
15410 }
15411}
15412
15413static void
15414control_host_proxy_init (ControlHostProxy *proxy)
15415{
15416#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
15417 proxy->priv = control_host_proxy_get_instance_private (proxy);
15418#else
15419 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_HOST_PROXY, ControlHostProxyPrivate);
15420#endif
15421
15422 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_host_interface_info ());
15423}
15424
15425static void
15426control_host_proxy_class_init (ControlHostProxyClass *klass)
15427{
15428 GObjectClass *gobject_class;
15429 GDBusProxyClass *proxy_class;
15430
15431 gobject_class = G_OBJECT_CLASS (klass);
15432 gobject_class->finalize = control_host_proxy_finalize;
15433 gobject_class->get_property = control_host_proxy_get_property;
15434 gobject_class->set_property = control_host_proxy_set_property;
15435
15436 proxy_class = G_DBUS_PROXY_CLASS (klass);
15437 proxy_class->g_signal = control_host_proxy_g_signal;
15438 proxy_class->g_properties_changed = control_host_proxy_g_properties_changed;
15439
15440#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
15441 g_type_class_add_private (klass, sizeof (ControlHostProxyPrivate));
15442#endif
15443}
15444
15445static void
15446control_host_proxy_iface_init (ControlHostIface *iface)
15447{
15448}
15449
15450/**
15451 * control_host_proxy_new:
15452 * @connection: A #GDBusConnection.
15453 * @flags: Flags from the #GDBusProxyFlags enumeration.
15454 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
15455 * @object_path: An object path.
15456 * @cancellable: (allow-none): A #GCancellable or %NULL.
15457 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
15458 * @user_data: User data to pass to @callback.
15459 *
15460 * 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.
15461 *
15462 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
15463 * You can then call control_host_proxy_new_finish() to get the result of the operation.
15464 *
15465 * See control_host_proxy_new_sync() for the synchronous, blocking version of this constructor.
15466 */
15467void
15468control_host_proxy_new (
15469 GDBusConnection *connection,
15470 GDBusProxyFlags flags,
15471 const gchar *name,
15472 const gchar *object_path,
15473 GCancellable *cancellable,
15474 GAsyncReadyCallback callback,
15475 gpointer user_data)
15476{
15477 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);
15478}
15479
15480/**
15481 * control_host_proxy_new_finish:
15482 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_proxy_new().
15483 * @error: Return location for error or %NULL
15484 *
15485 * Finishes an operation started with control_host_proxy_new().
15486 *
15487 * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set.
15488 */
15489ControlHost *
15490control_host_proxy_new_finish (
15491 GAsyncResult *res,
15492 GError **error)
15493{
15494 GObject *ret;
15495 GObject *source_object;
15496 source_object = g_async_result_get_source_object (res);
15497 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
15498 g_object_unref (source_object);
15499 if (ret != NULL)
15500 return CONTROL_HOST (ret);
15501 else
15502 return NULL;
15503}
15504
15505/**
15506 * control_host_proxy_new_sync:
15507 * @connection: A #GDBusConnection.
15508 * @flags: Flags from the #GDBusProxyFlags enumeration.
15509 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
15510 * @object_path: An object path.
15511 * @cancellable: (allow-none): A #GCancellable or %NULL.
15512 * @error: Return location for error or %NULL
15513 *
15514 * 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.
15515 *
15516 * The calling thread is blocked until a reply is received.
15517 *
15518 * See control_host_proxy_new() for the asynchronous version of this constructor.
15519 *
15520 * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set.
15521 */
15522ControlHost *
15523control_host_proxy_new_sync (
15524 GDBusConnection *connection,
15525 GDBusProxyFlags flags,
15526 const gchar *name,
15527 const gchar *object_path,
15528 GCancellable *cancellable,
15529 GError **error)
15530{
15531 GInitable *ret;
15532 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);
15533 if (ret != NULL)
15534 return CONTROL_HOST (ret);
15535 else
15536 return NULL;
15537}
15538
15539
15540/**
15541 * control_host_proxy_new_for_bus:
15542 * @bus_type: A #GBusType.
15543 * @flags: Flags from the #GDBusProxyFlags enumeration.
15544 * @name: A bus name (well-known or unique).
15545 * @object_path: An object path.
15546 * @cancellable: (allow-none): A #GCancellable or %NULL.
15547 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
15548 * @user_data: User data to pass to @callback.
15549 *
15550 * Like control_host_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
15551 *
15552 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
15553 * You can then call control_host_proxy_new_for_bus_finish() to get the result of the operation.
15554 *
15555 * See control_host_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
15556 */
15557void
15558control_host_proxy_new_for_bus (
15559 GBusType bus_type,
15560 GDBusProxyFlags flags,
15561 const gchar *name,
15562 const gchar *object_path,
15563 GCancellable *cancellable,
15564 GAsyncReadyCallback callback,
15565 gpointer user_data)
15566{
15567 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);
15568}
15569
15570/**
15571 * control_host_proxy_new_for_bus_finish:
15572 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_host_proxy_new_for_bus().
15573 * @error: Return location for error or %NULL
15574 *
15575 * Finishes an operation started with control_host_proxy_new_for_bus().
15576 *
15577 * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set.
15578 */
15579ControlHost *
15580control_host_proxy_new_for_bus_finish (
15581 GAsyncResult *res,
15582 GError **error)
15583{
15584 GObject *ret;
15585 GObject *source_object;
15586 source_object = g_async_result_get_source_object (res);
15587 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
15588 g_object_unref (source_object);
15589 if (ret != NULL)
15590 return CONTROL_HOST (ret);
15591 else
15592 return NULL;
15593}
15594
15595/**
15596 * control_host_proxy_new_for_bus_sync:
15597 * @bus_type: A #GBusType.
15598 * @flags: Flags from the #GDBusProxyFlags enumeration.
15599 * @name: A bus name (well-known or unique).
15600 * @object_path: An object path.
15601 * @cancellable: (allow-none): A #GCancellable or %NULL.
15602 * @error: Return location for error or %NULL
15603 *
15604 * Like control_host_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
15605 *
15606 * The calling thread is blocked until a reply is received.
15607 *
15608 * See control_host_proxy_new_for_bus() for the asynchronous version of this constructor.
15609 *
15610 * Returns: (transfer full) (type ControlHostProxy): The constructed proxy object or %NULL if @error is set.
15611 */
15612ControlHost *
15613control_host_proxy_new_for_bus_sync (
15614 GBusType bus_type,
15615 GDBusProxyFlags flags,
15616 const gchar *name,
15617 const gchar *object_path,
15618 GCancellable *cancellable,
15619 GError **error)
15620{
15621 GInitable *ret;
15622 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);
15623 if (ret != NULL)
15624 return CONTROL_HOST (ret);
15625 else
15626 return NULL;
15627}
15628
15629
15630/* ------------------------------------------------------------------------ */
15631
15632/**
15633 * ControlHostSkeleton:
15634 *
15635 * The #ControlHostSkeleton structure contains only private data and should only be accessed using the provided API.
15636 */
15637
15638/**
15639 * ControlHostSkeletonClass:
15640 * @parent_class: The parent class.
15641 *
15642 * Class structure for #ControlHostSkeleton.
15643 */
15644
15645struct _ControlHostSkeletonPrivate
15646{
15647 GValue *properties;
15648 GList *changed_properties;
15649 GSource *changed_properties_idle_source;
15650 GMainContext *context;
15651 GMutex lock;
15652};
15653
15654static void
15655_control_host_skeleton_handle_method_call (
15656 GDBusConnection *connection G_GNUC_UNUSED,
15657 const gchar *sender G_GNUC_UNUSED,
15658 const gchar *object_path G_GNUC_UNUSED,
15659 const gchar *interface_name,
15660 const gchar *method_name,
15661 GVariant *parameters,
15662 GDBusMethodInvocation *invocation,
15663 gpointer user_data)
15664{
15665 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (user_data);
15666 _ExtendedGDBusMethodInfo *info;
15667 GVariantIter iter;
15668 GVariant *child;
15669 GValue *paramv;
15670 guint num_params;
15671 guint num_extra;
15672 guint n;
15673 guint signal_id;
15674 GValue return_value = G_VALUE_INIT;
15675 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
15676 g_assert (info != NULL);
15677 num_params = g_variant_n_children (parameters);
15678 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
15679 n = 0;
15680 g_value_init (&paramv[n], TYPE_CONTROL_HOST);
15681 g_value_set_object (&paramv[n++], skeleton);
15682 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
15683 g_value_set_object (&paramv[n++], invocation);
15684 if (info->pass_fdlist)
15685 {
15686#ifdef G_OS_UNIX
15687 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
15688 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
15689#else
15690 g_assert_not_reached ();
15691#endif
15692 }
15693 g_variant_iter_init (&iter, parameters);
15694 while ((child = g_variant_iter_next_value (&iter)) != NULL)
15695 {
15696 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
15697 if (arg_info->use_gvariant)
15698 {
15699 g_value_init (&paramv[n], G_TYPE_VARIANT);
15700 g_value_set_variant (&paramv[n], child);
15701 n++;
15702 }
15703 else
15704 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
15705 g_variant_unref (child);
15706 }
15707 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_HOST);
15708 g_value_init (&return_value, G_TYPE_BOOLEAN);
15709 g_signal_emitv (paramv, signal_id, 0, &return_value);
15710 if (!g_value_get_boolean (&return_value))
15711 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);
15712 g_value_unset (&return_value);
15713 for (n = 0; n < num_params + num_extra; n++)
15714 g_value_unset (&paramv[n]);
15715 g_free (paramv);
15716}
15717
15718static GVariant *
15719_control_host_skeleton_handle_get_property (
15720 GDBusConnection *connection G_GNUC_UNUSED,
15721 const gchar *sender G_GNUC_UNUSED,
15722 const gchar *object_path G_GNUC_UNUSED,
15723 const gchar *interface_name G_GNUC_UNUSED,
15724 const gchar *property_name,
15725 GError **error,
15726 gpointer user_data)
15727{
15728 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (user_data);
15729 GValue value = G_VALUE_INIT;
15730 GParamSpec *pspec;
15731 _ExtendedGDBusPropertyInfo *info;
15732 GVariant *ret;
15733 ret = NULL;
15734 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, property_name);
15735 g_assert (info != NULL);
15736 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
15737 if (pspec == NULL)
15738 {
15739 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
15740 }
15741 else
15742 {
15743 g_value_init (&value, pspec->value_type);
15744 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
15745 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
15746 g_value_unset (&value);
15747 }
15748 return ret;
15749}
15750
15751static gboolean
15752_control_host_skeleton_handle_set_property (
15753 GDBusConnection *connection G_GNUC_UNUSED,
15754 const gchar *sender G_GNUC_UNUSED,
15755 const gchar *object_path G_GNUC_UNUSED,
15756 const gchar *interface_name G_GNUC_UNUSED,
15757 const gchar *property_name,
15758 GVariant *variant,
15759 GError **error,
15760 gpointer user_data)
15761{
15762 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (user_data);
15763 GValue value = G_VALUE_INIT;
15764 GParamSpec *pspec;
15765 _ExtendedGDBusPropertyInfo *info;
15766 gboolean ret;
15767 ret = FALSE;
15768 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_host_interface_info.parent_struct, property_name);
15769 g_assert (info != NULL);
15770 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
15771 if (pspec == NULL)
15772 {
15773 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
15774 }
15775 else
15776 {
15777 if (info->use_gvariant)
15778 g_value_set_variant (&value, variant);
15779 else
15780 g_dbus_gvariant_to_gvalue (variant, &value);
15781 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
15782 g_value_unset (&value);
15783 ret = TRUE;
15784 }
15785 return ret;
15786}
15787
15788static const GDBusInterfaceVTable _control_host_skeleton_vtable =
15789{
15790 _control_host_skeleton_handle_method_call,
15791 _control_host_skeleton_handle_get_property,
15792 _control_host_skeleton_handle_set_property,
15793 {NULL}
15794};
15795
15796static GDBusInterfaceInfo *
15797control_host_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
15798{
15799 return control_host_interface_info ();
15800}
15801
15802static GDBusInterfaceVTable *
15803control_host_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
15804{
15805 return (GDBusInterfaceVTable *) &_control_host_skeleton_vtable;
15806}
15807
15808static GVariant *
15809control_host_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
15810{
15811 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (_skeleton);
15812
15813 GVariantBuilder builder;
15814 guint n;
15815 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
15816 if (_control_host_interface_info.parent_struct.properties == NULL)
15817 goto out;
15818 for (n = 0; _control_host_interface_info.parent_struct.properties[n] != NULL; n++)
15819 {
15820 GDBusPropertyInfo *info = _control_host_interface_info.parent_struct.properties[n];
15821 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
15822 {
15823 GVariant *value;
15824 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);
15825 if (value != NULL)
15826 {
15827 g_variant_take_ref (value);
15828 g_variant_builder_add (&builder, "{sv}", info->name, value);
15829 g_variant_unref (value);
15830 }
15831 }
15832 }
15833out:
15834 return g_variant_builder_end (&builder);
15835}
15836
15837static void
15838control_host_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
15839{
15840}
15841
15842static void
15843_control_host_on_signal_booted (
15844 ControlHost *object)
15845{
15846 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object);
15847
15848 GList *connections, *l;
15849 GVariant *signal_variant;
15850 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
15851
15852 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
15853 for (l = connections; l != NULL; l = l->next)
15854 {
15855 GDBusConnection *connection = l->data;
15856 g_dbus_connection_emit_signal (connection,
15857 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.control.Host", "Booted",
15858 signal_variant, NULL);
15859 }
15860 g_variant_unref (signal_variant);
15861 g_list_free_full (connections, g_object_unref);
15862}
15863
15864static void control_host_skeleton_iface_init (ControlHostIface *iface);
15865#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
15866G_DEFINE_TYPE_WITH_CODE (ControlHostSkeleton, control_host_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
15867 G_ADD_PRIVATE (ControlHostSkeleton)
15868 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_skeleton_iface_init));
15869
15870#else
15871G_DEFINE_TYPE_WITH_CODE (ControlHostSkeleton, control_host_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
15872 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_HOST, control_host_skeleton_iface_init));
15873
15874#endif
15875static void
15876control_host_skeleton_finalize (GObject *object)
15877{
15878 ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object);
15879 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
15880 if (skeleton->priv->changed_properties_idle_source != NULL)
15881 g_source_destroy (skeleton->priv->changed_properties_idle_source);
15882 g_main_context_unref (skeleton->priv->context);
15883 g_mutex_clear (&skeleton->priv->lock);
15884 G_OBJECT_CLASS (control_host_skeleton_parent_class)->finalize (object);
15885}
15886
15887static void
15888control_host_skeleton_init (ControlHostSkeleton *skeleton)
15889{
15890#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
15891 skeleton->priv = control_host_skeleton_get_instance_private (skeleton);
15892#else
15893 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_HOST_SKELETON, ControlHostSkeletonPrivate);
15894#endif
15895
15896 g_mutex_init (&skeleton->priv->lock);
15897 skeleton->priv->context = g_main_context_ref_thread_default ();
15898}
15899
15900static void
15901control_host_skeleton_class_init (ControlHostSkeletonClass *klass)
15902{
15903 GObjectClass *gobject_class;
15904 GDBusInterfaceSkeletonClass *skeleton_class;
15905
15906 gobject_class = G_OBJECT_CLASS (klass);
15907 gobject_class->finalize = control_host_skeleton_finalize;
15908
15909 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
15910 skeleton_class->get_info = control_host_skeleton_dbus_interface_get_info;
15911 skeleton_class->get_properties = control_host_skeleton_dbus_interface_get_properties;
15912 skeleton_class->flush = control_host_skeleton_dbus_interface_flush;
15913 skeleton_class->get_vtable = control_host_skeleton_dbus_interface_get_vtable;
15914
15915#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
15916 g_type_class_add_private (klass, sizeof (ControlHostSkeletonPrivate));
15917#endif
15918}
15919
15920static void
15921control_host_skeleton_iface_init (ControlHostIface *iface)
15922{
15923 iface->booted = _control_host_on_signal_booted;
15924}
15925
15926/**
15927 * control_host_skeleton_new:
15928 *
15929 * 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>.
15930 *
15931 * Returns: (transfer full) (type ControlHostSkeleton): The skeleton object.
15932 */
15933ControlHost *
15934control_host_skeleton_new (void)
15935{
15936 return CONTROL_HOST (g_object_new (TYPE_CONTROL_HOST_SKELETON, NULL));
15937}
15938
15939/* ------------------------------------------------------------------------
15940 * Code for interface org.openbmc.control.Power
15941 * ------------------------------------------------------------------------
15942 */
15943
15944/**
15945 * SECTION:ControlPower
15946 * @title: ControlPower
15947 * @short_description: Generated C code for the org.openbmc.control.Power D-Bus interface
15948 *
15949 * 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.
15950 */
15951
15952/* ---- Introspection data for org.openbmc.control.Power ---- */
15953
15954static const _ExtendedGDBusArgInfo _control_power_method_info_set_power_state_IN_ARG_state =
15955{
15956 {
15957 -1,
15958 (gchar *) "state",
15959 (gchar *) "i",
15960 NULL
15961 },
15962 FALSE
15963};
15964
15965static const _ExtendedGDBusArgInfo * const _control_power_method_info_set_power_state_IN_ARG_pointers[] =
15966{
15967 &_control_power_method_info_set_power_state_IN_ARG_state,
15968 NULL
15969};
15970
15971static const _ExtendedGDBusMethodInfo _control_power_method_info_set_power_state =
15972{
15973 {
15974 -1,
15975 (gchar *) "setPowerState",
15976 (GDBusArgInfo **) &_control_power_method_info_set_power_state_IN_ARG_pointers,
15977 NULL,
15978 NULL
15979 },
15980 "handle-set-power-state",
15981 FALSE
15982};
15983
15984static const _ExtendedGDBusArgInfo _control_power_method_info_get_power_state_OUT_ARG_state =
15985{
15986 {
15987 -1,
15988 (gchar *) "state",
15989 (gchar *) "i",
15990 NULL
15991 },
15992 FALSE
15993};
15994
15995static const _ExtendedGDBusArgInfo * const _control_power_method_info_get_power_state_OUT_ARG_pointers[] =
15996{
15997 &_control_power_method_info_get_power_state_OUT_ARG_state,
15998 NULL
15999};
16000
16001static const _ExtendedGDBusMethodInfo _control_power_method_info_get_power_state =
16002{
16003 {
16004 -1,
16005 (gchar *) "getPowerState",
16006 NULL,
16007 (GDBusArgInfo **) &_control_power_method_info_get_power_state_OUT_ARG_pointers,
16008 NULL
16009 },
16010 "handle-get-power-state",
16011 FALSE
16012};
16013
16014static const _ExtendedGDBusMethodInfo * const _control_power_method_info_pointers[] =
16015{
16016 &_control_power_method_info_set_power_state,
16017 &_control_power_method_info_get_power_state,
16018 NULL
16019};
16020
16021static const _ExtendedGDBusSignalInfo _control_power_signal_info_power_good =
16022{
16023 {
16024 -1,
16025 (gchar *) "PowerGood",
16026 NULL,
16027 NULL
16028 },
16029 "power-good"
16030};
16031
16032static const _ExtendedGDBusSignalInfo _control_power_signal_info_power_lost =
16033{
16034 {
16035 -1,
16036 (gchar *) "PowerLost",
16037 NULL,
16038 NULL
16039 },
16040 "power-lost"
16041};
16042
16043static const _ExtendedGDBusSignalInfo * const _control_power_signal_info_pointers[] =
16044{
16045 &_control_power_signal_info_power_good,
16046 &_control_power_signal_info_power_lost,
16047 NULL
16048};
16049
16050static const _ExtendedGDBusPropertyInfo _control_power_property_info_pgood =
16051{
16052 {
16053 -1,
16054 (gchar *) "pgood",
16055 (gchar *) "i",
16056 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
16057 NULL
16058 },
16059 "pgood",
16060 FALSE
16061};
16062
16063static const _ExtendedGDBusPropertyInfo _control_power_property_info_state =
16064{
16065 {
16066 -1,
16067 (gchar *) "state",
16068 (gchar *) "i",
16069 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
16070 NULL
16071 },
16072 "state",
16073 FALSE
16074};
16075
Norman James32e74e22015-09-15 21:28:06 -050016076static const _ExtendedGDBusPropertyInfo _control_power_property_info_pgood_timeout =
16077{
16078 {
16079 -1,
16080 (gchar *) "pgood_timeout",
16081 (gchar *) "i",
16082 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
16083 NULL
16084 },
16085 "pgood-timeout",
16086 FALSE
16087};
16088
Norman James362a80f2015-09-14 14:04:39 -050016089static const _ExtendedGDBusPropertyInfo * const _control_power_property_info_pointers[] =
16090{
16091 &_control_power_property_info_pgood,
16092 &_control_power_property_info_state,
Norman James32e74e22015-09-15 21:28:06 -050016093 &_control_power_property_info_pgood_timeout,
Norman James362a80f2015-09-14 14:04:39 -050016094 NULL
16095};
16096
16097static const _ExtendedGDBusInterfaceInfo _control_power_interface_info =
16098{
16099 {
16100 -1,
16101 (gchar *) "org.openbmc.control.Power",
16102 (GDBusMethodInfo **) &_control_power_method_info_pointers,
16103 (GDBusSignalInfo **) &_control_power_signal_info_pointers,
16104 (GDBusPropertyInfo **) &_control_power_property_info_pointers,
16105 NULL
16106 },
16107 "control-power",
16108};
16109
16110
16111/**
16112 * control_power_interface_info:
16113 *
16114 * 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.
16115 *
16116 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
16117 */
16118GDBusInterfaceInfo *
16119control_power_interface_info (void)
16120{
16121 return (GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct;
16122}
16123
16124/**
16125 * control_power_override_properties:
16126 * @klass: The class structure for a #GObject<!-- -->-derived class.
16127 * @property_id_begin: The property id to assign to the first overridden property.
16128 *
16129 * Overrides all #GObject properties in the #ControlPower interface for a concrete class.
16130 * The properties are overridden in the order they are defined.
16131 *
16132 * Returns: The last property id.
16133 */
16134guint
16135control_power_override_properties (GObjectClass *klass, guint property_id_begin)
16136{
16137 g_object_class_override_property (klass, property_id_begin++, "pgood");
16138 g_object_class_override_property (klass, property_id_begin++, "state");
Norman James32e74e22015-09-15 21:28:06 -050016139 g_object_class_override_property (klass, property_id_begin++, "pgood-timeout");
Norman James362a80f2015-09-14 14:04:39 -050016140 return property_id_begin - 1;
16141}
16142
16143
16144
16145/**
16146 * ControlPower:
16147 *
16148 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Power.top_of_page">org.openbmc.control.Power</link>.
16149 */
16150
16151/**
16152 * ControlPowerIface:
16153 * @parent_iface: The parent interface.
16154 * @handle_get_power_state: Handler for the #ControlPower::handle-get-power-state signal.
16155 * @handle_set_power_state: Handler for the #ControlPower::handle-set-power-state signal.
16156 * @get_pgood: Getter for the #ControlPower:pgood property.
Norman James32e74e22015-09-15 21:28:06 -050016157 * @get_pgood_timeout: Getter for the #ControlPower:pgood-timeout property.
Norman James362a80f2015-09-14 14:04:39 -050016158 * @get_state: Getter for the #ControlPower:state property.
16159 * @power_good: Handler for the #ControlPower::power-good signal.
16160 * @power_lost: Handler for the #ControlPower::power-lost signal.
16161 *
16162 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Power.top_of_page">org.openbmc.control.Power</link>.
16163 */
16164
16165typedef ControlPowerIface ControlPowerInterface;
16166G_DEFINE_INTERFACE (ControlPower, control_power, G_TYPE_OBJECT);
16167
16168static void
16169control_power_default_init (ControlPowerIface *iface)
16170{
16171 /* GObject signals for incoming D-Bus method calls: */
16172 /**
16173 * ControlPower::handle-set-power-state:
16174 * @object: A #ControlPower.
16175 * @invocation: A #GDBusMethodInvocation.
16176 * @arg_state: Argument passed by remote caller.
16177 *
16178 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Power.setPowerState">setPowerState()</link> D-Bus method.
16179 *
16180 * 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.
16181 *
16182 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
16183 */
16184 g_signal_new ("handle-set-power-state",
16185 G_TYPE_FROM_INTERFACE (iface),
16186 G_SIGNAL_RUN_LAST,
16187 G_STRUCT_OFFSET (ControlPowerIface, handle_set_power_state),
16188 g_signal_accumulator_true_handled,
16189 NULL,
16190 g_cclosure_marshal_generic,
16191 G_TYPE_BOOLEAN,
16192 2,
16193 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT);
16194
16195 /**
16196 * ControlPower::handle-get-power-state:
16197 * @object: A #ControlPower.
16198 * @invocation: A #GDBusMethodInvocation.
16199 *
16200 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-control-Power.getPowerState">getPowerState()</link> D-Bus method.
16201 *
16202 * 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.
16203 *
16204 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
16205 */
16206 g_signal_new ("handle-get-power-state",
16207 G_TYPE_FROM_INTERFACE (iface),
16208 G_SIGNAL_RUN_LAST,
16209 G_STRUCT_OFFSET (ControlPowerIface, handle_get_power_state),
16210 g_signal_accumulator_true_handled,
16211 NULL,
16212 g_cclosure_marshal_generic,
16213 G_TYPE_BOOLEAN,
16214 1,
16215 G_TYPE_DBUS_METHOD_INVOCATION);
16216
16217 /* GObject signals for received D-Bus signals: */
16218 /**
16219 * ControlPower::power-good:
16220 * @object: A #ControlPower.
16221 *
16222 * 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.
16223 *
16224 * 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.
16225 */
16226 g_signal_new ("power-good",
16227 G_TYPE_FROM_INTERFACE (iface),
16228 G_SIGNAL_RUN_LAST,
16229 G_STRUCT_OFFSET (ControlPowerIface, power_good),
16230 NULL,
16231 NULL,
16232 g_cclosure_marshal_generic,
16233 G_TYPE_NONE,
16234 0);
16235
16236 /**
16237 * ControlPower::power-lost:
16238 * @object: A #ControlPower.
16239 *
16240 * 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.
16241 *
16242 * 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.
16243 */
16244 g_signal_new ("power-lost",
16245 G_TYPE_FROM_INTERFACE (iface),
16246 G_SIGNAL_RUN_LAST,
16247 G_STRUCT_OFFSET (ControlPowerIface, power_lost),
16248 NULL,
16249 NULL,
16250 g_cclosure_marshal_generic,
16251 G_TYPE_NONE,
16252 0);
16253
16254 /* GObject properties for D-Bus properties: */
16255 /**
16256 * ControlPower:pgood:
16257 *
16258 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-control-Power.pgood">"pgood"</link>.
16259 *
16260 * 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.
16261 */
16262 g_object_interface_install_property (iface,
16263 g_param_spec_int ("pgood", "pgood", "pgood", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
16264 /**
16265 * ControlPower:state:
16266 *
16267 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-control-Power.state">"state"</link>.
16268 *
16269 * 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.
16270 */
16271 g_object_interface_install_property (iface,
16272 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 -050016273 /**
16274 * ControlPower:pgood-timeout:
16275 *
16276 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-control-Power.pgood_timeout">"pgood_timeout"</link>.
16277 *
16278 * 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.
16279 */
16280 g_object_interface_install_property (iface,
16281 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 -050016282}
16283
16284/**
16285 * control_power_get_pgood: (skip)
16286 * @object: A #ControlPower.
16287 *
16288 * Gets the value of the <link linkend="gdbus-property-org-openbmc-control-Power.pgood">"pgood"</link> D-Bus property.
16289 *
16290 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
16291 *
16292 * Returns: The property value.
16293 */
16294gint
16295control_power_get_pgood (ControlPower *object)
16296{
16297 return CONTROL_POWER_GET_IFACE (object)->get_pgood (object);
16298}
16299
16300/**
16301 * control_power_set_pgood: (skip)
16302 * @object: A #ControlPower.
16303 * @value: The value to set.
16304 *
16305 * Sets the <link linkend="gdbus-property-org-openbmc-control-Power.pgood">"pgood"</link> D-Bus property to @value.
16306 *
16307 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
16308 */
16309void
16310control_power_set_pgood (ControlPower *object, gint value)
16311{
16312 g_object_set (G_OBJECT (object), "pgood", value, NULL);
16313}
16314
16315/**
16316 * control_power_get_state: (skip)
16317 * @object: A #ControlPower.
16318 *
16319 * Gets the value of the <link linkend="gdbus-property-org-openbmc-control-Power.state">"state"</link> D-Bus property.
16320 *
16321 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
16322 *
16323 * Returns: The property value.
16324 */
16325gint
16326control_power_get_state (ControlPower *object)
16327{
16328 return CONTROL_POWER_GET_IFACE (object)->get_state (object);
16329}
16330
16331/**
16332 * control_power_set_state: (skip)
16333 * @object: A #ControlPower.
16334 * @value: The value to set.
16335 *
16336 * Sets the <link linkend="gdbus-property-org-openbmc-control-Power.state">"state"</link> D-Bus property to @value.
16337 *
16338 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
16339 */
16340void
16341control_power_set_state (ControlPower *object, gint value)
16342{
16343 g_object_set (G_OBJECT (object), "state", value, NULL);
16344}
16345
16346/**
Norman James32e74e22015-09-15 21:28:06 -050016347 * control_power_get_pgood_timeout: (skip)
16348 * @object: A #ControlPower.
16349 *
16350 * Gets the value of the <link linkend="gdbus-property-org-openbmc-control-Power.pgood_timeout">"pgood_timeout"</link> D-Bus property.
16351 *
16352 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
16353 *
16354 * Returns: The property value.
16355 */
16356gint
16357control_power_get_pgood_timeout (ControlPower *object)
16358{
16359 return CONTROL_POWER_GET_IFACE (object)->get_pgood_timeout (object);
16360}
16361
16362/**
16363 * control_power_set_pgood_timeout: (skip)
16364 * @object: A #ControlPower.
16365 * @value: The value to set.
16366 *
16367 * Sets the <link linkend="gdbus-property-org-openbmc-control-Power.pgood_timeout">"pgood_timeout"</link> D-Bus property to @value.
16368 *
16369 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
16370 */
16371void
16372control_power_set_pgood_timeout (ControlPower *object, gint value)
16373{
16374 g_object_set (G_OBJECT (object), "pgood-timeout", value, NULL);
16375}
16376
16377/**
Norman James362a80f2015-09-14 14:04:39 -050016378 * control_power_emit_power_good:
16379 * @object: A #ControlPower.
16380 *
16381 * Emits the <link linkend="gdbus-signal-org-openbmc-control-Power.PowerGood">"PowerGood"</link> D-Bus signal.
16382 */
16383void
16384control_power_emit_power_good (
16385 ControlPower *object)
16386{
16387 g_signal_emit_by_name (object, "power-good");
16388}
16389
16390/**
16391 * control_power_emit_power_lost:
16392 * @object: A #ControlPower.
16393 *
16394 * Emits the <link linkend="gdbus-signal-org-openbmc-control-Power.PowerLost">"PowerLost"</link> D-Bus signal.
16395 */
16396void
16397control_power_emit_power_lost (
16398 ControlPower *object)
16399{
16400 g_signal_emit_by_name (object, "power-lost");
16401}
16402
16403/**
16404 * control_power_call_set_power_state:
16405 * @proxy: A #ControlPowerProxy.
16406 * @arg_state: Argument to pass with the method invocation.
16407 * @cancellable: (allow-none): A #GCancellable or %NULL.
16408 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
16409 * @user_data: User data to pass to @callback.
16410 *
16411 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Power.setPowerState">setPowerState()</link> D-Bus method on @proxy.
16412 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
16413 * You can then call control_power_call_set_power_state_finish() to get the result of the operation.
16414 *
16415 * See control_power_call_set_power_state_sync() for the synchronous, blocking version of this method.
16416 */
16417void
16418control_power_call_set_power_state (
16419 ControlPower *proxy,
16420 gint arg_state,
16421 GCancellable *cancellable,
16422 GAsyncReadyCallback callback,
16423 gpointer user_data)
16424{
16425 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
16426 "setPowerState",
16427 g_variant_new ("(i)",
16428 arg_state),
16429 G_DBUS_CALL_FLAGS_NONE,
16430 -1,
16431 cancellable,
16432 callback,
16433 user_data);
16434}
16435
16436/**
16437 * control_power_call_set_power_state_finish:
16438 * @proxy: A #ControlPowerProxy.
16439 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_call_set_power_state().
16440 * @error: Return location for error or %NULL.
16441 *
16442 * Finishes an operation started with control_power_call_set_power_state().
16443 *
16444 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
16445 */
16446gboolean
16447control_power_call_set_power_state_finish (
16448 ControlPower *proxy,
16449 GAsyncResult *res,
16450 GError **error)
16451{
16452 GVariant *_ret;
16453 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
16454 if (_ret == NULL)
16455 goto _out;
16456 g_variant_get (_ret,
16457 "()");
16458 g_variant_unref (_ret);
16459_out:
16460 return _ret != NULL;
16461}
16462
16463/**
16464 * control_power_call_set_power_state_sync:
16465 * @proxy: A #ControlPowerProxy.
16466 * @arg_state: Argument to pass with the method invocation.
16467 * @cancellable: (allow-none): A #GCancellable or %NULL.
16468 * @error: Return location for error or %NULL.
16469 *
16470 * 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.
16471 *
16472 * See control_power_call_set_power_state() for the asynchronous version of this method.
16473 *
16474 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
16475 */
16476gboolean
16477control_power_call_set_power_state_sync (
16478 ControlPower *proxy,
16479 gint arg_state,
16480 GCancellable *cancellable,
16481 GError **error)
16482{
16483 GVariant *_ret;
16484 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
16485 "setPowerState",
16486 g_variant_new ("(i)",
16487 arg_state),
16488 G_DBUS_CALL_FLAGS_NONE,
16489 -1,
16490 cancellable,
16491 error);
16492 if (_ret == NULL)
16493 goto _out;
16494 g_variant_get (_ret,
16495 "()");
16496 g_variant_unref (_ret);
16497_out:
16498 return _ret != NULL;
16499}
16500
16501/**
16502 * control_power_call_get_power_state:
16503 * @proxy: A #ControlPowerProxy.
16504 * @cancellable: (allow-none): A #GCancellable or %NULL.
16505 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
16506 * @user_data: User data to pass to @callback.
16507 *
16508 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-control-Power.getPowerState">getPowerState()</link> D-Bus method on @proxy.
16509 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
16510 * You can then call control_power_call_get_power_state_finish() to get the result of the operation.
16511 *
16512 * See control_power_call_get_power_state_sync() for the synchronous, blocking version of this method.
16513 */
16514void
16515control_power_call_get_power_state (
16516 ControlPower *proxy,
16517 GCancellable *cancellable,
16518 GAsyncReadyCallback callback,
16519 gpointer user_data)
16520{
16521 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
16522 "getPowerState",
16523 g_variant_new ("()"),
16524 G_DBUS_CALL_FLAGS_NONE,
16525 -1,
16526 cancellable,
16527 callback,
16528 user_data);
16529}
16530
16531/**
16532 * control_power_call_get_power_state_finish:
16533 * @proxy: A #ControlPowerProxy.
16534 * @out_state: (out): Return location for return parameter or %NULL to ignore.
16535 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_call_get_power_state().
16536 * @error: Return location for error or %NULL.
16537 *
16538 * Finishes an operation started with control_power_call_get_power_state().
16539 *
16540 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
16541 */
16542gboolean
16543control_power_call_get_power_state_finish (
16544 ControlPower *proxy,
16545 gint *out_state,
16546 GAsyncResult *res,
16547 GError **error)
16548{
16549 GVariant *_ret;
16550 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
16551 if (_ret == NULL)
16552 goto _out;
16553 g_variant_get (_ret,
16554 "(i)",
16555 out_state);
16556 g_variant_unref (_ret);
16557_out:
16558 return _ret != NULL;
16559}
16560
16561/**
16562 * control_power_call_get_power_state_sync:
16563 * @proxy: A #ControlPowerProxy.
16564 * @out_state: (out): Return location for return parameter or %NULL to ignore.
16565 * @cancellable: (allow-none): A #GCancellable or %NULL.
16566 * @error: Return location for error or %NULL.
16567 *
16568 * 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.
16569 *
16570 * See control_power_call_get_power_state() for the asynchronous version of this method.
16571 *
16572 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
16573 */
16574gboolean
16575control_power_call_get_power_state_sync (
16576 ControlPower *proxy,
16577 gint *out_state,
16578 GCancellable *cancellable,
16579 GError **error)
16580{
16581 GVariant *_ret;
16582 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
16583 "getPowerState",
16584 g_variant_new ("()"),
16585 G_DBUS_CALL_FLAGS_NONE,
16586 -1,
16587 cancellable,
16588 error);
16589 if (_ret == NULL)
16590 goto _out;
16591 g_variant_get (_ret,
16592 "(i)",
16593 out_state);
16594 g_variant_unref (_ret);
16595_out:
16596 return _ret != NULL;
16597}
16598
16599/**
16600 * control_power_complete_set_power_state:
16601 * @object: A #ControlPower.
16602 * @invocation: (transfer full): A #GDBusMethodInvocation.
16603 *
16604 * 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.
16605 *
16606 * This method will free @invocation, you cannot use it afterwards.
16607 */
16608void
16609control_power_complete_set_power_state (
16610 ControlPower *object,
16611 GDBusMethodInvocation *invocation)
16612{
16613 g_dbus_method_invocation_return_value (invocation,
16614 g_variant_new ("()"));
16615}
16616
16617/**
16618 * control_power_complete_get_power_state:
16619 * @object: A #ControlPower.
16620 * @invocation: (transfer full): A #GDBusMethodInvocation.
16621 * @state: Parameter to return.
16622 *
16623 * 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.
16624 *
16625 * This method will free @invocation, you cannot use it afterwards.
16626 */
16627void
16628control_power_complete_get_power_state (
16629 ControlPower *object,
16630 GDBusMethodInvocation *invocation,
16631 gint state)
16632{
16633 g_dbus_method_invocation_return_value (invocation,
16634 g_variant_new ("(i)",
16635 state));
16636}
16637
16638/* ------------------------------------------------------------------------ */
16639
16640/**
16641 * ControlPowerProxy:
16642 *
16643 * The #ControlPowerProxy structure contains only private data and should only be accessed using the provided API.
16644 */
16645
16646/**
16647 * ControlPowerProxyClass:
16648 * @parent_class: The parent class.
16649 *
16650 * Class structure for #ControlPowerProxy.
16651 */
16652
16653struct _ControlPowerProxyPrivate
16654{
16655 GData *qdata;
16656};
16657
16658static void control_power_proxy_iface_init (ControlPowerIface *iface);
16659
16660#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
16661G_DEFINE_TYPE_WITH_CODE (ControlPowerProxy, control_power_proxy, G_TYPE_DBUS_PROXY,
16662 G_ADD_PRIVATE (ControlPowerProxy)
16663 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_proxy_iface_init));
16664
16665#else
16666G_DEFINE_TYPE_WITH_CODE (ControlPowerProxy, control_power_proxy, G_TYPE_DBUS_PROXY,
16667 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_proxy_iface_init));
16668
16669#endif
16670static void
16671control_power_proxy_finalize (GObject *object)
16672{
16673 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (object);
16674 g_datalist_clear (&proxy->priv->qdata);
16675 G_OBJECT_CLASS (control_power_proxy_parent_class)->finalize (object);
16676}
16677
16678static void
16679control_power_proxy_get_property (GObject *object,
16680 guint prop_id,
16681 GValue *value,
16682 GParamSpec *pspec G_GNUC_UNUSED)
16683{
16684 const _ExtendedGDBusPropertyInfo *info;
16685 GVariant *variant;
Norman James32e74e22015-09-15 21:28:06 -050016686 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -050016687 info = _control_power_property_info_pointers[prop_id - 1];
16688 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
16689 if (info->use_gvariant)
16690 {
16691 g_value_set_variant (value, variant);
16692 }
16693 else
16694 {
16695 if (variant != NULL)
16696 g_dbus_gvariant_to_gvalue (variant, value);
16697 }
16698 if (variant != NULL)
16699 g_variant_unref (variant);
16700}
16701
16702static void
16703control_power_proxy_set_property_cb (GDBusProxy *proxy,
16704 GAsyncResult *res,
16705 gpointer user_data)
16706{
16707 const _ExtendedGDBusPropertyInfo *info = user_data;
16708 GError *error;
16709 GVariant *_ret;
16710 error = NULL;
16711 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
16712 if (!_ret)
16713 {
16714 g_warning ("Error setting property '%s' on interface org.openbmc.control.Power: %s (%s, %d)",
16715 info->parent_struct.name,
16716 error->message, g_quark_to_string (error->domain), error->code);
16717 g_error_free (error);
16718 }
16719 else
16720 {
16721 g_variant_unref (_ret);
16722 }
16723}
16724
16725static void
16726control_power_proxy_set_property (GObject *object,
16727 guint prop_id,
16728 const GValue *value,
16729 GParamSpec *pspec G_GNUC_UNUSED)
16730{
16731 const _ExtendedGDBusPropertyInfo *info;
16732 GVariant *variant;
Norman James32e74e22015-09-15 21:28:06 -050016733 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -050016734 info = _control_power_property_info_pointers[prop_id - 1];
16735 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
16736 g_dbus_proxy_call (G_DBUS_PROXY (object),
16737 "org.freedesktop.DBus.Properties.Set",
16738 g_variant_new ("(ssv)", "org.openbmc.control.Power", info->parent_struct.name, variant),
16739 G_DBUS_CALL_FLAGS_NONE,
16740 -1,
16741 NULL, (GAsyncReadyCallback) control_power_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
16742 g_variant_unref (variant);
16743}
16744
16745static void
16746control_power_proxy_g_signal (GDBusProxy *proxy,
16747 const gchar *sender_name G_GNUC_UNUSED,
16748 const gchar *signal_name,
16749 GVariant *parameters)
16750{
16751 _ExtendedGDBusSignalInfo *info;
16752 GVariantIter iter;
16753 GVariant *child;
16754 GValue *paramv;
16755 guint num_params;
16756 guint n;
16757 guint signal_id;
16758 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, signal_name);
16759 if (info == NULL)
16760 return;
16761 num_params = g_variant_n_children (parameters);
16762 paramv = g_new0 (GValue, num_params + 1);
16763 g_value_init (&paramv[0], TYPE_CONTROL_POWER);
16764 g_value_set_object (&paramv[0], proxy);
16765 g_variant_iter_init (&iter, parameters);
16766 n = 1;
16767 while ((child = g_variant_iter_next_value (&iter)) != NULL)
16768 {
16769 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
16770 if (arg_info->use_gvariant)
16771 {
16772 g_value_init (&paramv[n], G_TYPE_VARIANT);
16773 g_value_set_variant (&paramv[n], child);
16774 n++;
16775 }
16776 else
16777 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
16778 g_variant_unref (child);
16779 }
16780 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_POWER);
16781 g_signal_emitv (paramv, signal_id, 0, NULL);
16782 for (n = 0; n < num_params + 1; n++)
16783 g_value_unset (&paramv[n]);
16784 g_free (paramv);
16785}
16786
16787static void
16788control_power_proxy_g_properties_changed (GDBusProxy *_proxy,
16789 GVariant *changed_properties,
16790 const gchar *const *invalidated_properties)
16791{
16792 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (_proxy);
16793 guint n;
16794 const gchar *key;
16795 GVariantIter *iter;
16796 _ExtendedGDBusPropertyInfo *info;
16797 g_variant_get (changed_properties, "a{sv}", &iter);
16798 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
16799 {
16800 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, key);
16801 g_datalist_remove_data (&proxy->priv->qdata, key);
16802 if (info != NULL)
16803 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
16804 }
16805 g_variant_iter_free (iter);
16806 for (n = 0; invalidated_properties[n] != NULL; n++)
16807 {
16808 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, invalidated_properties[n]);
16809 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
16810 if (info != NULL)
16811 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
16812 }
16813}
16814
16815static gint
16816control_power_proxy_get_pgood (ControlPower *object)
16817{
16818 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (object);
16819 GVariant *variant;
16820 gint value = 0;
16821 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "pgood");
16822 if (variant != NULL)
16823 {
16824 value = g_variant_get_int32 (variant);
16825 g_variant_unref (variant);
16826 }
16827 return value;
16828}
16829
16830static gint
16831control_power_proxy_get_state (ControlPower *object)
16832{
16833 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (object);
16834 GVariant *variant;
16835 gint value = 0;
16836 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state");
16837 if (variant != NULL)
16838 {
16839 value = g_variant_get_int32 (variant);
16840 g_variant_unref (variant);
16841 }
16842 return value;
16843}
16844
Norman James32e74e22015-09-15 21:28:06 -050016845static gint
16846control_power_proxy_get_pgood_timeout (ControlPower *object)
16847{
16848 ControlPowerProxy *proxy = CONTROL_POWER_PROXY (object);
16849 GVariant *variant;
16850 gint value = 0;
16851 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "pgood_timeout");
16852 if (variant != NULL)
16853 {
16854 value = g_variant_get_int32 (variant);
16855 g_variant_unref (variant);
16856 }
16857 return value;
16858}
16859
Norman James362a80f2015-09-14 14:04:39 -050016860static void
16861control_power_proxy_init (ControlPowerProxy *proxy)
16862{
16863#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
16864 proxy->priv = control_power_proxy_get_instance_private (proxy);
16865#else
16866 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_CONTROL_POWER_PROXY, ControlPowerProxyPrivate);
16867#endif
16868
16869 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), control_power_interface_info ());
16870}
16871
16872static void
16873control_power_proxy_class_init (ControlPowerProxyClass *klass)
16874{
16875 GObjectClass *gobject_class;
16876 GDBusProxyClass *proxy_class;
16877
16878 gobject_class = G_OBJECT_CLASS (klass);
16879 gobject_class->finalize = control_power_proxy_finalize;
16880 gobject_class->get_property = control_power_proxy_get_property;
16881 gobject_class->set_property = control_power_proxy_set_property;
16882
16883 proxy_class = G_DBUS_PROXY_CLASS (klass);
16884 proxy_class->g_signal = control_power_proxy_g_signal;
16885 proxy_class->g_properties_changed = control_power_proxy_g_properties_changed;
16886
16887 control_power_override_properties (gobject_class, 1);
16888
16889#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
16890 g_type_class_add_private (klass, sizeof (ControlPowerProxyPrivate));
16891#endif
16892}
16893
16894static void
16895control_power_proxy_iface_init (ControlPowerIface *iface)
16896{
16897 iface->get_pgood = control_power_proxy_get_pgood;
16898 iface->get_state = control_power_proxy_get_state;
Norman James32e74e22015-09-15 21:28:06 -050016899 iface->get_pgood_timeout = control_power_proxy_get_pgood_timeout;
Norman James362a80f2015-09-14 14:04:39 -050016900}
16901
16902/**
16903 * control_power_proxy_new:
16904 * @connection: A #GDBusConnection.
16905 * @flags: Flags from the #GDBusProxyFlags enumeration.
16906 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
16907 * @object_path: An object path.
16908 * @cancellable: (allow-none): A #GCancellable or %NULL.
16909 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
16910 * @user_data: User data to pass to @callback.
16911 *
16912 * 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.
16913 *
16914 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
16915 * You can then call control_power_proxy_new_finish() to get the result of the operation.
16916 *
16917 * See control_power_proxy_new_sync() for the synchronous, blocking version of this constructor.
16918 */
16919void
16920control_power_proxy_new (
16921 GDBusConnection *connection,
16922 GDBusProxyFlags flags,
16923 const gchar *name,
16924 const gchar *object_path,
16925 GCancellable *cancellable,
16926 GAsyncReadyCallback callback,
16927 gpointer user_data)
16928{
16929 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);
16930}
16931
16932/**
16933 * control_power_proxy_new_finish:
16934 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_proxy_new().
16935 * @error: Return location for error or %NULL
16936 *
16937 * Finishes an operation started with control_power_proxy_new().
16938 *
16939 * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set.
16940 */
16941ControlPower *
16942control_power_proxy_new_finish (
16943 GAsyncResult *res,
16944 GError **error)
16945{
16946 GObject *ret;
16947 GObject *source_object;
16948 source_object = g_async_result_get_source_object (res);
16949 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
16950 g_object_unref (source_object);
16951 if (ret != NULL)
16952 return CONTROL_POWER (ret);
16953 else
16954 return NULL;
16955}
16956
16957/**
16958 * control_power_proxy_new_sync:
16959 * @connection: A #GDBusConnection.
16960 * @flags: Flags from the #GDBusProxyFlags enumeration.
16961 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
16962 * @object_path: An object path.
16963 * @cancellable: (allow-none): A #GCancellable or %NULL.
16964 * @error: Return location for error or %NULL
16965 *
16966 * 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.
16967 *
16968 * The calling thread is blocked until a reply is received.
16969 *
16970 * See control_power_proxy_new() for the asynchronous version of this constructor.
16971 *
16972 * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set.
16973 */
16974ControlPower *
16975control_power_proxy_new_sync (
16976 GDBusConnection *connection,
16977 GDBusProxyFlags flags,
16978 const gchar *name,
16979 const gchar *object_path,
16980 GCancellable *cancellable,
16981 GError **error)
16982{
16983 GInitable *ret;
16984 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);
16985 if (ret != NULL)
16986 return CONTROL_POWER (ret);
16987 else
16988 return NULL;
16989}
16990
16991
16992/**
16993 * control_power_proxy_new_for_bus:
16994 * @bus_type: A #GBusType.
16995 * @flags: Flags from the #GDBusProxyFlags enumeration.
16996 * @name: A bus name (well-known or unique).
16997 * @object_path: An object path.
16998 * @cancellable: (allow-none): A #GCancellable or %NULL.
16999 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
17000 * @user_data: User data to pass to @callback.
17001 *
17002 * Like control_power_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
17003 *
17004 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
17005 * You can then call control_power_proxy_new_for_bus_finish() to get the result of the operation.
17006 *
17007 * See control_power_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
17008 */
17009void
17010control_power_proxy_new_for_bus (
17011 GBusType bus_type,
17012 GDBusProxyFlags flags,
17013 const gchar *name,
17014 const gchar *object_path,
17015 GCancellable *cancellable,
17016 GAsyncReadyCallback callback,
17017 gpointer user_data)
17018{
17019 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);
17020}
17021
17022/**
17023 * control_power_proxy_new_for_bus_finish:
17024 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to control_power_proxy_new_for_bus().
17025 * @error: Return location for error or %NULL
17026 *
17027 * Finishes an operation started with control_power_proxy_new_for_bus().
17028 *
17029 * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set.
17030 */
17031ControlPower *
17032control_power_proxy_new_for_bus_finish (
17033 GAsyncResult *res,
17034 GError **error)
17035{
17036 GObject *ret;
17037 GObject *source_object;
17038 source_object = g_async_result_get_source_object (res);
17039 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
17040 g_object_unref (source_object);
17041 if (ret != NULL)
17042 return CONTROL_POWER (ret);
17043 else
17044 return NULL;
17045}
17046
17047/**
17048 * control_power_proxy_new_for_bus_sync:
17049 * @bus_type: A #GBusType.
17050 * @flags: Flags from the #GDBusProxyFlags enumeration.
17051 * @name: A bus name (well-known or unique).
17052 * @object_path: An object path.
17053 * @cancellable: (allow-none): A #GCancellable or %NULL.
17054 * @error: Return location for error or %NULL
17055 *
17056 * Like control_power_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
17057 *
17058 * The calling thread is blocked until a reply is received.
17059 *
17060 * See control_power_proxy_new_for_bus() for the asynchronous version of this constructor.
17061 *
17062 * Returns: (transfer full) (type ControlPowerProxy): The constructed proxy object or %NULL if @error is set.
17063 */
17064ControlPower *
17065control_power_proxy_new_for_bus_sync (
17066 GBusType bus_type,
17067 GDBusProxyFlags flags,
17068 const gchar *name,
17069 const gchar *object_path,
17070 GCancellable *cancellable,
17071 GError **error)
17072{
17073 GInitable *ret;
17074 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);
17075 if (ret != NULL)
17076 return CONTROL_POWER (ret);
17077 else
17078 return NULL;
17079}
17080
17081
17082/* ------------------------------------------------------------------------ */
17083
17084/**
17085 * ControlPowerSkeleton:
17086 *
17087 * The #ControlPowerSkeleton structure contains only private data and should only be accessed using the provided API.
17088 */
17089
17090/**
17091 * ControlPowerSkeletonClass:
17092 * @parent_class: The parent class.
17093 *
17094 * Class structure for #ControlPowerSkeleton.
17095 */
17096
17097struct _ControlPowerSkeletonPrivate
17098{
17099 GValue *properties;
17100 GList *changed_properties;
17101 GSource *changed_properties_idle_source;
17102 GMainContext *context;
17103 GMutex lock;
17104};
17105
17106static void
17107_control_power_skeleton_handle_method_call (
17108 GDBusConnection *connection G_GNUC_UNUSED,
17109 const gchar *sender G_GNUC_UNUSED,
17110 const gchar *object_path G_GNUC_UNUSED,
17111 const gchar *interface_name,
17112 const gchar *method_name,
17113 GVariant *parameters,
17114 GDBusMethodInvocation *invocation,
17115 gpointer user_data)
17116{
17117 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data);
17118 _ExtendedGDBusMethodInfo *info;
17119 GVariantIter iter;
17120 GVariant *child;
17121 GValue *paramv;
17122 guint num_params;
17123 guint num_extra;
17124 guint n;
17125 guint signal_id;
17126 GValue return_value = G_VALUE_INIT;
17127 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
17128 g_assert (info != NULL);
17129 num_params = g_variant_n_children (parameters);
17130 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
17131 n = 0;
17132 g_value_init (&paramv[n], TYPE_CONTROL_POWER);
17133 g_value_set_object (&paramv[n++], skeleton);
17134 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
17135 g_value_set_object (&paramv[n++], invocation);
17136 if (info->pass_fdlist)
17137 {
17138#ifdef G_OS_UNIX
17139 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
17140 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
17141#else
17142 g_assert_not_reached ();
17143#endif
17144 }
17145 g_variant_iter_init (&iter, parameters);
17146 while ((child = g_variant_iter_next_value (&iter)) != NULL)
17147 {
17148 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
17149 if (arg_info->use_gvariant)
17150 {
17151 g_value_init (&paramv[n], G_TYPE_VARIANT);
17152 g_value_set_variant (&paramv[n], child);
17153 n++;
17154 }
17155 else
17156 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
17157 g_variant_unref (child);
17158 }
17159 signal_id = g_signal_lookup (info->signal_name, TYPE_CONTROL_POWER);
17160 g_value_init (&return_value, G_TYPE_BOOLEAN);
17161 g_signal_emitv (paramv, signal_id, 0, &return_value);
17162 if (!g_value_get_boolean (&return_value))
17163 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);
17164 g_value_unset (&return_value);
17165 for (n = 0; n < num_params + num_extra; n++)
17166 g_value_unset (&paramv[n]);
17167 g_free (paramv);
17168}
17169
17170static GVariant *
17171_control_power_skeleton_handle_get_property (
17172 GDBusConnection *connection G_GNUC_UNUSED,
17173 const gchar *sender G_GNUC_UNUSED,
17174 const gchar *object_path G_GNUC_UNUSED,
17175 const gchar *interface_name G_GNUC_UNUSED,
17176 const gchar *property_name,
17177 GError **error,
17178 gpointer user_data)
17179{
17180 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data);
17181 GValue value = G_VALUE_INIT;
17182 GParamSpec *pspec;
17183 _ExtendedGDBusPropertyInfo *info;
17184 GVariant *ret;
17185 ret = NULL;
17186 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, property_name);
17187 g_assert (info != NULL);
17188 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
17189 if (pspec == NULL)
17190 {
17191 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
17192 }
17193 else
17194 {
17195 g_value_init (&value, pspec->value_type);
17196 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
17197 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
17198 g_value_unset (&value);
17199 }
17200 return ret;
17201}
17202
17203static gboolean
17204_control_power_skeleton_handle_set_property (
17205 GDBusConnection *connection G_GNUC_UNUSED,
17206 const gchar *sender G_GNUC_UNUSED,
17207 const gchar *object_path G_GNUC_UNUSED,
17208 const gchar *interface_name G_GNUC_UNUSED,
17209 const gchar *property_name,
17210 GVariant *variant,
17211 GError **error,
17212 gpointer user_data)
17213{
17214 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data);
17215 GValue value = G_VALUE_INIT;
17216 GParamSpec *pspec;
17217 _ExtendedGDBusPropertyInfo *info;
17218 gboolean ret;
17219 ret = FALSE;
17220 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_control_power_interface_info.parent_struct, property_name);
17221 g_assert (info != NULL);
17222 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
17223 if (pspec == NULL)
17224 {
17225 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
17226 }
17227 else
17228 {
17229 if (info->use_gvariant)
17230 g_value_set_variant (&value, variant);
17231 else
17232 g_dbus_gvariant_to_gvalue (variant, &value);
17233 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
17234 g_value_unset (&value);
17235 ret = TRUE;
17236 }
17237 return ret;
17238}
17239
17240static const GDBusInterfaceVTable _control_power_skeleton_vtable =
17241{
17242 _control_power_skeleton_handle_method_call,
17243 _control_power_skeleton_handle_get_property,
17244 _control_power_skeleton_handle_set_property,
17245 {NULL}
17246};
17247
17248static GDBusInterfaceInfo *
17249control_power_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
17250{
17251 return control_power_interface_info ();
17252}
17253
17254static GDBusInterfaceVTable *
17255control_power_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
17256{
17257 return (GDBusInterfaceVTable *) &_control_power_skeleton_vtable;
17258}
17259
17260static GVariant *
17261control_power_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
17262{
17263 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (_skeleton);
17264
17265 GVariantBuilder builder;
17266 guint n;
17267 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
17268 if (_control_power_interface_info.parent_struct.properties == NULL)
17269 goto out;
17270 for (n = 0; _control_power_interface_info.parent_struct.properties[n] != NULL; n++)
17271 {
17272 GDBusPropertyInfo *info = _control_power_interface_info.parent_struct.properties[n];
17273 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
17274 {
17275 GVariant *value;
17276 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);
17277 if (value != NULL)
17278 {
17279 g_variant_take_ref (value);
17280 g_variant_builder_add (&builder, "{sv}", info->name, value);
17281 g_variant_unref (value);
17282 }
17283 }
17284 }
17285out:
17286 return g_variant_builder_end (&builder);
17287}
17288
17289static gboolean _control_power_emit_changed (gpointer user_data);
17290
17291static void
17292control_power_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
17293{
17294 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (_skeleton);
17295 gboolean emit_changed = FALSE;
17296
17297 g_mutex_lock (&skeleton->priv->lock);
17298 if (skeleton->priv->changed_properties_idle_source != NULL)
17299 {
17300 g_source_destroy (skeleton->priv->changed_properties_idle_source);
17301 skeleton->priv->changed_properties_idle_source = NULL;
17302 emit_changed = TRUE;
17303 }
17304 g_mutex_unlock (&skeleton->priv->lock);
17305
17306 if (emit_changed)
17307 _control_power_emit_changed (skeleton);
17308}
17309
17310static void
17311_control_power_on_signal_power_good (
17312 ControlPower *object)
17313{
17314 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
17315
17316 GList *connections, *l;
17317 GVariant *signal_variant;
17318 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
17319
17320 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
17321 for (l = connections; l != NULL; l = l->next)
17322 {
17323 GDBusConnection *connection = l->data;
17324 g_dbus_connection_emit_signal (connection,
17325 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.control.Power", "PowerGood",
17326 signal_variant, NULL);
17327 }
17328 g_variant_unref (signal_variant);
17329 g_list_free_full (connections, g_object_unref);
17330}
17331
17332static void
17333_control_power_on_signal_power_lost (
17334 ControlPower *object)
17335{
17336 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
17337
17338 GList *connections, *l;
17339 GVariant *signal_variant;
17340 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
17341
17342 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
17343 for (l = connections; l != NULL; l = l->next)
17344 {
17345 GDBusConnection *connection = l->data;
17346 g_dbus_connection_emit_signal (connection,
17347 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.control.Power", "PowerLost",
17348 signal_variant, NULL);
17349 }
17350 g_variant_unref (signal_variant);
17351 g_list_free_full (connections, g_object_unref);
17352}
17353
17354static void control_power_skeleton_iface_init (ControlPowerIface *iface);
17355#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
17356G_DEFINE_TYPE_WITH_CODE (ControlPowerSkeleton, control_power_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
17357 G_ADD_PRIVATE (ControlPowerSkeleton)
17358 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_skeleton_iface_init));
17359
17360#else
17361G_DEFINE_TYPE_WITH_CODE (ControlPowerSkeleton, control_power_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
17362 G_IMPLEMENT_INTERFACE (TYPE_CONTROL_POWER, control_power_skeleton_iface_init));
17363
17364#endif
17365static void
17366control_power_skeleton_finalize (GObject *object)
17367{
17368 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
17369 guint n;
Norman James32e74e22015-09-15 21:28:06 -050017370 for (n = 0; n < 3; n++)
Norman James362a80f2015-09-14 14:04:39 -050017371 g_value_unset (&skeleton->priv->properties[n]);
17372 g_free (skeleton->priv->properties);
17373 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
17374 if (skeleton->priv->changed_properties_idle_source != NULL)
17375 g_source_destroy (skeleton->priv->changed_properties_idle_source);
17376 g_main_context_unref (skeleton->priv->context);
17377 g_mutex_clear (&skeleton->priv->lock);
17378 G_OBJECT_CLASS (control_power_skeleton_parent_class)->finalize (object);
17379}
17380
17381static void
17382control_power_skeleton_get_property (GObject *object,
17383 guint prop_id,
17384 GValue *value,
17385 GParamSpec *pspec G_GNUC_UNUSED)
17386{
17387 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
Norman James32e74e22015-09-15 21:28:06 -050017388 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -050017389 g_mutex_lock (&skeleton->priv->lock);
17390 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
17391 g_mutex_unlock (&skeleton->priv->lock);
17392}
17393
17394static gboolean
17395_control_power_emit_changed (gpointer user_data)
17396{
17397 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (user_data);
17398 GList *l;
17399 GVariantBuilder builder;
17400 GVariantBuilder invalidated_builder;
17401 guint num_changes;
17402
17403 g_mutex_lock (&skeleton->priv->lock);
17404 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
17405 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
17406 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
17407 {
17408 ChangedProperty *cp = l->data;
17409 GVariant *variant;
17410 const GValue *cur_value;
17411
17412 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
17413 if (!_g_value_equal (cur_value, &cp->orig_value))
17414 {
17415 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
17416 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
17417 g_variant_unref (variant);
17418 num_changes++;
17419 }
17420 }
17421 if (num_changes > 0)
17422 {
17423 GList *connections, *ll;
17424 GVariant *signal_variant;
17425 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.control.Power",
17426 &builder, &invalidated_builder));
17427 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
17428 for (ll = connections; ll != NULL; ll = ll->next)
17429 {
17430 GDBusConnection *connection = ll->data;
17431
17432 g_dbus_connection_emit_signal (connection,
17433 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
17434 "org.freedesktop.DBus.Properties",
17435 "PropertiesChanged",
17436 signal_variant,
17437 NULL);
17438 }
17439 g_variant_unref (signal_variant);
17440 g_list_free_full (connections, g_object_unref);
17441 }
17442 else
17443 {
17444 g_variant_builder_clear (&builder);
17445 g_variant_builder_clear (&invalidated_builder);
17446 }
17447 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
17448 skeleton->priv->changed_properties = NULL;
17449 skeleton->priv->changed_properties_idle_source = NULL;
17450 g_mutex_unlock (&skeleton->priv->lock);
17451 return FALSE;
17452}
17453
17454static void
17455_control_power_schedule_emit_changed (ControlPowerSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
17456{
17457 ChangedProperty *cp;
17458 GList *l;
17459 cp = NULL;
17460 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
17461 {
17462 ChangedProperty *i_cp = l->data;
17463 if (i_cp->info == info)
17464 {
17465 cp = i_cp;
17466 break;
17467 }
17468 }
17469 if (cp == NULL)
17470 {
17471 cp = g_new0 (ChangedProperty, 1);
17472 cp->prop_id = prop_id;
17473 cp->info = info;
17474 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
17475 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
17476 g_value_copy (orig_value, &cp->orig_value);
17477 }
17478}
17479
17480static void
17481control_power_skeleton_notify (GObject *object,
17482 GParamSpec *pspec G_GNUC_UNUSED)
17483{
17484 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
17485 g_mutex_lock (&skeleton->priv->lock);
17486 if (skeleton->priv->changed_properties != NULL &&
17487 skeleton->priv->changed_properties_idle_source == NULL)
17488 {
17489 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
17490 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
17491 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _control_power_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
Adriana Kobylak2cb27752015-10-19 16:23:14 -050017492 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _control_power_emit_changed");
Norman James362a80f2015-09-14 14:04:39 -050017493 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
17494 g_source_unref (skeleton->priv->changed_properties_idle_source);
17495 }
17496 g_mutex_unlock (&skeleton->priv->lock);
17497}
17498
17499static void
17500control_power_skeleton_set_property (GObject *object,
17501 guint prop_id,
17502 const GValue *value,
17503 GParamSpec *pspec)
17504{
17505 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
Norman James32e74e22015-09-15 21:28:06 -050017506 g_assert (prop_id != 0 && prop_id - 1 < 3);
Norman James362a80f2015-09-14 14:04:39 -050017507 g_mutex_lock (&skeleton->priv->lock);
17508 g_object_freeze_notify (object);
17509 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
17510 {
17511 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
17512 _control_power_schedule_emit_changed (skeleton, _control_power_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
17513 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
17514 g_object_notify_by_pspec (object, pspec);
17515 }
17516 g_mutex_unlock (&skeleton->priv->lock);
17517 g_object_thaw_notify (object);
17518}
17519
17520static void
17521control_power_skeleton_init (ControlPowerSkeleton *skeleton)
17522{
17523#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
17524 skeleton->priv = control_power_skeleton_get_instance_private (skeleton);
17525#else
17526 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_CONTROL_POWER_SKELETON, ControlPowerSkeletonPrivate);
17527#endif
17528
17529 g_mutex_init (&skeleton->priv->lock);
17530 skeleton->priv->context = g_main_context_ref_thread_default ();
Norman James32e74e22015-09-15 21:28:06 -050017531 skeleton->priv->properties = g_new0 (GValue, 3);
Norman James362a80f2015-09-14 14:04:39 -050017532 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
17533 g_value_init (&skeleton->priv->properties[1], G_TYPE_INT);
Norman James32e74e22015-09-15 21:28:06 -050017534 g_value_init (&skeleton->priv->properties[2], G_TYPE_INT);
Norman James362a80f2015-09-14 14:04:39 -050017535}
17536
17537static gint
17538control_power_skeleton_get_pgood (ControlPower *object)
17539{
17540 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
17541 gint value;
17542 g_mutex_lock (&skeleton->priv->lock);
17543 value = g_value_get_int (&(skeleton->priv->properties[0]));
17544 g_mutex_unlock (&skeleton->priv->lock);
17545 return value;
17546}
17547
17548static gint
17549control_power_skeleton_get_state (ControlPower *object)
17550{
17551 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
17552 gint value;
17553 g_mutex_lock (&skeleton->priv->lock);
17554 value = g_value_get_int (&(skeleton->priv->properties[1]));
17555 g_mutex_unlock (&skeleton->priv->lock);
17556 return value;
17557}
17558
Norman James32e74e22015-09-15 21:28:06 -050017559static gint
17560control_power_skeleton_get_pgood_timeout (ControlPower *object)
17561{
17562 ControlPowerSkeleton *skeleton = CONTROL_POWER_SKELETON (object);
17563 gint value;
17564 g_mutex_lock (&skeleton->priv->lock);
17565 value = g_value_get_int (&(skeleton->priv->properties[2]));
17566 g_mutex_unlock (&skeleton->priv->lock);
17567 return value;
17568}
17569
Norman James362a80f2015-09-14 14:04:39 -050017570static void
17571control_power_skeleton_class_init (ControlPowerSkeletonClass *klass)
17572{
17573 GObjectClass *gobject_class;
17574 GDBusInterfaceSkeletonClass *skeleton_class;
17575
17576 gobject_class = G_OBJECT_CLASS (klass);
17577 gobject_class->finalize = control_power_skeleton_finalize;
17578 gobject_class->get_property = control_power_skeleton_get_property;
17579 gobject_class->set_property = control_power_skeleton_set_property;
17580 gobject_class->notify = control_power_skeleton_notify;
17581
17582
17583 control_power_override_properties (gobject_class, 1);
17584
17585 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
17586 skeleton_class->get_info = control_power_skeleton_dbus_interface_get_info;
17587 skeleton_class->get_properties = control_power_skeleton_dbus_interface_get_properties;
17588 skeleton_class->flush = control_power_skeleton_dbus_interface_flush;
17589 skeleton_class->get_vtable = control_power_skeleton_dbus_interface_get_vtable;
17590
17591#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
17592 g_type_class_add_private (klass, sizeof (ControlPowerSkeletonPrivate));
17593#endif
17594}
17595
17596static void
17597control_power_skeleton_iface_init (ControlPowerIface *iface)
17598{
17599 iface->power_good = _control_power_on_signal_power_good;
17600 iface->power_lost = _control_power_on_signal_power_lost;
17601 iface->get_pgood = control_power_skeleton_get_pgood;
17602 iface->get_state = control_power_skeleton_get_state;
Norman James32e74e22015-09-15 21:28:06 -050017603 iface->get_pgood_timeout = control_power_skeleton_get_pgood_timeout;
Norman James362a80f2015-09-14 14:04:39 -050017604}
17605
17606/**
17607 * control_power_skeleton_new:
17608 *
17609 * 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>.
17610 *
17611 * Returns: (transfer full) (type ControlPowerSkeleton): The skeleton object.
17612 */
17613ControlPower *
17614control_power_skeleton_new (void)
17615{
17616 return CONTROL_POWER (g_object_new (TYPE_CONTROL_POWER_SKELETON, NULL));
17617}
17618
17619/* ------------------------------------------------------------------------
17620 * Code for interface org.openbmc.Watchdog
17621 * ------------------------------------------------------------------------
17622 */
17623
17624/**
17625 * SECTION:Watchdog
17626 * @title: Watchdog
17627 * @short_description: Generated C code for the org.openbmc.Watchdog D-Bus interface
17628 *
17629 * 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.
17630 */
17631
17632/* ---- Introspection data for org.openbmc.Watchdog ---- */
17633
17634static const _ExtendedGDBusMethodInfo _watchdog_method_info_start =
17635{
17636 {
17637 -1,
17638 (gchar *) "start",
17639 NULL,
17640 NULL,
17641 NULL
17642 },
17643 "handle-start",
17644 FALSE
17645};
17646
17647static const _ExtendedGDBusMethodInfo _watchdog_method_info_poke =
17648{
17649 {
17650 -1,
17651 (gchar *) "poke",
17652 NULL,
17653 NULL,
17654 NULL
17655 },
17656 "handle-poke",
17657 FALSE
17658};
17659
17660static const _ExtendedGDBusMethodInfo _watchdog_method_info_stop =
17661{
17662 {
17663 -1,
17664 (gchar *) "stop",
17665 NULL,
17666 NULL,
17667 NULL
17668 },
17669 "handle-stop",
17670 FALSE
17671};
17672
Adriana Kobylak2cb27752015-10-19 16:23:14 -050017673static const _ExtendedGDBusArgInfo _watchdog_method_info_set_IN_ARG_interval =
17674{
17675 {
17676 -1,
17677 (gchar *) "interval",
17678 (gchar *) "i",
17679 NULL
17680 },
17681 FALSE
17682};
17683
17684static const _ExtendedGDBusArgInfo * const _watchdog_method_info_set_IN_ARG_pointers[] =
17685{
17686 &_watchdog_method_info_set_IN_ARG_interval,
17687 NULL
17688};
17689
17690static const _ExtendedGDBusMethodInfo _watchdog_method_info_set =
17691{
17692 {
17693 -1,
17694 (gchar *) "set",
17695 (GDBusArgInfo **) &_watchdog_method_info_set_IN_ARG_pointers,
17696 NULL,
17697 NULL
17698 },
17699 "handle-set",
17700 FALSE
17701};
17702
Norman James362a80f2015-09-14 14:04:39 -050017703static const _ExtendedGDBusMethodInfo * const _watchdog_method_info_pointers[] =
17704{
17705 &_watchdog_method_info_start,
17706 &_watchdog_method_info_poke,
17707 &_watchdog_method_info_stop,
Adriana Kobylak2cb27752015-10-19 16:23:14 -050017708 &_watchdog_method_info_set,
Norman James362a80f2015-09-14 14:04:39 -050017709 NULL
17710};
17711
17712static const _ExtendedGDBusSignalInfo _watchdog_signal_info_watchdog_error =
17713{
17714 {
17715 -1,
17716 (gchar *) "WatchdogError",
17717 NULL,
17718 NULL
17719 },
17720 "watchdog-error"
17721};
17722
17723static const _ExtendedGDBusSignalInfo * const _watchdog_signal_info_pointers[] =
17724{
17725 &_watchdog_signal_info_watchdog_error,
17726 NULL
17727};
17728
17729static const _ExtendedGDBusPropertyInfo _watchdog_property_info_watchdog =
17730{
17731 {
17732 -1,
17733 (gchar *) "watchdog",
17734 (gchar *) "i",
17735 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
17736 NULL
17737 },
17738 "watchdog",
17739 FALSE
17740};
17741
17742static const _ExtendedGDBusPropertyInfo _watchdog_property_info_poll_interval =
17743{
17744 {
17745 -1,
17746 (gchar *) "poll_interval",
17747 (gchar *) "i",
17748 G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
17749 NULL
17750 },
17751 "poll-interval",
17752 FALSE
17753};
17754
17755static const _ExtendedGDBusPropertyInfo * const _watchdog_property_info_pointers[] =
17756{
17757 &_watchdog_property_info_watchdog,
17758 &_watchdog_property_info_poll_interval,
17759 NULL
17760};
17761
17762static const _ExtendedGDBusInterfaceInfo _watchdog_interface_info =
17763{
17764 {
17765 -1,
17766 (gchar *) "org.openbmc.Watchdog",
17767 (GDBusMethodInfo **) &_watchdog_method_info_pointers,
17768 (GDBusSignalInfo **) &_watchdog_signal_info_pointers,
17769 (GDBusPropertyInfo **) &_watchdog_property_info_pointers,
17770 NULL
17771 },
17772 "watchdog",
17773};
17774
17775
17776/**
17777 * watchdog_interface_info:
17778 *
17779 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link> D-Bus interface.
17780 *
17781 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
17782 */
17783GDBusInterfaceInfo *
17784watchdog_interface_info (void)
17785{
17786 return (GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct;
17787}
17788
17789/**
17790 * watchdog_override_properties:
17791 * @klass: The class structure for a #GObject<!-- -->-derived class.
17792 * @property_id_begin: The property id to assign to the first overridden property.
17793 *
17794 * Overrides all #GObject properties in the #Watchdog interface for a concrete class.
17795 * The properties are overridden in the order they are defined.
17796 *
17797 * Returns: The last property id.
17798 */
17799guint
17800watchdog_override_properties (GObjectClass *klass, guint property_id_begin)
17801{
17802 g_object_class_override_property (klass, property_id_begin++, "watchdog");
17803 g_object_class_override_property (klass, property_id_begin++, "poll-interval");
17804 return property_id_begin - 1;
17805}
17806
17807
17808
17809/**
17810 * Watchdog:
17811 *
17812 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link>.
17813 */
17814
17815/**
17816 * WatchdogIface:
17817 * @parent_iface: The parent interface.
17818 * @handle_poke: Handler for the #Watchdog::handle-poke signal.
Adriana Kobylak2cb27752015-10-19 16:23:14 -050017819 * @handle_set: Handler for the #Watchdog::handle-set signal.
Norman James362a80f2015-09-14 14:04:39 -050017820 * @handle_start: Handler for the #Watchdog::handle-start signal.
17821 * @handle_stop: Handler for the #Watchdog::handle-stop signal.
17822 * @get_poll_interval: Getter for the #Watchdog:poll-interval property.
17823 * @get_watchdog: Getter for the #Watchdog:watchdog property.
17824 * @watchdog_error: Handler for the #Watchdog::watchdog-error signal.
17825 *
17826 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link>.
17827 */
17828
17829typedef WatchdogIface WatchdogInterface;
17830G_DEFINE_INTERFACE (Watchdog, watchdog, G_TYPE_OBJECT);
17831
17832static void
17833watchdog_default_init (WatchdogIface *iface)
17834{
17835 /* GObject signals for incoming D-Bus method calls: */
17836 /**
17837 * Watchdog::handle-start:
17838 * @object: A #Watchdog.
17839 * @invocation: A #GDBusMethodInvocation.
17840 *
17841 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Watchdog.start">start()</link> D-Bus method.
17842 *
17843 * 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.
17844 *
17845 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
17846 */
17847 g_signal_new ("handle-start",
17848 G_TYPE_FROM_INTERFACE (iface),
17849 G_SIGNAL_RUN_LAST,
17850 G_STRUCT_OFFSET (WatchdogIface, handle_start),
17851 g_signal_accumulator_true_handled,
17852 NULL,
17853 g_cclosure_marshal_generic,
17854 G_TYPE_BOOLEAN,
17855 1,
17856 G_TYPE_DBUS_METHOD_INVOCATION);
17857
17858 /**
17859 * Watchdog::handle-poke:
17860 * @object: A #Watchdog.
17861 * @invocation: A #GDBusMethodInvocation.
17862 *
17863 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Watchdog.poke">poke()</link> D-Bus method.
17864 *
17865 * 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.
17866 *
17867 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
17868 */
17869 g_signal_new ("handle-poke",
17870 G_TYPE_FROM_INTERFACE (iface),
17871 G_SIGNAL_RUN_LAST,
17872 G_STRUCT_OFFSET (WatchdogIface, handle_poke),
17873 g_signal_accumulator_true_handled,
17874 NULL,
17875 g_cclosure_marshal_generic,
17876 G_TYPE_BOOLEAN,
17877 1,
17878 G_TYPE_DBUS_METHOD_INVOCATION);
17879
17880 /**
17881 * Watchdog::handle-stop:
17882 * @object: A #Watchdog.
17883 * @invocation: A #GDBusMethodInvocation.
17884 *
17885 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Watchdog.stop">stop()</link> D-Bus method.
17886 *
17887 * 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.
17888 *
17889 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
17890 */
17891 g_signal_new ("handle-stop",
17892 G_TYPE_FROM_INTERFACE (iface),
17893 G_SIGNAL_RUN_LAST,
17894 G_STRUCT_OFFSET (WatchdogIface, handle_stop),
17895 g_signal_accumulator_true_handled,
17896 NULL,
17897 g_cclosure_marshal_generic,
17898 G_TYPE_BOOLEAN,
17899 1,
17900 G_TYPE_DBUS_METHOD_INVOCATION);
17901
Adriana Kobylak2cb27752015-10-19 16:23:14 -050017902 /**
17903 * Watchdog::handle-set:
17904 * @object: A #Watchdog.
17905 * @invocation: A #GDBusMethodInvocation.
17906 * @arg_interval: Argument passed by remote caller.
17907 *
17908 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Watchdog.set">set()</link> D-Bus method.
17909 *
17910 * 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.
17911 *
17912 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
17913 */
17914 g_signal_new ("handle-set",
17915 G_TYPE_FROM_INTERFACE (iface),
17916 G_SIGNAL_RUN_LAST,
17917 G_STRUCT_OFFSET (WatchdogIface, handle_set),
17918 g_signal_accumulator_true_handled,
17919 NULL,
17920 g_cclosure_marshal_generic,
17921 G_TYPE_BOOLEAN,
17922 2,
17923 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_INT);
17924
Norman James362a80f2015-09-14 14:04:39 -050017925 /* GObject signals for received D-Bus signals: */
17926 /**
17927 * Watchdog::watchdog-error:
17928 * @object: A #Watchdog.
17929 *
17930 * 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.
17931 *
17932 * 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.
17933 */
17934 g_signal_new ("watchdog-error",
17935 G_TYPE_FROM_INTERFACE (iface),
17936 G_SIGNAL_RUN_LAST,
17937 G_STRUCT_OFFSET (WatchdogIface, watchdog_error),
17938 NULL,
17939 NULL,
17940 g_cclosure_marshal_generic,
17941 G_TYPE_NONE,
17942 0);
17943
17944 /* GObject properties for D-Bus properties: */
17945 /**
17946 * Watchdog:watchdog:
17947 *
17948 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Watchdog.watchdog">"watchdog"</link>.
17949 *
17950 * 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.
17951 */
17952 g_object_interface_install_property (iface,
17953 g_param_spec_int ("watchdog", "watchdog", "watchdog", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
17954 /**
17955 * Watchdog:poll-interval:
17956 *
17957 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Watchdog.poll_interval">"poll_interval"</link>.
17958 *
17959 * 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.
17960 */
17961 g_object_interface_install_property (iface,
17962 g_param_spec_int ("poll-interval", "poll_interval", "poll_interval", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
17963}
17964
17965/**
17966 * watchdog_get_watchdog: (skip)
17967 * @object: A #Watchdog.
17968 *
17969 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Watchdog.watchdog">"watchdog"</link> D-Bus property.
17970 *
17971 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
17972 *
17973 * Returns: The property value.
17974 */
17975gint
17976watchdog_get_watchdog (Watchdog *object)
17977{
17978 return WATCHDOG_GET_IFACE (object)->get_watchdog (object);
17979}
17980
17981/**
17982 * watchdog_set_watchdog: (skip)
17983 * @object: A #Watchdog.
17984 * @value: The value to set.
17985 *
17986 * Sets the <link linkend="gdbus-property-org-openbmc-Watchdog.watchdog">"watchdog"</link> D-Bus property to @value.
17987 *
17988 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
17989 */
17990void
17991watchdog_set_watchdog (Watchdog *object, gint value)
17992{
17993 g_object_set (G_OBJECT (object), "watchdog", value, NULL);
17994}
17995
17996/**
17997 * watchdog_get_poll_interval: (skip)
17998 * @object: A #Watchdog.
17999 *
18000 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Watchdog.poll_interval">"poll_interval"</link> D-Bus property.
18001 *
18002 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
18003 *
18004 * Returns: The property value.
18005 */
18006gint
18007watchdog_get_poll_interval (Watchdog *object)
18008{
18009 return WATCHDOG_GET_IFACE (object)->get_poll_interval (object);
18010}
18011
18012/**
18013 * watchdog_set_poll_interval: (skip)
18014 * @object: A #Watchdog.
18015 * @value: The value to set.
18016 *
18017 * Sets the <link linkend="gdbus-property-org-openbmc-Watchdog.poll_interval">"poll_interval"</link> D-Bus property to @value.
18018 *
18019 * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
18020 */
18021void
18022watchdog_set_poll_interval (Watchdog *object, gint value)
18023{
18024 g_object_set (G_OBJECT (object), "poll-interval", value, NULL);
18025}
18026
18027/**
18028 * watchdog_emit_watchdog_error:
18029 * @object: A #Watchdog.
18030 *
18031 * Emits the <link linkend="gdbus-signal-org-openbmc-Watchdog.WatchdogError">"WatchdogError"</link> D-Bus signal.
18032 */
18033void
18034watchdog_emit_watchdog_error (
18035 Watchdog *object)
18036{
18037 g_signal_emit_by_name (object, "watchdog-error");
18038}
18039
18040/**
18041 * watchdog_call_start:
18042 * @proxy: A #WatchdogProxy.
18043 * @cancellable: (allow-none): A #GCancellable or %NULL.
18044 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
18045 * @user_data: User data to pass to @callback.
18046 *
18047 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.start">start()</link> D-Bus method on @proxy.
18048 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
18049 * You can then call watchdog_call_start_finish() to get the result of the operation.
18050 *
18051 * See watchdog_call_start_sync() for the synchronous, blocking version of this method.
18052 */
18053void
18054watchdog_call_start (
18055 Watchdog *proxy,
18056 GCancellable *cancellable,
18057 GAsyncReadyCallback callback,
18058 gpointer user_data)
18059{
18060 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
18061 "start",
18062 g_variant_new ("()"),
18063 G_DBUS_CALL_FLAGS_NONE,
18064 -1,
18065 cancellable,
18066 callback,
18067 user_data);
18068}
18069
18070/**
18071 * watchdog_call_start_finish:
18072 * @proxy: A #WatchdogProxy.
18073 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_call_start().
18074 * @error: Return location for error or %NULL.
18075 *
18076 * Finishes an operation started with watchdog_call_start().
18077 *
18078 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
18079 */
18080gboolean
18081watchdog_call_start_finish (
18082 Watchdog *proxy,
18083 GAsyncResult *res,
18084 GError **error)
18085{
18086 GVariant *_ret;
18087 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
18088 if (_ret == NULL)
18089 goto _out;
18090 g_variant_get (_ret,
18091 "()");
18092 g_variant_unref (_ret);
18093_out:
18094 return _ret != NULL;
18095}
18096
18097/**
18098 * watchdog_call_start_sync:
18099 * @proxy: A #WatchdogProxy.
18100 * @cancellable: (allow-none): A #GCancellable or %NULL.
18101 * @error: Return location for error or %NULL.
18102 *
18103 * 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.
18104 *
18105 * See watchdog_call_start() for the asynchronous version of this method.
18106 *
18107 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
18108 */
18109gboolean
18110watchdog_call_start_sync (
18111 Watchdog *proxy,
18112 GCancellable *cancellable,
18113 GError **error)
18114{
18115 GVariant *_ret;
18116 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
18117 "start",
18118 g_variant_new ("()"),
18119 G_DBUS_CALL_FLAGS_NONE,
18120 -1,
18121 cancellable,
18122 error);
18123 if (_ret == NULL)
18124 goto _out;
18125 g_variant_get (_ret,
18126 "()");
18127 g_variant_unref (_ret);
18128_out:
18129 return _ret != NULL;
18130}
18131
18132/**
18133 * watchdog_call_poke:
18134 * @proxy: A #WatchdogProxy.
18135 * @cancellable: (allow-none): A #GCancellable or %NULL.
18136 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
18137 * @user_data: User data to pass to @callback.
18138 *
18139 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.poke">poke()</link> D-Bus method on @proxy.
18140 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
18141 * You can then call watchdog_call_poke_finish() to get the result of the operation.
18142 *
18143 * See watchdog_call_poke_sync() for the synchronous, blocking version of this method.
18144 */
18145void
18146watchdog_call_poke (
18147 Watchdog *proxy,
18148 GCancellable *cancellable,
18149 GAsyncReadyCallback callback,
18150 gpointer user_data)
18151{
18152 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
18153 "poke",
18154 g_variant_new ("()"),
18155 G_DBUS_CALL_FLAGS_NONE,
18156 -1,
18157 cancellable,
18158 callback,
18159 user_data);
18160}
18161
18162/**
18163 * watchdog_call_poke_finish:
18164 * @proxy: A #WatchdogProxy.
18165 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_call_poke().
18166 * @error: Return location for error or %NULL.
18167 *
18168 * Finishes an operation started with watchdog_call_poke().
18169 *
18170 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
18171 */
18172gboolean
18173watchdog_call_poke_finish (
18174 Watchdog *proxy,
18175 GAsyncResult *res,
18176 GError **error)
18177{
18178 GVariant *_ret;
18179 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
18180 if (_ret == NULL)
18181 goto _out;
18182 g_variant_get (_ret,
18183 "()");
18184 g_variant_unref (_ret);
18185_out:
18186 return _ret != NULL;
18187}
18188
18189/**
18190 * watchdog_call_poke_sync:
18191 * @proxy: A #WatchdogProxy.
18192 * @cancellable: (allow-none): A #GCancellable or %NULL.
18193 * @error: Return location for error or %NULL.
18194 *
18195 * 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.
18196 *
18197 * See watchdog_call_poke() for the asynchronous version of this method.
18198 *
18199 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
18200 */
18201gboolean
18202watchdog_call_poke_sync (
18203 Watchdog *proxy,
18204 GCancellable *cancellable,
18205 GError **error)
18206{
18207 GVariant *_ret;
18208 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
18209 "poke",
18210 g_variant_new ("()"),
18211 G_DBUS_CALL_FLAGS_NONE,
18212 -1,
18213 cancellable,
18214 error);
18215 if (_ret == NULL)
18216 goto _out;
18217 g_variant_get (_ret,
18218 "()");
18219 g_variant_unref (_ret);
18220_out:
18221 return _ret != NULL;
18222}
18223
18224/**
18225 * watchdog_call_stop:
18226 * @proxy: A #WatchdogProxy.
18227 * @cancellable: (allow-none): A #GCancellable or %NULL.
18228 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
18229 * @user_data: User data to pass to @callback.
18230 *
18231 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.stop">stop()</link> D-Bus method on @proxy.
18232 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
18233 * You can then call watchdog_call_stop_finish() to get the result of the operation.
18234 *
18235 * See watchdog_call_stop_sync() for the synchronous, blocking version of this method.
18236 */
18237void
18238watchdog_call_stop (
18239 Watchdog *proxy,
18240 GCancellable *cancellable,
18241 GAsyncReadyCallback callback,
18242 gpointer user_data)
18243{
18244 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
18245 "stop",
18246 g_variant_new ("()"),
18247 G_DBUS_CALL_FLAGS_NONE,
18248 -1,
18249 cancellable,
18250 callback,
18251 user_data);
18252}
18253
18254/**
18255 * watchdog_call_stop_finish:
18256 * @proxy: A #WatchdogProxy.
18257 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_call_stop().
18258 * @error: Return location for error or %NULL.
18259 *
18260 * Finishes an operation started with watchdog_call_stop().
18261 *
18262 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
18263 */
18264gboolean
18265watchdog_call_stop_finish (
18266 Watchdog *proxy,
18267 GAsyncResult *res,
18268 GError **error)
18269{
18270 GVariant *_ret;
18271 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
18272 if (_ret == NULL)
18273 goto _out;
18274 g_variant_get (_ret,
18275 "()");
18276 g_variant_unref (_ret);
18277_out:
18278 return _ret != NULL;
18279}
18280
18281/**
18282 * watchdog_call_stop_sync:
18283 * @proxy: A #WatchdogProxy.
18284 * @cancellable: (allow-none): A #GCancellable or %NULL.
18285 * @error: Return location for error or %NULL.
18286 *
18287 * 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.
18288 *
18289 * See watchdog_call_stop() for the asynchronous version of this method.
18290 *
18291 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
18292 */
18293gboolean
18294watchdog_call_stop_sync (
18295 Watchdog *proxy,
18296 GCancellable *cancellable,
18297 GError **error)
18298{
18299 GVariant *_ret;
18300 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
18301 "stop",
18302 g_variant_new ("()"),
18303 G_DBUS_CALL_FLAGS_NONE,
18304 -1,
18305 cancellable,
18306 error);
18307 if (_ret == NULL)
18308 goto _out;
18309 g_variant_get (_ret,
18310 "()");
18311 g_variant_unref (_ret);
18312_out:
18313 return _ret != NULL;
18314}
18315
18316/**
Adriana Kobylak2cb27752015-10-19 16:23:14 -050018317 * watchdog_call_set:
18318 * @proxy: A #WatchdogProxy.
18319 * @arg_interval: Argument to pass with the method invocation.
18320 * @cancellable: (allow-none): A #GCancellable or %NULL.
18321 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
18322 * @user_data: User data to pass to @callback.
18323 *
18324 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Watchdog.set">set()</link> D-Bus method on @proxy.
18325 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
18326 * You can then call watchdog_call_set_finish() to get the result of the operation.
18327 *
18328 * See watchdog_call_set_sync() for the synchronous, blocking version of this method.
18329 */
18330void
18331watchdog_call_set (
18332 Watchdog *proxy,
18333 gint arg_interval,
18334 GCancellable *cancellable,
18335 GAsyncReadyCallback callback,
18336 gpointer user_data)
18337{
18338 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
18339 "set",
18340 g_variant_new ("(i)",
18341 arg_interval),
18342 G_DBUS_CALL_FLAGS_NONE,
18343 -1,
18344 cancellable,
18345 callback,
18346 user_data);
18347}
18348
18349/**
18350 * watchdog_call_set_finish:
18351 * @proxy: A #WatchdogProxy.
18352 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_call_set().
18353 * @error: Return location for error or %NULL.
18354 *
18355 * Finishes an operation started with watchdog_call_set().
18356 *
18357 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
18358 */
18359gboolean
18360watchdog_call_set_finish (
18361 Watchdog *proxy,
18362 GAsyncResult *res,
18363 GError **error)
18364{
18365 GVariant *_ret;
18366 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
18367 if (_ret == NULL)
18368 goto _out;
18369 g_variant_get (_ret,
18370 "()");
18371 g_variant_unref (_ret);
18372_out:
18373 return _ret != NULL;
18374}
18375
18376/**
18377 * watchdog_call_set_sync:
18378 * @proxy: A #WatchdogProxy.
18379 * @arg_interval: Argument to pass with the method invocation.
18380 * @cancellable: (allow-none): A #GCancellable or %NULL.
18381 * @error: Return location for error or %NULL.
18382 *
18383 * 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.
18384 *
18385 * See watchdog_call_set() for the asynchronous version of this method.
18386 *
18387 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
18388 */
18389gboolean
18390watchdog_call_set_sync (
18391 Watchdog *proxy,
18392 gint arg_interval,
18393 GCancellable *cancellable,
18394 GError **error)
18395{
18396 GVariant *_ret;
18397 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
18398 "set",
18399 g_variant_new ("(i)",
18400 arg_interval),
18401 G_DBUS_CALL_FLAGS_NONE,
18402 -1,
18403 cancellable,
18404 error);
18405 if (_ret == NULL)
18406 goto _out;
18407 g_variant_get (_ret,
18408 "()");
18409 g_variant_unref (_ret);
18410_out:
18411 return _ret != NULL;
18412}
18413
18414/**
Norman James362a80f2015-09-14 14:04:39 -050018415 * watchdog_complete_start:
18416 * @object: A #Watchdog.
18417 * @invocation: (transfer full): A #GDBusMethodInvocation.
18418 *
18419 * 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.
18420 *
18421 * This method will free @invocation, you cannot use it afterwards.
18422 */
18423void
18424watchdog_complete_start (
18425 Watchdog *object,
18426 GDBusMethodInvocation *invocation)
18427{
18428 g_dbus_method_invocation_return_value (invocation,
18429 g_variant_new ("()"));
18430}
18431
18432/**
18433 * watchdog_complete_poke:
18434 * @object: A #Watchdog.
18435 * @invocation: (transfer full): A #GDBusMethodInvocation.
18436 *
18437 * 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.
18438 *
18439 * This method will free @invocation, you cannot use it afterwards.
18440 */
18441void
18442watchdog_complete_poke (
18443 Watchdog *object,
18444 GDBusMethodInvocation *invocation)
18445{
18446 g_dbus_method_invocation_return_value (invocation,
18447 g_variant_new ("()"));
18448}
18449
18450/**
18451 * watchdog_complete_stop:
18452 * @object: A #Watchdog.
18453 * @invocation: (transfer full): A #GDBusMethodInvocation.
18454 *
18455 * 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.
18456 *
18457 * This method will free @invocation, you cannot use it afterwards.
18458 */
18459void
18460watchdog_complete_stop (
18461 Watchdog *object,
18462 GDBusMethodInvocation *invocation)
18463{
18464 g_dbus_method_invocation_return_value (invocation,
18465 g_variant_new ("()"));
18466}
18467
Adriana Kobylak2cb27752015-10-19 16:23:14 -050018468/**
18469 * watchdog_complete_set:
18470 * @object: A #Watchdog.
18471 * @invocation: (transfer full): A #GDBusMethodInvocation.
18472 *
18473 * 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.
18474 *
18475 * This method will free @invocation, you cannot use it afterwards.
18476 */
18477void
18478watchdog_complete_set (
18479 Watchdog *object,
18480 GDBusMethodInvocation *invocation)
18481{
18482 g_dbus_method_invocation_return_value (invocation,
18483 g_variant_new ("()"));
18484}
18485
Norman James362a80f2015-09-14 14:04:39 -050018486/* ------------------------------------------------------------------------ */
18487
18488/**
18489 * WatchdogProxy:
18490 *
18491 * The #WatchdogProxy structure contains only private data and should only be accessed using the provided API.
18492 */
18493
18494/**
18495 * WatchdogProxyClass:
18496 * @parent_class: The parent class.
18497 *
18498 * Class structure for #WatchdogProxy.
18499 */
18500
18501struct _WatchdogProxyPrivate
18502{
18503 GData *qdata;
18504};
18505
18506static void watchdog_proxy_iface_init (WatchdogIface *iface);
18507
18508#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
18509G_DEFINE_TYPE_WITH_CODE (WatchdogProxy, watchdog_proxy, G_TYPE_DBUS_PROXY,
18510 G_ADD_PRIVATE (WatchdogProxy)
18511 G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_proxy_iface_init));
18512
18513#else
18514G_DEFINE_TYPE_WITH_CODE (WatchdogProxy, watchdog_proxy, G_TYPE_DBUS_PROXY,
18515 G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_proxy_iface_init));
18516
18517#endif
18518static void
18519watchdog_proxy_finalize (GObject *object)
18520{
18521 WatchdogProxy *proxy = WATCHDOG_PROXY (object);
18522 g_datalist_clear (&proxy->priv->qdata);
18523 G_OBJECT_CLASS (watchdog_proxy_parent_class)->finalize (object);
18524}
18525
18526static void
18527watchdog_proxy_get_property (GObject *object,
18528 guint prop_id,
18529 GValue *value,
18530 GParamSpec *pspec G_GNUC_UNUSED)
18531{
18532 const _ExtendedGDBusPropertyInfo *info;
18533 GVariant *variant;
18534 g_assert (prop_id != 0 && prop_id - 1 < 2);
18535 info = _watchdog_property_info_pointers[prop_id - 1];
18536 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
18537 if (info->use_gvariant)
18538 {
18539 g_value_set_variant (value, variant);
18540 }
18541 else
18542 {
18543 if (variant != NULL)
18544 g_dbus_gvariant_to_gvalue (variant, value);
18545 }
18546 if (variant != NULL)
18547 g_variant_unref (variant);
18548}
18549
18550static void
18551watchdog_proxy_set_property_cb (GDBusProxy *proxy,
18552 GAsyncResult *res,
18553 gpointer user_data)
18554{
18555 const _ExtendedGDBusPropertyInfo *info = user_data;
18556 GError *error;
18557 GVariant *_ret;
18558 error = NULL;
18559 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
18560 if (!_ret)
18561 {
18562 g_warning ("Error setting property '%s' on interface org.openbmc.Watchdog: %s (%s, %d)",
18563 info->parent_struct.name,
18564 error->message, g_quark_to_string (error->domain), error->code);
18565 g_error_free (error);
18566 }
18567 else
18568 {
18569 g_variant_unref (_ret);
18570 }
18571}
18572
18573static void
18574watchdog_proxy_set_property (GObject *object,
18575 guint prop_id,
18576 const GValue *value,
18577 GParamSpec *pspec G_GNUC_UNUSED)
18578{
18579 const _ExtendedGDBusPropertyInfo *info;
18580 GVariant *variant;
18581 g_assert (prop_id != 0 && prop_id - 1 < 2);
18582 info = _watchdog_property_info_pointers[prop_id - 1];
18583 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
18584 g_dbus_proxy_call (G_DBUS_PROXY (object),
18585 "org.freedesktop.DBus.Properties.Set",
18586 g_variant_new ("(ssv)", "org.openbmc.Watchdog", info->parent_struct.name, variant),
18587 G_DBUS_CALL_FLAGS_NONE,
18588 -1,
18589 NULL, (GAsyncReadyCallback) watchdog_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
18590 g_variant_unref (variant);
18591}
18592
18593static void
18594watchdog_proxy_g_signal (GDBusProxy *proxy,
18595 const gchar *sender_name G_GNUC_UNUSED,
18596 const gchar *signal_name,
18597 GVariant *parameters)
18598{
18599 _ExtendedGDBusSignalInfo *info;
18600 GVariantIter iter;
18601 GVariant *child;
18602 GValue *paramv;
18603 guint num_params;
18604 guint n;
18605 guint signal_id;
18606 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, signal_name);
18607 if (info == NULL)
18608 return;
18609 num_params = g_variant_n_children (parameters);
18610 paramv = g_new0 (GValue, num_params + 1);
18611 g_value_init (&paramv[0], TYPE_WATCHDOG);
18612 g_value_set_object (&paramv[0], proxy);
18613 g_variant_iter_init (&iter, parameters);
18614 n = 1;
18615 while ((child = g_variant_iter_next_value (&iter)) != NULL)
18616 {
18617 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
18618 if (arg_info->use_gvariant)
18619 {
18620 g_value_init (&paramv[n], G_TYPE_VARIANT);
18621 g_value_set_variant (&paramv[n], child);
18622 n++;
18623 }
18624 else
18625 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
18626 g_variant_unref (child);
18627 }
18628 signal_id = g_signal_lookup (info->signal_name, TYPE_WATCHDOG);
18629 g_signal_emitv (paramv, signal_id, 0, NULL);
18630 for (n = 0; n < num_params + 1; n++)
18631 g_value_unset (&paramv[n]);
18632 g_free (paramv);
18633}
18634
18635static void
18636watchdog_proxy_g_properties_changed (GDBusProxy *_proxy,
18637 GVariant *changed_properties,
18638 const gchar *const *invalidated_properties)
18639{
18640 WatchdogProxy *proxy = WATCHDOG_PROXY (_proxy);
18641 guint n;
18642 const gchar *key;
18643 GVariantIter *iter;
18644 _ExtendedGDBusPropertyInfo *info;
18645 g_variant_get (changed_properties, "a{sv}", &iter);
18646 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
18647 {
18648 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, key);
18649 g_datalist_remove_data (&proxy->priv->qdata, key);
18650 if (info != NULL)
18651 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
18652 }
18653 g_variant_iter_free (iter);
18654 for (n = 0; invalidated_properties[n] != NULL; n++)
18655 {
18656 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, invalidated_properties[n]);
18657 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
18658 if (info != NULL)
18659 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
18660 }
18661}
18662
18663static gint
18664watchdog_proxy_get_watchdog (Watchdog *object)
18665{
18666 WatchdogProxy *proxy = WATCHDOG_PROXY (object);
18667 GVariant *variant;
18668 gint value = 0;
18669 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "watchdog");
18670 if (variant != NULL)
18671 {
18672 value = g_variant_get_int32 (variant);
18673 g_variant_unref (variant);
18674 }
18675 return value;
18676}
18677
18678static gint
18679watchdog_proxy_get_poll_interval (Watchdog *object)
18680{
18681 WatchdogProxy *proxy = WATCHDOG_PROXY (object);
18682 GVariant *variant;
18683 gint value = 0;
18684 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "poll_interval");
18685 if (variant != NULL)
18686 {
18687 value = g_variant_get_int32 (variant);
18688 g_variant_unref (variant);
18689 }
18690 return value;
18691}
18692
18693static void
18694watchdog_proxy_init (WatchdogProxy *proxy)
18695{
18696#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
18697 proxy->priv = watchdog_proxy_get_instance_private (proxy);
18698#else
18699 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_WATCHDOG_PROXY, WatchdogProxyPrivate);
18700#endif
18701
18702 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), watchdog_interface_info ());
18703}
18704
18705static void
18706watchdog_proxy_class_init (WatchdogProxyClass *klass)
18707{
18708 GObjectClass *gobject_class;
18709 GDBusProxyClass *proxy_class;
18710
18711 gobject_class = G_OBJECT_CLASS (klass);
18712 gobject_class->finalize = watchdog_proxy_finalize;
18713 gobject_class->get_property = watchdog_proxy_get_property;
18714 gobject_class->set_property = watchdog_proxy_set_property;
18715
18716 proxy_class = G_DBUS_PROXY_CLASS (klass);
18717 proxy_class->g_signal = watchdog_proxy_g_signal;
18718 proxy_class->g_properties_changed = watchdog_proxy_g_properties_changed;
18719
18720 watchdog_override_properties (gobject_class, 1);
18721
18722#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
18723 g_type_class_add_private (klass, sizeof (WatchdogProxyPrivate));
18724#endif
18725}
18726
18727static void
18728watchdog_proxy_iface_init (WatchdogIface *iface)
18729{
18730 iface->get_watchdog = watchdog_proxy_get_watchdog;
18731 iface->get_poll_interval = watchdog_proxy_get_poll_interval;
18732}
18733
18734/**
18735 * watchdog_proxy_new:
18736 * @connection: A #GDBusConnection.
18737 * @flags: Flags from the #GDBusProxyFlags enumeration.
18738 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
18739 * @object_path: An object path.
18740 * @cancellable: (allow-none): A #GCancellable or %NULL.
18741 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
18742 * @user_data: User data to pass to @callback.
18743 *
18744 * 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.
18745 *
18746 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
18747 * You can then call watchdog_proxy_new_finish() to get the result of the operation.
18748 *
18749 * See watchdog_proxy_new_sync() for the synchronous, blocking version of this constructor.
18750 */
18751void
18752watchdog_proxy_new (
18753 GDBusConnection *connection,
18754 GDBusProxyFlags flags,
18755 const gchar *name,
18756 const gchar *object_path,
18757 GCancellable *cancellable,
18758 GAsyncReadyCallback callback,
18759 gpointer user_data)
18760{
18761 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);
18762}
18763
18764/**
18765 * watchdog_proxy_new_finish:
18766 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_proxy_new().
18767 * @error: Return location for error or %NULL
18768 *
18769 * Finishes an operation started with watchdog_proxy_new().
18770 *
18771 * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set.
18772 */
18773Watchdog *
18774watchdog_proxy_new_finish (
18775 GAsyncResult *res,
18776 GError **error)
18777{
18778 GObject *ret;
18779 GObject *source_object;
18780 source_object = g_async_result_get_source_object (res);
18781 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
18782 g_object_unref (source_object);
18783 if (ret != NULL)
18784 return WATCHDOG (ret);
18785 else
18786 return NULL;
18787}
18788
18789/**
18790 * watchdog_proxy_new_sync:
18791 * @connection: A #GDBusConnection.
18792 * @flags: Flags from the #GDBusProxyFlags enumeration.
18793 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
18794 * @object_path: An object path.
18795 * @cancellable: (allow-none): A #GCancellable or %NULL.
18796 * @error: Return location for error or %NULL
18797 *
18798 * 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.
18799 *
18800 * The calling thread is blocked until a reply is received.
18801 *
18802 * See watchdog_proxy_new() for the asynchronous version of this constructor.
18803 *
18804 * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set.
18805 */
18806Watchdog *
18807watchdog_proxy_new_sync (
18808 GDBusConnection *connection,
18809 GDBusProxyFlags flags,
18810 const gchar *name,
18811 const gchar *object_path,
18812 GCancellable *cancellable,
18813 GError **error)
18814{
18815 GInitable *ret;
18816 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);
18817 if (ret != NULL)
18818 return WATCHDOG (ret);
18819 else
18820 return NULL;
18821}
18822
18823
18824/**
18825 * watchdog_proxy_new_for_bus:
18826 * @bus_type: A #GBusType.
18827 * @flags: Flags from the #GDBusProxyFlags enumeration.
18828 * @name: A bus name (well-known or unique).
18829 * @object_path: An object path.
18830 * @cancellable: (allow-none): A #GCancellable or %NULL.
18831 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
18832 * @user_data: User data to pass to @callback.
18833 *
18834 * Like watchdog_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
18835 *
18836 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
18837 * You can then call watchdog_proxy_new_for_bus_finish() to get the result of the operation.
18838 *
18839 * See watchdog_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
18840 */
18841void
18842watchdog_proxy_new_for_bus (
18843 GBusType bus_type,
18844 GDBusProxyFlags flags,
18845 const gchar *name,
18846 const gchar *object_path,
18847 GCancellable *cancellable,
18848 GAsyncReadyCallback callback,
18849 gpointer user_data)
18850{
18851 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);
18852}
18853
18854/**
18855 * watchdog_proxy_new_for_bus_finish:
18856 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to watchdog_proxy_new_for_bus().
18857 * @error: Return location for error or %NULL
18858 *
18859 * Finishes an operation started with watchdog_proxy_new_for_bus().
18860 *
18861 * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set.
18862 */
18863Watchdog *
18864watchdog_proxy_new_for_bus_finish (
18865 GAsyncResult *res,
18866 GError **error)
18867{
18868 GObject *ret;
18869 GObject *source_object;
18870 source_object = g_async_result_get_source_object (res);
18871 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
18872 g_object_unref (source_object);
18873 if (ret != NULL)
18874 return WATCHDOG (ret);
18875 else
18876 return NULL;
18877}
18878
18879/**
18880 * watchdog_proxy_new_for_bus_sync:
18881 * @bus_type: A #GBusType.
18882 * @flags: Flags from the #GDBusProxyFlags enumeration.
18883 * @name: A bus name (well-known or unique).
18884 * @object_path: An object path.
18885 * @cancellable: (allow-none): A #GCancellable or %NULL.
18886 * @error: Return location for error or %NULL
18887 *
18888 * Like watchdog_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
18889 *
18890 * The calling thread is blocked until a reply is received.
18891 *
18892 * See watchdog_proxy_new_for_bus() for the asynchronous version of this constructor.
18893 *
18894 * Returns: (transfer full) (type WatchdogProxy): The constructed proxy object or %NULL if @error is set.
18895 */
18896Watchdog *
18897watchdog_proxy_new_for_bus_sync (
18898 GBusType bus_type,
18899 GDBusProxyFlags flags,
18900 const gchar *name,
18901 const gchar *object_path,
18902 GCancellable *cancellable,
18903 GError **error)
18904{
18905 GInitable *ret;
18906 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);
18907 if (ret != NULL)
18908 return WATCHDOG (ret);
18909 else
18910 return NULL;
18911}
18912
18913
18914/* ------------------------------------------------------------------------ */
18915
18916/**
18917 * WatchdogSkeleton:
18918 *
18919 * The #WatchdogSkeleton structure contains only private data and should only be accessed using the provided API.
18920 */
18921
18922/**
18923 * WatchdogSkeletonClass:
18924 * @parent_class: The parent class.
18925 *
18926 * Class structure for #WatchdogSkeleton.
18927 */
18928
18929struct _WatchdogSkeletonPrivate
18930{
18931 GValue *properties;
18932 GList *changed_properties;
18933 GSource *changed_properties_idle_source;
18934 GMainContext *context;
18935 GMutex lock;
18936};
18937
18938static void
18939_watchdog_skeleton_handle_method_call (
18940 GDBusConnection *connection G_GNUC_UNUSED,
18941 const gchar *sender G_GNUC_UNUSED,
18942 const gchar *object_path G_GNUC_UNUSED,
18943 const gchar *interface_name,
18944 const gchar *method_name,
18945 GVariant *parameters,
18946 GDBusMethodInvocation *invocation,
18947 gpointer user_data)
18948{
18949 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data);
18950 _ExtendedGDBusMethodInfo *info;
18951 GVariantIter iter;
18952 GVariant *child;
18953 GValue *paramv;
18954 guint num_params;
18955 guint num_extra;
18956 guint n;
18957 guint signal_id;
18958 GValue return_value = G_VALUE_INIT;
18959 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
18960 g_assert (info != NULL);
18961 num_params = g_variant_n_children (parameters);
18962 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
18963 n = 0;
18964 g_value_init (&paramv[n], TYPE_WATCHDOG);
18965 g_value_set_object (&paramv[n++], skeleton);
18966 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
18967 g_value_set_object (&paramv[n++], invocation);
18968 if (info->pass_fdlist)
18969 {
18970#ifdef G_OS_UNIX
18971 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
18972 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
18973#else
18974 g_assert_not_reached ();
18975#endif
18976 }
18977 g_variant_iter_init (&iter, parameters);
18978 while ((child = g_variant_iter_next_value (&iter)) != NULL)
18979 {
18980 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
18981 if (arg_info->use_gvariant)
18982 {
18983 g_value_init (&paramv[n], G_TYPE_VARIANT);
18984 g_value_set_variant (&paramv[n], child);
18985 n++;
18986 }
18987 else
18988 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
18989 g_variant_unref (child);
18990 }
18991 signal_id = g_signal_lookup (info->signal_name, TYPE_WATCHDOG);
18992 g_value_init (&return_value, G_TYPE_BOOLEAN);
18993 g_signal_emitv (paramv, signal_id, 0, &return_value);
18994 if (!g_value_get_boolean (&return_value))
18995 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);
18996 g_value_unset (&return_value);
18997 for (n = 0; n < num_params + num_extra; n++)
18998 g_value_unset (&paramv[n]);
18999 g_free (paramv);
19000}
19001
19002static GVariant *
19003_watchdog_skeleton_handle_get_property (
19004 GDBusConnection *connection G_GNUC_UNUSED,
19005 const gchar *sender G_GNUC_UNUSED,
19006 const gchar *object_path G_GNUC_UNUSED,
19007 const gchar *interface_name G_GNUC_UNUSED,
19008 const gchar *property_name,
19009 GError **error,
19010 gpointer user_data)
19011{
19012 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data);
19013 GValue value = G_VALUE_INIT;
19014 GParamSpec *pspec;
19015 _ExtendedGDBusPropertyInfo *info;
19016 GVariant *ret;
19017 ret = NULL;
19018 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, property_name);
19019 g_assert (info != NULL);
19020 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
19021 if (pspec == NULL)
19022 {
19023 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
19024 }
19025 else
19026 {
19027 g_value_init (&value, pspec->value_type);
19028 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
19029 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
19030 g_value_unset (&value);
19031 }
19032 return ret;
19033}
19034
19035static gboolean
19036_watchdog_skeleton_handle_set_property (
19037 GDBusConnection *connection G_GNUC_UNUSED,
19038 const gchar *sender G_GNUC_UNUSED,
19039 const gchar *object_path G_GNUC_UNUSED,
19040 const gchar *interface_name G_GNUC_UNUSED,
19041 const gchar *property_name,
19042 GVariant *variant,
19043 GError **error,
19044 gpointer user_data)
19045{
19046 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data);
19047 GValue value = G_VALUE_INIT;
19048 GParamSpec *pspec;
19049 _ExtendedGDBusPropertyInfo *info;
19050 gboolean ret;
19051 ret = FALSE;
19052 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_watchdog_interface_info.parent_struct, property_name);
19053 g_assert (info != NULL);
19054 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
19055 if (pspec == NULL)
19056 {
19057 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
19058 }
19059 else
19060 {
19061 if (info->use_gvariant)
19062 g_value_set_variant (&value, variant);
19063 else
19064 g_dbus_gvariant_to_gvalue (variant, &value);
19065 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
19066 g_value_unset (&value);
19067 ret = TRUE;
19068 }
19069 return ret;
19070}
19071
19072static const GDBusInterfaceVTable _watchdog_skeleton_vtable =
19073{
19074 _watchdog_skeleton_handle_method_call,
19075 _watchdog_skeleton_handle_get_property,
19076 _watchdog_skeleton_handle_set_property,
19077 {NULL}
19078};
19079
19080static GDBusInterfaceInfo *
19081watchdog_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
19082{
19083 return watchdog_interface_info ();
19084}
19085
19086static GDBusInterfaceVTable *
19087watchdog_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
19088{
19089 return (GDBusInterfaceVTable *) &_watchdog_skeleton_vtable;
19090}
19091
19092static GVariant *
19093watchdog_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
19094{
19095 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (_skeleton);
19096
19097 GVariantBuilder builder;
19098 guint n;
19099 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
19100 if (_watchdog_interface_info.parent_struct.properties == NULL)
19101 goto out;
19102 for (n = 0; _watchdog_interface_info.parent_struct.properties[n] != NULL; n++)
19103 {
19104 GDBusPropertyInfo *info = _watchdog_interface_info.parent_struct.properties[n];
19105 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
19106 {
19107 GVariant *value;
19108 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);
19109 if (value != NULL)
19110 {
19111 g_variant_take_ref (value);
19112 g_variant_builder_add (&builder, "{sv}", info->name, value);
19113 g_variant_unref (value);
19114 }
19115 }
19116 }
19117out:
19118 return g_variant_builder_end (&builder);
19119}
19120
19121static gboolean _watchdog_emit_changed (gpointer user_data);
19122
19123static void
19124watchdog_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
19125{
19126 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (_skeleton);
19127 gboolean emit_changed = FALSE;
19128
19129 g_mutex_lock (&skeleton->priv->lock);
19130 if (skeleton->priv->changed_properties_idle_source != NULL)
19131 {
19132 g_source_destroy (skeleton->priv->changed_properties_idle_source);
19133 skeleton->priv->changed_properties_idle_source = NULL;
19134 emit_changed = TRUE;
19135 }
19136 g_mutex_unlock (&skeleton->priv->lock);
19137
19138 if (emit_changed)
19139 _watchdog_emit_changed (skeleton);
19140}
19141
19142static void
19143_watchdog_on_signal_watchdog_error (
19144 Watchdog *object)
19145{
19146 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
19147
19148 GList *connections, *l;
19149 GVariant *signal_variant;
19150 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
19151
19152 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
19153 for (l = connections; l != NULL; l = l->next)
19154 {
19155 GDBusConnection *connection = l->data;
19156 g_dbus_connection_emit_signal (connection,
19157 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Watchdog", "WatchdogError",
19158 signal_variant, NULL);
19159 }
19160 g_variant_unref (signal_variant);
19161 g_list_free_full (connections, g_object_unref);
19162}
19163
19164static void watchdog_skeleton_iface_init (WatchdogIface *iface);
19165#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
19166G_DEFINE_TYPE_WITH_CODE (WatchdogSkeleton, watchdog_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
19167 G_ADD_PRIVATE (WatchdogSkeleton)
19168 G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_skeleton_iface_init));
19169
19170#else
19171G_DEFINE_TYPE_WITH_CODE (WatchdogSkeleton, watchdog_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
19172 G_IMPLEMENT_INTERFACE (TYPE_WATCHDOG, watchdog_skeleton_iface_init));
19173
19174#endif
19175static void
19176watchdog_skeleton_finalize (GObject *object)
19177{
19178 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
19179 guint n;
19180 for (n = 0; n < 2; n++)
19181 g_value_unset (&skeleton->priv->properties[n]);
19182 g_free (skeleton->priv->properties);
19183 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
19184 if (skeleton->priv->changed_properties_idle_source != NULL)
19185 g_source_destroy (skeleton->priv->changed_properties_idle_source);
19186 g_main_context_unref (skeleton->priv->context);
19187 g_mutex_clear (&skeleton->priv->lock);
19188 G_OBJECT_CLASS (watchdog_skeleton_parent_class)->finalize (object);
19189}
19190
19191static void
19192watchdog_skeleton_get_property (GObject *object,
19193 guint prop_id,
19194 GValue *value,
19195 GParamSpec *pspec G_GNUC_UNUSED)
19196{
19197 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
19198 g_assert (prop_id != 0 && prop_id - 1 < 2);
19199 g_mutex_lock (&skeleton->priv->lock);
19200 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
19201 g_mutex_unlock (&skeleton->priv->lock);
19202}
19203
19204static gboolean
19205_watchdog_emit_changed (gpointer user_data)
19206{
19207 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (user_data);
19208 GList *l;
19209 GVariantBuilder builder;
19210 GVariantBuilder invalidated_builder;
19211 guint num_changes;
19212
19213 g_mutex_lock (&skeleton->priv->lock);
19214 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
19215 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
19216 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
19217 {
19218 ChangedProperty *cp = l->data;
19219 GVariant *variant;
19220 const GValue *cur_value;
19221
19222 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
19223 if (!_g_value_equal (cur_value, &cp->orig_value))
19224 {
19225 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
19226 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
19227 g_variant_unref (variant);
19228 num_changes++;
19229 }
19230 }
19231 if (num_changes > 0)
19232 {
19233 GList *connections, *ll;
19234 GVariant *signal_variant;
19235 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Watchdog",
19236 &builder, &invalidated_builder));
19237 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
19238 for (ll = connections; ll != NULL; ll = ll->next)
19239 {
19240 GDBusConnection *connection = ll->data;
19241
19242 g_dbus_connection_emit_signal (connection,
19243 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
19244 "org.freedesktop.DBus.Properties",
19245 "PropertiesChanged",
19246 signal_variant,
19247 NULL);
19248 }
19249 g_variant_unref (signal_variant);
19250 g_list_free_full (connections, g_object_unref);
19251 }
19252 else
19253 {
19254 g_variant_builder_clear (&builder);
19255 g_variant_builder_clear (&invalidated_builder);
19256 }
19257 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
19258 skeleton->priv->changed_properties = NULL;
19259 skeleton->priv->changed_properties_idle_source = NULL;
19260 g_mutex_unlock (&skeleton->priv->lock);
19261 return FALSE;
19262}
19263
19264static void
19265_watchdog_schedule_emit_changed (WatchdogSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
19266{
19267 ChangedProperty *cp;
19268 GList *l;
19269 cp = NULL;
19270 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
19271 {
19272 ChangedProperty *i_cp = l->data;
19273 if (i_cp->info == info)
19274 {
19275 cp = i_cp;
19276 break;
19277 }
19278 }
19279 if (cp == NULL)
19280 {
19281 cp = g_new0 (ChangedProperty, 1);
19282 cp->prop_id = prop_id;
19283 cp->info = info;
19284 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
19285 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
19286 g_value_copy (orig_value, &cp->orig_value);
19287 }
19288}
19289
19290static void
19291watchdog_skeleton_notify (GObject *object,
19292 GParamSpec *pspec G_GNUC_UNUSED)
19293{
19294 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
19295 g_mutex_lock (&skeleton->priv->lock);
19296 if (skeleton->priv->changed_properties != NULL &&
19297 skeleton->priv->changed_properties_idle_source == NULL)
19298 {
19299 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
19300 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
19301 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _watchdog_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
Adriana Kobylak2cb27752015-10-19 16:23:14 -050019302 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _watchdog_emit_changed");
Norman James362a80f2015-09-14 14:04:39 -050019303 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
19304 g_source_unref (skeleton->priv->changed_properties_idle_source);
19305 }
19306 g_mutex_unlock (&skeleton->priv->lock);
19307}
19308
19309static void
19310watchdog_skeleton_set_property (GObject *object,
19311 guint prop_id,
19312 const GValue *value,
19313 GParamSpec *pspec)
19314{
19315 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
19316 g_assert (prop_id != 0 && prop_id - 1 < 2);
19317 g_mutex_lock (&skeleton->priv->lock);
19318 g_object_freeze_notify (object);
19319 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
19320 {
19321 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
19322 _watchdog_schedule_emit_changed (skeleton, _watchdog_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
19323 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
19324 g_object_notify_by_pspec (object, pspec);
19325 }
19326 g_mutex_unlock (&skeleton->priv->lock);
19327 g_object_thaw_notify (object);
19328}
19329
19330static void
19331watchdog_skeleton_init (WatchdogSkeleton *skeleton)
19332{
19333#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
19334 skeleton->priv = watchdog_skeleton_get_instance_private (skeleton);
19335#else
19336 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_WATCHDOG_SKELETON, WatchdogSkeletonPrivate);
19337#endif
19338
19339 g_mutex_init (&skeleton->priv->lock);
19340 skeleton->priv->context = g_main_context_ref_thread_default ();
19341 skeleton->priv->properties = g_new0 (GValue, 2);
19342 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
19343 g_value_init (&skeleton->priv->properties[1], G_TYPE_INT);
19344}
19345
19346static gint
19347watchdog_skeleton_get_watchdog (Watchdog *object)
19348{
19349 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
19350 gint value;
19351 g_mutex_lock (&skeleton->priv->lock);
19352 value = g_value_get_int (&(skeleton->priv->properties[0]));
19353 g_mutex_unlock (&skeleton->priv->lock);
19354 return value;
19355}
19356
19357static gint
19358watchdog_skeleton_get_poll_interval (Watchdog *object)
19359{
19360 WatchdogSkeleton *skeleton = WATCHDOG_SKELETON (object);
19361 gint value;
19362 g_mutex_lock (&skeleton->priv->lock);
19363 value = g_value_get_int (&(skeleton->priv->properties[1]));
19364 g_mutex_unlock (&skeleton->priv->lock);
19365 return value;
19366}
19367
19368static void
19369watchdog_skeleton_class_init (WatchdogSkeletonClass *klass)
19370{
19371 GObjectClass *gobject_class;
19372 GDBusInterfaceSkeletonClass *skeleton_class;
19373
19374 gobject_class = G_OBJECT_CLASS (klass);
19375 gobject_class->finalize = watchdog_skeleton_finalize;
19376 gobject_class->get_property = watchdog_skeleton_get_property;
19377 gobject_class->set_property = watchdog_skeleton_set_property;
19378 gobject_class->notify = watchdog_skeleton_notify;
19379
19380
19381 watchdog_override_properties (gobject_class, 1);
19382
19383 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
19384 skeleton_class->get_info = watchdog_skeleton_dbus_interface_get_info;
19385 skeleton_class->get_properties = watchdog_skeleton_dbus_interface_get_properties;
19386 skeleton_class->flush = watchdog_skeleton_dbus_interface_flush;
19387 skeleton_class->get_vtable = watchdog_skeleton_dbus_interface_get_vtable;
19388
19389#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
19390 g_type_class_add_private (klass, sizeof (WatchdogSkeletonPrivate));
19391#endif
19392}
19393
19394static void
19395watchdog_skeleton_iface_init (WatchdogIface *iface)
19396{
19397 iface->watchdog_error = _watchdog_on_signal_watchdog_error;
19398 iface->get_watchdog = watchdog_skeleton_get_watchdog;
19399 iface->get_poll_interval = watchdog_skeleton_get_poll_interval;
19400}
19401
19402/**
19403 * watchdog_skeleton_new:
19404 *
19405 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Watchdog.top_of_page">org.openbmc.Watchdog</link>.
19406 *
19407 * Returns: (transfer full) (type WatchdogSkeleton): The skeleton object.
19408 */
19409Watchdog *
19410watchdog_skeleton_new (void)
19411{
19412 return WATCHDOG (g_object_new (TYPE_WATCHDOG_SKELETON, NULL));
19413}
19414
19415/* ------------------------------------------------------------------------
19416 * Code for interface org.openbmc.EventLog
19417 * ------------------------------------------------------------------------
19418 */
19419
19420/**
19421 * SECTION:EventLog
19422 * @title: EventLog
19423 * @short_description: Generated C code for the org.openbmc.EventLog D-Bus interface
19424 *
19425 * 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.
19426 */
19427
19428/* ---- Introspection data for org.openbmc.EventLog ---- */
19429
Norman James2d1ee892015-09-16 23:13:45 -050019430static const _ExtendedGDBusArgInfo _event_log_method_info_get_event_log_OUT_ARG_log =
19431{
19432 {
19433 -1,
19434 (gchar *) "log",
19435 (gchar *) "a(s)",
19436 NULL
19437 },
19438 FALSE
19439};
19440
19441static const _ExtendedGDBusArgInfo * const _event_log_method_info_get_event_log_OUT_ARG_pointers[] =
19442{
19443 &_event_log_method_info_get_event_log_OUT_ARG_log,
19444 NULL
19445};
19446
19447static const _ExtendedGDBusMethodInfo _event_log_method_info_get_event_log =
19448{
19449 {
19450 -1,
19451 (gchar *) "getEventLog",
19452 NULL,
19453 (GDBusArgInfo **) &_event_log_method_info_get_event_log_OUT_ARG_pointers,
19454 NULL
19455 },
19456 "handle-get-event-log",
19457 FALSE
19458};
19459
19460static const _ExtendedGDBusMethodInfo * const _event_log_method_info_pointers[] =
19461{
19462 &_event_log_method_info_get_event_log,
19463 NULL
19464};
19465
Norman James8abb50c2015-09-16 10:58:16 -050019466static const _ExtendedGDBusArgInfo _event_log_signal_info_event_log_ARG_priority =
Norman James362a80f2015-09-14 14:04:39 -050019467{
19468 {
19469 -1,
Norman James8abb50c2015-09-16 10:58:16 -050019470 (gchar *) "priority",
19471 (gchar *) "i",
Norman James362a80f2015-09-14 14:04:39 -050019472 NULL
19473 },
19474 FALSE
19475};
19476
Norman James362a80f2015-09-14 14:04:39 -050019477static const _ExtendedGDBusArgInfo _event_log_signal_info_event_log_ARG_message =
19478{
19479 {
19480 -1,
19481 (gchar *) "message",
Norman James32e74e22015-09-15 21:28:06 -050019482 (gchar *) "s",
Norman James362a80f2015-09-14 14:04:39 -050019483 NULL
19484 },
19485 FALSE
19486};
19487
Norman James88872672015-09-21 16:51:35 -050019488static const _ExtendedGDBusArgInfo _event_log_signal_info_event_log_ARG_rc =
19489{
19490 {
19491 -1,
19492 (gchar *) "rc",
19493 (gchar *) "i",
19494 NULL
19495 },
19496 FALSE
19497};
19498
Norman James362a80f2015-09-14 14:04:39 -050019499static const _ExtendedGDBusArgInfo * const _event_log_signal_info_event_log_ARG_pointers[] =
19500{
Norman James8abb50c2015-09-16 10:58:16 -050019501 &_event_log_signal_info_event_log_ARG_priority,
Norman James362a80f2015-09-14 14:04:39 -050019502 &_event_log_signal_info_event_log_ARG_message,
Norman James88872672015-09-21 16:51:35 -050019503 &_event_log_signal_info_event_log_ARG_rc,
Norman James362a80f2015-09-14 14:04:39 -050019504 NULL
19505};
19506
19507static const _ExtendedGDBusSignalInfo _event_log_signal_info_event_log =
19508{
19509 {
19510 -1,
19511 (gchar *) "EventLog",
19512 (GDBusArgInfo **) &_event_log_signal_info_event_log_ARG_pointers,
19513 NULL
19514 },
19515 "event-log"
19516};
19517
19518static const _ExtendedGDBusSignalInfo * const _event_log_signal_info_pointers[] =
19519{
19520 &_event_log_signal_info_event_log,
19521 NULL
19522};
19523
Norman James362a80f2015-09-14 14:04:39 -050019524static const _ExtendedGDBusInterfaceInfo _event_log_interface_info =
19525{
19526 {
19527 -1,
19528 (gchar *) "org.openbmc.EventLog",
Norman James2d1ee892015-09-16 23:13:45 -050019529 (GDBusMethodInfo **) &_event_log_method_info_pointers,
Norman James362a80f2015-09-14 14:04:39 -050019530 (GDBusSignalInfo **) &_event_log_signal_info_pointers,
Norman James32e74e22015-09-15 21:28:06 -050019531 NULL,
Norman James362a80f2015-09-14 14:04:39 -050019532 NULL
19533 },
19534 "event-log",
19535};
19536
19537
19538/**
19539 * event_log_interface_info:
19540 *
19541 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link> D-Bus interface.
19542 *
19543 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
19544 */
19545GDBusInterfaceInfo *
19546event_log_interface_info (void)
19547{
19548 return (GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct;
19549}
19550
19551/**
19552 * event_log_override_properties:
19553 * @klass: The class structure for a #GObject<!-- -->-derived class.
19554 * @property_id_begin: The property id to assign to the first overridden property.
19555 *
19556 * Overrides all #GObject properties in the #EventLog interface for a concrete class.
19557 * The properties are overridden in the order they are defined.
19558 *
19559 * Returns: The last property id.
19560 */
19561guint
19562event_log_override_properties (GObjectClass *klass, guint property_id_begin)
19563{
Norman James362a80f2015-09-14 14:04:39 -050019564 return property_id_begin - 1;
19565}
19566
19567
19568
19569/**
19570 * EventLog:
19571 *
19572 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>.
19573 */
19574
19575/**
19576 * EventLogIface:
19577 * @parent_iface: The parent interface.
Norman James2d1ee892015-09-16 23:13:45 -050019578 * @handle_get_event_log: Handler for the #EventLog::handle-get-event-log signal.
Norman James362a80f2015-09-14 14:04:39 -050019579 * @event_log: Handler for the #EventLog::event-log signal.
19580 *
19581 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>.
19582 */
19583
19584typedef EventLogIface EventLogInterface;
19585G_DEFINE_INTERFACE (EventLog, event_log, G_TYPE_OBJECT);
19586
19587static void
19588event_log_default_init (EventLogIface *iface)
19589{
Norman James2d1ee892015-09-16 23:13:45 -050019590 /* GObject signals for incoming D-Bus method calls: */
19591 /**
19592 * EventLog::handle-get-event-log:
19593 * @object: A #EventLog.
19594 * @invocation: A #GDBusMethodInvocation.
19595 *
19596 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-EventLog.getEventLog">getEventLog()</link> D-Bus method.
19597 *
19598 * 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.
19599 *
19600 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
19601 */
19602 g_signal_new ("handle-get-event-log",
19603 G_TYPE_FROM_INTERFACE (iface),
19604 G_SIGNAL_RUN_LAST,
19605 G_STRUCT_OFFSET (EventLogIface, handle_get_event_log),
19606 g_signal_accumulator_true_handled,
19607 NULL,
19608 g_cclosure_marshal_generic,
19609 G_TYPE_BOOLEAN,
19610 1,
19611 G_TYPE_DBUS_METHOD_INVOCATION);
19612
Norman James362a80f2015-09-14 14:04:39 -050019613 /* GObject signals for received D-Bus signals: */
19614 /**
19615 * EventLog::event-log:
19616 * @object: A #EventLog.
Norman James8abb50c2015-09-16 10:58:16 -050019617 * @arg_priority: Argument.
Norman James362a80f2015-09-14 14:04:39 -050019618 * @arg_message: Argument.
Norman James88872672015-09-21 16:51:35 -050019619 * @arg_rc: Argument.
Norman James362a80f2015-09-14 14:04:39 -050019620 *
19621 * 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.
19622 *
19623 * 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.
19624 */
19625 g_signal_new ("event-log",
19626 G_TYPE_FROM_INTERFACE (iface),
19627 G_SIGNAL_RUN_LAST,
19628 G_STRUCT_OFFSET (EventLogIface, event_log),
19629 NULL,
19630 NULL,
19631 g_cclosure_marshal_generic,
19632 G_TYPE_NONE,
Norman James88872672015-09-21 16:51:35 -050019633 3, G_TYPE_INT, G_TYPE_STRING, G_TYPE_INT);
Norman James362a80f2015-09-14 14:04:39 -050019634
Norman James362a80f2015-09-14 14:04:39 -050019635}
19636
19637/**
19638 * event_log_emit_event_log:
19639 * @object: A #EventLog.
Norman James8abb50c2015-09-16 10:58:16 -050019640 * @arg_priority: Argument to pass with the signal.
Norman James362a80f2015-09-14 14:04:39 -050019641 * @arg_message: Argument to pass with the signal.
Norman James88872672015-09-21 16:51:35 -050019642 * @arg_rc: Argument to pass with the signal.
Norman James362a80f2015-09-14 14:04:39 -050019643 *
19644 * Emits the <link linkend="gdbus-signal-org-openbmc-EventLog.EventLog">"EventLog"</link> D-Bus signal.
19645 */
19646void
19647event_log_emit_event_log (
19648 EventLog *object,
Norman James8abb50c2015-09-16 10:58:16 -050019649 gint arg_priority,
Norman James88872672015-09-21 16:51:35 -050019650 const gchar *arg_message,
19651 gint arg_rc)
Norman James362a80f2015-09-14 14:04:39 -050019652{
Norman James88872672015-09-21 16:51:35 -050019653 g_signal_emit_by_name (object, "event-log", arg_priority, arg_message, arg_rc);
Norman James362a80f2015-09-14 14:04:39 -050019654}
19655
Norman James2d1ee892015-09-16 23:13:45 -050019656/**
19657 * event_log_call_get_event_log:
19658 * @proxy: A #EventLogProxy.
19659 * @cancellable: (allow-none): A #GCancellable or %NULL.
19660 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
19661 * @user_data: User data to pass to @callback.
19662 *
19663 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-EventLog.getEventLog">getEventLog()</link> D-Bus method on @proxy.
19664 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
19665 * You can then call event_log_call_get_event_log_finish() to get the result of the operation.
19666 *
19667 * See event_log_call_get_event_log_sync() for the synchronous, blocking version of this method.
19668 */
19669void
19670event_log_call_get_event_log (
19671 EventLog *proxy,
19672 GCancellable *cancellable,
19673 GAsyncReadyCallback callback,
19674 gpointer user_data)
19675{
19676 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
19677 "getEventLog",
19678 g_variant_new ("()"),
19679 G_DBUS_CALL_FLAGS_NONE,
19680 -1,
19681 cancellable,
19682 callback,
19683 user_data);
19684}
19685
19686/**
19687 * event_log_call_get_event_log_finish:
19688 * @proxy: A #EventLogProxy.
19689 * @out_log: (out): Return location for return parameter or %NULL to ignore.
19690 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to event_log_call_get_event_log().
19691 * @error: Return location for error or %NULL.
19692 *
19693 * Finishes an operation started with event_log_call_get_event_log().
19694 *
19695 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19696 */
19697gboolean
19698event_log_call_get_event_log_finish (
19699 EventLog *proxy,
19700 GVariant **out_log,
19701 GAsyncResult *res,
19702 GError **error)
19703{
19704 GVariant *_ret;
19705 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
19706 if (_ret == NULL)
19707 goto _out;
19708 g_variant_get (_ret,
19709 "(@a(s))",
19710 out_log);
19711 g_variant_unref (_ret);
19712_out:
19713 return _ret != NULL;
19714}
19715
19716/**
19717 * event_log_call_get_event_log_sync:
19718 * @proxy: A #EventLogProxy.
19719 * @out_log: (out): Return location for return parameter or %NULL to ignore.
19720 * @cancellable: (allow-none): A #GCancellable or %NULL.
19721 * @error: Return location for error or %NULL.
19722 *
19723 * 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.
19724 *
19725 * See event_log_call_get_event_log() for the asynchronous version of this method.
19726 *
19727 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
19728 */
19729gboolean
19730event_log_call_get_event_log_sync (
19731 EventLog *proxy,
19732 GVariant **out_log,
19733 GCancellable *cancellable,
19734 GError **error)
19735{
19736 GVariant *_ret;
19737 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
19738 "getEventLog",
19739 g_variant_new ("()"),
19740 G_DBUS_CALL_FLAGS_NONE,
19741 -1,
19742 cancellable,
19743 error);
19744 if (_ret == NULL)
19745 goto _out;
19746 g_variant_get (_ret,
19747 "(@a(s))",
19748 out_log);
19749 g_variant_unref (_ret);
19750_out:
19751 return _ret != NULL;
19752}
19753
19754/**
19755 * event_log_complete_get_event_log:
19756 * @object: A #EventLog.
19757 * @invocation: (transfer full): A #GDBusMethodInvocation.
19758 * @log: Parameter to return.
19759 *
19760 * 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.
19761 *
19762 * This method will free @invocation, you cannot use it afterwards.
19763 */
19764void
19765event_log_complete_get_event_log (
19766 EventLog *object,
19767 GDBusMethodInvocation *invocation,
19768 GVariant *log)
19769{
19770 g_dbus_method_invocation_return_value (invocation,
19771 g_variant_new ("(@a(s))",
19772 log));
19773}
19774
Norman James362a80f2015-09-14 14:04:39 -050019775/* ------------------------------------------------------------------------ */
19776
19777/**
19778 * EventLogProxy:
19779 *
19780 * The #EventLogProxy structure contains only private data and should only be accessed using the provided API.
19781 */
19782
19783/**
19784 * EventLogProxyClass:
19785 * @parent_class: The parent class.
19786 *
19787 * Class structure for #EventLogProxy.
19788 */
19789
19790struct _EventLogProxyPrivate
19791{
19792 GData *qdata;
19793};
19794
19795static void event_log_proxy_iface_init (EventLogIface *iface);
19796
19797#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
19798G_DEFINE_TYPE_WITH_CODE (EventLogProxy, event_log_proxy, G_TYPE_DBUS_PROXY,
19799 G_ADD_PRIVATE (EventLogProxy)
19800 G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_proxy_iface_init));
19801
19802#else
19803G_DEFINE_TYPE_WITH_CODE (EventLogProxy, event_log_proxy, G_TYPE_DBUS_PROXY,
19804 G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_proxy_iface_init));
19805
19806#endif
19807static void
19808event_log_proxy_finalize (GObject *object)
19809{
19810 EventLogProxy *proxy = EVENT_LOG_PROXY (object);
19811 g_datalist_clear (&proxy->priv->qdata);
19812 G_OBJECT_CLASS (event_log_proxy_parent_class)->finalize (object);
19813}
19814
19815static void
19816event_log_proxy_get_property (GObject *object,
19817 guint prop_id,
19818 GValue *value,
19819 GParamSpec *pspec G_GNUC_UNUSED)
19820{
Norman James362a80f2015-09-14 14:04:39 -050019821}
19822
19823static void
19824event_log_proxy_set_property (GObject *object,
19825 guint prop_id,
19826 const GValue *value,
19827 GParamSpec *pspec G_GNUC_UNUSED)
19828{
Norman James362a80f2015-09-14 14:04:39 -050019829}
19830
19831static void
19832event_log_proxy_g_signal (GDBusProxy *proxy,
19833 const gchar *sender_name G_GNUC_UNUSED,
19834 const gchar *signal_name,
19835 GVariant *parameters)
19836{
19837 _ExtendedGDBusSignalInfo *info;
19838 GVariantIter iter;
19839 GVariant *child;
19840 GValue *paramv;
19841 guint num_params;
19842 guint n;
19843 guint signal_id;
19844 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, signal_name);
19845 if (info == NULL)
19846 return;
19847 num_params = g_variant_n_children (parameters);
19848 paramv = g_new0 (GValue, num_params + 1);
19849 g_value_init (&paramv[0], TYPE_EVENT_LOG);
19850 g_value_set_object (&paramv[0], proxy);
19851 g_variant_iter_init (&iter, parameters);
19852 n = 1;
19853 while ((child = g_variant_iter_next_value (&iter)) != NULL)
19854 {
19855 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
19856 if (arg_info->use_gvariant)
19857 {
19858 g_value_init (&paramv[n], G_TYPE_VARIANT);
19859 g_value_set_variant (&paramv[n], child);
19860 n++;
19861 }
19862 else
19863 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
19864 g_variant_unref (child);
19865 }
19866 signal_id = g_signal_lookup (info->signal_name, TYPE_EVENT_LOG);
19867 g_signal_emitv (paramv, signal_id, 0, NULL);
19868 for (n = 0; n < num_params + 1; n++)
19869 g_value_unset (&paramv[n]);
19870 g_free (paramv);
19871}
19872
19873static void
19874event_log_proxy_g_properties_changed (GDBusProxy *_proxy,
19875 GVariant *changed_properties,
19876 const gchar *const *invalidated_properties)
19877{
19878 EventLogProxy *proxy = EVENT_LOG_PROXY (_proxy);
19879 guint n;
19880 const gchar *key;
19881 GVariantIter *iter;
19882 _ExtendedGDBusPropertyInfo *info;
19883 g_variant_get (changed_properties, "a{sv}", &iter);
19884 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
19885 {
19886 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, key);
19887 g_datalist_remove_data (&proxy->priv->qdata, key);
19888 if (info != NULL)
19889 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
19890 }
19891 g_variant_iter_free (iter);
19892 for (n = 0; invalidated_properties[n] != NULL; n++)
19893 {
19894 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, invalidated_properties[n]);
19895 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
19896 if (info != NULL)
19897 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
19898 }
19899}
19900
Norman James362a80f2015-09-14 14:04:39 -050019901static void
19902event_log_proxy_init (EventLogProxy *proxy)
19903{
19904#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
19905 proxy->priv = event_log_proxy_get_instance_private (proxy);
19906#else
19907 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_EVENT_LOG_PROXY, EventLogProxyPrivate);
19908#endif
19909
19910 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), event_log_interface_info ());
19911}
19912
19913static void
19914event_log_proxy_class_init (EventLogProxyClass *klass)
19915{
19916 GObjectClass *gobject_class;
19917 GDBusProxyClass *proxy_class;
19918
19919 gobject_class = G_OBJECT_CLASS (klass);
19920 gobject_class->finalize = event_log_proxy_finalize;
19921 gobject_class->get_property = event_log_proxy_get_property;
19922 gobject_class->set_property = event_log_proxy_set_property;
19923
19924 proxy_class = G_DBUS_PROXY_CLASS (klass);
19925 proxy_class->g_signal = event_log_proxy_g_signal;
19926 proxy_class->g_properties_changed = event_log_proxy_g_properties_changed;
19927
Norman James362a80f2015-09-14 14:04:39 -050019928#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
19929 g_type_class_add_private (klass, sizeof (EventLogProxyPrivate));
19930#endif
19931}
19932
19933static void
19934event_log_proxy_iface_init (EventLogIface *iface)
19935{
Norman James362a80f2015-09-14 14:04:39 -050019936}
19937
19938/**
19939 * event_log_proxy_new:
19940 * @connection: A #GDBusConnection.
19941 * @flags: Flags from the #GDBusProxyFlags enumeration.
19942 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
19943 * @object_path: An object path.
19944 * @cancellable: (allow-none): A #GCancellable or %NULL.
19945 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
19946 * @user_data: User data to pass to @callback.
19947 *
19948 * 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.
19949 *
19950 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
19951 * You can then call event_log_proxy_new_finish() to get the result of the operation.
19952 *
19953 * See event_log_proxy_new_sync() for the synchronous, blocking version of this constructor.
19954 */
19955void
19956event_log_proxy_new (
19957 GDBusConnection *connection,
19958 GDBusProxyFlags flags,
19959 const gchar *name,
19960 const gchar *object_path,
19961 GCancellable *cancellable,
19962 GAsyncReadyCallback callback,
19963 gpointer user_data)
19964{
19965 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);
19966}
19967
19968/**
19969 * event_log_proxy_new_finish:
19970 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to event_log_proxy_new().
19971 * @error: Return location for error or %NULL
19972 *
19973 * Finishes an operation started with event_log_proxy_new().
19974 *
19975 * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set.
19976 */
19977EventLog *
19978event_log_proxy_new_finish (
19979 GAsyncResult *res,
19980 GError **error)
19981{
19982 GObject *ret;
19983 GObject *source_object;
19984 source_object = g_async_result_get_source_object (res);
19985 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
19986 g_object_unref (source_object);
19987 if (ret != NULL)
19988 return EVENT_LOG (ret);
19989 else
19990 return NULL;
19991}
19992
19993/**
19994 * event_log_proxy_new_sync:
19995 * @connection: A #GDBusConnection.
19996 * @flags: Flags from the #GDBusProxyFlags enumeration.
19997 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
19998 * @object_path: An object path.
19999 * @cancellable: (allow-none): A #GCancellable or %NULL.
20000 * @error: Return location for error or %NULL
20001 *
20002 * 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.
20003 *
20004 * The calling thread is blocked until a reply is received.
20005 *
20006 * See event_log_proxy_new() for the asynchronous version of this constructor.
20007 *
20008 * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set.
20009 */
20010EventLog *
20011event_log_proxy_new_sync (
20012 GDBusConnection *connection,
20013 GDBusProxyFlags flags,
20014 const gchar *name,
20015 const gchar *object_path,
20016 GCancellable *cancellable,
20017 GError **error)
20018{
20019 GInitable *ret;
20020 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);
20021 if (ret != NULL)
20022 return EVENT_LOG (ret);
20023 else
20024 return NULL;
20025}
20026
20027
20028/**
20029 * event_log_proxy_new_for_bus:
20030 * @bus_type: A #GBusType.
20031 * @flags: Flags from the #GDBusProxyFlags enumeration.
20032 * @name: A bus name (well-known or unique).
20033 * @object_path: An object path.
20034 * @cancellable: (allow-none): A #GCancellable or %NULL.
20035 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
20036 * @user_data: User data to pass to @callback.
20037 *
20038 * Like event_log_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
20039 *
20040 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
20041 * You can then call event_log_proxy_new_for_bus_finish() to get the result of the operation.
20042 *
20043 * See event_log_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
20044 */
20045void
20046event_log_proxy_new_for_bus (
20047 GBusType bus_type,
20048 GDBusProxyFlags flags,
20049 const gchar *name,
20050 const gchar *object_path,
20051 GCancellable *cancellable,
20052 GAsyncReadyCallback callback,
20053 gpointer user_data)
20054{
20055 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);
20056}
20057
20058/**
20059 * event_log_proxy_new_for_bus_finish:
20060 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to event_log_proxy_new_for_bus().
20061 * @error: Return location for error or %NULL
20062 *
20063 * Finishes an operation started with event_log_proxy_new_for_bus().
20064 *
20065 * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set.
20066 */
20067EventLog *
20068event_log_proxy_new_for_bus_finish (
20069 GAsyncResult *res,
20070 GError **error)
20071{
20072 GObject *ret;
20073 GObject *source_object;
20074 source_object = g_async_result_get_source_object (res);
20075 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
20076 g_object_unref (source_object);
20077 if (ret != NULL)
20078 return EVENT_LOG (ret);
20079 else
20080 return NULL;
20081}
20082
20083/**
20084 * event_log_proxy_new_for_bus_sync:
20085 * @bus_type: A #GBusType.
20086 * @flags: Flags from the #GDBusProxyFlags enumeration.
20087 * @name: A bus name (well-known or unique).
20088 * @object_path: An object path.
20089 * @cancellable: (allow-none): A #GCancellable or %NULL.
20090 * @error: Return location for error or %NULL
20091 *
20092 * Like event_log_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
20093 *
20094 * The calling thread is blocked until a reply is received.
20095 *
20096 * See event_log_proxy_new_for_bus() for the asynchronous version of this constructor.
20097 *
20098 * Returns: (transfer full) (type EventLogProxy): The constructed proxy object or %NULL if @error is set.
20099 */
20100EventLog *
20101event_log_proxy_new_for_bus_sync (
20102 GBusType bus_type,
20103 GDBusProxyFlags flags,
20104 const gchar *name,
20105 const gchar *object_path,
20106 GCancellable *cancellable,
20107 GError **error)
20108{
20109 GInitable *ret;
20110 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);
20111 if (ret != NULL)
20112 return EVENT_LOG (ret);
20113 else
20114 return NULL;
20115}
20116
20117
20118/* ------------------------------------------------------------------------ */
20119
20120/**
20121 * EventLogSkeleton:
20122 *
20123 * The #EventLogSkeleton structure contains only private data and should only be accessed using the provided API.
20124 */
20125
20126/**
20127 * EventLogSkeletonClass:
20128 * @parent_class: The parent class.
20129 *
20130 * Class structure for #EventLogSkeleton.
20131 */
20132
20133struct _EventLogSkeletonPrivate
20134{
20135 GValue *properties;
20136 GList *changed_properties;
20137 GSource *changed_properties_idle_source;
20138 GMainContext *context;
20139 GMutex lock;
20140};
20141
20142static void
20143_event_log_skeleton_handle_method_call (
20144 GDBusConnection *connection G_GNUC_UNUSED,
20145 const gchar *sender G_GNUC_UNUSED,
20146 const gchar *object_path G_GNUC_UNUSED,
20147 const gchar *interface_name,
20148 const gchar *method_name,
20149 GVariant *parameters,
20150 GDBusMethodInvocation *invocation,
20151 gpointer user_data)
20152{
20153 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (user_data);
20154 _ExtendedGDBusMethodInfo *info;
20155 GVariantIter iter;
20156 GVariant *child;
20157 GValue *paramv;
20158 guint num_params;
20159 guint num_extra;
20160 guint n;
20161 guint signal_id;
20162 GValue return_value = G_VALUE_INIT;
20163 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
20164 g_assert (info != NULL);
20165 num_params = g_variant_n_children (parameters);
20166 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
20167 n = 0;
20168 g_value_init (&paramv[n], TYPE_EVENT_LOG);
20169 g_value_set_object (&paramv[n++], skeleton);
20170 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
20171 g_value_set_object (&paramv[n++], invocation);
20172 if (info->pass_fdlist)
20173 {
20174#ifdef G_OS_UNIX
20175 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
20176 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
20177#else
20178 g_assert_not_reached ();
20179#endif
20180 }
20181 g_variant_iter_init (&iter, parameters);
20182 while ((child = g_variant_iter_next_value (&iter)) != NULL)
20183 {
20184 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
20185 if (arg_info->use_gvariant)
20186 {
20187 g_value_init (&paramv[n], G_TYPE_VARIANT);
20188 g_value_set_variant (&paramv[n], child);
20189 n++;
20190 }
20191 else
20192 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
20193 g_variant_unref (child);
20194 }
20195 signal_id = g_signal_lookup (info->signal_name, TYPE_EVENT_LOG);
20196 g_value_init (&return_value, G_TYPE_BOOLEAN);
20197 g_signal_emitv (paramv, signal_id, 0, &return_value);
20198 if (!g_value_get_boolean (&return_value))
20199 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);
20200 g_value_unset (&return_value);
20201 for (n = 0; n < num_params + num_extra; n++)
20202 g_value_unset (&paramv[n]);
20203 g_free (paramv);
20204}
20205
20206static GVariant *
20207_event_log_skeleton_handle_get_property (
20208 GDBusConnection *connection G_GNUC_UNUSED,
20209 const gchar *sender G_GNUC_UNUSED,
20210 const gchar *object_path G_GNUC_UNUSED,
20211 const gchar *interface_name G_GNUC_UNUSED,
20212 const gchar *property_name,
20213 GError **error,
20214 gpointer user_data)
20215{
20216 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (user_data);
20217 GValue value = G_VALUE_INIT;
20218 GParamSpec *pspec;
20219 _ExtendedGDBusPropertyInfo *info;
20220 GVariant *ret;
20221 ret = NULL;
20222 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, property_name);
20223 g_assert (info != NULL);
20224 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
20225 if (pspec == NULL)
20226 {
20227 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
20228 }
20229 else
20230 {
20231 g_value_init (&value, pspec->value_type);
20232 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
20233 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
20234 g_value_unset (&value);
20235 }
20236 return ret;
20237}
20238
20239static gboolean
20240_event_log_skeleton_handle_set_property (
20241 GDBusConnection *connection G_GNUC_UNUSED,
20242 const gchar *sender G_GNUC_UNUSED,
20243 const gchar *object_path G_GNUC_UNUSED,
20244 const gchar *interface_name G_GNUC_UNUSED,
20245 const gchar *property_name,
20246 GVariant *variant,
20247 GError **error,
20248 gpointer user_data)
20249{
20250 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (user_data);
20251 GValue value = G_VALUE_INIT;
20252 GParamSpec *pspec;
20253 _ExtendedGDBusPropertyInfo *info;
20254 gboolean ret;
20255 ret = FALSE;
20256 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_event_log_interface_info.parent_struct, property_name);
20257 g_assert (info != NULL);
20258 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
20259 if (pspec == NULL)
20260 {
20261 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
20262 }
20263 else
20264 {
20265 if (info->use_gvariant)
20266 g_value_set_variant (&value, variant);
20267 else
20268 g_dbus_gvariant_to_gvalue (variant, &value);
20269 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
20270 g_value_unset (&value);
20271 ret = TRUE;
20272 }
20273 return ret;
20274}
20275
20276static const GDBusInterfaceVTable _event_log_skeleton_vtable =
20277{
20278 _event_log_skeleton_handle_method_call,
20279 _event_log_skeleton_handle_get_property,
20280 _event_log_skeleton_handle_set_property,
20281 {NULL}
20282};
20283
20284static GDBusInterfaceInfo *
20285event_log_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
20286{
20287 return event_log_interface_info ();
20288}
20289
20290static GDBusInterfaceVTable *
20291event_log_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
20292{
20293 return (GDBusInterfaceVTable *) &_event_log_skeleton_vtable;
20294}
20295
20296static GVariant *
20297event_log_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
20298{
20299 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (_skeleton);
20300
20301 GVariantBuilder builder;
20302 guint n;
20303 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
20304 if (_event_log_interface_info.parent_struct.properties == NULL)
20305 goto out;
20306 for (n = 0; _event_log_interface_info.parent_struct.properties[n] != NULL; n++)
20307 {
20308 GDBusPropertyInfo *info = _event_log_interface_info.parent_struct.properties[n];
20309 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
20310 {
20311 GVariant *value;
20312 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);
20313 if (value != NULL)
20314 {
20315 g_variant_take_ref (value);
20316 g_variant_builder_add (&builder, "{sv}", info->name, value);
20317 g_variant_unref (value);
20318 }
20319 }
20320 }
20321out:
20322 return g_variant_builder_end (&builder);
20323}
20324
Norman James362a80f2015-09-14 14:04:39 -050020325static void
20326event_log_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
20327{
Norman James362a80f2015-09-14 14:04:39 -050020328}
20329
20330static void
20331_event_log_on_signal_event_log (
20332 EventLog *object,
Norman James8abb50c2015-09-16 10:58:16 -050020333 gint arg_priority,
Norman James88872672015-09-21 16:51:35 -050020334 const gchar *arg_message,
20335 gint arg_rc)
Norman James362a80f2015-09-14 14:04:39 -050020336{
20337 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (object);
20338
20339 GList *connections, *l;
20340 GVariant *signal_variant;
20341 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
20342
Norman James88872672015-09-21 16:51:35 -050020343 signal_variant = g_variant_ref_sink (g_variant_new ("(isi)",
Norman James8abb50c2015-09-16 10:58:16 -050020344 arg_priority,
Norman James88872672015-09-21 16:51:35 -050020345 arg_message,
20346 arg_rc));
Norman James362a80f2015-09-14 14:04:39 -050020347 for (l = connections; l != NULL; l = l->next)
20348 {
20349 GDBusConnection *connection = l->data;
20350 g_dbus_connection_emit_signal (connection,
20351 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.EventLog", "EventLog",
20352 signal_variant, NULL);
20353 }
20354 g_variant_unref (signal_variant);
20355 g_list_free_full (connections, g_object_unref);
20356}
20357
20358static void event_log_skeleton_iface_init (EventLogIface *iface);
20359#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
20360G_DEFINE_TYPE_WITH_CODE (EventLogSkeleton, event_log_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
20361 G_ADD_PRIVATE (EventLogSkeleton)
20362 G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_skeleton_iface_init));
20363
20364#else
20365G_DEFINE_TYPE_WITH_CODE (EventLogSkeleton, event_log_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
20366 G_IMPLEMENT_INTERFACE (TYPE_EVENT_LOG, event_log_skeleton_iface_init));
20367
20368#endif
20369static void
20370event_log_skeleton_finalize (GObject *object)
20371{
20372 EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (object);
Norman James362a80f2015-09-14 14:04:39 -050020373 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
20374 if (skeleton->priv->changed_properties_idle_source != NULL)
20375 g_source_destroy (skeleton->priv->changed_properties_idle_source);
20376 g_main_context_unref (skeleton->priv->context);
20377 g_mutex_clear (&skeleton->priv->lock);
20378 G_OBJECT_CLASS (event_log_skeleton_parent_class)->finalize (object);
20379}
20380
20381static void
Norman James362a80f2015-09-14 14:04:39 -050020382event_log_skeleton_init (EventLogSkeleton *skeleton)
20383{
20384#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
20385 skeleton->priv = event_log_skeleton_get_instance_private (skeleton);
20386#else
20387 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_EVENT_LOG_SKELETON, EventLogSkeletonPrivate);
20388#endif
20389
20390 g_mutex_init (&skeleton->priv->lock);
20391 skeleton->priv->context = g_main_context_ref_thread_default ();
Norman James362a80f2015-09-14 14:04:39 -050020392}
20393
20394static void
20395event_log_skeleton_class_init (EventLogSkeletonClass *klass)
20396{
20397 GObjectClass *gobject_class;
20398 GDBusInterfaceSkeletonClass *skeleton_class;
20399
20400 gobject_class = G_OBJECT_CLASS (klass);
20401 gobject_class->finalize = event_log_skeleton_finalize;
Norman James362a80f2015-09-14 14:04:39 -050020402
20403 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
20404 skeleton_class->get_info = event_log_skeleton_dbus_interface_get_info;
20405 skeleton_class->get_properties = event_log_skeleton_dbus_interface_get_properties;
20406 skeleton_class->flush = event_log_skeleton_dbus_interface_flush;
20407 skeleton_class->get_vtable = event_log_skeleton_dbus_interface_get_vtable;
20408
20409#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
20410 g_type_class_add_private (klass, sizeof (EventLogSkeletonPrivate));
20411#endif
20412}
20413
20414static void
20415event_log_skeleton_iface_init (EventLogIface *iface)
20416{
20417 iface->event_log = _event_log_on_signal_event_log;
Norman James362a80f2015-09-14 14:04:39 -050020418}
20419
20420/**
20421 * event_log_skeleton_new:
20422 *
20423 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-EventLog.top_of_page">org.openbmc.EventLog</link>.
20424 *
20425 * Returns: (transfer full) (type EventLogSkeleton): The skeleton object.
20426 */
20427EventLog *
20428event_log_skeleton_new (void)
20429{
20430 return EVENT_LOG (g_object_new (TYPE_EVENT_LOG_SKELETON, NULL));
20431}
20432
20433/* ------------------------------------------------------------------------
20434 * Code for interface org.openbmc.Flash
20435 * ------------------------------------------------------------------------
20436 */
20437
20438/**
20439 * SECTION:Flash
20440 * @title: Flash
20441 * @short_description: Generated C code for the org.openbmc.Flash D-Bus interface
20442 *
20443 * 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.
20444 */
20445
20446/* ---- Introspection data for org.openbmc.Flash ---- */
20447
Norman Jamesdbcffbd2015-10-06 16:53:06 -050020448static const _ExtendedGDBusArgInfo _flash_method_info_update_IN_ARG_filename =
Norman James362a80f2015-09-14 14:04:39 -050020449{
20450 {
20451 -1,
Norman Jamesdbcffbd2015-10-06 16:53:06 -050020452 (gchar *) "filename",
Norman James362a80f2015-09-14 14:04:39 -050020453 (gchar *) "s",
20454 NULL
20455 },
20456 FALSE
20457};
20458
Norman Jamesdbcffbd2015-10-06 16:53:06 -050020459static const _ExtendedGDBusArgInfo * const _flash_method_info_update_IN_ARG_pointers[] =
Norman James362a80f2015-09-14 14:04:39 -050020460{
Norman Jamesdbcffbd2015-10-06 16:53:06 -050020461 &_flash_method_info_update_IN_ARG_filename,
Norman James362a80f2015-09-14 14:04:39 -050020462 NULL
20463};
20464
Norman Jamesdbcffbd2015-10-06 16:53:06 -050020465static const _ExtendedGDBusMethodInfo _flash_method_info_update =
Norman James362a80f2015-09-14 14:04:39 -050020466{
20467 {
20468 -1,
Norman Jamesdbcffbd2015-10-06 16:53:06 -050020469 (gchar *) "update",
20470 (GDBusArgInfo **) &_flash_method_info_update_IN_ARG_pointers,
Norman James362a80f2015-09-14 14:04:39 -050020471 NULL,
20472 NULL
20473 },
Norman Jamesdbcffbd2015-10-06 16:53:06 -050020474 "handle-update",
Norman James362a80f2015-09-14 14:04:39 -050020475 FALSE
20476};
20477
Norman Jamesf066e872015-10-07 15:29:51 -050020478static const _ExtendedGDBusArgInfo _flash_method_info_update_via_tftp_IN_ARG_url =
20479{
20480 {
20481 -1,
20482 (gchar *) "url",
20483 (gchar *) "s",
20484 NULL
20485 },
20486 FALSE
20487};
20488
20489static const _ExtendedGDBusArgInfo _flash_method_info_update_via_tftp_IN_ARG_filename =
20490{
20491 {
20492 -1,
20493 (gchar *) "filename",
20494 (gchar *) "s",
20495 NULL
20496 },
20497 FALSE
20498};
20499
20500static const _ExtendedGDBusArgInfo * const _flash_method_info_update_via_tftp_IN_ARG_pointers[] =
20501{
20502 &_flash_method_info_update_via_tftp_IN_ARG_url,
20503 &_flash_method_info_update_via_tftp_IN_ARG_filename,
20504 NULL
20505};
20506
20507static const _ExtendedGDBusMethodInfo _flash_method_info_update_via_tftp =
20508{
20509 {
20510 -1,
20511 (gchar *) "updateViaTftp",
20512 (GDBusArgInfo **) &_flash_method_info_update_via_tftp_IN_ARG_pointers,
20513 NULL,
20514 NULL
20515 },
20516 "handle-update-via-tftp",
20517 FALSE
20518};
20519
Norman James362a80f2015-09-14 14:04:39 -050020520static const _ExtendedGDBusMethodInfo _flash_method_info_init =
20521{
20522 {
20523 -1,
20524 (gchar *) "init",
20525 NULL,
20526 NULL,
20527 NULL
20528 },
20529 "handle-init",
20530 FALSE
20531};
20532
20533static const _ExtendedGDBusMethodInfo * const _flash_method_info_pointers[] =
20534{
Norman Jamesdbcffbd2015-10-06 16:53:06 -050020535 &_flash_method_info_update,
Norman Jamesf066e872015-10-07 15:29:51 -050020536 &_flash_method_info_update_via_tftp,
Norman James362a80f2015-09-14 14:04:39 -050020537 &_flash_method_info_init,
20538 NULL
20539};
20540
20541static const _ExtendedGDBusSignalInfo _flash_signal_info_updated =
20542{
20543 {
20544 -1,
20545 (gchar *) "Updated",
20546 NULL,
20547 NULL
20548 },
20549 "updated"
20550};
20551
Norman Jamesf066e872015-10-07 15:29:51 -050020552static const _ExtendedGDBusArgInfo _flash_signal_info_download_ARG_url =
20553{
20554 {
20555 -1,
20556 (gchar *) "url",
20557 (gchar *) "s",
20558 NULL
20559 },
20560 FALSE
20561};
20562
20563static const _ExtendedGDBusArgInfo _flash_signal_info_download_ARG_filename =
20564{
20565 {
20566 -1,
20567 (gchar *) "filename",
20568 (gchar *) "s",
20569 NULL
20570 },
20571 FALSE
20572};
20573
20574static const _ExtendedGDBusArgInfo * const _flash_signal_info_download_ARG_pointers[] =
20575{
20576 &_flash_signal_info_download_ARG_url,
20577 &_flash_signal_info_download_ARG_filename,
20578 NULL
20579};
20580
20581static const _ExtendedGDBusSignalInfo _flash_signal_info_download =
20582{
20583 {
20584 -1,
20585 (gchar *) "Download",
20586 (GDBusArgInfo **) &_flash_signal_info_download_ARG_pointers,
20587 NULL
20588 },
20589 "download"
20590};
20591
Norman James362a80f2015-09-14 14:04:39 -050020592static const _ExtendedGDBusSignalInfo * const _flash_signal_info_pointers[] =
20593{
20594 &_flash_signal_info_updated,
Norman Jamesf066e872015-10-07 15:29:51 -050020595 &_flash_signal_info_download,
Norman James362a80f2015-09-14 14:04:39 -050020596 NULL
20597};
20598
Norman James18998182015-10-11 21:54:53 -050020599static const _ExtendedGDBusPropertyInfo _flash_property_info_filename =
20600{
20601 {
20602 -1,
20603 (gchar *) "filename",
20604 (gchar *) "s",
20605 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
20606 NULL
20607 },
20608 "filename",
20609 FALSE
20610};
20611
20612static const _ExtendedGDBusPropertyInfo _flash_property_info_flasher_path =
20613{
20614 {
20615 -1,
20616 (gchar *) "flasher_path",
20617 (gchar *) "s",
20618 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
20619 NULL
20620 },
20621 "flasher-path",
20622 FALSE
20623};
20624
20625static const _ExtendedGDBusPropertyInfo _flash_property_info_flasher_name =
20626{
20627 {
20628 -1,
20629 (gchar *) "flasher_name",
20630 (gchar *) "s",
20631 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
20632 NULL
20633 },
20634 "flasher-name",
20635 FALSE
20636};
20637
20638static const _ExtendedGDBusPropertyInfo _flash_property_info_flasher_instance =
20639{
20640 {
20641 -1,
20642 (gchar *) "flasher_instance",
20643 (gchar *) "s",
20644 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
20645 NULL
20646 },
20647 "flasher-instance",
20648 FALSE
20649};
20650
20651static const _ExtendedGDBusPropertyInfo * const _flash_property_info_pointers[] =
20652{
20653 &_flash_property_info_filename,
20654 &_flash_property_info_flasher_path,
20655 &_flash_property_info_flasher_name,
20656 &_flash_property_info_flasher_instance,
20657 NULL
20658};
20659
Norman James362a80f2015-09-14 14:04:39 -050020660static const _ExtendedGDBusInterfaceInfo _flash_interface_info =
20661{
20662 {
20663 -1,
20664 (gchar *) "org.openbmc.Flash",
20665 (GDBusMethodInfo **) &_flash_method_info_pointers,
20666 (GDBusSignalInfo **) &_flash_signal_info_pointers,
Norman James18998182015-10-11 21:54:53 -050020667 (GDBusPropertyInfo **) &_flash_property_info_pointers,
Norman James362a80f2015-09-14 14:04:39 -050020668 NULL
20669 },
20670 "flash",
20671};
20672
20673
20674/**
20675 * flash_interface_info:
20676 *
20677 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link> D-Bus interface.
20678 *
20679 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
20680 */
20681GDBusInterfaceInfo *
20682flash_interface_info (void)
20683{
20684 return (GDBusInterfaceInfo *) &_flash_interface_info.parent_struct;
20685}
20686
20687/**
20688 * flash_override_properties:
20689 * @klass: The class structure for a #GObject<!-- -->-derived class.
20690 * @property_id_begin: The property id to assign to the first overridden property.
20691 *
20692 * Overrides all #GObject properties in the #Flash interface for a concrete class.
20693 * The properties are overridden in the order they are defined.
20694 *
20695 * Returns: The last property id.
20696 */
20697guint
20698flash_override_properties (GObjectClass *klass, guint property_id_begin)
20699{
Norman James18998182015-10-11 21:54:53 -050020700 g_object_class_override_property (klass, property_id_begin++, "filename");
20701 g_object_class_override_property (klass, property_id_begin++, "flasher-path");
20702 g_object_class_override_property (klass, property_id_begin++, "flasher-name");
20703 g_object_class_override_property (klass, property_id_begin++, "flasher-instance");
Norman James362a80f2015-09-14 14:04:39 -050020704 return property_id_begin - 1;
20705}
20706
20707
20708
20709/**
20710 * Flash:
20711 *
20712 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>.
20713 */
20714
20715/**
20716 * FlashIface:
20717 * @parent_iface: The parent interface.
Norman James362a80f2015-09-14 14:04:39 -050020718 * @handle_init: Handler for the #Flash::handle-init signal.
Norman Jamesdbcffbd2015-10-06 16:53:06 -050020719 * @handle_update: Handler for the #Flash::handle-update signal.
Norman Jamesf066e872015-10-07 15:29:51 -050020720 * @handle_update_via_tftp: Handler for the #Flash::handle-update-via-tftp signal.
Norman James18998182015-10-11 21:54:53 -050020721 * @get_filename: Getter for the #Flash:filename property.
20722 * @get_flasher_instance: Getter for the #Flash:flasher-instance property.
20723 * @get_flasher_name: Getter for the #Flash:flasher-name property.
20724 * @get_flasher_path: Getter for the #Flash:flasher-path property.
Norman Jamesf066e872015-10-07 15:29:51 -050020725 * @download: Handler for the #Flash::download signal.
Norman James362a80f2015-09-14 14:04:39 -050020726 * @updated: Handler for the #Flash::updated signal.
20727 *
20728 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>.
20729 */
20730
20731typedef FlashIface FlashInterface;
20732G_DEFINE_INTERFACE (Flash, flash, G_TYPE_OBJECT);
20733
20734static void
20735flash_default_init (FlashIface *iface)
20736{
20737 /* GObject signals for incoming D-Bus method calls: */
20738 /**
Norman Jamesdbcffbd2015-10-06 16:53:06 -050020739 * Flash::handle-update:
Norman James362a80f2015-09-14 14:04:39 -050020740 * @object: A #Flash.
20741 * @invocation: A #GDBusMethodInvocation.
Norman Jamesdbcffbd2015-10-06 16:53:06 -050020742 * @arg_filename: Argument passed by remote caller.
Norman James362a80f2015-09-14 14:04:39 -050020743 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050020744 * 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 -050020745 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050020746 * 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 -050020747 *
20748 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
20749 */
Norman Jamesdbcffbd2015-10-06 16:53:06 -050020750 g_signal_new ("handle-update",
Norman James362a80f2015-09-14 14:04:39 -050020751 G_TYPE_FROM_INTERFACE (iface),
20752 G_SIGNAL_RUN_LAST,
Norman Jamesdbcffbd2015-10-06 16:53:06 -050020753 G_STRUCT_OFFSET (FlashIface, handle_update),
Norman James362a80f2015-09-14 14:04:39 -050020754 g_signal_accumulator_true_handled,
20755 NULL,
20756 g_cclosure_marshal_generic,
20757 G_TYPE_BOOLEAN,
20758 2,
20759 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING);
20760
20761 /**
Norman Jamesf066e872015-10-07 15:29:51 -050020762 * Flash::handle-update-via-tftp:
20763 * @object: A #Flash.
20764 * @invocation: A #GDBusMethodInvocation.
20765 * @arg_url: Argument passed by remote caller.
20766 * @arg_filename: Argument passed by remote caller.
20767 *
20768 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.updateViaTftp">updateViaTftp()</link> D-Bus method.
20769 *
20770 * 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.
20771 *
20772 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
20773 */
20774 g_signal_new ("handle-update-via-tftp",
20775 G_TYPE_FROM_INTERFACE (iface),
20776 G_SIGNAL_RUN_LAST,
20777 G_STRUCT_OFFSET (FlashIface, handle_update_via_tftp),
20778 g_signal_accumulator_true_handled,
20779 NULL,
20780 g_cclosure_marshal_generic,
20781 G_TYPE_BOOLEAN,
20782 3,
20783 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_STRING);
20784
20785 /**
Norman James362a80f2015-09-14 14:04:39 -050020786 * Flash::handle-init:
20787 * @object: A #Flash.
20788 * @invocation: A #GDBusMethodInvocation.
20789 *
20790 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Flash.init">init()</link> D-Bus method.
20791 *
20792 * 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.
20793 *
20794 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
20795 */
20796 g_signal_new ("handle-init",
20797 G_TYPE_FROM_INTERFACE (iface),
20798 G_SIGNAL_RUN_LAST,
20799 G_STRUCT_OFFSET (FlashIface, handle_init),
20800 g_signal_accumulator_true_handled,
20801 NULL,
20802 g_cclosure_marshal_generic,
20803 G_TYPE_BOOLEAN,
20804 1,
20805 G_TYPE_DBUS_METHOD_INVOCATION);
20806
20807 /* GObject signals for received D-Bus signals: */
20808 /**
20809 * Flash::updated:
20810 * @object: A #Flash.
20811 *
20812 * 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.
20813 *
20814 * 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.
20815 */
20816 g_signal_new ("updated",
20817 G_TYPE_FROM_INTERFACE (iface),
20818 G_SIGNAL_RUN_LAST,
20819 G_STRUCT_OFFSET (FlashIface, updated),
20820 NULL,
20821 NULL,
20822 g_cclosure_marshal_generic,
20823 G_TYPE_NONE,
20824 0);
20825
Norman Jamesf066e872015-10-07 15:29:51 -050020826 /**
20827 * Flash::download:
20828 * @object: A #Flash.
20829 * @arg_url: Argument.
20830 * @arg_filename: Argument.
20831 *
20832 * 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.
20833 *
20834 * 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.
20835 */
20836 g_signal_new ("download",
20837 G_TYPE_FROM_INTERFACE (iface),
20838 G_SIGNAL_RUN_LAST,
20839 G_STRUCT_OFFSET (FlashIface, download),
20840 NULL,
20841 NULL,
20842 g_cclosure_marshal_generic,
20843 G_TYPE_NONE,
20844 2, G_TYPE_STRING, G_TYPE_STRING);
20845
Norman James18998182015-10-11 21:54:53 -050020846 /* GObject properties for D-Bus properties: */
20847 /**
20848 * Flash:filename:
20849 *
20850 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Flash.filename">"filename"</link>.
20851 *
20852 * 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.
20853 */
20854 g_object_interface_install_property (iface,
20855 g_param_spec_string ("filename", "filename", "filename", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
20856 /**
20857 * Flash:flasher-path:
20858 *
20859 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Flash.flasher_path">"flasher_path"</link>.
20860 *
20861 * 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.
20862 */
20863 g_object_interface_install_property (iface,
20864 g_param_spec_string ("flasher-path", "flasher_path", "flasher_path", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
20865 /**
20866 * Flash:flasher-name:
20867 *
20868 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Flash.flasher_name">"flasher_name"</link>.
20869 *
20870 * 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.
20871 */
20872 g_object_interface_install_property (iface,
20873 g_param_spec_string ("flasher-name", "flasher_name", "flasher_name", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
20874 /**
20875 * Flash:flasher-instance:
20876 *
20877 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Flash.flasher_instance">"flasher_instance"</link>.
20878 *
20879 * 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.
20880 */
20881 g_object_interface_install_property (iface,
20882 g_param_spec_string ("flasher-instance", "flasher_instance", "flasher_instance", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
20883}
20884
20885/**
20886 * flash_get_filename: (skip)
20887 * @object: A #Flash.
20888 *
20889 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Flash.filename">"filename"</link> D-Bus property.
20890 *
20891 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
20892 *
20893 * <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>
20894 *
20895 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
20896 */
20897const gchar *
20898flash_get_filename (Flash *object)
20899{
20900 return FLASH_GET_IFACE (object)->get_filename (object);
20901}
20902
20903/**
20904 * flash_dup_filename: (skip)
20905 * @object: A #Flash.
20906 *
20907 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Flash.filename">"filename"</link> D-Bus property.
20908 *
20909 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
20910 *
20911 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
20912 */
20913gchar *
20914flash_dup_filename (Flash *object)
20915{
20916 gchar *value;
20917 g_object_get (G_OBJECT (object), "filename", &value, NULL);
20918 return value;
20919}
20920
20921/**
20922 * flash_set_filename: (skip)
20923 * @object: A #Flash.
20924 * @value: The value to set.
20925 *
20926 * Sets the <link linkend="gdbus-property-org-openbmc-Flash.filename">"filename"</link> D-Bus property to @value.
20927 *
20928 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
20929 */
20930void
20931flash_set_filename (Flash *object, const gchar *value)
20932{
20933 g_object_set (G_OBJECT (object), "filename", value, NULL);
20934}
20935
20936/**
20937 * flash_get_flasher_path: (skip)
20938 * @object: A #Flash.
20939 *
20940 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_path">"flasher_path"</link> D-Bus property.
20941 *
20942 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
20943 *
20944 * <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>
20945 *
20946 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
20947 */
20948const gchar *
20949flash_get_flasher_path (Flash *object)
20950{
20951 return FLASH_GET_IFACE (object)->get_flasher_path (object);
20952}
20953
20954/**
20955 * flash_dup_flasher_path: (skip)
20956 * @object: A #Flash.
20957 *
20958 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_path">"flasher_path"</link> D-Bus property.
20959 *
20960 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
20961 *
20962 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
20963 */
20964gchar *
20965flash_dup_flasher_path (Flash *object)
20966{
20967 gchar *value;
20968 g_object_get (G_OBJECT (object), "flasher-path", &value, NULL);
20969 return value;
20970}
20971
20972/**
20973 * flash_set_flasher_path: (skip)
20974 * @object: A #Flash.
20975 * @value: The value to set.
20976 *
20977 * Sets the <link linkend="gdbus-property-org-openbmc-Flash.flasher_path">"flasher_path"</link> D-Bus property to @value.
20978 *
20979 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
20980 */
20981void
20982flash_set_flasher_path (Flash *object, const gchar *value)
20983{
20984 g_object_set (G_OBJECT (object), "flasher-path", value, NULL);
20985}
20986
20987/**
20988 * flash_get_flasher_name: (skip)
20989 * @object: A #Flash.
20990 *
20991 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_name">"flasher_name"</link> D-Bus property.
20992 *
20993 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
20994 *
20995 * <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>
20996 *
20997 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
20998 */
20999const gchar *
21000flash_get_flasher_name (Flash *object)
21001{
21002 return FLASH_GET_IFACE (object)->get_flasher_name (object);
21003}
21004
21005/**
21006 * flash_dup_flasher_name: (skip)
21007 * @object: A #Flash.
21008 *
21009 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_name">"flasher_name"</link> D-Bus property.
21010 *
21011 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
21012 *
21013 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
21014 */
21015gchar *
21016flash_dup_flasher_name (Flash *object)
21017{
21018 gchar *value;
21019 g_object_get (G_OBJECT (object), "flasher-name", &value, NULL);
21020 return value;
21021}
21022
21023/**
21024 * flash_set_flasher_name: (skip)
21025 * @object: A #Flash.
21026 * @value: The value to set.
21027 *
21028 * Sets the <link linkend="gdbus-property-org-openbmc-Flash.flasher_name">"flasher_name"</link> D-Bus property to @value.
21029 *
21030 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
21031 */
21032void
21033flash_set_flasher_name (Flash *object, const gchar *value)
21034{
21035 g_object_set (G_OBJECT (object), "flasher-name", value, NULL);
21036}
21037
21038/**
21039 * flash_get_flasher_instance: (skip)
21040 * @object: A #Flash.
21041 *
21042 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_instance">"flasher_instance"</link> D-Bus property.
21043 *
21044 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
21045 *
21046 * <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>
21047 *
21048 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
21049 */
21050const gchar *
21051flash_get_flasher_instance (Flash *object)
21052{
21053 return FLASH_GET_IFACE (object)->get_flasher_instance (object);
21054}
21055
21056/**
21057 * flash_dup_flasher_instance: (skip)
21058 * @object: A #Flash.
21059 *
21060 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Flash.flasher_instance">"flasher_instance"</link> D-Bus property.
21061 *
21062 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
21063 *
21064 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
21065 */
21066gchar *
21067flash_dup_flasher_instance (Flash *object)
21068{
21069 gchar *value;
21070 g_object_get (G_OBJECT (object), "flasher-instance", &value, NULL);
21071 return value;
21072}
21073
21074/**
21075 * flash_set_flasher_instance: (skip)
21076 * @object: A #Flash.
21077 * @value: The value to set.
21078 *
21079 * Sets the <link linkend="gdbus-property-org-openbmc-Flash.flasher_instance">"flasher_instance"</link> D-Bus property to @value.
21080 *
21081 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
21082 */
21083void
21084flash_set_flasher_instance (Flash *object, const gchar *value)
21085{
21086 g_object_set (G_OBJECT (object), "flasher-instance", value, NULL);
Norman James362a80f2015-09-14 14:04:39 -050021087}
21088
21089/**
21090 * flash_emit_updated:
21091 * @object: A #Flash.
21092 *
21093 * Emits the <link linkend="gdbus-signal-org-openbmc-Flash.Updated">"Updated"</link> D-Bus signal.
21094 */
21095void
21096flash_emit_updated (
21097 Flash *object)
21098{
21099 g_signal_emit_by_name (object, "updated");
21100}
21101
21102/**
Norman Jamesf066e872015-10-07 15:29:51 -050021103 * flash_emit_download:
21104 * @object: A #Flash.
21105 * @arg_url: Argument to pass with the signal.
21106 * @arg_filename: Argument to pass with the signal.
21107 *
21108 * Emits the <link linkend="gdbus-signal-org-openbmc-Flash.Download">"Download"</link> D-Bus signal.
21109 */
21110void
21111flash_emit_download (
21112 Flash *object,
21113 const gchar *arg_url,
21114 const gchar *arg_filename)
21115{
21116 g_signal_emit_by_name (object, "download", arg_url, arg_filename);
21117}
21118
21119/**
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021120 * flash_call_update:
Norman James362a80f2015-09-14 14:04:39 -050021121 * @proxy: A #FlashProxy.
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021122 * @arg_filename: Argument to pass with the method invocation.
Norman James362a80f2015-09-14 14:04:39 -050021123 * @cancellable: (allow-none): A #GCancellable or %NULL.
21124 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
21125 * @user_data: User data to pass to @callback.
21126 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021127 * 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 -050021128 * When the operation is finished, @callback will be invoked 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 -050021129 * You can then call flash_call_update_finish() to get the result of the operation.
Norman James362a80f2015-09-14 14:04:39 -050021130 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021131 * See flash_call_update_sync() for the synchronous, blocking version of this method.
Norman James362a80f2015-09-14 14:04:39 -050021132 */
21133void
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021134flash_call_update (
Norman James362a80f2015-09-14 14:04:39 -050021135 Flash *proxy,
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021136 const gchar *arg_filename,
Norman James362a80f2015-09-14 14:04:39 -050021137 GCancellable *cancellable,
21138 GAsyncReadyCallback callback,
21139 gpointer user_data)
21140{
21141 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021142 "update",
Norman James362a80f2015-09-14 14:04:39 -050021143 g_variant_new ("(s)",
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021144 arg_filename),
Norman James362a80f2015-09-14 14:04:39 -050021145 G_DBUS_CALL_FLAGS_NONE,
21146 -1,
21147 cancellable,
21148 callback,
21149 user_data);
21150}
21151
21152/**
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021153 * flash_call_update_finish:
Norman James362a80f2015-09-14 14:04:39 -050021154 * @proxy: A #FlashProxy.
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021155 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_update().
Norman James362a80f2015-09-14 14:04:39 -050021156 * @error: Return location for error or %NULL.
21157 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021158 * Finishes an operation started with flash_call_update().
Norman James362a80f2015-09-14 14:04:39 -050021159 *
21160 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
21161 */
21162gboolean
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021163flash_call_update_finish (
Norman James362a80f2015-09-14 14:04:39 -050021164 Flash *proxy,
21165 GAsyncResult *res,
21166 GError **error)
21167{
21168 GVariant *_ret;
21169 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
21170 if (_ret == NULL)
21171 goto _out;
21172 g_variant_get (_ret,
21173 "()");
21174 g_variant_unref (_ret);
21175_out:
21176 return _ret != NULL;
21177}
21178
21179/**
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021180 * flash_call_update_sync:
Norman James362a80f2015-09-14 14:04:39 -050021181 * @proxy: A #FlashProxy.
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021182 * @arg_filename: Argument to pass with the method invocation.
Norman James362a80f2015-09-14 14:04:39 -050021183 * @cancellable: (allow-none): A #GCancellable or %NULL.
21184 * @error: Return location for error or %NULL.
21185 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021186 * 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 -050021187 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021188 * See flash_call_update() for the asynchronous version of this method.
Norman James362a80f2015-09-14 14:04:39 -050021189 *
21190 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
21191 */
21192gboolean
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021193flash_call_update_sync (
Norman James362a80f2015-09-14 14:04:39 -050021194 Flash *proxy,
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021195 const gchar *arg_filename,
Norman James362a80f2015-09-14 14:04:39 -050021196 GCancellable *cancellable,
21197 GError **error)
21198{
21199 GVariant *_ret;
21200 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021201 "update",
Norman James362a80f2015-09-14 14:04:39 -050021202 g_variant_new ("(s)",
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021203 arg_filename),
Norman James362a80f2015-09-14 14:04:39 -050021204 G_DBUS_CALL_FLAGS_NONE,
21205 -1,
21206 cancellable,
21207 error);
21208 if (_ret == NULL)
21209 goto _out;
21210 g_variant_get (_ret,
21211 "()");
21212 g_variant_unref (_ret);
21213_out:
21214 return _ret != NULL;
21215}
21216
21217/**
Norman Jamesf066e872015-10-07 15:29:51 -050021218 * flash_call_update_via_tftp:
21219 * @proxy: A #FlashProxy.
21220 * @arg_url: Argument to pass with the method invocation.
21221 * @arg_filename: Argument to pass with the method invocation.
21222 * @cancellable: (allow-none): A #GCancellable or %NULL.
21223 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
21224 * @user_data: User data to pass to @callback.
21225 *
21226 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.updateViaTftp">updateViaTftp()</link> D-Bus method on @proxy.
21227 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
21228 * You can then call flash_call_update_via_tftp_finish() to get the result of the operation.
21229 *
21230 * See flash_call_update_via_tftp_sync() for the synchronous, blocking version of this method.
21231 */
21232void
21233flash_call_update_via_tftp (
21234 Flash *proxy,
21235 const gchar *arg_url,
21236 const gchar *arg_filename,
21237 GCancellable *cancellable,
21238 GAsyncReadyCallback callback,
21239 gpointer user_data)
21240{
21241 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
21242 "updateViaTftp",
21243 g_variant_new ("(ss)",
21244 arg_url,
21245 arg_filename),
21246 G_DBUS_CALL_FLAGS_NONE,
21247 -1,
21248 cancellable,
21249 callback,
21250 user_data);
21251}
21252
21253/**
21254 * flash_call_update_via_tftp_finish:
21255 * @proxy: A #FlashProxy.
21256 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_update_via_tftp().
21257 * @error: Return location for error or %NULL.
21258 *
21259 * Finishes an operation started with flash_call_update_via_tftp().
21260 *
21261 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
21262 */
21263gboolean
21264flash_call_update_via_tftp_finish (
21265 Flash *proxy,
21266 GAsyncResult *res,
21267 GError **error)
21268{
21269 GVariant *_ret;
21270 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
21271 if (_ret == NULL)
21272 goto _out;
21273 g_variant_get (_ret,
21274 "()");
21275 g_variant_unref (_ret);
21276_out:
21277 return _ret != NULL;
21278}
21279
21280/**
21281 * flash_call_update_via_tftp_sync:
21282 * @proxy: A #FlashProxy.
21283 * @arg_url: Argument to pass with the method invocation.
21284 * @arg_filename: Argument to pass with the method invocation.
21285 * @cancellable: (allow-none): A #GCancellable or %NULL.
21286 * @error: Return location for error or %NULL.
21287 *
21288 * 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.
21289 *
21290 * See flash_call_update_via_tftp() for the asynchronous version of this method.
21291 *
21292 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
21293 */
21294gboolean
21295flash_call_update_via_tftp_sync (
21296 Flash *proxy,
21297 const gchar *arg_url,
21298 const gchar *arg_filename,
21299 GCancellable *cancellable,
21300 GError **error)
21301{
21302 GVariant *_ret;
21303 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
21304 "updateViaTftp",
21305 g_variant_new ("(ss)",
21306 arg_url,
21307 arg_filename),
21308 G_DBUS_CALL_FLAGS_NONE,
21309 -1,
21310 cancellable,
21311 error);
21312 if (_ret == NULL)
21313 goto _out;
21314 g_variant_get (_ret,
21315 "()");
21316 g_variant_unref (_ret);
21317_out:
21318 return _ret != NULL;
21319}
21320
21321/**
Norman James362a80f2015-09-14 14:04:39 -050021322 * flash_call_init:
21323 * @proxy: A #FlashProxy.
21324 * @cancellable: (allow-none): A #GCancellable or %NULL.
21325 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
21326 * @user_data: User data to pass to @callback.
21327 *
21328 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Flash.init">init()</link> D-Bus method on @proxy.
21329 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
21330 * You can then call flash_call_init_finish() to get the result of the operation.
21331 *
21332 * See flash_call_init_sync() for the synchronous, blocking version of this method.
21333 */
21334void
21335flash_call_init (
21336 Flash *proxy,
21337 GCancellable *cancellable,
21338 GAsyncReadyCallback callback,
21339 gpointer user_data)
21340{
21341 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
21342 "init",
21343 g_variant_new ("()"),
21344 G_DBUS_CALL_FLAGS_NONE,
21345 -1,
21346 cancellable,
21347 callback,
21348 user_data);
21349}
21350
21351/**
21352 * flash_call_init_finish:
21353 * @proxy: A #FlashProxy.
21354 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_call_init().
21355 * @error: Return location for error or %NULL.
21356 *
21357 * Finishes an operation started with flash_call_init().
21358 *
21359 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
21360 */
21361gboolean
21362flash_call_init_finish (
21363 Flash *proxy,
21364 GAsyncResult *res,
21365 GError **error)
21366{
21367 GVariant *_ret;
21368 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
21369 if (_ret == NULL)
21370 goto _out;
21371 g_variant_get (_ret,
21372 "()");
21373 g_variant_unref (_ret);
21374_out:
21375 return _ret != NULL;
21376}
21377
21378/**
21379 * flash_call_init_sync:
21380 * @proxy: A #FlashProxy.
21381 * @cancellable: (allow-none): A #GCancellable or %NULL.
21382 * @error: Return location for error or %NULL.
21383 *
21384 * 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.
21385 *
21386 * See flash_call_init() for the asynchronous version of this method.
21387 *
21388 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
21389 */
21390gboolean
21391flash_call_init_sync (
21392 Flash *proxy,
21393 GCancellable *cancellable,
21394 GError **error)
21395{
21396 GVariant *_ret;
21397 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
21398 "init",
21399 g_variant_new ("()"),
21400 G_DBUS_CALL_FLAGS_NONE,
21401 -1,
21402 cancellable,
21403 error);
21404 if (_ret == NULL)
21405 goto _out;
21406 g_variant_get (_ret,
21407 "()");
21408 g_variant_unref (_ret);
21409_out:
21410 return _ret != NULL;
21411}
21412
21413/**
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021414 * flash_complete_update:
Norman James362a80f2015-09-14 14:04:39 -050021415 * @object: A #Flash.
21416 * @invocation: (transfer full): A #GDBusMethodInvocation.
21417 *
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021418 * 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 -050021419 *
21420 * This method will free @invocation, you cannot use it afterwards.
21421 */
21422void
Norman Jamesdbcffbd2015-10-06 16:53:06 -050021423flash_complete_update (
Norman James362a80f2015-09-14 14:04:39 -050021424 Flash *object,
21425 GDBusMethodInvocation *invocation)
21426{
21427 g_dbus_method_invocation_return_value (invocation,
21428 g_variant_new ("()"));
21429}
21430
21431/**
Norman Jamesf066e872015-10-07 15:29:51 -050021432 * flash_complete_update_via_tftp:
21433 * @object: A #Flash.
21434 * @invocation: (transfer full): A #GDBusMethodInvocation.
21435 *
21436 * 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.
21437 *
21438 * This method will free @invocation, you cannot use it afterwards.
21439 */
21440void
21441flash_complete_update_via_tftp (
21442 Flash *object,
21443 GDBusMethodInvocation *invocation)
21444{
21445 g_dbus_method_invocation_return_value (invocation,
21446 g_variant_new ("()"));
21447}
21448
21449/**
Norman James362a80f2015-09-14 14:04:39 -050021450 * flash_complete_init:
21451 * @object: A #Flash.
21452 * @invocation: (transfer full): A #GDBusMethodInvocation.
21453 *
21454 * 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.
21455 *
21456 * This method will free @invocation, you cannot use it afterwards.
21457 */
21458void
21459flash_complete_init (
21460 Flash *object,
21461 GDBusMethodInvocation *invocation)
21462{
21463 g_dbus_method_invocation_return_value (invocation,
21464 g_variant_new ("()"));
21465}
21466
21467/* ------------------------------------------------------------------------ */
21468
21469/**
21470 * FlashProxy:
21471 *
21472 * The #FlashProxy structure contains only private data and should only be accessed using the provided API.
21473 */
21474
21475/**
21476 * FlashProxyClass:
21477 * @parent_class: The parent class.
21478 *
21479 * Class structure for #FlashProxy.
21480 */
21481
21482struct _FlashProxyPrivate
21483{
21484 GData *qdata;
21485};
21486
21487static void flash_proxy_iface_init (FlashIface *iface);
21488
21489#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
21490G_DEFINE_TYPE_WITH_CODE (FlashProxy, flash_proxy, G_TYPE_DBUS_PROXY,
21491 G_ADD_PRIVATE (FlashProxy)
21492 G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_proxy_iface_init));
21493
21494#else
21495G_DEFINE_TYPE_WITH_CODE (FlashProxy, flash_proxy, G_TYPE_DBUS_PROXY,
21496 G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_proxy_iface_init));
21497
21498#endif
21499static void
21500flash_proxy_finalize (GObject *object)
21501{
21502 FlashProxy *proxy = FLASH_PROXY (object);
21503 g_datalist_clear (&proxy->priv->qdata);
21504 G_OBJECT_CLASS (flash_proxy_parent_class)->finalize (object);
21505}
21506
21507static void
21508flash_proxy_get_property (GObject *object,
21509 guint prop_id,
21510 GValue *value,
21511 GParamSpec *pspec G_GNUC_UNUSED)
21512{
Norman James18998182015-10-11 21:54:53 -050021513 const _ExtendedGDBusPropertyInfo *info;
21514 GVariant *variant;
21515 g_assert (prop_id != 0 && prop_id - 1 < 4);
21516 info = _flash_property_info_pointers[prop_id - 1];
21517 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
21518 if (info->use_gvariant)
21519 {
21520 g_value_set_variant (value, variant);
21521 }
21522 else
21523 {
21524 if (variant != NULL)
21525 g_dbus_gvariant_to_gvalue (variant, value);
21526 }
21527 if (variant != NULL)
21528 g_variant_unref (variant);
21529}
21530
21531static void
21532flash_proxy_set_property_cb (GDBusProxy *proxy,
21533 GAsyncResult *res,
21534 gpointer user_data)
21535{
21536 const _ExtendedGDBusPropertyInfo *info = user_data;
21537 GError *error;
21538 GVariant *_ret;
21539 error = NULL;
21540 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
21541 if (!_ret)
21542 {
21543 g_warning ("Error setting property '%s' on interface org.openbmc.Flash: %s (%s, %d)",
21544 info->parent_struct.name,
21545 error->message, g_quark_to_string (error->domain), error->code);
21546 g_error_free (error);
21547 }
21548 else
21549 {
21550 g_variant_unref (_ret);
21551 }
Norman James362a80f2015-09-14 14:04:39 -050021552}
21553
21554static void
21555flash_proxy_set_property (GObject *object,
21556 guint prop_id,
21557 const GValue *value,
21558 GParamSpec *pspec G_GNUC_UNUSED)
21559{
Norman James18998182015-10-11 21:54:53 -050021560 const _ExtendedGDBusPropertyInfo *info;
21561 GVariant *variant;
21562 g_assert (prop_id != 0 && prop_id - 1 < 4);
21563 info = _flash_property_info_pointers[prop_id - 1];
21564 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
21565 g_dbus_proxy_call (G_DBUS_PROXY (object),
21566 "org.freedesktop.DBus.Properties.Set",
21567 g_variant_new ("(ssv)", "org.openbmc.Flash", info->parent_struct.name, variant),
21568 G_DBUS_CALL_FLAGS_NONE,
21569 -1,
21570 NULL, (GAsyncReadyCallback) flash_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
21571 g_variant_unref (variant);
Norman James362a80f2015-09-14 14:04:39 -050021572}
21573
21574static void
21575flash_proxy_g_signal (GDBusProxy *proxy,
21576 const gchar *sender_name G_GNUC_UNUSED,
21577 const gchar *signal_name,
21578 GVariant *parameters)
21579{
21580 _ExtendedGDBusSignalInfo *info;
21581 GVariantIter iter;
21582 GVariant *child;
21583 GValue *paramv;
21584 guint num_params;
21585 guint n;
21586 guint signal_id;
21587 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, signal_name);
21588 if (info == NULL)
21589 return;
21590 num_params = g_variant_n_children (parameters);
21591 paramv = g_new0 (GValue, num_params + 1);
21592 g_value_init (&paramv[0], TYPE_FLASH);
21593 g_value_set_object (&paramv[0], proxy);
21594 g_variant_iter_init (&iter, parameters);
21595 n = 1;
21596 while ((child = g_variant_iter_next_value (&iter)) != NULL)
21597 {
21598 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
21599 if (arg_info->use_gvariant)
21600 {
21601 g_value_init (&paramv[n], G_TYPE_VARIANT);
21602 g_value_set_variant (&paramv[n], child);
21603 n++;
21604 }
21605 else
21606 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
21607 g_variant_unref (child);
21608 }
21609 signal_id = g_signal_lookup (info->signal_name, TYPE_FLASH);
21610 g_signal_emitv (paramv, signal_id, 0, NULL);
21611 for (n = 0; n < num_params + 1; n++)
21612 g_value_unset (&paramv[n]);
21613 g_free (paramv);
21614}
21615
21616static void
21617flash_proxy_g_properties_changed (GDBusProxy *_proxy,
21618 GVariant *changed_properties,
21619 const gchar *const *invalidated_properties)
21620{
21621 FlashProxy *proxy = FLASH_PROXY (_proxy);
21622 guint n;
21623 const gchar *key;
21624 GVariantIter *iter;
21625 _ExtendedGDBusPropertyInfo *info;
21626 g_variant_get (changed_properties, "a{sv}", &iter);
21627 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
21628 {
21629 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, key);
21630 g_datalist_remove_data (&proxy->priv->qdata, key);
21631 if (info != NULL)
21632 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
21633 }
21634 g_variant_iter_free (iter);
21635 for (n = 0; invalidated_properties[n] != NULL; n++)
21636 {
21637 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, invalidated_properties[n]);
21638 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
21639 if (info != NULL)
21640 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
21641 }
21642}
21643
Norman James18998182015-10-11 21:54:53 -050021644static const gchar *
21645flash_proxy_get_filename (Flash *object)
21646{
21647 FlashProxy *proxy = FLASH_PROXY (object);
21648 GVariant *variant;
21649 const gchar *value = NULL;
21650 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "filename");
21651 if (variant != NULL)
21652 {
21653 value = g_variant_get_string (variant, NULL);
21654 g_variant_unref (variant);
21655 }
21656 return value;
21657}
21658
21659static const gchar *
21660flash_proxy_get_flasher_path (Flash *object)
21661{
21662 FlashProxy *proxy = FLASH_PROXY (object);
21663 GVariant *variant;
21664 const gchar *value = NULL;
21665 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "flasher_path");
21666 if (variant != NULL)
21667 {
21668 value = g_variant_get_string (variant, NULL);
21669 g_variant_unref (variant);
21670 }
21671 return value;
21672}
21673
21674static const gchar *
21675flash_proxy_get_flasher_name (Flash *object)
21676{
21677 FlashProxy *proxy = FLASH_PROXY (object);
21678 GVariant *variant;
21679 const gchar *value = NULL;
21680 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "flasher_name");
21681 if (variant != NULL)
21682 {
21683 value = g_variant_get_string (variant, NULL);
21684 g_variant_unref (variant);
21685 }
21686 return value;
21687}
21688
21689static const gchar *
21690flash_proxy_get_flasher_instance (Flash *object)
21691{
21692 FlashProxy *proxy = FLASH_PROXY (object);
21693 GVariant *variant;
21694 const gchar *value = NULL;
21695 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "flasher_instance");
21696 if (variant != NULL)
21697 {
21698 value = g_variant_get_string (variant, NULL);
21699 g_variant_unref (variant);
21700 }
21701 return value;
21702}
21703
Norman James362a80f2015-09-14 14:04:39 -050021704static void
21705flash_proxy_init (FlashProxy *proxy)
21706{
21707#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
21708 proxy->priv = flash_proxy_get_instance_private (proxy);
21709#else
21710 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_FLASH_PROXY, FlashProxyPrivate);
21711#endif
21712
21713 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), flash_interface_info ());
21714}
21715
21716static void
21717flash_proxy_class_init (FlashProxyClass *klass)
21718{
21719 GObjectClass *gobject_class;
21720 GDBusProxyClass *proxy_class;
21721
21722 gobject_class = G_OBJECT_CLASS (klass);
21723 gobject_class->finalize = flash_proxy_finalize;
21724 gobject_class->get_property = flash_proxy_get_property;
21725 gobject_class->set_property = flash_proxy_set_property;
21726
21727 proxy_class = G_DBUS_PROXY_CLASS (klass);
21728 proxy_class->g_signal = flash_proxy_g_signal;
21729 proxy_class->g_properties_changed = flash_proxy_g_properties_changed;
21730
Norman James18998182015-10-11 21:54:53 -050021731 flash_override_properties (gobject_class, 1);
21732
Norman James362a80f2015-09-14 14:04:39 -050021733#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
21734 g_type_class_add_private (klass, sizeof (FlashProxyPrivate));
21735#endif
21736}
21737
21738static void
21739flash_proxy_iface_init (FlashIface *iface)
21740{
Norman James18998182015-10-11 21:54:53 -050021741 iface->get_filename = flash_proxy_get_filename;
21742 iface->get_flasher_path = flash_proxy_get_flasher_path;
21743 iface->get_flasher_name = flash_proxy_get_flasher_name;
21744 iface->get_flasher_instance = flash_proxy_get_flasher_instance;
Norman James362a80f2015-09-14 14:04:39 -050021745}
21746
21747/**
21748 * flash_proxy_new:
21749 * @connection: A #GDBusConnection.
21750 * @flags: Flags from the #GDBusProxyFlags enumeration.
21751 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
21752 * @object_path: An object path.
21753 * @cancellable: (allow-none): A #GCancellable or %NULL.
21754 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
21755 * @user_data: User data to pass to @callback.
21756 *
21757 * 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.
21758 *
21759 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
21760 * You can then call flash_proxy_new_finish() to get the result of the operation.
21761 *
21762 * See flash_proxy_new_sync() for the synchronous, blocking version of this constructor.
21763 */
21764void
21765flash_proxy_new (
21766 GDBusConnection *connection,
21767 GDBusProxyFlags flags,
21768 const gchar *name,
21769 const gchar *object_path,
21770 GCancellable *cancellable,
21771 GAsyncReadyCallback callback,
21772 gpointer user_data)
21773{
21774 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);
21775}
21776
21777/**
21778 * flash_proxy_new_finish:
21779 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_proxy_new().
21780 * @error: Return location for error or %NULL
21781 *
21782 * Finishes an operation started with flash_proxy_new().
21783 *
21784 * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set.
21785 */
21786Flash *
21787flash_proxy_new_finish (
21788 GAsyncResult *res,
21789 GError **error)
21790{
21791 GObject *ret;
21792 GObject *source_object;
21793 source_object = g_async_result_get_source_object (res);
21794 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
21795 g_object_unref (source_object);
21796 if (ret != NULL)
21797 return FLASH (ret);
21798 else
21799 return NULL;
21800}
21801
21802/**
21803 * flash_proxy_new_sync:
21804 * @connection: A #GDBusConnection.
21805 * @flags: Flags from the #GDBusProxyFlags enumeration.
21806 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
21807 * @object_path: An object path.
21808 * @cancellable: (allow-none): A #GCancellable or %NULL.
21809 * @error: Return location for error or %NULL
21810 *
21811 * 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.
21812 *
21813 * The calling thread is blocked until a reply is received.
21814 *
21815 * See flash_proxy_new() for the asynchronous version of this constructor.
21816 *
21817 * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set.
21818 */
21819Flash *
21820flash_proxy_new_sync (
21821 GDBusConnection *connection,
21822 GDBusProxyFlags flags,
21823 const gchar *name,
21824 const gchar *object_path,
21825 GCancellable *cancellable,
21826 GError **error)
21827{
21828 GInitable *ret;
21829 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);
21830 if (ret != NULL)
21831 return FLASH (ret);
21832 else
21833 return NULL;
21834}
21835
21836
21837/**
21838 * flash_proxy_new_for_bus:
21839 * @bus_type: A #GBusType.
21840 * @flags: Flags from the #GDBusProxyFlags enumeration.
21841 * @name: A bus name (well-known or unique).
21842 * @object_path: An object path.
21843 * @cancellable: (allow-none): A #GCancellable or %NULL.
21844 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
21845 * @user_data: User data to pass to @callback.
21846 *
21847 * Like flash_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
21848 *
21849 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
21850 * You can then call flash_proxy_new_for_bus_finish() to get the result of the operation.
21851 *
21852 * See flash_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
21853 */
21854void
21855flash_proxy_new_for_bus (
21856 GBusType bus_type,
21857 GDBusProxyFlags flags,
21858 const gchar *name,
21859 const gchar *object_path,
21860 GCancellable *cancellable,
21861 GAsyncReadyCallback callback,
21862 gpointer user_data)
21863{
21864 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);
21865}
21866
21867/**
21868 * flash_proxy_new_for_bus_finish:
21869 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_proxy_new_for_bus().
21870 * @error: Return location for error or %NULL
21871 *
21872 * Finishes an operation started with flash_proxy_new_for_bus().
21873 *
21874 * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set.
21875 */
21876Flash *
21877flash_proxy_new_for_bus_finish (
21878 GAsyncResult *res,
21879 GError **error)
21880{
21881 GObject *ret;
21882 GObject *source_object;
21883 source_object = g_async_result_get_source_object (res);
21884 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
21885 g_object_unref (source_object);
21886 if (ret != NULL)
21887 return FLASH (ret);
21888 else
21889 return NULL;
21890}
21891
21892/**
21893 * flash_proxy_new_for_bus_sync:
21894 * @bus_type: A #GBusType.
21895 * @flags: Flags from the #GDBusProxyFlags enumeration.
21896 * @name: A bus name (well-known or unique).
21897 * @object_path: An object path.
21898 * @cancellable: (allow-none): A #GCancellable or %NULL.
21899 * @error: Return location for error or %NULL
21900 *
21901 * Like flash_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
21902 *
21903 * The calling thread is blocked until a reply is received.
21904 *
21905 * See flash_proxy_new_for_bus() for the asynchronous version of this constructor.
21906 *
21907 * Returns: (transfer full) (type FlashProxy): The constructed proxy object or %NULL if @error is set.
21908 */
21909Flash *
21910flash_proxy_new_for_bus_sync (
21911 GBusType bus_type,
21912 GDBusProxyFlags flags,
21913 const gchar *name,
21914 const gchar *object_path,
21915 GCancellable *cancellable,
21916 GError **error)
21917{
21918 GInitable *ret;
21919 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);
21920 if (ret != NULL)
21921 return FLASH (ret);
21922 else
21923 return NULL;
21924}
21925
21926
21927/* ------------------------------------------------------------------------ */
21928
21929/**
21930 * FlashSkeleton:
21931 *
21932 * The #FlashSkeleton structure contains only private data and should only be accessed using the provided API.
21933 */
21934
21935/**
21936 * FlashSkeletonClass:
21937 * @parent_class: The parent class.
21938 *
21939 * Class structure for #FlashSkeleton.
21940 */
21941
21942struct _FlashSkeletonPrivate
21943{
21944 GValue *properties;
21945 GList *changed_properties;
21946 GSource *changed_properties_idle_source;
21947 GMainContext *context;
21948 GMutex lock;
21949};
21950
21951static void
21952_flash_skeleton_handle_method_call (
21953 GDBusConnection *connection G_GNUC_UNUSED,
21954 const gchar *sender G_GNUC_UNUSED,
21955 const gchar *object_path G_GNUC_UNUSED,
21956 const gchar *interface_name,
21957 const gchar *method_name,
21958 GVariant *parameters,
21959 GDBusMethodInvocation *invocation,
21960 gpointer user_data)
21961{
21962 FlashSkeleton *skeleton = FLASH_SKELETON (user_data);
21963 _ExtendedGDBusMethodInfo *info;
21964 GVariantIter iter;
21965 GVariant *child;
21966 GValue *paramv;
21967 guint num_params;
21968 guint num_extra;
21969 guint n;
21970 guint signal_id;
21971 GValue return_value = G_VALUE_INIT;
21972 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
21973 g_assert (info != NULL);
21974 num_params = g_variant_n_children (parameters);
21975 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
21976 n = 0;
21977 g_value_init (&paramv[n], TYPE_FLASH);
21978 g_value_set_object (&paramv[n++], skeleton);
21979 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
21980 g_value_set_object (&paramv[n++], invocation);
21981 if (info->pass_fdlist)
21982 {
21983#ifdef G_OS_UNIX
21984 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
21985 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
21986#else
21987 g_assert_not_reached ();
21988#endif
21989 }
21990 g_variant_iter_init (&iter, parameters);
21991 while ((child = g_variant_iter_next_value (&iter)) != NULL)
21992 {
21993 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
21994 if (arg_info->use_gvariant)
21995 {
21996 g_value_init (&paramv[n], G_TYPE_VARIANT);
21997 g_value_set_variant (&paramv[n], child);
21998 n++;
21999 }
22000 else
22001 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
22002 g_variant_unref (child);
22003 }
22004 signal_id = g_signal_lookup (info->signal_name, TYPE_FLASH);
22005 g_value_init (&return_value, G_TYPE_BOOLEAN);
22006 g_signal_emitv (paramv, signal_id, 0, &return_value);
22007 if (!g_value_get_boolean (&return_value))
22008 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);
22009 g_value_unset (&return_value);
22010 for (n = 0; n < num_params + num_extra; n++)
22011 g_value_unset (&paramv[n]);
22012 g_free (paramv);
22013}
22014
22015static GVariant *
22016_flash_skeleton_handle_get_property (
22017 GDBusConnection *connection G_GNUC_UNUSED,
22018 const gchar *sender G_GNUC_UNUSED,
22019 const gchar *object_path G_GNUC_UNUSED,
22020 const gchar *interface_name G_GNUC_UNUSED,
22021 const gchar *property_name,
22022 GError **error,
22023 gpointer user_data)
22024{
22025 FlashSkeleton *skeleton = FLASH_SKELETON (user_data);
22026 GValue value = G_VALUE_INIT;
22027 GParamSpec *pspec;
22028 _ExtendedGDBusPropertyInfo *info;
22029 GVariant *ret;
22030 ret = NULL;
22031 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, property_name);
22032 g_assert (info != NULL);
22033 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
22034 if (pspec == NULL)
22035 {
22036 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
22037 }
22038 else
22039 {
22040 g_value_init (&value, pspec->value_type);
22041 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
22042 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
22043 g_value_unset (&value);
22044 }
22045 return ret;
22046}
22047
22048static gboolean
22049_flash_skeleton_handle_set_property (
22050 GDBusConnection *connection G_GNUC_UNUSED,
22051 const gchar *sender G_GNUC_UNUSED,
22052 const gchar *object_path G_GNUC_UNUSED,
22053 const gchar *interface_name G_GNUC_UNUSED,
22054 const gchar *property_name,
22055 GVariant *variant,
22056 GError **error,
22057 gpointer user_data)
22058{
22059 FlashSkeleton *skeleton = FLASH_SKELETON (user_data);
22060 GValue value = G_VALUE_INIT;
22061 GParamSpec *pspec;
22062 _ExtendedGDBusPropertyInfo *info;
22063 gboolean ret;
22064 ret = FALSE;
22065 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_interface_info.parent_struct, property_name);
22066 g_assert (info != NULL);
22067 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
22068 if (pspec == NULL)
22069 {
22070 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
22071 }
22072 else
22073 {
22074 if (info->use_gvariant)
22075 g_value_set_variant (&value, variant);
22076 else
22077 g_dbus_gvariant_to_gvalue (variant, &value);
22078 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
22079 g_value_unset (&value);
22080 ret = TRUE;
22081 }
22082 return ret;
22083}
22084
22085static const GDBusInterfaceVTable _flash_skeleton_vtable =
22086{
22087 _flash_skeleton_handle_method_call,
22088 _flash_skeleton_handle_get_property,
22089 _flash_skeleton_handle_set_property,
22090 {NULL}
22091};
22092
22093static GDBusInterfaceInfo *
22094flash_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
22095{
22096 return flash_interface_info ();
22097}
22098
22099static GDBusInterfaceVTable *
22100flash_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
22101{
22102 return (GDBusInterfaceVTable *) &_flash_skeleton_vtable;
22103}
22104
22105static GVariant *
22106flash_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
22107{
22108 FlashSkeleton *skeleton = FLASH_SKELETON (_skeleton);
22109
22110 GVariantBuilder builder;
22111 guint n;
22112 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
22113 if (_flash_interface_info.parent_struct.properties == NULL)
22114 goto out;
22115 for (n = 0; _flash_interface_info.parent_struct.properties[n] != NULL; n++)
22116 {
22117 GDBusPropertyInfo *info = _flash_interface_info.parent_struct.properties[n];
22118 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
22119 {
22120 GVariant *value;
22121 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);
22122 if (value != NULL)
22123 {
22124 g_variant_take_ref (value);
22125 g_variant_builder_add (&builder, "{sv}", info->name, value);
22126 g_variant_unref (value);
22127 }
22128 }
22129 }
22130out:
22131 return g_variant_builder_end (&builder);
22132}
22133
Norman James18998182015-10-11 21:54:53 -050022134static gboolean _flash_emit_changed (gpointer user_data);
22135
Norman James362a80f2015-09-14 14:04:39 -050022136static void
22137flash_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
22138{
Norman James18998182015-10-11 21:54:53 -050022139 FlashSkeleton *skeleton = FLASH_SKELETON (_skeleton);
22140 gboolean emit_changed = FALSE;
22141
22142 g_mutex_lock (&skeleton->priv->lock);
22143 if (skeleton->priv->changed_properties_idle_source != NULL)
22144 {
22145 g_source_destroy (skeleton->priv->changed_properties_idle_source);
22146 skeleton->priv->changed_properties_idle_source = NULL;
22147 emit_changed = TRUE;
22148 }
22149 g_mutex_unlock (&skeleton->priv->lock);
22150
22151 if (emit_changed)
22152 _flash_emit_changed (skeleton);
Norman James362a80f2015-09-14 14:04:39 -050022153}
22154
22155static void
22156_flash_on_signal_updated (
22157 Flash *object)
22158{
22159 FlashSkeleton *skeleton = FLASH_SKELETON (object);
22160
22161 GList *connections, *l;
22162 GVariant *signal_variant;
22163 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
22164
22165 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
22166 for (l = connections; l != NULL; l = l->next)
22167 {
22168 GDBusConnection *connection = l->data;
22169 g_dbus_connection_emit_signal (connection,
22170 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Flash", "Updated",
22171 signal_variant, NULL);
22172 }
22173 g_variant_unref (signal_variant);
22174 g_list_free_full (connections, g_object_unref);
22175}
22176
Norman Jamesf066e872015-10-07 15:29:51 -050022177static void
22178_flash_on_signal_download (
22179 Flash *object,
22180 const gchar *arg_url,
22181 const gchar *arg_filename)
22182{
22183 FlashSkeleton *skeleton = FLASH_SKELETON (object);
22184
22185 GList *connections, *l;
22186 GVariant *signal_variant;
22187 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
22188
22189 signal_variant = g_variant_ref_sink (g_variant_new ("(ss)",
22190 arg_url,
22191 arg_filename));
22192 for (l = connections; l != NULL; l = l->next)
22193 {
22194 GDBusConnection *connection = l->data;
22195 g_dbus_connection_emit_signal (connection,
22196 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Flash", "Download",
22197 signal_variant, NULL);
22198 }
22199 g_variant_unref (signal_variant);
22200 g_list_free_full (connections, g_object_unref);
22201}
22202
Norman James362a80f2015-09-14 14:04:39 -050022203static void flash_skeleton_iface_init (FlashIface *iface);
22204#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
22205G_DEFINE_TYPE_WITH_CODE (FlashSkeleton, flash_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
22206 G_ADD_PRIVATE (FlashSkeleton)
22207 G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_skeleton_iface_init));
22208
22209#else
22210G_DEFINE_TYPE_WITH_CODE (FlashSkeleton, flash_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
22211 G_IMPLEMENT_INTERFACE (TYPE_FLASH, flash_skeleton_iface_init));
22212
22213#endif
22214static void
22215flash_skeleton_finalize (GObject *object)
22216{
22217 FlashSkeleton *skeleton = FLASH_SKELETON (object);
Norman James18998182015-10-11 21:54:53 -050022218 guint n;
22219 for (n = 0; n < 4; n++)
22220 g_value_unset (&skeleton->priv->properties[n]);
22221 g_free (skeleton->priv->properties);
Norman James362a80f2015-09-14 14:04:39 -050022222 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
22223 if (skeleton->priv->changed_properties_idle_source != NULL)
22224 g_source_destroy (skeleton->priv->changed_properties_idle_source);
22225 g_main_context_unref (skeleton->priv->context);
22226 g_mutex_clear (&skeleton->priv->lock);
22227 G_OBJECT_CLASS (flash_skeleton_parent_class)->finalize (object);
22228}
22229
22230static void
Norman James18998182015-10-11 21:54:53 -050022231flash_skeleton_get_property (GObject *object,
22232 guint prop_id,
22233 GValue *value,
22234 GParamSpec *pspec G_GNUC_UNUSED)
22235{
22236 FlashSkeleton *skeleton = FLASH_SKELETON (object);
22237 g_assert (prop_id != 0 && prop_id - 1 < 4);
22238 g_mutex_lock (&skeleton->priv->lock);
22239 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
22240 g_mutex_unlock (&skeleton->priv->lock);
22241}
22242
22243static gboolean
22244_flash_emit_changed (gpointer user_data)
22245{
22246 FlashSkeleton *skeleton = FLASH_SKELETON (user_data);
22247 GList *l;
22248 GVariantBuilder builder;
22249 GVariantBuilder invalidated_builder;
22250 guint num_changes;
22251
22252 g_mutex_lock (&skeleton->priv->lock);
22253 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
22254 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
22255 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
22256 {
22257 ChangedProperty *cp = l->data;
22258 GVariant *variant;
22259 const GValue *cur_value;
22260
22261 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
22262 if (!_g_value_equal (cur_value, &cp->orig_value))
22263 {
22264 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
22265 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
22266 g_variant_unref (variant);
22267 num_changes++;
22268 }
22269 }
22270 if (num_changes > 0)
22271 {
22272 GList *connections, *ll;
22273 GVariant *signal_variant;
22274 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Flash",
22275 &builder, &invalidated_builder));
22276 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
22277 for (ll = connections; ll != NULL; ll = ll->next)
22278 {
22279 GDBusConnection *connection = ll->data;
22280
22281 g_dbus_connection_emit_signal (connection,
22282 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
22283 "org.freedesktop.DBus.Properties",
22284 "PropertiesChanged",
22285 signal_variant,
22286 NULL);
22287 }
22288 g_variant_unref (signal_variant);
22289 g_list_free_full (connections, g_object_unref);
22290 }
22291 else
22292 {
22293 g_variant_builder_clear (&builder);
22294 g_variant_builder_clear (&invalidated_builder);
22295 }
22296 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
22297 skeleton->priv->changed_properties = NULL;
22298 skeleton->priv->changed_properties_idle_source = NULL;
22299 g_mutex_unlock (&skeleton->priv->lock);
22300 return FALSE;
22301}
22302
22303static void
22304_flash_schedule_emit_changed (FlashSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
22305{
22306 ChangedProperty *cp;
22307 GList *l;
22308 cp = NULL;
22309 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
22310 {
22311 ChangedProperty *i_cp = l->data;
22312 if (i_cp->info == info)
22313 {
22314 cp = i_cp;
22315 break;
22316 }
22317 }
22318 if (cp == NULL)
22319 {
22320 cp = g_new0 (ChangedProperty, 1);
22321 cp->prop_id = prop_id;
22322 cp->info = info;
22323 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
22324 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
22325 g_value_copy (orig_value, &cp->orig_value);
22326 }
22327}
22328
22329static void
22330flash_skeleton_notify (GObject *object,
22331 GParamSpec *pspec G_GNUC_UNUSED)
22332{
22333 FlashSkeleton *skeleton = FLASH_SKELETON (object);
22334 g_mutex_lock (&skeleton->priv->lock);
22335 if (skeleton->priv->changed_properties != NULL &&
22336 skeleton->priv->changed_properties_idle_source == NULL)
22337 {
22338 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
22339 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
22340 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _flash_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
Adriana Kobylak2cb27752015-10-19 16:23:14 -050022341 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _flash_emit_changed");
Norman James18998182015-10-11 21:54:53 -050022342 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
22343 g_source_unref (skeleton->priv->changed_properties_idle_source);
22344 }
22345 g_mutex_unlock (&skeleton->priv->lock);
22346}
22347
22348static void
22349flash_skeleton_set_property (GObject *object,
22350 guint prop_id,
22351 const GValue *value,
22352 GParamSpec *pspec)
22353{
22354 FlashSkeleton *skeleton = FLASH_SKELETON (object);
22355 g_assert (prop_id != 0 && prop_id - 1 < 4);
22356 g_mutex_lock (&skeleton->priv->lock);
22357 g_object_freeze_notify (object);
22358 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
22359 {
22360 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
22361 _flash_schedule_emit_changed (skeleton, _flash_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
22362 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
22363 g_object_notify_by_pspec (object, pspec);
22364 }
22365 g_mutex_unlock (&skeleton->priv->lock);
22366 g_object_thaw_notify (object);
22367}
22368
22369static void
Norman James362a80f2015-09-14 14:04:39 -050022370flash_skeleton_init (FlashSkeleton *skeleton)
22371{
22372#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
22373 skeleton->priv = flash_skeleton_get_instance_private (skeleton);
22374#else
22375 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_FLASH_SKELETON, FlashSkeletonPrivate);
22376#endif
22377
22378 g_mutex_init (&skeleton->priv->lock);
22379 skeleton->priv->context = g_main_context_ref_thread_default ();
Norman James18998182015-10-11 21:54:53 -050022380 skeleton->priv->properties = g_new0 (GValue, 4);
22381 g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING);
22382 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
22383 g_value_init (&skeleton->priv->properties[2], G_TYPE_STRING);
22384 g_value_init (&skeleton->priv->properties[3], G_TYPE_STRING);
22385}
22386
22387static const gchar *
22388flash_skeleton_get_filename (Flash *object)
22389{
22390 FlashSkeleton *skeleton = FLASH_SKELETON (object);
22391 const gchar *value;
22392 g_mutex_lock (&skeleton->priv->lock);
22393 value = g_value_get_string (&(skeleton->priv->properties[0]));
22394 g_mutex_unlock (&skeleton->priv->lock);
22395 return value;
22396}
22397
22398static const gchar *
22399flash_skeleton_get_flasher_path (Flash *object)
22400{
22401 FlashSkeleton *skeleton = FLASH_SKELETON (object);
22402 const gchar *value;
22403 g_mutex_lock (&skeleton->priv->lock);
22404 value = g_value_get_string (&(skeleton->priv->properties[1]));
22405 g_mutex_unlock (&skeleton->priv->lock);
22406 return value;
22407}
22408
22409static const gchar *
22410flash_skeleton_get_flasher_name (Flash *object)
22411{
22412 FlashSkeleton *skeleton = FLASH_SKELETON (object);
22413 const gchar *value;
22414 g_mutex_lock (&skeleton->priv->lock);
22415 value = g_value_get_string (&(skeleton->priv->properties[2]));
22416 g_mutex_unlock (&skeleton->priv->lock);
22417 return value;
22418}
22419
22420static const gchar *
22421flash_skeleton_get_flasher_instance (Flash *object)
22422{
22423 FlashSkeleton *skeleton = FLASH_SKELETON (object);
22424 const gchar *value;
22425 g_mutex_lock (&skeleton->priv->lock);
22426 value = g_value_get_string (&(skeleton->priv->properties[3]));
22427 g_mutex_unlock (&skeleton->priv->lock);
22428 return value;
Norman James362a80f2015-09-14 14:04:39 -050022429}
22430
22431static void
22432flash_skeleton_class_init (FlashSkeletonClass *klass)
22433{
22434 GObjectClass *gobject_class;
22435 GDBusInterfaceSkeletonClass *skeleton_class;
22436
22437 gobject_class = G_OBJECT_CLASS (klass);
22438 gobject_class->finalize = flash_skeleton_finalize;
Norman James18998182015-10-11 21:54:53 -050022439 gobject_class->get_property = flash_skeleton_get_property;
22440 gobject_class->set_property = flash_skeleton_set_property;
22441 gobject_class->notify = flash_skeleton_notify;
22442
22443
22444 flash_override_properties (gobject_class, 1);
Norman James362a80f2015-09-14 14:04:39 -050022445
22446 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
22447 skeleton_class->get_info = flash_skeleton_dbus_interface_get_info;
22448 skeleton_class->get_properties = flash_skeleton_dbus_interface_get_properties;
22449 skeleton_class->flush = flash_skeleton_dbus_interface_flush;
22450 skeleton_class->get_vtable = flash_skeleton_dbus_interface_get_vtable;
22451
22452#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
22453 g_type_class_add_private (klass, sizeof (FlashSkeletonPrivate));
22454#endif
22455}
22456
22457static void
22458flash_skeleton_iface_init (FlashIface *iface)
22459{
22460 iface->updated = _flash_on_signal_updated;
Norman Jamesf066e872015-10-07 15:29:51 -050022461 iface->download = _flash_on_signal_download;
Norman James18998182015-10-11 21:54:53 -050022462 iface->get_filename = flash_skeleton_get_filename;
22463 iface->get_flasher_path = flash_skeleton_get_flasher_path;
22464 iface->get_flasher_name = flash_skeleton_get_flasher_name;
22465 iface->get_flasher_instance = flash_skeleton_get_flasher_instance;
Norman James362a80f2015-09-14 14:04:39 -050022466}
22467
22468/**
22469 * flash_skeleton_new:
22470 *
22471 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Flash.top_of_page">org.openbmc.Flash</link>.
22472 *
22473 * Returns: (transfer full) (type FlashSkeleton): The skeleton object.
22474 */
22475Flash *
22476flash_skeleton_new (void)
22477{
22478 return FLASH (g_object_new (TYPE_FLASH_SKELETON, NULL));
22479}
22480
22481/* ------------------------------------------------------------------------
Norman James18998182015-10-11 21:54:53 -050022482 * Code for interface org.openbmc.FlashControl
22483 * ------------------------------------------------------------------------
22484 */
22485
22486/**
22487 * SECTION:FlashControl
22488 * @title: FlashControl
22489 * @short_description: Generated C code for the org.openbmc.FlashControl D-Bus interface
22490 *
22491 * 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.
22492 */
22493
22494/* ---- Introspection data for org.openbmc.FlashControl ---- */
22495
22496static const _ExtendedGDBusArgInfo _flash_control_method_info_flash_IN_ARG_type =
22497{
22498 {
22499 -1,
22500 (gchar *) "type",
22501 (gchar *) "s",
22502 NULL
22503 },
22504 FALSE
22505};
22506
22507static const _ExtendedGDBusArgInfo _flash_control_method_info_flash_IN_ARG_filename =
22508{
22509 {
22510 -1,
22511 (gchar *) "filename",
22512 (gchar *) "s",
22513 NULL
22514 },
22515 FALSE
22516};
22517
22518static const _ExtendedGDBusArgInfo * const _flash_control_method_info_flash_IN_ARG_pointers[] =
22519{
22520 &_flash_control_method_info_flash_IN_ARG_type,
22521 &_flash_control_method_info_flash_IN_ARG_filename,
22522 NULL
22523};
22524
22525static const _ExtendedGDBusMethodInfo _flash_control_method_info_flash =
22526{
22527 {
22528 -1,
22529 (gchar *) "flash",
22530 (GDBusArgInfo **) &_flash_control_method_info_flash_IN_ARG_pointers,
22531 NULL,
22532 NULL
22533 },
22534 "handle-flash",
22535 FALSE
22536};
22537
22538static const _ExtendedGDBusMethodInfo * const _flash_control_method_info_pointers[] =
22539{
22540 &_flash_control_method_info_flash,
22541 NULL
22542};
22543
22544static const _ExtendedGDBusArgInfo _flash_control_signal_info_done_ARG_filename =
22545{
22546 {
22547 -1,
22548 (gchar *) "filename",
22549 (gchar *) "s",
22550 NULL
22551 },
22552 FALSE
22553};
22554
22555static const _ExtendedGDBusArgInfo * const _flash_control_signal_info_done_ARG_pointers[] =
22556{
22557 &_flash_control_signal_info_done_ARG_filename,
22558 NULL
22559};
22560
22561static const _ExtendedGDBusSignalInfo _flash_control_signal_info_done =
22562{
22563 {
22564 -1,
22565 (gchar *) "Done",
22566 (GDBusArgInfo **) &_flash_control_signal_info_done_ARG_pointers,
22567 NULL
22568 },
22569 "done"
22570};
22571
22572static const _ExtendedGDBusArgInfo _flash_control_signal_info_error_ARG_filename =
22573{
22574 {
22575 -1,
22576 (gchar *) "filename",
22577 (gchar *) "s",
22578 NULL
22579 },
22580 FALSE
22581};
22582
22583static const _ExtendedGDBusArgInfo * const _flash_control_signal_info_error_ARG_pointers[] =
22584{
22585 &_flash_control_signal_info_error_ARG_filename,
22586 NULL
22587};
22588
22589static const _ExtendedGDBusSignalInfo _flash_control_signal_info_error =
22590{
22591 {
22592 -1,
22593 (gchar *) "Error",
22594 (GDBusArgInfo **) &_flash_control_signal_info_error_ARG_pointers,
22595 NULL
22596 },
22597 "error"
22598};
22599
22600static const _ExtendedGDBusArgInfo _flash_control_signal_info_progress_ARG_filename =
22601{
22602 {
22603 -1,
22604 (gchar *) "filename",
22605 (gchar *) "s",
22606 NULL
22607 },
22608 FALSE
22609};
22610
22611static const _ExtendedGDBusArgInfo _flash_control_signal_info_progress_ARG_progress =
22612{
22613 {
22614 -1,
22615 (gchar *) "progress",
22616 (gchar *) "y",
22617 NULL
22618 },
22619 FALSE
22620};
22621
22622static const _ExtendedGDBusArgInfo * const _flash_control_signal_info_progress_ARG_pointers[] =
22623{
22624 &_flash_control_signal_info_progress_ARG_filename,
22625 &_flash_control_signal_info_progress_ARG_progress,
22626 NULL
22627};
22628
22629static const _ExtendedGDBusSignalInfo _flash_control_signal_info_progress =
22630{
22631 {
22632 -1,
22633 (gchar *) "Progress",
22634 (GDBusArgInfo **) &_flash_control_signal_info_progress_ARG_pointers,
22635 NULL
22636 },
22637 "progress"
22638};
22639
22640static const _ExtendedGDBusSignalInfo * const _flash_control_signal_info_pointers[] =
22641{
22642 &_flash_control_signal_info_done,
22643 &_flash_control_signal_info_error,
22644 &_flash_control_signal_info_progress,
22645 NULL
22646};
22647
22648static const _ExtendedGDBusPropertyInfo _flash_control_property_info_filename =
22649{
22650 {
22651 -1,
22652 (gchar *) "filename",
22653 (gchar *) "s",
22654 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
22655 NULL
22656 },
22657 "filename",
22658 FALSE
22659};
22660
22661static const _ExtendedGDBusPropertyInfo _flash_control_property_info_type_ =
22662{
22663 {
22664 -1,
22665 (gchar *) "type",
22666 (gchar *) "s",
22667 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
22668 NULL
22669 },
22670 "type",
22671 FALSE
22672};
22673
22674static const _ExtendedGDBusPropertyInfo * const _flash_control_property_info_pointers[] =
22675{
22676 &_flash_control_property_info_filename,
22677 &_flash_control_property_info_type_,
22678 NULL
22679};
22680
22681static const _ExtendedGDBusInterfaceInfo _flash_control_interface_info =
22682{
22683 {
22684 -1,
22685 (gchar *) "org.openbmc.FlashControl",
22686 (GDBusMethodInfo **) &_flash_control_method_info_pointers,
22687 (GDBusSignalInfo **) &_flash_control_signal_info_pointers,
22688 (GDBusPropertyInfo **) &_flash_control_property_info_pointers,
22689 NULL
22690 },
22691 "flash-control",
22692};
22693
22694
22695/**
22696 * flash_control_interface_info:
22697 *
22698 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link> D-Bus interface.
22699 *
22700 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
22701 */
22702GDBusInterfaceInfo *
22703flash_control_interface_info (void)
22704{
22705 return (GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct;
22706}
22707
22708/**
22709 * flash_control_override_properties:
22710 * @klass: The class structure for a #GObject<!-- -->-derived class.
22711 * @property_id_begin: The property id to assign to the first overridden property.
22712 *
22713 * Overrides all #GObject properties in the #FlashControl interface for a concrete class.
22714 * The properties are overridden in the order they are defined.
22715 *
22716 * Returns: The last property id.
22717 */
22718guint
22719flash_control_override_properties (GObjectClass *klass, guint property_id_begin)
22720{
22721 g_object_class_override_property (klass, property_id_begin++, "filename");
22722 g_object_class_override_property (klass, property_id_begin++, "type");
22723 return property_id_begin - 1;
22724}
22725
22726
22727
22728/**
22729 * FlashControl:
22730 *
22731 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link>.
22732 */
22733
22734/**
22735 * FlashControlIface:
22736 * @parent_iface: The parent interface.
22737 * @handle_flash: Handler for the #FlashControl::handle-flash signal.
22738 * @get_filename: Getter for the #FlashControl:filename property.
22739 * @get_type_: Getter for the #FlashControl:type property.
22740 * @done: Handler for the #FlashControl::done signal.
22741 * @error: Handler for the #FlashControl::error signal.
22742 * @progress: Handler for the #FlashControl::progress signal.
22743 *
22744 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link>.
22745 */
22746
22747typedef FlashControlIface FlashControlInterface;
22748G_DEFINE_INTERFACE (FlashControl, flash_control, G_TYPE_OBJECT);
22749
22750static void
22751flash_control_default_init (FlashControlIface *iface)
22752{
22753 /* GObject signals for incoming D-Bus method calls: */
22754 /**
22755 * FlashControl::handle-flash:
22756 * @object: A #FlashControl.
22757 * @invocation: A #GDBusMethodInvocation.
22758 * @arg_type: Argument passed by remote caller.
22759 * @arg_filename: Argument passed by remote caller.
22760 *
22761 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-FlashControl.flash">flash()</link> D-Bus method.
22762 *
22763 * 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.
22764 *
22765 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
22766 */
22767 g_signal_new ("handle-flash",
22768 G_TYPE_FROM_INTERFACE (iface),
22769 G_SIGNAL_RUN_LAST,
22770 G_STRUCT_OFFSET (FlashControlIface, handle_flash),
22771 g_signal_accumulator_true_handled,
22772 NULL,
22773 g_cclosure_marshal_generic,
22774 G_TYPE_BOOLEAN,
22775 3,
22776 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_STRING, G_TYPE_STRING);
22777
22778 /* GObject signals for received D-Bus signals: */
22779 /**
22780 * FlashControl::done:
22781 * @object: A #FlashControl.
22782 * @arg_filename: Argument.
22783 *
22784 * 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.
22785 *
22786 * 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.
22787 */
22788 g_signal_new ("done",
22789 G_TYPE_FROM_INTERFACE (iface),
22790 G_SIGNAL_RUN_LAST,
22791 G_STRUCT_OFFSET (FlashControlIface, done),
22792 NULL,
22793 NULL,
22794 g_cclosure_marshal_generic,
22795 G_TYPE_NONE,
22796 1, G_TYPE_STRING);
22797
22798 /**
22799 * FlashControl::error:
22800 * @object: A #FlashControl.
22801 * @arg_filename: Argument.
22802 *
22803 * 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.
22804 *
22805 * 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.
22806 */
22807 g_signal_new ("error",
22808 G_TYPE_FROM_INTERFACE (iface),
22809 G_SIGNAL_RUN_LAST,
22810 G_STRUCT_OFFSET (FlashControlIface, error),
22811 NULL,
22812 NULL,
22813 g_cclosure_marshal_generic,
22814 G_TYPE_NONE,
22815 1, G_TYPE_STRING);
22816
22817 /**
22818 * FlashControl::progress:
22819 * @object: A #FlashControl.
22820 * @arg_filename: Argument.
22821 * @arg_progress: Argument.
22822 *
22823 * 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.
22824 *
22825 * 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.
22826 */
22827 g_signal_new ("progress",
22828 G_TYPE_FROM_INTERFACE (iface),
22829 G_SIGNAL_RUN_LAST,
22830 G_STRUCT_OFFSET (FlashControlIface, progress),
22831 NULL,
22832 NULL,
22833 g_cclosure_marshal_generic,
22834 G_TYPE_NONE,
22835 2, G_TYPE_STRING, G_TYPE_UCHAR);
22836
22837 /* GObject properties for D-Bus properties: */
22838 /**
22839 * FlashControl:filename:
22840 *
22841 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-FlashControl.filename">"filename"</link>.
22842 *
22843 * 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.
22844 */
22845 g_object_interface_install_property (iface,
22846 g_param_spec_string ("filename", "filename", "filename", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
22847 /**
22848 * FlashControl:type:
22849 *
22850 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-FlashControl.type">"type"</link>.
22851 *
22852 * 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.
22853 */
22854 g_object_interface_install_property (iface,
22855 g_param_spec_string ("type", "type", "type", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
22856}
22857
22858/**
22859 * flash_control_get_filename: (skip)
22860 * @object: A #FlashControl.
22861 *
22862 * Gets the value of the <link linkend="gdbus-property-org-openbmc-FlashControl.filename">"filename"</link> D-Bus property.
22863 *
22864 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
22865 *
22866 * <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>
22867 *
22868 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
22869 */
22870const gchar *
22871flash_control_get_filename (FlashControl *object)
22872{
22873 return FLASH_CONTROL_GET_IFACE (object)->get_filename (object);
22874}
22875
22876/**
22877 * flash_control_dup_filename: (skip)
22878 * @object: A #FlashControl.
22879 *
22880 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-FlashControl.filename">"filename"</link> D-Bus property.
22881 *
22882 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
22883 *
22884 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
22885 */
22886gchar *
22887flash_control_dup_filename (FlashControl *object)
22888{
22889 gchar *value;
22890 g_object_get (G_OBJECT (object), "filename", &value, NULL);
22891 return value;
22892}
22893
22894/**
22895 * flash_control_set_filename: (skip)
22896 * @object: A #FlashControl.
22897 * @value: The value to set.
22898 *
22899 * Sets the <link linkend="gdbus-property-org-openbmc-FlashControl.filename">"filename"</link> D-Bus property to @value.
22900 *
22901 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
22902 */
22903void
22904flash_control_set_filename (FlashControl *object, const gchar *value)
22905{
22906 g_object_set (G_OBJECT (object), "filename", value, NULL);
22907}
22908
22909/**
22910 * flash_control_get_type_: (skip)
22911 * @object: A #FlashControl.
22912 *
22913 * Gets the value of the <link linkend="gdbus-property-org-openbmc-FlashControl.type">"type"</link> D-Bus property.
22914 *
22915 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
22916 *
22917 * <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>
22918 *
22919 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
22920 */
22921const gchar *
22922flash_control_get_type_ (FlashControl *object)
22923{
22924 return FLASH_CONTROL_GET_IFACE (object)->get_type_ (object);
22925}
22926
22927/**
22928 * flash_control_dup_type_: (skip)
22929 * @object: A #FlashControl.
22930 *
22931 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-FlashControl.type">"type"</link> D-Bus property.
22932 *
22933 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
22934 *
22935 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
22936 */
22937gchar *
22938flash_control_dup_type_ (FlashControl *object)
22939{
22940 gchar *value;
22941 g_object_get (G_OBJECT (object), "type", &value, NULL);
22942 return value;
22943}
22944
22945/**
22946 * flash_control_set_type_: (skip)
22947 * @object: A #FlashControl.
22948 * @value: The value to set.
22949 *
22950 * Sets the <link linkend="gdbus-property-org-openbmc-FlashControl.type">"type"</link> D-Bus property to @value.
22951 *
22952 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
22953 */
22954void
22955flash_control_set_type_ (FlashControl *object, const gchar *value)
22956{
22957 g_object_set (G_OBJECT (object), "type", value, NULL);
22958}
22959
22960/**
22961 * flash_control_emit_done:
22962 * @object: A #FlashControl.
22963 * @arg_filename: Argument to pass with the signal.
22964 *
22965 * Emits the <link linkend="gdbus-signal-org-openbmc-FlashControl.Done">"Done"</link> D-Bus signal.
22966 */
22967void
22968flash_control_emit_done (
22969 FlashControl *object,
22970 const gchar *arg_filename)
22971{
22972 g_signal_emit_by_name (object, "done", arg_filename);
22973}
22974
22975/**
22976 * flash_control_emit_error:
22977 * @object: A #FlashControl.
22978 * @arg_filename: Argument to pass with the signal.
22979 *
22980 * Emits the <link linkend="gdbus-signal-org-openbmc-FlashControl.Error">"Error"</link> D-Bus signal.
22981 */
22982void
22983flash_control_emit_error (
22984 FlashControl *object,
22985 const gchar *arg_filename)
22986{
22987 g_signal_emit_by_name (object, "error", arg_filename);
22988}
22989
22990/**
22991 * flash_control_emit_progress:
22992 * @object: A #FlashControl.
22993 * @arg_filename: Argument to pass with the signal.
22994 * @arg_progress: Argument to pass with the signal.
22995 *
22996 * Emits the <link linkend="gdbus-signal-org-openbmc-FlashControl.Progress">"Progress"</link> D-Bus signal.
22997 */
22998void
22999flash_control_emit_progress (
23000 FlashControl *object,
23001 const gchar *arg_filename,
23002 guchar arg_progress)
23003{
23004 g_signal_emit_by_name (object, "progress", arg_filename, arg_progress);
23005}
23006
23007/**
23008 * flash_control_call_flash:
23009 * @proxy: A #FlashControlProxy.
23010 * @arg_type: Argument to pass with the method invocation.
23011 * @arg_filename: Argument to pass with the method invocation.
23012 * @cancellable: (allow-none): A #GCancellable or %NULL.
23013 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
23014 * @user_data: User data to pass to @callback.
23015 *
23016 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-FlashControl.flash">flash()</link> D-Bus method on @proxy.
23017 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
23018 * You can then call flash_control_call_flash_finish() to get the result of the operation.
23019 *
23020 * See flash_control_call_flash_sync() for the synchronous, blocking version of this method.
23021 */
23022void
23023flash_control_call_flash (
23024 FlashControl *proxy,
23025 const gchar *arg_type,
23026 const gchar *arg_filename,
23027 GCancellable *cancellable,
23028 GAsyncReadyCallback callback,
23029 gpointer user_data)
23030{
23031 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
23032 "flash",
23033 g_variant_new ("(ss)",
23034 arg_type,
23035 arg_filename),
23036 G_DBUS_CALL_FLAGS_NONE,
23037 -1,
23038 cancellable,
23039 callback,
23040 user_data);
23041}
23042
23043/**
23044 * flash_control_call_flash_finish:
23045 * @proxy: A #FlashControlProxy.
23046 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_control_call_flash().
23047 * @error: Return location for error or %NULL.
23048 *
23049 * Finishes an operation started with flash_control_call_flash().
23050 *
23051 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
23052 */
23053gboolean
23054flash_control_call_flash_finish (
23055 FlashControl *proxy,
23056 GAsyncResult *res,
23057 GError **error)
23058{
23059 GVariant *_ret;
23060 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
23061 if (_ret == NULL)
23062 goto _out;
23063 g_variant_get (_ret,
23064 "()");
23065 g_variant_unref (_ret);
23066_out:
23067 return _ret != NULL;
23068}
23069
23070/**
23071 * flash_control_call_flash_sync:
23072 * @proxy: A #FlashControlProxy.
23073 * @arg_type: Argument to pass with the method invocation.
23074 * @arg_filename: Argument to pass with the method invocation.
23075 * @cancellable: (allow-none): A #GCancellable or %NULL.
23076 * @error: Return location for error or %NULL.
23077 *
23078 * 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.
23079 *
23080 * See flash_control_call_flash() for the asynchronous version of this method.
23081 *
23082 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
23083 */
23084gboolean
23085flash_control_call_flash_sync (
23086 FlashControl *proxy,
23087 const gchar *arg_type,
23088 const gchar *arg_filename,
23089 GCancellable *cancellable,
23090 GError **error)
23091{
23092 GVariant *_ret;
23093 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
23094 "flash",
23095 g_variant_new ("(ss)",
23096 arg_type,
23097 arg_filename),
23098 G_DBUS_CALL_FLAGS_NONE,
23099 -1,
23100 cancellable,
23101 error);
23102 if (_ret == NULL)
23103 goto _out;
23104 g_variant_get (_ret,
23105 "()");
23106 g_variant_unref (_ret);
23107_out:
23108 return _ret != NULL;
23109}
23110
23111/**
23112 * flash_control_complete_flash:
23113 * @object: A #FlashControl.
23114 * @invocation: (transfer full): A #GDBusMethodInvocation.
23115 *
23116 * 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.
23117 *
23118 * This method will free @invocation, you cannot use it afterwards.
23119 */
23120void
23121flash_control_complete_flash (
23122 FlashControl *object,
23123 GDBusMethodInvocation *invocation)
23124{
23125 g_dbus_method_invocation_return_value (invocation,
23126 g_variant_new ("()"));
23127}
23128
23129/* ------------------------------------------------------------------------ */
23130
23131/**
23132 * FlashControlProxy:
23133 *
23134 * The #FlashControlProxy structure contains only private data and should only be accessed using the provided API.
23135 */
23136
23137/**
23138 * FlashControlProxyClass:
23139 * @parent_class: The parent class.
23140 *
23141 * Class structure for #FlashControlProxy.
23142 */
23143
23144struct _FlashControlProxyPrivate
23145{
23146 GData *qdata;
23147};
23148
23149static void flash_control_proxy_iface_init (FlashControlIface *iface);
23150
23151#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
23152G_DEFINE_TYPE_WITH_CODE (FlashControlProxy, flash_control_proxy, G_TYPE_DBUS_PROXY,
23153 G_ADD_PRIVATE (FlashControlProxy)
23154 G_IMPLEMENT_INTERFACE (TYPE_FLASH_CONTROL, flash_control_proxy_iface_init));
23155
23156#else
23157G_DEFINE_TYPE_WITH_CODE (FlashControlProxy, flash_control_proxy, G_TYPE_DBUS_PROXY,
23158 G_IMPLEMENT_INTERFACE (TYPE_FLASH_CONTROL, flash_control_proxy_iface_init));
23159
23160#endif
23161static void
23162flash_control_proxy_finalize (GObject *object)
23163{
23164 FlashControlProxy *proxy = FLASH_CONTROL_PROXY (object);
23165 g_datalist_clear (&proxy->priv->qdata);
23166 G_OBJECT_CLASS (flash_control_proxy_parent_class)->finalize (object);
23167}
23168
23169static void
23170flash_control_proxy_get_property (GObject *object,
23171 guint prop_id,
23172 GValue *value,
23173 GParamSpec *pspec G_GNUC_UNUSED)
23174{
23175 const _ExtendedGDBusPropertyInfo *info;
23176 GVariant *variant;
23177 g_assert (prop_id != 0 && prop_id - 1 < 2);
23178 info = _flash_control_property_info_pointers[prop_id - 1];
23179 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
23180 if (info->use_gvariant)
23181 {
23182 g_value_set_variant (value, variant);
23183 }
23184 else
23185 {
23186 if (variant != NULL)
23187 g_dbus_gvariant_to_gvalue (variant, value);
23188 }
23189 if (variant != NULL)
23190 g_variant_unref (variant);
23191}
23192
23193static void
23194flash_control_proxy_set_property_cb (GDBusProxy *proxy,
23195 GAsyncResult *res,
23196 gpointer user_data)
23197{
23198 const _ExtendedGDBusPropertyInfo *info = user_data;
23199 GError *error;
23200 GVariant *_ret;
23201 error = NULL;
23202 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
23203 if (!_ret)
23204 {
23205 g_warning ("Error setting property '%s' on interface org.openbmc.FlashControl: %s (%s, %d)",
23206 info->parent_struct.name,
23207 error->message, g_quark_to_string (error->domain), error->code);
23208 g_error_free (error);
23209 }
23210 else
23211 {
23212 g_variant_unref (_ret);
23213 }
23214}
23215
23216static void
23217flash_control_proxy_set_property (GObject *object,
23218 guint prop_id,
23219 const GValue *value,
23220 GParamSpec *pspec G_GNUC_UNUSED)
23221{
23222 const _ExtendedGDBusPropertyInfo *info;
23223 GVariant *variant;
23224 g_assert (prop_id != 0 && prop_id - 1 < 2);
23225 info = _flash_control_property_info_pointers[prop_id - 1];
23226 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
23227 g_dbus_proxy_call (G_DBUS_PROXY (object),
23228 "org.freedesktop.DBus.Properties.Set",
23229 g_variant_new ("(ssv)", "org.openbmc.FlashControl", info->parent_struct.name, variant),
23230 G_DBUS_CALL_FLAGS_NONE,
23231 -1,
23232 NULL, (GAsyncReadyCallback) flash_control_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
23233 g_variant_unref (variant);
23234}
23235
23236static void
23237flash_control_proxy_g_signal (GDBusProxy *proxy,
23238 const gchar *sender_name G_GNUC_UNUSED,
23239 const gchar *signal_name,
23240 GVariant *parameters)
23241{
23242 _ExtendedGDBusSignalInfo *info;
23243 GVariantIter iter;
23244 GVariant *child;
23245 GValue *paramv;
23246 guint num_params;
23247 guint n;
23248 guint signal_id;
23249 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct, signal_name);
23250 if (info == NULL)
23251 return;
23252 num_params = g_variant_n_children (parameters);
23253 paramv = g_new0 (GValue, num_params + 1);
23254 g_value_init (&paramv[0], TYPE_FLASH_CONTROL);
23255 g_value_set_object (&paramv[0], proxy);
23256 g_variant_iter_init (&iter, parameters);
23257 n = 1;
23258 while ((child = g_variant_iter_next_value (&iter)) != NULL)
23259 {
23260 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
23261 if (arg_info->use_gvariant)
23262 {
23263 g_value_init (&paramv[n], G_TYPE_VARIANT);
23264 g_value_set_variant (&paramv[n], child);
23265 n++;
23266 }
23267 else
23268 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
23269 g_variant_unref (child);
23270 }
23271 signal_id = g_signal_lookup (info->signal_name, TYPE_FLASH_CONTROL);
23272 g_signal_emitv (paramv, signal_id, 0, NULL);
23273 for (n = 0; n < num_params + 1; n++)
23274 g_value_unset (&paramv[n]);
23275 g_free (paramv);
23276}
23277
23278static void
23279flash_control_proxy_g_properties_changed (GDBusProxy *_proxy,
23280 GVariant *changed_properties,
23281 const gchar *const *invalidated_properties)
23282{
23283 FlashControlProxy *proxy = FLASH_CONTROL_PROXY (_proxy);
23284 guint n;
23285 const gchar *key;
23286 GVariantIter *iter;
23287 _ExtendedGDBusPropertyInfo *info;
23288 g_variant_get (changed_properties, "a{sv}", &iter);
23289 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
23290 {
23291 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct, key);
23292 g_datalist_remove_data (&proxy->priv->qdata, key);
23293 if (info != NULL)
23294 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
23295 }
23296 g_variant_iter_free (iter);
23297 for (n = 0; invalidated_properties[n] != NULL; n++)
23298 {
23299 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct, invalidated_properties[n]);
23300 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
23301 if (info != NULL)
23302 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
23303 }
23304}
23305
23306static const gchar *
23307flash_control_proxy_get_filename (FlashControl *object)
23308{
23309 FlashControlProxy *proxy = FLASH_CONTROL_PROXY (object);
23310 GVariant *variant;
23311 const gchar *value = NULL;
23312 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "filename");
23313 if (variant != NULL)
23314 {
23315 value = g_variant_get_string (variant, NULL);
23316 g_variant_unref (variant);
23317 }
23318 return value;
23319}
23320
23321static const gchar *
23322flash_control_proxy_get_type_ (FlashControl *object)
23323{
23324 FlashControlProxy *proxy = FLASH_CONTROL_PROXY (object);
23325 GVariant *variant;
23326 const gchar *value = NULL;
23327 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "type");
23328 if (variant != NULL)
23329 {
23330 value = g_variant_get_string (variant, NULL);
23331 g_variant_unref (variant);
23332 }
23333 return value;
23334}
23335
23336static void
23337flash_control_proxy_init (FlashControlProxy *proxy)
23338{
23339#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
23340 proxy->priv = flash_control_proxy_get_instance_private (proxy);
23341#else
23342 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_FLASH_CONTROL_PROXY, FlashControlProxyPrivate);
23343#endif
23344
23345 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), flash_control_interface_info ());
23346}
23347
23348static void
23349flash_control_proxy_class_init (FlashControlProxyClass *klass)
23350{
23351 GObjectClass *gobject_class;
23352 GDBusProxyClass *proxy_class;
23353
23354 gobject_class = G_OBJECT_CLASS (klass);
23355 gobject_class->finalize = flash_control_proxy_finalize;
23356 gobject_class->get_property = flash_control_proxy_get_property;
23357 gobject_class->set_property = flash_control_proxy_set_property;
23358
23359 proxy_class = G_DBUS_PROXY_CLASS (klass);
23360 proxy_class->g_signal = flash_control_proxy_g_signal;
23361 proxy_class->g_properties_changed = flash_control_proxy_g_properties_changed;
23362
23363 flash_control_override_properties (gobject_class, 1);
23364
23365#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
23366 g_type_class_add_private (klass, sizeof (FlashControlProxyPrivate));
23367#endif
23368}
23369
23370static void
23371flash_control_proxy_iface_init (FlashControlIface *iface)
23372{
23373 iface->get_filename = flash_control_proxy_get_filename;
23374 iface->get_type_ = flash_control_proxy_get_type_;
23375}
23376
23377/**
23378 * flash_control_proxy_new:
23379 * @connection: A #GDBusConnection.
23380 * @flags: Flags from the #GDBusProxyFlags enumeration.
23381 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
23382 * @object_path: An object path.
23383 * @cancellable: (allow-none): A #GCancellable or %NULL.
23384 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
23385 * @user_data: User data to pass to @callback.
23386 *
23387 * 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.
23388 *
23389 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
23390 * You can then call flash_control_proxy_new_finish() to get the result of the operation.
23391 *
23392 * See flash_control_proxy_new_sync() for the synchronous, blocking version of this constructor.
23393 */
23394void
23395flash_control_proxy_new (
23396 GDBusConnection *connection,
23397 GDBusProxyFlags flags,
23398 const gchar *name,
23399 const gchar *object_path,
23400 GCancellable *cancellable,
23401 GAsyncReadyCallback callback,
23402 gpointer user_data)
23403{
23404 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);
23405}
23406
23407/**
23408 * flash_control_proxy_new_finish:
23409 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_control_proxy_new().
23410 * @error: Return location for error or %NULL
23411 *
23412 * Finishes an operation started with flash_control_proxy_new().
23413 *
23414 * Returns: (transfer full) (type FlashControlProxy): The constructed proxy object or %NULL if @error is set.
23415 */
23416FlashControl *
23417flash_control_proxy_new_finish (
23418 GAsyncResult *res,
23419 GError **error)
23420{
23421 GObject *ret;
23422 GObject *source_object;
23423 source_object = g_async_result_get_source_object (res);
23424 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
23425 g_object_unref (source_object);
23426 if (ret != NULL)
23427 return FLASH_CONTROL (ret);
23428 else
23429 return NULL;
23430}
23431
23432/**
23433 * flash_control_proxy_new_sync:
23434 * @connection: A #GDBusConnection.
23435 * @flags: Flags from the #GDBusProxyFlags enumeration.
23436 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
23437 * @object_path: An object path.
23438 * @cancellable: (allow-none): A #GCancellable or %NULL.
23439 * @error: Return location for error or %NULL
23440 *
23441 * 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.
23442 *
23443 * The calling thread is blocked until a reply is received.
23444 *
23445 * See flash_control_proxy_new() for the asynchronous version of this constructor.
23446 *
23447 * Returns: (transfer full) (type FlashControlProxy): The constructed proxy object or %NULL if @error is set.
23448 */
23449FlashControl *
23450flash_control_proxy_new_sync (
23451 GDBusConnection *connection,
23452 GDBusProxyFlags flags,
23453 const gchar *name,
23454 const gchar *object_path,
23455 GCancellable *cancellable,
23456 GError **error)
23457{
23458 GInitable *ret;
23459 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);
23460 if (ret != NULL)
23461 return FLASH_CONTROL (ret);
23462 else
23463 return NULL;
23464}
23465
23466
23467/**
23468 * flash_control_proxy_new_for_bus:
23469 * @bus_type: A #GBusType.
23470 * @flags: Flags from the #GDBusProxyFlags enumeration.
23471 * @name: A bus name (well-known or unique).
23472 * @object_path: An object path.
23473 * @cancellable: (allow-none): A #GCancellable or %NULL.
23474 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
23475 * @user_data: User data to pass to @callback.
23476 *
23477 * Like flash_control_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
23478 *
23479 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
23480 * You can then call flash_control_proxy_new_for_bus_finish() to get the result of the operation.
23481 *
23482 * See flash_control_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
23483 */
23484void
23485flash_control_proxy_new_for_bus (
23486 GBusType bus_type,
23487 GDBusProxyFlags flags,
23488 const gchar *name,
23489 const gchar *object_path,
23490 GCancellable *cancellable,
23491 GAsyncReadyCallback callback,
23492 gpointer user_data)
23493{
23494 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);
23495}
23496
23497/**
23498 * flash_control_proxy_new_for_bus_finish:
23499 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to flash_control_proxy_new_for_bus().
23500 * @error: Return location for error or %NULL
23501 *
23502 * Finishes an operation started with flash_control_proxy_new_for_bus().
23503 *
23504 * Returns: (transfer full) (type FlashControlProxy): The constructed proxy object or %NULL if @error is set.
23505 */
23506FlashControl *
23507flash_control_proxy_new_for_bus_finish (
23508 GAsyncResult *res,
23509 GError **error)
23510{
23511 GObject *ret;
23512 GObject *source_object;
23513 source_object = g_async_result_get_source_object (res);
23514 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
23515 g_object_unref (source_object);
23516 if (ret != NULL)
23517 return FLASH_CONTROL (ret);
23518 else
23519 return NULL;
23520}
23521
23522/**
23523 * flash_control_proxy_new_for_bus_sync:
23524 * @bus_type: A #GBusType.
23525 * @flags: Flags from the #GDBusProxyFlags enumeration.
23526 * @name: A bus name (well-known or unique).
23527 * @object_path: An object path.
23528 * @cancellable: (allow-none): A #GCancellable or %NULL.
23529 * @error: Return location for error or %NULL
23530 *
23531 * Like flash_control_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
23532 *
23533 * The calling thread is blocked until a reply is received.
23534 *
23535 * See flash_control_proxy_new_for_bus() for the asynchronous version of this constructor.
23536 *
23537 * Returns: (transfer full) (type FlashControlProxy): The constructed proxy object or %NULL if @error is set.
23538 */
23539FlashControl *
23540flash_control_proxy_new_for_bus_sync (
23541 GBusType bus_type,
23542 GDBusProxyFlags flags,
23543 const gchar *name,
23544 const gchar *object_path,
23545 GCancellable *cancellable,
23546 GError **error)
23547{
23548 GInitable *ret;
23549 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);
23550 if (ret != NULL)
23551 return FLASH_CONTROL (ret);
23552 else
23553 return NULL;
23554}
23555
23556
23557/* ------------------------------------------------------------------------ */
23558
23559/**
23560 * FlashControlSkeleton:
23561 *
23562 * The #FlashControlSkeleton structure contains only private data and should only be accessed using the provided API.
23563 */
23564
23565/**
23566 * FlashControlSkeletonClass:
23567 * @parent_class: The parent class.
23568 *
23569 * Class structure for #FlashControlSkeleton.
23570 */
23571
23572struct _FlashControlSkeletonPrivate
23573{
23574 GValue *properties;
23575 GList *changed_properties;
23576 GSource *changed_properties_idle_source;
23577 GMainContext *context;
23578 GMutex lock;
23579};
23580
23581static void
23582_flash_control_skeleton_handle_method_call (
23583 GDBusConnection *connection G_GNUC_UNUSED,
23584 const gchar *sender G_GNUC_UNUSED,
23585 const gchar *object_path G_GNUC_UNUSED,
23586 const gchar *interface_name,
23587 const gchar *method_name,
23588 GVariant *parameters,
23589 GDBusMethodInvocation *invocation,
23590 gpointer user_data)
23591{
23592 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (user_data);
23593 _ExtendedGDBusMethodInfo *info;
23594 GVariantIter iter;
23595 GVariant *child;
23596 GValue *paramv;
23597 guint num_params;
23598 guint num_extra;
23599 guint n;
23600 guint signal_id;
23601 GValue return_value = G_VALUE_INIT;
23602 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
23603 g_assert (info != NULL);
23604 num_params = g_variant_n_children (parameters);
23605 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
23606 n = 0;
23607 g_value_init (&paramv[n], TYPE_FLASH_CONTROL);
23608 g_value_set_object (&paramv[n++], skeleton);
23609 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
23610 g_value_set_object (&paramv[n++], invocation);
23611 if (info->pass_fdlist)
23612 {
23613#ifdef G_OS_UNIX
23614 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
23615 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
23616#else
23617 g_assert_not_reached ();
23618#endif
23619 }
23620 g_variant_iter_init (&iter, parameters);
23621 while ((child = g_variant_iter_next_value (&iter)) != NULL)
23622 {
23623 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
23624 if (arg_info->use_gvariant)
23625 {
23626 g_value_init (&paramv[n], G_TYPE_VARIANT);
23627 g_value_set_variant (&paramv[n], child);
23628 n++;
23629 }
23630 else
23631 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
23632 g_variant_unref (child);
23633 }
23634 signal_id = g_signal_lookup (info->signal_name, TYPE_FLASH_CONTROL);
23635 g_value_init (&return_value, G_TYPE_BOOLEAN);
23636 g_signal_emitv (paramv, signal_id, 0, &return_value);
23637 if (!g_value_get_boolean (&return_value))
23638 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);
23639 g_value_unset (&return_value);
23640 for (n = 0; n < num_params + num_extra; n++)
23641 g_value_unset (&paramv[n]);
23642 g_free (paramv);
23643}
23644
23645static GVariant *
23646_flash_control_skeleton_handle_get_property (
23647 GDBusConnection *connection G_GNUC_UNUSED,
23648 const gchar *sender G_GNUC_UNUSED,
23649 const gchar *object_path G_GNUC_UNUSED,
23650 const gchar *interface_name G_GNUC_UNUSED,
23651 const gchar *property_name,
23652 GError **error,
23653 gpointer user_data)
23654{
23655 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (user_data);
23656 GValue value = G_VALUE_INIT;
23657 GParamSpec *pspec;
23658 _ExtendedGDBusPropertyInfo *info;
23659 GVariant *ret;
23660 ret = NULL;
23661 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct, property_name);
23662 g_assert (info != NULL);
23663 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
23664 if (pspec == NULL)
23665 {
23666 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
23667 }
23668 else
23669 {
23670 g_value_init (&value, pspec->value_type);
23671 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
23672 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
23673 g_value_unset (&value);
23674 }
23675 return ret;
23676}
23677
23678static gboolean
23679_flash_control_skeleton_handle_set_property (
23680 GDBusConnection *connection G_GNUC_UNUSED,
23681 const gchar *sender G_GNUC_UNUSED,
23682 const gchar *object_path G_GNUC_UNUSED,
23683 const gchar *interface_name G_GNUC_UNUSED,
23684 const gchar *property_name,
23685 GVariant *variant,
23686 GError **error,
23687 gpointer user_data)
23688{
23689 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (user_data);
23690 GValue value = G_VALUE_INIT;
23691 GParamSpec *pspec;
23692 _ExtendedGDBusPropertyInfo *info;
23693 gboolean ret;
23694 ret = FALSE;
23695 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_flash_control_interface_info.parent_struct, property_name);
23696 g_assert (info != NULL);
23697 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
23698 if (pspec == NULL)
23699 {
23700 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
23701 }
23702 else
23703 {
23704 if (info->use_gvariant)
23705 g_value_set_variant (&value, variant);
23706 else
23707 g_dbus_gvariant_to_gvalue (variant, &value);
23708 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
23709 g_value_unset (&value);
23710 ret = TRUE;
23711 }
23712 return ret;
23713}
23714
23715static const GDBusInterfaceVTable _flash_control_skeleton_vtable =
23716{
23717 _flash_control_skeleton_handle_method_call,
23718 _flash_control_skeleton_handle_get_property,
23719 _flash_control_skeleton_handle_set_property,
23720 {NULL}
23721};
23722
23723static GDBusInterfaceInfo *
23724flash_control_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
23725{
23726 return flash_control_interface_info ();
23727}
23728
23729static GDBusInterfaceVTable *
23730flash_control_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
23731{
23732 return (GDBusInterfaceVTable *) &_flash_control_skeleton_vtable;
23733}
23734
23735static GVariant *
23736flash_control_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
23737{
23738 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (_skeleton);
23739
23740 GVariantBuilder builder;
23741 guint n;
23742 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
23743 if (_flash_control_interface_info.parent_struct.properties == NULL)
23744 goto out;
23745 for (n = 0; _flash_control_interface_info.parent_struct.properties[n] != NULL; n++)
23746 {
23747 GDBusPropertyInfo *info = _flash_control_interface_info.parent_struct.properties[n];
23748 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
23749 {
23750 GVariant *value;
23751 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);
23752 if (value != NULL)
23753 {
23754 g_variant_take_ref (value);
23755 g_variant_builder_add (&builder, "{sv}", info->name, value);
23756 g_variant_unref (value);
23757 }
23758 }
23759 }
23760out:
23761 return g_variant_builder_end (&builder);
23762}
23763
23764static gboolean _flash_control_emit_changed (gpointer user_data);
23765
23766static void
23767flash_control_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
23768{
23769 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (_skeleton);
23770 gboolean emit_changed = FALSE;
23771
23772 g_mutex_lock (&skeleton->priv->lock);
23773 if (skeleton->priv->changed_properties_idle_source != NULL)
23774 {
23775 g_source_destroy (skeleton->priv->changed_properties_idle_source);
23776 skeleton->priv->changed_properties_idle_source = NULL;
23777 emit_changed = TRUE;
23778 }
23779 g_mutex_unlock (&skeleton->priv->lock);
23780
23781 if (emit_changed)
23782 _flash_control_emit_changed (skeleton);
23783}
23784
23785static void
23786_flash_control_on_signal_done (
23787 FlashControl *object,
23788 const gchar *arg_filename)
23789{
23790 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
23791
23792 GList *connections, *l;
23793 GVariant *signal_variant;
23794 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
23795
23796 signal_variant = g_variant_ref_sink (g_variant_new ("(s)",
23797 arg_filename));
23798 for (l = connections; l != NULL; l = l->next)
23799 {
23800 GDBusConnection *connection = l->data;
23801 g_dbus_connection_emit_signal (connection,
23802 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.FlashControl", "Done",
23803 signal_variant, NULL);
23804 }
23805 g_variant_unref (signal_variant);
23806 g_list_free_full (connections, g_object_unref);
23807}
23808
23809static void
23810_flash_control_on_signal_error (
23811 FlashControl *object,
23812 const gchar *arg_filename)
23813{
23814 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
23815
23816 GList *connections, *l;
23817 GVariant *signal_variant;
23818 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
23819
23820 signal_variant = g_variant_ref_sink (g_variant_new ("(s)",
23821 arg_filename));
23822 for (l = connections; l != NULL; l = l->next)
23823 {
23824 GDBusConnection *connection = l->data;
23825 g_dbus_connection_emit_signal (connection,
23826 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.FlashControl", "Error",
23827 signal_variant, NULL);
23828 }
23829 g_variant_unref (signal_variant);
23830 g_list_free_full (connections, g_object_unref);
23831}
23832
23833static void
23834_flash_control_on_signal_progress (
23835 FlashControl *object,
23836 const gchar *arg_filename,
23837 guchar arg_progress)
23838{
23839 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
23840
23841 GList *connections, *l;
23842 GVariant *signal_variant;
23843 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
23844
23845 signal_variant = g_variant_ref_sink (g_variant_new ("(sy)",
23846 arg_filename,
23847 arg_progress));
23848 for (l = connections; l != NULL; l = l->next)
23849 {
23850 GDBusConnection *connection = l->data;
23851 g_dbus_connection_emit_signal (connection,
23852 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.FlashControl", "Progress",
23853 signal_variant, NULL);
23854 }
23855 g_variant_unref (signal_variant);
23856 g_list_free_full (connections, g_object_unref);
23857}
23858
23859static void flash_control_skeleton_iface_init (FlashControlIface *iface);
23860#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
23861G_DEFINE_TYPE_WITH_CODE (FlashControlSkeleton, flash_control_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
23862 G_ADD_PRIVATE (FlashControlSkeleton)
23863 G_IMPLEMENT_INTERFACE (TYPE_FLASH_CONTROL, flash_control_skeleton_iface_init));
23864
23865#else
23866G_DEFINE_TYPE_WITH_CODE (FlashControlSkeleton, flash_control_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
23867 G_IMPLEMENT_INTERFACE (TYPE_FLASH_CONTROL, flash_control_skeleton_iface_init));
23868
23869#endif
23870static void
23871flash_control_skeleton_finalize (GObject *object)
23872{
23873 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
23874 guint n;
23875 for (n = 0; n < 2; n++)
23876 g_value_unset (&skeleton->priv->properties[n]);
23877 g_free (skeleton->priv->properties);
23878 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
23879 if (skeleton->priv->changed_properties_idle_source != NULL)
23880 g_source_destroy (skeleton->priv->changed_properties_idle_source);
23881 g_main_context_unref (skeleton->priv->context);
23882 g_mutex_clear (&skeleton->priv->lock);
23883 G_OBJECT_CLASS (flash_control_skeleton_parent_class)->finalize (object);
23884}
23885
23886static void
23887flash_control_skeleton_get_property (GObject *object,
23888 guint prop_id,
23889 GValue *value,
23890 GParamSpec *pspec G_GNUC_UNUSED)
23891{
23892 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
23893 g_assert (prop_id != 0 && prop_id - 1 < 2);
23894 g_mutex_lock (&skeleton->priv->lock);
23895 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
23896 g_mutex_unlock (&skeleton->priv->lock);
23897}
23898
23899static gboolean
23900_flash_control_emit_changed (gpointer user_data)
23901{
23902 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (user_data);
23903 GList *l;
23904 GVariantBuilder builder;
23905 GVariantBuilder invalidated_builder;
23906 guint num_changes;
23907
23908 g_mutex_lock (&skeleton->priv->lock);
23909 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
23910 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
23911 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
23912 {
23913 ChangedProperty *cp = l->data;
23914 GVariant *variant;
23915 const GValue *cur_value;
23916
23917 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
23918 if (!_g_value_equal (cur_value, &cp->orig_value))
23919 {
23920 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
23921 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
23922 g_variant_unref (variant);
23923 num_changes++;
23924 }
23925 }
23926 if (num_changes > 0)
23927 {
23928 GList *connections, *ll;
23929 GVariant *signal_variant;
23930 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.FlashControl",
23931 &builder, &invalidated_builder));
23932 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
23933 for (ll = connections; ll != NULL; ll = ll->next)
23934 {
23935 GDBusConnection *connection = ll->data;
23936
23937 g_dbus_connection_emit_signal (connection,
23938 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
23939 "org.freedesktop.DBus.Properties",
23940 "PropertiesChanged",
23941 signal_variant,
23942 NULL);
23943 }
23944 g_variant_unref (signal_variant);
23945 g_list_free_full (connections, g_object_unref);
23946 }
23947 else
23948 {
23949 g_variant_builder_clear (&builder);
23950 g_variant_builder_clear (&invalidated_builder);
23951 }
23952 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
23953 skeleton->priv->changed_properties = NULL;
23954 skeleton->priv->changed_properties_idle_source = NULL;
23955 g_mutex_unlock (&skeleton->priv->lock);
23956 return FALSE;
23957}
23958
23959static void
23960_flash_control_schedule_emit_changed (FlashControlSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
23961{
23962 ChangedProperty *cp;
23963 GList *l;
23964 cp = NULL;
23965 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
23966 {
23967 ChangedProperty *i_cp = l->data;
23968 if (i_cp->info == info)
23969 {
23970 cp = i_cp;
23971 break;
23972 }
23973 }
23974 if (cp == NULL)
23975 {
23976 cp = g_new0 (ChangedProperty, 1);
23977 cp->prop_id = prop_id;
23978 cp->info = info;
23979 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
23980 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
23981 g_value_copy (orig_value, &cp->orig_value);
23982 }
23983}
23984
23985static void
23986flash_control_skeleton_notify (GObject *object,
23987 GParamSpec *pspec G_GNUC_UNUSED)
23988{
23989 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
23990 g_mutex_lock (&skeleton->priv->lock);
23991 if (skeleton->priv->changed_properties != NULL &&
23992 skeleton->priv->changed_properties_idle_source == NULL)
23993 {
23994 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
23995 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
23996 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _flash_control_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
Adriana Kobylak2cb27752015-10-19 16:23:14 -050023997 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _flash_control_emit_changed");
Norman James18998182015-10-11 21:54:53 -050023998 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
23999 g_source_unref (skeleton->priv->changed_properties_idle_source);
24000 }
24001 g_mutex_unlock (&skeleton->priv->lock);
24002}
24003
24004static void
24005flash_control_skeleton_set_property (GObject *object,
24006 guint prop_id,
24007 const GValue *value,
24008 GParamSpec *pspec)
24009{
24010 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
24011 g_assert (prop_id != 0 && prop_id - 1 < 2);
24012 g_mutex_lock (&skeleton->priv->lock);
24013 g_object_freeze_notify (object);
24014 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
24015 {
24016 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
24017 _flash_control_schedule_emit_changed (skeleton, _flash_control_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
24018 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
24019 g_object_notify_by_pspec (object, pspec);
24020 }
24021 g_mutex_unlock (&skeleton->priv->lock);
24022 g_object_thaw_notify (object);
24023}
24024
24025static void
24026flash_control_skeleton_init (FlashControlSkeleton *skeleton)
24027{
24028#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
24029 skeleton->priv = flash_control_skeleton_get_instance_private (skeleton);
24030#else
24031 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_FLASH_CONTROL_SKELETON, FlashControlSkeletonPrivate);
24032#endif
24033
24034 g_mutex_init (&skeleton->priv->lock);
24035 skeleton->priv->context = g_main_context_ref_thread_default ();
24036 skeleton->priv->properties = g_new0 (GValue, 2);
24037 g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING);
24038 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
24039}
24040
24041static const gchar *
24042flash_control_skeleton_get_filename (FlashControl *object)
24043{
24044 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
24045 const gchar *value;
24046 g_mutex_lock (&skeleton->priv->lock);
24047 value = g_value_get_string (&(skeleton->priv->properties[0]));
24048 g_mutex_unlock (&skeleton->priv->lock);
24049 return value;
24050}
24051
24052static const gchar *
24053flash_control_skeleton_get_type_ (FlashControl *object)
24054{
24055 FlashControlSkeleton *skeleton = FLASH_CONTROL_SKELETON (object);
24056 const gchar *value;
24057 g_mutex_lock (&skeleton->priv->lock);
24058 value = g_value_get_string (&(skeleton->priv->properties[1]));
24059 g_mutex_unlock (&skeleton->priv->lock);
24060 return value;
24061}
24062
24063static void
24064flash_control_skeleton_class_init (FlashControlSkeletonClass *klass)
24065{
24066 GObjectClass *gobject_class;
24067 GDBusInterfaceSkeletonClass *skeleton_class;
24068
24069 gobject_class = G_OBJECT_CLASS (klass);
24070 gobject_class->finalize = flash_control_skeleton_finalize;
24071 gobject_class->get_property = flash_control_skeleton_get_property;
24072 gobject_class->set_property = flash_control_skeleton_set_property;
24073 gobject_class->notify = flash_control_skeleton_notify;
24074
24075
24076 flash_control_override_properties (gobject_class, 1);
24077
24078 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
24079 skeleton_class->get_info = flash_control_skeleton_dbus_interface_get_info;
24080 skeleton_class->get_properties = flash_control_skeleton_dbus_interface_get_properties;
24081 skeleton_class->flush = flash_control_skeleton_dbus_interface_flush;
24082 skeleton_class->get_vtable = flash_control_skeleton_dbus_interface_get_vtable;
24083
24084#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
24085 g_type_class_add_private (klass, sizeof (FlashControlSkeletonPrivate));
24086#endif
24087}
24088
24089static void
24090flash_control_skeleton_iface_init (FlashControlIface *iface)
24091{
24092 iface->done = _flash_control_on_signal_done;
24093 iface->error = _flash_control_on_signal_error;
24094 iface->progress = _flash_control_on_signal_progress;
24095 iface->get_filename = flash_control_skeleton_get_filename;
24096 iface->get_type_ = flash_control_skeleton_get_type_;
24097}
24098
24099/**
24100 * flash_control_skeleton_new:
24101 *
24102 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-FlashControl.top_of_page">org.openbmc.FlashControl</link>.
24103 *
24104 * Returns: (transfer full) (type FlashControlSkeleton): The skeleton object.
24105 */
24106FlashControl *
24107flash_control_skeleton_new (void)
24108{
24109 return FLASH_CONTROL (g_object_new (TYPE_FLASH_CONTROL_SKELETON, NULL));
24110}
24111
24112/* ------------------------------------------------------------------------
Norman James362a80f2015-09-14 14:04:39 -050024113 * Code for interface org.openbmc.Button
24114 * ------------------------------------------------------------------------
24115 */
24116
24117/**
24118 * SECTION:Button
24119 * @title: Button
24120 * @short_description: Generated C code for the org.openbmc.Button D-Bus interface
24121 *
24122 * 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.
24123 */
24124
24125/* ---- Introspection data for org.openbmc.Button ---- */
24126
24127static const _ExtendedGDBusArgInfo _button_method_info_is_on_OUT_ARG_state =
24128{
24129 {
24130 -1,
24131 (gchar *) "state",
24132 (gchar *) "b",
24133 NULL
24134 },
24135 FALSE
24136};
24137
24138static const _ExtendedGDBusArgInfo * const _button_method_info_is_on_OUT_ARG_pointers[] =
24139{
24140 &_button_method_info_is_on_OUT_ARG_state,
24141 NULL
24142};
24143
24144static const _ExtendedGDBusMethodInfo _button_method_info_is_on =
24145{
24146 {
24147 -1,
24148 (gchar *) "isOn",
24149 NULL,
24150 (GDBusArgInfo **) &_button_method_info_is_on_OUT_ARG_pointers,
24151 NULL
24152 },
24153 "handle-is-on",
24154 FALSE
24155};
24156
24157static const _ExtendedGDBusMethodInfo _button_method_info_sim_button_press =
24158{
24159 {
24160 -1,
24161 (gchar *) "simButtonPress",
24162 NULL,
24163 NULL,
24164 NULL
24165 },
24166 "handle-sim-button-press",
24167 FALSE
24168};
24169
24170static const _ExtendedGDBusMethodInfo _button_method_info_sim_button_long_press =
24171{
24172 {
24173 -1,
24174 (gchar *) "simButtonLongPress",
24175 NULL,
24176 NULL,
24177 NULL
24178 },
24179 "handle-sim-button-long-press",
24180 FALSE
24181};
24182
24183static const _ExtendedGDBusMethodInfo * const _button_method_info_pointers[] =
24184{
24185 &_button_method_info_is_on,
24186 &_button_method_info_sim_button_press,
24187 &_button_method_info_sim_button_long_press,
24188 NULL
24189};
24190
24191static const _ExtendedGDBusSignalInfo _button_signal_info_button_release =
24192{
24193 {
24194 -1,
24195 (gchar *) "ButtonRelease",
24196 NULL,
24197 NULL
24198 },
24199 "button-release"
24200};
24201
24202static const _ExtendedGDBusSignalInfo _button_signal_info_button_pressed =
24203{
24204 {
24205 -1,
24206 (gchar *) "ButtonPressed",
24207 NULL,
24208 NULL
24209 },
24210 "button-pressed"
24211};
24212
24213static const _ExtendedGDBusSignalInfo _button_signal_info_button_pressed_long =
24214{
24215 {
24216 -1,
24217 (gchar *) "ButtonPressedLong",
24218 NULL,
24219 NULL
24220 },
24221 "button-pressed-long"
24222};
24223
24224static const _ExtendedGDBusSignalInfo * const _button_signal_info_pointers[] =
24225{
24226 &_button_signal_info_button_release,
24227 &_button_signal_info_button_pressed,
24228 &_button_signal_info_button_pressed_long,
24229 NULL
24230};
24231
24232static const _ExtendedGDBusPropertyInfo _button_property_info_state =
24233{
24234 {
24235 -1,
24236 (gchar *) "state",
24237 (gchar *) "b",
24238 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
24239 NULL
24240 },
24241 "state",
24242 FALSE
24243};
24244
24245static const _ExtendedGDBusPropertyInfo * const _button_property_info_pointers[] =
24246{
24247 &_button_property_info_state,
24248 NULL
24249};
24250
24251static const _ExtendedGDBusInterfaceInfo _button_interface_info =
24252{
24253 {
24254 -1,
24255 (gchar *) "org.openbmc.Button",
24256 (GDBusMethodInfo **) &_button_method_info_pointers,
24257 (GDBusSignalInfo **) &_button_signal_info_pointers,
24258 (GDBusPropertyInfo **) &_button_property_info_pointers,
24259 NULL
24260 },
24261 "button",
24262};
24263
24264
24265/**
24266 * button_interface_info:
24267 *
24268 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link> D-Bus interface.
24269 *
24270 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
24271 */
24272GDBusInterfaceInfo *
24273button_interface_info (void)
24274{
24275 return (GDBusInterfaceInfo *) &_button_interface_info.parent_struct;
24276}
24277
24278/**
24279 * button_override_properties:
24280 * @klass: The class structure for a #GObject<!-- -->-derived class.
24281 * @property_id_begin: The property id to assign to the first overridden property.
24282 *
24283 * Overrides all #GObject properties in the #Button interface for a concrete class.
24284 * The properties are overridden in the order they are defined.
24285 *
24286 * Returns: The last property id.
24287 */
24288guint
24289button_override_properties (GObjectClass *klass, guint property_id_begin)
24290{
24291 g_object_class_override_property (klass, property_id_begin++, "state");
24292 return property_id_begin - 1;
24293}
24294
24295
24296
24297/**
24298 * Button:
24299 *
24300 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link>.
24301 */
24302
24303/**
24304 * ButtonIface:
24305 * @parent_iface: The parent interface.
24306 * @handle_is_on: Handler for the #Button::handle-is-on signal.
24307 * @handle_sim_button_long_press: Handler for the #Button::handle-sim-button-long-press signal.
24308 * @handle_sim_button_press: Handler for the #Button::handle-sim-button-press signal.
24309 * @get_state: Getter for the #Button:state property.
24310 * @button_pressed: Handler for the #Button::button-pressed signal.
24311 * @button_pressed_long: Handler for the #Button::button-pressed-long signal.
24312 * @button_release: Handler for the #Button::button-release signal.
24313 *
24314 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link>.
24315 */
24316
24317typedef ButtonIface ButtonInterface;
24318G_DEFINE_INTERFACE (Button, button, G_TYPE_OBJECT);
24319
24320static void
24321button_default_init (ButtonIface *iface)
24322{
24323 /* GObject signals for incoming D-Bus method calls: */
24324 /**
24325 * Button::handle-is-on:
24326 * @object: A #Button.
24327 * @invocation: A #GDBusMethodInvocation.
24328 *
24329 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Button.isOn">isOn()</link> D-Bus method.
24330 *
24331 * 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.
24332 *
24333 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
24334 */
24335 g_signal_new ("handle-is-on",
24336 G_TYPE_FROM_INTERFACE (iface),
24337 G_SIGNAL_RUN_LAST,
24338 G_STRUCT_OFFSET (ButtonIface, handle_is_on),
24339 g_signal_accumulator_true_handled,
24340 NULL,
24341 g_cclosure_marshal_generic,
24342 G_TYPE_BOOLEAN,
24343 1,
24344 G_TYPE_DBUS_METHOD_INVOCATION);
24345
24346 /**
24347 * Button::handle-sim-button-press:
24348 * @object: A #Button.
24349 * @invocation: A #GDBusMethodInvocation.
24350 *
24351 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Button.simButtonPress">simButtonPress()</link> D-Bus method.
24352 *
24353 * 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_button_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.
24354 *
24355 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
24356 */
24357 g_signal_new ("handle-sim-button-press",
24358 G_TYPE_FROM_INTERFACE (iface),
24359 G_SIGNAL_RUN_LAST,
24360 G_STRUCT_OFFSET (ButtonIface, handle_sim_button_press),
24361 g_signal_accumulator_true_handled,
24362 NULL,
24363 g_cclosure_marshal_generic,
24364 G_TYPE_BOOLEAN,
24365 1,
24366 G_TYPE_DBUS_METHOD_INVOCATION);
24367
24368 /**
24369 * Button::handle-sim-button-long-press:
24370 * @object: A #Button.
24371 * @invocation: A #GDBusMethodInvocation.
24372 *
24373 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Button.simButtonLongPress">simButtonLongPress()</link> D-Bus method.
24374 *
24375 * 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_button_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.
24376 *
24377 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
24378 */
24379 g_signal_new ("handle-sim-button-long-press",
24380 G_TYPE_FROM_INTERFACE (iface),
24381 G_SIGNAL_RUN_LAST,
24382 G_STRUCT_OFFSET (ButtonIface, handle_sim_button_long_press),
24383 g_signal_accumulator_true_handled,
24384 NULL,
24385 g_cclosure_marshal_generic,
24386 G_TYPE_BOOLEAN,
24387 1,
24388 G_TYPE_DBUS_METHOD_INVOCATION);
24389
24390 /* GObject signals for received D-Bus signals: */
24391 /**
24392 * Button::button-release:
24393 * @object: A #Button.
24394 *
24395 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Button.ButtonRelease">"ButtonRelease"</link> is received.
24396 *
24397 * 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.
24398 */
24399 g_signal_new ("button-release",
24400 G_TYPE_FROM_INTERFACE (iface),
24401 G_SIGNAL_RUN_LAST,
24402 G_STRUCT_OFFSET (ButtonIface, button_release),
24403 NULL,
24404 NULL,
24405 g_cclosure_marshal_generic,
24406 G_TYPE_NONE,
24407 0);
24408
24409 /**
24410 * Button::button-pressed:
24411 * @object: A #Button.
24412 *
24413 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Button.ButtonPressed">"ButtonPressed"</link> is received.
24414 *
24415 * 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.
24416 */
24417 g_signal_new ("button-pressed",
24418 G_TYPE_FROM_INTERFACE (iface),
24419 G_SIGNAL_RUN_LAST,
24420 G_STRUCT_OFFSET (ButtonIface, button_pressed),
24421 NULL,
24422 NULL,
24423 g_cclosure_marshal_generic,
24424 G_TYPE_NONE,
24425 0);
24426
24427 /**
24428 * Button::button-pressed-long:
24429 * @object: A #Button.
24430 *
24431 * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Button.ButtonPressedLong">"ButtonPressedLong"</link> is received.
24432 *
24433 * 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.
24434 */
24435 g_signal_new ("button-pressed-long",
24436 G_TYPE_FROM_INTERFACE (iface),
24437 G_SIGNAL_RUN_LAST,
24438 G_STRUCT_OFFSET (ButtonIface, button_pressed_long),
24439 NULL,
24440 NULL,
24441 g_cclosure_marshal_generic,
24442 G_TYPE_NONE,
24443 0);
24444
24445 /* GObject properties for D-Bus properties: */
24446 /**
24447 * Button:state:
24448 *
24449 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Button.state">"state"</link>.
24450 *
24451 * 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.
24452 */
24453 g_object_interface_install_property (iface,
24454 g_param_spec_boolean ("state", "state", "state", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
24455}
24456
24457/**
24458 * button_get_state: (skip)
24459 * @object: A #Button.
24460 *
24461 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Button.state">"state"</link> D-Bus property.
24462 *
24463 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
24464 *
24465 * Returns: The property value.
24466 */
24467gboolean
24468button_get_state (Button *object)
24469{
24470 return BUTTON_GET_IFACE (object)->get_state (object);
24471}
24472
24473/**
24474 * button_set_state: (skip)
24475 * @object: A #Button.
24476 * @value: The value to set.
24477 *
24478 * Sets the <link linkend="gdbus-property-org-openbmc-Button.state">"state"</link> D-Bus property to @value.
24479 *
24480 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
24481 */
24482void
24483button_set_state (Button *object, gboolean value)
24484{
24485 g_object_set (G_OBJECT (object), "state", value, NULL);
24486}
24487
24488/**
24489 * button_emit_button_release:
24490 * @object: A #Button.
24491 *
24492 * Emits the <link linkend="gdbus-signal-org-openbmc-Button.ButtonRelease">"ButtonRelease"</link> D-Bus signal.
24493 */
24494void
24495button_emit_button_release (
24496 Button *object)
24497{
24498 g_signal_emit_by_name (object, "button-release");
24499}
24500
24501/**
24502 * button_emit_button_pressed:
24503 * @object: A #Button.
24504 *
24505 * Emits the <link linkend="gdbus-signal-org-openbmc-Button.ButtonPressed">"ButtonPressed"</link> D-Bus signal.
24506 */
24507void
24508button_emit_button_pressed (
24509 Button *object)
24510{
24511 g_signal_emit_by_name (object, "button-pressed");
24512}
24513
24514/**
24515 * button_emit_button_pressed_long:
24516 * @object: A #Button.
24517 *
24518 * Emits the <link linkend="gdbus-signal-org-openbmc-Button.ButtonPressedLong">"ButtonPressedLong"</link> D-Bus signal.
24519 */
24520void
24521button_emit_button_pressed_long (
24522 Button *object)
24523{
24524 g_signal_emit_by_name (object, "button-pressed-long");
24525}
24526
24527/**
24528 * button_call_is_on:
24529 * @proxy: A #ButtonProxy.
24530 * @cancellable: (allow-none): A #GCancellable or %NULL.
24531 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
24532 * @user_data: User data to pass to @callback.
24533 *
24534 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.isOn">isOn()</link> D-Bus method on @proxy.
24535 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
24536 * You can then call button_call_is_on_finish() to get the result of the operation.
24537 *
24538 * See button_call_is_on_sync() for the synchronous, blocking version of this method.
24539 */
24540void
24541button_call_is_on (
24542 Button *proxy,
24543 GCancellable *cancellable,
24544 GAsyncReadyCallback callback,
24545 gpointer user_data)
24546{
24547 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
24548 "isOn",
24549 g_variant_new ("()"),
24550 G_DBUS_CALL_FLAGS_NONE,
24551 -1,
24552 cancellable,
24553 callback,
24554 user_data);
24555}
24556
24557/**
24558 * button_call_is_on_finish:
24559 * @proxy: A #ButtonProxy.
24560 * @out_state: (out): Return location for return parameter or %NULL to ignore.
24561 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_call_is_on().
24562 * @error: Return location for error or %NULL.
24563 *
24564 * Finishes an operation started with button_call_is_on().
24565 *
24566 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
24567 */
24568gboolean
24569button_call_is_on_finish (
24570 Button *proxy,
24571 gboolean *out_state,
24572 GAsyncResult *res,
24573 GError **error)
24574{
24575 GVariant *_ret;
24576 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
24577 if (_ret == NULL)
24578 goto _out;
24579 g_variant_get (_ret,
24580 "(b)",
24581 out_state);
24582 g_variant_unref (_ret);
24583_out:
24584 return _ret != NULL;
24585}
24586
24587/**
24588 * button_call_is_on_sync:
24589 * @proxy: A #ButtonProxy.
24590 * @out_state: (out): Return location for return parameter or %NULL to ignore.
24591 * @cancellable: (allow-none): A #GCancellable or %NULL.
24592 * @error: Return location for error or %NULL.
24593 *
24594 * 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.
24595 *
24596 * See button_call_is_on() for the asynchronous version of this method.
24597 *
24598 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
24599 */
24600gboolean
24601button_call_is_on_sync (
24602 Button *proxy,
24603 gboolean *out_state,
24604 GCancellable *cancellable,
24605 GError **error)
24606{
24607 GVariant *_ret;
24608 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
24609 "isOn",
24610 g_variant_new ("()"),
24611 G_DBUS_CALL_FLAGS_NONE,
24612 -1,
24613 cancellable,
24614 error);
24615 if (_ret == NULL)
24616 goto _out;
24617 g_variant_get (_ret,
24618 "(b)",
24619 out_state);
24620 g_variant_unref (_ret);
24621_out:
24622 return _ret != NULL;
24623}
24624
24625/**
24626 * button_call_sim_button_press:
24627 * @proxy: A #ButtonProxy.
24628 * @cancellable: (allow-none): A #GCancellable or %NULL.
24629 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
24630 * @user_data: User data to pass to @callback.
24631 *
24632 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.simButtonPress">simButtonPress()</link> D-Bus method on @proxy.
24633 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
24634 * You can then call button_call_sim_button_press_finish() to get the result of the operation.
24635 *
24636 * See button_call_sim_button_press_sync() for the synchronous, blocking version of this method.
24637 */
24638void
24639button_call_sim_button_press (
24640 Button *proxy,
24641 GCancellable *cancellable,
24642 GAsyncReadyCallback callback,
24643 gpointer user_data)
24644{
24645 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
24646 "simButtonPress",
24647 g_variant_new ("()"),
24648 G_DBUS_CALL_FLAGS_NONE,
24649 -1,
24650 cancellable,
24651 callback,
24652 user_data);
24653}
24654
24655/**
24656 * button_call_sim_button_press_finish:
24657 * @proxy: A #ButtonProxy.
24658 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_call_sim_button_press().
24659 * @error: Return location for error or %NULL.
24660 *
24661 * Finishes an operation started with button_call_sim_button_press().
24662 *
24663 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
24664 */
24665gboolean
24666button_call_sim_button_press_finish (
24667 Button *proxy,
24668 GAsyncResult *res,
24669 GError **error)
24670{
24671 GVariant *_ret;
24672 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
24673 if (_ret == NULL)
24674 goto _out;
24675 g_variant_get (_ret,
24676 "()");
24677 g_variant_unref (_ret);
24678_out:
24679 return _ret != NULL;
24680}
24681
24682/**
24683 * button_call_sim_button_press_sync:
24684 * @proxy: A #ButtonProxy.
24685 * @cancellable: (allow-none): A #GCancellable or %NULL.
24686 * @error: Return location for error or %NULL.
24687 *
24688 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.simButtonPress">simButtonPress()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
24689 *
24690 * See button_call_sim_button_press() for the asynchronous version of this method.
24691 *
24692 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
24693 */
24694gboolean
24695button_call_sim_button_press_sync (
24696 Button *proxy,
24697 GCancellable *cancellable,
24698 GError **error)
24699{
24700 GVariant *_ret;
24701 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
24702 "simButtonPress",
24703 g_variant_new ("()"),
24704 G_DBUS_CALL_FLAGS_NONE,
24705 -1,
24706 cancellable,
24707 error);
24708 if (_ret == NULL)
24709 goto _out;
24710 g_variant_get (_ret,
24711 "()");
24712 g_variant_unref (_ret);
24713_out:
24714 return _ret != NULL;
24715}
24716
24717/**
24718 * button_call_sim_button_long_press:
24719 * @proxy: A #ButtonProxy.
24720 * @cancellable: (allow-none): A #GCancellable or %NULL.
24721 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
24722 * @user_data: User data to pass to @callback.
24723 *
24724 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.simButtonLongPress">simButtonLongPress()</link> D-Bus method on @proxy.
24725 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
24726 * You can then call button_call_sim_button_long_press_finish() to get the result of the operation.
24727 *
24728 * See button_call_sim_button_long_press_sync() for the synchronous, blocking version of this method.
24729 */
24730void
24731button_call_sim_button_long_press (
24732 Button *proxy,
24733 GCancellable *cancellable,
24734 GAsyncReadyCallback callback,
24735 gpointer user_data)
24736{
24737 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
24738 "simButtonLongPress",
24739 g_variant_new ("()"),
24740 G_DBUS_CALL_FLAGS_NONE,
24741 -1,
24742 cancellable,
24743 callback,
24744 user_data);
24745}
24746
24747/**
24748 * button_call_sim_button_long_press_finish:
24749 * @proxy: A #ButtonProxy.
24750 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_call_sim_button_long_press().
24751 * @error: Return location for error or %NULL.
24752 *
24753 * Finishes an operation started with button_call_sim_button_long_press().
24754 *
24755 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
24756 */
24757gboolean
24758button_call_sim_button_long_press_finish (
24759 Button *proxy,
24760 GAsyncResult *res,
24761 GError **error)
24762{
24763 GVariant *_ret;
24764 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
24765 if (_ret == NULL)
24766 goto _out;
24767 g_variant_get (_ret,
24768 "()");
24769 g_variant_unref (_ret);
24770_out:
24771 return _ret != NULL;
24772}
24773
24774/**
24775 * button_call_sim_button_long_press_sync:
24776 * @proxy: A #ButtonProxy.
24777 * @cancellable: (allow-none): A #GCancellable or %NULL.
24778 * @error: Return location for error or %NULL.
24779 *
24780 * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.simButtonLongPress">simButtonLongPress()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
24781 *
24782 * See button_call_sim_button_long_press() for the asynchronous version of this method.
24783 *
24784 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
24785 */
24786gboolean
24787button_call_sim_button_long_press_sync (
24788 Button *proxy,
24789 GCancellable *cancellable,
24790 GError **error)
24791{
24792 GVariant *_ret;
24793 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
24794 "simButtonLongPress",
24795 g_variant_new ("()"),
24796 G_DBUS_CALL_FLAGS_NONE,
24797 -1,
24798 cancellable,
24799 error);
24800 if (_ret == NULL)
24801 goto _out;
24802 g_variant_get (_ret,
24803 "()");
24804 g_variant_unref (_ret);
24805_out:
24806 return _ret != NULL;
24807}
24808
24809/**
24810 * button_complete_is_on:
24811 * @object: A #Button.
24812 * @invocation: (transfer full): A #GDBusMethodInvocation.
24813 * @state: Parameter to return.
24814 *
24815 * 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.
24816 *
24817 * This method will free @invocation, you cannot use it afterwards.
24818 */
24819void
24820button_complete_is_on (
24821 Button *object,
24822 GDBusMethodInvocation *invocation,
24823 gboolean state)
24824{
24825 g_dbus_method_invocation_return_value (invocation,
24826 g_variant_new ("(b)",
24827 state));
24828}
24829
24830/**
24831 * button_complete_sim_button_press:
24832 * @object: A #Button.
24833 * @invocation: (transfer full): A #GDBusMethodInvocation.
24834 *
24835 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Button.simButtonPress">simButtonPress()</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.
24836 *
24837 * This method will free @invocation, you cannot use it afterwards.
24838 */
24839void
24840button_complete_sim_button_press (
24841 Button *object,
24842 GDBusMethodInvocation *invocation)
24843{
24844 g_dbus_method_invocation_return_value (invocation,
24845 g_variant_new ("()"));
24846}
24847
24848/**
24849 * button_complete_sim_button_long_press:
24850 * @object: A #Button.
24851 * @invocation: (transfer full): A #GDBusMethodInvocation.
24852 *
24853 * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Button.simButtonLongPress">simButtonLongPress()</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.
24854 *
24855 * This method will free @invocation, you cannot use it afterwards.
24856 */
24857void
24858button_complete_sim_button_long_press (
24859 Button *object,
24860 GDBusMethodInvocation *invocation)
24861{
24862 g_dbus_method_invocation_return_value (invocation,
24863 g_variant_new ("()"));
24864}
24865
24866/* ------------------------------------------------------------------------ */
24867
24868/**
24869 * ButtonProxy:
24870 *
24871 * The #ButtonProxy structure contains only private data and should only be accessed using the provided API.
24872 */
24873
24874/**
24875 * ButtonProxyClass:
24876 * @parent_class: The parent class.
24877 *
24878 * Class structure for #ButtonProxy.
24879 */
24880
24881struct _ButtonProxyPrivate
24882{
24883 GData *qdata;
24884};
24885
24886static void button_proxy_iface_init (ButtonIface *iface);
24887
24888#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
24889G_DEFINE_TYPE_WITH_CODE (ButtonProxy, button_proxy, G_TYPE_DBUS_PROXY,
24890 G_ADD_PRIVATE (ButtonProxy)
24891 G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_proxy_iface_init));
24892
24893#else
24894G_DEFINE_TYPE_WITH_CODE (ButtonProxy, button_proxy, G_TYPE_DBUS_PROXY,
24895 G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_proxy_iface_init));
24896
24897#endif
24898static void
24899button_proxy_finalize (GObject *object)
24900{
24901 ButtonProxy *proxy = BUTTON_PROXY (object);
24902 g_datalist_clear (&proxy->priv->qdata);
24903 G_OBJECT_CLASS (button_proxy_parent_class)->finalize (object);
24904}
24905
24906static void
24907button_proxy_get_property (GObject *object,
24908 guint prop_id,
24909 GValue *value,
24910 GParamSpec *pspec G_GNUC_UNUSED)
24911{
24912 const _ExtendedGDBusPropertyInfo *info;
24913 GVariant *variant;
24914 g_assert (prop_id != 0 && prop_id - 1 < 1);
24915 info = _button_property_info_pointers[prop_id - 1];
24916 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
24917 if (info->use_gvariant)
24918 {
24919 g_value_set_variant (value, variant);
24920 }
24921 else
24922 {
24923 if (variant != NULL)
24924 g_dbus_gvariant_to_gvalue (variant, value);
24925 }
24926 if (variant != NULL)
24927 g_variant_unref (variant);
24928}
24929
24930static void
24931button_proxy_set_property_cb (GDBusProxy *proxy,
24932 GAsyncResult *res,
24933 gpointer user_data)
24934{
24935 const _ExtendedGDBusPropertyInfo *info = user_data;
24936 GError *error;
24937 GVariant *_ret;
24938 error = NULL;
24939 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
24940 if (!_ret)
24941 {
24942 g_warning ("Error setting property '%s' on interface org.openbmc.Button: %s (%s, %d)",
24943 info->parent_struct.name,
24944 error->message, g_quark_to_string (error->domain), error->code);
24945 g_error_free (error);
24946 }
24947 else
24948 {
24949 g_variant_unref (_ret);
24950 }
24951}
24952
24953static void
24954button_proxy_set_property (GObject *object,
24955 guint prop_id,
24956 const GValue *value,
24957 GParamSpec *pspec G_GNUC_UNUSED)
24958{
24959 const _ExtendedGDBusPropertyInfo *info;
24960 GVariant *variant;
24961 g_assert (prop_id != 0 && prop_id - 1 < 1);
24962 info = _button_property_info_pointers[prop_id - 1];
24963 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
24964 g_dbus_proxy_call (G_DBUS_PROXY (object),
24965 "org.freedesktop.DBus.Properties.Set",
24966 g_variant_new ("(ssv)", "org.openbmc.Button", info->parent_struct.name, variant),
24967 G_DBUS_CALL_FLAGS_NONE,
24968 -1,
24969 NULL, (GAsyncReadyCallback) button_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
24970 g_variant_unref (variant);
24971}
24972
24973static void
24974button_proxy_g_signal (GDBusProxy *proxy,
24975 const gchar *sender_name G_GNUC_UNUSED,
24976 const gchar *signal_name,
24977 GVariant *parameters)
24978{
24979 _ExtendedGDBusSignalInfo *info;
24980 GVariantIter iter;
24981 GVariant *child;
24982 GValue *paramv;
24983 guint num_params;
24984 guint n;
24985 guint signal_id;
24986 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, signal_name);
24987 if (info == NULL)
24988 return;
24989 num_params = g_variant_n_children (parameters);
24990 paramv = g_new0 (GValue, num_params + 1);
24991 g_value_init (&paramv[0], TYPE_BUTTON);
24992 g_value_set_object (&paramv[0], proxy);
24993 g_variant_iter_init (&iter, parameters);
24994 n = 1;
24995 while ((child = g_variant_iter_next_value (&iter)) != NULL)
24996 {
24997 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
24998 if (arg_info->use_gvariant)
24999 {
25000 g_value_init (&paramv[n], G_TYPE_VARIANT);
25001 g_value_set_variant (&paramv[n], child);
25002 n++;
25003 }
25004 else
25005 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
25006 g_variant_unref (child);
25007 }
25008 signal_id = g_signal_lookup (info->signal_name, TYPE_BUTTON);
25009 g_signal_emitv (paramv, signal_id, 0, NULL);
25010 for (n = 0; n < num_params + 1; n++)
25011 g_value_unset (&paramv[n]);
25012 g_free (paramv);
25013}
25014
25015static void
25016button_proxy_g_properties_changed (GDBusProxy *_proxy,
25017 GVariant *changed_properties,
25018 const gchar *const *invalidated_properties)
25019{
25020 ButtonProxy *proxy = BUTTON_PROXY (_proxy);
25021 guint n;
25022 const gchar *key;
25023 GVariantIter *iter;
25024 _ExtendedGDBusPropertyInfo *info;
25025 g_variant_get (changed_properties, "a{sv}", &iter);
25026 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
25027 {
25028 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, key);
25029 g_datalist_remove_data (&proxy->priv->qdata, key);
25030 if (info != NULL)
25031 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
25032 }
25033 g_variant_iter_free (iter);
25034 for (n = 0; invalidated_properties[n] != NULL; n++)
25035 {
25036 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, invalidated_properties[n]);
25037 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
25038 if (info != NULL)
25039 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
25040 }
25041}
25042
25043static gboolean
25044button_proxy_get_state (Button *object)
25045{
25046 ButtonProxy *proxy = BUTTON_PROXY (object);
25047 GVariant *variant;
25048 gboolean value = 0;
25049 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state");
25050 if (variant != NULL)
25051 {
25052 value = g_variant_get_boolean (variant);
25053 g_variant_unref (variant);
25054 }
25055 return value;
25056}
25057
25058static void
25059button_proxy_init (ButtonProxy *proxy)
25060{
25061#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
25062 proxy->priv = button_proxy_get_instance_private (proxy);
25063#else
25064 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_BUTTON_PROXY, ButtonProxyPrivate);
25065#endif
25066
25067 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), button_interface_info ());
25068}
25069
25070static void
25071button_proxy_class_init (ButtonProxyClass *klass)
25072{
25073 GObjectClass *gobject_class;
25074 GDBusProxyClass *proxy_class;
25075
25076 gobject_class = G_OBJECT_CLASS (klass);
25077 gobject_class->finalize = button_proxy_finalize;
25078 gobject_class->get_property = button_proxy_get_property;
25079 gobject_class->set_property = button_proxy_set_property;
25080
25081 proxy_class = G_DBUS_PROXY_CLASS (klass);
25082 proxy_class->g_signal = button_proxy_g_signal;
25083 proxy_class->g_properties_changed = button_proxy_g_properties_changed;
25084
25085 button_override_properties (gobject_class, 1);
25086
25087#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
25088 g_type_class_add_private (klass, sizeof (ButtonProxyPrivate));
25089#endif
25090}
25091
25092static void
25093button_proxy_iface_init (ButtonIface *iface)
25094{
25095 iface->get_state = button_proxy_get_state;
25096}
25097
25098/**
25099 * button_proxy_new:
25100 * @connection: A #GDBusConnection.
25101 * @flags: Flags from the #GDBusProxyFlags enumeration.
25102 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
25103 * @object_path: An object path.
25104 * @cancellable: (allow-none): A #GCancellable or %NULL.
25105 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
25106 * @user_data: User data to pass to @callback.
25107 *
25108 * 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.
25109 *
25110 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
25111 * You can then call button_proxy_new_finish() to get the result of the operation.
25112 *
25113 * See button_proxy_new_sync() for the synchronous, blocking version of this constructor.
25114 */
25115void
25116button_proxy_new (
25117 GDBusConnection *connection,
25118 GDBusProxyFlags flags,
25119 const gchar *name,
25120 const gchar *object_path,
25121 GCancellable *cancellable,
25122 GAsyncReadyCallback callback,
25123 gpointer user_data)
25124{
25125 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);
25126}
25127
25128/**
25129 * button_proxy_new_finish:
25130 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_proxy_new().
25131 * @error: Return location for error or %NULL
25132 *
25133 * Finishes an operation started with button_proxy_new().
25134 *
25135 * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set.
25136 */
25137Button *
25138button_proxy_new_finish (
25139 GAsyncResult *res,
25140 GError **error)
25141{
25142 GObject *ret;
25143 GObject *source_object;
25144 source_object = g_async_result_get_source_object (res);
25145 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
25146 g_object_unref (source_object);
25147 if (ret != NULL)
25148 return BUTTON (ret);
25149 else
25150 return NULL;
25151}
25152
25153/**
25154 * button_proxy_new_sync:
25155 * @connection: A #GDBusConnection.
25156 * @flags: Flags from the #GDBusProxyFlags enumeration.
25157 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
25158 * @object_path: An object path.
25159 * @cancellable: (allow-none): A #GCancellable or %NULL.
25160 * @error: Return location for error or %NULL
25161 *
25162 * 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.
25163 *
25164 * The calling thread is blocked until a reply is received.
25165 *
25166 * See button_proxy_new() for the asynchronous version of this constructor.
25167 *
25168 * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set.
25169 */
25170Button *
25171button_proxy_new_sync (
25172 GDBusConnection *connection,
25173 GDBusProxyFlags flags,
25174 const gchar *name,
25175 const gchar *object_path,
25176 GCancellable *cancellable,
25177 GError **error)
25178{
25179 GInitable *ret;
25180 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);
25181 if (ret != NULL)
25182 return BUTTON (ret);
25183 else
25184 return NULL;
25185}
25186
25187
25188/**
25189 * button_proxy_new_for_bus:
25190 * @bus_type: A #GBusType.
25191 * @flags: Flags from the #GDBusProxyFlags enumeration.
25192 * @name: A bus name (well-known or unique).
25193 * @object_path: An object path.
25194 * @cancellable: (allow-none): A #GCancellable or %NULL.
25195 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
25196 * @user_data: User data to pass to @callback.
25197 *
25198 * Like button_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
25199 *
25200 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
25201 * You can then call button_proxy_new_for_bus_finish() to get the result of the operation.
25202 *
25203 * See button_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
25204 */
25205void
25206button_proxy_new_for_bus (
25207 GBusType bus_type,
25208 GDBusProxyFlags flags,
25209 const gchar *name,
25210 const gchar *object_path,
25211 GCancellable *cancellable,
25212 GAsyncReadyCallback callback,
25213 gpointer user_data)
25214{
25215 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);
25216}
25217
25218/**
25219 * button_proxy_new_for_bus_finish:
25220 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_proxy_new_for_bus().
25221 * @error: Return location for error or %NULL
25222 *
25223 * Finishes an operation started with button_proxy_new_for_bus().
25224 *
25225 * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set.
25226 */
25227Button *
25228button_proxy_new_for_bus_finish (
25229 GAsyncResult *res,
25230 GError **error)
25231{
25232 GObject *ret;
25233 GObject *source_object;
25234 source_object = g_async_result_get_source_object (res);
25235 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
25236 g_object_unref (source_object);
25237 if (ret != NULL)
25238 return BUTTON (ret);
25239 else
25240 return NULL;
25241}
25242
25243/**
25244 * button_proxy_new_for_bus_sync:
25245 * @bus_type: A #GBusType.
25246 * @flags: Flags from the #GDBusProxyFlags enumeration.
25247 * @name: A bus name (well-known or unique).
25248 * @object_path: An object path.
25249 * @cancellable: (allow-none): A #GCancellable or %NULL.
25250 * @error: Return location for error or %NULL
25251 *
25252 * Like button_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
25253 *
25254 * The calling thread is blocked until a reply is received.
25255 *
25256 * See button_proxy_new_for_bus() for the asynchronous version of this constructor.
25257 *
25258 * Returns: (transfer full) (type ButtonProxy): The constructed proxy object or %NULL if @error is set.
25259 */
25260Button *
25261button_proxy_new_for_bus_sync (
25262 GBusType bus_type,
25263 GDBusProxyFlags flags,
25264 const gchar *name,
25265 const gchar *object_path,
25266 GCancellable *cancellable,
25267 GError **error)
25268{
25269 GInitable *ret;
25270 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);
25271 if (ret != NULL)
25272 return BUTTON (ret);
25273 else
25274 return NULL;
25275}
25276
25277
25278/* ------------------------------------------------------------------------ */
25279
25280/**
25281 * ButtonSkeleton:
25282 *
25283 * The #ButtonSkeleton structure contains only private data and should only be accessed using the provided API.
25284 */
25285
25286/**
25287 * ButtonSkeletonClass:
25288 * @parent_class: The parent class.
25289 *
25290 * Class structure for #ButtonSkeleton.
25291 */
25292
25293struct _ButtonSkeletonPrivate
25294{
25295 GValue *properties;
25296 GList *changed_properties;
25297 GSource *changed_properties_idle_source;
25298 GMainContext *context;
25299 GMutex lock;
25300};
25301
25302static void
25303_button_skeleton_handle_method_call (
25304 GDBusConnection *connection G_GNUC_UNUSED,
25305 const gchar *sender G_GNUC_UNUSED,
25306 const gchar *object_path G_GNUC_UNUSED,
25307 const gchar *interface_name,
25308 const gchar *method_name,
25309 GVariant *parameters,
25310 GDBusMethodInvocation *invocation,
25311 gpointer user_data)
25312{
25313 ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data);
25314 _ExtendedGDBusMethodInfo *info;
25315 GVariantIter iter;
25316 GVariant *child;
25317 GValue *paramv;
25318 guint num_params;
25319 guint num_extra;
25320 guint n;
25321 guint signal_id;
25322 GValue return_value = G_VALUE_INIT;
25323 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
25324 g_assert (info != NULL);
25325 num_params = g_variant_n_children (parameters);
25326 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
25327 n = 0;
25328 g_value_init (&paramv[n], TYPE_BUTTON);
25329 g_value_set_object (&paramv[n++], skeleton);
25330 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
25331 g_value_set_object (&paramv[n++], invocation);
25332 if (info->pass_fdlist)
25333 {
25334#ifdef G_OS_UNIX
25335 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
25336 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
25337#else
25338 g_assert_not_reached ();
25339#endif
25340 }
25341 g_variant_iter_init (&iter, parameters);
25342 while ((child = g_variant_iter_next_value (&iter)) != NULL)
25343 {
25344 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
25345 if (arg_info->use_gvariant)
25346 {
25347 g_value_init (&paramv[n], G_TYPE_VARIANT);
25348 g_value_set_variant (&paramv[n], child);
25349 n++;
25350 }
25351 else
25352 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
25353 g_variant_unref (child);
25354 }
25355 signal_id = g_signal_lookup (info->signal_name, TYPE_BUTTON);
25356 g_value_init (&return_value, G_TYPE_BOOLEAN);
25357 g_signal_emitv (paramv, signal_id, 0, &return_value);
25358 if (!g_value_get_boolean (&return_value))
25359 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);
25360 g_value_unset (&return_value);
25361 for (n = 0; n < num_params + num_extra; n++)
25362 g_value_unset (&paramv[n]);
25363 g_free (paramv);
25364}
25365
25366static GVariant *
25367_button_skeleton_handle_get_property (
25368 GDBusConnection *connection G_GNUC_UNUSED,
25369 const gchar *sender G_GNUC_UNUSED,
25370 const gchar *object_path G_GNUC_UNUSED,
25371 const gchar *interface_name G_GNUC_UNUSED,
25372 const gchar *property_name,
25373 GError **error,
25374 gpointer user_data)
25375{
25376 ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data);
25377 GValue value = G_VALUE_INIT;
25378 GParamSpec *pspec;
25379 _ExtendedGDBusPropertyInfo *info;
25380 GVariant *ret;
25381 ret = NULL;
25382 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, property_name);
25383 g_assert (info != NULL);
25384 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
25385 if (pspec == NULL)
25386 {
25387 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
25388 }
25389 else
25390 {
25391 g_value_init (&value, pspec->value_type);
25392 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
25393 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
25394 g_value_unset (&value);
25395 }
25396 return ret;
25397}
25398
25399static gboolean
25400_button_skeleton_handle_set_property (
25401 GDBusConnection *connection G_GNUC_UNUSED,
25402 const gchar *sender G_GNUC_UNUSED,
25403 const gchar *object_path G_GNUC_UNUSED,
25404 const gchar *interface_name G_GNUC_UNUSED,
25405 const gchar *property_name,
25406 GVariant *variant,
25407 GError **error,
25408 gpointer user_data)
25409{
25410 ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data);
25411 GValue value = G_VALUE_INIT;
25412 GParamSpec *pspec;
25413 _ExtendedGDBusPropertyInfo *info;
25414 gboolean ret;
25415 ret = FALSE;
25416 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_button_interface_info.parent_struct, property_name);
25417 g_assert (info != NULL);
25418 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
25419 if (pspec == NULL)
25420 {
25421 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
25422 }
25423 else
25424 {
25425 if (info->use_gvariant)
25426 g_value_set_variant (&value, variant);
25427 else
25428 g_dbus_gvariant_to_gvalue (variant, &value);
25429 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
25430 g_value_unset (&value);
25431 ret = TRUE;
25432 }
25433 return ret;
25434}
25435
25436static const GDBusInterfaceVTable _button_skeleton_vtable =
25437{
25438 _button_skeleton_handle_method_call,
25439 _button_skeleton_handle_get_property,
25440 _button_skeleton_handle_set_property,
25441 {NULL}
25442};
25443
25444static GDBusInterfaceInfo *
25445button_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
25446{
25447 return button_interface_info ();
25448}
25449
25450static GDBusInterfaceVTable *
25451button_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
25452{
25453 return (GDBusInterfaceVTable *) &_button_skeleton_vtable;
25454}
25455
25456static GVariant *
25457button_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
25458{
25459 ButtonSkeleton *skeleton = BUTTON_SKELETON (_skeleton);
25460
25461 GVariantBuilder builder;
25462 guint n;
25463 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
25464 if (_button_interface_info.parent_struct.properties == NULL)
25465 goto out;
25466 for (n = 0; _button_interface_info.parent_struct.properties[n] != NULL; n++)
25467 {
25468 GDBusPropertyInfo *info = _button_interface_info.parent_struct.properties[n];
25469 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
25470 {
25471 GVariant *value;
25472 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);
25473 if (value != NULL)
25474 {
25475 g_variant_take_ref (value);
25476 g_variant_builder_add (&builder, "{sv}", info->name, value);
25477 g_variant_unref (value);
25478 }
25479 }
25480 }
25481out:
25482 return g_variant_builder_end (&builder);
25483}
25484
25485static gboolean _button_emit_changed (gpointer user_data);
25486
25487static void
25488button_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
25489{
25490 ButtonSkeleton *skeleton = BUTTON_SKELETON (_skeleton);
25491 gboolean emit_changed = FALSE;
25492
25493 g_mutex_lock (&skeleton->priv->lock);
25494 if (skeleton->priv->changed_properties_idle_source != NULL)
25495 {
25496 g_source_destroy (skeleton->priv->changed_properties_idle_source);
25497 skeleton->priv->changed_properties_idle_source = NULL;
25498 emit_changed = TRUE;
25499 }
25500 g_mutex_unlock (&skeleton->priv->lock);
25501
25502 if (emit_changed)
25503 _button_emit_changed (skeleton);
25504}
25505
25506static void
25507_button_on_signal_button_release (
25508 Button *object)
25509{
25510 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
25511
25512 GList *connections, *l;
25513 GVariant *signal_variant;
25514 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
25515
25516 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
25517 for (l = connections; l != NULL; l = l->next)
25518 {
25519 GDBusConnection *connection = l->data;
25520 g_dbus_connection_emit_signal (connection,
25521 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Button", "ButtonRelease",
25522 signal_variant, NULL);
25523 }
25524 g_variant_unref (signal_variant);
25525 g_list_free_full (connections, g_object_unref);
25526}
25527
25528static void
25529_button_on_signal_button_pressed (
25530 Button *object)
25531{
25532 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
25533
25534 GList *connections, *l;
25535 GVariant *signal_variant;
25536 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
25537
25538 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
25539 for (l = connections; l != NULL; l = l->next)
25540 {
25541 GDBusConnection *connection = l->data;
25542 g_dbus_connection_emit_signal (connection,
25543 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Button", "ButtonPressed",
25544 signal_variant, NULL);
25545 }
25546 g_variant_unref (signal_variant);
25547 g_list_free_full (connections, g_object_unref);
25548}
25549
25550static void
25551_button_on_signal_button_pressed_long (
25552 Button *object)
25553{
25554 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
25555
25556 GList *connections, *l;
25557 GVariant *signal_variant;
25558 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
25559
25560 signal_variant = g_variant_ref_sink (g_variant_new ("()"));
25561 for (l = connections; l != NULL; l = l->next)
25562 {
25563 GDBusConnection *connection = l->data;
25564 g_dbus_connection_emit_signal (connection,
25565 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Button", "ButtonPressedLong",
25566 signal_variant, NULL);
25567 }
25568 g_variant_unref (signal_variant);
25569 g_list_free_full (connections, g_object_unref);
25570}
25571
25572static void button_skeleton_iface_init (ButtonIface *iface);
25573#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
25574G_DEFINE_TYPE_WITH_CODE (ButtonSkeleton, button_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
25575 G_ADD_PRIVATE (ButtonSkeleton)
25576 G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_skeleton_iface_init));
25577
25578#else
25579G_DEFINE_TYPE_WITH_CODE (ButtonSkeleton, button_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
25580 G_IMPLEMENT_INTERFACE (TYPE_BUTTON, button_skeleton_iface_init));
25581
25582#endif
25583static void
25584button_skeleton_finalize (GObject *object)
25585{
25586 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
25587 guint n;
25588 for (n = 0; n < 1; n++)
25589 g_value_unset (&skeleton->priv->properties[n]);
25590 g_free (skeleton->priv->properties);
25591 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
25592 if (skeleton->priv->changed_properties_idle_source != NULL)
25593 g_source_destroy (skeleton->priv->changed_properties_idle_source);
25594 g_main_context_unref (skeleton->priv->context);
25595 g_mutex_clear (&skeleton->priv->lock);
25596 G_OBJECT_CLASS (button_skeleton_parent_class)->finalize (object);
25597}
25598
25599static void
25600button_skeleton_get_property (GObject *object,
25601 guint prop_id,
25602 GValue *value,
25603 GParamSpec *pspec G_GNUC_UNUSED)
25604{
25605 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
25606 g_assert (prop_id != 0 && prop_id - 1 < 1);
25607 g_mutex_lock (&skeleton->priv->lock);
25608 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
25609 g_mutex_unlock (&skeleton->priv->lock);
25610}
25611
25612static gboolean
25613_button_emit_changed (gpointer user_data)
25614{
25615 ButtonSkeleton *skeleton = BUTTON_SKELETON (user_data);
25616 GList *l;
25617 GVariantBuilder builder;
25618 GVariantBuilder invalidated_builder;
25619 guint num_changes;
25620
25621 g_mutex_lock (&skeleton->priv->lock);
25622 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
25623 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
25624 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
25625 {
25626 ChangedProperty *cp = l->data;
25627 GVariant *variant;
25628 const GValue *cur_value;
25629
25630 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
25631 if (!_g_value_equal (cur_value, &cp->orig_value))
25632 {
25633 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
25634 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
25635 g_variant_unref (variant);
25636 num_changes++;
25637 }
25638 }
25639 if (num_changes > 0)
25640 {
25641 GList *connections, *ll;
25642 GVariant *signal_variant;
25643 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Button",
25644 &builder, &invalidated_builder));
25645 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
25646 for (ll = connections; ll != NULL; ll = ll->next)
25647 {
25648 GDBusConnection *connection = ll->data;
25649
25650 g_dbus_connection_emit_signal (connection,
25651 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
25652 "org.freedesktop.DBus.Properties",
25653 "PropertiesChanged",
25654 signal_variant,
25655 NULL);
25656 }
25657 g_variant_unref (signal_variant);
25658 g_list_free_full (connections, g_object_unref);
25659 }
25660 else
25661 {
25662 g_variant_builder_clear (&builder);
25663 g_variant_builder_clear (&invalidated_builder);
25664 }
25665 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
25666 skeleton->priv->changed_properties = NULL;
25667 skeleton->priv->changed_properties_idle_source = NULL;
25668 g_mutex_unlock (&skeleton->priv->lock);
25669 return FALSE;
25670}
25671
25672static void
25673_button_schedule_emit_changed (ButtonSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
25674{
25675 ChangedProperty *cp;
25676 GList *l;
25677 cp = NULL;
25678 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
25679 {
25680 ChangedProperty *i_cp = l->data;
25681 if (i_cp->info == info)
25682 {
25683 cp = i_cp;
25684 break;
25685 }
25686 }
25687 if (cp == NULL)
25688 {
25689 cp = g_new0 (ChangedProperty, 1);
25690 cp->prop_id = prop_id;
25691 cp->info = info;
25692 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
25693 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
25694 g_value_copy (orig_value, &cp->orig_value);
25695 }
25696}
25697
25698static void
25699button_skeleton_notify (GObject *object,
25700 GParamSpec *pspec G_GNUC_UNUSED)
25701{
25702 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
25703 g_mutex_lock (&skeleton->priv->lock);
25704 if (skeleton->priv->changed_properties != NULL &&
25705 skeleton->priv->changed_properties_idle_source == NULL)
25706 {
25707 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
25708 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
25709 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _button_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
Adriana Kobylak2cb27752015-10-19 16:23:14 -050025710 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _button_emit_changed");
Norman James362a80f2015-09-14 14:04:39 -050025711 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
25712 g_source_unref (skeleton->priv->changed_properties_idle_source);
25713 }
25714 g_mutex_unlock (&skeleton->priv->lock);
25715}
25716
25717static void
25718button_skeleton_set_property (GObject *object,
25719 guint prop_id,
25720 const GValue *value,
25721 GParamSpec *pspec)
25722{
25723 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
25724 g_assert (prop_id != 0 && prop_id - 1 < 1);
25725 g_mutex_lock (&skeleton->priv->lock);
25726 g_object_freeze_notify (object);
25727 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
25728 {
25729 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
25730 _button_schedule_emit_changed (skeleton, _button_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
25731 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
25732 g_object_notify_by_pspec (object, pspec);
25733 }
25734 g_mutex_unlock (&skeleton->priv->lock);
25735 g_object_thaw_notify (object);
25736}
25737
25738static void
25739button_skeleton_init (ButtonSkeleton *skeleton)
25740{
25741#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
25742 skeleton->priv = button_skeleton_get_instance_private (skeleton);
25743#else
25744 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_BUTTON_SKELETON, ButtonSkeletonPrivate);
25745#endif
25746
25747 g_mutex_init (&skeleton->priv->lock);
25748 skeleton->priv->context = g_main_context_ref_thread_default ();
25749 skeleton->priv->properties = g_new0 (GValue, 1);
25750 g_value_init (&skeleton->priv->properties[0], G_TYPE_BOOLEAN);
25751}
25752
25753static gboolean
25754button_skeleton_get_state (Button *object)
25755{
25756 ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
25757 gboolean value;
25758 g_mutex_lock (&skeleton->priv->lock);
25759 value = g_value_get_boolean (&(skeleton->priv->properties[0]));
25760 g_mutex_unlock (&skeleton->priv->lock);
25761 return value;
25762}
25763
25764static void
25765button_skeleton_class_init (ButtonSkeletonClass *klass)
25766{
25767 GObjectClass *gobject_class;
25768 GDBusInterfaceSkeletonClass *skeleton_class;
25769
25770 gobject_class = G_OBJECT_CLASS (klass);
25771 gobject_class->finalize = button_skeleton_finalize;
25772 gobject_class->get_property = button_skeleton_get_property;
25773 gobject_class->set_property = button_skeleton_set_property;
25774 gobject_class->notify = button_skeleton_notify;
25775
25776
25777 button_override_properties (gobject_class, 1);
25778
25779 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
25780 skeleton_class->get_info = button_skeleton_dbus_interface_get_info;
25781 skeleton_class->get_properties = button_skeleton_dbus_interface_get_properties;
25782 skeleton_class->flush = button_skeleton_dbus_interface_flush;
25783 skeleton_class->get_vtable = button_skeleton_dbus_interface_get_vtable;
25784
25785#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
25786 g_type_class_add_private (klass, sizeof (ButtonSkeletonPrivate));
25787#endif
25788}
25789
25790static void
25791button_skeleton_iface_init (ButtonIface *iface)
25792{
25793 iface->button_release = _button_on_signal_button_release;
25794 iface->button_pressed = _button_on_signal_button_pressed;
25795 iface->button_pressed_long = _button_on_signal_button_pressed_long;
25796 iface->get_state = button_skeleton_get_state;
25797}
25798
25799/**
25800 * button_skeleton_new:
25801 *
25802 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link>.
25803 *
25804 * Returns: (transfer full) (type ButtonSkeleton): The skeleton object.
25805 */
25806Button *
25807button_skeleton_new (void)
25808{
25809 return BUTTON (g_object_new (TYPE_BUTTON_SKELETON, NULL));
25810}
25811
25812/* ------------------------------------------------------------------------
25813 * Code for interface org.openbmc.Led
25814 * ------------------------------------------------------------------------
25815 */
25816
25817/**
25818 * SECTION:Led
25819 * @title: Led
25820 * @short_description: Generated C code for the org.openbmc.Led D-Bus interface
25821 *
25822 * 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.
25823 */
25824
25825/* ---- Introspection data for org.openbmc.Led ---- */
25826
25827static const _ExtendedGDBusMethodInfo _led_method_info_set_on =
25828{
25829 {
25830 -1,
25831 (gchar *) "setOn",
25832 NULL,
25833 NULL,
25834 NULL
25835 },
25836 "handle-set-on",
25837 FALSE
25838};
25839
25840static const _ExtendedGDBusMethodInfo _led_method_info_set_off =
25841{
25842 {
25843 -1,
25844 (gchar *) "setOff",
25845 NULL,
25846 NULL,
25847 NULL
25848 },
25849 "handle-set-off",
25850 FALSE
25851};
25852
25853static const _ExtendedGDBusMethodInfo _led_method_info_set_blink_slow =
25854{
25855 {
25856 -1,
25857 (gchar *) "setBlinkSlow",
25858 NULL,
25859 NULL,
25860 NULL
25861 },
25862 "handle-set-blink-slow",
25863 FALSE
25864};
25865
25866static const _ExtendedGDBusMethodInfo _led_method_info_set_blink_fast =
25867{
25868 {
25869 -1,
25870 (gchar *) "setBlinkFast",
25871 NULL,
25872 NULL,
25873 NULL
25874 },
25875 "handle-set-blink-fast",
25876 FALSE
25877};
25878
25879static const _ExtendedGDBusMethodInfo * const _led_method_info_pointers[] =
25880{
25881 &_led_method_info_set_on,
25882 &_led_method_info_set_off,
25883 &_led_method_info_set_blink_slow,
25884 &_led_method_info_set_blink_fast,
25885 NULL
25886};
25887
25888static const _ExtendedGDBusPropertyInfo _led_property_info_color =
25889{
25890 {
25891 -1,
25892 (gchar *) "color",
25893 (gchar *) "i",
25894 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
25895 NULL
25896 },
25897 "color",
25898 FALSE
25899};
25900
25901static const _ExtendedGDBusPropertyInfo _led_property_info_function =
25902{
25903 {
25904 -1,
25905 (gchar *) "function",
25906 (gchar *) "s",
25907 G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
25908 NULL
25909 },
25910 "function",
25911 FALSE
25912};
25913
25914static const _ExtendedGDBusPropertyInfo * const _led_property_info_pointers[] =
25915{
25916 &_led_property_info_color,
25917 &_led_property_info_function,
25918 NULL
25919};
25920
25921static const _ExtendedGDBusInterfaceInfo _led_interface_info =
25922{
25923 {
25924 -1,
25925 (gchar *) "org.openbmc.Led",
25926 (GDBusMethodInfo **) &_led_method_info_pointers,
25927 NULL,
25928 (GDBusPropertyInfo **) &_led_property_info_pointers,
25929 NULL
25930 },
25931 "led",
25932};
25933
25934
25935/**
25936 * led_interface_info:
25937 *
25938 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link> D-Bus interface.
25939 *
25940 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
25941 */
25942GDBusInterfaceInfo *
25943led_interface_info (void)
25944{
25945 return (GDBusInterfaceInfo *) &_led_interface_info.parent_struct;
25946}
25947
25948/**
25949 * led_override_properties:
25950 * @klass: The class structure for a #GObject<!-- -->-derived class.
25951 * @property_id_begin: The property id to assign to the first overridden property.
25952 *
25953 * Overrides all #GObject properties in the #Led interface for a concrete class.
25954 * The properties are overridden in the order they are defined.
25955 *
25956 * Returns: The last property id.
25957 */
25958guint
25959led_override_properties (GObjectClass *klass, guint property_id_begin)
25960{
25961 g_object_class_override_property (klass, property_id_begin++, "color");
25962 g_object_class_override_property (klass, property_id_begin++, "function");
25963 return property_id_begin - 1;
25964}
25965
25966
25967
25968/**
25969 * Led:
25970 *
25971 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>.
25972 */
25973
25974/**
25975 * LedIface:
25976 * @parent_iface: The parent interface.
25977 * @handle_set_blink_fast: Handler for the #Led::handle-set-blink-fast signal.
25978 * @handle_set_blink_slow: Handler for the #Led::handle-set-blink-slow signal.
25979 * @handle_set_off: Handler for the #Led::handle-set-off signal.
25980 * @handle_set_on: Handler for the #Led::handle-set-on signal.
25981 * @get_color: Getter for the #Led:color property.
25982 * @get_function: Getter for the #Led:function property.
25983 *
25984 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>.
25985 */
25986
25987typedef LedIface LedInterface;
25988G_DEFINE_INTERFACE (Led, led, G_TYPE_OBJECT);
25989
25990static void
25991led_default_init (LedIface *iface)
25992{
25993 /* GObject signals for incoming D-Bus method calls: */
25994 /**
25995 * Led::handle-set-on:
25996 * @object: A #Led.
25997 * @invocation: A #GDBusMethodInvocation.
25998 *
25999 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setOn">setOn()</link> D-Bus method.
26000 *
26001 * 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.
26002 *
26003 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
26004 */
26005 g_signal_new ("handle-set-on",
26006 G_TYPE_FROM_INTERFACE (iface),
26007 G_SIGNAL_RUN_LAST,
26008 G_STRUCT_OFFSET (LedIface, handle_set_on),
26009 g_signal_accumulator_true_handled,
26010 NULL,
26011 g_cclosure_marshal_generic,
26012 G_TYPE_BOOLEAN,
26013 1,
26014 G_TYPE_DBUS_METHOD_INVOCATION);
26015
26016 /**
26017 * Led::handle-set-off:
26018 * @object: A #Led.
26019 * @invocation: A #GDBusMethodInvocation.
26020 *
26021 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setOff">setOff()</link> D-Bus method.
26022 *
26023 * 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.
26024 *
26025 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
26026 */
26027 g_signal_new ("handle-set-off",
26028 G_TYPE_FROM_INTERFACE (iface),
26029 G_SIGNAL_RUN_LAST,
26030 G_STRUCT_OFFSET (LedIface, handle_set_off),
26031 g_signal_accumulator_true_handled,
26032 NULL,
26033 g_cclosure_marshal_generic,
26034 G_TYPE_BOOLEAN,
26035 1,
26036 G_TYPE_DBUS_METHOD_INVOCATION);
26037
26038 /**
26039 * Led::handle-set-blink-slow:
26040 * @object: A #Led.
26041 * @invocation: A #GDBusMethodInvocation.
26042 *
26043 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setBlinkSlow">setBlinkSlow()</link> D-Bus method.
26044 *
26045 * 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.
26046 *
26047 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
26048 */
26049 g_signal_new ("handle-set-blink-slow",
26050 G_TYPE_FROM_INTERFACE (iface),
26051 G_SIGNAL_RUN_LAST,
26052 G_STRUCT_OFFSET (LedIface, handle_set_blink_slow),
26053 g_signal_accumulator_true_handled,
26054 NULL,
26055 g_cclosure_marshal_generic,
26056 G_TYPE_BOOLEAN,
26057 1,
26058 G_TYPE_DBUS_METHOD_INVOCATION);
26059
26060 /**
26061 * Led::handle-set-blink-fast:
26062 * @object: A #Led.
26063 * @invocation: A #GDBusMethodInvocation.
26064 *
26065 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Led.setBlinkFast">setBlinkFast()</link> D-Bus method.
26066 *
26067 * 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.
26068 *
26069 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
26070 */
26071 g_signal_new ("handle-set-blink-fast",
26072 G_TYPE_FROM_INTERFACE (iface),
26073 G_SIGNAL_RUN_LAST,
26074 G_STRUCT_OFFSET (LedIface, handle_set_blink_fast),
26075 g_signal_accumulator_true_handled,
26076 NULL,
26077 g_cclosure_marshal_generic,
26078 G_TYPE_BOOLEAN,
26079 1,
26080 G_TYPE_DBUS_METHOD_INVOCATION);
26081
26082 /* GObject properties for D-Bus properties: */
26083 /**
26084 * Led:color:
26085 *
26086 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Led.color">"color"</link>.
26087 *
26088 * 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.
26089 */
26090 g_object_interface_install_property (iface,
26091 g_param_spec_int ("color", "color", "color", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
26092 /**
26093 * Led:function:
26094 *
26095 * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link>.
26096 *
26097 * 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.
26098 */
26099 g_object_interface_install_property (iface,
26100 g_param_spec_string ("function", "function", "function", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
26101}
26102
26103/**
26104 * led_get_color: (skip)
26105 * @object: A #Led.
26106 *
26107 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Led.color">"color"</link> D-Bus property.
26108 *
26109 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
26110 *
26111 * Returns: The property value.
26112 */
26113gint
26114led_get_color (Led *object)
26115{
26116 return LED_GET_IFACE (object)->get_color (object);
26117}
26118
26119/**
26120 * led_set_color: (skip)
26121 * @object: A #Led.
26122 * @value: The value to set.
26123 *
26124 * Sets the <link linkend="gdbus-property-org-openbmc-Led.color">"color"</link> D-Bus property to @value.
26125 *
26126 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
26127 */
26128void
26129led_set_color (Led *object, gint value)
26130{
26131 g_object_set (G_OBJECT (object), "color", value, NULL);
26132}
26133
26134/**
26135 * led_get_function: (skip)
26136 * @object: A #Led.
26137 *
26138 * Gets the value of the <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link> D-Bus property.
26139 *
26140 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
26141 *
26142 * <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>
26143 *
26144 * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
26145 */
26146const gchar *
26147led_get_function (Led *object)
26148{
26149 return LED_GET_IFACE (object)->get_function (object);
26150}
26151
26152/**
26153 * led_dup_function: (skip)
26154 * @object: A #Led.
26155 *
26156 * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link> D-Bus property.
26157 *
26158 * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
26159 *
26160 * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
26161 */
26162gchar *
26163led_dup_function (Led *object)
26164{
26165 gchar *value;
26166 g_object_get (G_OBJECT (object), "function", &value, NULL);
26167 return value;
26168}
26169
26170/**
26171 * led_set_function: (skip)
26172 * @object: A #Led.
26173 * @value: The value to set.
26174 *
26175 * Sets the <link linkend="gdbus-property-org-openbmc-Led.function">"function"</link> D-Bus property to @value.
26176 *
26177 * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
26178 */
26179void
26180led_set_function (Led *object, const gchar *value)
26181{
26182 g_object_set (G_OBJECT (object), "function", value, NULL);
26183}
26184
26185/**
26186 * led_call_set_on:
26187 * @proxy: A #LedProxy.
26188 * @cancellable: (allow-none): A #GCancellable or %NULL.
26189 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
26190 * @user_data: User data to pass to @callback.
26191 *
26192 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setOn">setOn()</link> D-Bus method on @proxy.
26193 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
26194 * You can then call led_call_set_on_finish() to get the result of the operation.
26195 *
26196 * See led_call_set_on_sync() for the synchronous, blocking version of this method.
26197 */
26198void
26199led_call_set_on (
26200 Led *proxy,
26201 GCancellable *cancellable,
26202 GAsyncReadyCallback callback,
26203 gpointer user_data)
26204{
26205 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
26206 "setOn",
26207 g_variant_new ("()"),
26208 G_DBUS_CALL_FLAGS_NONE,
26209 -1,
26210 cancellable,
26211 callback,
26212 user_data);
26213}
26214
26215/**
26216 * led_call_set_on_finish:
26217 * @proxy: A #LedProxy.
26218 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_on().
26219 * @error: Return location for error or %NULL.
26220 *
26221 * Finishes an operation started with led_call_set_on().
26222 *
26223 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
26224 */
26225gboolean
26226led_call_set_on_finish (
26227 Led *proxy,
26228 GAsyncResult *res,
26229 GError **error)
26230{
26231 GVariant *_ret;
26232 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
26233 if (_ret == NULL)
26234 goto _out;
26235 g_variant_get (_ret,
26236 "()");
26237 g_variant_unref (_ret);
26238_out:
26239 return _ret != NULL;
26240}
26241
26242/**
26243 * led_call_set_on_sync:
26244 * @proxy: A #LedProxy.
26245 * @cancellable: (allow-none): A #GCancellable or %NULL.
26246 * @error: Return location for error or %NULL.
26247 *
26248 * 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.
26249 *
26250 * See led_call_set_on() for the asynchronous version of this method.
26251 *
26252 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
26253 */
26254gboolean
26255led_call_set_on_sync (
26256 Led *proxy,
26257 GCancellable *cancellable,
26258 GError **error)
26259{
26260 GVariant *_ret;
26261 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
26262 "setOn",
26263 g_variant_new ("()"),
26264 G_DBUS_CALL_FLAGS_NONE,
26265 -1,
26266 cancellable,
26267 error);
26268 if (_ret == NULL)
26269 goto _out;
26270 g_variant_get (_ret,
26271 "()");
26272 g_variant_unref (_ret);
26273_out:
26274 return _ret != NULL;
26275}
26276
26277/**
26278 * led_call_set_off:
26279 * @proxy: A #LedProxy.
26280 * @cancellable: (allow-none): A #GCancellable or %NULL.
26281 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
26282 * @user_data: User data to pass to @callback.
26283 *
26284 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setOff">setOff()</link> D-Bus method on @proxy.
26285 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
26286 * You can then call led_call_set_off_finish() to get the result of the operation.
26287 *
26288 * See led_call_set_off_sync() for the synchronous, blocking version of this method.
26289 */
26290void
26291led_call_set_off (
26292 Led *proxy,
26293 GCancellable *cancellable,
26294 GAsyncReadyCallback callback,
26295 gpointer user_data)
26296{
26297 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
26298 "setOff",
26299 g_variant_new ("()"),
26300 G_DBUS_CALL_FLAGS_NONE,
26301 -1,
26302 cancellable,
26303 callback,
26304 user_data);
26305}
26306
26307/**
26308 * led_call_set_off_finish:
26309 * @proxy: A #LedProxy.
26310 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_off().
26311 * @error: Return location for error or %NULL.
26312 *
26313 * Finishes an operation started with led_call_set_off().
26314 *
26315 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
26316 */
26317gboolean
26318led_call_set_off_finish (
26319 Led *proxy,
26320 GAsyncResult *res,
26321 GError **error)
26322{
26323 GVariant *_ret;
26324 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
26325 if (_ret == NULL)
26326 goto _out;
26327 g_variant_get (_ret,
26328 "()");
26329 g_variant_unref (_ret);
26330_out:
26331 return _ret != NULL;
26332}
26333
26334/**
26335 * led_call_set_off_sync:
26336 * @proxy: A #LedProxy.
26337 * @cancellable: (allow-none): A #GCancellable or %NULL.
26338 * @error: Return location for error or %NULL.
26339 *
26340 * 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.
26341 *
26342 * See led_call_set_off() for the asynchronous version of this method.
26343 *
26344 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
26345 */
26346gboolean
26347led_call_set_off_sync (
26348 Led *proxy,
26349 GCancellable *cancellable,
26350 GError **error)
26351{
26352 GVariant *_ret;
26353 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
26354 "setOff",
26355 g_variant_new ("()"),
26356 G_DBUS_CALL_FLAGS_NONE,
26357 -1,
26358 cancellable,
26359 error);
26360 if (_ret == NULL)
26361 goto _out;
26362 g_variant_get (_ret,
26363 "()");
26364 g_variant_unref (_ret);
26365_out:
26366 return _ret != NULL;
26367}
26368
26369/**
26370 * led_call_set_blink_slow:
26371 * @proxy: A #LedProxy.
26372 * @cancellable: (allow-none): A #GCancellable or %NULL.
26373 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
26374 * @user_data: User data to pass to @callback.
26375 *
26376 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setBlinkSlow">setBlinkSlow()</link> D-Bus method on @proxy.
26377 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
26378 * You can then call led_call_set_blink_slow_finish() to get the result of the operation.
26379 *
26380 * See led_call_set_blink_slow_sync() for the synchronous, blocking version of this method.
26381 */
26382void
26383led_call_set_blink_slow (
26384 Led *proxy,
26385 GCancellable *cancellable,
26386 GAsyncReadyCallback callback,
26387 gpointer user_data)
26388{
26389 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
26390 "setBlinkSlow",
26391 g_variant_new ("()"),
26392 G_DBUS_CALL_FLAGS_NONE,
26393 -1,
26394 cancellable,
26395 callback,
26396 user_data);
26397}
26398
26399/**
26400 * led_call_set_blink_slow_finish:
26401 * @proxy: A #LedProxy.
26402 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_blink_slow().
26403 * @error: Return location for error or %NULL.
26404 *
26405 * Finishes an operation started with led_call_set_blink_slow().
26406 *
26407 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
26408 */
26409gboolean
26410led_call_set_blink_slow_finish (
26411 Led *proxy,
26412 GAsyncResult *res,
26413 GError **error)
26414{
26415 GVariant *_ret;
26416 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
26417 if (_ret == NULL)
26418 goto _out;
26419 g_variant_get (_ret,
26420 "()");
26421 g_variant_unref (_ret);
26422_out:
26423 return _ret != NULL;
26424}
26425
26426/**
26427 * led_call_set_blink_slow_sync:
26428 * @proxy: A #LedProxy.
26429 * @cancellable: (allow-none): A #GCancellable or %NULL.
26430 * @error: Return location for error or %NULL.
26431 *
26432 * 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.
26433 *
26434 * See led_call_set_blink_slow() for the asynchronous version of this method.
26435 *
26436 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
26437 */
26438gboolean
26439led_call_set_blink_slow_sync (
26440 Led *proxy,
26441 GCancellable *cancellable,
26442 GError **error)
26443{
26444 GVariant *_ret;
26445 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
26446 "setBlinkSlow",
26447 g_variant_new ("()"),
26448 G_DBUS_CALL_FLAGS_NONE,
26449 -1,
26450 cancellable,
26451 error);
26452 if (_ret == NULL)
26453 goto _out;
26454 g_variant_get (_ret,
26455 "()");
26456 g_variant_unref (_ret);
26457_out:
26458 return _ret != NULL;
26459}
26460
26461/**
26462 * led_call_set_blink_fast:
26463 * @proxy: A #LedProxy.
26464 * @cancellable: (allow-none): A #GCancellable or %NULL.
26465 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
26466 * @user_data: User data to pass to @callback.
26467 *
26468 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Led.setBlinkFast">setBlinkFast()</link> D-Bus method on @proxy.
26469 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
26470 * You can then call led_call_set_blink_fast_finish() to get the result of the operation.
26471 *
26472 * See led_call_set_blink_fast_sync() for the synchronous, blocking version of this method.
26473 */
26474void
26475led_call_set_blink_fast (
26476 Led *proxy,
26477 GCancellable *cancellable,
26478 GAsyncReadyCallback callback,
26479 gpointer user_data)
26480{
26481 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
26482 "setBlinkFast",
26483 g_variant_new ("()"),
26484 G_DBUS_CALL_FLAGS_NONE,
26485 -1,
26486 cancellable,
26487 callback,
26488 user_data);
26489}
26490
26491/**
26492 * led_call_set_blink_fast_finish:
26493 * @proxy: A #LedProxy.
26494 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_call_set_blink_fast().
26495 * @error: Return location for error or %NULL.
26496 *
26497 * Finishes an operation started with led_call_set_blink_fast().
26498 *
26499 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
26500 */
26501gboolean
26502led_call_set_blink_fast_finish (
26503 Led *proxy,
26504 GAsyncResult *res,
26505 GError **error)
26506{
26507 GVariant *_ret;
26508 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
26509 if (_ret == NULL)
26510 goto _out;
26511 g_variant_get (_ret,
26512 "()");
26513 g_variant_unref (_ret);
26514_out:
26515 return _ret != NULL;
26516}
26517
26518/**
26519 * led_call_set_blink_fast_sync:
26520 * @proxy: A #LedProxy.
26521 * @cancellable: (allow-none): A #GCancellable or %NULL.
26522 * @error: Return location for error or %NULL.
26523 *
26524 * 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.
26525 *
26526 * See led_call_set_blink_fast() for the asynchronous version of this method.
26527 *
26528 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
26529 */
26530gboolean
26531led_call_set_blink_fast_sync (
26532 Led *proxy,
26533 GCancellable *cancellable,
26534 GError **error)
26535{
26536 GVariant *_ret;
26537 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
26538 "setBlinkFast",
26539 g_variant_new ("()"),
26540 G_DBUS_CALL_FLAGS_NONE,
26541 -1,
26542 cancellable,
26543 error);
26544 if (_ret == NULL)
26545 goto _out;
26546 g_variant_get (_ret,
26547 "()");
26548 g_variant_unref (_ret);
26549_out:
26550 return _ret != NULL;
26551}
26552
26553/**
26554 * led_complete_set_on:
26555 * @object: A #Led.
26556 * @invocation: (transfer full): A #GDBusMethodInvocation.
26557 *
26558 * 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.
26559 *
26560 * This method will free @invocation, you cannot use it afterwards.
26561 */
26562void
26563led_complete_set_on (
26564 Led *object,
26565 GDBusMethodInvocation *invocation)
26566{
26567 g_dbus_method_invocation_return_value (invocation,
26568 g_variant_new ("()"));
26569}
26570
26571/**
26572 * led_complete_set_off:
26573 * @object: A #Led.
26574 * @invocation: (transfer full): A #GDBusMethodInvocation.
26575 *
26576 * 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.
26577 *
26578 * This method will free @invocation, you cannot use it afterwards.
26579 */
26580void
26581led_complete_set_off (
26582 Led *object,
26583 GDBusMethodInvocation *invocation)
26584{
26585 g_dbus_method_invocation_return_value (invocation,
26586 g_variant_new ("()"));
26587}
26588
26589/**
26590 * led_complete_set_blink_slow:
26591 * @object: A #Led.
26592 * @invocation: (transfer full): A #GDBusMethodInvocation.
26593 *
26594 * 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.
26595 *
26596 * This method will free @invocation, you cannot use it afterwards.
26597 */
26598void
26599led_complete_set_blink_slow (
26600 Led *object,
26601 GDBusMethodInvocation *invocation)
26602{
26603 g_dbus_method_invocation_return_value (invocation,
26604 g_variant_new ("()"));
26605}
26606
26607/**
26608 * led_complete_set_blink_fast:
26609 * @object: A #Led.
26610 * @invocation: (transfer full): A #GDBusMethodInvocation.
26611 *
26612 * 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.
26613 *
26614 * This method will free @invocation, you cannot use it afterwards.
26615 */
26616void
26617led_complete_set_blink_fast (
26618 Led *object,
26619 GDBusMethodInvocation *invocation)
26620{
26621 g_dbus_method_invocation_return_value (invocation,
26622 g_variant_new ("()"));
26623}
26624
26625/* ------------------------------------------------------------------------ */
26626
26627/**
26628 * LedProxy:
26629 *
26630 * The #LedProxy structure contains only private data and should only be accessed using the provided API.
26631 */
26632
26633/**
26634 * LedProxyClass:
26635 * @parent_class: The parent class.
26636 *
26637 * Class structure for #LedProxy.
26638 */
26639
26640struct _LedProxyPrivate
26641{
26642 GData *qdata;
26643};
26644
26645static void led_proxy_iface_init (LedIface *iface);
26646
26647#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
26648G_DEFINE_TYPE_WITH_CODE (LedProxy, led_proxy, G_TYPE_DBUS_PROXY,
26649 G_ADD_PRIVATE (LedProxy)
26650 G_IMPLEMENT_INTERFACE (TYPE_LED, led_proxy_iface_init));
26651
26652#else
26653G_DEFINE_TYPE_WITH_CODE (LedProxy, led_proxy, G_TYPE_DBUS_PROXY,
26654 G_IMPLEMENT_INTERFACE (TYPE_LED, led_proxy_iface_init));
26655
26656#endif
26657static void
26658led_proxy_finalize (GObject *object)
26659{
26660 LedProxy *proxy = LED_PROXY (object);
26661 g_datalist_clear (&proxy->priv->qdata);
26662 G_OBJECT_CLASS (led_proxy_parent_class)->finalize (object);
26663}
26664
26665static void
26666led_proxy_get_property (GObject *object,
26667 guint prop_id,
26668 GValue *value,
26669 GParamSpec *pspec G_GNUC_UNUSED)
26670{
26671 const _ExtendedGDBusPropertyInfo *info;
26672 GVariant *variant;
26673 g_assert (prop_id != 0 && prop_id - 1 < 2);
26674 info = _led_property_info_pointers[prop_id - 1];
26675 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
26676 if (info->use_gvariant)
26677 {
26678 g_value_set_variant (value, variant);
26679 }
26680 else
26681 {
26682 if (variant != NULL)
26683 g_dbus_gvariant_to_gvalue (variant, value);
26684 }
26685 if (variant != NULL)
26686 g_variant_unref (variant);
26687}
26688
26689static void
26690led_proxy_set_property_cb (GDBusProxy *proxy,
26691 GAsyncResult *res,
26692 gpointer user_data)
26693{
26694 const _ExtendedGDBusPropertyInfo *info = user_data;
26695 GError *error;
26696 GVariant *_ret;
26697 error = NULL;
26698 _ret = g_dbus_proxy_call_finish (proxy, res, &error);
26699 if (!_ret)
26700 {
26701 g_warning ("Error setting property '%s' on interface org.openbmc.Led: %s (%s, %d)",
26702 info->parent_struct.name,
26703 error->message, g_quark_to_string (error->domain), error->code);
26704 g_error_free (error);
26705 }
26706 else
26707 {
26708 g_variant_unref (_ret);
26709 }
26710}
26711
26712static void
26713led_proxy_set_property (GObject *object,
26714 guint prop_id,
26715 const GValue *value,
26716 GParamSpec *pspec G_GNUC_UNUSED)
26717{
26718 const _ExtendedGDBusPropertyInfo *info;
26719 GVariant *variant;
26720 g_assert (prop_id != 0 && prop_id - 1 < 2);
26721 info = _led_property_info_pointers[prop_id - 1];
26722 variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
26723 g_dbus_proxy_call (G_DBUS_PROXY (object),
26724 "org.freedesktop.DBus.Properties.Set",
26725 g_variant_new ("(ssv)", "org.openbmc.Led", info->parent_struct.name, variant),
26726 G_DBUS_CALL_FLAGS_NONE,
26727 -1,
26728 NULL, (GAsyncReadyCallback) led_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
26729 g_variant_unref (variant);
26730}
26731
26732static void
26733led_proxy_g_signal (GDBusProxy *proxy,
26734 const gchar *sender_name G_GNUC_UNUSED,
26735 const gchar *signal_name,
26736 GVariant *parameters)
26737{
26738 _ExtendedGDBusSignalInfo *info;
26739 GVariantIter iter;
26740 GVariant *child;
26741 GValue *paramv;
26742 guint num_params;
26743 guint n;
26744 guint signal_id;
26745 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, signal_name);
26746 if (info == NULL)
26747 return;
26748 num_params = g_variant_n_children (parameters);
26749 paramv = g_new0 (GValue, num_params + 1);
26750 g_value_init (&paramv[0], TYPE_LED);
26751 g_value_set_object (&paramv[0], proxy);
26752 g_variant_iter_init (&iter, parameters);
26753 n = 1;
26754 while ((child = g_variant_iter_next_value (&iter)) != NULL)
26755 {
26756 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
26757 if (arg_info->use_gvariant)
26758 {
26759 g_value_init (&paramv[n], G_TYPE_VARIANT);
26760 g_value_set_variant (&paramv[n], child);
26761 n++;
26762 }
26763 else
26764 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
26765 g_variant_unref (child);
26766 }
26767 signal_id = g_signal_lookup (info->signal_name, TYPE_LED);
26768 g_signal_emitv (paramv, signal_id, 0, NULL);
26769 for (n = 0; n < num_params + 1; n++)
26770 g_value_unset (&paramv[n]);
26771 g_free (paramv);
26772}
26773
26774static void
26775led_proxy_g_properties_changed (GDBusProxy *_proxy,
26776 GVariant *changed_properties,
26777 const gchar *const *invalidated_properties)
26778{
26779 LedProxy *proxy = LED_PROXY (_proxy);
26780 guint n;
26781 const gchar *key;
26782 GVariantIter *iter;
26783 _ExtendedGDBusPropertyInfo *info;
26784 g_variant_get (changed_properties, "a{sv}", &iter);
26785 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
26786 {
26787 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, key);
26788 g_datalist_remove_data (&proxy->priv->qdata, key);
26789 if (info != NULL)
26790 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
26791 }
26792 g_variant_iter_free (iter);
26793 for (n = 0; invalidated_properties[n] != NULL; n++)
26794 {
26795 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, invalidated_properties[n]);
26796 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
26797 if (info != NULL)
26798 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
26799 }
26800}
26801
26802static gint
26803led_proxy_get_color (Led *object)
26804{
26805 LedProxy *proxy = LED_PROXY (object);
26806 GVariant *variant;
26807 gint value = 0;
26808 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "color");
26809 if (variant != NULL)
26810 {
26811 value = g_variant_get_int32 (variant);
26812 g_variant_unref (variant);
26813 }
26814 return value;
26815}
26816
26817static const gchar *
26818led_proxy_get_function (Led *object)
26819{
26820 LedProxy *proxy = LED_PROXY (object);
26821 GVariant *variant;
26822 const gchar *value = NULL;
26823 variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "function");
26824 if (variant != NULL)
26825 {
26826 value = g_variant_get_string (variant, NULL);
26827 g_variant_unref (variant);
26828 }
26829 return value;
26830}
26831
26832static void
26833led_proxy_init (LedProxy *proxy)
26834{
26835#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
26836 proxy->priv = led_proxy_get_instance_private (proxy);
26837#else
26838 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_LED_PROXY, LedProxyPrivate);
26839#endif
26840
26841 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), led_interface_info ());
26842}
26843
26844static void
26845led_proxy_class_init (LedProxyClass *klass)
26846{
26847 GObjectClass *gobject_class;
26848 GDBusProxyClass *proxy_class;
26849
26850 gobject_class = G_OBJECT_CLASS (klass);
26851 gobject_class->finalize = led_proxy_finalize;
26852 gobject_class->get_property = led_proxy_get_property;
26853 gobject_class->set_property = led_proxy_set_property;
26854
26855 proxy_class = G_DBUS_PROXY_CLASS (klass);
26856 proxy_class->g_signal = led_proxy_g_signal;
26857 proxy_class->g_properties_changed = led_proxy_g_properties_changed;
26858
26859 led_override_properties (gobject_class, 1);
26860
26861#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
26862 g_type_class_add_private (klass, sizeof (LedProxyPrivate));
26863#endif
26864}
26865
26866static void
26867led_proxy_iface_init (LedIface *iface)
26868{
26869 iface->get_color = led_proxy_get_color;
26870 iface->get_function = led_proxy_get_function;
26871}
26872
26873/**
26874 * led_proxy_new:
26875 * @connection: A #GDBusConnection.
26876 * @flags: Flags from the #GDBusProxyFlags enumeration.
26877 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
26878 * @object_path: An object path.
26879 * @cancellable: (allow-none): A #GCancellable or %NULL.
26880 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
26881 * @user_data: User data to pass to @callback.
26882 *
26883 * 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.
26884 *
26885 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
26886 * You can then call led_proxy_new_finish() to get the result of the operation.
26887 *
26888 * See led_proxy_new_sync() for the synchronous, blocking version of this constructor.
26889 */
26890void
26891led_proxy_new (
26892 GDBusConnection *connection,
26893 GDBusProxyFlags flags,
26894 const gchar *name,
26895 const gchar *object_path,
26896 GCancellable *cancellable,
26897 GAsyncReadyCallback callback,
26898 gpointer user_data)
26899{
26900 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);
26901}
26902
26903/**
26904 * led_proxy_new_finish:
26905 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_proxy_new().
26906 * @error: Return location for error or %NULL
26907 *
26908 * Finishes an operation started with led_proxy_new().
26909 *
26910 * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set.
26911 */
26912Led *
26913led_proxy_new_finish (
26914 GAsyncResult *res,
26915 GError **error)
26916{
26917 GObject *ret;
26918 GObject *source_object;
26919 source_object = g_async_result_get_source_object (res);
26920 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
26921 g_object_unref (source_object);
26922 if (ret != NULL)
26923 return LED (ret);
26924 else
26925 return NULL;
26926}
26927
26928/**
26929 * led_proxy_new_sync:
26930 * @connection: A #GDBusConnection.
26931 * @flags: Flags from the #GDBusProxyFlags enumeration.
26932 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
26933 * @object_path: An object path.
26934 * @cancellable: (allow-none): A #GCancellable or %NULL.
26935 * @error: Return location for error or %NULL
26936 *
26937 * 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.
26938 *
26939 * The calling thread is blocked until a reply is received.
26940 *
26941 * See led_proxy_new() for the asynchronous version of this constructor.
26942 *
26943 * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set.
26944 */
26945Led *
26946led_proxy_new_sync (
26947 GDBusConnection *connection,
26948 GDBusProxyFlags flags,
26949 const gchar *name,
26950 const gchar *object_path,
26951 GCancellable *cancellable,
26952 GError **error)
26953{
26954 GInitable *ret;
26955 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);
26956 if (ret != NULL)
26957 return LED (ret);
26958 else
26959 return NULL;
26960}
26961
26962
26963/**
26964 * led_proxy_new_for_bus:
26965 * @bus_type: A #GBusType.
26966 * @flags: Flags from the #GDBusProxyFlags enumeration.
26967 * @name: A bus name (well-known or unique).
26968 * @object_path: An object path.
26969 * @cancellable: (allow-none): A #GCancellable or %NULL.
26970 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
26971 * @user_data: User data to pass to @callback.
26972 *
26973 * Like led_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
26974 *
26975 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
26976 * You can then call led_proxy_new_for_bus_finish() to get the result of the operation.
26977 *
26978 * See led_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
26979 */
26980void
26981led_proxy_new_for_bus (
26982 GBusType bus_type,
26983 GDBusProxyFlags flags,
26984 const gchar *name,
26985 const gchar *object_path,
26986 GCancellable *cancellable,
26987 GAsyncReadyCallback callback,
26988 gpointer user_data)
26989{
26990 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);
26991}
26992
26993/**
26994 * led_proxy_new_for_bus_finish:
26995 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to led_proxy_new_for_bus().
26996 * @error: Return location for error or %NULL
26997 *
26998 * Finishes an operation started with led_proxy_new_for_bus().
26999 *
27000 * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set.
27001 */
27002Led *
27003led_proxy_new_for_bus_finish (
27004 GAsyncResult *res,
27005 GError **error)
27006{
27007 GObject *ret;
27008 GObject *source_object;
27009 source_object = g_async_result_get_source_object (res);
27010 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
27011 g_object_unref (source_object);
27012 if (ret != NULL)
27013 return LED (ret);
27014 else
27015 return NULL;
27016}
27017
27018/**
27019 * led_proxy_new_for_bus_sync:
27020 * @bus_type: A #GBusType.
27021 * @flags: Flags from the #GDBusProxyFlags enumeration.
27022 * @name: A bus name (well-known or unique).
27023 * @object_path: An object path.
27024 * @cancellable: (allow-none): A #GCancellable or %NULL.
27025 * @error: Return location for error or %NULL
27026 *
27027 * Like led_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
27028 *
27029 * The calling thread is blocked until a reply is received.
27030 *
27031 * See led_proxy_new_for_bus() for the asynchronous version of this constructor.
27032 *
27033 * Returns: (transfer full) (type LedProxy): The constructed proxy object or %NULL if @error is set.
27034 */
27035Led *
27036led_proxy_new_for_bus_sync (
27037 GBusType bus_type,
27038 GDBusProxyFlags flags,
27039 const gchar *name,
27040 const gchar *object_path,
27041 GCancellable *cancellable,
27042 GError **error)
27043{
27044 GInitable *ret;
27045 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);
27046 if (ret != NULL)
27047 return LED (ret);
27048 else
27049 return NULL;
27050}
27051
27052
27053/* ------------------------------------------------------------------------ */
27054
27055/**
27056 * LedSkeleton:
27057 *
27058 * The #LedSkeleton structure contains only private data and should only be accessed using the provided API.
27059 */
27060
27061/**
27062 * LedSkeletonClass:
27063 * @parent_class: The parent class.
27064 *
27065 * Class structure for #LedSkeleton.
27066 */
27067
27068struct _LedSkeletonPrivate
27069{
27070 GValue *properties;
27071 GList *changed_properties;
27072 GSource *changed_properties_idle_source;
27073 GMainContext *context;
27074 GMutex lock;
27075};
27076
27077static void
27078_led_skeleton_handle_method_call (
27079 GDBusConnection *connection G_GNUC_UNUSED,
27080 const gchar *sender G_GNUC_UNUSED,
27081 const gchar *object_path G_GNUC_UNUSED,
27082 const gchar *interface_name,
27083 const gchar *method_name,
27084 GVariant *parameters,
27085 GDBusMethodInvocation *invocation,
27086 gpointer user_data)
27087{
27088 LedSkeleton *skeleton = LED_SKELETON (user_data);
27089 _ExtendedGDBusMethodInfo *info;
27090 GVariantIter iter;
27091 GVariant *child;
27092 GValue *paramv;
27093 guint num_params;
27094 guint num_extra;
27095 guint n;
27096 guint signal_id;
27097 GValue return_value = G_VALUE_INIT;
27098 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
27099 g_assert (info != NULL);
27100 num_params = g_variant_n_children (parameters);
27101 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
27102 n = 0;
27103 g_value_init (&paramv[n], TYPE_LED);
27104 g_value_set_object (&paramv[n++], skeleton);
27105 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
27106 g_value_set_object (&paramv[n++], invocation);
27107 if (info->pass_fdlist)
27108 {
27109#ifdef G_OS_UNIX
27110 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
27111 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
27112#else
27113 g_assert_not_reached ();
27114#endif
27115 }
27116 g_variant_iter_init (&iter, parameters);
27117 while ((child = g_variant_iter_next_value (&iter)) != NULL)
27118 {
27119 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
27120 if (arg_info->use_gvariant)
27121 {
27122 g_value_init (&paramv[n], G_TYPE_VARIANT);
27123 g_value_set_variant (&paramv[n], child);
27124 n++;
27125 }
27126 else
27127 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
27128 g_variant_unref (child);
27129 }
27130 signal_id = g_signal_lookup (info->signal_name, TYPE_LED);
27131 g_value_init (&return_value, G_TYPE_BOOLEAN);
27132 g_signal_emitv (paramv, signal_id, 0, &return_value);
27133 if (!g_value_get_boolean (&return_value))
27134 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);
27135 g_value_unset (&return_value);
27136 for (n = 0; n < num_params + num_extra; n++)
27137 g_value_unset (&paramv[n]);
27138 g_free (paramv);
27139}
27140
27141static GVariant *
27142_led_skeleton_handle_get_property (
27143 GDBusConnection *connection G_GNUC_UNUSED,
27144 const gchar *sender G_GNUC_UNUSED,
27145 const gchar *object_path G_GNUC_UNUSED,
27146 const gchar *interface_name G_GNUC_UNUSED,
27147 const gchar *property_name,
27148 GError **error,
27149 gpointer user_data)
27150{
27151 LedSkeleton *skeleton = LED_SKELETON (user_data);
27152 GValue value = G_VALUE_INIT;
27153 GParamSpec *pspec;
27154 _ExtendedGDBusPropertyInfo *info;
27155 GVariant *ret;
27156 ret = NULL;
27157 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, property_name);
27158 g_assert (info != NULL);
27159 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
27160 if (pspec == NULL)
27161 {
27162 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
27163 }
27164 else
27165 {
27166 g_value_init (&value, pspec->value_type);
27167 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
27168 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
27169 g_value_unset (&value);
27170 }
27171 return ret;
27172}
27173
27174static gboolean
27175_led_skeleton_handle_set_property (
27176 GDBusConnection *connection G_GNUC_UNUSED,
27177 const gchar *sender G_GNUC_UNUSED,
27178 const gchar *object_path G_GNUC_UNUSED,
27179 const gchar *interface_name G_GNUC_UNUSED,
27180 const gchar *property_name,
27181 GVariant *variant,
27182 GError **error,
27183 gpointer user_data)
27184{
27185 LedSkeleton *skeleton = LED_SKELETON (user_data);
27186 GValue value = G_VALUE_INIT;
27187 GParamSpec *pspec;
27188 _ExtendedGDBusPropertyInfo *info;
27189 gboolean ret;
27190 ret = FALSE;
27191 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_led_interface_info.parent_struct, property_name);
27192 g_assert (info != NULL);
27193 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
27194 if (pspec == NULL)
27195 {
27196 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
27197 }
27198 else
27199 {
27200 if (info->use_gvariant)
27201 g_value_set_variant (&value, variant);
27202 else
27203 g_dbus_gvariant_to_gvalue (variant, &value);
27204 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
27205 g_value_unset (&value);
27206 ret = TRUE;
27207 }
27208 return ret;
27209}
27210
27211static const GDBusInterfaceVTable _led_skeleton_vtable =
27212{
27213 _led_skeleton_handle_method_call,
27214 _led_skeleton_handle_get_property,
27215 _led_skeleton_handle_set_property,
27216 {NULL}
27217};
27218
27219static GDBusInterfaceInfo *
27220led_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
27221{
27222 return led_interface_info ();
27223}
27224
27225static GDBusInterfaceVTable *
27226led_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
27227{
27228 return (GDBusInterfaceVTable *) &_led_skeleton_vtable;
27229}
27230
27231static GVariant *
27232led_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
27233{
27234 LedSkeleton *skeleton = LED_SKELETON (_skeleton);
27235
27236 GVariantBuilder builder;
27237 guint n;
27238 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
27239 if (_led_interface_info.parent_struct.properties == NULL)
27240 goto out;
27241 for (n = 0; _led_interface_info.parent_struct.properties[n] != NULL; n++)
27242 {
27243 GDBusPropertyInfo *info = _led_interface_info.parent_struct.properties[n];
27244 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
27245 {
27246 GVariant *value;
27247 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);
27248 if (value != NULL)
27249 {
27250 g_variant_take_ref (value);
27251 g_variant_builder_add (&builder, "{sv}", info->name, value);
27252 g_variant_unref (value);
27253 }
27254 }
27255 }
27256out:
27257 return g_variant_builder_end (&builder);
27258}
27259
27260static gboolean _led_emit_changed (gpointer user_data);
27261
27262static void
27263led_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
27264{
27265 LedSkeleton *skeleton = LED_SKELETON (_skeleton);
27266 gboolean emit_changed = FALSE;
27267
27268 g_mutex_lock (&skeleton->priv->lock);
27269 if (skeleton->priv->changed_properties_idle_source != NULL)
27270 {
27271 g_source_destroy (skeleton->priv->changed_properties_idle_source);
27272 skeleton->priv->changed_properties_idle_source = NULL;
27273 emit_changed = TRUE;
27274 }
27275 g_mutex_unlock (&skeleton->priv->lock);
27276
27277 if (emit_changed)
27278 _led_emit_changed (skeleton);
27279}
27280
27281static void led_skeleton_iface_init (LedIface *iface);
27282#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
27283G_DEFINE_TYPE_WITH_CODE (LedSkeleton, led_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
27284 G_ADD_PRIVATE (LedSkeleton)
27285 G_IMPLEMENT_INTERFACE (TYPE_LED, led_skeleton_iface_init));
27286
27287#else
27288G_DEFINE_TYPE_WITH_CODE (LedSkeleton, led_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
27289 G_IMPLEMENT_INTERFACE (TYPE_LED, led_skeleton_iface_init));
27290
27291#endif
27292static void
27293led_skeleton_finalize (GObject *object)
27294{
27295 LedSkeleton *skeleton = LED_SKELETON (object);
27296 guint n;
27297 for (n = 0; n < 2; n++)
27298 g_value_unset (&skeleton->priv->properties[n]);
27299 g_free (skeleton->priv->properties);
27300 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
27301 if (skeleton->priv->changed_properties_idle_source != NULL)
27302 g_source_destroy (skeleton->priv->changed_properties_idle_source);
27303 g_main_context_unref (skeleton->priv->context);
27304 g_mutex_clear (&skeleton->priv->lock);
27305 G_OBJECT_CLASS (led_skeleton_parent_class)->finalize (object);
27306}
27307
27308static void
27309led_skeleton_get_property (GObject *object,
27310 guint prop_id,
27311 GValue *value,
27312 GParamSpec *pspec G_GNUC_UNUSED)
27313{
27314 LedSkeleton *skeleton = LED_SKELETON (object);
27315 g_assert (prop_id != 0 && prop_id - 1 < 2);
27316 g_mutex_lock (&skeleton->priv->lock);
27317 g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
27318 g_mutex_unlock (&skeleton->priv->lock);
27319}
27320
27321static gboolean
27322_led_emit_changed (gpointer user_data)
27323{
27324 LedSkeleton *skeleton = LED_SKELETON (user_data);
27325 GList *l;
27326 GVariantBuilder builder;
27327 GVariantBuilder invalidated_builder;
27328 guint num_changes;
27329
27330 g_mutex_lock (&skeleton->priv->lock);
27331 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
27332 g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
27333 for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
27334 {
27335 ChangedProperty *cp = l->data;
27336 GVariant *variant;
27337 const GValue *cur_value;
27338
27339 cur_value = &skeleton->priv->properties[cp->prop_id - 1];
27340 if (!_g_value_equal (cur_value, &cp->orig_value))
27341 {
27342 variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
27343 g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
27344 g_variant_unref (variant);
27345 num_changes++;
27346 }
27347 }
27348 if (num_changes > 0)
27349 {
27350 GList *connections, *ll;
27351 GVariant *signal_variant;
27352 signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.Led",
27353 &builder, &invalidated_builder));
27354 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
27355 for (ll = connections; ll != NULL; ll = ll->next)
27356 {
27357 GDBusConnection *connection = ll->data;
27358
27359 g_dbus_connection_emit_signal (connection,
27360 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
27361 "org.freedesktop.DBus.Properties",
27362 "PropertiesChanged",
27363 signal_variant,
27364 NULL);
27365 }
27366 g_variant_unref (signal_variant);
27367 g_list_free_full (connections, g_object_unref);
27368 }
27369 else
27370 {
27371 g_variant_builder_clear (&builder);
27372 g_variant_builder_clear (&invalidated_builder);
27373 }
27374 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
27375 skeleton->priv->changed_properties = NULL;
27376 skeleton->priv->changed_properties_idle_source = NULL;
27377 g_mutex_unlock (&skeleton->priv->lock);
27378 return FALSE;
27379}
27380
27381static void
27382_led_schedule_emit_changed (LedSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
27383{
27384 ChangedProperty *cp;
27385 GList *l;
27386 cp = NULL;
27387 for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
27388 {
27389 ChangedProperty *i_cp = l->data;
27390 if (i_cp->info == info)
27391 {
27392 cp = i_cp;
27393 break;
27394 }
27395 }
27396 if (cp == NULL)
27397 {
27398 cp = g_new0 (ChangedProperty, 1);
27399 cp->prop_id = prop_id;
27400 cp->info = info;
27401 skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
27402 g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
27403 g_value_copy (orig_value, &cp->orig_value);
27404 }
27405}
27406
27407static void
27408led_skeleton_notify (GObject *object,
27409 GParamSpec *pspec G_GNUC_UNUSED)
27410{
27411 LedSkeleton *skeleton = LED_SKELETON (object);
27412 g_mutex_lock (&skeleton->priv->lock);
27413 if (skeleton->priv->changed_properties != NULL &&
27414 skeleton->priv->changed_properties_idle_source == NULL)
27415 {
27416 skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
27417 g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
27418 g_source_set_callback (skeleton->priv->changed_properties_idle_source, _led_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
Adriana Kobylak2cb27752015-10-19 16:23:14 -050027419 g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _led_emit_changed");
Norman James362a80f2015-09-14 14:04:39 -050027420 g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
27421 g_source_unref (skeleton->priv->changed_properties_idle_source);
27422 }
27423 g_mutex_unlock (&skeleton->priv->lock);
27424}
27425
27426static void
27427led_skeleton_set_property (GObject *object,
27428 guint prop_id,
27429 const GValue *value,
27430 GParamSpec *pspec)
27431{
27432 LedSkeleton *skeleton = LED_SKELETON (object);
27433 g_assert (prop_id != 0 && prop_id - 1 < 2);
27434 g_mutex_lock (&skeleton->priv->lock);
27435 g_object_freeze_notify (object);
27436 if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
27437 {
27438 if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
27439 _led_schedule_emit_changed (skeleton, _led_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
27440 g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
27441 g_object_notify_by_pspec (object, pspec);
27442 }
27443 g_mutex_unlock (&skeleton->priv->lock);
27444 g_object_thaw_notify (object);
27445}
27446
27447static void
27448led_skeleton_init (LedSkeleton *skeleton)
27449{
27450#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
27451 skeleton->priv = led_skeleton_get_instance_private (skeleton);
27452#else
27453 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_LED_SKELETON, LedSkeletonPrivate);
27454#endif
27455
27456 g_mutex_init (&skeleton->priv->lock);
27457 skeleton->priv->context = g_main_context_ref_thread_default ();
27458 skeleton->priv->properties = g_new0 (GValue, 2);
27459 g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
27460 g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
27461}
27462
27463static gint
27464led_skeleton_get_color (Led *object)
27465{
27466 LedSkeleton *skeleton = LED_SKELETON (object);
27467 gint value;
27468 g_mutex_lock (&skeleton->priv->lock);
27469 value = g_value_get_int (&(skeleton->priv->properties[0]));
27470 g_mutex_unlock (&skeleton->priv->lock);
27471 return value;
27472}
27473
27474static const gchar *
27475led_skeleton_get_function (Led *object)
27476{
27477 LedSkeleton *skeleton = LED_SKELETON (object);
27478 const gchar *value;
27479 g_mutex_lock (&skeleton->priv->lock);
27480 value = g_value_get_string (&(skeleton->priv->properties[1]));
27481 g_mutex_unlock (&skeleton->priv->lock);
27482 return value;
27483}
27484
27485static void
27486led_skeleton_class_init (LedSkeletonClass *klass)
27487{
27488 GObjectClass *gobject_class;
27489 GDBusInterfaceSkeletonClass *skeleton_class;
27490
27491 gobject_class = G_OBJECT_CLASS (klass);
27492 gobject_class->finalize = led_skeleton_finalize;
27493 gobject_class->get_property = led_skeleton_get_property;
27494 gobject_class->set_property = led_skeleton_set_property;
27495 gobject_class->notify = led_skeleton_notify;
27496
27497
27498 led_override_properties (gobject_class, 1);
27499
27500 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
27501 skeleton_class->get_info = led_skeleton_dbus_interface_get_info;
27502 skeleton_class->get_properties = led_skeleton_dbus_interface_get_properties;
27503 skeleton_class->flush = led_skeleton_dbus_interface_flush;
27504 skeleton_class->get_vtable = led_skeleton_dbus_interface_get_vtable;
27505
27506#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
27507 g_type_class_add_private (klass, sizeof (LedSkeletonPrivate));
27508#endif
27509}
27510
27511static void
27512led_skeleton_iface_init (LedIface *iface)
27513{
27514 iface->get_color = led_skeleton_get_color;
27515 iface->get_function = led_skeleton_get_function;
27516}
27517
27518/**
27519 * led_skeleton_new:
27520 *
27521 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>.
27522 *
27523 * Returns: (transfer full) (type LedSkeleton): The skeleton object.
27524 */
27525Led *
27526led_skeleton_new (void)
27527{
27528 return LED (g_object_new (TYPE_LED_SKELETON, NULL));
27529}
27530
27531/* ------------------------------------------------------------------------
Norman Jamesdbcffbd2015-10-06 16:53:06 -050027532 * Code for interface org.openbmc.HostIpmi
27533 * ------------------------------------------------------------------------
27534 */
27535
27536/**
27537 * SECTION:HostIpmi
27538 * @title: HostIpmi
27539 * @short_description: Generated C code for the org.openbmc.HostIpmi D-Bus interface
27540 *
27541 * 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.
27542 */
27543
27544/* ---- Introspection data for org.openbmc.HostIpmi ---- */
27545
27546static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_IN_ARG_seq =
27547{
27548 {
27549 -1,
27550 (gchar *) "seq",
27551 (gchar *) "y",
27552 NULL
27553 },
27554 FALSE
27555};
27556
27557static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_IN_ARG_netfn =
27558{
27559 {
27560 -1,
27561 (gchar *) "netfn",
27562 (gchar *) "y",
27563 NULL
27564 },
27565 FALSE
27566};
27567
27568static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_IN_ARG_cmd =
27569{
27570 {
27571 -1,
27572 (gchar *) "cmd",
27573 (gchar *) "y",
27574 NULL
27575 },
27576 FALSE
27577};
27578
27579static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_IN_ARG_data =
27580{
27581 {
27582 -1,
27583 (gchar *) "data",
27584 (gchar *) "ay",
27585 NULL
27586 },
27587 FALSE
27588};
27589
27590static const _ExtendedGDBusArgInfo * const _host_ipmi_method_info_send_message_IN_ARG_pointers[] =
27591{
27592 &_host_ipmi_method_info_send_message_IN_ARG_seq,
27593 &_host_ipmi_method_info_send_message_IN_ARG_netfn,
27594 &_host_ipmi_method_info_send_message_IN_ARG_cmd,
27595 &_host_ipmi_method_info_send_message_IN_ARG_data,
27596 NULL
27597};
27598
27599static const _ExtendedGDBusArgInfo _host_ipmi_method_info_send_message_OUT_ARG_unnamed_arg4 =
27600{
27601 {
27602 -1,
27603 (gchar *) "unnamed_arg4",
27604 (gchar *) "x",
27605 NULL
27606 },
27607 FALSE
27608};
27609
27610static const _ExtendedGDBusArgInfo * const _host_ipmi_method_info_send_message_OUT_ARG_pointers[] =
27611{
27612 &_host_ipmi_method_info_send_message_OUT_ARG_unnamed_arg4,
27613 NULL
27614};
27615
27616static const _ExtendedGDBusMethodInfo _host_ipmi_method_info_send_message =
27617{
27618 {
27619 -1,
27620 (gchar *) "sendMessage",
27621 (GDBusArgInfo **) &_host_ipmi_method_info_send_message_IN_ARG_pointers,
27622 (GDBusArgInfo **) &_host_ipmi_method_info_send_message_OUT_ARG_pointers,
27623 NULL
27624 },
27625 "handle-send-message",
27626 FALSE
27627};
27628
27629static const _ExtendedGDBusMethodInfo * const _host_ipmi_method_info_pointers[] =
27630{
27631 &_host_ipmi_method_info_send_message,
27632 NULL
27633};
27634
27635static const _ExtendedGDBusArgInfo _host_ipmi_signal_info_received_message_ARG_seq =
27636{
27637 {
27638 -1,
27639 (gchar *) "seq",
27640 (gchar *) "y",
27641 NULL
27642 },
27643 FALSE
27644};
27645
27646static const _ExtendedGDBusArgInfo _host_ipmi_signal_info_received_message_ARG_netfn =
27647{
27648 {
27649 -1,
27650 (gchar *) "netfn",
27651 (gchar *) "y",
27652 NULL
27653 },
27654 FALSE
27655};
27656
27657static const _ExtendedGDBusArgInfo _host_ipmi_signal_info_received_message_ARG_cmd =
27658{
27659 {
27660 -1,
27661 (gchar *) "cmd",
27662 (gchar *) "y",
27663 NULL
27664 },
27665 FALSE
27666};
27667
27668static const _ExtendedGDBusArgInfo _host_ipmi_signal_info_received_message_ARG_data =
27669{
27670 {
27671 -1,
27672 (gchar *) "data",
27673 (gchar *) "ay",
27674 NULL
27675 },
27676 FALSE
27677};
27678
27679static const _ExtendedGDBusArgInfo * const _host_ipmi_signal_info_received_message_ARG_pointers[] =
27680{
27681 &_host_ipmi_signal_info_received_message_ARG_seq,
27682 &_host_ipmi_signal_info_received_message_ARG_netfn,
27683 &_host_ipmi_signal_info_received_message_ARG_cmd,
27684 &_host_ipmi_signal_info_received_message_ARG_data,
27685 NULL
27686};
27687
27688static const _ExtendedGDBusSignalInfo _host_ipmi_signal_info_received_message =
27689{
27690 {
27691 -1,
27692 (gchar *) "ReceivedMessage",
27693 (GDBusArgInfo **) &_host_ipmi_signal_info_received_message_ARG_pointers,
27694 NULL
27695 },
27696 "received-message"
27697};
27698
27699static const _ExtendedGDBusSignalInfo * const _host_ipmi_signal_info_pointers[] =
27700{
27701 &_host_ipmi_signal_info_received_message,
27702 NULL
27703};
27704
27705static const _ExtendedGDBusInterfaceInfo _host_ipmi_interface_info =
27706{
27707 {
27708 -1,
27709 (gchar *) "org.openbmc.HostIpmi",
27710 (GDBusMethodInfo **) &_host_ipmi_method_info_pointers,
27711 (GDBusSignalInfo **) &_host_ipmi_signal_info_pointers,
27712 NULL,
27713 NULL
27714 },
27715 "host-ipmi",
27716};
27717
27718
27719/**
27720 * host_ipmi_interface_info:
27721 *
27722 * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link> D-Bus interface.
27723 *
27724 * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
27725 */
27726GDBusInterfaceInfo *
27727host_ipmi_interface_info (void)
27728{
27729 return (GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct;
27730}
27731
27732/**
27733 * host_ipmi_override_properties:
27734 * @klass: The class structure for a #GObject<!-- -->-derived class.
27735 * @property_id_begin: The property id to assign to the first overridden property.
27736 *
27737 * Overrides all #GObject properties in the #HostIpmi interface for a concrete class.
27738 * The properties are overridden in the order they are defined.
27739 *
27740 * Returns: The last property id.
27741 */
27742guint
27743host_ipmi_override_properties (GObjectClass *klass, guint property_id_begin)
27744{
27745 return property_id_begin - 1;
27746}
27747
27748
27749
27750/**
27751 * HostIpmi:
27752 *
27753 * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link>.
27754 */
27755
27756/**
27757 * HostIpmiIface:
27758 * @parent_iface: The parent interface.
27759 * @handle_send_message: Handler for the #HostIpmi::handle-send-message signal.
27760 * @received_message: Handler for the #HostIpmi::received-message signal.
27761 *
27762 * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link>.
27763 */
27764
27765typedef HostIpmiIface HostIpmiInterface;
27766G_DEFINE_INTERFACE (HostIpmi, host_ipmi, G_TYPE_OBJECT);
27767
27768static void
27769host_ipmi_default_init (HostIpmiIface *iface)
27770{
27771 /* GObject signals for incoming D-Bus method calls: */
27772 /**
27773 * HostIpmi::handle-send-message:
27774 * @object: A #HostIpmi.
27775 * @invocation: A #GDBusMethodInvocation.
27776 * @arg_seq: Argument passed by remote caller.
27777 * @arg_netfn: Argument passed by remote caller.
27778 * @arg_cmd: Argument passed by remote caller.
27779 * @arg_data: Argument passed by remote caller.
27780 *
27781 * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-HostIpmi.sendMessage">sendMessage()</link> D-Bus method.
27782 *
27783 * 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.
27784 *
27785 * Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
27786 */
27787 g_signal_new ("handle-send-message",
27788 G_TYPE_FROM_INTERFACE (iface),
27789 G_SIGNAL_RUN_LAST,
27790 G_STRUCT_OFFSET (HostIpmiIface, handle_send_message),
27791 g_signal_accumulator_true_handled,
27792 NULL,
27793 g_cclosure_marshal_generic,
27794 G_TYPE_BOOLEAN,
27795 5,
27796 G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_UCHAR, G_TYPE_UCHAR, G_TYPE_UCHAR, G_TYPE_STRING);
27797
27798 /* GObject signals for received D-Bus signals: */
27799 /**
27800 * HostIpmi::received-message:
27801 * @object: A #HostIpmi.
27802 * @arg_seq: Argument.
27803 * @arg_netfn: Argument.
27804 * @arg_cmd: Argument.
27805 * @arg_data: Argument.
27806 *
27807 * 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.
27808 *
27809 * 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.
27810 */
27811 g_signal_new ("received-message",
27812 G_TYPE_FROM_INTERFACE (iface),
27813 G_SIGNAL_RUN_LAST,
27814 G_STRUCT_OFFSET (HostIpmiIface, received_message),
27815 NULL,
27816 NULL,
27817 g_cclosure_marshal_generic,
27818 G_TYPE_NONE,
27819 4, G_TYPE_UCHAR, G_TYPE_UCHAR, G_TYPE_UCHAR, G_TYPE_STRING);
27820
27821}
27822
27823/**
27824 * host_ipmi_emit_received_message:
27825 * @object: A #HostIpmi.
27826 * @arg_seq: Argument to pass with the signal.
27827 * @arg_netfn: Argument to pass with the signal.
27828 * @arg_cmd: Argument to pass with the signal.
27829 * @arg_data: Argument to pass with the signal.
27830 *
27831 * Emits the <link linkend="gdbus-signal-org-openbmc-HostIpmi.ReceivedMessage">"ReceivedMessage"</link> D-Bus signal.
27832 */
27833void
27834host_ipmi_emit_received_message (
27835 HostIpmi *object,
27836 guchar arg_seq,
27837 guchar arg_netfn,
27838 guchar arg_cmd,
27839 const gchar *arg_data)
27840{
27841 g_signal_emit_by_name (object, "received-message", arg_seq, arg_netfn, arg_cmd, arg_data);
27842}
27843
27844/**
27845 * host_ipmi_call_send_message:
27846 * @proxy: A #HostIpmiProxy.
27847 * @arg_seq: Argument to pass with the method invocation.
27848 * @arg_netfn: Argument to pass with the method invocation.
27849 * @arg_cmd: Argument to pass with the method invocation.
27850 * @arg_data: Argument to pass with the method invocation.
27851 * @cancellable: (allow-none): A #GCancellable or %NULL.
27852 * @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
27853 * @user_data: User data to pass to @callback.
27854 *
27855 * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-HostIpmi.sendMessage">sendMessage()</link> D-Bus method on @proxy.
27856 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
27857 * You can then call host_ipmi_call_send_message_finish() to get the result of the operation.
27858 *
27859 * See host_ipmi_call_send_message_sync() for the synchronous, blocking version of this method.
27860 */
27861void
27862host_ipmi_call_send_message (
27863 HostIpmi *proxy,
27864 guchar arg_seq,
27865 guchar arg_netfn,
27866 guchar arg_cmd,
27867 const gchar *arg_data,
27868 GCancellable *cancellable,
27869 GAsyncReadyCallback callback,
27870 gpointer user_data)
27871{
27872 g_dbus_proxy_call (G_DBUS_PROXY (proxy),
27873 "sendMessage",
27874 g_variant_new ("(yyy^ay)",
27875 arg_seq,
27876 arg_netfn,
27877 arg_cmd,
27878 arg_data),
27879 G_DBUS_CALL_FLAGS_NONE,
27880 -1,
27881 cancellable,
27882 callback,
27883 user_data);
27884}
27885
27886/**
27887 * host_ipmi_call_send_message_finish:
27888 * @proxy: A #HostIpmiProxy.
27889 * @out_unnamed_arg4: (out): Return location for return parameter or %NULL to ignore.
27890 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to host_ipmi_call_send_message().
27891 * @error: Return location for error or %NULL.
27892 *
27893 * Finishes an operation started with host_ipmi_call_send_message().
27894 *
27895 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
27896 */
27897gboolean
27898host_ipmi_call_send_message_finish (
27899 HostIpmi *proxy,
27900 gint64 *out_unnamed_arg4,
27901 GAsyncResult *res,
27902 GError **error)
27903{
27904 GVariant *_ret;
27905 _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
27906 if (_ret == NULL)
27907 goto _out;
27908 g_variant_get (_ret,
27909 "(x)",
27910 out_unnamed_arg4);
27911 g_variant_unref (_ret);
27912_out:
27913 return _ret != NULL;
27914}
27915
27916/**
27917 * host_ipmi_call_send_message_sync:
27918 * @proxy: A #HostIpmiProxy.
27919 * @arg_seq: Argument to pass with the method invocation.
27920 * @arg_netfn: Argument to pass with the method invocation.
27921 * @arg_cmd: Argument to pass with the method invocation.
27922 * @arg_data: Argument to pass with the method invocation.
27923 * @out_unnamed_arg4: (out): Return location for return parameter or %NULL to ignore.
27924 * @cancellable: (allow-none): A #GCancellable or %NULL.
27925 * @error: Return location for error or %NULL.
27926 *
27927 * 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.
27928 *
27929 * See host_ipmi_call_send_message() for the asynchronous version of this method.
27930 *
27931 * Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
27932 */
27933gboolean
27934host_ipmi_call_send_message_sync (
27935 HostIpmi *proxy,
27936 guchar arg_seq,
27937 guchar arg_netfn,
27938 guchar arg_cmd,
27939 const gchar *arg_data,
27940 gint64 *out_unnamed_arg4,
27941 GCancellable *cancellable,
27942 GError **error)
27943{
27944 GVariant *_ret;
27945 _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
27946 "sendMessage",
27947 g_variant_new ("(yyy^ay)",
27948 arg_seq,
27949 arg_netfn,
27950 arg_cmd,
27951 arg_data),
27952 G_DBUS_CALL_FLAGS_NONE,
27953 -1,
27954 cancellable,
27955 error);
27956 if (_ret == NULL)
27957 goto _out;
27958 g_variant_get (_ret,
27959 "(x)",
27960 out_unnamed_arg4);
27961 g_variant_unref (_ret);
27962_out:
27963 return _ret != NULL;
27964}
27965
27966/**
27967 * host_ipmi_complete_send_message:
27968 * @object: A #HostIpmi.
27969 * @invocation: (transfer full): A #GDBusMethodInvocation.
27970 * @unnamed_arg4: Parameter to return.
27971 *
27972 * 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.
27973 *
27974 * This method will free @invocation, you cannot use it afterwards.
27975 */
27976void
27977host_ipmi_complete_send_message (
27978 HostIpmi *object,
27979 GDBusMethodInvocation *invocation,
27980 gint64 unnamed_arg4)
27981{
27982 g_dbus_method_invocation_return_value (invocation,
27983 g_variant_new ("(x)",
27984 unnamed_arg4));
27985}
27986
27987/* ------------------------------------------------------------------------ */
27988
27989/**
27990 * HostIpmiProxy:
27991 *
27992 * The #HostIpmiProxy structure contains only private data and should only be accessed using the provided API.
27993 */
27994
27995/**
27996 * HostIpmiProxyClass:
27997 * @parent_class: The parent class.
27998 *
27999 * Class structure for #HostIpmiProxy.
28000 */
28001
28002struct _HostIpmiProxyPrivate
28003{
28004 GData *qdata;
28005};
28006
28007static void host_ipmi_proxy_iface_init (HostIpmiIface *iface);
28008
28009#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
28010G_DEFINE_TYPE_WITH_CODE (HostIpmiProxy, host_ipmi_proxy, G_TYPE_DBUS_PROXY,
28011 G_ADD_PRIVATE (HostIpmiProxy)
28012 G_IMPLEMENT_INTERFACE (TYPE_HOST_IPMI, host_ipmi_proxy_iface_init));
28013
28014#else
28015G_DEFINE_TYPE_WITH_CODE (HostIpmiProxy, host_ipmi_proxy, G_TYPE_DBUS_PROXY,
28016 G_IMPLEMENT_INTERFACE (TYPE_HOST_IPMI, host_ipmi_proxy_iface_init));
28017
28018#endif
28019static void
28020host_ipmi_proxy_finalize (GObject *object)
28021{
28022 HostIpmiProxy *proxy = HOST_IPMI_PROXY (object);
28023 g_datalist_clear (&proxy->priv->qdata);
28024 G_OBJECT_CLASS (host_ipmi_proxy_parent_class)->finalize (object);
28025}
28026
28027static void
28028host_ipmi_proxy_get_property (GObject *object,
28029 guint prop_id,
28030 GValue *value,
28031 GParamSpec *pspec G_GNUC_UNUSED)
28032{
28033}
28034
28035static void
28036host_ipmi_proxy_set_property (GObject *object,
28037 guint prop_id,
28038 const GValue *value,
28039 GParamSpec *pspec G_GNUC_UNUSED)
28040{
28041}
28042
28043static void
28044host_ipmi_proxy_g_signal (GDBusProxy *proxy,
28045 const gchar *sender_name G_GNUC_UNUSED,
28046 const gchar *signal_name,
28047 GVariant *parameters)
28048{
28049 _ExtendedGDBusSignalInfo *info;
28050 GVariantIter iter;
28051 GVariant *child;
28052 GValue *paramv;
28053 guint num_params;
28054 guint n;
28055 guint signal_id;
28056 info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, signal_name);
28057 if (info == NULL)
28058 return;
28059 num_params = g_variant_n_children (parameters);
28060 paramv = g_new0 (GValue, num_params + 1);
28061 g_value_init (&paramv[0], TYPE_HOST_IPMI);
28062 g_value_set_object (&paramv[0], proxy);
28063 g_variant_iter_init (&iter, parameters);
28064 n = 1;
28065 while ((child = g_variant_iter_next_value (&iter)) != NULL)
28066 {
28067 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
28068 if (arg_info->use_gvariant)
28069 {
28070 g_value_init (&paramv[n], G_TYPE_VARIANT);
28071 g_value_set_variant (&paramv[n], child);
28072 n++;
28073 }
28074 else
28075 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
28076 g_variant_unref (child);
28077 }
28078 signal_id = g_signal_lookup (info->signal_name, TYPE_HOST_IPMI);
28079 g_signal_emitv (paramv, signal_id, 0, NULL);
28080 for (n = 0; n < num_params + 1; n++)
28081 g_value_unset (&paramv[n]);
28082 g_free (paramv);
28083}
28084
28085static void
28086host_ipmi_proxy_g_properties_changed (GDBusProxy *_proxy,
28087 GVariant *changed_properties,
28088 const gchar *const *invalidated_properties)
28089{
28090 HostIpmiProxy *proxy = HOST_IPMI_PROXY (_proxy);
28091 guint n;
28092 const gchar *key;
28093 GVariantIter *iter;
28094 _ExtendedGDBusPropertyInfo *info;
28095 g_variant_get (changed_properties, "a{sv}", &iter);
28096 while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
28097 {
28098 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, key);
28099 g_datalist_remove_data (&proxy->priv->qdata, key);
28100 if (info != NULL)
28101 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
28102 }
28103 g_variant_iter_free (iter);
28104 for (n = 0; invalidated_properties[n] != NULL; n++)
28105 {
28106 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, invalidated_properties[n]);
28107 g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
28108 if (info != NULL)
28109 g_object_notify (G_OBJECT (proxy), info->hyphen_name);
28110 }
28111}
28112
28113static void
28114host_ipmi_proxy_init (HostIpmiProxy *proxy)
28115{
28116#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
28117 proxy->priv = host_ipmi_proxy_get_instance_private (proxy);
28118#else
28119 proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_HOST_IPMI_PROXY, HostIpmiProxyPrivate);
28120#endif
28121
28122 g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), host_ipmi_interface_info ());
28123}
28124
28125static void
28126host_ipmi_proxy_class_init (HostIpmiProxyClass *klass)
28127{
28128 GObjectClass *gobject_class;
28129 GDBusProxyClass *proxy_class;
28130
28131 gobject_class = G_OBJECT_CLASS (klass);
28132 gobject_class->finalize = host_ipmi_proxy_finalize;
28133 gobject_class->get_property = host_ipmi_proxy_get_property;
28134 gobject_class->set_property = host_ipmi_proxy_set_property;
28135
28136 proxy_class = G_DBUS_PROXY_CLASS (klass);
28137 proxy_class->g_signal = host_ipmi_proxy_g_signal;
28138 proxy_class->g_properties_changed = host_ipmi_proxy_g_properties_changed;
28139
28140#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
28141 g_type_class_add_private (klass, sizeof (HostIpmiProxyPrivate));
28142#endif
28143}
28144
28145static void
28146host_ipmi_proxy_iface_init (HostIpmiIface *iface)
28147{
28148}
28149
28150/**
28151 * host_ipmi_proxy_new:
28152 * @connection: A #GDBusConnection.
28153 * @flags: Flags from the #GDBusProxyFlags enumeration.
28154 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
28155 * @object_path: An object path.
28156 * @cancellable: (allow-none): A #GCancellable or %NULL.
28157 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
28158 * @user_data: User data to pass to @callback.
28159 *
28160 * 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.
28161 *
28162 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
28163 * You can then call host_ipmi_proxy_new_finish() to get the result of the operation.
28164 *
28165 * See host_ipmi_proxy_new_sync() for the synchronous, blocking version of this constructor.
28166 */
28167void
28168host_ipmi_proxy_new (
28169 GDBusConnection *connection,
28170 GDBusProxyFlags flags,
28171 const gchar *name,
28172 const gchar *object_path,
28173 GCancellable *cancellable,
28174 GAsyncReadyCallback callback,
28175 gpointer user_data)
28176{
28177 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);
28178}
28179
28180/**
28181 * host_ipmi_proxy_new_finish:
28182 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to host_ipmi_proxy_new().
28183 * @error: Return location for error or %NULL
28184 *
28185 * Finishes an operation started with host_ipmi_proxy_new().
28186 *
28187 * Returns: (transfer full) (type HostIpmiProxy): The constructed proxy object or %NULL if @error is set.
28188 */
28189HostIpmi *
28190host_ipmi_proxy_new_finish (
28191 GAsyncResult *res,
28192 GError **error)
28193{
28194 GObject *ret;
28195 GObject *source_object;
28196 source_object = g_async_result_get_source_object (res);
28197 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
28198 g_object_unref (source_object);
28199 if (ret != NULL)
28200 return HOST_IPMI (ret);
28201 else
28202 return NULL;
28203}
28204
28205/**
28206 * host_ipmi_proxy_new_sync:
28207 * @connection: A #GDBusConnection.
28208 * @flags: Flags from the #GDBusProxyFlags enumeration.
28209 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
28210 * @object_path: An object path.
28211 * @cancellable: (allow-none): A #GCancellable or %NULL.
28212 * @error: Return location for error or %NULL
28213 *
28214 * 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.
28215 *
28216 * The calling thread is blocked until a reply is received.
28217 *
28218 * See host_ipmi_proxy_new() for the asynchronous version of this constructor.
28219 *
28220 * Returns: (transfer full) (type HostIpmiProxy): The constructed proxy object or %NULL if @error is set.
28221 */
28222HostIpmi *
28223host_ipmi_proxy_new_sync (
28224 GDBusConnection *connection,
28225 GDBusProxyFlags flags,
28226 const gchar *name,
28227 const gchar *object_path,
28228 GCancellable *cancellable,
28229 GError **error)
28230{
28231 GInitable *ret;
28232 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);
28233 if (ret != NULL)
28234 return HOST_IPMI (ret);
28235 else
28236 return NULL;
28237}
28238
28239
28240/**
28241 * host_ipmi_proxy_new_for_bus:
28242 * @bus_type: A #GBusType.
28243 * @flags: Flags from the #GDBusProxyFlags enumeration.
28244 * @name: A bus name (well-known or unique).
28245 * @object_path: An object path.
28246 * @cancellable: (allow-none): A #GCancellable or %NULL.
28247 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
28248 * @user_data: User data to pass to @callback.
28249 *
28250 * Like host_ipmi_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
28251 *
28252 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
28253 * You can then call host_ipmi_proxy_new_for_bus_finish() to get the result of the operation.
28254 *
28255 * See host_ipmi_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
28256 */
28257void
28258host_ipmi_proxy_new_for_bus (
28259 GBusType bus_type,
28260 GDBusProxyFlags flags,
28261 const gchar *name,
28262 const gchar *object_path,
28263 GCancellable *cancellable,
28264 GAsyncReadyCallback callback,
28265 gpointer user_data)
28266{
28267 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);
28268}
28269
28270/**
28271 * host_ipmi_proxy_new_for_bus_finish:
28272 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to host_ipmi_proxy_new_for_bus().
28273 * @error: Return location for error or %NULL
28274 *
28275 * Finishes an operation started with host_ipmi_proxy_new_for_bus().
28276 *
28277 * Returns: (transfer full) (type HostIpmiProxy): The constructed proxy object or %NULL if @error is set.
28278 */
28279HostIpmi *
28280host_ipmi_proxy_new_for_bus_finish (
28281 GAsyncResult *res,
28282 GError **error)
28283{
28284 GObject *ret;
28285 GObject *source_object;
28286 source_object = g_async_result_get_source_object (res);
28287 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
28288 g_object_unref (source_object);
28289 if (ret != NULL)
28290 return HOST_IPMI (ret);
28291 else
28292 return NULL;
28293}
28294
28295/**
28296 * host_ipmi_proxy_new_for_bus_sync:
28297 * @bus_type: A #GBusType.
28298 * @flags: Flags from the #GDBusProxyFlags enumeration.
28299 * @name: A bus name (well-known or unique).
28300 * @object_path: An object path.
28301 * @cancellable: (allow-none): A #GCancellable or %NULL.
28302 * @error: Return location for error or %NULL
28303 *
28304 * Like host_ipmi_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
28305 *
28306 * The calling thread is blocked until a reply is received.
28307 *
28308 * See host_ipmi_proxy_new_for_bus() for the asynchronous version of this constructor.
28309 *
28310 * Returns: (transfer full) (type HostIpmiProxy): The constructed proxy object or %NULL if @error is set.
28311 */
28312HostIpmi *
28313host_ipmi_proxy_new_for_bus_sync (
28314 GBusType bus_type,
28315 GDBusProxyFlags flags,
28316 const gchar *name,
28317 const gchar *object_path,
28318 GCancellable *cancellable,
28319 GError **error)
28320{
28321 GInitable *ret;
28322 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);
28323 if (ret != NULL)
28324 return HOST_IPMI (ret);
28325 else
28326 return NULL;
28327}
28328
28329
28330/* ------------------------------------------------------------------------ */
28331
28332/**
28333 * HostIpmiSkeleton:
28334 *
28335 * The #HostIpmiSkeleton structure contains only private data and should only be accessed using the provided API.
28336 */
28337
28338/**
28339 * HostIpmiSkeletonClass:
28340 * @parent_class: The parent class.
28341 *
28342 * Class structure for #HostIpmiSkeleton.
28343 */
28344
28345struct _HostIpmiSkeletonPrivate
28346{
28347 GValue *properties;
28348 GList *changed_properties;
28349 GSource *changed_properties_idle_source;
28350 GMainContext *context;
28351 GMutex lock;
28352};
28353
28354static void
28355_host_ipmi_skeleton_handle_method_call (
28356 GDBusConnection *connection G_GNUC_UNUSED,
28357 const gchar *sender G_GNUC_UNUSED,
28358 const gchar *object_path G_GNUC_UNUSED,
28359 const gchar *interface_name,
28360 const gchar *method_name,
28361 GVariant *parameters,
28362 GDBusMethodInvocation *invocation,
28363 gpointer user_data)
28364{
28365 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (user_data);
28366 _ExtendedGDBusMethodInfo *info;
28367 GVariantIter iter;
28368 GVariant *child;
28369 GValue *paramv;
28370 guint num_params;
28371 guint num_extra;
28372 guint n;
28373 guint signal_id;
28374 GValue return_value = G_VALUE_INIT;
28375 info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
28376 g_assert (info != NULL);
28377 num_params = g_variant_n_children (parameters);
28378 num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
28379 n = 0;
28380 g_value_init (&paramv[n], TYPE_HOST_IPMI);
28381 g_value_set_object (&paramv[n++], skeleton);
28382 g_value_init (&paramv[n], G_TYPE_DBUS_METHOD_INVOCATION);
28383 g_value_set_object (&paramv[n++], invocation);
28384 if (info->pass_fdlist)
28385 {
28386#ifdef G_OS_UNIX
28387 g_value_init (&paramv[n], G_TYPE_UNIX_FD_LIST);
28388 g_value_set_object (&paramv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
28389#else
28390 g_assert_not_reached ();
28391#endif
28392 }
28393 g_variant_iter_init (&iter, parameters);
28394 while ((child = g_variant_iter_next_value (&iter)) != NULL)
28395 {
28396 _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
28397 if (arg_info->use_gvariant)
28398 {
28399 g_value_init (&paramv[n], G_TYPE_VARIANT);
28400 g_value_set_variant (&paramv[n], child);
28401 n++;
28402 }
28403 else
28404 g_dbus_gvariant_to_gvalue (child, &paramv[n++]);
28405 g_variant_unref (child);
28406 }
28407 signal_id = g_signal_lookup (info->signal_name, TYPE_HOST_IPMI);
28408 g_value_init (&return_value, G_TYPE_BOOLEAN);
28409 g_signal_emitv (paramv, signal_id, 0, &return_value);
28410 if (!g_value_get_boolean (&return_value))
28411 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);
28412 g_value_unset (&return_value);
28413 for (n = 0; n < num_params + num_extra; n++)
28414 g_value_unset (&paramv[n]);
28415 g_free (paramv);
28416}
28417
28418static GVariant *
28419_host_ipmi_skeleton_handle_get_property (
28420 GDBusConnection *connection G_GNUC_UNUSED,
28421 const gchar *sender G_GNUC_UNUSED,
28422 const gchar *object_path G_GNUC_UNUSED,
28423 const gchar *interface_name G_GNUC_UNUSED,
28424 const gchar *property_name,
28425 GError **error,
28426 gpointer user_data)
28427{
28428 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (user_data);
28429 GValue value = G_VALUE_INIT;
28430 GParamSpec *pspec;
28431 _ExtendedGDBusPropertyInfo *info;
28432 GVariant *ret;
28433 ret = NULL;
28434 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, property_name);
28435 g_assert (info != NULL);
28436 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
28437 if (pspec == NULL)
28438 {
28439 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
28440 }
28441 else
28442 {
28443 g_value_init (&value, pspec->value_type);
28444 g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
28445 ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
28446 g_value_unset (&value);
28447 }
28448 return ret;
28449}
28450
28451static gboolean
28452_host_ipmi_skeleton_handle_set_property (
28453 GDBusConnection *connection G_GNUC_UNUSED,
28454 const gchar *sender G_GNUC_UNUSED,
28455 const gchar *object_path G_GNUC_UNUSED,
28456 const gchar *interface_name G_GNUC_UNUSED,
28457 const gchar *property_name,
28458 GVariant *variant,
28459 GError **error,
28460 gpointer user_data)
28461{
28462 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (user_data);
28463 GValue value = G_VALUE_INIT;
28464 GParamSpec *pspec;
28465 _ExtendedGDBusPropertyInfo *info;
28466 gboolean ret;
28467 ret = FALSE;
28468 info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_host_ipmi_interface_info.parent_struct, property_name);
28469 g_assert (info != NULL);
28470 pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
28471 if (pspec == NULL)
28472 {
28473 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
28474 }
28475 else
28476 {
28477 if (info->use_gvariant)
28478 g_value_set_variant (&value, variant);
28479 else
28480 g_dbus_gvariant_to_gvalue (variant, &value);
28481 g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
28482 g_value_unset (&value);
28483 ret = TRUE;
28484 }
28485 return ret;
28486}
28487
28488static const GDBusInterfaceVTable _host_ipmi_skeleton_vtable =
28489{
28490 _host_ipmi_skeleton_handle_method_call,
28491 _host_ipmi_skeleton_handle_get_property,
28492 _host_ipmi_skeleton_handle_set_property,
28493 {NULL}
28494};
28495
28496static GDBusInterfaceInfo *
28497host_ipmi_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
28498{
28499 return host_ipmi_interface_info ();
28500}
28501
28502static GDBusInterfaceVTable *
28503host_ipmi_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
28504{
28505 return (GDBusInterfaceVTable *) &_host_ipmi_skeleton_vtable;
28506}
28507
28508static GVariant *
28509host_ipmi_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
28510{
28511 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (_skeleton);
28512
28513 GVariantBuilder builder;
28514 guint n;
28515 g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
28516 if (_host_ipmi_interface_info.parent_struct.properties == NULL)
28517 goto out;
28518 for (n = 0; _host_ipmi_interface_info.parent_struct.properties[n] != NULL; n++)
28519 {
28520 GDBusPropertyInfo *info = _host_ipmi_interface_info.parent_struct.properties[n];
28521 if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
28522 {
28523 GVariant *value;
28524 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);
28525 if (value != NULL)
28526 {
28527 g_variant_take_ref (value);
28528 g_variant_builder_add (&builder, "{sv}", info->name, value);
28529 g_variant_unref (value);
28530 }
28531 }
28532 }
28533out:
28534 return g_variant_builder_end (&builder);
28535}
28536
28537static void
28538host_ipmi_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
28539{
28540}
28541
28542static void
28543_host_ipmi_on_signal_received_message (
28544 HostIpmi *object,
28545 guchar arg_seq,
28546 guchar arg_netfn,
28547 guchar arg_cmd,
28548 const gchar *arg_data)
28549{
28550 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (object);
28551
28552 GList *connections, *l;
28553 GVariant *signal_variant;
28554 connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
28555
28556 signal_variant = g_variant_ref_sink (g_variant_new ("(yyy^ay)",
28557 arg_seq,
28558 arg_netfn,
28559 arg_cmd,
28560 arg_data));
28561 for (l = connections; l != NULL; l = l->next)
28562 {
28563 GDBusConnection *connection = l->data;
28564 g_dbus_connection_emit_signal (connection,
28565 NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.HostIpmi", "ReceivedMessage",
28566 signal_variant, NULL);
28567 }
28568 g_variant_unref (signal_variant);
28569 g_list_free_full (connections, g_object_unref);
28570}
28571
28572static void host_ipmi_skeleton_iface_init (HostIpmiIface *iface);
28573#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
28574G_DEFINE_TYPE_WITH_CODE (HostIpmiSkeleton, host_ipmi_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
28575 G_ADD_PRIVATE (HostIpmiSkeleton)
28576 G_IMPLEMENT_INTERFACE (TYPE_HOST_IPMI, host_ipmi_skeleton_iface_init));
28577
28578#else
28579G_DEFINE_TYPE_WITH_CODE (HostIpmiSkeleton, host_ipmi_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
28580 G_IMPLEMENT_INTERFACE (TYPE_HOST_IPMI, host_ipmi_skeleton_iface_init));
28581
28582#endif
28583static void
28584host_ipmi_skeleton_finalize (GObject *object)
28585{
28586 HostIpmiSkeleton *skeleton = HOST_IPMI_SKELETON (object);
28587 g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
28588 if (skeleton->priv->changed_properties_idle_source != NULL)
28589 g_source_destroy (skeleton->priv->changed_properties_idle_source);
28590 g_main_context_unref (skeleton->priv->context);
28591 g_mutex_clear (&skeleton->priv->lock);
28592 G_OBJECT_CLASS (host_ipmi_skeleton_parent_class)->finalize (object);
28593}
28594
28595static void
28596host_ipmi_skeleton_init (HostIpmiSkeleton *skeleton)
28597{
28598#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
28599 skeleton->priv = host_ipmi_skeleton_get_instance_private (skeleton);
28600#else
28601 skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_HOST_IPMI_SKELETON, HostIpmiSkeletonPrivate);
28602#endif
28603
28604 g_mutex_init (&skeleton->priv->lock);
28605 skeleton->priv->context = g_main_context_ref_thread_default ();
28606}
28607
28608static void
28609host_ipmi_skeleton_class_init (HostIpmiSkeletonClass *klass)
28610{
28611 GObjectClass *gobject_class;
28612 GDBusInterfaceSkeletonClass *skeleton_class;
28613
28614 gobject_class = G_OBJECT_CLASS (klass);
28615 gobject_class->finalize = host_ipmi_skeleton_finalize;
28616
28617 skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
28618 skeleton_class->get_info = host_ipmi_skeleton_dbus_interface_get_info;
28619 skeleton_class->get_properties = host_ipmi_skeleton_dbus_interface_get_properties;
28620 skeleton_class->flush = host_ipmi_skeleton_dbus_interface_flush;
28621 skeleton_class->get_vtable = host_ipmi_skeleton_dbus_interface_get_vtable;
28622
28623#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
28624 g_type_class_add_private (klass, sizeof (HostIpmiSkeletonPrivate));
28625#endif
28626}
28627
28628static void
28629host_ipmi_skeleton_iface_init (HostIpmiIface *iface)
28630{
28631 iface->received_message = _host_ipmi_on_signal_received_message;
28632}
28633
28634/**
28635 * host_ipmi_skeleton_new:
28636 *
28637 * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-HostIpmi.top_of_page">org.openbmc.HostIpmi</link>.
28638 *
28639 * Returns: (transfer full) (type HostIpmiSkeleton): The skeleton object.
28640 */
28641HostIpmi *
28642host_ipmi_skeleton_new (void)
28643{
28644 return HOST_IPMI (g_object_new (TYPE_HOST_IPMI_SKELETON, NULL));
28645}
28646
28647/* ------------------------------------------------------------------------
Norman James362a80f2015-09-14 14:04:39 -050028648 * Code for Object, ObjectProxy and ObjectSkeleton
28649 * ------------------------------------------------------------------------
28650 */
28651
28652/**
28653 * SECTION:Object
28654 * @title: Object
28655 * @short_description: Specialized GDBusObject types
28656 *
28657 * This section contains the #Object, #ObjectProxy, and #ObjectSkeleton types which make it easier to work with objects implementing generated types for D-Bus interfaces.
28658 */
28659
28660/**
28661 * Object:
28662 *
28663 * The #Object type is a specialized container of interfaces.
28664 */
28665
28666/**
28667 * ObjectIface:
28668 * @parent_iface: The parent interface.
28669 *
28670 * Virtual table for the #Object interface.
28671 */
28672
28673typedef ObjectIface ObjectInterface;
28674G_DEFINE_INTERFACE_WITH_CODE (Object, object, G_TYPE_OBJECT, g_type_interface_add_prerequisite (g_define_type_id, G_TYPE_DBUS_OBJECT));
28675
28676static void
28677object_default_init (ObjectIface *iface)
28678{
28679 /**
28680 * Object:occ:
28681 *
28682 * The #Occ instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Occ.top_of_page">org.openbmc.Occ</link>, if any.
28683 *
28684 * Connect to the #GObject::notify signal to get informed of property changes.
28685 */
28686 g_object_interface_install_property (iface, g_param_spec_object ("occ", "occ", "occ", TYPE_OCC, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
28687
28688 /**
28689 * Object:fan:
28690 *
28691 * 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.
28692 *
28693 * Connect to the #GObject::notify signal to get informed of property changes.
28694 */
28695 g_object_interface_install_property (iface, g_param_spec_object ("fan", "fan", "fan", TYPE_FAN, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
28696
28697 /**
28698 * Object:sensor-value:
28699 *
28700 * 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.
28701 *
28702 * Connect to the #GObject::notify signal to get informed of property changes.
28703 */
28704 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));
28705
28706 /**
28707 * Object:sensor-threshold:
28708 *
28709 * 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.
28710 *
28711 * Connect to the #GObject::notify signal to get informed of property changes.
28712 */
28713 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));
28714
28715 /**
28716 * Object:sensor-i2c:
28717 *
28718 * 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.
28719 *
28720 * Connect to the #GObject::notify signal to get informed of property changes.
28721 */
28722 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));
28723
28724 /**
28725 * Object:sensor-match:
28726 *
28727 * 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.
28728 *
28729 * Connect to the #GObject::notify signal to get informed of property changes.
28730 */
28731 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));
28732
28733 /**
28734 * Object:process:
28735 *
28736 * 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.
28737 *
28738 * Connect to the #GObject::notify signal to get informed of property changes.
28739 */
28740 g_object_interface_install_property (iface, g_param_spec_object ("process", "process", "process", TYPE_PROCESS, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
28741
28742 /**
Norman James18998182015-10-11 21:54:53 -050028743 * Object:shared-resource:
28744 *
28745 * 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.
28746 *
28747 * Connect to the #GObject::notify signal to get informed of property changes.
28748 */
28749 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));
28750
28751 /**
Norman James362a80f2015-09-14 14:04:39 -050028752 * Object:control:
28753 *
28754 * 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.
28755 *
28756 * Connect to the #GObject::notify signal to get informed of property changes.
28757 */
28758 g_object_interface_install_property (iface, g_param_spec_object ("control", "control", "control", TYPE_CONTROL, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
28759
28760 /**
28761 * Object:control-bmc:
28762 *
28763 * 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.
28764 *
28765 * Connect to the #GObject::notify signal to get informed of property changes.
28766 */
28767 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));
28768
28769 /**
28770 * Object:control-host:
28771 *
28772 * 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.
28773 *
28774 * Connect to the #GObject::notify signal to get informed of property changes.
28775 */
28776 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));
28777
28778 /**
28779 * Object:control-power:
28780 *
28781 * 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.
28782 *
28783 * Connect to the #GObject::notify signal to get informed of property changes.
28784 */
28785 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));
28786
28787 /**
28788 * Object:watchdog:
28789 *
28790 * 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.
28791 *
28792 * Connect to the #GObject::notify signal to get informed of property changes.
28793 */
28794 g_object_interface_install_property (iface, g_param_spec_object ("watchdog", "watchdog", "watchdog", TYPE_WATCHDOG, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
28795
28796 /**
28797 * Object:event-log:
28798 *
28799 * 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.
28800 *
28801 * Connect to the #GObject::notify signal to get informed of property changes.
28802 */
28803 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));
28804
28805 /**
28806 * Object:flash:
28807 *
28808 * 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.
28809 *
28810 * Connect to the #GObject::notify signal to get informed of property changes.
28811 */
28812 g_object_interface_install_property (iface, g_param_spec_object ("flash", "flash", "flash", TYPE_FLASH, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
28813
28814 /**
Norman James18998182015-10-11 21:54:53 -050028815 * Object:flash-control:
28816 *
28817 * 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.
28818 *
28819 * Connect to the #GObject::notify signal to get informed of property changes.
28820 */
28821 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));
28822
28823 /**
Norman James362a80f2015-09-14 14:04:39 -050028824 * Object:button:
28825 *
28826 * 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.
28827 *
28828 * Connect to the #GObject::notify signal to get informed of property changes.
28829 */
28830 g_object_interface_install_property (iface, g_param_spec_object ("button", "button", "button", TYPE_BUTTON, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
28831
28832 /**
28833 * Object:led:
28834 *
28835 * 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.
28836 *
28837 * Connect to the #GObject::notify signal to get informed of property changes.
28838 */
28839 g_object_interface_install_property (iface, g_param_spec_object ("led", "led", "led", TYPE_LED, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
28840
Norman Jamesdbcffbd2015-10-06 16:53:06 -050028841 /**
28842 * Object:host-ipmi:
28843 *
28844 * 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.
28845 *
28846 * Connect to the #GObject::notify signal to get informed of property changes.
28847 */
28848 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));
28849
Norman James362a80f2015-09-14 14:04:39 -050028850}
28851
28852/**
28853 * object_get_occ:
28854 * @object: A #Object.
28855 *
28856 * Gets the #Occ instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Occ.top_of_page">org.openbmc.Occ</link> on @object, if any.
28857 *
28858 * Returns: (transfer full): A #Occ that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
28859 */
28860Occ *object_get_occ (Object *object)
28861{
28862 GDBusInterface *ret;
28863 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Occ");
28864 if (ret == NULL)
28865 return NULL;
28866 return OCC (ret);
28867}
28868
28869/**
28870 * object_get_fan:
28871 * @object: A #Object.
28872 *
28873 * 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.
28874 *
28875 * Returns: (transfer full): A #Fan that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
28876 */
28877Fan *object_get_fan (Object *object)
28878{
28879 GDBusInterface *ret;
28880 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan");
28881 if (ret == NULL)
28882 return NULL;
28883 return FAN (ret);
28884}
28885
28886/**
28887 * object_get_sensor_value:
28888 * @object: A #Object.
28889 *
28890 * 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.
28891 *
28892 * Returns: (transfer full): A #SensorValue that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
28893 */
28894SensorValue *object_get_sensor_value (Object *object)
28895{
28896 GDBusInterface *ret;
28897 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue");
28898 if (ret == NULL)
28899 return NULL;
28900 return SENSOR_VALUE (ret);
28901}
28902
28903/**
28904 * object_get_sensor_threshold:
28905 * @object: A #Object.
28906 *
28907 * 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.
28908 *
28909 * Returns: (transfer full): A #SensorThreshold that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
28910 */
28911SensorThreshold *object_get_sensor_threshold (Object *object)
28912{
28913 GDBusInterface *ret;
28914 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold");
28915 if (ret == NULL)
28916 return NULL;
28917 return SENSOR_THRESHOLD (ret);
28918}
28919
28920/**
28921 * object_get_sensor_i2c:
28922 * @object: A #Object.
28923 *
28924 * 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.
28925 *
28926 * Returns: (transfer full): A #SensorI2c that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
28927 */
28928SensorI2c *object_get_sensor_i2c (Object *object)
28929{
28930 GDBusInterface *ret;
28931 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
28932 if (ret == NULL)
28933 return NULL;
28934 return SENSOR_I2C (ret);
28935}
28936
28937/**
28938 * object_get_sensor_match:
28939 * @object: A #Object.
28940 *
28941 * 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.
28942 *
28943 * Returns: (transfer full): A #SensorMatch that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
28944 */
28945SensorMatch *object_get_sensor_match (Object *object)
28946{
28947 GDBusInterface *ret;
28948 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch");
28949 if (ret == NULL)
28950 return NULL;
28951 return SENSOR_MATCH (ret);
28952}
28953
28954/**
28955 * object_get_process:
28956 * @object: A #Object.
28957 *
28958 * 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.
28959 *
28960 * Returns: (transfer full): A #Process that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
28961 */
28962Process *object_get_process (Object *object)
28963{
28964 GDBusInterface *ret;
28965 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process");
28966 if (ret == NULL)
28967 return NULL;
28968 return PROCESS (ret);
28969}
28970
28971/**
Norman James18998182015-10-11 21:54:53 -050028972 * object_get_shared_resource:
28973 * @object: A #Object.
28974 *
28975 * 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.
28976 *
28977 * Returns: (transfer full): A #SharedResource that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
28978 */
28979SharedResource *object_get_shared_resource (Object *object)
28980{
28981 GDBusInterface *ret;
28982 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SharedResource");
28983 if (ret == NULL)
28984 return NULL;
28985 return SHARED_RESOURCE (ret);
28986}
28987
28988/**
Norman James362a80f2015-09-14 14:04:39 -050028989 * object_get_control:
28990 * @object: A #Object.
28991 *
28992 * 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.
28993 *
28994 * Returns: (transfer full): A #Control that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
28995 */
28996Control *object_get_control (Object *object)
28997{
28998 GDBusInterface *ret;
28999 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control");
29000 if (ret == NULL)
29001 return NULL;
29002 return CONTROL (ret);
29003}
29004
29005/**
29006 * object_get_control_bmc:
29007 * @object: A #Object.
29008 *
29009 * 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.
29010 *
29011 * Returns: (transfer full): A #ControlBmc that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
29012 */
29013ControlBmc *object_get_control_bmc (Object *object)
29014{
29015 GDBusInterface *ret;
29016 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc");
29017 if (ret == NULL)
29018 return NULL;
29019 return CONTROL_BMC (ret);
29020}
29021
29022/**
29023 * object_get_control_host:
29024 * @object: A #Object.
29025 *
29026 * 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.
29027 *
29028 * Returns: (transfer full): A #ControlHost that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
29029 */
29030ControlHost *object_get_control_host (Object *object)
29031{
29032 GDBusInterface *ret;
29033 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
29034 if (ret == NULL)
29035 return NULL;
29036 return CONTROL_HOST (ret);
29037}
29038
29039/**
29040 * object_get_control_power:
29041 * @object: A #Object.
29042 *
29043 * 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.
29044 *
29045 * Returns: (transfer full): A #ControlPower that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
29046 */
29047ControlPower *object_get_control_power (Object *object)
29048{
29049 GDBusInterface *ret;
29050 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power");
29051 if (ret == NULL)
29052 return NULL;
29053 return CONTROL_POWER (ret);
29054}
29055
29056/**
29057 * object_get_watchdog:
29058 * @object: A #Object.
29059 *
29060 * 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.
29061 *
29062 * Returns: (transfer full): A #Watchdog that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
29063 */
29064Watchdog *object_get_watchdog (Object *object)
29065{
29066 GDBusInterface *ret;
29067 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog");
29068 if (ret == NULL)
29069 return NULL;
29070 return WATCHDOG (ret);
29071}
29072
29073/**
29074 * object_get_event_log:
29075 * @object: A #Object.
29076 *
29077 * 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.
29078 *
29079 * Returns: (transfer full): A #EventLog that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
29080 */
29081EventLog *object_get_event_log (Object *object)
29082{
29083 GDBusInterface *ret;
29084 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
29085 if (ret == NULL)
29086 return NULL;
29087 return EVENT_LOG (ret);
29088}
29089
29090/**
29091 * object_get_flash:
29092 * @object: A #Object.
29093 *
29094 * 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.
29095 *
29096 * Returns: (transfer full): A #Flash that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
29097 */
29098Flash *object_get_flash (Object *object)
29099{
29100 GDBusInterface *ret;
29101 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash");
29102 if (ret == NULL)
29103 return NULL;
29104 return FLASH (ret);
29105}
29106
29107/**
Norman James18998182015-10-11 21:54:53 -050029108 * object_get_flash_control:
29109 * @object: A #Object.
29110 *
29111 * 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.
29112 *
29113 * Returns: (transfer full): A #FlashControl that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
29114 */
29115FlashControl *object_get_flash_control (Object *object)
29116{
29117 GDBusInterface *ret;
29118 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.FlashControl");
29119 if (ret == NULL)
29120 return NULL;
29121 return FLASH_CONTROL (ret);
29122}
29123
29124/**
Norman James362a80f2015-09-14 14:04:39 -050029125 * object_get_button:
29126 * @object: A #Object.
29127 *
29128 * 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.
29129 *
29130 * Returns: (transfer full): A #Button that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
29131 */
29132Button *object_get_button (Object *object)
29133{
29134 GDBusInterface *ret;
29135 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button");
29136 if (ret == NULL)
29137 return NULL;
29138 return BUTTON (ret);
29139}
29140
29141/**
29142 * object_get_led:
29143 * @object: A #Object.
29144 *
29145 * 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.
29146 *
29147 * Returns: (transfer full): A #Led that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
29148 */
29149Led *object_get_led (Object *object)
29150{
29151 GDBusInterface *ret;
29152 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led");
29153 if (ret == NULL)
29154 return NULL;
29155 return LED (ret);
29156}
29157
Norman Jamesdbcffbd2015-10-06 16:53:06 -050029158/**
29159 * object_get_host_ipmi:
29160 * @object: A #Object.
29161 *
29162 * 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.
29163 *
29164 * Returns: (transfer full): A #HostIpmi that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
29165 */
29166HostIpmi *object_get_host_ipmi (Object *object)
29167{
29168 GDBusInterface *ret;
29169 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.HostIpmi");
29170 if (ret == NULL)
29171 return NULL;
29172 return HOST_IPMI (ret);
29173}
29174
Norman James362a80f2015-09-14 14:04:39 -050029175
29176/**
29177 * object_peek_occ: (skip)
29178 * @object: A #Object.
29179 *
29180 * Like object_get_occ() but doesn't increase the reference count on the returned object.
29181 *
29182 * <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>
29183 *
29184 * Returns: (transfer none): A #Occ or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
29185 */
29186Occ *object_peek_occ (Object *object)
29187{
29188 GDBusInterface *ret;
29189 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Occ");
29190 if (ret == NULL)
29191 return NULL;
29192 g_object_unref (ret);
29193 return OCC (ret);
29194}
29195
29196/**
29197 * object_peek_fan: (skip)
29198 * @object: A #Object.
29199 *
29200 * Like object_get_fan() but doesn't increase the reference count on the returned object.
29201 *
29202 * <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>
29203 *
29204 * 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.
29205 */
29206Fan *object_peek_fan (Object *object)
29207{
29208 GDBusInterface *ret;
29209 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan");
29210 if (ret == NULL)
29211 return NULL;
29212 g_object_unref (ret);
29213 return FAN (ret);
29214}
29215
29216/**
29217 * object_peek_sensor_value: (skip)
29218 * @object: A #Object.
29219 *
29220 * Like object_get_sensor_value() but doesn't increase the reference count on the returned object.
29221 *
29222 * <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>
29223 *
29224 * 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.
29225 */
29226SensorValue *object_peek_sensor_value (Object *object)
29227{
29228 GDBusInterface *ret;
29229 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue");
29230 if (ret == NULL)
29231 return NULL;
29232 g_object_unref (ret);
29233 return SENSOR_VALUE (ret);
29234}
29235
29236/**
29237 * object_peek_sensor_threshold: (skip)
29238 * @object: A #Object.
29239 *
29240 * Like object_get_sensor_threshold() but doesn't increase the reference count on the returned object.
29241 *
29242 * <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>
29243 *
29244 * 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.
29245 */
29246SensorThreshold *object_peek_sensor_threshold (Object *object)
29247{
29248 GDBusInterface *ret;
29249 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold");
29250 if (ret == NULL)
29251 return NULL;
29252 g_object_unref (ret);
29253 return SENSOR_THRESHOLD (ret);
29254}
29255
29256/**
29257 * object_peek_sensor_i2c: (skip)
29258 * @object: A #Object.
29259 *
29260 * Like object_get_sensor_i2c() but doesn't increase the reference count on the returned object.
29261 *
29262 * <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>
29263 *
29264 * 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.
29265 */
29266SensorI2c *object_peek_sensor_i2c (Object *object)
29267{
29268 GDBusInterface *ret;
29269 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
29270 if (ret == NULL)
29271 return NULL;
29272 g_object_unref (ret);
29273 return SENSOR_I2C (ret);
29274}
29275
29276/**
29277 * object_peek_sensor_match: (skip)
29278 * @object: A #Object.
29279 *
29280 * Like object_get_sensor_match() but doesn't increase the reference count on the returned object.
29281 *
29282 * <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>
29283 *
29284 * 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.
29285 */
29286SensorMatch *object_peek_sensor_match (Object *object)
29287{
29288 GDBusInterface *ret;
29289 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch");
29290 if (ret == NULL)
29291 return NULL;
29292 g_object_unref (ret);
29293 return SENSOR_MATCH (ret);
29294}
29295
29296/**
29297 * object_peek_process: (skip)
29298 * @object: A #Object.
29299 *
29300 * Like object_get_process() but doesn't increase the reference count on the returned object.
29301 *
29302 * <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>
29303 *
29304 * 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.
29305 */
29306Process *object_peek_process (Object *object)
29307{
29308 GDBusInterface *ret;
29309 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process");
29310 if (ret == NULL)
29311 return NULL;
29312 g_object_unref (ret);
29313 return PROCESS (ret);
29314}
29315
29316/**
Norman James18998182015-10-11 21:54:53 -050029317 * object_peek_shared_resource: (skip)
29318 * @object: A #Object.
29319 *
29320 * Like object_get_shared_resource() but doesn't increase the reference count on the returned object.
29321 *
29322 * <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>
29323 *
29324 * 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.
29325 */
29326SharedResource *object_peek_shared_resource (Object *object)
29327{
29328 GDBusInterface *ret;
29329 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SharedResource");
29330 if (ret == NULL)
29331 return NULL;
29332 g_object_unref (ret);
29333 return SHARED_RESOURCE (ret);
29334}
29335
29336/**
Norman James362a80f2015-09-14 14:04:39 -050029337 * object_peek_control: (skip)
29338 * @object: A #Object.
29339 *
29340 * Like object_get_control() but doesn't increase the reference count on the returned object.
29341 *
29342 * <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>
29343 *
29344 * 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.
29345 */
29346Control *object_peek_control (Object *object)
29347{
29348 GDBusInterface *ret;
29349 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control");
29350 if (ret == NULL)
29351 return NULL;
29352 g_object_unref (ret);
29353 return CONTROL (ret);
29354}
29355
29356/**
29357 * object_peek_control_bmc: (skip)
29358 * @object: A #Object.
29359 *
29360 * Like object_get_control_bmc() but doesn't increase the reference count on the returned object.
29361 *
29362 * <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>
29363 *
29364 * 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.
29365 */
29366ControlBmc *object_peek_control_bmc (Object *object)
29367{
29368 GDBusInterface *ret;
29369 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc");
29370 if (ret == NULL)
29371 return NULL;
29372 g_object_unref (ret);
29373 return CONTROL_BMC (ret);
29374}
29375
29376/**
29377 * object_peek_control_host: (skip)
29378 * @object: A #Object.
29379 *
29380 * Like object_get_control_host() but doesn't increase the reference count on the returned object.
29381 *
29382 * <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>
29383 *
29384 * 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.
29385 */
29386ControlHost *object_peek_control_host (Object *object)
29387{
29388 GDBusInterface *ret;
29389 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
29390 if (ret == NULL)
29391 return NULL;
29392 g_object_unref (ret);
29393 return CONTROL_HOST (ret);
29394}
29395
29396/**
29397 * object_peek_control_power: (skip)
29398 * @object: A #Object.
29399 *
29400 * Like object_get_control_power() but doesn't increase the reference count on the returned object.
29401 *
29402 * <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>
29403 *
29404 * 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.
29405 */
29406ControlPower *object_peek_control_power (Object *object)
29407{
29408 GDBusInterface *ret;
29409 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power");
29410 if (ret == NULL)
29411 return NULL;
29412 g_object_unref (ret);
29413 return CONTROL_POWER (ret);
29414}
29415
29416/**
29417 * object_peek_watchdog: (skip)
29418 * @object: A #Object.
29419 *
29420 * Like object_get_watchdog() but doesn't increase the reference count on the returned object.
29421 *
29422 * <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>
29423 *
29424 * 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.
29425 */
29426Watchdog *object_peek_watchdog (Object *object)
29427{
29428 GDBusInterface *ret;
29429 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog");
29430 if (ret == NULL)
29431 return NULL;
29432 g_object_unref (ret);
29433 return WATCHDOG (ret);
29434}
29435
29436/**
29437 * object_peek_event_log: (skip)
29438 * @object: A #Object.
29439 *
29440 * Like object_get_event_log() but doesn't increase the reference count on the returned object.
29441 *
29442 * <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>
29443 *
29444 * 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.
29445 */
29446EventLog *object_peek_event_log (Object *object)
29447{
29448 GDBusInterface *ret;
29449 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
29450 if (ret == NULL)
29451 return NULL;
29452 g_object_unref (ret);
29453 return EVENT_LOG (ret);
29454}
29455
29456/**
29457 * object_peek_flash: (skip)
29458 * @object: A #Object.
29459 *
29460 * Like object_get_flash() but doesn't increase the reference count on the returned object.
29461 *
29462 * <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>
29463 *
29464 * 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.
29465 */
29466Flash *object_peek_flash (Object *object)
29467{
29468 GDBusInterface *ret;
29469 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash");
29470 if (ret == NULL)
29471 return NULL;
29472 g_object_unref (ret);
29473 return FLASH (ret);
29474}
29475
29476/**
Norman James18998182015-10-11 21:54:53 -050029477 * object_peek_flash_control: (skip)
29478 * @object: A #Object.
29479 *
29480 * Like object_get_flash_control() but doesn't increase the reference count on the returned object.
29481 *
29482 * <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>
29483 *
29484 * 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.
29485 */
29486FlashControl *object_peek_flash_control (Object *object)
29487{
29488 GDBusInterface *ret;
29489 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.FlashControl");
29490 if (ret == NULL)
29491 return NULL;
29492 g_object_unref (ret);
29493 return FLASH_CONTROL (ret);
29494}
29495
29496/**
Norman James362a80f2015-09-14 14:04:39 -050029497 * object_peek_button: (skip)
29498 * @object: A #Object.
29499 *
29500 * Like object_get_button() but doesn't increase the reference count on the returned object.
29501 *
29502 * <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>
29503 *
29504 * 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.
29505 */
29506Button *object_peek_button (Object *object)
29507{
29508 GDBusInterface *ret;
29509 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button");
29510 if (ret == NULL)
29511 return NULL;
29512 g_object_unref (ret);
29513 return BUTTON (ret);
29514}
29515
29516/**
29517 * object_peek_led: (skip)
29518 * @object: A #Object.
29519 *
29520 * Like object_get_led() but doesn't increase the reference count on the returned object.
29521 *
29522 * <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>
29523 *
29524 * 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.
29525 */
29526Led *object_peek_led (Object *object)
29527{
29528 GDBusInterface *ret;
29529 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led");
29530 if (ret == NULL)
29531 return NULL;
29532 g_object_unref (ret);
29533 return LED (ret);
29534}
29535
Norman Jamesdbcffbd2015-10-06 16:53:06 -050029536/**
29537 * object_peek_host_ipmi: (skip)
29538 * @object: A #Object.
29539 *
29540 * Like object_get_host_ipmi() but doesn't increase the reference count on the returned object.
29541 *
29542 * <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>
29543 *
29544 * 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.
29545 */
29546HostIpmi *object_peek_host_ipmi (Object *object)
29547{
29548 GDBusInterface *ret;
29549 ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.HostIpmi");
29550 if (ret == NULL)
29551 return NULL;
29552 g_object_unref (ret);
29553 return HOST_IPMI (ret);
29554}
29555
Norman James362a80f2015-09-14 14:04:39 -050029556
29557static void
29558object_notify (GDBusObject *object, GDBusInterface *interface)
29559{
29560 _ExtendedGDBusInterfaceInfo *info = (_ExtendedGDBusInterfaceInfo *) g_dbus_interface_get_info (interface);
29561 /* info can be NULL if the other end is using a D-Bus interface we don't know
29562 * anything about, for example old generated code in this process talking to
29563 * newer generated code in the other process. */
29564 if (info != NULL)
29565 g_object_notify (G_OBJECT (object), info->hyphen_name);
29566}
29567
29568/**
29569 * ObjectProxy:
29570 *
29571 * The #ObjectProxy structure contains only private data and should only be accessed using the provided API.
29572 */
29573
29574/**
29575 * ObjectProxyClass:
29576 * @parent_class: The parent class.
29577 *
29578 * Class structure for #ObjectProxy.
29579 */
29580
29581static void
29582object_proxy__object_iface_init (ObjectIface *iface G_GNUC_UNUSED)
29583{
29584}
29585
29586static void
29587object_proxy__g_dbus_object_iface_init (GDBusObjectIface *iface)
29588{
29589 iface->interface_added = object_notify;
29590 iface->interface_removed = object_notify;
29591}
29592
29593
29594G_DEFINE_TYPE_WITH_CODE (ObjectProxy, object_proxy, G_TYPE_DBUS_OBJECT_PROXY,
29595 G_IMPLEMENT_INTERFACE (TYPE_OBJECT, object_proxy__object_iface_init)
29596 G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, object_proxy__g_dbus_object_iface_init));
29597
29598static void
29599object_proxy_init (ObjectProxy *object G_GNUC_UNUSED)
29600{
29601}
29602
29603static void
29604object_proxy_set_property (GObject *gobject,
29605 guint prop_id,
29606 const GValue *value G_GNUC_UNUSED,
29607 GParamSpec *pspec)
29608{
29609 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
29610}
29611
29612static void
29613object_proxy_get_property (GObject *gobject,
29614 guint prop_id,
29615 GValue *value,
29616 GParamSpec *pspec)
29617{
29618 ObjectProxy *object = OBJECT_PROXY (gobject);
29619 GDBusInterface *interface;
29620
29621 switch (prop_id)
29622 {
29623 case 1:
29624 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Occ");
29625 g_value_take_object (value, interface);
29626 break;
29627
29628 case 2:
29629 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan");
29630 g_value_take_object (value, interface);
29631 break;
29632
29633 case 3:
29634 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue");
29635 g_value_take_object (value, interface);
29636 break;
29637
29638 case 4:
Norman Jamesdfdaca92015-09-27 22:11:15 -050029639 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold");
Norman James362a80f2015-09-14 14:04:39 -050029640 g_value_take_object (value, interface);
29641 break;
29642
Norman James19e45912015-10-04 20:19:41 -050029643 case 5:
Norman Jamesdfdaca92015-09-27 22:11:15 -050029644 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
Norman James362a80f2015-09-14 14:04:39 -050029645 g_value_take_object (value, interface);
29646 break;
29647
Norman James19e45912015-10-04 20:19:41 -050029648 case 6:
Norman Jamesdfdaca92015-09-27 22:11:15 -050029649 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch");
Norman James362a80f2015-09-14 14:04:39 -050029650 g_value_take_object (value, interface);
29651 break;
29652
Norman James19e45912015-10-04 20:19:41 -050029653 case 7:
Norman Jamesdfdaca92015-09-27 22:11:15 -050029654 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process");
Norman James362a80f2015-09-14 14:04:39 -050029655 g_value_take_object (value, interface);
29656 break;
29657
Norman James19e45912015-10-04 20:19:41 -050029658 case 8:
Norman James18998182015-10-11 21:54:53 -050029659 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SharedResource");
Norman James362a80f2015-09-14 14:04:39 -050029660 g_value_take_object (value, interface);
29661 break;
29662
Norman James19e45912015-10-04 20:19:41 -050029663 case 9:
Norman James18998182015-10-11 21:54:53 -050029664 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control");
Norman James362a80f2015-09-14 14:04:39 -050029665 g_value_take_object (value, interface);
29666 break;
29667
Norman James19e45912015-10-04 20:19:41 -050029668 case 10:
Norman James18998182015-10-11 21:54:53 -050029669 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc");
Norman James362a80f2015-09-14 14:04:39 -050029670 g_value_take_object (value, interface);
29671 break;
29672
Norman James19e45912015-10-04 20:19:41 -050029673 case 11:
Norman James18998182015-10-11 21:54:53 -050029674 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
Norman James362a80f2015-09-14 14:04:39 -050029675 g_value_take_object (value, interface);
29676 break;
29677
Norman James19e45912015-10-04 20:19:41 -050029678 case 12:
Norman James18998182015-10-11 21:54:53 -050029679 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power");
Norman James362a80f2015-09-14 14:04:39 -050029680 g_value_take_object (value, interface);
29681 break;
29682
Norman James19e45912015-10-04 20:19:41 -050029683 case 13:
Norman James18998182015-10-11 21:54:53 -050029684 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog");
Norman James362a80f2015-09-14 14:04:39 -050029685 g_value_take_object (value, interface);
29686 break;
29687
Norman James19e45912015-10-04 20:19:41 -050029688 case 14:
Norman James18998182015-10-11 21:54:53 -050029689 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
Norman James362a80f2015-09-14 14:04:39 -050029690 g_value_take_object (value, interface);
29691 break;
29692
Norman James19e45912015-10-04 20:19:41 -050029693 case 15:
Norman James18998182015-10-11 21:54:53 -050029694 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash");
Norman Jamesdfdaca92015-09-27 22:11:15 -050029695 g_value_take_object (value, interface);
29696 break;
29697
Norman James19e45912015-10-04 20:19:41 -050029698 case 16:
Norman James18998182015-10-11 21:54:53 -050029699 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.FlashControl");
Norman James362a80f2015-09-14 14:04:39 -050029700 g_value_take_object (value, interface);
29701 break;
29702
Norman Jamesdbcffbd2015-10-06 16:53:06 -050029703 case 17:
Norman James18998182015-10-11 21:54:53 -050029704 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button");
29705 g_value_take_object (value, interface);
29706 break;
29707
29708 case 18:
29709 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led");
29710 g_value_take_object (value, interface);
29711 break;
29712
29713 case 19:
Norman Jamesdbcffbd2015-10-06 16:53:06 -050029714 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.HostIpmi");
29715 g_value_take_object (value, interface);
29716 break;
29717
Norman James362a80f2015-09-14 14:04:39 -050029718 default:
29719 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
29720 break;
29721 }
29722}
29723
29724static void
29725object_proxy_class_init (ObjectProxyClass *klass)
29726{
29727 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
29728
29729 gobject_class->set_property = object_proxy_set_property;
29730 gobject_class->get_property = object_proxy_get_property;
29731
29732 g_object_class_override_property (gobject_class, 1, "occ");
29733 g_object_class_override_property (gobject_class, 2, "fan");
29734 g_object_class_override_property (gobject_class, 3, "sensor-value");
Norman James19e45912015-10-04 20:19:41 -050029735 g_object_class_override_property (gobject_class, 4, "sensor-threshold");
29736 g_object_class_override_property (gobject_class, 5, "sensor-i2c");
29737 g_object_class_override_property (gobject_class, 6, "sensor-match");
29738 g_object_class_override_property (gobject_class, 7, "process");
Norman James18998182015-10-11 21:54:53 -050029739 g_object_class_override_property (gobject_class, 8, "shared-resource");
29740 g_object_class_override_property (gobject_class, 9, "control");
29741 g_object_class_override_property (gobject_class, 10, "control-bmc");
29742 g_object_class_override_property (gobject_class, 11, "control-host");
29743 g_object_class_override_property (gobject_class, 12, "control-power");
29744 g_object_class_override_property (gobject_class, 13, "watchdog");
29745 g_object_class_override_property (gobject_class, 14, "event-log");
29746 g_object_class_override_property (gobject_class, 15, "flash");
29747 g_object_class_override_property (gobject_class, 16, "flash-control");
29748 g_object_class_override_property (gobject_class, 17, "button");
29749 g_object_class_override_property (gobject_class, 18, "led");
29750 g_object_class_override_property (gobject_class, 19, "host-ipmi");
Norman James362a80f2015-09-14 14:04:39 -050029751}
29752
29753/**
29754 * object_proxy_new:
29755 * @connection: A #GDBusConnection.
29756 * @object_path: An object path.
29757 *
29758 * Creates a new proxy object.
29759 *
29760 * Returns: (transfer full): The proxy object.
29761 */
29762ObjectProxy *
29763object_proxy_new (GDBusConnection *connection,
29764 const gchar *object_path)
29765{
29766 g_return_val_if_fail (G_IS_DBUS_CONNECTION (connection), NULL);
29767 g_return_val_if_fail (g_variant_is_object_path (object_path), NULL);
29768 return OBJECT_PROXY (g_object_new (TYPE_OBJECT_PROXY, "g-connection", connection, "g-object-path", object_path, NULL));
29769}
29770
29771/**
29772 * ObjectSkeleton:
29773 *
29774 * The #ObjectSkeleton structure contains only private data and should only be accessed using the provided API.
29775 */
29776
29777/**
29778 * ObjectSkeletonClass:
29779 * @parent_class: The parent class.
29780 *
29781 * Class structure for #ObjectSkeleton.
29782 */
29783
29784static void
29785object_skeleton__object_iface_init (ObjectIface *iface G_GNUC_UNUSED)
29786{
29787}
29788
29789
29790static void
29791object_skeleton__g_dbus_object_iface_init (GDBusObjectIface *iface)
29792{
29793 iface->interface_added = object_notify;
29794 iface->interface_removed = object_notify;
29795}
29796
29797G_DEFINE_TYPE_WITH_CODE (ObjectSkeleton, object_skeleton, G_TYPE_DBUS_OBJECT_SKELETON,
29798 G_IMPLEMENT_INTERFACE (TYPE_OBJECT, object_skeleton__object_iface_init)
29799 G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, object_skeleton__g_dbus_object_iface_init));
29800
29801static void
29802object_skeleton_init (ObjectSkeleton *object G_GNUC_UNUSED)
29803{
29804}
29805
29806static void
29807object_skeleton_set_property (GObject *gobject,
29808 guint prop_id,
29809 const GValue *value,
29810 GParamSpec *pspec)
29811{
29812 ObjectSkeleton *object = OBJECT_SKELETON (gobject);
29813 GDBusInterfaceSkeleton *interface;
29814
29815 switch (prop_id)
29816 {
29817 case 1:
29818 interface = g_value_get_object (value);
29819 if (interface != NULL)
29820 {
29821 g_warn_if_fail (IS_OCC (interface));
29822 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
29823 }
29824 else
29825 {
29826 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Occ");
29827 }
29828 break;
29829
29830 case 2:
29831 interface = g_value_get_object (value);
29832 if (interface != NULL)
29833 {
29834 g_warn_if_fail (IS_FAN (interface));
29835 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
29836 }
29837 else
29838 {
29839 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Fan");
29840 }
29841 break;
29842
29843 case 3:
29844 interface = g_value_get_object (value);
29845 if (interface != NULL)
29846 {
29847 g_warn_if_fail (IS_SENSOR_VALUE (interface));
29848 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
29849 }
29850 else
29851 {
29852 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorValue");
29853 }
29854 break;
29855
29856 case 4:
29857 interface = g_value_get_object (value);
29858 if (interface != NULL)
29859 {
29860 g_warn_if_fail (IS_SENSOR_THRESHOLD (interface));
29861 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
29862 }
29863 else
29864 {
29865 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorThreshold");
29866 }
29867 break;
29868
Norman James19e45912015-10-04 20:19:41 -050029869 case 5:
Norman James362a80f2015-09-14 14:04:39 -050029870 interface = g_value_get_object (value);
29871 if (interface != NULL)
29872 {
29873 g_warn_if_fail (IS_SENSOR_I2C (interface));
29874 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
29875 }
29876 else
29877 {
29878 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorI2c");
29879 }
29880 break;
29881
Norman James19e45912015-10-04 20:19:41 -050029882 case 6:
Norman James362a80f2015-09-14 14:04:39 -050029883 interface = g_value_get_object (value);
29884 if (interface != NULL)
29885 {
29886 g_warn_if_fail (IS_SENSOR_MATCH (interface));
29887 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
29888 }
29889 else
29890 {
29891 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SensorMatch");
29892 }
29893 break;
29894
Norman James19e45912015-10-04 20:19:41 -050029895 case 7:
Norman James362a80f2015-09-14 14:04:39 -050029896 interface = g_value_get_object (value);
29897 if (interface != NULL)
29898 {
29899 g_warn_if_fail (IS_PROCESS (interface));
29900 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
29901 }
29902 else
29903 {
29904 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Process");
29905 }
29906 break;
29907
Norman James19e45912015-10-04 20:19:41 -050029908 case 8:
Norman James362a80f2015-09-14 14:04:39 -050029909 interface = g_value_get_object (value);
29910 if (interface != NULL)
29911 {
Norman James18998182015-10-11 21:54:53 -050029912 g_warn_if_fail (IS_SHARED_RESOURCE (interface));
29913 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
29914 }
29915 else
29916 {
29917 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.SharedResource");
29918 }
29919 break;
29920
29921 case 9:
29922 interface = g_value_get_object (value);
29923 if (interface != NULL)
29924 {
Norman James362a80f2015-09-14 14:04:39 -050029925 g_warn_if_fail (IS_CONTROL (interface));
29926 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
29927 }
29928 else
29929 {
29930 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Control");
29931 }
29932 break;
29933
Norman James18998182015-10-11 21:54:53 -050029934 case 10:
Norman James362a80f2015-09-14 14:04:39 -050029935 interface = g_value_get_object (value);
29936 if (interface != NULL)
29937 {
29938 g_warn_if_fail (IS_CONTROL_BMC (interface));
29939 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
29940 }
29941 else
29942 {
29943 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.control.Bmc");
29944 }
29945 break;
29946
Norman James18998182015-10-11 21:54:53 -050029947 case 11:
Norman James362a80f2015-09-14 14:04:39 -050029948 interface = g_value_get_object (value);
29949 if (interface != NULL)
29950 {
29951 g_warn_if_fail (IS_CONTROL_HOST (interface));
29952 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
29953 }
29954 else
29955 {
29956 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.control.Host");
29957 }
29958 break;
29959
Norman James18998182015-10-11 21:54:53 -050029960 case 12:
Norman James362a80f2015-09-14 14:04:39 -050029961 interface = g_value_get_object (value);
29962 if (interface != NULL)
29963 {
29964 g_warn_if_fail (IS_CONTROL_POWER (interface));
29965 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
29966 }
29967 else
29968 {
29969 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.control.Power");
29970 }
29971 break;
29972
Norman James18998182015-10-11 21:54:53 -050029973 case 13:
Norman James362a80f2015-09-14 14:04:39 -050029974 interface = g_value_get_object (value);
29975 if (interface != NULL)
29976 {
29977 g_warn_if_fail (IS_WATCHDOG (interface));
29978 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
29979 }
29980 else
29981 {
29982 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Watchdog");
29983 }
29984 break;
29985
Norman James18998182015-10-11 21:54:53 -050029986 case 14:
Norman James362a80f2015-09-14 14:04:39 -050029987 interface = g_value_get_object (value);
29988 if (interface != NULL)
29989 {
29990 g_warn_if_fail (IS_EVENT_LOG (interface));
29991 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
29992 }
29993 else
29994 {
29995 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.EventLog");
29996 }
29997 break;
29998
Norman James18998182015-10-11 21:54:53 -050029999 case 15:
Norman James362a80f2015-09-14 14:04:39 -050030000 interface = g_value_get_object (value);
30001 if (interface != NULL)
30002 {
30003 g_warn_if_fail (IS_FLASH (interface));
30004 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
30005 }
30006 else
30007 {
30008 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Flash");
30009 }
30010 break;
30011
Norman James18998182015-10-11 21:54:53 -050030012 case 16:
30013 interface = g_value_get_object (value);
30014 if (interface != NULL)
30015 {
30016 g_warn_if_fail (IS_FLASH_CONTROL (interface));
30017 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
30018 }
30019 else
30020 {
30021 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.FlashControl");
30022 }
30023 break;
30024
30025 case 17:
Norman James362a80f2015-09-14 14:04:39 -050030026 interface = g_value_get_object (value);
30027 if (interface != NULL)
30028 {
30029 g_warn_if_fail (IS_BUTTON (interface));
30030 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
30031 }
30032 else
30033 {
30034 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Button");
30035 }
30036 break;
30037
Norman James18998182015-10-11 21:54:53 -050030038 case 18:
Norman James362a80f2015-09-14 14:04:39 -050030039 interface = g_value_get_object (value);
30040 if (interface != NULL)
30041 {
30042 g_warn_if_fail (IS_LED (interface));
30043 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
30044 }
30045 else
30046 {
30047 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Led");
30048 }
30049 break;
30050
Norman James18998182015-10-11 21:54:53 -050030051 case 19:
Norman Jamesdbcffbd2015-10-06 16:53:06 -050030052 interface = g_value_get_object (value);
30053 if (interface != NULL)
30054 {
30055 g_warn_if_fail (IS_HOST_IPMI (interface));
30056 g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
30057 }
30058 else
30059 {
30060 g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.HostIpmi");
30061 }
30062 break;
30063
Norman James362a80f2015-09-14 14:04:39 -050030064 default:
30065 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
30066 break;
30067 }
30068}
30069
30070static void
30071object_skeleton_get_property (GObject *gobject,
30072 guint prop_id,
30073 GValue *value,
30074 GParamSpec *pspec)
30075{
30076 ObjectSkeleton *object = OBJECT_SKELETON (gobject);
30077 GDBusInterface *interface;
30078
30079 switch (prop_id)
30080 {
30081 case 1:
30082 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Occ");
30083 g_value_take_object (value, interface);
30084 break;
30085
30086 case 2:
30087 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan");
30088 g_value_take_object (value, interface);
30089 break;
30090
30091 case 3:
30092 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue");
30093 g_value_take_object (value, interface);
30094 break;
30095
30096 case 4:
Norman Jamesdfdaca92015-09-27 22:11:15 -050030097 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold");
Norman James362a80f2015-09-14 14:04:39 -050030098 g_value_take_object (value, interface);
30099 break;
30100
Norman James19e45912015-10-04 20:19:41 -050030101 case 5:
Norman Jamesdfdaca92015-09-27 22:11:15 -050030102 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
Norman James362a80f2015-09-14 14:04:39 -050030103 g_value_take_object (value, interface);
30104 break;
30105
Norman James19e45912015-10-04 20:19:41 -050030106 case 6:
Norman Jamesdfdaca92015-09-27 22:11:15 -050030107 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch");
Norman James362a80f2015-09-14 14:04:39 -050030108 g_value_take_object (value, interface);
30109 break;
30110
Norman James19e45912015-10-04 20:19:41 -050030111 case 7:
Norman Jamesdfdaca92015-09-27 22:11:15 -050030112 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process");
Norman James362a80f2015-09-14 14:04:39 -050030113 g_value_take_object (value, interface);
30114 break;
30115
Norman James19e45912015-10-04 20:19:41 -050030116 case 8:
Norman James18998182015-10-11 21:54:53 -050030117 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SharedResource");
Norman James362a80f2015-09-14 14:04:39 -050030118 g_value_take_object (value, interface);
30119 break;
30120
Norman James19e45912015-10-04 20:19:41 -050030121 case 9:
Norman James18998182015-10-11 21:54:53 -050030122 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control");
Norman James362a80f2015-09-14 14:04:39 -050030123 g_value_take_object (value, interface);
30124 break;
30125
Norman James19e45912015-10-04 20:19:41 -050030126 case 10:
Norman James18998182015-10-11 21:54:53 -050030127 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc");
Norman James362a80f2015-09-14 14:04:39 -050030128 g_value_take_object (value, interface);
30129 break;
30130
Norman James19e45912015-10-04 20:19:41 -050030131 case 11:
Norman James18998182015-10-11 21:54:53 -050030132 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
Norman James362a80f2015-09-14 14:04:39 -050030133 g_value_take_object (value, interface);
30134 break;
30135
Norman James19e45912015-10-04 20:19:41 -050030136 case 12:
Norman James18998182015-10-11 21:54:53 -050030137 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power");
Norman James362a80f2015-09-14 14:04:39 -050030138 g_value_take_object (value, interface);
30139 break;
30140
Norman James19e45912015-10-04 20:19:41 -050030141 case 13:
Norman James18998182015-10-11 21:54:53 -050030142 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog");
Norman James362a80f2015-09-14 14:04:39 -050030143 g_value_take_object (value, interface);
30144 break;
30145
Norman James19e45912015-10-04 20:19:41 -050030146 case 14:
Norman James18998182015-10-11 21:54:53 -050030147 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
Norman James362a80f2015-09-14 14:04:39 -050030148 g_value_take_object (value, interface);
30149 break;
30150
Norman James19e45912015-10-04 20:19:41 -050030151 case 15:
Norman James18998182015-10-11 21:54:53 -050030152 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash");
Norman Jamesdfdaca92015-09-27 22:11:15 -050030153 g_value_take_object (value, interface);
30154 break;
30155
Norman James19e45912015-10-04 20:19:41 -050030156 case 16:
Norman James18998182015-10-11 21:54:53 -050030157 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.FlashControl");
Norman James362a80f2015-09-14 14:04:39 -050030158 g_value_take_object (value, interface);
30159 break;
30160
Norman Jamesdbcffbd2015-10-06 16:53:06 -050030161 case 17:
Norman James18998182015-10-11 21:54:53 -050030162 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button");
30163 g_value_take_object (value, interface);
30164 break;
30165
30166 case 18:
30167 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led");
30168 g_value_take_object (value, interface);
30169 break;
30170
30171 case 19:
Norman Jamesdbcffbd2015-10-06 16:53:06 -050030172 interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.HostIpmi");
30173 g_value_take_object (value, interface);
30174 break;
30175
Norman James362a80f2015-09-14 14:04:39 -050030176 default:
30177 G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
30178 break;
30179 }
30180}
30181
30182static void
30183object_skeleton_class_init (ObjectSkeletonClass *klass)
30184{
30185 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
30186
30187 gobject_class->set_property = object_skeleton_set_property;
30188 gobject_class->get_property = object_skeleton_get_property;
30189
30190 g_object_class_override_property (gobject_class, 1, "occ");
30191 g_object_class_override_property (gobject_class, 2, "fan");
30192 g_object_class_override_property (gobject_class, 3, "sensor-value");
Norman James19e45912015-10-04 20:19:41 -050030193 g_object_class_override_property (gobject_class, 4, "sensor-threshold");
30194 g_object_class_override_property (gobject_class, 5, "sensor-i2c");
30195 g_object_class_override_property (gobject_class, 6, "sensor-match");
30196 g_object_class_override_property (gobject_class, 7, "process");
Norman James18998182015-10-11 21:54:53 -050030197 g_object_class_override_property (gobject_class, 8, "shared-resource");
30198 g_object_class_override_property (gobject_class, 9, "control");
30199 g_object_class_override_property (gobject_class, 10, "control-bmc");
30200 g_object_class_override_property (gobject_class, 11, "control-host");
30201 g_object_class_override_property (gobject_class, 12, "control-power");
30202 g_object_class_override_property (gobject_class, 13, "watchdog");
30203 g_object_class_override_property (gobject_class, 14, "event-log");
30204 g_object_class_override_property (gobject_class, 15, "flash");
30205 g_object_class_override_property (gobject_class, 16, "flash-control");
30206 g_object_class_override_property (gobject_class, 17, "button");
30207 g_object_class_override_property (gobject_class, 18, "led");
30208 g_object_class_override_property (gobject_class, 19, "host-ipmi");
Norman James362a80f2015-09-14 14:04:39 -050030209}
30210
30211/**
30212 * object_skeleton_new:
30213 * @object_path: An object path.
30214 *
30215 * Creates a new skeleton object.
30216 *
30217 * Returns: (transfer full): The skeleton object.
30218 */
30219ObjectSkeleton *
30220object_skeleton_new (const gchar *object_path)
30221{
30222 g_return_val_if_fail (g_variant_is_object_path (object_path), NULL);
30223 return OBJECT_SKELETON (g_object_new (TYPE_OBJECT_SKELETON, "g-object-path", object_path, NULL));
30224}
30225
30226/**
30227 * object_skeleton_set_occ:
30228 * @object: A #ObjectSkeleton.
30229 * @interface_: (allow-none): A #Occ or %NULL to clear the interface.
30230 *
30231 * Sets the #Occ instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Occ.top_of_page">org.openbmc.Occ</link> on @object.
30232 */
30233void object_skeleton_set_occ (ObjectSkeleton *object, Occ *interface_)
30234{
30235 g_object_set (G_OBJECT (object), "occ", interface_, NULL);
30236}
30237
30238/**
30239 * object_skeleton_set_fan:
30240 * @object: A #ObjectSkeleton.
30241 * @interface_: (allow-none): A #Fan or %NULL to clear the interface.
30242 *
30243 * 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.
30244 */
30245void object_skeleton_set_fan (ObjectSkeleton *object, Fan *interface_)
30246{
30247 g_object_set (G_OBJECT (object), "fan", interface_, NULL);
30248}
30249
30250/**
30251 * object_skeleton_set_sensor_value:
30252 * @object: A #ObjectSkeleton.
30253 * @interface_: (allow-none): A #SensorValue or %NULL to clear the interface.
30254 *
30255 * 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.
30256 */
30257void object_skeleton_set_sensor_value (ObjectSkeleton *object, SensorValue *interface_)
30258{
30259 g_object_set (G_OBJECT (object), "sensor-value", interface_, NULL);
30260}
30261
30262/**
30263 * object_skeleton_set_sensor_threshold:
30264 * @object: A #ObjectSkeleton.
30265 * @interface_: (allow-none): A #SensorThreshold or %NULL to clear the interface.
30266 *
30267 * 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.
30268 */
30269void object_skeleton_set_sensor_threshold (ObjectSkeleton *object, SensorThreshold *interface_)
30270{
30271 g_object_set (G_OBJECT (object), "sensor-threshold", interface_, NULL);
30272}
30273
30274/**
30275 * object_skeleton_set_sensor_i2c:
30276 * @object: A #ObjectSkeleton.
30277 * @interface_: (allow-none): A #SensorI2c or %NULL to clear the interface.
30278 *
30279 * 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.
30280 */
30281void object_skeleton_set_sensor_i2c (ObjectSkeleton *object, SensorI2c *interface_)
30282{
30283 g_object_set (G_OBJECT (object), "sensor-i2c", interface_, NULL);
30284}
30285
30286/**
30287 * object_skeleton_set_sensor_match:
30288 * @object: A #ObjectSkeleton.
30289 * @interface_: (allow-none): A #SensorMatch or %NULL to clear the interface.
30290 *
30291 * 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.
30292 */
30293void object_skeleton_set_sensor_match (ObjectSkeleton *object, SensorMatch *interface_)
30294{
30295 g_object_set (G_OBJECT (object), "sensor-match", interface_, NULL);
30296}
30297
30298/**
30299 * object_skeleton_set_process:
30300 * @object: A #ObjectSkeleton.
30301 * @interface_: (allow-none): A #Process or %NULL to clear the interface.
30302 *
30303 * 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.
30304 */
30305void object_skeleton_set_process (ObjectSkeleton *object, Process *interface_)
30306{
30307 g_object_set (G_OBJECT (object), "process", interface_, NULL);
30308}
30309
30310/**
Norman James18998182015-10-11 21:54:53 -050030311 * object_skeleton_set_shared_resource:
30312 * @object: A #ObjectSkeleton.
30313 * @interface_: (allow-none): A #SharedResource or %NULL to clear the interface.
30314 *
30315 * 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.
30316 */
30317void object_skeleton_set_shared_resource (ObjectSkeleton *object, SharedResource *interface_)
30318{
30319 g_object_set (G_OBJECT (object), "shared-resource", interface_, NULL);
30320}
30321
30322/**
Norman James362a80f2015-09-14 14:04:39 -050030323 * object_skeleton_set_control:
30324 * @object: A #ObjectSkeleton.
30325 * @interface_: (allow-none): A #Control or %NULL to clear the interface.
30326 *
30327 * 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.
30328 */
30329void object_skeleton_set_control (ObjectSkeleton *object, Control *interface_)
30330{
30331 g_object_set (G_OBJECT (object), "control", interface_, NULL);
30332}
30333
30334/**
30335 * object_skeleton_set_control_bmc:
30336 * @object: A #ObjectSkeleton.
30337 * @interface_: (allow-none): A #ControlBmc or %NULL to clear the interface.
30338 *
30339 * 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.
30340 */
30341void object_skeleton_set_control_bmc (ObjectSkeleton *object, ControlBmc *interface_)
30342{
30343 g_object_set (G_OBJECT (object), "control-bmc", interface_, NULL);
30344}
30345
30346/**
30347 * object_skeleton_set_control_host:
30348 * @object: A #ObjectSkeleton.
30349 * @interface_: (allow-none): A #ControlHost or %NULL to clear the interface.
30350 *
30351 * 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.
30352 */
30353void object_skeleton_set_control_host (ObjectSkeleton *object, ControlHost *interface_)
30354{
30355 g_object_set (G_OBJECT (object), "control-host", interface_, NULL);
30356}
30357
30358/**
30359 * object_skeleton_set_control_power:
30360 * @object: A #ObjectSkeleton.
30361 * @interface_: (allow-none): A #ControlPower or %NULL to clear the interface.
30362 *
30363 * 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.
30364 */
30365void object_skeleton_set_control_power (ObjectSkeleton *object, ControlPower *interface_)
30366{
30367 g_object_set (G_OBJECT (object), "control-power", interface_, NULL);
30368}
30369
30370/**
30371 * object_skeleton_set_watchdog:
30372 * @object: A #ObjectSkeleton.
30373 * @interface_: (allow-none): A #Watchdog or %NULL to clear the interface.
30374 *
30375 * 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.
30376 */
30377void object_skeleton_set_watchdog (ObjectSkeleton *object, Watchdog *interface_)
30378{
30379 g_object_set (G_OBJECT (object), "watchdog", interface_, NULL);
30380}
30381
30382/**
30383 * object_skeleton_set_event_log:
30384 * @object: A #ObjectSkeleton.
30385 * @interface_: (allow-none): A #EventLog or %NULL to clear the interface.
30386 *
30387 * 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.
30388 */
30389void object_skeleton_set_event_log (ObjectSkeleton *object, EventLog *interface_)
30390{
30391 g_object_set (G_OBJECT (object), "event-log", interface_, NULL);
30392}
30393
30394/**
30395 * object_skeleton_set_flash:
30396 * @object: A #ObjectSkeleton.
30397 * @interface_: (allow-none): A #Flash or %NULL to clear the interface.
30398 *
30399 * 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.
30400 */
30401void object_skeleton_set_flash (ObjectSkeleton *object, Flash *interface_)
30402{
30403 g_object_set (G_OBJECT (object), "flash", interface_, NULL);
30404}
30405
30406/**
Norman James18998182015-10-11 21:54:53 -050030407 * object_skeleton_set_flash_control:
30408 * @object: A #ObjectSkeleton.
30409 * @interface_: (allow-none): A #FlashControl or %NULL to clear the interface.
30410 *
30411 * 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.
30412 */
30413void object_skeleton_set_flash_control (ObjectSkeleton *object, FlashControl *interface_)
30414{
30415 g_object_set (G_OBJECT (object), "flash-control", interface_, NULL);
30416}
30417
30418/**
Norman James362a80f2015-09-14 14:04:39 -050030419 * object_skeleton_set_button:
30420 * @object: A #ObjectSkeleton.
30421 * @interface_: (allow-none): A #Button or %NULL to clear the interface.
30422 *
30423 * 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.
30424 */
30425void object_skeleton_set_button (ObjectSkeleton *object, Button *interface_)
30426{
30427 g_object_set (G_OBJECT (object), "button", interface_, NULL);
30428}
30429
30430/**
30431 * object_skeleton_set_led:
30432 * @object: A #ObjectSkeleton.
30433 * @interface_: (allow-none): A #Led or %NULL to clear the interface.
30434 *
30435 * 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.
30436 */
30437void object_skeleton_set_led (ObjectSkeleton *object, Led *interface_)
30438{
30439 g_object_set (G_OBJECT (object), "led", interface_, NULL);
30440}
30441
Norman Jamesdbcffbd2015-10-06 16:53:06 -050030442/**
30443 * object_skeleton_set_host_ipmi:
30444 * @object: A #ObjectSkeleton.
30445 * @interface_: (allow-none): A #HostIpmi or %NULL to clear the interface.
30446 *
30447 * 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.
30448 */
30449void object_skeleton_set_host_ipmi (ObjectSkeleton *object, HostIpmi *interface_)
30450{
30451 g_object_set (G_OBJECT (object), "host-ipmi", interface_, NULL);
30452}
30453
Norman James362a80f2015-09-14 14:04:39 -050030454
30455/* ------------------------------------------------------------------------
30456 * Code for ObjectManager client
30457 * ------------------------------------------------------------------------
30458 */
30459
30460/**
30461 * SECTION:ObjectManagerClient
30462 * @title: ObjectManagerClient
30463 * @short_description: Generated GDBusObjectManagerClient type
30464 *
30465 * This section contains a #GDBusObjectManagerClient that uses object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc.
30466 */
30467
30468/**
30469 * ObjectManagerClient:
30470 *
30471 * The #ObjectManagerClient structure contains only private data and should only be accessed using the provided API.
30472 */
30473
30474/**
30475 * ObjectManagerClientClass:
30476 * @parent_class: The parent class.
30477 *
30478 * Class structure for #ObjectManagerClient.
30479 */
30480
30481G_DEFINE_TYPE (ObjectManagerClient, object_manager_client, G_TYPE_DBUS_OBJECT_MANAGER_CLIENT);
30482
30483static void
30484object_manager_client_init (ObjectManagerClient *manager G_GNUC_UNUSED)
30485{
30486}
30487
30488static void
30489object_manager_client_class_init (ObjectManagerClientClass *klass G_GNUC_UNUSED)
30490{
30491}
30492
30493/**
30494 * object_manager_client_get_proxy_type:
30495 * @manager: A #GDBusObjectManagerClient.
30496 * @object_path: The object path of the remote object (unused).
30497 * @interface_name: (allow-none): Interface name of the remote object or %NULL to get the object proxy #GType.
30498 * @user_data: User data (unused).
30499 *
30500 * A #GDBusProxyTypeFunc that maps @interface_name to the generated #GDBusObjectProxy<!-- -->- and #GDBusProxy<!-- -->-derived types.
30501 *
30502 * Returns: A #GDBusProxy<!-- -->-derived #GType if @interface_name is not %NULL, otherwise the #GType for #ObjectProxy.
30503 */
30504GType
30505object_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)
30506{
30507 static gsize once_init_value = 0;
30508 static GHashTable *lookup_hash;
30509 GType ret;
30510
30511 if (interface_name == NULL)
30512 return TYPE_OBJECT_PROXY;
30513 if (g_once_init_enter (&once_init_value))
30514 {
30515 lookup_hash = g_hash_table_new (g_str_hash, g_str_equal);
30516 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Occ", GSIZE_TO_POINTER (TYPE_OCC_PROXY));
30517 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Fan", GSIZE_TO_POINTER (TYPE_FAN_PROXY));
30518 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorValue", GSIZE_TO_POINTER (TYPE_SENSOR_VALUE_PROXY));
Norman James362a80f2015-09-14 14:04:39 -050030519 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorThreshold", GSIZE_TO_POINTER (TYPE_SENSOR_THRESHOLD_PROXY));
30520 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorI2c", GSIZE_TO_POINTER (TYPE_SENSOR_I2C_PROXY));
30521 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorMatch", GSIZE_TO_POINTER (TYPE_SENSOR_MATCH_PROXY));
30522 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Process", GSIZE_TO_POINTER (TYPE_PROCESS_PROXY));
Norman James18998182015-10-11 21:54:53 -050030523 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SharedResource", GSIZE_TO_POINTER (TYPE_SHARED_RESOURCE_PROXY));
Norman James362a80f2015-09-14 14:04:39 -050030524 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Control", GSIZE_TO_POINTER (TYPE_CONTROL_PROXY));
30525 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.control.Bmc", GSIZE_TO_POINTER (TYPE_CONTROL_BMC_PROXY));
30526 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.control.Host", GSIZE_TO_POINTER (TYPE_CONTROL_HOST_PROXY));
30527 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.control.Power", GSIZE_TO_POINTER (TYPE_CONTROL_POWER_PROXY));
30528 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Watchdog", GSIZE_TO_POINTER (TYPE_WATCHDOG_PROXY));
30529 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.EventLog", GSIZE_TO_POINTER (TYPE_EVENT_LOG_PROXY));
30530 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Flash", GSIZE_TO_POINTER (TYPE_FLASH_PROXY));
Norman James18998182015-10-11 21:54:53 -050030531 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.FlashControl", GSIZE_TO_POINTER (TYPE_FLASH_CONTROL_PROXY));
Norman James362a80f2015-09-14 14:04:39 -050030532 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Button", GSIZE_TO_POINTER (TYPE_BUTTON_PROXY));
30533 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Led", GSIZE_TO_POINTER (TYPE_LED_PROXY));
Norman Jamesdbcffbd2015-10-06 16:53:06 -050030534 g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.HostIpmi", GSIZE_TO_POINTER (TYPE_HOST_IPMI_PROXY));
Norman James362a80f2015-09-14 14:04:39 -050030535 g_once_init_leave (&once_init_value, 1);
30536 }
30537 ret = (GType) GPOINTER_TO_SIZE (g_hash_table_lookup (lookup_hash, interface_name));
30538 if (ret == (GType) 0)
30539 ret = G_TYPE_DBUS_PROXY;
30540 return ret;
30541}
30542
30543/**
30544 * object_manager_client_new:
30545 * @connection: A #GDBusConnection.
30546 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
30547 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
30548 * @object_path: An object path.
30549 * @cancellable: (allow-none): A #GCancellable or %NULL.
30550 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
30551 * @user_data: User data to pass to @callback.
30552 *
30553 * Asynchronously creates #GDBusObjectManagerClient using object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new() for more details.
30554 *
30555 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
30556 * You can then call object_manager_client_new_finish() to get the result of the operation.
30557 *
30558 * See object_manager_client_new_sync() for the synchronous, blocking version of this constructor.
30559 */
30560void
30561object_manager_client_new (
30562 GDBusConnection *connection,
30563 GDBusObjectManagerClientFlags flags,
30564 const gchar *name,
30565 const gchar *object_path,
30566 GCancellable *cancellable,
30567 GAsyncReadyCallback callback,
30568 gpointer user_data)
30569{
30570 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);
30571}
30572
30573/**
30574 * object_manager_client_new_finish:
30575 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_manager_client_new().
30576 * @error: Return location for error or %NULL
30577 *
30578 * Finishes an operation started with object_manager_client_new().
30579 *
30580 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
30581 */
30582GDBusObjectManager *
30583object_manager_client_new_finish (
30584 GAsyncResult *res,
30585 GError **error)
30586{
30587 GObject *ret;
30588 GObject *source_object;
30589 source_object = g_async_result_get_source_object (res);
30590 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
30591 g_object_unref (source_object);
30592 if (ret != NULL)
30593 return G_DBUS_OBJECT_MANAGER (ret);
30594 else
30595 return NULL;
30596}
30597
30598/**
30599 * object_manager_client_new_sync:
30600 * @connection: A #GDBusConnection.
30601 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
30602 * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
30603 * @object_path: An object path.
30604 * @cancellable: (allow-none): A #GCancellable or %NULL.
30605 * @error: Return location for error or %NULL
30606 *
30607 * Synchronously creates #GDBusObjectManagerClient using object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new_sync() for more details.
30608 *
30609 * The calling thread is blocked until a reply is received.
30610 *
30611 * See object_manager_client_new() for the asynchronous version of this constructor.
30612 *
30613 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
30614 */
30615GDBusObjectManager *
30616object_manager_client_new_sync (
30617 GDBusConnection *connection,
30618 GDBusObjectManagerClientFlags flags,
30619 const gchar *name,
30620 const gchar *object_path,
30621 GCancellable *cancellable,
30622 GError **error)
30623{
30624 GInitable *ret;
30625 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);
30626 if (ret != NULL)
30627 return G_DBUS_OBJECT_MANAGER (ret);
30628 else
30629 return NULL;
30630}
30631
30632
30633/**
30634 * object_manager_client_new_for_bus:
30635 * @bus_type: A #GBusType.
30636 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
30637 * @name: A bus name (well-known or unique).
30638 * @object_path: An object path.
30639 * @cancellable: (allow-none): A #GCancellable or %NULL.
30640 * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
30641 * @user_data: User data to pass to @callback.
30642 *
30643 * Like object_manager_client_new() but takes a #GBusType instead of a #GDBusConnection.
30644 *
30645 * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
30646 * You can then call object_manager_client_new_for_bus_finish() to get the result of the operation.
30647 *
30648 * See object_manager_client_new_for_bus_sync() for the synchronous, blocking version of this constructor.
30649 */
30650void
30651object_manager_client_new_for_bus (
30652 GBusType bus_type,
30653 GDBusObjectManagerClientFlags flags,
30654 const gchar *name,
30655 const gchar *object_path,
30656 GCancellable *cancellable,
30657 GAsyncReadyCallback callback,
30658 gpointer user_data)
30659{
30660 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);
30661}
30662
30663/**
30664 * object_manager_client_new_for_bus_finish:
30665 * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_manager_client_new_for_bus().
30666 * @error: Return location for error or %NULL
30667 *
30668 * Finishes an operation started with object_manager_client_new_for_bus().
30669 *
30670 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
30671 */
30672GDBusObjectManager *
30673object_manager_client_new_for_bus_finish (
30674 GAsyncResult *res,
30675 GError **error)
30676{
30677 GObject *ret;
30678 GObject *source_object;
30679 source_object = g_async_result_get_source_object (res);
30680 ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
30681 g_object_unref (source_object);
30682 if (ret != NULL)
30683 return G_DBUS_OBJECT_MANAGER (ret);
30684 else
30685 return NULL;
30686}
30687
30688/**
30689 * object_manager_client_new_for_bus_sync:
30690 * @bus_type: A #GBusType.
30691 * @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
30692 * @name: A bus name (well-known or unique).
30693 * @object_path: An object path.
30694 * @cancellable: (allow-none): A #GCancellable or %NULL.
30695 * @error: Return location for error or %NULL
30696 *
30697 * Like object_manager_client_new_sync() but takes a #GBusType instead of a #GDBusConnection.
30698 *
30699 * The calling thread is blocked until a reply is received.
30700 *
30701 * See object_manager_client_new_for_bus() for the asynchronous version of this constructor.
30702 *
30703 * Returns: (transfer full) (type ObjectManagerClient): The constructed object manager client or %NULL if @error is set.
30704 */
30705GDBusObjectManager *
30706object_manager_client_new_for_bus_sync (
30707 GBusType bus_type,
30708 GDBusObjectManagerClientFlags flags,
30709 const gchar *name,
30710 const gchar *object_path,
30711 GCancellable *cancellable,
30712 GError **error)
30713{
30714 GInitable *ret;
30715 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);
30716 if (ret != NULL)
30717 return G_DBUS_OBJECT_MANAGER (ret);
30718 else
30719 return NULL;
30720}
30721
30722